diff mbox series

[v2] wifi: mac80211: fix decapsulation offload flag for WDS interface

Message ID 20220916142707.28478-1-howard-yh.hsu@mediatek.com
State New
Headers show
Series [v2] wifi: mac80211: fix decapsulation offload flag for WDS interface | expand

Commit Message

Howard-YH Hsu (許育豪) Sept. 16, 2022, 2:27 p.m. UTC
Rx decapsulation offload cannot be enabled on WDS interface since its
offload_flags is not configured. Its offload_flags shall be configured
by checking hardware information.

Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
---
v2:
   - Configure offload_flags in ieee80211_check_fast_rx
   - Update commit message
---
 net/mac80211/rx.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Felix Fietkau Sept. 16, 2022, 3:28 p.m. UTC | #1
On 16.09.22 16:27, Howard Hsu wrote:
> Rx decapsulation offload cannot be enabled on WDS interface since its
> offload_flags is not configured. Its offload_flags shall be configured
> by checking hardware information.
> 
> Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
> ---
> v2:
>     - Configure offload_flags in ieee80211_check_fast_rx
>     - Update commit message
> ---
>   net/mac80211/rx.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index a57811372027..0d8cfe34b088 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -4433,6 +4433,16 @@ void ieee80211_check_fast_rx(struct sta_info *sta)
>   	if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED))
>   		goto clear;
>   
> +	if (ieee80211_hw_check(&local->hw, SUPPORTS_RX_DECAP_OFFLOAD)) {
> +		sdata->vif.offload_flags |= IEEE80211_OFFLOAD_DECAP_ENABLED;
> +
> +		if (local->monitors &&
> +		    !ieee80211_hw_check(&local->hw, SUPPORTS_CONC_MON_RX_DECAP))
> +			sdata->vif.offload_flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED;
> +	} else {
> +		sdata->vif.offload_flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED;
> +	}
I don't think you should be messing with decap flags here.
Further down there's a piece of code that does:

     offload = assign &&
           (sdata->vif.offload_flags & IEEE80211_OFFLOAD_DECAP_ENABLED);

Please change the code so that it gets the sdata from sdata->bss and 
check sdata_bss->vif.offload_flags.

- Felix
diff mbox series

Patch

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index a57811372027..0d8cfe34b088 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -4433,6 +4433,16 @@  void ieee80211_check_fast_rx(struct sta_info *sta)
 	if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED))
 		goto clear;
 
+	if (ieee80211_hw_check(&local->hw, SUPPORTS_RX_DECAP_OFFLOAD)) {
+		sdata->vif.offload_flags |= IEEE80211_OFFLOAD_DECAP_ENABLED;
+
+		if (local->monitors &&
+		    !ieee80211_hw_check(&local->hw, SUPPORTS_CONC_MON_RX_DECAP))
+			sdata->vif.offload_flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED;
+	} else {
+		sdata->vif.offload_flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED;
+	}
+
 	rcu_read_lock();
 	key = rcu_dereference(sta->ptk[sta->ptk_idx]);
 	if (!key)