mac80211: drop frames with unexpected DS bits from fast-rx to slow path
PATCH 1/4 mac80211: drop frames with unexpected DS bits from fast-rx to slow path
Fixes rx for 4-addr packets in AP mode
--- net/mac80211/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/rx.c +1 -1
@@ -3937,7 +3937,7 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,if ((hdr->frame_control &cpu_to_le16 (IEEE80211_FCTL_FROMDS |IEEE80211_FCTL_TODS )) != fast_rx->expected_ds_bits) - goto drop; +return false;/* assign the key to drop unencrypted frames (later) * and strip the IV/MIC if necessary
Signature · 1 line
2.14.2
PATCH 2/4 mac80211: support AP 4-addr mode fast-rx
--- net/mac80211/rx.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/mac80211/rx.c +9 -0
@@ -3783,6 +3783,15 @@ void ieee80211_check_fast_rx(struct sta_info *sta) !(sdata->flags &IEEE80211_SDATA_DONT_BRIDGE_PACKETS ) && (sdata->vif.type !=NL80211_IFTYPE_AP_VLAN || !sdata->u.vlan.sta); + +if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN && + sdata->u.vlan.sta) { + fastrx.expected_ds_bits |= +cpu_to_le16 (IEEE80211_FCTL_FROMDS ); + fastrx.sa_offs = offsetof(struct ieee80211_hdr , addr4); + fastrx.internal_forward =0 ; + } +break ;default : goto clear;
Signature · 1 line
2.14.2
PATCH 3/4 mac80211: support fast-rx with incompatible PS capabilities when PS is disabled
In reply to Felix FietkauWhen powersave is disabled for the interface, we can do fast-rx anyway.
--- net/mac80211/cfg.c | 1 + net/mac80211/rx.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-)
net/mac80211/cfg.c +1 -0
@@ -2685,6 +2685,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,ieee80211_recalc_ps (local);ieee80211_recalc_ps_vif (sdata); +ieee80211_check_fast_rx_iface (sdata);return 0 ; }
net/mac80211/rx.c +11 -6
@@ -3750,12 +3750,7 @@ void ieee80211_check_fast_rx(struct sta_info *sta)/* 4-addr is harder to deal with, later maybe */ if (sdata->u.mgd.use_4addr) goto clear; -/* software powersave is a huge mess, avoid all of it */ -if (ieee80211_hw_check (&local->hw,PS_NULLFUNC_STACK )) - goto clear; -if (ieee80211_hw_check (&local->hw,SUPPORTS_PS ) && - !ieee80211_hw_check (&local->hw,SUPPORTS_DYNAMIC_PS )) - goto clear; +if (sta->sta.tdls) { fastrx.da_offs = offsetof(struct ieee80211_hdr , addr1); fastrx.sa_offs = offsetof(struct ieee80211_hdr , addr2);
@@ -3767,6 +3762,16 @@ void ieee80211_check_fast_rx(struct sta_info *sta) fastrx.expected_ds_bits =cpu_to_le16 (IEEE80211_FCTL_FROMDS ); } + +if (!sdata->u.mgd.powersave) +break ; + +/* software powersave is a huge mess, avoid all of it */ +if (ieee80211_hw_check (&local->hw,PS_NULLFUNC_STACK )) + goto clear; +if (ieee80211_hw_check (&local->hw,SUPPORTS_PS ) && + !ieee80211_hw_check (&local->hw,SUPPORTS_DYNAMIC_PS )) + goto clear;break ;case NL80211_IFTYPE_AP_VLAN :case NL80211_IFTYPE_AP :
Signature · 1 line
2.14.2
Re: [PATCH 3/4] mac80211: support fast-rx with incompatible PS capabilities when PS is disabled
I've applied 1 to mac80211, and 2/3 to mac80211-next, so please only resend 4, unless you can convince me it's OK as is :-)
johannes
PATCH 4/4 mac80211: support station 4-addr mode fast-rx
In reply to Felix Fietkau--- net/mac80211/cfg.c | 2 -- net/mac80211/rx.c | 11 +++++++---- 2 files changed, 7 insertions(+), 6 deletions(-)
net/mac80211/cfg.c +0 -2
@@ -160,7 +160,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy,if (type ==NL80211_IFTYPE_AP_VLAN && params && params->use_4addr ==0 ) {RCU_INIT_POINTER (sdata->u.vlan.sta,NULL ); -ieee80211_check_fast_rx_iface (sdata); }else if (type ==NL80211_IFTYPE_STATION && params && params->use_4addr >=0 ) { sdata->u.mgd.use_4addr = params->use_4addr;
@@ -1575,7 +1574,6 @@ static int ieee80211_change_station(struct wiphy *wiphy, }rcu_assign_pointer (vlansdata->u.vlan.sta, sta); -__ieee80211_check_fast_rx_iface (vlansdata); } if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
net/mac80211/rx.c +7 -4
@@ -3747,10 +3747,6 @@ void ieee80211_check_fast_rx(struct sta_info *sta)switch (sdata->vif.type) {case NL80211_IFTYPE_STATION : -/* 4-addr is harder to deal with, later maybe */ -if (sdata->u.mgd.use_4addr) - goto clear; -if (sta->sta.tdls) { fastrx.da_offs = offsetof(struct ieee80211_hdr , addr1); fastrx.sa_offs = offsetof(struct ieee80211_hdr , addr2);
@@ -3763,6 +3759,13 @@ void ieee80211_check_fast_rx(struct sta_info *sta)cpu_to_le16 (IEEE80211_FCTL_FROMDS ); } +if (sdata->u.mgd.use_4addr && !sta->sta.tdls) { + fastrx.expected_ds_bits |= +cpu_to_le16 (IEEE80211_FCTL_TODS ); + fastrx.da_offs = offsetof(struct ieee80211_hdr , addr3); + fastrx.sa_offs = offsetof(struct ieee80211_hdr , addr4); + } +if (!sdata->u.mgd.powersave)break ;
Signature · 1 line
2.14.2
Johannes Berg
maintainerRe: [PATCH 4/4] mac80211: support station 4-addr mode fast-rx
Quoted 19 lines · Felix Fietkau
Signed-off-by Felix Fietkau <[email protected]>--- net/mac80211/cfg.c | 2 -- net/mac80211/rx.c | 11 +++++++---- 2 files changed, 7 insertions(+), 6 deletions(-)net/mac80211/cfg.c +0
-1@@ -160,7 +160,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy,if (type ==NL80211_IFTYPE_AP_VLAN && params && params->use_4addr ==0 ) {RCU_INIT_POINTER (sdata->u.vlan.sta,NULL ); -ieee80211_check_fast_rx_iface (sdata); }else if (type ==NL80211_IFTYPE_STATION && params && params->use_4addr >=0 ) { sdata->u.mgd.use_4addr = params->use_4addr;
net/mac80211/cfg.c static int ieee80211_change_station(struct wiphy *wiphy, · line 1579
Quoted 7 lines
net/mac80211/cfg.c +0
-1@@ -1575,7 +1574,6 @@ static int ieee80211_change_station(struct wiphy *wiphy, }rcu_assign_pointer (vlansdata->u.vlan.sta, sta); -__ieee80211_check_fast_rx_iface (vlansdata); } if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
I'm not convinced this is right - don't you have to recheck to modify the station data? Otherwise you'd just drop all the frames to the slowpath again due to the first patch in the series, no?
johannes
Re: [PATCH 4/4] mac80211: support station 4-addr mode fast-rx
Quoted 26 lines · Johannes Berg
Quoted 25 lines · Felix Fietkau
Signed-off-by Felix Fietkau <[email protected]>--- net/mac80211/cfg.c | 2 -- net/mac80211/rx.c | 11 +++++++---- 2 files changed, 7 insertions(+), 6 deletions(-)net/mac80211/cfg.c +0
-2@@ -160,7 +160,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy,if (type ==NL80211_IFTYPE_AP_VLAN && params && params->use_4addr ==0 ) {RCU_INIT_POINTER (sdata->u.vlan.sta,NULL ); -ieee80211_check_fast_rx_iface (sdata); }else if (type ==NL80211_IFTYPE_STATION && params && params->use_4addr >=0 ) { sdata->u.mgd.use_4addr = params->use_4addr;@@ -1575,7 +1574,6 @@ static int ieee80211_change_station(struct wiphy *wiphy, }rcu_assign_pointer (vlansdata->u.vlan.sta, sta); -__ieee80211_check_fast_rx_iface (vlansdata); }
Quoted 5 lines
net/mac80211/cfg.c static int ieee80211_change_station(struct wiphy *wiphy, · line 1579
Quoted 1 line
net/mac80211/cfg.c +0
-0if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&I'm not convinced this is right - don't you have to recheck to modify
the station data? Otherwise you'd just drop all the frames to the
slowpath again due to the first patch in the series, no?You're right and I forgot to take those out before sending. Will
resubmit this one.
Thanks,
- Felix