mac80211: fix various issues with fast-rx mode

Signed-off-by: Felix Fietkau <nbd@nbd.name>
openwrt-18.06
Felix Fietkau 2018-02-23 10:10:01 +01:00
parent 50641a0f9a
commit 393661640b
5 changed files with 153 additions and 2 deletions

View File

@ -0,0 +1,21 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Fri, 23 Feb 2018 09:59:35 +0100
Subject: [PATCH] mac80211: drop frames with unexpected DS bits from
fast-rx to slow path
Fixes rx for 4-addr packets in AP mode
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3928,7 +3928,7 @@ static bool ieee80211_invoke_fast_rx(str
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

View File

@ -0,0 +1,25 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Fri, 23 Feb 2018 10:00:22 +0100
Subject: [PATCH] mac80211: support AP 4-addr mode fast-rx
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3774,6 +3774,15 @@ void ieee80211_check_fast_rx(struct 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;

View File

@ -0,0 +1,53 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Fri, 23 Feb 2018 10:01:53 +0100
Subject: [PATCH] mac80211: support fast-rx with incompatible PS
capabilities when PS is disabled
When powersave is disabled for the interface, we can do fast-rx anyway.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2658,6 +2658,7 @@ static int ieee80211_set_power_mgmt(stru
ieee80211_recalc_ps(local);
ieee80211_recalc_ps_vif(sdata);
+ ieee80211_check_fast_rx_iface(sdata);
return 0;
}
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3741,12 +3741,7 @@ void ieee80211_check_fast_rx(struct 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);
@@ -3758,6 +3753,16 @@ void ieee80211_check_fast_rx(struct 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:

View File

@ -0,0 +1,52 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Fri, 23 Feb 2018 10:05:08 +0100
Subject: [PATCH] mac80211: support station 4-addr mode fast-rx
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -160,7 +160,6 @@ static int ieee80211_change_iface(struct
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;
@@ -1574,7 +1573,6 @@ static int ieee80211_change_station(stru
}
rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
- __ieee80211_check_fast_rx_iface(vlansdata);
}
if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3738,10 +3738,6 @@ void ieee80211_check_fast_rx(struct 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);
@@ -3754,6 +3750,13 @@ void ieee80211_check_fast_rx(struct 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;

View File

@ -57,7 +57,7 @@
__NL80211_ATTR_AFTER_LAST,
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2447,6 +2447,19 @@ static int ieee80211_get_tx_power(struct
@@ -2445,6 +2445,19 @@ static int ieee80211_get_tx_power(struct
return 0;
}
@ -77,7 +77,7 @@
static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
const u8 *addr)
{
@@ -3720,6 +3733,7 @@ const struct cfg80211_ops mac80211_confi
@@ -3719,6 +3732,7 @@ const struct cfg80211_ops mac80211_confi
.set_wiphy_params = ieee80211_set_wiphy_params,
.set_tx_power = ieee80211_set_tx_power,
.get_tx_power = ieee80211_get_tx_power,