wifi: ath12k: set OFFLOAD_ENCAP_4ADDR on interface bringup
PATCH v2 1/1 wifi: ath12k: set OFFLOAD_ENCAP_4ADDR on interface bringup
I tried the WDS support added in https://lore.kernel.org/linux-wireless/[email protected]/.
With a ath12k WDS client, the frames received by the WDS AP had some extra bytes in the beginning of the frame.
My understanding of the problem:
1 - this is a WDS client, 4 address mode.
2 - on interface bringup (ath12k_mac_op_add_interface), it has OFFLOAD_ENCAP_ENABLED but not OFFLOAD_ENCAP_4ADDR.
it picks software encap for this interface and it doesn't get rechecked later.
so later on, it software encaps the ethernet frames and sends the resulting wifi frames to the vdev
3 - on vdev bringup (ath12k_mac_vdev_create -> ath12k_mac_update_vif_offload), it has OFFLOAD_ENCAP_ENABLED.
so it expects to receive ethernet or "native wifi" frames.
it also sets OFFLOAD_ENCAP_4ADDR but it's too late here
4 - the wifi frame encapsulated according to (2) gets passed to the vdev marked as "native wifi".
it already had a QOS field in it, the vdev adds an extra one when doing the hardware encap
This fixes it by setting OFFLOAD_ENCAP_4ADDR during interface bringup.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
---
Changes in v2:
- add explicit check for station and AP for consistency with ath12k_mac_update_vif_offload()
- clarify problem description slightly
- Link to v1: https://lore.kernel.org/linux-wireless/[email protected]/
--- drivers/net/wireless/ath/ath12k/mac.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/mac.c +7 -1
@@ -10276,7 +10276,8 @@ static void ath12k_mac_update_vif_offload(struct ath12k_link_vif *arvif)if (ret) {ath12k_warn (ab,"failed to set vdev %d tx encap mode: %d\n" , arvif->vdev_id, ret); - vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED ; + vif->offload_flags &= ~(IEEE80211_OFFLOAD_ENCAP_ENABLED | +IEEE80211_OFFLOAD_ENCAP_4ADDR ); }if (vif->offload_flags &IEEE80211_OFFLOAD_ENCAP_ENABLED )
@@ -10940,6 +10941,11 @@ int ath12k_mac_op_add_interface(struct ieee80211_hw *hw, vif->driver_flags |=IEEE80211_VIF_SUPPORTS_UAPSD ; +if ((vif->type ==NL80211_IFTYPE_STATION || + vif->type ==NL80211_IFTYPE_AP ) && + (vif->offload_flags &IEEE80211_OFFLOAD_ENCAP_ENABLED )) + vif->offload_flags |=IEEE80211_OFFLOAD_ENCAP_4ADDR ; +ath12k_mac_determine_vdev_type (vif, ahvif);for_each_ar (ah, ar, i) {
Signature · 1 line
2.56.1
Am 16.11.2026 um 02:59 schrieb Ronald Ouyang:
Quoted 44 lines
I tried the WDS support added in https://lore.kernel.org/linux-wireless/[email protected]/.
With a ath12k WDS client, the frames received by the WDS AP had some extra bytes in the beginning of the frame.My understanding of the problem:
1 - this is a WDS client, 4 address mode.
2 - on interface bringup (ath12k_mac_op_add_interface), it hasOFFLOAD_ENCAP_ENABLEDbut notOFFLOAD_ENCAP_4ADDR.
it picks software encap for this interface and it doesn't get rechecked later.
so later on, it software encaps the ethernet frames and sends the resulting wifi frames to the vdev
3 - on vdev bringup (ath12k_mac_vdev_create->ath12k_mac_update_vif_offload), it hasOFFLOAD_ENCAP_ENABLED.
so it expects to receive ethernet or "native wifi" frames.
it also setsOFFLOAD_ENCAP_4ADDRbut it's too late here
4 - the wifi frame encapsulated according to (2) gets passed to the vdev marked as "native wifi".
it already had a QOS field in it, the vdev adds an extra one when doing the hardware encapThis fixes it by setting
OFFLOAD_ENCAP_4ADDRduring interface bringup.Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Fixes 729cad3c3c9e ("wifi: ath12k: Add 4-address mode support for eth offload")Signed-off-by Ronald Ouyang <[email protected]>---
Changes in v2:
- add explicit check for station and AP for consistency withath12k_mac_update_vif_offload()
- clarify problem description slightly
- Link to v1: https://lore.kernel.org/linux-wireless/[email protected]/--- drivers/net/wireless/ath/ath12k/mac.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/wireless/ath/ath12k/mac.c +2
-1@@ -10276,7 +10276,8 @@ static void ath12k_mac_update_vif_offload(struct ath12k_link_vif *arvif)if (ret) {ath12k_warn (ab,"failed to set vdev %d tx encap mode: %d\n" , arvif->vdev_id, ret); - vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED ; + vif->offload_flags &= ~(IEEE80211_OFFLOAD_ENCAP_ENABLED | +IEEE80211_OFFLOAD_ENCAP_4ADDR ); }if (vif->offload_flags &IEEE80211_OFFLOAD_ENCAP_ENABLED )
drivers/net/wireless/ath/ath12k/mac.c int ath12k_mac_op_add_interface(struct ieee80211_hw *hw, · line 10948
Quoted 8 lines
drivers/net/wireless/ath/ath12k/mac.c +5
-0@@ -10940,6 +10941,11 @@ int ath12k_mac_op_add_interface(struct ieee80211_hw *hw, vif->driver_flags |=IEEE80211_VIF_SUPPORTS_UAPSD ; +if ((vif->type ==NL80211_IFTYPE_STATION || + vif->type ==NL80211_IFTYPE_AP ) && + (vif->offload_flags &IEEE80211_OFFLOAD_ENCAP_ENABLED )) + vif->offload_flags |=IEEE80211_OFFLOAD_ENCAP_4ADDR ; +
isnt the correct iftype AP_VLAN for AP with 4addr frame support enabled?
Sebastian
Quoted 3 lines
drivers/net/wireless/ath/ath12k/mac.c +0
-0ath12k_mac_determine_vdev_type (vif, ahvif);for_each_ar (ah, ar, i) {