From: Felix Fietkau Date: Fri, 23 Feb 2018 09:10:01 +0000 (+0100) Subject: mac80211: fix various issues with fast-rx mode X-Git-Tag: v18.06.0-rc1~800 X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=commitdiff_plain;h=393661640b0ec9e5eec83b44e9084b8df687bc03 mac80211: fix various issues with fast-rx mode Signed-off-by: Felix Fietkau --- 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 0000000000..a7562996b1 --- /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 +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 +--- + +--- 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 0000000000..3f3eb0a5e1 --- /dev/null +++ b/package/kernel/mac80211/patches/332-mac80211-support-AP-4-addr-mode-fast-rx.patch @@ -0,0 +1,25 @@ +From: Felix Fietkau +Date: Fri, 23 Feb 2018 10:00:22 +0100 +Subject: [PATCH] mac80211: support AP 4-addr mode fast-rx + +Signed-off-by: Felix Fietkau +--- + +--- 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 0000000000..8c4c724ef7 --- /dev/null +++ b/package/kernel/mac80211/patches/333-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch @@ -0,0 +1,53 @@ +From: Felix Fietkau +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 +--- + +--- 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 0000000000..8f9cba138f --- /dev/null +++ b/package/kernel/mac80211/patches/334-mac80211-support-station-4-addr-mode-fast-rx.patch @@ -0,0 +1,52 @@ +From: Felix Fietkau +Date: Fri, 23 Feb 2018 10:05:08 +0100 +Subject: [PATCH] mac80211: support station 4-addr mode fast-rx + +Signed-off-by: Felix Fietkau +--- + +--- 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 2a2d2f3cde..80723b1c8a 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,