[PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986

Aleksander Jan Bajkowski posted 1 patch 3 months, 3 weeks ago
There is a newer version of this series
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 5 +++++
drivers/net/wireless/mediatek/mt76/mt7915/init.c     | 3 ++-
drivers/net/wireless/mediatek/mt76/mt792x_core.c     | 3 +++
3 files changed, 10 insertions(+), 1 deletion(-)
[PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
Posted by Aleksander Jan Bajkowski 3 months, 3 weeks ago
Supports IPv4 and IPv6 TCP + UDP

In various tests between MT7986 and Intel BE200, I observed a performance
boost ranging from 2 to 12%, with an average of 5.5%.

I did the tests on the MT7915, MT7981, MT7986, and MT7921 variants. The
MT7922, MT7925, and MT799x are untouched for now and still have
checksumming disabled.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
[rebased and resolved conflicts]
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
---
 drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 5 +++++
 drivers/net/wireless/mediatek/mt76/mt7915/init.c     | 3 ++-
 drivers/net/wireless/mediatek/mt76/mt792x_core.c     | 3 +++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
index 0db00efe88b0..e31b3e7e2038 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
@@ -372,6 +372,9 @@ mt76_connac2_mac_write_txwi_8023(__le32 *txwi, struct sk_buff *skb,
 		wmm = sta->wme;
 	}
 
+	val = FIELD_PREP(MT_TXD0_ETH_TYPE_OFFSET, 10);
+	txwi[0] |= cpu_to_le32(val);
+
 	val = FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_802_3) |
 	      FIELD_PREP(MT_TXD1_TID, tid);
 
@@ -391,6 +394,8 @@ mt76_connac2_mac_write_txwi_8023(__le32 *txwi, struct sk_buff *skb,
 
 	val = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
 	      FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
+	if (skb->ip_summed == CHECKSUM_PARTIAL)
+		val |= MT_TXD7_IP_SUM | MT_TXD7_UDP_TCP_SUM;
 
 	txwi[7] |= cpu_to_le32(val);
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 5ea8b46e092e..a3bab240afb7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -359,7 +359,8 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
 	hw->queues = 4;
 	hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
 	hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
-	hw->netdev_features = NETIF_F_RXCSUM;
+	hw->netdev_features = NETIF_F_RXCSUM |
+			      NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 
 	if (mtk_wed_device_active(&mdev->mmio.wed))
 		hw->netdev_features |= NETIF_F_HW_TC;
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
index c0e56541a954..fe138d2e8e62 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
@@ -632,6 +632,9 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
 	}
 	hw->netdev_features = NETIF_F_RXCSUM;
 
+	if (is_mt7921(&dev->mt76))
+		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+
 	hw->radiotap_timestamp.units_pos =
 		IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
 
-- 
2.47.3
Re: [PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
Posted by kernel test robot 3 months, 2 weeks ago
Hi Aleksander,

kernel test robot noticed the following build warnings:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.18-rc2 next-20251017]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Aleksander-Jan-Bajkowski/wifi-mt76-add-tx-checksum-offload-for-mt7915-mt7921-mt7981-and-mt7986/20251019-235515
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20251019155316.3537185-1-olek2%40wp.pl
patch subject: [PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20251020/202510201250.Hpsrohca-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 754ebc6ebb9fb9fbee7aef33478c74ea74949853)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251020/202510201250.Hpsrohca-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510201250.Hpsrohca-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/mediatek/mt76/mt792x_core.c:636:19: warning: expression result unused [-Wunused-value]
     636 |                 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
         |                 ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +636 drivers/net/wireless/mediatek/mt76/mt792x_core.c

   618	
   619	int mt792x_init_wiphy(struct ieee80211_hw *hw)
   620	{
   621		struct mt792x_phy *phy = mt792x_hw_phy(hw);
   622		struct mt792x_dev *dev = phy->dev;
   623		struct wiphy *wiphy = hw->wiphy;
   624	
   625		hw->queues = 4;
   626		if (dev->has_eht) {
   627			hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_EHT;
   628			hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_EHT;
   629		} else {
   630			hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
   631			hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
   632		}
   633		hw->netdev_features = NETIF_F_RXCSUM;
   634	
   635		if (is_mt7921(&dev->mt76))
 > 636			NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
   637	
   638		hw->radiotap_timestamp.units_pos =
   639			IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
   640	
   641		phy->slottime = 9;
   642	
   643		hw->sta_data_size = sizeof(struct mt792x_sta);
   644		hw->vif_data_size = sizeof(struct mt792x_vif);
   645		hw->chanctx_data_size = sizeof(struct mt792x_chanctx);
   646	
   647		if (dev->fw_features & MT792x_FW_CAP_CNM) {
   648			wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
   649			wiphy->iface_combinations = if_comb_chanctx;
   650			wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_chanctx);
   651		} else {
   652			wiphy->flags &= ~WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
   653			wiphy->iface_combinations = if_comb;
   654			wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
   655		}
   656		wiphy->flags &= ~(WIPHY_FLAG_IBSS_RSN | WIPHY_FLAG_4ADDR_AP |
   657				  WIPHY_FLAG_4ADDR_STATION);
   658		wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
   659					 BIT(NL80211_IFTYPE_AP) |
   660					 BIT(NL80211_IFTYPE_P2P_CLIENT) |
   661					 BIT(NL80211_IFTYPE_P2P_GO) |
   662					 BIT(NL80211_IFTYPE_P2P_DEVICE);
   663		wiphy->max_remain_on_channel_duration = 5000;
   664		wiphy->max_scan_ie_len = MT76_CONNAC_SCAN_IE_LEN;
   665		wiphy->max_scan_ssids = 4;
   666		wiphy->max_sched_scan_plan_interval =
   667			MT76_CONNAC_MAX_TIME_SCHED_SCAN_INTERVAL;
   668		wiphy->max_sched_scan_ie_len = IEEE80211_MAX_DATA_LEN;
   669		wiphy->max_sched_scan_ssids = MT76_CONNAC_MAX_SCHED_SCAN_SSID;
   670		wiphy->max_match_sets = MT76_CONNAC_MAX_SCAN_MATCH;
   671		wiphy->max_sched_scan_reqs = 1;
   672		wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH |
   673				WIPHY_FLAG_SPLIT_SCAN_6GHZ;
   674	
   675		wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
   676				   NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
   677		wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_SET_SCAN_DWELL);
   678		wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
   679		wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_HT);
   680		wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_VHT);
   681		wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_HE);
   682		wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
   683		wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
   684	
   685		ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
   686		ieee80211_hw_set(hw, HAS_RATE_CONTROL);
   687		ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD);
   688		ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
   689		ieee80211_hw_set(hw, WANT_MONITOR_VIF);
   690		ieee80211_hw_set(hw, SUPPORTS_PS);
   691		ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
   692		ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
   693		ieee80211_hw_set(hw, CONNECTION_MONITOR);
   694		ieee80211_hw_set(hw, NO_VIRTUAL_MONITOR);
   695		ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
   696		ieee80211_hw_set(hw, SUPPORTS_ONLY_HE_MULTI_BSSID);
   697	
   698		if (is_mt7921(&dev->mt76)) {
   699			ieee80211_hw_set(hw, CHANCTX_STA_CSA);
   700		}
   701	
   702		if (dev->pm.enable)
   703			ieee80211_hw_set(hw, CONNECTION_MONITOR);
   704	
   705		hw->max_tx_fragments = 4;
   706	
   707		return 0;
   708	}
   709	EXPORT_SYMBOL_GPL(mt792x_init_wiphy);
   710	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
Posted by kernel test robot 3 months, 3 weeks ago
Hi Aleksander,

kernel test robot noticed the following build warnings:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.18-rc1 next-20251017]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Aleksander-Jan-Bajkowski/wifi-mt76-add-tx-checksum-offload-for-mt7915-mt7921-mt7981-and-mt7986/20251019-235515
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20251019155316.3537185-1-olek2%40wp.pl
patch subject: [PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
config: i386-buildonly-randconfig-003-20251019 (https://download.01.org/0day-ci/archive/20251020/202510200105.T000lujD-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251020/202510200105.T000lujD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510200105.T000lujD-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/skbuff.h:29,
                    from drivers/net/wireless/mediatek/mt76/mt76.h:12,
                    from drivers/net/wireless/mediatek/mt76/mt76_connac.h:7,
                    from drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h:7,
                    from drivers/net/wireless/mediatek/mt76/mt792x.h:10,
                    from drivers/net/wireless/mediatek/mt76/mt792x_core.c:7:
   drivers/net/wireless/mediatek/mt76/mt792x_core.c: In function 'mt792x_init_wiphy':
>> include/linux/netdev_features.h:104:33: warning: statement with no effect [-Wunused-value]
     104 | #define __NETIF_F_BIT(bit)      ((netdev_features_t)1 << (bit))
         |                                 ^
   include/linux/netdev_features.h:105:33: note: in expansion of macro '__NETIF_F_BIT'
     105 | #define __NETIF_F(name)         __NETIF_F_BIT(NETIF_F_##name##_BIT)
         |                                 ^~~~~~~~~~~~~
   include/linux/netdev_features.h:119:33: note: in expansion of macro '__NETIF_F'
     119 | #define NETIF_F_IP_CSUM         __NETIF_F(IP_CSUM)
         |                                 ^~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt792x_core.c:636:17: note: in expansion of macro 'NETIF_F_IP_CSUM'
     636 |                 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
         |                 ^~~~~~~~~~~~~~~


vim +104 include/linux/netdev_features.h

a19f2a6df28e0c Michał Mirosław 2011-11-15  102  
a19f2a6df28e0c Michał Mirosław 2011-11-15  103  /* copy'n'paste compression ;) */
a19f2a6df28e0c Michał Mirosław 2011-11-15 @104  #define __NETIF_F_BIT(bit)	((netdev_features_t)1 << (bit))
a19f2a6df28e0c Michał Mirosław 2011-11-15  105  #define __NETIF_F(name)		__NETIF_F_BIT(NETIF_F_##name##_BIT)
a19f2a6df28e0c Michał Mirosław 2011-11-15  106  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
Posted by Ben Greear 3 months, 3 weeks ago
On 10/19/25 08:51, Aleksander Jan Bajkowski wrote:
> Supports IPv4 and IPv6 TCP + UDP
> 
> In various tests between MT7986 and Intel BE200, I observed a performance
> boost ranging from 2 to 12%, with an average of 5.5%.
> 
> I did the tests on the MT7915, MT7981, MT7986, and MT7921 variants. The
> MT7922, MT7925, and MT799x are untouched for now and still have
> checksumming disabled.

At least with  7996, tcp csum only worked on the first few vdevs
created in our testing, so we had to add logic to disable that flag
on subsequent vdevs.

Have you tried creating a bunch of station and/or vap vdevs to see if
all of them can still transmit TCP traffic?

Thanks,
Ben


> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> [rebased and resolved conflicts]
> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
> ---
>   drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 5 +++++
>   drivers/net/wireless/mediatek/mt76/mt7915/init.c     | 3 ++-
>   drivers/net/wireless/mediatek/mt76/mt792x_core.c     | 3 +++
>   3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
> index 0db00efe88b0..e31b3e7e2038 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
> @@ -372,6 +372,9 @@ mt76_connac2_mac_write_txwi_8023(__le32 *txwi, struct sk_buff *skb,
>   		wmm = sta->wme;
>   	}
>   
> +	val = FIELD_PREP(MT_TXD0_ETH_TYPE_OFFSET, 10);
> +	txwi[0] |= cpu_to_le32(val);
> +
>   	val = FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_802_3) |
>   	      FIELD_PREP(MT_TXD1_TID, tid);
>   
> @@ -391,6 +394,8 @@ mt76_connac2_mac_write_txwi_8023(__le32 *txwi, struct sk_buff *skb,
>   
>   	val = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
>   	      FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
> +	if (skb->ip_summed == CHECKSUM_PARTIAL)
> +		val |= MT_TXD7_IP_SUM | MT_TXD7_UDP_TCP_SUM;
>   
>   	txwi[7] |= cpu_to_le32(val);
>   }
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> index 5ea8b46e092e..a3bab240afb7 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> @@ -359,7 +359,8 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
>   	hw->queues = 4;
>   	hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
>   	hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
> -	hw->netdev_features = NETIF_F_RXCSUM;
> +	hw->netdev_features = NETIF_F_RXCSUM |
> +			      NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
>   
>   	if (mtk_wed_device_active(&mdev->mmio.wed))
>   		hw->netdev_features |= NETIF_F_HW_TC;
> diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
> index c0e56541a954..fe138d2e8e62 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
> @@ -632,6 +632,9 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
>   	}
>   	hw->netdev_features = NETIF_F_RXCSUM;
>   
> +	if (is_mt7921(&dev->mt76))
> +		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
> +
>   	hw->radiotap_timestamp.units_pos =
>   		IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
>   

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com
Re: [PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
Posted by Aleksander Jan Bajkowski 3 months, 3 weeks ago
Hi Ben,

On 10/19/25 18:26, Ben Greear wrote:
> On 10/19/25 08:51, Aleksander Jan Bajkowski wrote:
>> Supports IPv4 and IPv6 TCP + UDP
>>
>> In various tests between MT7986 and Intel BE200, I observed a 
>> performance
>> boost ranging from 2 to 12%, with an average of 5.5%.
>>
>> I did the tests on the MT7915, MT7981, MT7986, and MT7921 variants. The
>> MT7922, MT7925, and MT799x are untouched for now and still have
>> checksumming disabled.
>
> At least with  7996, tcp csum only worked on the first few vdevs
> created in our testing, so we had to add logic to disable that flag
> on subsequent vdevs.
>
> Have you tried creating a bunch of station and/or vap vdevs to see if
> all of them can still transmit TCP traffic?
>
>
Thanks for the useful information. On all tested devices, I had a single
AP configured per device. I will try to create several APs for each device.

I also have a router with MT7996. A quick test shows that checksum
offload doesn't work on this router. MT7996 is visible in the system
as a single DBDC device. I have 3 APs configured there. Each on a
separate band (2.4/5/6 GHz).

Best regards,
Aleksander

Re: [PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
Posted by Ben Greear 3 months, 2 weeks ago
On 10/19/25 09:43, Aleksander Jan Bajkowski wrote:
> Hi Ben,
> 
> On 10/19/25 18:26, Ben Greear wrote:
>> On 10/19/25 08:51, Aleksander Jan Bajkowski wrote:
>>> Supports IPv4 and IPv6 TCP + UDP
>>>
>>> In various tests between MT7986 and Intel BE200, I observed a performance
>>> boost ranging from 2 to 12%, with an average of 5.5%.
>>>
>>> I did the tests on the MT7915, MT7981, MT7986, and MT7921 variants. The
>>> MT7922, MT7925, and MT799x are untouched for now and still have
>>> checksumming disabled.
>>
>> At least with  7996, tcp csum only worked on the first few vdevs
>> created in our testing, so we had to add logic to disable that flag
>> on subsequent vdevs.
>>
>> Have you tried creating a bunch of station and/or vap vdevs to see if
>> all of them can still transmit TCP traffic?
>>
>>
> Thanks for the useful information. On all tested devices, I had a single
> AP configured per device. I will try to create several APs for each device.

We can try it out as well.

> I also have a router with MT7996. A quick test shows that checksum
> offload doesn't work on this router. MT7996 is visible in the system
> as a single DBDC device. I have 3 APs configured there. Each on a
> separate band (2.4/5/6 GHz).
> 
> Best regards,
> Aleksander

We have it working on 7996, but the patch is tangled in some other changes we made
with how wcid and such are allocated.  We are still cleaning and testing patches
on top of Felix's tree, should have something to post sometime soon.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

Re: [PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
Posted by Aleksander Jan Bajkowski 3 months, 2 weeks ago
On 10/19/25 20:18, Ben Greear wrote:
> On 10/19/25 09:43, Aleksander Jan Bajkowski wrote:
>> Hi Ben,
>>
>> On 10/19/25 18:26, Ben Greear wrote:
>>> On 10/19/25 08:51, Aleksander Jan Bajkowski wrote:
>>>> Supports IPv4 and IPv6 TCP + UDP
>>>>
>>>> In various tests between MT7986 and Intel BE200, I observed a 
>>>> performance
>>>> boost ranging from 2 to 12%, with an average of 5.5%.
>>>>
>>>> I did the tests on the MT7915, MT7981, MT7986, and MT7921 variants. 
>>>> The
>>>> MT7922, MT7925, and MT799x are untouched for now and still have
>>>> checksumming disabled.
>>>
>>> At least with  7996, tcp csum only worked on the first few vdevs
>>> created in our testing, so we had to add logic to disable that flag
>>> on subsequent vdevs.
>>>
>>> Have you tried creating a bunch of station and/or vap vdevs to see if
>>> all of them can still transmit TCP traffic?
>>>
>>>
>> Thanks for the useful information. On all tested devices, I had a single
>> AP configured per device. I will try to create several APs for each 
>> device.
>
> We can try it out as well.


I've tested multiple VAPs (15x AP + 1x station). It seems that everything
works fine on MT7915, MT7981, and MT7986. By connecting to the first
and last AP, tx checksum offload works correctly. MT7921 only supports
a single VAP, so I skipped testing it.

>
>> I also have a router with MT7996. A quick test shows that checksum
>> offload doesn't work on this router. MT7996 is visible in the system
>> as a single DBDC device. I have 3 APs configured there. Each on a
>> separate band (2.4/5/6 GHz).
>>
>> Best regards,
>> Aleksander
>
> We have it working on 7996, but the patch is tangled in some other 
> changes we made
> with how wcid and such are allocated.  We are still cleaning and 
> testing patches
> on top of Felix's tree, should have something to post sometime soon.
>

Maybe only the MT7996 is affected?
Re: [PATCH] wifi: mt76: add tx checksum offload for mt7915, mt7921, mt7981 and mt7986
Posted by Christophe JAILLET 3 months, 3 weeks ago
Le 19/10/2025 à 17:51, Aleksander Jan Bajkowski a écrit :
> Supports IPv4 and IPv6 TCP + UDP
> 
> In various tests between MT7986 and Intel BE200, I observed a performance
> boost ranging from 2 to 12%, with an average of 5.5%.
> 
> I did the tests on the MT7915, MT7981, MT7986, and MT7921 variants. The
> MT7922, MT7925, and MT799x are untouched for now and still have
> checksumming disabled.
> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> [rebased and resolved conflicts]
> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
> ---
>   drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 5 +++++
>   drivers/net/wireless/mediatek/mt76/mt7915/init.c     | 3 ++-
>   drivers/net/wireless/mediatek/mt76/mt792x_core.c     | 3 +++
>   3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
> index 0db00efe88b0..e31b3e7e2038 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
> @@ -372,6 +372,9 @@ mt76_connac2_mac_write_txwi_8023(__le32 *txwi, struct sk_buff *skb,
>   		wmm = sta->wme;
>   	}
>   
> +	val = FIELD_PREP(MT_TXD0_ETH_TYPE_OFFSET, 10);
> +	txwi[0] |= cpu_to_le32(val);
> +
>   	val = FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_802_3) |
>   	      FIELD_PREP(MT_TXD1_TID, tid);
>   
> @@ -391,6 +394,8 @@ mt76_connac2_mac_write_txwi_8023(__le32 *txwi, struct sk_buff *skb,
>   
>   	val = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
>   	      FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
> +	if (skb->ip_summed == CHECKSUM_PARTIAL)
> +		val |= MT_TXD7_IP_SUM | MT_TXD7_UDP_TCP_SUM;
>   
>   	txwi[7] |= cpu_to_le32(val);
>   }
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> index 5ea8b46e092e..a3bab240afb7 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> @@ -359,7 +359,8 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
>   	hw->queues = 4;
>   	hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
>   	hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
> -	hw->netdev_features = NETIF_F_RXCSUM;
> +	hw->netdev_features = NETIF_F_RXCSUM |
> +			      NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
>   
>   	if (mtk_wed_device_active(&mdev->mmio.wed))
>   		hw->netdev_features |= NETIF_F_HW_TC;
> diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
> index c0e56541a954..fe138d2e8e62 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
> @@ -632,6 +632,9 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
>   	}
>   	hw->netdev_features = NETIF_F_RXCSUM;
>   
> +	if (is_mt7921(&dev->mt76))
> +		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;

This looks strange.

Maybe:
	netdev_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
?

CJ

> +
>   	hw->radiotap_timestamp.units_pos =
>   		IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
>