linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] mac80211: drop frames with unexpected DS bits from fast-rx to slow path
@ 2018-02-23  9:06 Felix Fietkau
  2018-02-23  9:06 ` [PATCH 2/4] mac80211: support AP 4-addr mode fast-rx Felix Fietkau
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Felix Fietkau @ 2018-02-23  9:06 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

Fixes rx for 4-addr packets in AP mode

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 3dc162ddc3a6..1c947e005434 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] mac80211: support AP 4-addr mode fast-rx
  2018-02-23  9:06 [PATCH 1/4] mac80211: drop frames with unexpected DS bits from fast-rx to slow path Felix Fietkau
@ 2018-02-23  9:06 ` Felix Fietkau
  2018-02-23  9:06 ` [PATCH 3/4] mac80211: support fast-rx with incompatible PS capabilities when PS is disabled Felix Fietkau
  2018-02-23  9:06 ` [PATCH 4/4] mac80211: support station 4-addr mode fast-rx Felix Fietkau
  2 siblings, 0 replies; 7+ messages in thread
From: Felix Fietkau @ 2018-02-23  9:06 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/rx.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 1c947e005434..bef83c6bf50c 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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;
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] mac80211: support fast-rx with incompatible PS capabilities when PS is disabled
  2018-02-23  9:06 [PATCH 1/4] mac80211: drop frames with unexpected DS bits from fast-rx to slow path Felix Fietkau
  2018-02-23  9:06 ` [PATCH 2/4] mac80211: support AP 4-addr mode fast-rx Felix Fietkau
@ 2018-02-23  9:06 ` Felix Fietkau
  2018-02-23 11:25   ` Johannes Berg
  2018-02-23  9:06 ` [PATCH 4/4] mac80211: support station 4-addr mode fast-rx Felix Fietkau
  2 siblings, 1 reply; 7+ messages in thread
From: Felix Fietkau @ 2018-02-23  9:06 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

When powersave is disabled for the interface, we can do fast-rx anyway.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/cfg.c |  1 +
 net/mac80211/rx.c  | 17 +++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 46028e12e216..6f9d5beec73e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -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;
 }
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bef83c6bf50c..6e2506a84586 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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:
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] mac80211: support station 4-addr mode fast-rx
  2018-02-23  9:06 [PATCH 1/4] mac80211: drop frames with unexpected DS bits from fast-rx to slow path Felix Fietkau
  2018-02-23  9:06 ` [PATCH 2/4] mac80211: support AP 4-addr mode fast-rx Felix Fietkau
  2018-02-23  9:06 ` [PATCH 3/4] mac80211: support fast-rx with incompatible PS capabilities when PS is disabled Felix Fietkau
@ 2018-02-23  9:06 ` Felix Fietkau
  2018-02-23 11:24   ` Johannes Berg
  2 siblings, 1 reply; 7+ messages in thread
From: Felix Fietkau @ 2018-02-23  9:06 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

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 &&
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;
 
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 4/4] mac80211: support station 4-addr mode fast-rx
  2018-02-23  9:06 ` [PATCH 4/4] mac80211: support station 4-addr mode fast-rx Felix Fietkau
@ 2018-02-23 11:24   ` Johannes Berg
  2018-02-23 12:54     ` Felix Fietkau
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2018-02-23 11:24 UTC (permalink / raw)
  To: Felix Fietkau, linux-wireless

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/4] mac80211: support fast-rx with incompatible PS capabilities when PS is disabled
  2018-02-23  9:06 ` [PATCH 3/4] mac80211: support fast-rx with incompatible PS capabilities when PS is disabled Felix Fietkau
@ 2018-02-23 11:25   ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2018-02-23 11:25 UTC (permalink / raw)
  To: Felix Fietkau, linux-wireless

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 4/4] mac80211: support station 4-addr mode fast-rx
  2018-02-23 11:24   ` Johannes Berg
@ 2018-02-23 12:54     ` Felix Fietkau
  0 siblings, 0 replies; 7+ messages in thread
From: Felix Fietkau @ 2018-02-23 12:54 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-23 12:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-23  9:06 [PATCH 1/4] mac80211: drop frames with unexpected DS bits from fast-rx to slow path Felix Fietkau
2018-02-23  9:06 ` [PATCH 2/4] mac80211: support AP 4-addr mode fast-rx Felix Fietkau
2018-02-23  9:06 ` [PATCH 3/4] mac80211: support fast-rx with incompatible PS capabilities when PS is disabled Felix Fietkau
2018-02-23 11:25   ` Johannes Berg
2018-02-23  9:06 ` [PATCH 4/4] mac80211: support station 4-addr mode fast-rx Felix Fietkau
2018-02-23 11:24   ` Johannes Berg
2018-02-23 12:54     ` Felix Fietkau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).