[openwrt/openwrt] mac80211: fix various issues with fast-rx mode

LEDE Commits lede-commits at lists.infradead.org
Fri Feb 23 01:15:52 PST 2018


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/393661640b0ec9e5eec83b44e9084b8df687bc03

commit 393661640b0ec9e5eec83b44e9084b8df687bc03
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Feb 23 10:10:01 2018 +0100

    mac80211: fix various issues with fast-rx mode
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 ...op-frames-with-unexpected-DS-bits-from-fa.patch | 21 +++++++++
 ...2-mac80211-support-AP-4-addr-mode-fast-rx.patch | 25 ++++++++++
 ...pport-fast-rx-with-incompatible-PS-capabi.patch | 53 ++++++++++++++++++++++
 ...80211-support-station-4-addr-mode-fast-rx.patch | 52 +++++++++++++++++++++
 .../522-mac80211_configure_antenna_gain.patch      |  4 +-
 5 files changed, 153 insertions(+), 2 deletions(-)

diff --git a/package/kernel/mac80211/patches/331-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch b/package/kernel/mac80211/patches/331-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch
new file mode 100644
index 0000000..a756299
--- /dev/null
+++ b/package/kernel/mac80211/patches/331-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch
@@ -0,0 +1,21 @@
+From: Felix Fietkau <nbd at 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 at 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
diff --git a/package/kernel/mac80211/patches/332-mac80211-support-AP-4-addr-mode-fast-rx.patch b/package/kernel/mac80211/patches/332-mac80211-support-AP-4-addr-mode-fast-rx.patch
new file mode 100644
index 0000000..3f3eb0a
--- /dev/null
+++ b/package/kernel/mac80211/patches/332-mac80211-support-AP-4-addr-mode-fast-rx.patch
@@ -0,0 +1,25 @@
+From: Felix Fietkau <nbd at 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 at 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;
diff --git a/package/kernel/mac80211/patches/333-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch b/package/kernel/mac80211/patches/333-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch
new file mode 100644
index 0000000..8c4c724
--- /dev/null
+++ b/package/kernel/mac80211/patches/333-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch
@@ -0,0 +1,53 @@
+From: Felix Fietkau <nbd at 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 at 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:
diff --git a/package/kernel/mac80211/patches/334-mac80211-support-station-4-addr-mode-fast-rx.patch b/package/kernel/mac80211/patches/334-mac80211-support-station-4-addr-mode-fast-rx.patch
new file mode 100644
index 0000000..8f9cba1
--- /dev/null
+++ b/package/kernel/mac80211/patches/334-mac80211-support-station-4-addr-mode-fast-rx.patch
@@ -0,0 +1,52 @@
+From: Felix Fietkau <nbd at 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 at 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;
+ 
diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
index 2a2d2f3..80723b1 100644
--- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
+++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
@@ -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,



More information about the lede-commits mailing list