diff mbox

[4/4] mac80211: support station 4-addr mode fast-rx

Message ID 20180223090606.55726-4-nbd@nbd.name (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show

Commit Message

Felix Fietkau Feb. 23, 2018, 9:06 a.m. UTC
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/cfg.c |  2 --
 net/mac80211/rx.c  | 11 +++++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

Comments

Johannes Berg Feb. 23, 2018, 11:24 a.m. UTC | #1
On Fri, 2018-02-23 at 10:06 +0100, Felix Fietkau wrote:
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
>  net/mac80211/cfg.c |  2 --
>  net/mac80211/rx.c  | 11 +++++++----
>  2 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 6f9d5beec73e..72b5a2ec4e94 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -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 &&

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
Felix Fietkau Feb. 23, 2018, 12:54 p.m. UTC | #2
On 2018-02-23 12:24, Johannes Berg wrote:
> On Fri, 2018-02-23 at 10:06 +0100, Felix Fietkau wrote:
>> Signed-off-by: Felix Fietkau <nbd@nbd.name>
>> ---
>>  net/mac80211/cfg.c |  2 --
>>  net/mac80211/rx.c  | 11 +++++++----
>>  2 files changed, 7 insertions(+), 6 deletions(-)
>> 
>> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
>> index 6f9d5beec73e..72b5a2ec4e94 100644
>> --- a/net/mac80211/cfg.c
>> +++ b/net/mac80211/cfg.c
>> @@ -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 &&
> 
> 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
diff mbox

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6f9d5beec73e..72b5a2ec4e94 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -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 &&
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 6e2506a84586..6944705c5258 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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;