From 0a3ec87a66baa29a9dcb367847a1dcb093d3de16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Sun, 3 May 2020 15:20:52 +0200 Subject: [PATCH 01/21] hostapd: update to latest Git hostap_2_9-1238-gdd2daf0848ed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump package to latest upstream Git HEAD which is commit dd2daf0848ed ("HE: Process HE 6 GHz band capab from associating HE STA"). Since last update there was 1238 commits done in the upstream tree with 618 files changed, 53399 insertions, 24928 deletions. I didn't bothered to rebase mesh patches as the changes seems not trivial and I don't have enough knowledge of those parts to do/test that properly, so someone else has to forward port them, ideally upstream them so we don't need to bother anymore. I've just deleted them for now: 004-mesh-use-setup-completion-callback-to-complete-mesh-.patch 005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch 006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch 007-mesh-apply-channel-attributes-before-running-Mesh.patch 011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch 013-mesh-do-not-allow-pri-sec-channel-switch.patch 015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch 016-mesh-fix-channel-switch-error-during-CAC.patch 018-mesh-make-forwarding-configurable.patch Refreshed all other patches, removed upstreamed patches: 051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch 067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch 070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch 071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch 090-wolfssl-fix-crypto_bignum_sum.patch 091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch 091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch 091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch 800-usleep.patch Tested-by: Stefan Lippers-Hollmann [ipq8065/NBG6817; ipq40xx/MAP-AC2200] Signed-off-by: Petr Štetiar --- package/network/services/hostapd/Makefile | 8 +- ...ompletion-callback-to-complete-mesh-.patch | 124 ---------- ...-frequency-as-pri-sec-channel-switch.patch | 26 --- ...rnel-driver-DFS-handler-in-userspace.patch | 48 ---- ...annel-attributes-before-running-Mesh.patch | 47 ---- ...hannels-to-be-selected-if-dfs-is-ena.patch | 78 ------- ...-do-not-allow-pri-sec-channel-switch.patch | 29 --- ...sh-do-not-use-offchan-mgmt-tx-on-DFS.patch | 61 ----- ...-fix-channel-switch-error-during-CAC.patch | 59 ----- ...18-mesh-make-forwarding-configurable.patch | 219 ------------------ ...ix-race-condition-in-mesh-mpm-new-pe.patch | 34 --- ...re-management-frame-from-unexpected-.patch | 66 ------ ...ix-WMM-queue-mapping-for-regulatory-.patch | 41 ---- ...ix-regulatory-limits-for-wmm-cwmin-c.patch | 47 ---- .../090-wolfssl-fix-crypto_bignum_sum.patch | 26 --- ...iler-warnings-on-size_t-printf-forma.patch | 31 --- ...ix-crypto_bignum_rand-implementation.patch | 49 ---- ...ardcode-include-directory-in-wpa_sup.patch | 26 --- .../hostapd/patches/100-daemonize_fix.patch | 2 +- .../hostapd/patches/200-multicall.patch | 50 ++-- .../services/hostapd/patches/300-noscan.patch | 12 +- .../hostapd/patches/301-mesh-noscan.patch | 18 +- .../patches/310-rescan_immediately.patch | 2 +- .../hostapd/patches/320-optional_rfkill.patch | 2 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/340-reload_freq_change.patch | 8 +- .../341-mesh-ctrl-iface-channel-switch.patch | 2 +- .../patches/350-nl80211_del_beacon_bss.patch | 10 +- .../patches/360-ctrl_iface_reload.patch | 12 +- .../hostapd/patches/370-ap_sta_support.patch | 60 ++--- .../patches/380-disable_ctrl_iface_mib.patch | 36 +-- .../381-hostapd_cli_UNKNOWN-COMMAND.patch | 2 +- .../patches/390-wpa_ie_cap_workaround.patch | 4 +- .../400-wps_single_auth_enc_type.patch | 13 +- .../patches/410-limit_debug_messages.patch | 44 ++-- .../patches/420-indicate-features.patch | 4 +- .../patches/430-hostapd_cli_ifdef.patch | 18 +- .../hostapd/patches/450-scan_wait.patch | 10 +- ...dd-new-config-params-to-be-used-with.patch | 16 +- ...-use-new-parameters-during-ibss-join.patch | 4 +- .../patches/463-add-mcast_rate-to-11s.patch | 12 +- .../patches/464-fix-mesh-obss-check.patch | 2 +- .../patches/470-survey_data_fallback.patch | 4 +- .../patches/500-lto-jobserver-support.patch | 4 +- .../hostapd/patches/600-ubus_support.patch | 120 +++++----- .../hostapd/patches/700-wifi-reload.patch | 44 ++-- .../services/hostapd/patches/800-usleep.patch | 53 ----- 47 files changed, 262 insertions(+), 1327 deletions(-) delete mode 100644 package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch delete mode 100644 package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch delete mode 100644 package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch delete mode 100644 package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch delete mode 100644 package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch delete mode 100644 package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch delete mode 100644 package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch delete mode 100644 package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch delete mode 100644 package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch delete mode 100644 package/network/services/hostapd/patches/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch delete mode 100644 package/network/services/hostapd/patches/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch delete mode 100644 package/network/services/hostapd/patches/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch delete mode 100644 package/network/services/hostapd/patches/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch delete mode 100644 package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch delete mode 100644 package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch delete mode 100644 package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch delete mode 100644 package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch delete mode 100644 package/network/services/hostapd/patches/800-usleep.patch diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 4fd285390e..b4b70a3d6f 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=10 +PKG_RELEASE:=1 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2019-08-08 -PKG_SOURCE_VERSION:=ca8c2bd28ad53f431d6ee60ef754e98cfdb4c17b -PKG_MIRROR_HASH:=9d9f1c60afa5324ee17219bd3ec61c1a6fa4043b4187da9bb44e59025d3ed31d +PKG_SOURCE_DATE:=2020-05-20 +PKG_SOURCE_VERSION:=dd2daf0848ed8854065cc5cfca07a0538cd380af +PKG_MIRROR_HASH:=5f198ba4f9098e8bddb32e41f82a24d0510c6e25317a86dcfafc70fb8db260e2 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch b/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch deleted file mode 100644 index 3d99b3bfb9..0000000000 --- a/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch +++ /dev/null @@ -1,124 +0,0 @@ -From c05ace7510ead96e72b97ce47b33f7b5865d6d36 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:38 -0700 -Subject: [PATCH 1/7] mesh: use setup completion callback to complete mesh join - -mesh join function is the last function to be called during -mesh join process, but it's been called a bit earlier than -it's supposed to be, so that some mesh parameter values -such as VHT capabilities not applied correct when mesh join -is in process. -Moreover current design of mesh join that is called directly -after mesh initialization isn't suitable for DFS channels to use, -since mesh join process should be paused until DFS CAC is -done and resumed after it's done. -The callback will be called by hostapd_setup_interface_complete_sync. -There is possiblity that completing mesh init fails, so add error -handle codes. - -Signed-off-by: Peter Oh -Signed-off-by: Peter Oh ---- - src/ap/hostapd.c | 11 ++++++++++- - wpa_supplicant/mesh.c | 13 +++++++------ - 2 files changed, 17 insertions(+), 7 deletions(-) - ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -423,6 +423,8 @@ static void hostapd_free_hapd_data(struc - #ifdef CONFIG_MESH - wpabuf_free(hapd->mesh_pending_auth); - hapd->mesh_pending_auth = NULL; -+ /* handling setup failure is already done */ -+ hapd->setup_complete_cb = NULL; - #endif /* CONFIG_MESH */ - - hostapd_clean_rrm(hapd); -@@ -2049,6 +2051,13 @@ dfs_offload: - if (hapd->setup_complete_cb) - hapd->setup_complete_cb(hapd->setup_complete_cb_ctx); - -+#ifdef CONFIG_MESH -+ if (delay_apply_cfg && !iface->mconf) { -+ wpa_printf(MSG_ERROR, "Error while completing mesh init"); -+ goto fail; -+ } -+#endif /* CONFIG_MESH */ -+ - wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", - iface->bss[0]->conf->iface); - if (iface->interfaces && iface->interfaces->terminate_on_error > 0) -@@ -2192,7 +2201,7 @@ int hostapd_setup_interface(struct hosta - ret = setup_interface(iface); - if (ret) { - wpa_printf(MSG_ERROR, "%s: Unable to setup interface.", -- iface->bss[0]->conf->iface); -+ iface->conf ? iface->conf->bss[0]->iface : "N/A"); - return -1; - } - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -190,8 +190,9 @@ static int wpas_mesh_init_rsn(struct wpa - } - - --static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) -+static void wpas_mesh_complete_cb(void *ctx) - { -+ struct wpa_supplicant *wpa_s = ctx; - struct hostapd_iface *ifmsh = wpa_s->ifmsh; - struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; - struct wpa_ssid *ssid = wpa_s->current_ssid; -@@ -200,7 +201,7 @@ static int wpas_mesh_complete(struct wpa - if (!params || !ssid || !ifmsh) { - wpa_printf(MSG_ERROR, "mesh: %s called without active mesh", - __func__); -- return -1; -+ return; - } - - if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && -@@ -209,7 +210,7 @@ static int wpas_mesh_complete(struct wpa - "mesh: RSN initialization failed - deinit mesh"); - wpa_supplicant_mesh_deinit(wpa_s); - wpa_drv_leave_mesh(wpa_s); -- return -1; -+ return; - } - - if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { -@@ -235,8 +236,6 @@ static int wpas_mesh_complete(struct wpa - - if (!ret) - wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); -- -- return ret; - } - - -@@ -263,6 +262,7 @@ static int wpa_supplicant_mesh_init(stru - if (!ifmsh) - return -ENOMEM; - -+ ifmsh->owner = wpa_s; - ifmsh->drv_flags = wpa_s->drv_flags; - ifmsh->num_bss = 1; - ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss, -@@ -280,6 +280,8 @@ static int wpa_supplicant_mesh_init(stru - bss->drv_priv = wpa_s->drv_priv; - bss->iface = ifmsh; - bss->mesh_sta_free_cb = mesh_mpm_free_sta; -+ bss->setup_complete_cb = wpas_mesh_complete_cb; -+ bss->setup_complete_cb_ctx = wpa_s; - frequency = ssid->frequency; - if (frequency != freq->freq && - frequency == freq->freq + freq->sec_channel_offset * 20) { -@@ -521,7 +523,6 @@ int wpa_supplicant_join_mesh(struct wpa_ - goto out; - } - -- ret = wpas_mesh_complete(wpa_s); - out: - return ret; - } diff --git a/package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch deleted file mode 100644 index 4d77f2d206..0000000000 --- a/package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch +++ /dev/null @@ -1,26 +0,0 @@ -From c56f18380d1d404a2abc0ea5373d294508ef1e54 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:41 -0700 -Subject: [PATCH 2/7] mesh: update ssid->frequency as pri/sec channel switch - -ssid->frequency is one of variables used to gets channel -number from given frequency. Leave it as unchanged when -pri/sec channel switched will cause picking up wrong -channel number after applying secondary channel offset -for HT40 and leads failing interface bring-up. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -287,6 +287,7 @@ static int wpa_supplicant_mesh_init(stru - frequency == freq->freq + freq->sec_channel_offset * 20) { - wpa_printf(MSG_DEBUG, "mesh: pri/sec channels switched"); - frequency = freq->freq; -+ ssid->frequency = frequency; - } - wpa_s->assoc_freq = frequency; - wpa_s->current_ssid = ssid; diff --git a/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch b/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch deleted file mode 100644 index 76c43da8e2..0000000000 --- a/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 593602b7f14be5c2695979639764b1c50f01bbec Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:49 -0700 -Subject: [PATCH 7/7] mesh: inform kernel driver DFS handler in userspace - -NL80211_ATTR_HANDLE_DFS is required by kerenel space -to enable DFS channels that indicates DFS handler -resides in userspace. - -Signed-off-by: Peter Oh ---- - src/drivers/driver.h | 1 + - src/drivers/driver_nl80211.c | 3 +++ - wpa_supplicant/mesh.c | 1 + - 3 files changed, 5 insertions(+) - ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -1477,6 +1477,7 @@ struct wpa_driver_mesh_join_params { - #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004 - #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 - unsigned int flags; -+ u8 handle_dfs; - }; - - /** ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -9624,6 +9624,9 @@ static int nl80211_join_mesh(struct i802 - - wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags); - -+ if (params->handle_dfs) -+ if (nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS)) -+ goto fail; - container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP); - if (!container) - goto fail; ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -309,6 +309,7 @@ static int wpa_supplicant_mesh_init(stru - conf->country[0] = wpa_s->conf->country[0]; - conf->country[1] = wpa_s->conf->country[1]; - conf->country[2] = ' '; -+ wpa_s->mesh_params->handle_dfs = 1; - } - - bss->iconf = conf; diff --git a/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch b/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch deleted file mode 100644 index f04fcc49e8..0000000000 --- a/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 2564184440d9d6041d11a8c7d50b31368634c3bd Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:40 -0700 -Subject: [PATCH] mesh: Apply channel attributes before setup interface - -This helps mesh interface initialization with correct channel -parameters. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -249,7 +249,7 @@ static int wpa_supplicant_mesh_init(stru - struct mesh_conf *mconf; - int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 }; - int rate_len; -- int frequency; -+ int frequency, saved_freq; - - if (!wpa_s->conf->user_mpm) { - /* not much for us to do here */ -@@ -386,6 +386,13 @@ static int wpa_supplicant_mesh_init(stru - conf->basic_rates[rate_len] = -1; - } - -+ /* Handle pri/sec switch frequency within AP configuration parameter -+ * generation without changing the stored network profile in the end. */ -+ saved_freq = ssid->frequency; -+ ssid->frequency = frequency; -+ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); -+ ssid->frequency = saved_freq; -+ - if (wpa_drv_init_mesh(wpa_s)) { - wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); - return -1; -@@ -397,8 +404,6 @@ static int wpa_supplicant_mesh_init(stru - return -1; - } - -- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); -- - return 0; - out_free: - wpa_supplicant_mesh_deinit(wpa_s); diff --git a/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch deleted file mode 100644 index 37f7f635ea..0000000000 --- a/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 89fa0d75fb1be82330258082ed3d7fd452eb6076 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:45 -0700 -Subject: [PATCH 3/7] mesh: Allow DFS channels to be selected if dfs is enabled - -Note: DFS is assumed to be usable if a country code has been set - -Signed-off-by: Benjamin Berg -Signed-off-by: Peter Oh ---- - wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++------ - 1 file changed, 18 insertions(+), 6 deletions(-) - ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -2153,6 +2153,8 @@ void ibss_mesh_setup_freq(struct wpa_sup - struct hostapd_freq_params vht_freq; - int chwidth, seg0, seg1; - u32 vht_caps = 0; -+ int dfs_enabled = wpa_s->conf->country[0] && -+ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); - - freq->freq = ssid->frequency; - -@@ -2232,8 +2234,11 @@ void ibss_mesh_setup_freq(struct wpa_sup - return; - - /* Check primary channel flags */ -- if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) -+ if (pri_chan->flag & HOSTAPD_CHAN_DISABLED) - return; -+ if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) -+ if (!dfs_enabled) -+ return; - - freq->channel = pri_chan->chan; - -@@ -2264,8 +2269,11 @@ void ibss_mesh_setup_freq(struct wpa_sup - return; - - /* Check secondary channel flags */ -- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) -+ if (sec_chan->flag & HOSTAPD_CHAN_DISABLED) - return; -+ if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) -+ if (!dfs_enabled) -+ return; - - if (ht40 == -1) { - if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) -@@ -2356,8 +2364,11 @@ skip_ht40: - return; - - /* Back to HT configuration if channel not usable */ -- if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) -+ if (chan->flag & HOSTAPD_CHAN_DISABLED) - return; -+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) -+ if (!dfs_enabled) -+ return; - } - - chwidth = CHANWIDTH_80MHZ; -@@ -2377,10 +2388,11 @@ skip_ht40: - if (!chan) - continue; - -- if (chan->flag & (HOSTAPD_CHAN_DISABLED | -- HOSTAPD_CHAN_NO_IR | -- HOSTAPD_CHAN_RADAR)) -+ if (chan->flag & HOSTAPD_CHAN_DISABLED) - continue; -+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) -+ if (!dfs_enabled) -+ continue; - - /* Found a suitable second segment for 80+80 */ - chwidth = CHANWIDTH_80P80MHZ; diff --git a/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch deleted file mode 100644 index 778273e67c..0000000000 --- a/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 4f4a9b9e2e61fba334a21dadea749e4b440f42e6 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:48 -0700 -Subject: [PATCH 6/7] mesh: don't allow pri/sec channel switch - -This limitation isn't backed by standard, but it is known that -mesh doesn't have capability to handle 20/40 coex change in -current implementation and it will not able to establish -PLINK when channel switch between primary and secondary happens. - -Since it's unknown when we will have the implementation of handling -20/40 coex change for mesh, it'd better to avoid them from happening -until standard based implementation is introduced. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -386,6 +386,7 @@ static int wpa_supplicant_mesh_init(stru - conf->basic_rates[rate_len] = -1; - } - -+ conf->no_pri_sec_switch = 1; - /* Handle pri/sec switch frequency within AP configuration parameter - * generation without changing the stored network profile in the end. */ - saved_freq = ssid->frequency; diff --git a/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch b/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch deleted file mode 100644 index 8bac9082d7..0000000000 --- a/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 71e9c65a7c8af90a5fd11072062b596421316452 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:46 -0700 -Subject: [PATCH 4/7] mesh: do not set offchanok on DFS channels in non-ETSI - -mac80211 does not allow mgmt tx to use off channel on -DFS channels in non-ETSI domain, because it will invalidate -CAC result on current operating channel. -(mac80211 commit: 34373d12f3cbb74960a73431138ef619d857996f) -Hence don't set offchanok for mgmt tx in case of DFS channels -in non-ETSI. - -Signed-off-by: Peter Oh ---- - src/drivers/driver_nl80211.c | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -7462,6 +7462,10 @@ static int wpa_driver_nl80211_send_actio - int ret = -1; - u8 *buf; - struct ieee80211_hdr *hdr; -+ struct hostapd_hw_modes *modes; -+ int i, offchanok = 1; -+ u16 num_modes, flags; -+ u8 dfs_domain; - - wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, " - "freq=%u MHz wait=%d ms no_cck=%d)", -@@ -7486,6 +7490,21 @@ static int wpa_driver_nl80211_send_actio - os_memset(bss->rand_addr, 0, ETH_ALEN); - } - -+ if (is_mesh_interface(drv->nlmode)) { -+ modes = nl80211_get_hw_feature_data(bss, &num_modes, -+ &flags, &dfs_domain); -+ if (dfs_domain != HOSTAPD_DFS_REGION_ETSI && -+ ieee80211_is_dfs(bss->freq, modes, num_modes)) -+ offchanok = 0; -+ if (modes) { -+ for (i = 0; i < num_modes; i++) { -+ os_free(modes[i].channels); -+ os_free(modes[i].rates); -+ } -+ os_free(modes); -+ } -+ } -+ - if (is_ap_interface(drv->nlmode) && - (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || - (int) freq == bss->freq || drv->device_ap_sme || -@@ -7497,7 +7516,7 @@ static int wpa_driver_nl80211_send_actio - ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf, - 24 + data_len, - &drv->send_action_cookie, -- no_cck, 0, 1, NULL, 0); -+ no_cck, 0, offchanok, NULL, 0); - - os_free(buf); - return ret; diff --git a/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch b/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch deleted file mode 100644 index f2baf1d8b7..0000000000 --- a/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 5913d6e2a741683e7c747c046f72ca790bbe1337 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:47 -0700 -Subject: [PATCH 5/7] mesh: fix channel switch error during CAC - -Mesh interface has used its channel parameters that configured -during its initialization even after channel switched due to -DFS radar detection during CAC which caused channel switch error. -This change fixes the error by updating its channel parameters -when channel's been changed from initial one. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -13,6 +13,7 @@ - #include "utils/uuid.h" - #include "common/ieee802_11_defs.h" - #include "common/wpa_ctrl.h" -+#include "common/hw_features_common.h" - #include "ap/sta_info.h" - #include "ap/hostapd.h" - #include "ap/ieee802_11.h" -@@ -204,6 +205,32 @@ static void wpas_mesh_complete_cb(void * - return; - } - -+ /* -+ * inspect if channel's been changed since initialized. -+ * i.e. DFS radar detection -+ */ -+ if (ifmsh->freq != params->freq.freq) { -+ wpa_s->assoc_freq = ifmsh->freq; -+ ssid->frequency = ifmsh->freq; -+ if (hostapd_set_freq_params(¶ms->freq, -+ ifmsh->conf->hw_mode, -+ ifmsh->freq, -+ ifmsh->conf->channel, -+ ifmsh->conf->ieee80211n, -+ ifmsh->conf->ieee80211ac, -+ ifmsh->conf->ieee80211ax, -+ ifmsh->conf->secondary_channel, -+ hostapd_get_oper_chwidth(ifmsh->conf), -+ hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), -+ hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), -+ ifmsh->current_mode->vht_capab, -+ &ifmsh->current_mode->he_capab[IEEE80211_MODE_AP])) { -+ wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); -+ wpa_supplicant_mesh_deinit(wpa_s); -+ return; -+ } -+ } -+ - if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && - wpas_mesh_init_rsn(wpa_s)) { - wpa_printf(MSG_ERROR, diff --git a/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch b/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch deleted file mode 100644 index af94fed4b8..0000000000 --- a/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 90fe6429624fc48bc0e5d2d7eeecb7498708b5e3 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Wed, 18 Apr 2018 19:24:31 +0200 -Subject: [PATCH 18/18] mesh: make forwarding configurable - -Allow mesh_fwding to be specified in a mesh bss config, pass that -to the driver (only nl80211 implemented for now) and announce -forwarding capability accordingly. - -Signed-off-by: Daniel Golle ---- - src/ap/ap_config.h | 2 ++ - src/drivers/driver.h | 2 ++ - src/drivers/driver_nl80211.c | 3 +++ - wpa_supplicant/config.c | 4 ++++ - wpa_supplicant/config.h | 9 +++++++++ - wpa_supplicant/config_file.c | 4 ++++ - wpa_supplicant/config_ssid.h | 5 +++++ - wpa_supplicant/mesh.c | 6 ++++++ - wpa_supplicant/mesh_mpm.c | 4 ++-- - wpa_supplicant/wpa_supplicant.conf | 3 +++ - 10 files changed, 40 insertions(+), 2 deletions(-) - ---- a/src/ap/ap_config.h -+++ b/src/ap/ap_config.h -@@ -51,6 +51,7 @@ struct mesh_conf { - int dot11MeshRetryTimeout; /* msec */ - int dot11MeshConfirmTimeout; /* msec */ - int dot11MeshHoldingTimeout; /* msec */ -+ int mesh_fwding; - }; - - #define MAX_STA_COUNT 2007 -@@ -666,6 +667,7 @@ struct hostapd_bss_config { - - #define MESH_ENABLED BIT(0) - int mesh; -+ int mesh_fwding; - - u8 radio_measurements[RRM_CAPABILITIES_IE_LEN]; - ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -1450,6 +1450,7 @@ struct wpa_driver_mesh_bss_params { - #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004 - #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008 - #define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010 -+#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020 - /* - * TODO: Other mesh configuration parameters would go here. - * See NL80211_MESHCONF_* for all the mesh config parameters. -@@ -1459,6 +1460,7 @@ struct wpa_driver_mesh_bss_params { - int peer_link_timeout; - int max_peer_links; - int rssi_threshold; -+ int forwarding; - u16 ht_opmode; - }; - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -9592,6 +9592,9 @@ static int nl80211_put_mesh_config(struc - if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && - nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, - params->auto_plinks)) || -+ ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_FORWARDING) && -+ nla_put_u8(msg, NL80211_MESHCONF_FORWARDING, -+ params->forwarding)) || - ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) && - nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, - params->max_peer_links)) || ---- a/wpa_supplicant/config.c -+++ b/wpa_supplicant/config.c -@@ -2307,6 +2307,7 @@ static const struct parse_data ssid_fiel - #ifdef CONFIG_MESH - { INT_RANGE(mode, 0, 5) }, - { INT_RANGE(no_auto_peer, 0, 1) }, -+ { INT_RANGE(mesh_fwding, 0, 1) }, - { INT_RANGE(mesh_rssi_threshold, -255, 1) }, - #else /* CONFIG_MESH */ - { INT_RANGE(mode, 0, 4) }, -@@ -2869,6 +2870,7 @@ void wpa_config_set_network_defaults(str - ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; - ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; - ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; -+ ssid->mesh_fwding = DEFAULT_MESH_FWDING; - ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; - #endif /* CONFIG_MESH */ - #ifdef CONFIG_HT_OVERRIDES -@@ -4089,6 +4091,7 @@ struct wpa_config * wpa_config_alloc_emp - config->user_mpm = DEFAULT_USER_MPM; - config->max_peer_links = DEFAULT_MAX_PEER_LINKS; - config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; -+ config->mesh_fwding = DEFAULT_MESH_FWDING; - config->dot11RSNASAERetransPeriod = - DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; - config->fast_reauth = DEFAULT_FAST_REAUTH; -@@ -4726,6 +4729,7 @@ static const struct global_parse_data gl - { INT(user_mpm), 0 }, - { INT_RANGE(max_peer_links, 0, 255), 0 }, - { INT(mesh_max_inactivity), 0 }, -+ { INT_RANGE(mesh_fwding, 0, 1), 0 }, - { INT(dot11RSNASAERetransPeriod), 0 }, - #endif /* CONFIG_MESH */ - { INT(disable_scan_offload), 0 }, ---- a/wpa_supplicant/config.h -+++ b/wpa_supplicant/config.h -@@ -18,6 +18,7 @@ - #define DEFAULT_USER_MPM 1 - #define DEFAULT_MAX_PEER_LINKS 99 - #define DEFAULT_MESH_MAX_INACTIVITY 300 -+#define DEFAULT_MESH_FWDING 1 - /* - * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, - * but use 1000 ms in practice to avoid issues on low power CPUs. -@@ -1327,6 +1328,14 @@ struct wpa_config { - int mesh_max_inactivity; - - /** -+ * mesh_fwding - Mesh network layer-2 forwarding -+ * -+ * This controls whether to enable layer-2 forwarding. -+ * By default: 1: enabled -+ */ -+ int mesh_fwding; -+ -+ /** - * dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame - * - * This timeout value is used in mesh STA to retransmit ---- a/wpa_supplicant/config_file.c -+++ b/wpa_supplicant/config_file.c -@@ -829,6 +829,7 @@ static void wpa_config_write_network(FIL - #endif /* IEEE8021X_EAPOL */ - INT(mode); - INT(no_auto_peer); -+ INT(mesh_fwding); - INT(frequency); - INT(fixed_freq); - #ifdef CONFIG_ACS -@@ -1472,6 +1473,9 @@ static void wpa_config_write_global(FILE - fprintf(f, "mesh_max_inactivity=%d\n", - config->mesh_max_inactivity); - -+ if (config->mesh_fwding != DEFAULT_MESH_FWDING) -+ fprintf(f, "mesh_fwding=%d\n", config->mesh_fwding); -+ - if (config->dot11RSNASAERetransPeriod != - DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD) - fprintf(f, "dot11RSNASAERetransPeriod=%d\n", ---- a/wpa_supplicant/config_ssid.h -+++ b/wpa_supplicant/config_ssid.h -@@ -516,6 +516,11 @@ struct wpa_ssid { - int dot11MeshConfirmTimeout; /* msec */ - int dot11MeshHoldingTimeout; /* msec */ - -+ /** -+ * Mesh network layer-2 forwarding -+ */ -+ int mesh_fwding; -+ - int ht; - int ht40; - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -126,6 +126,7 @@ static struct mesh_conf * mesh_config_cr - conf->mesh_cc_id = 0; - conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; - conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; -+ conf->mesh_fwding = ssid->mesh_fwding; - conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; - conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; - conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; -@@ -328,6 +329,7 @@ static int wpa_supplicant_mesh_init(stru - bss->conf->start_disabled = 1; - bss->conf->mesh = MESH_ENABLED; - bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; -+ bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding; - - if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, - wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { -@@ -549,6 +551,10 @@ int wpa_supplicant_join_mesh(struct wpa_ - } - params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; - -+ /* always explicitely set forwarding to on or off for now */ -+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_FORWARDING; -+ params->conf.forwarding = ssid->mesh_fwding; -+ - os_free(wpa_s->mesh_params); - wpa_s->mesh_params = params; - if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { ---- a/wpa_supplicant/mesh_mpm.c -+++ b/wpa_supplicant/mesh_mpm.c -@@ -305,9 +305,9 @@ static void mesh_mpm_send_plink_action(s - info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; - /* TODO: Add Connected to Mesh Gate/AS subfields */ - wpabuf_put_u8(buf, info); -- /* always forwarding & accepting plinks for now */ -+ /* set forwarding & always accepting plinks for now */ - wpabuf_put_u8(buf, MESH_CAP_ACCEPT_ADDITIONAL_PEER | -- MESH_CAP_FORWARDING); -+ (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0)); - } else { /* Peer closing frame */ - /* IE: Mesh ID */ - wpabuf_put_u8(buf, WLAN_EID_MESH_ID); ---- a/wpa_supplicant/wpa_supplicant.conf -+++ b/wpa_supplicant/wpa_supplicant.conf -@@ -153,6 +153,9 @@ ap_scan=1 - # This timeout value is used in mesh STA to clean up inactive stations. - #mesh_max_inactivity=300 - -+# Enable 802.11s layer-2 routing and forwarding -+#mesh_fwding=1 -+ - # cert_in_cb - Whether to include a peer certificate dump in events - # This controls whether peer certificates for authentication server and - # its certificate chain are included in EAP peer certificate events. This is diff --git a/package/network/services/hostapd/patches/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch b/package/network/services/hostapd/patches/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch deleted file mode 100644 index cca8d47488..0000000000 --- a/package/network/services/hostapd/patches/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Felix Fietkau -Date: Tue, 12 Feb 2019 14:22:43 +0100 -Subject: [PATCH v2] wpa_supplicant: fix race condition in mesh mpm new peer - handling - -When wpa_supplicant receives another new peer event before the first one -has been processed, it tries to add a station to the driver a second time -(which fails) and then tears down the station entry until another event -comes in. -Fix this by only adding a station to the driver if it didn't exist already. - -Signed-off-by: Felix Fietkau ---- - ---- a/wpa_supplicant/mesh_mpm.c -+++ b/wpa_supplicant/mesh_mpm.c -@@ -710,11 +710,12 @@ static struct sta_info * mesh_mpm_add_pe - } - - sta = ap_get_sta(data, addr); -- if (!sta) { -- sta = ap_sta_add(data, addr); -- if (!sta) -- return NULL; -- } -+ if (sta) -+ return NULL; -+ -+ sta = ap_sta_add(data, addr); -+ if (!sta) -+ return NULL; - - /* Set WMM by default since Mesh STAs are QoS STAs */ - sta->flags |= WLAN_STA_WMM; diff --git a/package/network/services/hostapd/patches/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch b/package/network/services/hostapd/patches/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch deleted file mode 100644 index 25ee2c9f85..0000000000 --- a/package/network/services/hostapd/patches/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 8c07fa9eda13e835f3f968b2e1c9a8be3a851ff9 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Thu, 29 Aug 2019 11:52:04 +0300 -Subject: [PATCH] AP: Silently ignore management frame from unexpected source - address - -Do not process any received Management frames with unexpected/invalid SA -so that we do not add any state for unexpected STA addresses or end up -sending out frames to unexpected destination. This prevents unexpected -sequences where an unprotected frame might end up causing the AP to send -out a response to another device and that other device processing the -unexpected response. - -In particular, this prevents some potential denial of service cases -where the unexpected response frame from the AP might result in a -connected station dropping its association. - -Signed-off-by: Jouni Malinen ---- - src/ap/drv_callbacks.c | 13 +++++++++++++ - src/ap/ieee802_11.c | 12 ++++++++++++ - 2 files changed, 25 insertions(+) - ---- a/src/ap/drv_callbacks.c -+++ b/src/ap/drv_callbacks.c -@@ -131,6 +131,19 @@ int hostapd_notif_assoc(struct hostapd_d - "hostapd_notif_assoc: Skip event with no address"); - return -1; - } -+ -+ if (is_multicast_ether_addr(addr) || -+ is_zero_ether_addr(addr) || -+ os_memcmp(addr, hapd->own_addr, ETH_ALEN) == 0) { -+ /* Do not process any frames with unexpected/invalid SA so that -+ * we do not add any state for unexpected STA addresses or end -+ * up sending out frames to unexpected destination. */ -+ wpa_printf(MSG_DEBUG, "%s: Invalid SA=" MACSTR -+ " in received indication - ignore this indication silently", -+ __func__, MAC2STR(addr)); -+ return 0; -+ } -+ - random_add_randomness(addr, ETH_ALEN); - - hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211, ---- a/src/ap/ieee802_11.c -+++ b/src/ap/ieee802_11.c -@@ -4626,6 +4626,18 @@ int ieee802_11_mgmt(struct hostapd_data - fc = le_to_host16(mgmt->frame_control); - stype = WLAN_FC_GET_STYPE(fc); - -+ if (is_multicast_ether_addr(mgmt->sa) || -+ is_zero_ether_addr(mgmt->sa) || -+ os_memcmp(mgmt->sa, hapd->own_addr, ETH_ALEN) == 0) { -+ /* Do not process any frames with unexpected/invalid SA so that -+ * we do not add any state for unexpected STA addresses or end -+ * up sending out frames to unexpected destination. */ -+ wpa_printf(MSG_DEBUG, "MGMT: Invalid SA=" MACSTR -+ " in received frame - ignore this frame silently", -+ MAC2STR(mgmt->sa)); -+ return 0; -+ } -+ - if (stype == WLAN_FC_STYPE_BEACON) { - handle_beacon(hapd, mgmt, len, fi); - return 1; diff --git a/package/network/services/hostapd/patches/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch b/package/network/services/hostapd/patches/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch deleted file mode 100644 index 240411236a..0000000000 --- a/package/network/services/hostapd/patches/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: Felix Fietkau -Date: Thu, 23 Jan 2020 13:50:47 +0100 -Subject: [PATCH] driver_nl80211: fix WMM queue mapping for regulatory - limit - -nl80211 uses a different queue mapping from hostap, so AC indexes need to -be converted. - -Signed-off-by: Felix Fietkau ---- - ---- a/src/drivers/driver_nl80211_capa.c -+++ b/src/drivers/driver_nl80211_capa.c -@@ -1403,6 +1403,12 @@ static void phy_info_freq(struct hostapd - [NL80211_WMMR_AIFSN] = { .type = NLA_U8 }, - [NL80211_WMMR_TXOP] = { .type = NLA_U16 }, - }; -+ static const u8 wmm_map[4] = { -+ [NL80211_AC_BE] = WMM_AC_BE, -+ [NL80211_AC_BK] = WMM_AC_BK, -+ [NL80211_AC_VI] = WMM_AC_VI, -+ [NL80211_AC_VO] = WMM_AC_VO, -+ }; - struct nlattr *nl_wmm; - struct nlattr *tb_wmm[NL80211_WMMR_MAX + 1]; - int rem_wmm, ac, count = 0; -@@ -1424,12 +1430,13 @@ static void phy_info_freq(struct hostapd - return; - } - ac = nl_wmm->nla_type; -- if (ac < 0 || ac >= WMM_AC_NUM) { -+ if (ac >= ARRAY_SIZE(wmm_map)) { - wpa_printf(MSG_DEBUG, - "nl80211: Invalid AC value %d", ac); - return; - } - -+ ac = wmm_map[ac]; - chan->wmm_rules[ac].min_cwmin = - nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]); - chan->wmm_rules[ac].min_cwmax = diff --git a/package/network/services/hostapd/patches/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch b/package/network/services/hostapd/patches/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch deleted file mode 100644 index fe41e2b788..0000000000 --- a/package/network/services/hostapd/patches/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Felix Fietkau -Date: Thu, 23 Jan 2020 14:10:20 +0100 -Subject: [PATCH] driver_nl80211: fix regulatory limits for wmm cwmin/cwmax - values - -The internal WMM AC parameters use just the exponent of the CW value, while -nl80211 reports the full CW value. -This led to completely bogus CWmin/CWmax values in the WMM IE when a regulatory -limit was present. Fix this by converting the value to the exponent before -passing it on - -Signed-off-by: Felix Fietkau ---- - ---- a/src/drivers/driver_nl80211_capa.c -+++ b/src/drivers/driver_nl80211_capa.c -@@ -1336,6 +1336,18 @@ static void phy_info_vht_capa(struct hos - } - } - -+static inline int cw2ecw(unsigned int cw) -+{ -+ int bit; -+ -+ if (cw == 0) -+ return 0; -+ -+ for (bit = 1; cw != 1; bit++) -+ cw >>= 1; -+ -+ return bit; -+} - - static void phy_info_freq(struct hostapd_hw_modes *mode, - struct hostapd_channel_data *chan, -@@ -1438,9 +1450,9 @@ static void phy_info_freq(struct hostapd - - ac = wmm_map[ac]; - chan->wmm_rules[ac].min_cwmin = -- nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]); -+ cw2ecw(nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN])); - chan->wmm_rules[ac].min_cwmax = -- nla_get_u16(tb_wmm[NL80211_WMMR_CW_MAX]); -+ cw2ecw(nla_get_u16(tb_wmm[NL80211_WMMR_CW_MAX])); - chan->wmm_rules[ac].min_aifs = - nla_get_u8(tb_wmm[NL80211_WMMR_AIFSN]); - chan->wmm_rules[ac].max_txop = diff --git a/package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch b/package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch deleted file mode 100644 index 7cc0dec3fe..0000000000 --- a/package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 1766e608ba1114220f3b3598e77aa53b50c38a6e Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Mon, 14 Oct 2019 19:27:47 +0300 -Subject: [PATCH] wolfSSL: Fix crypto_bignum_sub() - -The initial crypto wrapper implementation for wolfSSL seems to have -included a copy-paste error in crypto_bignum_sub() implementation that -was identical to crypto_bignum_add() while mp_sub() should have been -used instead of mp_add(). - -Signed-off-by: Jouni Malinen ---- - src/crypto/crypto_wolfssl.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/src/crypto/crypto_wolfssl.c -+++ b/src/crypto/crypto_wolfssl.c -@@ -1151,7 +1151,7 @@ int crypto_bignum_sub(const struct crypt - if (TEST_FAIL()) - return -1; - -- return mp_add((mp_int *) a, (mp_int *) b, -+ return mp_sub((mp_int *) a, (mp_int *) b, - (mp_int *) r) == MP_OKAY ? 0 : -1; - } - diff --git a/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch b/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch deleted file mode 100644 index 464bcff0b5..0000000000 --- a/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 6a28c4dbc102de3fed9db44637f47a10e7adfb78 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Sat, 16 May 2020 21:01:51 +0300 -Subject: [PATCH 1/3] wolfssl: Fix compiler warnings on size_t printf format - use - -Signed-off-by: Jouni Malinen ---- - src/crypto/tls_wolfssl.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/src/crypto/tls_wolfssl.c -+++ b/src/crypto/tls_wolfssl.c -@@ -1741,7 +1741,7 @@ struct wpabuf * tls_connection_encrypt(v - if (!conn) - return NULL; - -- wpa_printf(MSG_DEBUG, "SSL: encrypt: %ld bytes", wpabuf_len(in_data)); -+ wpa_printf(MSG_DEBUG, "SSL: encrypt: %zu bytes", wpabuf_len(in_data)); - - wolfssl_reset_out_data(&conn->output); - -@@ -1792,7 +1792,7 @@ struct wpabuf * tls_connection_decrypt(v - } - wpabuf_put(buf, res); - -- wpa_printf(MSG_DEBUG, "SSL: decrypt: %ld bytes", wpabuf_len(buf)); -+ wpa_printf(MSG_DEBUG, "SSL: decrypt: %zu bytes", wpabuf_len(buf)); - - return buf; - } diff --git a/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch b/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch deleted file mode 100644 index 2464b63489..0000000000 --- a/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch +++ /dev/null @@ -1,49 +0,0 @@ -From eb595b3e3ab531645a5bde71cf6385335b7a4b95 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Sat, 16 May 2020 21:02:17 +0300 -Subject: [PATCH 2/3] wolfssl: Fix crypto_bignum_rand() implementation - -The previous implementation used mp_rand_prime() to generate a random -value in range 0..m. That is insanely slow way of generating a random -value since mp_rand_prime() is for generating a random _prime_ which is -not what is needed here. Replace that implementation with generationg of -a random value in the requested range without doing any kind of prime -number checks or loops to reject values that are not primes. - -This speeds up SAE and EAP-pwd routines by couple of orders of -magnitude.. - -Signed-off-by: Jouni Malinen ---- - src/crypto/crypto_wolfssl.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - ---- a/src/crypto/crypto_wolfssl.c -+++ b/src/crypto/crypto_wolfssl.c -@@ -1084,19 +1084,21 @@ int crypto_bignum_rand(struct crypto_big - { - int ret = 0; - WC_RNG rng; -+ size_t len; -+ u8 *buf; - - if (TEST_FAIL()) - return -1; - if (wc_InitRng(&rng) != 0) - return -1; -- if (mp_rand_prime((mp_int *) r, -- (mp_count_bits((mp_int *) m) + 7) / 8 * 2, -- &rng, NULL) != 0) -- ret = -1; -- if (ret == 0 && -+ len = (mp_count_bits((mp_int *) m) + 7) / 8; -+ buf = os_malloc(len); -+ if (!buf || wc_RNG_GenerateBlock(&rng, buf, len) != 0 || -+ mp_read_unsigned_bin((mp_int *) r, buf, len) != MP_OKAY || - mp_mod((mp_int *) r, (mp_int *) m, (mp_int *) r) != 0) - ret = -1; - wc_FreeRng(&rng); -+ bin_clear_free(buf, len); - return ret; - } - diff --git a/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch b/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch deleted file mode 100644 index b15dccd7d1..0000000000 --- a/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 79488da576aeeb9400e1742fab7f463eed0fa7a1 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Sat, 16 May 2020 21:07:45 +0300 -Subject: [PATCH 3/3] wolfssl: Do not hardcode include directory in - wpa_supplicant build - -This is not really appropriate for any kind of cross compilations and is -not really needed in general since system specific values can be set in -.config. - -Signed-off-by: Jouni Malinen ---- - wpa_supplicant/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/wpa_supplicant/Makefile -+++ b/wpa_supplicant/Makefile -@@ -1086,7 +1086,7 @@ endif - - ifeq ($(CONFIG_TLS), wolfssl) - ifdef TLS_FUNCS --CFLAGS += -DWOLFSSL_DER_LOAD -I/usr/local/include/wolfssl -+CFLAGS += -DWOLFSSL_DER_LOAD - OBJS += ../src/crypto/tls_wolfssl.o - endif - OBJS += ../src/crypto/crypto_wolfssl.o diff --git a/package/network/services/hostapd/patches/100-daemonize_fix.patch b/package/network/services/hostapd/patches/100-daemonize_fix.patch index 43057ef9fe..687bd4082d 100644 --- a/package/network/services/hostapd/patches/100-daemonize_fix.patch +++ b/package/network/services/hostapd/patches/100-daemonize_fix.patch @@ -8,7 +8,7 @@ #ifdef ANDROID #include -@@ -182,59 +183,46 @@ int os_gmtime(os_time_t t, struct os_tm +@@ -188,59 +189,46 @@ int os_gmtime(os_time_t t, struct os_tm return 0; } diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index a8597edae4..8459a02d16 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -8,7 +8,7 @@ ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository -@@ -198,7 +199,8 @@ endif +@@ -200,7 +201,8 @@ endif ifdef CONFIG_NO_VLAN CFLAGS += -DCONFIG_NO_VLAN @@ -18,7 +18,7 @@ OBJS += ../src/ap/vlan_init.o OBJS += ../src/ap/vlan_ifconfig.o OBJS += ../src/ap/vlan.o -@@ -366,10 +368,14 @@ CFLAGS += -DCONFIG_MBO +@@ -346,10 +348,14 @@ CFLAGS += -DCONFIG_MBO OBJS += ../src/ap/mbo_ap.o endif @@ -36,7 +36,7 @@ LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -1316,6 +1322,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) +@@ -1294,6 +1300,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) BCHECK=../src/drivers/build.hostapd @@ -49,7 +49,7 @@ hostapd: $(BCHECK) $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -1358,6 +1370,12 @@ ifeq ($(CONFIG_TLS), linux) +@@ -1335,6 +1347,12 @@ ifeq ($(CONFIG_TLS), linux) HOBJS += ../src/crypto/crypto_linux.o endif @@ -72,7 +72,7 @@ ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository -@@ -363,7 +364,9 @@ endif +@@ -359,7 +360,9 @@ endif ifdef CONFIG_IBSS_RSN NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_IBSS_RSN @@ -82,7 +82,7 @@ OBJS += ibss_rsn.o endif -@@ -892,6 +895,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS +@@ -880,6 +883,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS LIBS += -ldl -rdynamic endif @@ -93,7 +93,7 @@ endif ifdef CONFIG_AP -@@ -899,9 +906,11 @@ NEED_EAP_COMMON=y +@@ -887,9 +894,11 @@ NEED_EAP_COMMON=y NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_AP OBJS += ap.o @@ -105,7 +105,7 @@ OBJS += ../src/ap/hostapd.o OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o -@@ -983,6 +992,12 @@ endif +@@ -969,6 +978,12 @@ endif ifdef CONFIG_HS20 OBJS += ../src/ap/hs20.o endif @@ -118,7 +118,7 @@ endif ifdef CONFIG_MBO -@@ -991,7 +1006,9 @@ CFLAGS += -DCONFIG_MBO +@@ -977,7 +992,9 @@ CFLAGS += -DCONFIG_MBO endif ifdef NEED_RSN_AUTHENTICATOR @@ -128,7 +128,7 @@ NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1899,6 +1916,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1887,6 +1904,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config @@ -141,7 +141,7 @@ wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -1999,6 +2022,12 @@ endif +@@ -1987,6 +2010,12 @@ endif $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ @$(E) " sed" $< @@ -156,7 +156,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5657,8 +5657,8 @@ union wpa_event_data { +@@ -5865,8 +5865,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -167,7 +167,7 @@ /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -5670,7 +5670,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -5878,7 +5878,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -178,7 +178,7 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -1669,8 +1669,8 @@ err: +@@ -1768,8 +1768,8 @@ err: #endif /* CONFIG_OWE */ @@ -189,7 +189,7 @@ { struct hostapd_data *hapd = ctx; #ifndef CONFIG_NO_STDOUT_DEBUG -@@ -1915,7 +1915,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -2014,7 +2014,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -200,7 +200,7 @@ struct hapd_interfaces *interfaces = ctx; --- a/wpa_supplicant/wpa_priv.c +++ b/wpa_supplicant/wpa_priv.c -@@ -1031,8 +1031,8 @@ static void wpa_priv_send_ft_response(st +@@ -1038,8 +1038,8 @@ static void wpa_priv_send_ft_response(st } @@ -211,7 +211,7 @@ { struct wpa_priv_interface *iface = ctx; -@@ -1095,7 +1095,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -1102,7 +1102,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -220,7 +220,7 @@ union wpa_event_data *data) { struct wpa_priv_global *global = ctx; -@@ -1207,6 +1207,8 @@ int main(int argc, char *argv[]) +@@ -1215,6 +1215,8 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; @@ -231,7 +231,7 @@ os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4184,8 +4184,8 @@ static void wpas_event_assoc_reject(stru +@@ -4499,8 +4499,8 @@ static void wpas_event_unprot_beacon(str } @@ -242,7 +242,7 @@ { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -4967,7 +4967,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -5313,7 +5313,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -253,7 +253,7 @@ struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -6096,7 +6096,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -6571,7 +6571,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -261,7 +261,7 @@ /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -6133,6 +6132,11 @@ static int wpa_supplicant_match_existing +@@ -6608,6 +6607,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -273,7 +273,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -6389,6 +6393,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -6864,6 +6868,8 @@ struct wpa_global * wpa_supplicant_init( #ifndef CONFIG_NO_WPA_MSG wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ @@ -284,7 +284,7 @@ wpa_debug_open_file(params->wpa_debug_file_path); --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -592,6 +592,11 @@ fail: +@@ -590,6 +590,11 @@ fail: return -1; } @@ -296,7 +296,7 @@ #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -682,6 +687,8 @@ int main(int argc, char *argv[]) +@@ -680,6 +685,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index 4c3728bc8f..80f9cf2a0b 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -1,9 +1,9 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3411,6 +3411,10 @@ static int hostapd_config_fill(struct ho +@@ -3452,6 +3452,10 @@ static int hostapd_config_fill(struct ho + if (bss->ocv && !bss->ieee80211w) bss->ieee80211w = 1; #endif /* CONFIG_OCV */ - #ifdef CONFIG_IEEE80211N + } else if (os_strcmp(buf, "noscan") == 0) { + conf->noscan = atoi(pos); + } else if (os_strcmp(buf, "ht_coex") == 0) { @@ -13,7 +13,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -934,6 +934,8 @@ struct hostapd_config { +@@ -972,6 +972,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; @@ -24,7 +24,7 @@ int no_pri_sec_switch; --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c -@@ -477,7 +477,8 @@ static int ieee80211n_check_40mhz(struct +@@ -500,7 +500,8 @@ static int ieee80211n_check_40mhz(struct int ret; /* Check that HT40 is used and PRI / SEC switch is allowed */ @@ -36,7 +36,7 @@ hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -252,6 +252,9 @@ void hostapd_2040_coex_action(struct hos +@@ -230,6 +230,9 @@ void hostapd_2040_coex_action(struct hos return; } @@ -46,7 +46,7 @@ if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) { wpa_printf(MSG_DEBUG, "Ignore too short 20/40 BSS Coexistence Management frame"); -@@ -412,6 +415,9 @@ void ht40_intolerant_add(struct hostapd_ +@@ -390,6 +393,9 @@ void ht40_intolerant_add(struct hostapd_ if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) return; diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index b1450ef6db..a86070aa3a 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2312,6 +2312,7 @@ static const struct parse_data ssid_fiel +@@ -2477,6 +2477,7 @@ static const struct parse_data ssid_fiel #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, #endif /* CONFIG_MESH */ @@ -10,17 +10,17 @@ { STR(id_str) }, --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c -@@ -829,6 +829,7 @@ static void wpa_config_write_network(FIL +@@ -866,6 +866,7 @@ static void wpa_config_write_network(FIL #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); + INT(noscan); - INT(mesh_fwding); INT(frequency); - INT(fixed_freq); + INT(enable_edmg); + INT(edmg_channel); --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -361,6 +361,8 @@ static int wpa_supplicant_mesh_init(stru +@@ -333,6 +333,8 @@ static int wpa_supplicant_mesh_init(stru frequency); goto out_free; } @@ -31,7 +31,7 @@ if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2143,12 +2143,12 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2331,12 +2331,12 @@ void ibss_mesh_setup_freq(struct wpa_sup int ieee80211_mode = wpas_mode_to_ieee80211_mode(ssid->mode); enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; @@ -46,8 +46,8 @@ unsigned int j, k; struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; -@@ -2221,7 +2221,7 @@ void ibss_mesh_setup_freq(struct wpa_sup - return; +@@ -2416,7 +2416,7 @@ void ibss_mesh_setup_freq(struct wpa_sup + #endif /* CONFIG_HE_OVERRIDES */ /* Setup higher BW only for 5 GHz */ - if (mode->mode != HOSTAPD_MODE_IEEE80211A) @@ -57,7 +57,7 @@ for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) { --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -918,6 +918,8 @@ struct wpa_ssid { +@@ -960,6 +960,8 @@ struct wpa_ssid { */ int no_auto_peer; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index 8d0307c3a2..25f0306f8f 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4474,7 +4474,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -4926,7 +4926,7 @@ wpa_supplicant_alloc(struct wpa_supplica if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch index 9a3afad1f8..a703c7e132 100644 --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch @@ -24,7 +24,7 @@ endif ifdef NEED_NETLINK -@@ -146,6 +143,7 @@ endif +@@ -142,6 +139,7 @@ endif ifdef NEED_RFKILL DRV_OBJS += ../src/drivers/rfkill.o diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch index 13343e22e6..e9fd27560f 100644 --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4431,7 +4431,7 @@ static int nl80211_set_channel(struct i8 +@@ -4639,7 +4639,7 @@ static int nl80211_set_channel(struct i8 freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch index 369586769c..09c6a4648d 100644 --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch @@ -1,12 +1,14 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -108,6 +108,26 @@ static void hostapd_reload_bss(struct ho +@@ -112,6 +112,28 @@ static void hostapd_reload_bss(struct ho #endif /* CONFIG_NO_RADIUS */ ssid = &hapd->conf->ssid; + + hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq, + hapd->iconf->channel, ++ hapd->iconf->enable_edmg, ++ hapd->iconf->edmg_channel, + hapd->iconf->ieee80211n, + hapd->iconf->ieee80211ac, + hapd->iconf->ieee80211ax, @@ -27,7 +29,7 @@ if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && ssid->wpa_passphrase_set && ssid->wpa_passphrase) { /* -@@ -205,6 +225,7 @@ int hostapd_reload_config(struct hostapd +@@ -213,6 +235,7 @@ int hostapd_reload_config(struct hostapd struct hostapd_data *hapd = iface->bss[0]; struct hostapd_config *newconf, *oldconf; size_t j; @@ -35,7 +37,7 @@ if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ -@@ -255,24 +276,20 @@ int hostapd_reload_config(struct hostapd +@@ -263,24 +286,20 @@ int hostapd_reload_config(struct hostapd } iface->conf = newconf; diff --git a/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch b/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch index 70fb01b8e5..a1e59cc95d 100644 --- a/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch +++ b/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1378,15 +1378,35 @@ int ap_switch_channel(struct wpa_supplic +@@ -1426,15 +1426,35 @@ int ap_switch_channel(struct wpa_supplic #ifdef CONFIG_CTRL_IFACE diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch index c3ce2b474d..07b219efaf 100644 --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -2721,10 +2721,15 @@ static int wpa_driver_nl80211_del_beacon +@@ -2778,10 +2778,15 @@ static int wpa_driver_nl80211_del_beacon struct nl_msg *msg; struct wpa_driver_nl80211_data *drv = bss->drv; @@ -18,7 +18,7 @@ return send_and_recv_msgs(drv, msg, NULL, NULL); } -@@ -5042,7 +5047,7 @@ static void nl80211_teardown_ap(struct i +@@ -5250,7 +5255,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); @@ -27,7 +27,7 @@ } -@@ -7353,8 +7358,6 @@ static int wpa_driver_nl80211_if_remove( +@@ -7631,8 +7636,6 @@ static int wpa_driver_nl80211_if_remove( } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); @@ -36,7 +36,7 @@ nl80211_destroy_bss(bss); if (!bss->added_if) i802_set_iface_flags(bss, 0); -@@ -7744,7 +7747,6 @@ static int wpa_driver_nl80211_deinit_ap( +@@ -8006,7 +8009,6 @@ static int wpa_driver_nl80211_deinit_ap( if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); @@ -44,7 +44,7 @@ /* * If the P2P GO interface was dynamically added, then it is -@@ -7764,7 +7766,6 @@ static int wpa_driver_nl80211_stop_ap(vo +@@ -8026,7 +8028,6 @@ static int wpa_driver_nl80211_stop_ap(vo if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch index 1706abb0ad..3d9b99510f 100644 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch @@ -1,6 +1,6 @@ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -60,6 +60,7 @@ +@@ -65,6 +65,7 @@ #include "fst/fst_ctrl_iface.h" #include "config_file.h" #include "ctrl_iface.h" @@ -8,7 +8,7 @@ #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256 -@@ -78,6 +79,7 @@ static void hostapd_ctrl_iface_send(stru +@@ -80,6 +81,7 @@ static void hostapd_ctrl_iface_send(stru enum wpa_msg_type type, const char *buf, size_t len); @@ -16,7 +16,7 @@ static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd, struct sockaddr_storage *from, -@@ -129,6 +131,61 @@ static int hostapd_ctrl_iface_new_sta(st +@@ -131,6 +133,61 @@ static int hostapd_ctrl_iface_new_sta(st return 0; } @@ -76,9 +76,9 @@ + iface->interfaces->config_read_cb = config_read_cb; +} - #ifdef CONFIG_IEEE80211W #ifdef NEED_AP_MLME -@@ -3195,6 +3252,8 @@ static int hostapd_ctrl_iface_receive_pr + static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, +@@ -3499,6 +3556,8 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, reply_size); @@ -89,7 +89,7 @@ #ifdef RADIUS_SERVER --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c -@@ -874,7 +874,13 @@ int hostapd_parse_csa_settings(const cha +@@ -917,7 +917,13 @@ int hostapd_parse_csa_settings(const cha int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) { diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch index a861ce4153..f678c66478 100644 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch @@ -11,7 +11,7 @@ -include .config -include $(if $(MULTICALL),../hostapd/.config) -@@ -116,6 +120,8 @@ OBJS_c += ../src/utils/common.o +@@ -118,6 +122,8 @@ OBJS_c += ../src/utils/common.o OBJS_c += ../src/common/cli.o OBJS += wmm_ac.o @@ -59,7 +59,7 @@ --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h -@@ -82,6 +82,10 @@ struct wpa_bss { +@@ -83,6 +83,10 @@ struct wpa_bss { u8 ssid[SSID_MAX_LEN]; /** Length of SSID */ size_t ssid_len; @@ -110,9 +110,9 @@ break; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -127,6 +127,55 @@ static void wpas_update_fils_connect_par - #endif /* CONFIG_FILS && IEEE8021X_EAPOL */ - +@@ -129,6 +129,54 @@ static void wpas_update_fils_connect_par + static void wpas_update_owe_connect_params(struct wpa_supplicant *wpa_s); + #endif /* CONFIG_OWE */ +static int hostapd_stop(struct wpa_supplicant *wpa_s) +{ @@ -162,11 +162,10 @@ + } + return 0; +} -+ + + #ifdef CONFIG_WEP /* Configure default/group WEP keys for static WEP */ - int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) - { -@@ -940,12 +989,16 @@ void wpa_supplicant_set_state(struct wpa +@@ -991,6 +1039,8 @@ void wpa_supplicant_set_state(struct wpa sme_sched_obss_scan(wpa_s, 1); @@ -174,8 +173,9 @@ + hostapd_reload(wpa_s, wpa_s->current_bss); #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL) if (!fils_hlp_sent && ssid && ssid->eap.erp) - wpas_update_fils_connect_params(wpa_s); - #endif /* CONFIG_FILS && IEEE8021X_EAPOL */ + update_fils_connect_params = true; +@@ -1001,6 +1051,8 @@ void wpa_supplicant_set_state(struct wpa + #endif /* CONFIG_OWE */ } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || state == WPA_ASSOCIATED) { + if (wpa_s->hostapd) @@ -183,7 +183,7 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -2038,6 +2091,8 @@ void wpa_supplicant_associate(struct wpa +@@ -2222,6 +2274,8 @@ void wpa_supplicant_associate(struct wpa wpa_ssid_txt(ssid->ssid, ssid->ssid_len), ssid->id); wpas_notify_mesh_group_started(wpa_s, ssid); @@ -192,7 +192,7 @@ #else /* CONFIG_MESH */ wpa_msg(wpa_s, MSG_ERROR, "mesh mode support not included in the build"); -@@ -5716,6 +5771,16 @@ static int wpa_supplicant_init_iface(str +@@ -6184,6 +6238,16 @@ static int wpa_supplicant_init_iface(str sizeof(wpa_s->bridge_ifname)); } @@ -207,9 +207,9 @@ + } + /* RSNA Supplicant Key Management - INITIALIZE */ - eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); - eapol_sm_notify_portValid(wpa_s->eapol, FALSE); -@@ -6043,6 +6108,11 @@ static void wpa_supplicant_deinit_iface( + eapol_sm_notify_portEnabled(wpa_s->eapol, false); + eapol_sm_notify_portValid(wpa_s->eapol, false); +@@ -6517,6 +6581,11 @@ static void wpa_supplicant_deinit_iface( if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); @@ -223,7 +223,7 @@ wpa_s->ctrl_iface = NULL; --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -101,6 +101,11 @@ struct wpa_interface { +@@ -104,6 +104,11 @@ struct wpa_interface { const char *ifname; /** @@ -235,7 +235,7 @@ * bridge_ifname - Optional bridge interface name * * If the driver interface (ifname) is included in a Linux bridge -@@ -516,6 +521,8 @@ struct wpa_supplicant { +@@ -530,6 +535,8 @@ struct wpa_supplicant { #endif /* CONFIG_CTRL_IFACE_BINDER */ char bridge_ifname[16]; @@ -246,9 +246,9 @@ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -2408,6 +2408,11 @@ static int hostapd_ctrl_iface_chan_switc - if (ret) - return ret; +@@ -2665,6 +2665,11 @@ static int hostapd_ctrl_iface_chan_switc + return 0; + } + if (os_strstr(pos, " auto-ht")) { + settings.freq_params.ht_enabled = iface->conf->ieee80211n; @@ -260,7 +260,7 @@ /* Save CHAN_SWITCH VHT config */ --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1403,11 +1403,6 @@ int ieee802_11_set_beacon(struct hostapd +@@ -1460,11 +1460,6 @@ int ieee802_11_set_beacon(struct hostapd struct wpabuf *beacon, *proberesp, *assocresp; int res, ret = -1; @@ -274,7 +274,7 @@ if (ieee802_11_build_ap_params(hapd, ¶ms) < 0) --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4184,6 +4184,60 @@ static void wpas_event_assoc_reject(stru +@@ -4499,6 +4499,60 @@ static void wpas_event_unprot_beacon(str } @@ -335,7 +335,7 @@ void supplicant_event(void *ctx, enum wpa_event_type event, union wpa_event_data *data) { -@@ -4485,8 +4539,10 @@ void supplicant_event(void *ctx, enum wp +@@ -4801,8 +4855,10 @@ void supplicant_event(void *ctx, enum wp channel_width_to_string(data->ch_switch.ch_width), data->ch_switch.cf1, data->ch_switch.cf2); @@ -349,7 +349,7 @@ wpa_s->current_ssid->frequency = data->ch_switch.freq; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5478,6 +5478,7 @@ union wpa_event_data { +@@ -5669,6 +5669,7 @@ union wpa_event_data { /** * struct ch_switch @@ -357,7 +357,7 @@ * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -5486,6 +5487,7 @@ union wpa_event_data { +@@ -5677,6 +5678,7 @@ union wpa_event_data { * @cf2: Center frequency 2 */ struct ch_switch { @@ -367,7 +367,7 @@ int ch_offset; --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c -@@ -536,7 +536,7 @@ static void mlme_event_ch_switch(struct +@@ -541,7 +541,7 @@ static void mlme_event_ch_switch(struct struct nlattr *ifindex, struct nlattr *freq, struct nlattr *type, struct nlattr *bw, struct nlattr *cf1, struct nlattr *cf2, @@ -376,7 +376,7 @@ { struct i802_bss *bss; union wpa_event_data data; -@@ -595,6 +595,8 @@ static void mlme_event_ch_switch(struct +@@ -600,6 +600,8 @@ static void mlme_event_ch_switch(struct data.ch_switch.cf1 = nla_get_u32(cf1); if (cf2) data.ch_switch.cf2 = nla_get_u32(cf2); @@ -385,7 +385,7 @@ if (finished) bss->freq = data.ch_switch.freq; -@@ -2544,6 +2546,7 @@ static void do_process_drv_event(struct +@@ -2689,6 +2691,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CHANNEL_WIDTH], tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], @@ -393,7 +393,7 @@ 0); break; case NL80211_CMD_CH_SWITCH_NOTIFY: -@@ -2554,6 +2557,7 @@ static void do_process_drv_event(struct +@@ -2699,6 +2702,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CHANNEL_WIDTH], tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 7f16d3a12a..5d29884e8d 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -220,6 +220,9 @@ endif +@@ -222,6 +222,9 @@ endif ifdef CONFIG_NO_CTRL_IFACE CFLAGS += -DCONFIG_NO_CTRL_IFACE else @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -3020,6 +3020,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3323,6 +3323,7 @@ static int hostapd_ctrl_iface_receive_pr reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -3061,6 +3062,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3364,6 +3365,7 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -30,7 +30,7 @@ reply_len = -1; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -957,6 +957,9 @@ ifdef CONFIG_FILS +@@ -942,6 +942,9 @@ ifdef CONFIG_FILS OBJS += ../src/ap/fils_hlp.o endif ifdef CONFIG_CTRL_IFACE @@ -42,7 +42,7 @@ --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -2144,7 +2144,7 @@ static int wpa_supplicant_ctrl_iface_sta +@@ -2257,7 +2257,7 @@ static int wpa_supplicant_ctrl_iface_sta pos += ret; } @@ -51,7 +51,7 @@ if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -9962,6 +9962,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10172,6 +10172,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = -1; } else if (os_strncmp(buf, "NOTE ", 5) == 0) { wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); @@ -59,7 +59,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -9974,6 +9975,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10184,6 +10185,7 @@ char * wpa_supplicant_ctrl_iface_process reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -67,7 +67,7 @@ } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -10458,6 +10460,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10668,6 +10670,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -75,7 +75,7 @@ } else if (os_strcmp(buf, "STA-FIRST") == 0) { reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); } else if (os_strncmp(buf, "STA ", 4) == 0) { -@@ -10466,12 +10469,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10676,12 +10679,15 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, reply_size); @@ -101,7 +101,7 @@ static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen, size_t curr_len, const u8 *mcs_set) -@@ -423,6 +424,7 @@ int hostapd_ctrl_iface_sta_next(struct h +@@ -451,6 +452,7 @@ int hostapd_ctrl_iface_sta_next(struct h return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); } @@ -109,7 +109,7 @@ #ifdef CONFIG_P2P_MANAGER static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, -@@ -763,12 +765,12 @@ int hostapd_ctrl_iface_status(struct hos +@@ -806,12 +808,12 @@ int hostapd_ctrl_iface_status(struct hos return len; len += ret; } @@ -126,7 +126,7 @@ if (os_snprintf_error(buflen - len, ret)) --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2706,6 +2706,7 @@ static const char * bool_txt(Boolean val +@@ -2711,6 +2711,7 @@ static const char * bool_txt(bool val) return val ? "TRUE" : "FALSE"; } @@ -134,7 +134,7 @@ int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -2892,6 +2893,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -2897,6 +2898,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -144,7 +144,7 @@ static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx) --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c -@@ -4116,6 +4116,7 @@ static const char * wpa_bool_txt(int val +@@ -4351,6 +4351,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -152,7 +152,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -4264,7 +4265,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -4501,7 +4502,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -163,7 +163,7 @@ { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -2502,6 +2502,8 @@ static u32 wpa_key_mgmt_suite(struct wpa +@@ -2680,6 +2680,8 @@ static u32 wpa_key_mgmt_suite(struct wpa } @@ -172,7 +172,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -2585,6 +2587,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -2761,6 +2763,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } @@ -182,7 +182,7 @@ --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1236,7 +1236,7 @@ int wpas_ap_wps_nfc_report_handover(stru +@@ -1284,7 +1284,7 @@ int wpas_ap_wps_nfc_report_handover(stru #endif /* CONFIG_WPS */ diff --git a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch index 7bac937373..d2414faf01 100644 --- a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch +++ b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch @@ -1,6 +1,6 @@ --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -743,7 +743,7 @@ static int wpa_ctrl_command_sta(struct w +@@ -744,7 +744,7 @@ static int wpa_ctrl_command_sta(struct w } buf[len] = '\0'; diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch index c879c3fb84..1318759ea7 100644 --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch @@ -1,6 +1,6 @@ --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c -@@ -2089,6 +2089,31 @@ u32 wpa_akm_to_suite(int akm) +@@ -2119,6 +2119,31 @@ u32 wpa_akm_to_suite(int akm) } @@ -32,7 +32,7 @@ int wpa_compare_rsn_ie(int ft_initial_assoc, const u8 *ie1, size_t ie1len, const u8 *ie2, size_t ie2len) -@@ -2096,8 +2121,19 @@ int wpa_compare_rsn_ie(int ft_initial_as +@@ -2126,8 +2151,19 @@ int wpa_compare_rsn_ie(int ft_initial_as if (ie1 == NULL || ie2 == NULL) return -1; diff --git a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch index 7f1986ec46..73a8c7694d 100644 --- a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch @@ -1,22 +1,23 @@ --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c -@@ -346,8 +346,7 @@ static int hapd_wps_reconfig_in_memory(s +@@ -394,9 +394,8 @@ static int hapd_wps_reconfig_in_memory(s bss->wpa_pairwise |= WPA_CIPHER_GCMP; else bss->wpa_pairwise |= WPA_CIPHER_CCMP; - } + #ifndef CONFIG_NO_TKIP - if (cred->encr_type & WPS_ENCR_TKIP) + } else if (cred->encr_type & WPS_ENCR_TKIP) bss->wpa_pairwise |= WPA_CIPHER_TKIP; + #endif /* CONFIG_NO_TKIP */ bss->rsn_pairwise = bss->wpa_pairwise; - bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa, -@@ -1108,8 +1107,7 @@ int hostapd_init_wps(struct hostapd_data +@@ -1178,8 +1177,7 @@ int hostapd_init_wps(struct hostapd_data WPA_CIPHER_GCMP_256)) { wps->encr_types |= WPS_ENCR_AES; wps->encr_types_rsn |= WPS_ENCR_AES; - } - if (conf->rsn_pairwise & WPA_CIPHER_TKIP) { + } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) { - wps->encr_types |= WPS_ENCR_TKIP; - wps->encr_types_rsn |= WPS_ENCR_TKIP; - } + #ifdef CONFIG_NO_TKIP + wpa_printf(MSG_INFO, "WPS: TKIP not supported"); + goto fail; diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch index 3947eb8611..d2713fc29b 100644 --- a/package/network/services/hostapd/patches/410-limit_debug_messages.patch +++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch @@ -9,41 +9,37 @@ { va_list ap; -@@ -253,8 +253,8 @@ void wpa_printf(int level, const char *f +@@ -255,7 +255,7 @@ void wpa_printf(int level, const char *f } -static void _wpa_hexdump(int level, const char *title, const u8 *buf, -- size_t len, int show) +void _wpa_hexdump(int level, const char *title, const u8 *buf, -+ size_t len, int show) + size_t len, int show, int only_syslog) { size_t i; - -@@ -380,20 +380,8 @@ static void _wpa_hexdump(int level, cons +@@ -382,19 +382,7 @@ static void _wpa_hexdump(int level, cons #endif /* CONFIG_ANDROID_LOG */ } -void wpa_hexdump(int level, const char *title, const void *buf, size_t len) -{ -- _wpa_hexdump(level, title, buf, len, 1); +- _wpa_hexdump(level, title, buf, len, 1, 0); -} - - -void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len) -{ -- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); +- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys, 0); -} - - -static void _wpa_hexdump_ascii(int level, const char *title, const void *buf, -- size_t len, int show) +void _wpa_hexdump_ascii(int level, const char *title, const void *buf, -+ size_t len, int show) + size_t len, int show) { size_t i, llen; - const u8 *pos = buf; -@@ -506,20 +494,6 @@ static void _wpa_hexdump_ascii(int level +@@ -507,20 +495,6 @@ file_done: } @@ -64,7 +60,7 @@ #ifdef CONFIG_DEBUG_FILE static char *last_path = NULL; #endif /* CONFIG_DEBUG_FILE */ -@@ -635,7 +609,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_ +@@ -636,7 +610,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_ } @@ -73,7 +69,7 @@ { va_list ap; char *buf; -@@ -673,7 +647,7 @@ void wpa_msg(void *ctx, int level, const +@@ -674,7 +648,7 @@ void wpa_msg(void *ctx, int level, const } @@ -84,13 +80,13 @@ char *buf; --- a/src/utils/wpa_debug.h +++ b/src/utils/wpa_debug.h -@@ -52,6 +52,17 @@ int wpa_debug_reopen_file(void); +@@ -50,6 +50,17 @@ int wpa_debug_reopen_file(void); void wpa_debug_close_file(void); void wpa_debug_setup_stdout(void); +/* internal */ +void _wpa_hexdump(int level, const char *title, const u8 *buf, -+ size_t len, int show); ++ size_t len, int show, int only_syslog); +void _wpa_hexdump_ascii(int level, const char *title, const void *buf, + size_t len, int show); +extern int wpa_debug_show_keys; @@ -102,7 +98,7 @@ /** * wpa_debug_printf_timestamp - Print timestamp for debug output * -@@ -72,9 +83,15 @@ void wpa_debug_print_timestamp(void); +@@ -70,9 +81,15 @@ void wpa_debug_print_timestamp(void); * * Note: New line '\n' is added to the end of the text when printing to stdout. */ @@ -119,7 +115,7 @@ /** * wpa_hexdump - conditional hex dump * @level: priority level (MSG_*) of the message -@@ -86,7 +103,13 @@ PRINTF_FORMAT(2, 3); +@@ -84,7 +101,13 @@ PRINTF_FORMAT(2, 3); * output may be directed to stdout, stderr, and/or syslog based on * configuration. The contents of buf is printed out has hex dump. */ @@ -129,12 +125,12 @@ + if (level < CONFIG_MSG_MIN_PRIORITY) + return; + -+ _wpa_hexdump(level, title, buf, len, 1); ++ _wpa_hexdump(level, title, buf, len, 1, 1); +} static inline void wpa_hexdump_buf(int level, const char *title, const struct wpabuf *buf) -@@ -108,7 +131,13 @@ static inline void wpa_hexdump_buf(int l +@@ -106,7 +129,13 @@ static inline void wpa_hexdump_buf(int l * like wpa_hexdump(), but by default, does not include secret keys (passwords, * etc.) in debug output. */ @@ -144,12 +140,12 @@ + if (level < CONFIG_MSG_MIN_PRIORITY) + return; + -+ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); ++ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys, 1); +} static inline void wpa_hexdump_buf_key(int level, const char *title, const struct wpabuf *buf) -@@ -130,8 +159,14 @@ static inline void wpa_hexdump_buf_key(i +@@ -128,8 +157,14 @@ static inline void wpa_hexdump_buf_key(i * the hex numbers and ASCII characters (for printable range) are shown. 16 * bytes per line will be shown. */ @@ -166,7 +162,7 @@ /** * wpa_hexdump_ascii_key - conditional hex dump, hide keys -@@ -147,8 +182,14 @@ void wpa_hexdump_ascii(int level, const +@@ -145,8 +180,14 @@ void wpa_hexdump_ascii(int level, const * bytes per line will be shown. This works like wpa_hexdump_ascii(), but by * default, does not include secret keys (passwords, etc.) in debug output. */ @@ -183,7 +179,7 @@ /* * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce -@@ -185,7 +226,12 @@ void wpa_hexdump_ascii_key(int level, co +@@ -183,7 +224,12 @@ void wpa_hexdump_ascii_key(int level, co * * Note: New line '\n' is added to the end of the text when printing to stdout. */ @@ -197,7 +193,7 @@ /** * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors -@@ -199,8 +245,13 @@ void wpa_msg(void *ctx, int level, const +@@ -197,8 +243,13 @@ void wpa_msg(void *ctx, int level, const * attached ctrl_iface monitors. In other words, it can be used for frequent * events that do not need to be sent to syslog. */ diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch index 1f8b049f36..67a33967f5 100644 --- a/package/network/services/hostapd/patches/420-indicate-features.patch +++ b/package/network/services/hostapd/patches/420-indicate-features.patch @@ -8,7 +8,7 @@ #include "crypto/random.h" #include "crypto/tls.h" #include "common/version.h" -@@ -690,7 +691,7 @@ int main(int argc, char *argv[]) +@@ -688,7 +689,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -17,7 +17,7 @@ if (c < 0) break; switch (c) { -@@ -727,6 +728,8 @@ int main(int argc, char *argv[]) +@@ -725,6 +726,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch index ca053bcdf6..3744464c89 100644 --- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch @@ -1,6 +1,6 @@ --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -385,7 +385,6 @@ static int hostapd_cli_cmd_disassociate( +@@ -388,7 +388,6 @@ static int hostapd_cli_cmd_disassociate( } @@ -8,23 +8,23 @@ static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -398,7 +397,6 @@ static int hostapd_cli_cmd_signature(str +@@ -401,7 +400,6 @@ static int hostapd_cli_cmd_signature(str os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]); return wpa_ctrl_command(ctrl, buf); } -#endif /* CONFIG_TAXONOMY */ - #ifdef CONFIG_IEEE80211W -@@ -417,7 +415,6 @@ static int hostapd_cli_cmd_sa_query(stru - #endif /* CONFIG_IEEE80211W */ + static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc, +@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(stru + } -#ifdef CONFIG_WPS static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -643,7 +640,6 @@ static int hostapd_cli_cmd_wps_config(st +@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(st ssid_hex, argv[1]); return wpa_ctrl_command(ctrl, buf); } @@ -32,7 +32,7 @@ static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -1538,15 +1534,12 @@ static const struct hostapd_cli_cmd host +@@ -1532,13 +1528,10 @@ static const struct hostapd_cli_cmd host { "disassociate", hostapd_cli_cmd_disassociate, hostapd_complete_stations, " = disassociate a station" }, @@ -40,15 +40,13 @@ { "signature", hostapd_cli_cmd_signature, hostapd_complete_stations, " = get taxonomy signature for a station" }, -#endif /* CONFIG_TAXONOMY */ - #ifdef CONFIG_IEEE80211W { "sa_query", hostapd_cli_cmd_sa_query, hostapd_complete_stations, " = send SA Query to a station" }, - #endif /* CONFIG_IEEE80211W */ -#ifdef CONFIG_WPS { "wps_pin", hostapd_cli_cmd_wps_pin, NULL, " [timeout] [addr] = add WPS Enrollee PIN" }, { "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL, -@@ -1571,7 +1564,6 @@ static const struct hostapd_cli_cmd host +@@ -1563,7 +1556,6 @@ static const struct hostapd_cli_cmd host " = configure AP" }, { "wps_get_status", hostapd_cli_cmd_wps_get_status, NULL, "= show current WPS status" }, diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch index 5e080df82f..ac874ad66a 100644 --- a/package/network/services/hostapd/patches/450-scan_wait.patch +++ b/package/network/services/hostapd/patches/450-scan_wait.patch @@ -9,7 +9,7 @@ #ifndef CONFIG_NO_HOSTAPD_LOGGER -@@ -149,6 +151,14 @@ static void hostapd_logger_cb(void *ctx, +@@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx, } #endif /* CONFIG_NO_HOSTAPD_LOGGER */ @@ -24,7 +24,7 @@ /** * hostapd_driver_init - Preparate driver interface -@@ -167,6 +177,8 @@ static int hostapd_driver_init(struct ho +@@ -164,6 +174,8 @@ static int hostapd_driver_init(struct ho return -1; } @@ -33,7 +33,7 @@ /* Initialize the driver interface */ if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5])) b = NULL; -@@ -407,8 +419,6 @@ static void hostapd_global_deinit(const +@@ -404,8 +416,6 @@ static void hostapd_global_deinit(const #endif /* CONFIG_NATIVE_WINDOWS */ eap_server_unregister_methods(); @@ -42,7 +42,7 @@ } -@@ -434,18 +444,6 @@ static int hostapd_global_run(struct hap +@@ -431,18 +441,6 @@ static int hostapd_global_run(struct hap } #endif /* EAP_SERVER_TNC */ @@ -61,7 +61,7 @@ eloop_run(); return 0; -@@ -647,8 +645,7 @@ int main(int argc, char *argv[]) +@@ -645,8 +643,7 @@ int main(int argc, char *argv[]) struct hapd_interfaces interfaces; int ret = 1; size_t i, j; diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index b740378090..762f9d649f 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -22,7 +22,7 @@ Signed-hostap: Antonio Quartulli #include "common/defs.h" #include "common/ieee802_11_defs.h" #include "common/wpa_common.h" -@@ -819,6 +820,9 @@ struct wpa_driver_associate_params { +@@ -850,6 +851,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; @@ -34,7 +34,7 @@ Signed-hostap: Antonio Quartulli * --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -17,6 +17,7 @@ +@@ -18,6 +18,7 @@ #include "eap_peer/eap.h" #include "p2p/p2p.h" #include "fst/fst.h" @@ -42,7 +42,7 @@ Signed-hostap: Antonio Quartulli #include "config.h" -@@ -2130,6 +2131,97 @@ static char * wpa_config_write_peerkey(c +@@ -2269,6 +2270,97 @@ static char * wpa_config_write_peerkey(c #endif /* NO_CONFIG_WRITE */ @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli /* Helper macros for network block parser */ #ifdef OFFSET -@@ -2382,6 +2474,8 @@ static const struct parse_data ssid_fiel +@@ -2551,6 +2643,8 @@ static const struct parse_data ssid_fiel { INT(ap_max_inactivity) }, { INT(dtim_period) }, { INT(beacon_int) }, @@ -162,7 +162,7 @@ Signed-hostap: Antonio Quartulli #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) -@@ -790,6 +792,9 @@ struct wpa_ssid { +@@ -832,6 +834,9 @@ struct wpa_ssid { */ void *parent_cred; @@ -174,11 +174,11 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3266,6 +3266,12 @@ static void wpas_start_assoc_cb(struct w +@@ -3615,6 +3615,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; -+ i = 0; ++ int i = 0; + while (i < WLAN_SUPP_RATES_MAX) { + params.rates[i] = ssid->rates[i]; + i++; @@ -186,4 +186,4 @@ Signed-hostap: Antonio Quartulli + params.mcast_rate = ssid->mcast_rate; } - params.pairwise_suite = cipher_pairwise; + if (bss && ssid->enable_edmg) diff --git a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch index 54ac6a7e3c..1d3d46dd26 100644 --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5323,7 +5323,7 @@ static int wpa_driver_nl80211_ibss(struc +@@ -5573,7 +5573,7 @@ static int wpa_driver_nl80211_ibss(struc struct wpa_driver_associate_params *params) { struct nl_msg *msg; @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli int count = 0; wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); -@@ -5350,6 +5350,37 @@ retry: +@@ -5600,6 +5600,37 @@ retry: nl80211_put_beacon_int(msg, params->beacon_int)) goto fail; diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index b1c0a59188..9ee60b1a63 100644 --- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch @@ -19,17 +19,17 @@ Tested-by: Simon Wunderlich --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1484,6 +1484,7 @@ struct wpa_driver_mesh_join_params { +@@ -1546,6 +1546,7 @@ struct wpa_driver_mesh_join_params { + #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004 #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; - u8 handle_dfs; + int mcast_rate; }; - /** + struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9612,6 +9612,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -9959,6 +9959,18 @@ static int nl80211_put_mesh_id(struct nl } @@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params) { -@@ -9673,6 +9685,7 @@ static int nl80211_join_mesh(struct i802 +@@ -10017,6 +10029,7 @@ static int nl80211_join_mesh(struct i802 nl80211_put_basic_rates(msg, params->basic_rates) || nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || nl80211_put_beacon_int(msg, params->beacon_int) || @@ -58,7 +58,7 @@ Tested-by: Simon Wunderlich --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -494,6 +494,7 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -460,6 +460,7 @@ int wpa_supplicant_join_mesh(struct wpa_ params->meshid = ssid->ssid; params->meshid_len = ssid->ssid_len; diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch index 4b63b6fd78..17c9837969 100644 --- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2216,11 +2216,13 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2402,11 +2402,13 @@ void ibss_mesh_setup_freq(struct wpa_sup for (j = 0; j < wpa_s->last_scan_res_used; j++) { struct wpa_bss *bss = wpa_s->last_scan_res[j]; diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch index a0e5384e3c..57a78ee865 100644 --- a/package/network/services/hostapd/patches/470-survey_data_fallback.patch +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch @@ -1,6 +1,6 @@ --- a/src/ap/acs.c +++ b/src/ap/acs.c -@@ -293,18 +293,12 @@ static void acs_fail(struct hostapd_ifac +@@ -302,18 +302,12 @@ static void acs_fail(struct hostapd_ifac static long double acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf) { @@ -20,7 +20,7 @@ total = survey->channel_time; -@@ -406,20 +400,19 @@ static int acs_usable_vht160_chan(const +@@ -415,20 +409,19 @@ static int acs_usable_vht160_chan(const static int acs_survey_is_sufficient(struct freq_survey *survey) { if (!(survey->filled & SURVEY_HAS_NF)) { diff --git a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch index 1edfb8e804..1da40367aa 100644 --- a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch +++ b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -1332,14 +1332,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) +@@ -1310,14 +1310,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) @$(AR) cr $@ hostapd_multi.o $(OBJS) hostapd: $(BCHECK) $(OBJS) @@ -19,7 +19,7 @@ NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1932,23 +1932,23 @@ wpa_supplicant_multi.a: .config $(BCHECK +@@ -1920,23 +1920,23 @@ wpa_supplicant_multi.a: .config $(BCHECK @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index cc49ae3b24..c4cf2a4cde 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -165,6 +165,11 @@ OBJS += ../src/common/hw_features_common +@@ -167,6 +167,11 @@ OBJS += ../src/common/hw_features_common OBJS += ../src/eapol_auth/eapol_auth_sm.o @@ -22,15 +22,16 @@ #define OCE_STA_CFON_ENABLED(hapd) \ ((hapd->conf->oce & OCE_STA_CFON) && \ -@@ -72,6 +73,7 @@ struct hapd_interfaces { - #ifdef CONFIG_DPP - struct dpp_global *dpp; - #endif /* CONFIG_DPP */ +@@ -80,7 +81,7 @@ struct hapd_interfaces { + #ifdef CONFIG_CTRL_IFACE_UDP + unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN]; + #endif /* CONFIG_CTRL_IFACE_UDP */ +- + struct ubus_object ubus; }; enum hostapd_chan_status { -@@ -145,6 +147,7 @@ struct hostapd_data { +@@ -154,6 +155,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -38,7 +39,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -580,6 +583,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -588,6 +590,7 @@ hostapd_alloc_bss_data(struct hostapd_if struct hostapd_bss_config *bss); int hostapd_setup_interface(struct hostapd_iface *iface); int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err); @@ -48,15 +49,15 @@ struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -380,6 +380,7 @@ static void hostapd_free_hapd_data(struc +@@ -391,6 +391,7 @@ static void hostapd_free_hapd_data(struc hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); + hostapd_ubus_free_bss(hapd); - iapp_deinit(hapd->iapp); - hapd->iapp = NULL; accounting_deinit(hapd); -@@ -1377,6 +1378,8 @@ static int hostapd_setup_bss(struct host + hostapd_deinit_wpa(hapd); + vlan_deinit(hapd); +@@ -1392,6 +1393,8 @@ static int hostapd_setup_bss(struct host if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -65,15 +66,15 @@ return 0; } -@@ -1891,6 +1894,7 @@ static int hostapd_setup_interface_compl +@@ -1967,6 +1970,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; + hostapd_ubus_add_iface(iface); wpa_printf(MSG_DEBUG, "Completing interface initialization"); - if (iface->conf->channel) { + if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2087,6 +2091,7 @@ dfs_offload: +@@ -2157,6 +2161,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -81,7 +82,7 @@ hostapd_set_state(iface, HAPD_IFACE_DISABLED); wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); #ifdef CONFIG_FST -@@ -2562,6 +2567,7 @@ void hostapd_interface_deinit_free(struc +@@ -2630,6 +2635,7 @@ void hostapd_interface_deinit_free(struc (unsigned int) iface->conf->num_bss); driver = iface->bss[0]->driver; drv_priv = iface->bss[0]->drv_priv; @@ -91,7 +92,7 @@ __func__, driver, drv_priv); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -2032,7 +2032,7 @@ static void handle_auth(struct hostapd_d +@@ -2252,13 +2252,18 @@ static void handle_auth(struct hostapd_d u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; struct sta_info *sta = NULL; @@ -99,11 +100,10 @@ + int res, reply_res, ubus_resp; u16 fc; const u8 *challenge = NULL; - u32 session_timeout, acct_interim_interval; -@@ -2043,6 +2043,11 @@ static void handle_auth(struct hostapd_d - char *identity = NULL; - char *radius_cui = NULL; + u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN]; + size_t resp_ies_len = 0; u16 seq_ctrl; + struct radius_sta rad_info; + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_AUTH_REQ, + .mgmt_frame = mgmt, @@ -112,7 +112,7 @@ if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -2204,6 +2209,13 @@ static void handle_auth(struct hostapd_d +@@ -2418,6 +2423,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -126,18 +126,18 @@ if (res == HOSTAPD_ACL_PENDING) return; -@@ -3862,7 +3874,7 @@ static void handle_assoc(struct hostapd_ - u16 capab_info, listen_interval, seq_ctrl, fc; - u16 resp = WLAN_STATUS_SUCCESS, reply_res; +@@ -4078,7 +4090,7 @@ static void handle_assoc(struct hostapd_ + int resp = WLAN_STATUS_SUCCESS; + u16 reply_res; const u8 *pos; - int left, i; + int left, i, ubus_resp; struct sta_info *sta; u8 *tmp = NULL; - struct hostapd_sta_wpa_psk_short *psk = NULL; -@@ -3871,6 +3883,11 @@ static void handle_assoc(struct hostapd_ #ifdef CONFIG_FILS - int delay_assoc = 0; +@@ -4291,6 +4303,11 @@ static void handle_assoc(struct hostapd_ + left = res; + } #endif /* CONFIG_FILS */ + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_ASSOC_REQ, @@ -145,11 +145,11 @@ + .ssi_signal = rssi, + }; - if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) : - sizeof(mgmt->u.assoc_req))) { -@@ -4050,6 +4067,14 @@ static void handle_assoc(struct hostapd_ - } - #endif /* CONFIG_MBO */ + /* followed by SSID and Supported rates; and HT capabilities if 802.11n + * is used */ +@@ -4455,6 +4472,14 @@ static void handle_assoc(struct hostapd_ + pos, left, rssi, omit_rsnxe); + os_free(tmp); + ubus_resp = hostapd_ubus_handle_event(hapd, &req); + if (ubus_resp) { @@ -160,9 +160,9 @@ + } + /* - * sta->capability is used in check_assoc_ies() for RRM enabled - * capability element. -@@ -4277,6 +4302,7 @@ static void handle_disassoc(struct hosta + * Remove the station in case tranmission of a success response fails + * (the STA was added associated to the driver) or if the station was +@@ -4482,6 +4507,7 @@ static void handle_disassoc(struct hosta wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.disassoc.reason_code)); @@ -170,7 +170,7 @@ sta = ap_get_sta(hapd, mgmt->sa); if (sta == NULL) { -@@ -4342,6 +4368,8 @@ static void handle_deauth(struct hostapd +@@ -4548,6 +4574,8 @@ static void handle_deauth(struct hostapd " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code)); @@ -181,10 +181,10 @@ wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -746,6 +746,12 @@ void handle_probe_req(struct hostapd_dat - struct hostapd_sta_wpa_psk_short *psk = NULL; - char *identity = NULL; - char *radius_cui = NULL; +@@ -810,6 +810,12 @@ void handle_probe_req(struct hostapd_dat + u16 csa_offs[2]; + size_t csa_offs_len; + struct radius_sta rad_info; + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_PROBE_REQ, + .mgmt_frame = mgmt, @@ -194,7 +194,7 @@ if (len < IEEE80211_HDRLEN) return; -@@ -923,6 +929,12 @@ void handle_probe_req(struct hostapd_dat +@@ -992,6 +998,12 @@ void handle_probe_req(struct hostapd_dat } #endif /* CONFIG_P2P */ @@ -209,9 +209,9 @@ --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -118,6 +118,10 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -119,6 +119,10 @@ int hostapd_notif_assoc(struct hostapd_d u16 reason = WLAN_REASON_UNSPECIFIED; - u16 status = WLAN_STATUS_SUCCESS; + int status = WLAN_STATUS_SUCCESS; const u8 *p2p_dev_addr = NULL; + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_ASSOC_REQ, @@ -220,7 +220,7 @@ if (addr == NULL) { /* -@@ -210,6 +214,12 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -211,6 +215,12 @@ int hostapd_notif_assoc(struct hostapd_d goto fail; } @@ -235,7 +235,7 @@ wpabuf_free(sta->p2p_ie); --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c -@@ -424,6 +424,7 @@ void ap_handle_timer(void *eloop_ctx, vo +@@ -423,6 +423,7 @@ void ap_handle_timer(void *eloop_ctx, vo HOSTAPD_LEVEL_INFO, "deauthenticated due to " "local deauth request"); ap_free_sta(hapd, sta); @@ -251,7 +251,7 @@ break; } } -@@ -1284,6 +1286,7 @@ void ap_sta_set_authorized(struct hostap +@@ -1293,6 +1295,7 @@ void ap_sta_set_authorized(struct hostap buf, ip_addr, keyid_buf); } else { wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf); @@ -261,7 +261,7 @@ hapd->msg_ctx_parent != hapd->msg_ctx) --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -185,6 +185,7 @@ static void hostapd_wpa_auth_psk_failure +@@ -251,6 +251,7 @@ static void hostapd_wpa_auth_psk_failure struct hostapd_data *hapd = ctx; wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR, MAC2STR(addr)); @@ -271,7 +271,7 @@ --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -188,6 +188,12 @@ ifdef CONFIG_EAPOL_TEST +@@ -190,6 +190,12 @@ ifdef CONFIG_EAPOL_TEST CFLAGS += -Werror -DEAPOL_TEST endif @@ -284,19 +284,19 @@ ifdef CONFIG_CODE_COVERAGE CFLAGS += -O0 -fprofile-arcs -ftest-coverage LIBS += -lgcov -@@ -945,6 +951,9 @@ endif - ifdef CONFIG_IEEE80211AX - OBJS += ../src/ap/ieee802_11_he.o +@@ -877,6 +883,9 @@ OBJS += ../src/pae/ieee802_1x_secy_ops.o + ifdef CONFIG_AP + OBJS += ../src/ap/wpa_auth_kay.o endif +ifdef CONFIG_UBUS +OBJS += ../src/ap/ubus.o +endif endif - ifdef CONFIG_WNM_AP - CFLAGS += -DCONFIG_WNM_AP + + ifdef CONFIG_IEEE8021X_EAPOL --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -6297,6 +6297,8 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -6771,6 +6771,8 @@ struct wpa_supplicant * wpa_supplicant_a } #endif /* CONFIG_P2P */ @@ -305,7 +305,7 @@ return wpa_s; } -@@ -6323,6 +6325,8 @@ int wpa_supplicant_remove_iface(struct w +@@ -6797,6 +6799,8 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -314,7 +314,7 @@ /* Remove interface from the global list of interfaces */ prev = global->ifaces; if (prev == wpa_s) { -@@ -6626,8 +6630,12 @@ int wpa_supplicant_run(struct wpa_global +@@ -7100,8 +7104,12 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -337,7 +337,7 @@ extern const char *const wpa_supplicant_version; extern const char *const wpa_supplicant_license; -@@ -306,6 +307,8 @@ struct wpa_global { +@@ -310,6 +311,8 @@ struct wpa_global { #endif /* CONFIG_WIFI_DISPLAY */ struct psk_list_entry *add_psk; /* From group formation */ @@ -346,7 +346,7 @@ }; -@@ -506,6 +509,7 @@ struct wpa_supplicant { +@@ -520,6 +523,7 @@ struct wpa_supplicant { unsigned char own_addr[ETH_ALEN]; unsigned char perm_addr[ETH_ALEN]; char ifname[100]; @@ -375,7 +375,7 @@ --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -894,6 +894,7 @@ int main(int argc, char *argv[]) +@@ -892,6 +892,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); @@ -383,7 +383,7 @@ if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -903,6 +904,7 @@ int main(int argc, char *argv[]) +@@ -901,6 +902,7 @@ int main(int argc, char *argv[]) ret = 0; out: diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch index e89d21d580..053dcdad83 100644 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ b/package/network/services/hostapd/patches/700-wifi-reload.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2470,6 +2470,8 @@ static int hostapd_config_fill(struct ho +@@ -2460,6 +2460,8 @@ static int hostapd_config_fill(struct ho bss->isolate = atoi(pos); } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { bss->ap_max_inactivity = atoi(pos); @@ -9,18 +9,18 @@ } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) { bss->skip_inactivity_poll = atoi(pos); } else if (os_strcmp(buf, "country_code") == 0) { -@@ -3131,6 +3133,8 @@ static int hostapd_config_fill(struct ho +@@ -3156,6 +3158,8 @@ static int hostapd_config_fill(struct ho } } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) { conf->acs_exclude_dfs = atoi(pos); + } else if (os_strcmp(buf, "radio_config_id") == 0) { + conf->config_id = os_strdup(pos); + } else if (os_strcmp(buf, "op_class") == 0) { + conf->op_class = atoi(pos); } else if (os_strcmp(buf, "channel") == 0) { - if (os_strcmp(pos, "acs_survey") == 0) { - #ifndef CONFIG_ACS --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c -@@ -698,6 +698,7 @@ void hostapd_config_free_bss(struct host +@@ -772,6 +772,7 @@ void hostapd_config_free_bss(struct host os_free(conf->radius_req_attr_sqlite); os_free(conf->rsn_preauth_interfaces); os_free(conf->ctrl_interface); @@ -28,7 +28,7 @@ os_free(conf->ca_cert); os_free(conf->server_cert); os_free(conf->server_cert2); -@@ -881,6 +882,7 @@ void hostapd_config_free(struct hostapd_ +@@ -964,6 +965,7 @@ void hostapd_config_free(struct hostapd_ for (i = 0; i < conf->num_bss; i++) hostapd_config_free_bss(conf->bss[i]); @@ -38,7 +38,7 @@ os_free(conf->basic_rates); --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -829,6 +829,7 @@ struct hostapd_bss_config { +@@ -859,6 +859,7 @@ struct hostapd_bss_config { */ u8 mka_psk_set; #endif /* CONFIG_MACSEC */ @@ -46,7 +46,7 @@ }; /** -@@ -1012,6 +1013,7 @@ struct hostapd_config { +@@ -1050,6 +1051,7 @@ struct hostapd_config { unsigned int airtime_update_interval; #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1) #endif /* CONFIG_AIRTIME_POLICY */ @@ -56,7 +56,7 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -206,6 +206,10 @@ static int hostapd_iface_conf_changed(st +@@ -216,6 +216,10 @@ static int hostapd_iface_conf_changed(st { size_t i; @@ -67,7 +67,7 @@ if (newconf->num_bss != oldconf->num_bss) return 1; -@@ -219,7 +223,7 @@ static int hostapd_iface_conf_changed(st +@@ -229,7 +233,7 @@ static int hostapd_iface_conf_changed(st } @@ -76,7 +76,7 @@ { struct hapd_interfaces *interfaces = iface->interfaces; struct hostapd_data *hapd = iface->bss[0]; -@@ -242,13 +246,16 @@ int hostapd_reload_config(struct hostapd +@@ -252,13 +256,16 @@ int hostapd_reload_config(struct hostapd if (newconf == NULL) return -1; @@ -95,7 +95,7 @@ wpa_printf(MSG_DEBUG, "Configuration changes include interface/BSS modification - force full disable+enable sequence"); fname = os_strdup(iface->config_fname); -@@ -273,6 +280,22 @@ int hostapd_reload_config(struct hostapd +@@ -283,6 +290,24 @@ int hostapd_reload_config(struct hostapd wpa_printf(MSG_ERROR, "Failed to enable interface on config reload"); return res; @@ -105,7 +105,9 @@ + if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) { + hostapd_flush_old_stations(iface->bss[j], + WLAN_REASON_PREV_AUTH_NOT_VALID); ++#ifdef CONFIG_WEP + hostapd_broadcast_wep_clear(iface->bss[j]); ++#endif + +#ifndef CONFIG_NO_RADIUS + /* TODO: update dynamic data based on changed configuration @@ -118,7 +120,7 @@ } iface->conf = newconf; -@@ -289,6 +312,12 @@ int hostapd_reload_config(struct hostapd +@@ -299,6 +324,12 @@ int hostapd_reload_config(struct hostapd for (j = 0; j < iface->num_bss; j++) { hapd = iface->bss[j]; @@ -131,7 +133,7 @@ hapd->iconf = newconf; hapd->conf = newconf->bss[j]; hostapd_reload_bss(hapd); -@@ -2257,6 +2286,10 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -2329,6 +2360,10 @@ hostapd_alloc_bss_data(struct hostapd_if hapd->iconf = conf; hapd->conf = bss; hapd->iface = hapd_iface; @@ -144,7 +146,7 @@ hapd->ctrl_sock = -1; --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -42,7 +42,7 @@ struct mesh_conf; +@@ -46,7 +46,7 @@ struct mesh_conf; struct hostapd_iface; struct hapd_interfaces { @@ -153,7 +155,7 @@ struct hostapd_config * (*config_read_cb)(const char *config_fname); int (*ctrl_iface_init)(struct hostapd_data *hapd); void (*ctrl_iface_deinit)(struct hostapd_data *hapd); -@@ -148,6 +148,7 @@ struct hostapd_data { +@@ -156,6 +156,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; struct hostapd_ubus_bss ubus; @@ -161,7 +163,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -575,7 +576,7 @@ struct hostapd_iface { +@@ -582,7 +583,7 @@ struct hostapd_iface { int hostapd_for_each_interface(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); @@ -172,7 +174,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4295,6 +4295,9 @@ static int wpa_driver_nl80211_set_ap(voi +@@ -4486,6 +4486,9 @@ static int wpa_driver_nl80211_set_ap(voi if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); @@ -184,7 +186,7 @@ nl80211_set_bss(bss, params->cts_protect, params->preamble, --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -182,7 +182,7 @@ static int hostapd_ctrl_iface_update(str +@@ -184,7 +184,7 @@ static int hostapd_ctrl_iface_update(str iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; reload_opts = txt; @@ -195,7 +197,7 @@ } --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -320,7 +320,7 @@ static void handle_term(int sig, void *s +@@ -317,7 +317,7 @@ static void handle_term(int sig, void *s static int handle_reload_iface(struct hostapd_iface *iface, void *ctx) { @@ -206,7 +208,7 @@ } --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c -@@ -275,7 +275,7 @@ static void wps_reload_config(void *eloo +@@ -315,7 +315,7 @@ static void wps_reload_config(void *eloo wpa_printf(MSG_DEBUG, "WPS: Reload configuration data"); if (iface->interfaces == NULL || diff --git a/package/network/services/hostapd/patches/800-usleep.patch b/package/network/services/hostapd/patches/800-usleep.patch deleted file mode 100644 index 6d90e6f64c..0000000000 --- a/package/network/services/hostapd/patches/800-usleep.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 39042d7f7c4997af55474ebe4513c81f00732837 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Sat, 24 Aug 2019 15:01:16 -0700 -Subject: os_sleep: Use nanosleep for POSIX versions 2008 and higher - -uClibc-ng optionally disabled deprecated POSIX functions like usleep, -causing compilation failures. This switches to nanosleep while retaining -support for older libcs that do not support nanosleep. - -Signed-off-by: Rosen Penev ---- - src/utils/os_internal.c | 6 ++++++ - src/utils/os_unix.c | 6 ++++++ - 2 files changed, 12 insertions(+) - ---- a/src/utils/os_internal.c -+++ b/src/utils/os_internal.c -@@ -25,10 +25,16 @@ - - void os_sleep(os_time_t sec, os_time_t usec) - { -+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) -+ const struct timespec req = { sec, usec * 1000 }; -+ -+ nanosleep(&req, NULL); -+#else - if (sec) - sleep(sec); - if (usec) - usleep(usec); -+#endif - } - - ---- a/src/utils/os_unix.c -+++ b/src/utils/os_unix.c -@@ -50,10 +50,16 @@ struct os_alloc_trace { - - void os_sleep(os_time_t sec, os_time_t usec) - { -+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) -+ const struct timespec req = { sec, usec * 1000 }; -+ -+ nanosleep(&req, NULL); -+#else - if (sec) - sleep(sec); - if (usec) - usleep(usec); -+#endif - } - - From 472fd98c5b12b531e0cb8dacb2625dd1810b278d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 4 May 2020 10:14:32 +0200 Subject: [PATCH 02/21] hostapd: disable support for Wired Equivalent Privacy by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream in commit 200c7693c9a1 ("Make WEP functionality an optional build parameter") has made WEP functionality an optional build parameter disabled as default, because WEP should not be used for anything anymore. As a step towards removing it completely, they moved all WEP related functionality behind CONFIG_WEP blocks and disabled it by default. This functionality is subject to be completely removed in a future release. So follow this good security advice, deprecation notice and disable WEP by default, but still allow custom builds with WEP support via CONFIG_WPA_ENABLE_WEP config option till upstream removes support for WEP completely. Signed-off-by: Petr Štetiar --- package/network/services/hostapd/Config.in | 9 +++++++++ package/network/services/hostapd/Makefile | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index 9dfa44e313..2cdd1ed970 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -73,3 +73,12 @@ config DRIVER_11AC_SUPPORT config DRIVER_11W_SUPPORT bool default n + +config WPA_ENABLE_WEP + bool "Enable support for unsecure and obsolete WEP" + help + Wired equivalent privacy (WEP) is an obsolete cryptographic data + confidentiality algorithm that is not considered secure. It should not be used + for anything anymore. The functionality needed to use WEP is available in the + current hostapd release under this optional build parameter and completely + removed in a future release. diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index b4b70a3d6f..a2c5a34f2f 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -32,6 +32,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_DRIVER_WEXT_SUPPORT \ CONFIG_DRIVER_11N_SUPPORT \ CONFIG_DRIVER_11AC_SUPPORT \ + CONFIG_WPA_ENABLE_WEP EAPOL_TEST_PROVIDERS:=eapol-test eapol-test-openssl eapol-test-wolfssl @@ -445,6 +446,10 @@ ifdef CONFIG_PACKAGE_kmod-cfg80211 TARGET_LDFLAGS += -lm -lnl-tiny endif +ifdef CONFIG_WPA_ENABLE_WEP + DRIVER_MAKEOPTS += CONFIG_WEP=y +endif + define Build/RunMake CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \ From a860fe2304c5c555af9113c93377ed7bb6e6abca Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 20 May 2020 22:43:08 -0600 Subject: [PATCH 03/21] wireguard: bump to 1.0.20200520 This version has the various slew of bug fixes and compat fixes and such, but the most interesting thing from an OpenWRT perspective is that WireGuard now plays nicely with cake and fq_codel. I'll be very interested to hear from OpenWRT users whether this makes a measurable difference. Usual set of full changes follows. This release aligns with the changes I sent to DaveM for 5.7-rc7 and were pushed to net.git about 45 minutes ago. * qemu: use newer iproute2 for gcc-10 * qemu: add -fcommon for compiling ping with gcc-10 These enable the test suite to compile with gcc-10. * noise: read preshared key while taking lock Matt noticed a benign data race when porting the Linux code to OpenBSD. * queueing: preserve flow hash across packet scrubbing * noise: separate receive counter from send counter WireGuard now works with fq_codel, cake, and other qdiscs that make use of skb->hash. This should significantly improve latency spikes related to buffer bloat. Here's a before and after graph from some data Toke measured: https://data.zx2c4.com/removal-of-buffer-bloat-in-wireguard.png * compat: support RHEL 8 as 8.2, drop 8.1 support * compat: support CentOS 8 explicitly * compat: RHEL7 backported the skb hash renamings The usual RHEL churn. * compat: backport renamed/missing skb hash members The new support for fq_codel and friends meant more backporting work. * compat: ip6_dst_lookup_flow was backported to 4.14, 4.9, and 4.4 The main motivation for releasing this now: three stable kernels were released at the same time, with a patch that necessitated updating in our compat layer. Signed-off-by: Jason A. Donenfeld --- package/network/services/wireguard/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/services/wireguard/Makefile b/package/network/services/wireguard/Makefile index b856d82773..ce91fbe9b5 100644 --- a/package/network/services/wireguard/Makefile +++ b/package/network/services/wireguard/Makefile @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=wireguard -PKG_VERSION:=1.0.20200506 +PKG_VERSION:=1.0.20200520 PKG_RELEASE:=1 PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/ -PKG_HASH:=98a99f2b825a82d57a7213e666f1ee4f7cc02bddb09bf4908b4b09447a8f121e +PKG_HASH:=16e7ae4bef734b243428eea07f3b3c3d4721880c3ea8eb8f98628fd6ae5b77c3 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING From 017320ead3a21415ab876012d1a2844e783c071f Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 21 May 2020 10:15:46 +0100 Subject: [PATCH 04/21] hostapd: bring back mesh patches Bring back 802.11s mesh features to the level previously available before the recent hostapd version bump. This is mostly to support use of 802.11s on DFS channels, but also making mesh forwarding configurable which is crucial for use of 802.11s MAC with other routing protocols, such as batman-adv, on top. While at it, fix new compiler warning by adapting 700-wifi-reload.patch to upstream changes, now building without any warnings again. Fixes: 0a3ec87a66 ("hostapd: update to latest Git hostap_2_9-1238-gdd2daf0848ed") Signed-off-by: Daniel Golle --- package/network/services/hostapd/Makefile | 2 +- ...ompletion-callback-to-complete-mesh-.patch | 124 ++++++++++ ...-frequency-as-pri-sec-channel-switch.patch | 26 +++ ...rnel-driver-DFS-handler-in-userspace.patch | 48 ++++ ...annel-attributes-before-running-Mesh.patch | 47 ++++ ...hannels-to-be-selected-if-dfs-is-ena.patch | 78 +++++++ ...-do-not-allow-pri-sec-channel-switch.patch | 29 +++ ...sh-do-not-use-offchan-mgmt-tx-on-DFS.patch | 52 +++++ ...-fix-channel-switch-error-during-CAC.patch | 61 +++++ ...18-mesh-make-forwarding-configurable.patch | 219 ++++++++++++++++++ .../hostapd/patches/200-multicall.patch | 34 +-- .../services/hostapd/patches/300-noscan.patch | 2 +- .../hostapd/patches/301-mesh-noscan.patch | 12 +- .../patches/310-rescan_immediately.patch | 2 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/340-reload_freq_change.patch | 6 +- .../patches/350-nl80211_del_beacon_bss.patch | 10 +- .../patches/360-ctrl_iface_reload.patch | 2 +- .../hostapd/patches/370-ap_sta_support.patch | 22 +- .../patches/380-disable_ctrl_iface_mib.patch | 24 +- .../patches/420-indicate-features.patch | 4 +- ...dd-new-config-params-to-be-used-with.patch | 6 +- ...-use-new-parameters-during-ibss-join.patch | 4 +- .../patches/463-add-mcast_rate-to-11s.patch | 10 +- .../patches/464-fix-mesh-obss-check.patch | 2 +- .../patches/500-lto-jobserver-support.patch | 4 +- .../hostapd/patches/600-ubus_support.patch | 46 ++-- .../hostapd/patches/700-wifi-reload.patch | 22 +- 28 files changed, 792 insertions(+), 108 deletions(-) create mode 100644 package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch create mode 100644 package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch create mode 100644 package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch create mode 100644 package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch create mode 100644 package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch create mode 100644 package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch create mode 100644 package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch create mode 100644 package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch create mode 100644 package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index a2c5a34f2f..66560d5d41 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch b/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch new file mode 100644 index 0000000000..844437f74a --- /dev/null +++ b/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch @@ -0,0 +1,124 @@ +From c05ace7510ead96e72b97ce47b33f7b5865d6d36 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Mon, 27 Aug 2018 14:28:38 -0700 +Subject: [PATCH 1/7] mesh: use setup completion callback to complete mesh join + +mesh join function is the last function to be called during +mesh join process, but it's been called a bit earlier than +it's supposed to be, so that some mesh parameter values +such as VHT capabilities not applied correct when mesh join +is in process. +Moreover current design of mesh join that is called directly +after mesh initialization isn't suitable for DFS channels to use, +since mesh join process should be paused until DFS CAC is +done and resumed after it's done. +The callback will be called by hostapd_setup_interface_complete_sync. +There is possiblity that completing mesh init fails, so add error +handle codes. + +Signed-off-by: Peter Oh +Signed-off-by: Peter Oh +--- + src/ap/hostapd.c | 11 ++++++++++- + wpa_supplicant/mesh.c | 13 +++++++------ + 2 files changed, 17 insertions(+), 7 deletions(-) + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -434,6 +434,8 @@ static void hostapd_free_hapd_data(struc + #ifdef CONFIG_MESH + wpabuf_free(hapd->mesh_pending_auth); + hapd->mesh_pending_auth = NULL; ++ /* handling setup failure is already done */ ++ hapd->setup_complete_cb = NULL; + #endif /* CONFIG_MESH */ + + hostapd_clean_rrm(hapd); +@@ -2145,6 +2147,13 @@ dfs_offload: + if (hapd->setup_complete_cb) + hapd->setup_complete_cb(hapd->setup_complete_cb_ctx); + ++#ifdef CONFIG_MESH ++ if (delay_apply_cfg && !iface->mconf) { ++ wpa_printf(MSG_ERROR, "Error while completing mesh init"); ++ goto fail; ++ } ++#endif /* CONFIG_MESH */ ++ + wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", + iface->bss[0]->conf->iface); + if (iface->interfaces && iface->interfaces->terminate_on_error > 0) +@@ -2288,7 +2297,7 @@ int hostapd_setup_interface(struct hosta + ret = setup_interface(iface); + if (ret) { + wpa_printf(MSG_ERROR, "%s: Unable to setup interface.", +- iface->bss[0]->conf->iface); ++ iface->conf ? iface->conf->bss[0]->iface : "N/A"); + return -1; + } + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -194,8 +194,9 @@ static int wpas_mesh_init_rsn(struct wpa + } + + +-static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) ++static void wpas_mesh_complete_cb(void *ctx) + { ++ struct wpa_supplicant *wpa_s = ctx; + struct hostapd_iface *ifmsh = wpa_s->ifmsh; + struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; + struct wpa_ssid *ssid = wpa_s->current_ssid; +@@ -204,7 +205,7 @@ static int wpas_mesh_complete(struct wpa + if (!params || !ssid || !ifmsh) { + wpa_printf(MSG_ERROR, "mesh: %s called without active mesh", + __func__); +- return -1; ++ return; + } + + if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && +@@ -213,7 +214,7 @@ static int wpas_mesh_complete(struct wpa + "mesh: RSN initialization failed - deinit mesh"); + wpa_supplicant_mesh_deinit(wpa_s); + wpa_drv_leave_mesh(wpa_s); +- return -1; ++ return; + } + + if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { +@@ -239,8 +240,6 @@ static int wpas_mesh_complete(struct wpa + + if (!ret) + wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); +- +- return ret; + } + + +@@ -267,6 +266,7 @@ static int wpa_supplicant_mesh_init(stru + if (!ifmsh) + return -ENOMEM; + ++ ifmsh->owner = wpa_s; + ifmsh->drv_flags = wpa_s->drv_flags; + ifmsh->drv_flags2 = wpa_s->drv_flags2; + ifmsh->num_bss = 1; +@@ -285,6 +285,8 @@ static int wpa_supplicant_mesh_init(stru + bss->drv_priv = wpa_s->drv_priv; + bss->iface = ifmsh; + bss->mesh_sta_free_cb = mesh_mpm_free_sta; ++ bss->setup_complete_cb = wpas_mesh_complete_cb; ++ bss->setup_complete_cb_ctx = wpa_s; + frequency = ssid->frequency; + if (frequency != freq->freq && + frequency == freq->freq + freq->sec_channel_offset * 20) { +@@ -526,7 +528,6 @@ int wpa_supplicant_join_mesh(struct wpa_ + goto out; + } + +- ret = wpas_mesh_complete(wpa_s); + out: + return ret; + } diff --git a/package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch new file mode 100644 index 0000000000..1167982ba5 --- /dev/null +++ b/package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch @@ -0,0 +1,26 @@ +From c56f18380d1d404a2abc0ea5373d294508ef1e54 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Mon, 27 Aug 2018 14:28:41 -0700 +Subject: [PATCH 2/7] mesh: update ssid->frequency as pri/sec channel switch + +ssid->frequency is one of variables used to gets channel +number from given frequency. Leave it as unchanged when +pri/sec channel switched will cause picking up wrong +channel number after applying secondary channel offset +for HT40 and leads failing interface bring-up. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -292,6 +292,7 @@ static int wpa_supplicant_mesh_init(stru + frequency == freq->freq + freq->sec_channel_offset * 20) { + wpa_printf(MSG_DEBUG, "mesh: pri/sec channels switched"); + frequency = freq->freq; ++ ssid->frequency = frequency; + } + wpa_s->assoc_freq = frequency; + wpa_s->current_ssid = ssid; diff --git a/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch b/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch new file mode 100644 index 0000000000..8b1ce88864 --- /dev/null +++ b/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch @@ -0,0 +1,48 @@ +From 593602b7f14be5c2695979639764b1c50f01bbec Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Mon, 27 Aug 2018 14:28:49 -0700 +Subject: [PATCH 7/7] mesh: inform kernel driver DFS handler in userspace + +NL80211_ATTR_HANDLE_DFS is required by kerenel space +to enable DFS channels that indicates DFS handler +resides in userspace. + +Signed-off-by: Peter Oh +--- + src/drivers/driver.h | 1 + + src/drivers/driver_nl80211.c | 3 +++ + wpa_supplicant/mesh.c | 1 + + 3 files changed, 5 insertions(+) + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -1542,6 +1542,7 @@ struct wpa_driver_mesh_join_params { + #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004 + #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 + unsigned int flags; ++ u8 handle_dfs; + }; + + struct wpa_driver_set_key_params { +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -10038,6 +10038,9 @@ static int nl80211_join_mesh(struct i802 + + wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags); + ++ if (params->handle_dfs) ++ if (nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS)) ++ goto fail; + container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP); + if (!container) + goto fail; +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -314,6 +314,7 @@ static int wpa_supplicant_mesh_init(stru + conf->country[0] = wpa_s->conf->country[0]; + conf->country[1] = wpa_s->conf->country[1]; + conf->country[2] = ' '; ++ wpa_s->mesh_params->handle_dfs = 1; + } + + bss->iconf = conf; diff --git a/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch b/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch new file mode 100644 index 0000000000..a0d20023be --- /dev/null +++ b/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch @@ -0,0 +1,47 @@ +From 2564184440d9d6041d11a8c7d50b31368634c3bd Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Mon, 27 Aug 2018 14:28:40 -0700 +Subject: [PATCH] mesh: Apply channel attributes before setup interface + +This helps mesh interface initialization with correct channel +parameters. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -253,7 +253,7 @@ static int wpa_supplicant_mesh_init(stru + struct mesh_conf *mconf; + int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 }; + int rate_len; +- int frequency; ++ int frequency, saved_freq; + + if (!wpa_s->conf->user_mpm) { + /* not much for us to do here */ +@@ -391,6 +391,13 @@ static int wpa_supplicant_mesh_init(stru + conf->basic_rates[rate_len] = -1; + } + ++ /* Handle pri/sec switch frequency within AP configuration parameter ++ * generation without changing the stored network profile in the end. */ ++ saved_freq = ssid->frequency; ++ ssid->frequency = frequency; ++ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); ++ ssid->frequency = saved_freq; ++ + if (wpa_drv_init_mesh(wpa_s)) { + wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); + return -1; +@@ -402,8 +409,6 @@ static int wpa_supplicant_mesh_init(stru + return -1; + } + +- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); +- + return 0; + out_free: + wpa_supplicant_mesh_deinit(wpa_s); diff --git a/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch new file mode 100644 index 0000000000..cc63576883 --- /dev/null +++ b/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch @@ -0,0 +1,78 @@ +From 89fa0d75fb1be82330258082ed3d7fd452eb6076 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Mon, 27 Aug 2018 14:28:45 -0700 +Subject: [PATCH 3/7] mesh: Allow DFS channels to be selected if dfs is enabled + +Note: DFS is assumed to be usable if a country code has been set + +Signed-off-by: Benjamin Berg +Signed-off-by: Peter Oh +--- + wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2345,6 +2345,8 @@ void ibss_mesh_setup_freq(struct wpa_sup + int chwidth, seg0, seg1; + u32 vht_caps = 0; + int is_24ghz; ++ int dfs_enabled = wpa_s->conf->country[0] && ++ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); + + freq->freq = ssid->frequency; + +@@ -2432,8 +2434,11 @@ void ibss_mesh_setup_freq(struct wpa_sup + return; + + /* Check primary channel flags */ +- if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) ++ if (pri_chan->flag & HOSTAPD_CHAN_DISABLED) + return; ++ if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (!dfs_enabled) ++ return; + + freq->channel = pri_chan->chan; + +@@ -2466,8 +2471,11 @@ void ibss_mesh_setup_freq(struct wpa_sup + return; + + /* Check secondary channel flags */ +- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) ++ if (sec_chan->flag & HOSTAPD_CHAN_DISABLED) + return; ++ if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (!dfs_enabled) ++ return; + + if (ht40 == -1) { + if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) +@@ -2560,8 +2568,11 @@ skip_ht40: + return; + + /* Back to HT configuration if channel not usable */ +- if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) ++ if (chan->flag & HOSTAPD_CHAN_DISABLED) + return; ++ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (!dfs_enabled) ++ return; + } + + chwidth = CHANWIDTH_80MHZ; +@@ -2581,10 +2592,11 @@ skip_ht40: + if (!chan) + continue; + +- if (chan->flag & (HOSTAPD_CHAN_DISABLED | +- HOSTAPD_CHAN_NO_IR | +- HOSTAPD_CHAN_RADAR)) ++ if (chan->flag & HOSTAPD_CHAN_DISABLED) + continue; ++ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (!dfs_enabled) ++ continue; + + /* Found a suitable second segment for 80+80 */ + chwidth = CHANWIDTH_80P80MHZ; diff --git a/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch new file mode 100644 index 0000000000..45c18fb3b6 --- /dev/null +++ b/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch @@ -0,0 +1,29 @@ +From 4f4a9b9e2e61fba334a21dadea749e4b440f42e6 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Mon, 27 Aug 2018 14:28:48 -0700 +Subject: [PATCH 6/7] mesh: don't allow pri/sec channel switch + +This limitation isn't backed by standard, but it is known that +mesh doesn't have capability to handle 20/40 coex change in +current implementation and it will not able to establish +PLINK when channel switch between primary and secondary happens. + +Since it's unknown when we will have the implementation of handling +20/40 coex change for mesh, it'd better to avoid them from happening +until standard based implementation is introduced. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -391,6 +391,7 @@ static int wpa_supplicant_mesh_init(stru + conf->basic_rates[rate_len] = -1; + } + ++ conf->no_pri_sec_switch = 1; + /* Handle pri/sec switch frequency within AP configuration parameter + * generation without changing the stored network profile in the end. */ + saved_freq = ssid->frequency; diff --git a/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch b/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch new file mode 100644 index 0000000000..3d623a65b2 --- /dev/null +++ b/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch @@ -0,0 +1,52 @@ +From 71e9c65a7c8af90a5fd11072062b596421316452 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Mon, 27 Aug 2018 14:28:46 -0700 +Subject: [PATCH 4/7] mesh: do not set offchanok on DFS channels in non-ETSI + +mac80211 does not allow mgmt tx to use off channel on +DFS channels in non-ETSI domain, because it will invalidate +CAC result on current operating channel. +(mac80211 commit: 34373d12f3cbb74960a73431138ef619d857996f) +Hence don't set offchanok for mgmt tx in case of DFS channels +in non-ETSI. + +Signed-off-by: Peter Oh +--- + src/drivers/driver_nl80211.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -7788,6 +7788,10 @@ static int wpa_driver_nl80211_send_actio + u8 *buf; + struct ieee80211_hdr *hdr; + int offchanok = 1; ++ struct hostapd_hw_modes *modes; ++ int i; ++ u16 num_modes, flags; ++ u8 dfs_domain; + + if (is_ap_interface(drv->nlmode) && (int) freq == bss->freq && + bss->beacon_set) +@@ -7816,6 +7820,21 @@ static int wpa_driver_nl80211_send_actio + os_memset(bss->rand_addr, 0, ETH_ALEN); + } + ++ if (is_mesh_interface(drv->nlmode)) { ++ modes = nl80211_get_hw_feature_data(bss, &num_modes, ++ &flags, &dfs_domain); ++ if (dfs_domain != HOSTAPD_DFS_REGION_ETSI && ++ ieee80211_is_dfs(bss->freq, modes, num_modes)) ++ offchanok = 0; ++ if (modes) { ++ for (i = 0; i < num_modes; i++) { ++ os_free(modes[i].channels); ++ os_free(modes[i].rates); ++ } ++ os_free(modes); ++ } ++ } ++ + if (is_ap_interface(drv->nlmode) && + (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || + (int) freq == bss->freq || drv->device_ap_sme || diff --git a/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch b/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch new file mode 100644 index 0000000000..6b52abf988 --- /dev/null +++ b/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch @@ -0,0 +1,61 @@ +From 5913d6e2a741683e7c747c046f72ca790bbe1337 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Mon, 27 Aug 2018 14:28:47 -0700 +Subject: [PATCH 5/7] mesh: fix channel switch error during CAC + +Mesh interface has used its channel parameters that configured +during its initialization even after channel switched due to +DFS radar detection during CAC which caused channel switch error. +This change fixes the error by updating its channel parameters +when channel's been changed from initial one. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -13,6 +13,7 @@ + #include "utils/uuid.h" + #include "common/ieee802_11_defs.h" + #include "common/wpa_ctrl.h" ++#include "common/hw_features_common.h" + #include "ap/sta_info.h" + #include "ap/hostapd.h" + #include "ap/ieee802_11.h" +@@ -208,6 +209,34 @@ static void wpas_mesh_complete_cb(void * + return; + } + ++ /* ++ * inspect if channel's been changed since initialized. ++ * i.e. DFS radar detection ++ */ ++ if (ifmsh->freq != params->freq.freq) { ++ wpa_s->assoc_freq = ifmsh->freq; ++ ssid->frequency = ifmsh->freq; ++ if (hostapd_set_freq_params(¶ms->freq, ++ ifmsh->conf->hw_mode, ++ ifmsh->freq, ++ ifmsh->conf->channel, ++ ifmsh->conf->enable_edmg, ++ ifmsh->conf->edmg_channel, ++ ifmsh->conf->ieee80211n, ++ ifmsh->conf->ieee80211ac, ++ ifmsh->conf->ieee80211ax, ++ ifmsh->conf->secondary_channel, ++ hostapd_get_oper_chwidth(ifmsh->conf), ++ hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), ++ hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), ++ ifmsh->current_mode->vht_capab, ++ &ifmsh->current_mode->he_capab[IEEE80211_MODE_AP])) { ++ wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); ++ wpa_supplicant_mesh_deinit(wpa_s); ++ return; ++ } ++ } ++ + if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && + wpas_mesh_init_rsn(wpa_s)) { + wpa_printf(MSG_ERROR, diff --git a/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch b/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch new file mode 100644 index 0000000000..f7ea9674da --- /dev/null +++ b/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch @@ -0,0 +1,219 @@ +From 90fe6429624fc48bc0e5d2d7eeecb7498708b5e3 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 18 Apr 2018 19:24:31 +0200 +Subject: [PATCH 18/18] mesh: make forwarding configurable + +Allow mesh_fwding to be specified in a mesh bss config, pass that +to the driver (only nl80211 implemented for now) and announce +forwarding capability accordingly. + +Signed-off-by: Daniel Golle +--- + src/ap/ap_config.h | 2 ++ + src/drivers/driver.h | 2 ++ + src/drivers/driver_nl80211.c | 3 +++ + wpa_supplicant/config.c | 4 ++++ + wpa_supplicant/config.h | 9 +++++++++ + wpa_supplicant/config_file.c | 4 ++++ + wpa_supplicant/config_ssid.h | 5 +++++ + wpa_supplicant/mesh.c | 6 ++++++ + wpa_supplicant/mesh_mpm.c | 4 ++-- + wpa_supplicant/wpa_supplicant.conf | 3 +++ + 10 files changed, 40 insertions(+), 2 deletions(-) + +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -51,6 +51,7 @@ struct mesh_conf { + int dot11MeshRetryTimeout; /* msec */ + int dot11MeshConfirmTimeout; /* msec */ + int dot11MeshHoldingTimeout; /* msec */ ++ int mesh_fwding; + }; + + #define MAX_STA_COUNT 2007 +@@ -691,6 +692,7 @@ struct hostapd_bss_config { + + #define MESH_ENABLED BIT(0) + int mesh; ++ int mesh_fwding; + + u8 radio_measurements[RRM_CAPABILITIES_IE_LEN]; + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -1515,6 +1515,7 @@ struct wpa_driver_mesh_bss_params { + #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004 + #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008 + #define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010 ++#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020 + /* + * TODO: Other mesh configuration parameters would go here. + * See NL80211_MESHCONF_* for all the mesh config parameters. +@@ -1524,6 +1525,7 @@ struct wpa_driver_mesh_bss_params { + int peer_link_timeout; + int max_peer_links; + int rssi_threshold; ++ int forwarding; + u16 ht_opmode; + }; + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -10006,6 +10006,9 @@ static int nl80211_put_mesh_config(struc + if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && + nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, + params->auto_plinks)) || ++ ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_FORWARDING) && ++ nla_put_u8(msg, NL80211_MESHCONF_FORWARDING, ++ params->forwarding)) || + ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) && + nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, + params->max_peer_links)) || +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -2473,6 +2473,7 @@ static const struct parse_data ssid_fiel + #ifdef CONFIG_MESH + { INT_RANGE(mode, 0, 5) }, + { INT_RANGE(no_auto_peer, 0, 1) }, ++ { INT_RANGE(mesh_fwding, 0, 1) }, + { INT_RANGE(mesh_rssi_threshold, -255, 1) }, + #else /* CONFIG_MESH */ + { INT_RANGE(mode, 0, 4) }, +@@ -3046,6 +3047,7 @@ void wpa_config_set_network_defaults(str + ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; + ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; + ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; ++ ssid->mesh_fwding = DEFAULT_MESH_FWDING; + ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; + #endif /* CONFIG_MESH */ + #ifdef CONFIG_HT_OVERRIDES +@@ -4273,6 +4275,7 @@ struct wpa_config * wpa_config_alloc_emp + config->user_mpm = DEFAULT_USER_MPM; + config->max_peer_links = DEFAULT_MAX_PEER_LINKS; + config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; ++ config->mesh_fwding = DEFAULT_MESH_FWDING; + config->dot11RSNASAERetransPeriod = + DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; + config->fast_reauth = DEFAULT_FAST_REAUTH; +@@ -4911,6 +4914,7 @@ static const struct global_parse_data gl + { INT(user_mpm), 0 }, + { INT_RANGE(max_peer_links, 0, 255), 0 }, + { INT(mesh_max_inactivity), 0 }, ++ { INT_RANGE(mesh_fwding, 0, 1), 0 }, + { INT(dot11RSNASAERetransPeriod), 0 }, + #endif /* CONFIG_MESH */ + { INT(disable_scan_offload), 0 }, +--- a/wpa_supplicant/config.h ++++ b/wpa_supplicant/config.h +@@ -18,6 +18,7 @@ + #define DEFAULT_USER_MPM 1 + #define DEFAULT_MAX_PEER_LINKS 99 + #define DEFAULT_MESH_MAX_INACTIVITY 300 ++#define DEFAULT_MESH_FWDING 1 + /* + * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, + * but use 1000 ms in practice to avoid issues on low power CPUs. +@@ -1351,6 +1352,14 @@ struct wpa_config { + int mesh_max_inactivity; + + /** ++ * mesh_fwding - Mesh network layer-2 forwarding ++ * ++ * This controls whether to enable layer-2 forwarding. ++ * By default: 1: enabled ++ */ ++ int mesh_fwding; ++ ++ /** + * dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame + * + * This timeout value is used in mesh STA to retransmit +--- a/wpa_supplicant/config_file.c ++++ b/wpa_supplicant/config_file.c +@@ -866,6 +866,7 @@ static void wpa_config_write_network(FIL + #endif /* IEEE8021X_EAPOL */ + INT(mode); + INT(no_auto_peer); ++ INT(mesh_fwding); + INT(frequency); + INT(enable_edmg); + INT(edmg_channel); +@@ -1526,6 +1527,9 @@ static void wpa_config_write_global(FILE + fprintf(f, "mesh_max_inactivity=%d\n", + config->mesh_max_inactivity); + ++ if (config->mesh_fwding != DEFAULT_MESH_FWDING) ++ fprintf(f, "mesh_fwding=%d\n", config->mesh_fwding); ++ + if (config->dot11RSNASAERetransPeriod != + DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD) + fprintf(f, "dot11RSNASAERetransPeriod=%d\n", +--- a/wpa_supplicant/config_ssid.h ++++ b/wpa_supplicant/config_ssid.h +@@ -540,6 +540,11 @@ struct wpa_ssid { + int dot11MeshConfirmTimeout; /* msec */ + int dot11MeshHoldingTimeout; /* msec */ + ++ /** ++ * Mesh network layer-2 forwarding ++ */ ++ int mesh_fwding; ++ + int ht; + int ht40; + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -130,6 +130,7 @@ static struct mesh_conf * mesh_config_cr + conf->mesh_cc_id = 0; + conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; + conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; ++ conf->mesh_fwding = ssid->mesh_fwding; + conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; + conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; + conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; +@@ -335,6 +336,7 @@ static int wpa_supplicant_mesh_init(stru + bss->conf->start_disabled = 1; + bss->conf->mesh = MESH_ENABLED; + bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; ++ bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding; + + if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, + wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { +@@ -556,6 +558,10 @@ int wpa_supplicant_join_mesh(struct wpa_ + } + params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; + ++ /* always explicitely set forwarding to on or off for now */ ++ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_FORWARDING; ++ params->conf.forwarding = ssid->mesh_fwding; ++ + os_free(wpa_s->mesh_params); + wpa_s->mesh_params = params; + if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { +--- a/wpa_supplicant/mesh_mpm.c ++++ b/wpa_supplicant/mesh_mpm.c +@@ -303,9 +303,9 @@ static void mesh_mpm_send_plink_action(s + info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; + /* TODO: Add Connected to Mesh Gate/AS subfields */ + wpabuf_put_u8(buf, info); +- /* always forwarding & accepting plinks for now */ ++ /* set forwarding & always accepting plinks for now */ + wpabuf_put_u8(buf, MESH_CAP_ACCEPT_ADDITIONAL_PEER | +- MESH_CAP_FORWARDING); ++ (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0)); + } else { /* Peer closing frame */ + /* IE: Mesh ID */ + wpabuf_put_u8(buf, WLAN_EID_MESH_ID); +--- a/wpa_supplicant/wpa_supplicant.conf ++++ b/wpa_supplicant/wpa_supplicant.conf +@@ -150,6 +150,9 @@ ap_scan=1 + # This timeout value is used in mesh STA to clean up inactive stations. + #mesh_max_inactivity=300 + ++# Enable 802.11s layer-2 routing and forwarding ++#mesh_fwding=1 ++ + # cert_in_cb - Whether to include a peer certificate dump in events + # This controls whether peer certificates for authentication server and + # its certificate chain are included in EAP peer certificate events. This is diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index 8459a02d16..ef28e191c9 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -36,7 +36,7 @@ LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -1294,6 +1300,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) +@@ -1300,6 +1306,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) BCHECK=../src/drivers/build.hostapd @@ -49,7 +49,7 @@ hostapd: $(BCHECK) $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -1335,6 +1347,12 @@ ifeq ($(CONFIG_TLS), linux) +@@ -1341,6 +1353,12 @@ ifeq ($(CONFIG_TLS), linux) HOBJS += ../src/crypto/crypto_linux.o endif @@ -72,7 +72,7 @@ ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository -@@ -359,7 +360,9 @@ endif +@@ -365,7 +366,9 @@ endif ifdef CONFIG_IBSS_RSN NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_IBSS_RSN @@ -82,7 +82,7 @@ OBJS += ibss_rsn.o endif -@@ -880,6 +883,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS +@@ -886,6 +889,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS LIBS += -ldl -rdynamic endif @@ -93,7 +93,7 @@ endif ifdef CONFIG_AP -@@ -887,9 +894,11 @@ NEED_EAP_COMMON=y +@@ -893,9 +900,11 @@ NEED_EAP_COMMON=y NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_AP OBJS += ap.o @@ -105,7 +105,7 @@ OBJS += ../src/ap/hostapd.o OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o -@@ -969,6 +978,12 @@ endif +@@ -975,6 +984,12 @@ endif ifdef CONFIG_HS20 OBJS += ../src/ap/hs20.o endif @@ -118,7 +118,7 @@ endif ifdef CONFIG_MBO -@@ -977,7 +992,9 @@ CFLAGS += -DCONFIG_MBO +@@ -983,7 +998,9 @@ CFLAGS += -DCONFIG_MBO endif ifdef NEED_RSN_AUTHENTICATOR @@ -128,7 +128,7 @@ NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1887,6 +1904,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1893,6 +1910,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config @@ -141,7 +141,7 @@ wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -1987,6 +2010,12 @@ endif +@@ -1993,6 +2016,12 @@ endif $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ @$(E) " sed" $< @@ -156,7 +156,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5865,8 +5865,8 @@ union wpa_event_data { +@@ -5879,8 +5879,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -167,7 +167,7 @@ /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -5878,7 +5878,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -5892,7 +5892,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -231,7 +231,7 @@ os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4499,8 +4499,8 @@ static void wpas_event_unprot_beacon(str +@@ -4500,8 +4500,8 @@ static void wpas_event_unprot_beacon(str } @@ -242,7 +242,7 @@ { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -5313,7 +5313,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -5319,7 +5319,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -253,7 +253,7 @@ struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -6571,7 +6571,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -6593,7 +6593,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -261,7 +261,7 @@ /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -6608,6 +6607,11 @@ static int wpa_supplicant_match_existing +@@ -6630,6 +6629,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -273,7 +273,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -6864,6 +6868,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -6886,6 +6890,8 @@ struct wpa_global * wpa_supplicant_init( #ifndef CONFIG_NO_WPA_MSG wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ @@ -296,7 +296,7 @@ #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -680,6 +685,8 @@ int main(int argc, char *argv[]) +@@ -684,6 +689,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index 80f9cf2a0b..53cf38c42e 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -13,7 +13,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -972,6 +972,8 @@ struct hostapd_config { +@@ -974,6 +974,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index a86070aa3a..33c481cc76 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2477,6 +2477,7 @@ static const struct parse_data ssid_fiel +@@ -2478,6 +2478,7 @@ static const struct parse_data ssid_fiel #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, #endif /* CONFIG_MESH */ @@ -15,12 +15,12 @@ INT(mode); INT(no_auto_peer); + INT(noscan); + INT(mesh_fwding); INT(frequency); INT(enable_edmg); - INT(edmg_channel); --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -333,6 +333,8 @@ static int wpa_supplicant_mesh_init(stru +@@ -368,6 +368,8 @@ static int wpa_supplicant_mesh_init(stru frequency); goto out_free; } @@ -31,7 +31,7 @@ if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2331,12 +2331,12 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2334,12 +2334,12 @@ void ibss_mesh_setup_freq(struct wpa_sup int ieee80211_mode = wpas_mode_to_ieee80211_mode(ssid->mode); enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; @@ -46,7 +46,7 @@ unsigned int j, k; struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; -@@ -2416,7 +2416,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2421,7 +2421,7 @@ void ibss_mesh_setup_freq(struct wpa_sup #endif /* CONFIG_HE_OVERRIDES */ /* Setup higher BW only for 5 GHz */ @@ -57,7 +57,7 @@ for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) { --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -960,6 +960,8 @@ struct wpa_ssid { +@@ -965,6 +965,8 @@ struct wpa_ssid { */ int no_auto_peer; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index 25f0306f8f..7c065f55b3 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4926,7 +4926,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -4948,7 +4948,7 @@ wpa_supplicant_alloc(struct wpa_supplica if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch index e9fd27560f..5ad4ed801a 100644 --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4639,7 +4639,7 @@ static int nl80211_set_channel(struct i8 +@@ -4645,7 +4645,7 @@ static int nl80211_set_channel(struct i8 freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch index 09c6a4648d..e0e62c2a11 100644 --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -112,6 +112,28 @@ static void hostapd_reload_bss(struct ho +@@ -114,6 +114,28 @@ static void hostapd_reload_bss(struct ho #endif /* CONFIG_NO_RADIUS */ ssid = &hapd->conf->ssid; @@ -29,7 +29,7 @@ if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && ssid->wpa_passphrase_set && ssid->wpa_passphrase) { /* -@@ -213,6 +235,7 @@ int hostapd_reload_config(struct hostapd +@@ -215,6 +237,7 @@ int hostapd_reload_config(struct hostapd struct hostapd_data *hapd = iface->bss[0]; struct hostapd_config *newconf, *oldconf; size_t j; @@ -37,7 +37,7 @@ if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ -@@ -263,24 +286,20 @@ int hostapd_reload_config(struct hostapd +@@ -265,24 +288,20 @@ int hostapd_reload_config(struct hostapd } iface->conf = newconf; diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch index 07b219efaf..876becfbc9 100644 --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -2778,10 +2778,15 @@ static int wpa_driver_nl80211_del_beacon +@@ -2787,10 +2787,15 @@ static int wpa_driver_nl80211_del_beacon struct nl_msg *msg; struct wpa_driver_nl80211_data *drv = bss->drv; @@ -18,7 +18,7 @@ return send_and_recv_msgs(drv, msg, NULL, NULL); } -@@ -5250,7 +5255,7 @@ static void nl80211_teardown_ap(struct i +@@ -5260,7 +5265,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); @@ -27,7 +27,7 @@ } -@@ -7631,8 +7636,6 @@ static int wpa_driver_nl80211_if_remove( +@@ -7678,8 +7683,6 @@ static int wpa_driver_nl80211_if_remove( } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); @@ -36,7 +36,7 @@ nl80211_destroy_bss(bss); if (!bss->added_if) i802_set_iface_flags(bss, 0); -@@ -8006,7 +8009,6 @@ static int wpa_driver_nl80211_deinit_ap( +@@ -8073,7 +8076,6 @@ static int wpa_driver_nl80211_deinit_ap( if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); @@ -44,7 +44,7 @@ /* * If the P2P GO interface was dynamically added, then it is -@@ -8026,7 +8028,6 @@ static int wpa_driver_nl80211_stop_ap(vo +@@ -8093,7 +8095,6 @@ static int wpa_driver_nl80211_stop_ap(vo if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch index 3d9b99510f..7692a29157 100644 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch @@ -78,7 +78,7 @@ #ifdef NEED_AP_MLME static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, -@@ -3499,6 +3556,8 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3527,6 +3584,8 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, reply_size); diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch index f678c66478..670d0a52a1 100644 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch @@ -183,7 +183,7 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -2222,6 +2274,8 @@ void wpa_supplicant_associate(struct wpa +@@ -2225,6 +2277,8 @@ void wpa_supplicant_associate(struct wpa wpa_ssid_txt(ssid->ssid, ssid->ssid_len), ssid->id); wpas_notify_mesh_group_started(wpa_s, ssid); @@ -192,7 +192,7 @@ #else /* CONFIG_MESH */ wpa_msg(wpa_s, MSG_ERROR, "mesh mode support not included in the build"); -@@ -6184,6 +6238,16 @@ static int wpa_supplicant_init_iface(str +@@ -6206,6 +6260,16 @@ static int wpa_supplicant_init_iface(str sizeof(wpa_s->bridge_ifname)); } @@ -209,7 +209,7 @@ /* RSNA Supplicant Key Management - INITIALIZE */ eapol_sm_notify_portEnabled(wpa_s->eapol, false); eapol_sm_notify_portValid(wpa_s->eapol, false); -@@ -6517,6 +6581,11 @@ static void wpa_supplicant_deinit_iface( +@@ -6539,6 +6603,11 @@ static void wpa_supplicant_deinit_iface( if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); @@ -246,7 +246,7 @@ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -2665,6 +2665,11 @@ static int hostapd_ctrl_iface_chan_switc +@@ -2693,6 +2693,11 @@ static int hostapd_ctrl_iface_chan_switc return 0; } @@ -260,7 +260,7 @@ /* Save CHAN_SWITCH VHT config */ --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1460,11 +1460,6 @@ int ieee802_11_set_beacon(struct hostapd +@@ -1468,11 +1468,6 @@ int ieee802_11_set_beacon(struct hostapd struct wpabuf *beacon, *proberesp, *assocresp; int res, ret = -1; @@ -274,7 +274,7 @@ if (ieee802_11_build_ap_params(hapd, ¶ms) < 0) --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4499,6 +4499,60 @@ static void wpas_event_unprot_beacon(str +@@ -4500,6 +4500,60 @@ static void wpas_event_unprot_beacon(str } @@ -335,7 +335,7 @@ void supplicant_event(void *ctx, enum wpa_event_type event, union wpa_event_data *data) { -@@ -4801,8 +4855,10 @@ void supplicant_event(void *ctx, enum wp +@@ -4802,8 +4856,10 @@ void supplicant_event(void *ctx, enum wp channel_width_to_string(data->ch_switch.ch_width), data->ch_switch.cf1, data->ch_switch.cf2); @@ -349,7 +349,7 @@ wpa_s->current_ssid->frequency = data->ch_switch.freq; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5669,6 +5669,7 @@ union wpa_event_data { +@@ -5683,6 +5683,7 @@ union wpa_event_data { /** * struct ch_switch @@ -357,7 +357,7 @@ * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -5677,6 +5678,7 @@ union wpa_event_data { +@@ -5691,6 +5692,7 @@ union wpa_event_data { * @cf2: Center frequency 2 */ struct ch_switch { @@ -385,7 +385,7 @@ if (finished) bss->freq = data.ch_switch.freq; -@@ -2689,6 +2691,7 @@ static void do_process_drv_event(struct +@@ -2686,6 +2688,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CHANNEL_WIDTH], tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], @@ -393,7 +393,7 @@ 0); break; case NL80211_CMD_CH_SWITCH_NOTIFY: -@@ -2699,6 +2702,7 @@ static void do_process_drv_event(struct +@@ -2696,6 +2699,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CHANNEL_WIDTH], tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 5d29884e8d..2b904d1199 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -3323,6 +3323,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3351,6 +3351,7 @@ static int hostapd_ctrl_iface_receive_pr reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -3364,6 +3365,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3392,6 +3393,7 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -30,7 +30,7 @@ reply_len = -1; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -942,6 +942,9 @@ ifdef CONFIG_FILS +@@ -948,6 +948,9 @@ ifdef CONFIG_FILS OBJS += ../src/ap/fils_hlp.o endif ifdef CONFIG_CTRL_IFACE @@ -42,7 +42,7 @@ --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -2257,7 +2257,7 @@ static int wpa_supplicant_ctrl_iface_sta +@@ -2261,7 +2261,7 @@ static int wpa_supplicant_ctrl_iface_sta pos += ret; } @@ -51,7 +51,7 @@ if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -10172,6 +10172,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10243,6 +10243,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = -1; } else if (os_strncmp(buf, "NOTE ", 5) == 0) { wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); @@ -59,7 +59,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -10184,6 +10185,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10255,6 +10256,7 @@ char * wpa_supplicant_ctrl_iface_process reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -67,7 +67,7 @@ } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -10668,6 +10670,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10739,6 +10741,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -75,7 +75,7 @@ } else if (os_strcmp(buf, "STA-FIRST") == 0) { reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); } else if (os_strncmp(buf, "STA ", 4) == 0) { -@@ -10676,12 +10679,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10747,12 +10750,15 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, reply_size); @@ -144,7 +144,7 @@ static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx) --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c -@@ -4351,6 +4351,7 @@ static const char * wpa_bool_txt(int val +@@ -4391,6 +4391,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -152,7 +152,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -4501,7 +4502,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -4541,7 +4542,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -163,7 +163,7 @@ { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -2680,6 +2680,8 @@ static u32 wpa_key_mgmt_suite(struct wpa +@@ -2717,6 +2717,8 @@ static u32 wpa_key_mgmt_suite(struct wpa } @@ -172,7 +172,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -2761,6 +2763,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -2798,6 +2800,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch index 67a33967f5..9f216347f4 100644 --- a/package/network/services/hostapd/patches/420-indicate-features.patch +++ b/package/network/services/hostapd/patches/420-indicate-features.patch @@ -8,7 +8,7 @@ #include "crypto/random.h" #include "crypto/tls.h" #include "common/version.h" -@@ -688,7 +689,7 @@ int main(int argc, char *argv[]) +@@ -692,7 +693,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -17,7 +17,7 @@ if (c < 0) break; switch (c) { -@@ -725,6 +726,8 @@ int main(int argc, char *argv[]) +@@ -729,6 +730,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index 762f9d649f..0a512a48a1 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli /* Helper macros for network block parser */ #ifdef OFFSET -@@ -2551,6 +2643,8 @@ static const struct parse_data ssid_fiel +@@ -2552,6 +2644,8 @@ static const struct parse_data ssid_fiel { INT(ap_max_inactivity) }, { INT(dtim_period) }, { INT(beacon_int) }, @@ -162,7 +162,7 @@ Signed-hostap: Antonio Quartulli #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) -@@ -832,6 +834,9 @@ struct wpa_ssid { +@@ -837,6 +839,9 @@ struct wpa_ssid { */ void *parent_cred; @@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3615,6 +3615,12 @@ static void wpas_start_assoc_cb(struct w +@@ -3637,6 +3637,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; diff --git a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch index 1d3d46dd26..955e15e307 100644 --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5573,7 +5573,7 @@ static int wpa_driver_nl80211_ibss(struc +@@ -5583,7 +5583,7 @@ static int wpa_driver_nl80211_ibss(struc struct wpa_driver_associate_params *params) { struct nl_msg *msg; @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli int count = 0; wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); -@@ -5600,6 +5600,37 @@ retry: +@@ -5610,6 +5610,37 @@ retry: nl80211_put_beacon_int(msg, params->beacon_int)) goto fail; diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index 9ee60b1a63..473f3c786c 100644 --- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch @@ -19,17 +19,17 @@ Tested-by: Simon Wunderlich --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1546,6 +1546,7 @@ struct wpa_driver_mesh_join_params { - #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004 +@@ -1549,6 +1549,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; + u8 handle_dfs; + int mcast_rate; }; struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9959,6 +9959,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -10026,6 +10026,18 @@ static int nl80211_put_mesh_id(struct nl } @@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params) { -@@ -10017,6 +10029,7 @@ static int nl80211_join_mesh(struct i802 +@@ -10087,6 +10099,7 @@ static int nl80211_join_mesh(struct i802 nl80211_put_basic_rates(msg, params->basic_rates) || nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || nl80211_put_beacon_int(msg, params->beacon_int) || @@ -58,7 +58,7 @@ Tested-by: Simon Wunderlich --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -460,6 +460,7 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -501,6 +501,7 @@ int wpa_supplicant_join_mesh(struct wpa_ params->meshid = ssid->ssid; params->meshid_len = ssid->ssid_len; diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch index 17c9837969..6d48175163 100644 --- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2402,11 +2402,13 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2407,11 +2407,13 @@ void ibss_mesh_setup_freq(struct wpa_sup for (j = 0; j < wpa_s->last_scan_res_used; j++) { struct wpa_bss *bss = wpa_s->last_scan_res[j]; diff --git a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch index 1da40367aa..223c43cfde 100644 --- a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch +++ b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -1310,14 +1310,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) +@@ -1316,14 +1316,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) @$(AR) cr $@ hostapd_multi.o $(OBJS) hostapd: $(BCHECK) $(OBJS) @@ -19,7 +19,7 @@ NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1920,23 +1920,23 @@ wpa_supplicant_multi.a: .config $(BCHECK +@@ -1926,23 +1926,23 @@ wpa_supplicant_multi.a: .config $(BCHECK @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index c4cf2a4cde..23bdaa7a1b 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -39,7 +39,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -588,6 +590,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -603,6 +605,7 @@ hostapd_alloc_bss_data(struct hostapd_if struct hostapd_bss_config *bss); int hostapd_setup_interface(struct hostapd_iface *iface); int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err); @@ -49,7 +49,7 @@ struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -391,6 +391,7 @@ static void hostapd_free_hapd_data(struc +@@ -395,6 +395,7 @@ static void hostapd_free_hapd_data(struc hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -57,7 +57,7 @@ accounting_deinit(hapd); hostapd_deinit_wpa(hapd); vlan_deinit(hapd); -@@ -1392,6 +1393,8 @@ static int hostapd_setup_bss(struct host +@@ -1413,6 +1414,8 @@ static int hostapd_setup_bss(struct host if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -66,7 +66,7 @@ return 0; } -@@ -1967,6 +1970,7 @@ static int hostapd_setup_interface_compl +@@ -1988,6 +1991,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -74,7 +74,7 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2157,6 +2161,7 @@ dfs_offload: +@@ -2185,6 +2189,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -82,7 +82,7 @@ hostapd_set_state(iface, HAPD_IFACE_DISABLED); wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); #ifdef CONFIG_FST -@@ -2630,6 +2635,7 @@ void hostapd_interface_deinit_free(struc +@@ -2658,6 +2663,7 @@ void hostapd_interface_deinit_free(struc (unsigned int) iface->conf->num_bss); driver = iface->bss[0]->driver; drv_priv = iface->bss[0]->drv_priv; @@ -126,7 +126,7 @@ if (res == HOSTAPD_ACL_PENDING) return; -@@ -4078,7 +4090,7 @@ static void handle_assoc(struct hostapd_ +@@ -4087,7 +4099,7 @@ static void handle_assoc(struct hostapd_ int resp = WLAN_STATUS_SUCCESS; u16 reply_res; const u8 *pos; @@ -135,7 +135,7 @@ struct sta_info *sta; u8 *tmp = NULL; #ifdef CONFIG_FILS -@@ -4291,6 +4303,11 @@ static void handle_assoc(struct hostapd_ +@@ -4300,6 +4312,11 @@ static void handle_assoc(struct hostapd_ left = res; } #endif /* CONFIG_FILS */ @@ -147,7 +147,7 @@ /* followed by SSID and Supported rates; and HT capabilities if 802.11n * is used */ -@@ -4455,6 +4472,14 @@ static void handle_assoc(struct hostapd_ +@@ -4464,6 +4481,14 @@ static void handle_assoc(struct hostapd_ pos, left, rssi, omit_rsnxe); os_free(tmp); @@ -162,7 +162,7 @@ /* * Remove the station in case tranmission of a success response fails * (the STA was added associated to the driver) or if the station was -@@ -4482,6 +4507,7 @@ static void handle_disassoc(struct hosta +@@ -4491,6 +4516,7 @@ static void handle_disassoc(struct hosta wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.disassoc.reason_code)); @@ -170,7 +170,7 @@ sta = ap_get_sta(hapd, mgmt->sa); if (sta == NULL) { -@@ -4548,6 +4574,8 @@ static void handle_deauth(struct hostapd +@@ -4557,6 +4583,8 @@ static void handle_deauth(struct hostapd " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code)); @@ -181,7 +181,7 @@ wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -810,6 +810,12 @@ void handle_probe_req(struct hostapd_dat +@@ -814,6 +814,12 @@ void handle_probe_req(struct hostapd_dat u16 csa_offs[2]; size_t csa_offs_len; struct radius_sta rad_info; @@ -194,7 +194,7 @@ if (len < IEEE80211_HDRLEN) return; -@@ -992,6 +998,12 @@ void handle_probe_req(struct hostapd_dat +@@ -996,6 +1002,12 @@ void handle_probe_req(struct hostapd_dat } #endif /* CONFIG_P2P */ @@ -235,7 +235,7 @@ wpabuf_free(sta->p2p_ie); --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c -@@ -423,6 +423,7 @@ void ap_handle_timer(void *eloop_ctx, vo +@@ -424,6 +424,7 @@ void ap_handle_timer(void *eloop_ctx, vo HOSTAPD_LEVEL_INFO, "deauthenticated due to " "local deauth request"); ap_free_sta(hapd, sta); @@ -243,7 +243,7 @@ return; } -@@ -578,6 +579,7 @@ skip_poll: +@@ -579,6 +580,7 @@ skip_poll: hapd, sta, WLAN_REASON_PREV_AUTH_NOT_VALID); ap_free_sta(hapd, sta); @@ -251,7 +251,7 @@ break; } } -@@ -1293,6 +1295,7 @@ void ap_sta_set_authorized(struct hostap +@@ -1294,6 +1296,7 @@ void ap_sta_set_authorized(struct hostap buf, ip_addr, keyid_buf); } else { wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf); @@ -284,7 +284,7 @@ ifdef CONFIG_CODE_COVERAGE CFLAGS += -O0 -fprofile-arcs -ftest-coverage LIBS += -lgcov -@@ -877,6 +883,9 @@ OBJS += ../src/pae/ieee802_1x_secy_ops.o +@@ -883,6 +889,9 @@ OBJS += ../src/pae/ieee802_1x_secy_ops.o ifdef CONFIG_AP OBJS += ../src/ap/wpa_auth_kay.o endif @@ -296,7 +296,7 @@ ifdef CONFIG_IEEE8021X_EAPOL --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -6771,6 +6771,8 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -6793,6 +6793,8 @@ struct wpa_supplicant * wpa_supplicant_a } #endif /* CONFIG_P2P */ @@ -305,7 +305,7 @@ return wpa_s; } -@@ -6797,6 +6799,8 @@ int wpa_supplicant_remove_iface(struct w +@@ -6819,6 +6821,8 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -314,7 +314,7 @@ /* Remove interface from the global list of interfaces */ prev = global->ifaces; if (prev == wpa_s) { -@@ -7100,8 +7104,12 @@ int wpa_supplicant_run(struct wpa_global +@@ -7122,8 +7126,12 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -364,7 +364,7 @@ #ifndef WPS_PIN_SCAN_IGNORE_SEL_REG -@@ -388,6 +389,8 @@ static int wpa_supplicant_wps_cred(void +@@ -392,6 +393,8 @@ static int wpa_supplicant_wps_cred(void wpa_hexdump_key(MSG_DEBUG, "WPS: Received Credential attribute", cred->cred_attr, cred->cred_attr_len); @@ -375,7 +375,7 @@ --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -892,6 +892,7 @@ int main(int argc, char *argv[]) +@@ -896,6 +896,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); @@ -383,7 +383,7 @@ if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -901,6 +902,7 @@ int main(int argc, char *argv[]) +@@ -905,6 +906,7 @@ int main(int argc, char *argv[]) ret = 0; out: diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch index 053dcdad83..82e5c806d4 100644 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ b/package/network/services/hostapd/patches/700-wifi-reload.patch @@ -38,7 +38,7 @@ os_free(conf->basic_rates); --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -859,6 +859,7 @@ struct hostapd_bss_config { +@@ -861,6 +861,7 @@ struct hostapd_bss_config { */ u8 mka_psk_set; #endif /* CONFIG_MACSEC */ @@ -46,7 +46,7 @@ }; /** -@@ -1050,6 +1051,7 @@ struct hostapd_config { +@@ -1052,6 +1053,7 @@ struct hostapd_config { unsigned int airtime_update_interval; #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1) #endif /* CONFIG_AIRTIME_POLICY */ @@ -56,7 +56,7 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -216,6 +216,10 @@ static int hostapd_iface_conf_changed(st +@@ -218,6 +218,10 @@ static int hostapd_iface_conf_changed(st { size_t i; @@ -67,7 +67,7 @@ if (newconf->num_bss != oldconf->num_bss) return 1; -@@ -229,7 +233,7 @@ static int hostapd_iface_conf_changed(st +@@ -231,7 +235,7 @@ static int hostapd_iface_conf_changed(st } @@ -76,7 +76,7 @@ { struct hapd_interfaces *interfaces = iface->interfaces; struct hostapd_data *hapd = iface->bss[0]; -@@ -252,13 +256,16 @@ int hostapd_reload_config(struct hostapd +@@ -254,13 +258,16 @@ int hostapd_reload_config(struct hostapd if (newconf == NULL) return -1; @@ -95,7 +95,7 @@ wpa_printf(MSG_DEBUG, "Configuration changes include interface/BSS modification - force full disable+enable sequence"); fname = os_strdup(iface->config_fname); -@@ -283,6 +290,24 @@ int hostapd_reload_config(struct hostapd +@@ -285,6 +292,24 @@ int hostapd_reload_config(struct hostapd wpa_printf(MSG_ERROR, "Failed to enable interface on config reload"); return res; @@ -114,13 +114,13 @@ + * items (e.g., open/close sockets, etc.) */ + radius_client_flush(iface->bss[j]->radius, 0); +#endif /* CONFIG_NO_RADIUS */ -+ wpa_printf(MSG_INFO, "bss %d changed", j); ++ wpa_printf(MSG_INFO, "bss %zu changed", j); + } + } } iface->conf = newconf; -@@ -299,6 +324,12 @@ int hostapd_reload_config(struct hostapd +@@ -301,6 +326,12 @@ int hostapd_reload_config(struct hostapd for (j = 0; j < iface->num_bss; j++) { hapd = iface->bss[j]; @@ -133,7 +133,7 @@ hapd->iconf = newconf; hapd->conf = newconf->bss[j]; hostapd_reload_bss(hapd); -@@ -2329,6 +2360,10 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -2355,6 +2386,10 @@ hostapd_alloc_bss_data(struct hostapd_if hapd->iconf = conf; hapd->conf = bss; hapd->iface = hapd_iface; @@ -163,7 +163,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -582,7 +583,7 @@ struct hostapd_iface { +@@ -597,7 +598,7 @@ struct hostapd_iface { int hostapd_for_each_interface(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); @@ -174,7 +174,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4486,6 +4486,9 @@ static int wpa_driver_nl80211_set_ap(voi +@@ -4492,6 +4492,9 @@ static int wpa_driver_nl80211_set_ap(voi if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); From 72a1d5c3acd5b0bec46612f94bb8a82fe4d56179 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 21 May 2020 09:57:22 +0100 Subject: [PATCH 05/21] kernel: backport gpio emulated open drain output fix Backport the GPIO emulated open drain output fix from v5.5, which is required for the i2c-pxa backport. Signed-off-by: Russell King --- ...b-fix-up-emulated-open-drain-outputs.patch | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 target/linux/generic/backport-5.4/802-v5.5-gpiolib-fix-up-emulated-open-drain-outputs.patch diff --git a/target/linux/generic/backport-5.4/802-v5.5-gpiolib-fix-up-emulated-open-drain-outputs.patch b/target/linux/generic/backport-5.4/802-v5.5-gpiolib-fix-up-emulated-open-drain-outputs.patch new file mode 100644 index 0000000000..311d4ed448 --- /dev/null +++ b/target/linux/generic/backport-5.4/802-v5.5-gpiolib-fix-up-emulated-open-drain-outputs.patch @@ -0,0 +1,45 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: Linus Walleij ,Bartosz Golaszewski ,linux-gpio@vger.kernel.org +Subject: [PATCH] gpiolib: fix up emulated open drain outputs +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +gpiolib has a corner case with open drain outputs that are emulated. +When such outputs are outputting a logic 1, emulation will set the +hardware to input mode, which will cause gpiod_get_direction() to +report that it is in input mode. This is different from the behaviour +with a true open-drain output. + +Unify the semantics here. + +Suggested-by: Linus Walleij +Signed-off-by: Russell King +--- + drivers/gpio/gpiolib.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index 104ed299d5ea..99d19f80440e 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -220,6 +220,14 @@ int gpiod_get_direction(struct gpio_desc *desc) + chip = gpiod_to_chip(desc); + offset = gpio_chip_hwgpio(desc); + ++ /* ++ * Open drain emulation using input mode may incorrectly report ++ * input here, fix that up. ++ */ ++ if (test_bit(FLAG_OPEN_DRAIN, &desc->flags) && ++ test_bit(FLAG_IS_OUT, &desc->flags)) ++ return 0; ++ + if (!chip->get_direction) + return -ENOTSUPP; + +-- +2.20.1 + From 714199ec3461b2b5bac9796d4f5ee79f56d2eb00 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 21 May 2020 09:57:27 +0100 Subject: [PATCH 06/21] kernel: backport v5.8 i2c-pxa updates Add i2c-pxa updates queued for v5.8, which add bus recovery to this driver; this is needed for the uDPU platform. Signed-off-by: Russell King --- ...pxa-use-official-address-byte-helper.patch | 64 +++ ...5.8-i2c-pxa-remove-unneeded-includes.patch | 42 ++ ...ge-includes-to-be-in-alphabetical-or.patch | 57 +++ ...-re-arrange-functions-to-flow-better.patch | 385 ++++++++++++++++++ ...e-arrange-register-field-definitions.patch | 166 ++++++++ ...nd-use-definitions-for-IBMR-register.patch | 71 ++++ ...-set-fm-and-hs-members-for-each-type.patch | 71 ++++ ...ove-private-definitions-to-i2c-pxa.c.patch | 135 ++++++ ...-move-DT-IDs-along-side-platform-IDs.patch | 55 +++ ..._pxa_scream_blue_murder-debug-output.patch | 52 +++ ...13-v5.8-i2c-pxa-clean-up-decode_bits.patch | 58 +++ ...pxa_wait_bus_not_busy-boundary-condi.patch | 58 +++ ...lidate-i2c_pxa_-xfer-implementations.patch | 96 +++++ ...omplaints-with-non-responsive-slaves.patch | 72 ++++ ...a-ensure-timeout-messages-are-unique.patch | 50 +++ ...2c-pxa-remove-some-unnecessary-debug.patch | 39 ++ ...l-master-action-bits-in-i2c_pxa_stop.patch | 43 ++ ...a-use-master-abort-for-device-probes.patch | 40 ++ ...a-implement-generic-i2c-bus-recovery.patch | 290 +++++++++++++ 19 files changed, 1844 insertions(+) create mode 100644 target/linux/generic/backport-5.4/803-v5.8-i2c-pxa-use-official-address-byte-helper.patch create mode 100644 target/linux/generic/backport-5.4/804-v5.8-i2c-pxa-remove-unneeded-includes.patch create mode 100644 target/linux/generic/backport-5.4/805-v5.8-i2c-pxa-re-arrange-includes-to-be-in-alphabetical-or.patch create mode 100644 target/linux/generic/backport-5.4/806-v5.8-i2c-pxa-re-arrange-functions-to-flow-better.patch create mode 100644 target/linux/generic/backport-5.4/807-v5.8-i2c-pxa-re-arrange-register-field-definitions.patch create mode 100644 target/linux/generic/backport-5.4/808-v5.8-i2c-pxa-add-and-use-definitions-for-IBMR-register.patch create mode 100644 target/linux/generic/backport-5.4/809-v5.8-i2c-pxa-always-set-fm-and-hs-members-for-each-type.patch create mode 100644 target/linux/generic/backport-5.4/810-v5.8-i2c-pxa-move-private-definitions-to-i2c-pxa.c.patch create mode 100644 target/linux/generic/backport-5.4/811-v5.8-i2c-pxa-move-DT-IDs-along-side-platform-IDs.patch create mode 100644 target/linux/generic/backport-5.4/812-v5.8-i2c-pxa-fix-i2c_pxa_scream_blue_murder-debug-output.patch create mode 100644 target/linux/generic/backport-5.4/813-v5.8-i2c-pxa-clean-up-decode_bits.patch create mode 100644 target/linux/generic/backport-5.4/814-v5.8-i2c-pxa-fix-i2c_pxa_wait_bus_not_busy-boundary-condi.patch create mode 100644 target/linux/generic/backport-5.4/815-v5.8-i2c-pxa-consolidate-i2c_pxa_-xfer-implementations.patch create mode 100644 target/linux/generic/backport-5.4/816-v5.8-i2c-pxa-avoid-complaints-with-non-responsive-slaves.patch create mode 100644 target/linux/generic/backport-5.4/817-v5.8-i2c-pxa-ensure-timeout-messages-are-unique.patch create mode 100644 target/linux/generic/backport-5.4/818-v5.8-i2c-pxa-remove-some-unnecessary-debug.patch create mode 100644 target/linux/generic/backport-5.4/819-v5.8-i2c-pxa-clear-all-master-action-bits-in-i2c_pxa_stop.patch create mode 100644 target/linux/generic/backport-5.4/820-v5.8-i2c-pxa-use-master-abort-for-device-probes.patch create mode 100644 target/linux/generic/backport-5.4/821-v5.8-i2c-pxa-implement-generic-i2c-bus-recovery.patch diff --git a/target/linux/generic/backport-5.4/803-v5.8-i2c-pxa-use-official-address-byte-helper.patch b/target/linux/generic/backport-5.4/803-v5.8-i2c-pxa-use-official-address-byte-helper.patch new file mode 100644 index 0000000000..8aaa6c9b3c --- /dev/null +++ b/target/linux/generic/backport-5.4/803-v5.8-i2c-pxa-use-official-address-byte-helper.patch @@ -0,0 +1,64 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 01/17] i2c: pxa: use official address byte helper +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +i2c-pxa was created before i2c_8bit_addr_from_msg() was implemented, +and used its own i2c_pxa_addr_byte() which is functionally the same. +Sadly, it was never updated to use this new helper. Switch it over. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 21 +++++++-------------- + 1 file changed, 7 insertions(+), 14 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index 2c3c3d6935c0..966000923e8e 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -675,16 +675,6 @@ static void i2c_pxa_slave_stop(struct pxa_i2c *i2c) + * PXA I2C Master mode + */ + +-static inline unsigned int i2c_pxa_addr_byte(struct i2c_msg *msg) +-{ +- unsigned int addr = (msg->addr & 0x7f) << 1; +- +- if (msg->flags & I2C_M_RD) +- addr |= 1; +- +- return addr; +-} +- + static inline void i2c_pxa_start_message(struct pxa_i2c *i2c) + { + u32 icr; +@@ -693,8 +683,8 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c) + /* + * Step 1: target slave address into IDBR + */ +- writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c)); +- i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg); ++ i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg); ++ writel(i2c->req_slave_addr, _IDBR(i2c)); + + /* + * Step 2: initiate the write. +@@ -1006,8 +999,8 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) + /* + * Write the next address. + */ +- writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c)); +- i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg); ++ i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg); ++ writel(i2c->req_slave_addr, _IDBR(i2c)); + + /* + * And trigger a repeated start, and send the byte. +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/804-v5.8-i2c-pxa-remove-unneeded-includes.patch b/target/linux/generic/backport-5.4/804-v5.8-i2c-pxa-remove-unneeded-includes.patch new file mode 100644 index 0000000000..ed4a3d5928 --- /dev/null +++ b/target/linux/generic/backport-5.4/804-v5.8-i2c-pxa-remove-unneeded-includes.patch @@ -0,0 +1,42 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 02/17] i2c: pxa: remove unneeded includes +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +i2c-pxa does not need linux/sched.h nor linux/time.h includes, so +remove these. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index 966000923e8e..eddb749c9eae 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -20,8 +20,6 @@ + #include + #include + #include +-#include +-#include + #include + #include + #include +@@ -35,8 +33,6 @@ + #include + #include + +-#include +- + struct pxa_reg_layout { + u32 ibmr; + u32 idbr; +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/805-v5.8-i2c-pxa-re-arrange-includes-to-be-in-alphabetical-or.patch b/target/linux/generic/backport-5.4/805-v5.8-i2c-pxa-re-arrange-includes-to-be-in-alphabetical-or.patch new file mode 100644 index 0000000000..ccca8d1dc7 --- /dev/null +++ b/target/linux/generic/backport-5.4/805-v5.8-i2c-pxa-re-arrange-includes-to-be-in-alphabetical-or.patch @@ -0,0 +1,57 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 03/17] i2c: pxa: re-arrange includes to be in alphabetical + order +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Arrange the includes to be in alphabetical order to help avoid +duplicated includes. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index eddb749c9eae..ee83d2e46de0 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -16,22 +16,22 @@ + * Dec 2004: Added support for PXA27x and slave device probing [Liam Girdwood] + * Feb 2005: Rework slave mode handling [RMK] + */ +-#include +-#include +-#include +-#include ++#include + #include ++#include + #include +-#include ++#include + #include ++#include ++#include ++#include ++#include ++#include + #include + #include + #include +-#include +-#include +-#include +-#include + #include ++#include + + struct pxa_reg_layout { + u32 ibmr; +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/806-v5.8-i2c-pxa-re-arrange-functions-to-flow-better.patch b/target/linux/generic/backport-5.4/806-v5.8-i2c-pxa-re-arrange-functions-to-flow-better.patch new file mode 100644 index 0000000000..efe7071de4 --- /dev/null +++ b/target/linux/generic/backport-5.4/806-v5.8-i2c-pxa-re-arrange-functions-to-flow-better.patch @@ -0,0 +1,385 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 04/17] i2c: pxa: re-arrange functions to flow better +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Re-arrange the PXA I2C code to avoid forward declarations, and keep +similar functionality (e.g. the non-IRQ mode support) together. This +improves code readability. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 325 +++++++++++++++++------------------ + 1 file changed, 162 insertions(+), 163 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index ee83d2e46de0..e5f00ae39861 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -327,7 +327,6 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) + #endif /* ifdef DEBUG / else */ + + static void i2c_pxa_master_complete(struct pxa_i2c *i2c, int ret); +-static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id); + + static inline int i2c_pxa_is_slavemode(struct pxa_i2c *i2c) + { +@@ -703,34 +702,6 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) + writel(icr, _ICR(i2c)); + } + +-static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c) +-{ +- /* make timeout the same as for interrupt based functions */ +- long timeout = 2 * DEF_TIMEOUT; +- +- /* +- * Wait for the bus to become free. +- */ +- while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) { +- udelay(1000); +- show_state(i2c); +- } +- +- if (timeout < 0) { +- show_state(i2c); +- dev_err(&i2c->adap.dev, +- "i2c_pxa: timeout waiting for bus free\n"); +- return I2C_RETRY; +- } +- +- /* +- * Set master mode. +- */ +- writel(readl(_ICR(i2c)) | ICR_SCLE, _ICR(i2c)); +- +- return 0; +-} +- + /* + * PXA I2C send master code + * 1. Load master code to IDBR and send it. +@@ -759,140 +730,6 @@ static int i2c_pxa_send_mastercode(struct pxa_i2c *i2c) + return (timeout == 0) ? I2C_RETRY : 0; + } + +-static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c, +- struct i2c_msg *msg, int num) +-{ +- unsigned long timeout = 500000; /* 5 seconds */ +- int ret = 0; +- +- ret = i2c_pxa_pio_set_master(i2c); +- if (ret) +- goto out; +- +- i2c->msg = msg; +- i2c->msg_num = num; +- i2c->msg_idx = 0; +- i2c->msg_ptr = 0; +- i2c->irqlogidx = 0; +- +- i2c_pxa_start_message(i2c); +- +- while (i2c->msg_num > 0 && --timeout) { +- i2c_pxa_handler(0, i2c); +- udelay(10); +- } +- +- i2c_pxa_stop_message(i2c); +- +- /* +- * We place the return code in i2c->msg_idx. +- */ +- ret = i2c->msg_idx; +- +-out: +- if (timeout == 0) { +- i2c_pxa_scream_blue_murder(i2c, "timeout"); +- ret = I2C_RETRY; +- } +- +- return ret; +-} +- +-/* +- * We are protected by the adapter bus mutex. +- */ +-static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num) +-{ +- long timeout; +- int ret; +- +- /* +- * Wait for the bus to become free. +- */ +- ret = i2c_pxa_wait_bus_not_busy(i2c); +- if (ret) { +- dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for bus free\n"); +- goto out; +- } +- +- /* +- * Set master mode. +- */ +- ret = i2c_pxa_set_master(i2c); +- if (ret) { +- dev_err(&i2c->adap.dev, "i2c_pxa_set_master: error %d\n", ret); +- goto out; +- } +- +- if (i2c->high_mode) { +- ret = i2c_pxa_send_mastercode(i2c); +- if (ret) { +- dev_err(&i2c->adap.dev, "i2c_pxa_send_mastercode timeout\n"); +- goto out; +- } +- } +- +- spin_lock_irq(&i2c->lock); +- +- i2c->msg = msg; +- i2c->msg_num = num; +- i2c->msg_idx = 0; +- i2c->msg_ptr = 0; +- i2c->irqlogidx = 0; +- +- i2c_pxa_start_message(i2c); +- +- spin_unlock_irq(&i2c->lock); +- +- /* +- * The rest of the processing occurs in the interrupt handler. +- */ +- timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5); +- i2c_pxa_stop_message(i2c); +- +- /* +- * We place the return code in i2c->msg_idx. +- */ +- ret = i2c->msg_idx; +- +- if (!timeout && i2c->msg_num) { +- i2c_pxa_scream_blue_murder(i2c, "timeout"); +- ret = I2C_RETRY; +- } +- +- out: +- return ret; +-} +- +-static int i2c_pxa_pio_xfer(struct i2c_adapter *adap, +- struct i2c_msg msgs[], int num) +-{ +- struct pxa_i2c *i2c = adap->algo_data; +- int ret, i; +- +- /* If the I2C controller is disabled we need to reset it +- (probably due to a suspend/resume destroying state). We do +- this here as we can then avoid worrying about resuming the +- controller before its users. */ +- if (!(readl(_ICR(i2c)) & ICR_IUE)) +- i2c_pxa_reset(i2c); +- +- for (i = adap->retries; i >= 0; i--) { +- ret = i2c_pxa_do_pio_xfer(i2c, msgs, num); +- if (ret != I2C_RETRY) +- goto out; +- +- if (i2c_debug) +- dev_dbg(&adap->dev, "Retrying transmission\n"); +- udelay(100); +- } +- i2c_pxa_scream_blue_murder(i2c, "exhausted retries"); +- ret = -EREMOTEIO; +- out: +- i2c_pxa_set_slave(i2c, ret); +- return ret; +-} +- + /* + * i2c_pxa_master_complete - complete the message and wake up. + */ +@@ -1099,6 +936,71 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id) + return IRQ_HANDLED; + } + ++/* ++ * We are protected by the adapter bus mutex. ++ */ ++static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num) ++{ ++ long timeout; ++ int ret; ++ ++ /* ++ * Wait for the bus to become free. ++ */ ++ ret = i2c_pxa_wait_bus_not_busy(i2c); ++ if (ret) { ++ dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for bus free\n"); ++ goto out; ++ } ++ ++ /* ++ * Set master mode. ++ */ ++ ret = i2c_pxa_set_master(i2c); ++ if (ret) { ++ dev_err(&i2c->adap.dev, "i2c_pxa_set_master: error %d\n", ret); ++ goto out; ++ } ++ ++ if (i2c->high_mode) { ++ ret = i2c_pxa_send_mastercode(i2c); ++ if (ret) { ++ dev_err(&i2c->adap.dev, "i2c_pxa_send_mastercode timeout\n"); ++ goto out; ++ } ++ } ++ ++ spin_lock_irq(&i2c->lock); ++ ++ i2c->msg = msg; ++ i2c->msg_num = num; ++ i2c->msg_idx = 0; ++ i2c->msg_ptr = 0; ++ i2c->irqlogidx = 0; ++ ++ i2c_pxa_start_message(i2c); ++ ++ spin_unlock_irq(&i2c->lock); ++ ++ /* ++ * The rest of the processing occurs in the interrupt handler. ++ */ ++ timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5); ++ i2c_pxa_stop_message(i2c); ++ ++ /* ++ * We place the return code in i2c->msg_idx. ++ */ ++ ret = i2c->msg_idx; ++ ++ if (!timeout && i2c->msg_num) { ++ i2c_pxa_scream_blue_murder(i2c, "timeout"); ++ ret = I2C_RETRY; ++ } ++ ++ out: ++ return ret; ++} + + static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) + { +@@ -1132,6 +1034,103 @@ static const struct i2c_algorithm i2c_pxa_algorithm = { + .functionality = i2c_pxa_functionality, + }; + ++/* Non-interrupt mode support */ ++static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c) ++{ ++ /* make timeout the same as for interrupt based functions */ ++ long timeout = 2 * DEF_TIMEOUT; ++ ++ /* ++ * Wait for the bus to become free. ++ */ ++ while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) { ++ udelay(1000); ++ show_state(i2c); ++ } ++ ++ if (timeout < 0) { ++ show_state(i2c); ++ dev_err(&i2c->adap.dev, ++ "i2c_pxa: timeout waiting for bus free\n"); ++ return I2C_RETRY; ++ } ++ ++ /* ++ * Set master mode. ++ */ ++ writel(readl(_ICR(i2c)) | ICR_SCLE, _ICR(i2c)); ++ ++ return 0; ++} ++ ++static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c, ++ struct i2c_msg *msg, int num) ++{ ++ unsigned long timeout = 500000; /* 5 seconds */ ++ int ret = 0; ++ ++ ret = i2c_pxa_pio_set_master(i2c); ++ if (ret) ++ goto out; ++ ++ i2c->msg = msg; ++ i2c->msg_num = num; ++ i2c->msg_idx = 0; ++ i2c->msg_ptr = 0; ++ i2c->irqlogidx = 0; ++ ++ i2c_pxa_start_message(i2c); ++ ++ while (i2c->msg_num > 0 && --timeout) { ++ i2c_pxa_handler(0, i2c); ++ udelay(10); ++ } ++ ++ i2c_pxa_stop_message(i2c); ++ ++ /* ++ * We place the return code in i2c->msg_idx. ++ */ ++ ret = i2c->msg_idx; ++ ++out: ++ if (timeout == 0) { ++ i2c_pxa_scream_blue_murder(i2c, "timeout"); ++ ret = I2C_RETRY; ++ } ++ ++ return ret; ++} ++ ++static int i2c_pxa_pio_xfer(struct i2c_adapter *adap, ++ struct i2c_msg msgs[], int num) ++{ ++ struct pxa_i2c *i2c = adap->algo_data; ++ int ret, i; ++ ++ /* If the I2C controller is disabled we need to reset it ++ (probably due to a suspend/resume destroying state). We do ++ this here as we can then avoid worrying about resuming the ++ controller before its users. */ ++ if (!(readl(_ICR(i2c)) & ICR_IUE)) ++ i2c_pxa_reset(i2c); ++ ++ for (i = adap->retries; i >= 0; i--) { ++ ret = i2c_pxa_do_pio_xfer(i2c, msgs, num); ++ if (ret != I2C_RETRY) ++ goto out; ++ ++ if (i2c_debug) ++ dev_dbg(&adap->dev, "Retrying transmission\n"); ++ udelay(100); ++ } ++ i2c_pxa_scream_blue_murder(i2c, "exhausted retries"); ++ ret = -EREMOTEIO; ++ out: ++ i2c_pxa_set_slave(i2c, ret); ++ return ret; ++} ++ + static const struct i2c_algorithm i2c_pxa_pio_algorithm = { + .master_xfer = i2c_pxa_pio_xfer, + .functionality = i2c_pxa_functionality, +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/807-v5.8-i2c-pxa-re-arrange-register-field-definitions.patch b/target/linux/generic/backport-5.4/807-v5.8-i2c-pxa-re-arrange-register-field-definitions.patch new file mode 100644 index 0000000000..348da2a5f2 --- /dev/null +++ b/target/linux/generic/backport-5.4/807-v5.8-i2c-pxa-re-arrange-register-field-definitions.patch @@ -0,0 +1,166 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 05/17] i2c: pxa: re-arrange register field definitions +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Arrange the register field definitions to be grouped together, rather +than the Armada-3700 definitions being separated from the rest of the +definitions. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 113 ++++++++++++++++------------------- + 1 file changed, 53 insertions(+), 60 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index e5f00ae39861..ea96dfa6b9d5 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -33,6 +33,56 @@ + #include + #include + ++/* I2C register field definitions */ ++#define ICR_START (1 << 0) /* start bit */ ++#define ICR_STOP (1 << 1) /* stop bit */ ++#define ICR_ACKNAK (1 << 2) /* send ACK(0) or NAK(1) */ ++#define ICR_TB (1 << 3) /* transfer byte bit */ ++#define ICR_MA (1 << 4) /* master abort */ ++#define ICR_SCLE (1 << 5) /* master clock enable */ ++#define ICR_IUE (1 << 6) /* unit enable */ ++#define ICR_GCD (1 << 7) /* general call disable */ ++#define ICR_ITEIE (1 << 8) /* enable tx interrupts */ ++#define ICR_IRFIE (1 << 9) /* enable rx interrupts */ ++#define ICR_BEIE (1 << 10) /* enable bus error ints */ ++#define ICR_SSDIE (1 << 11) /* slave STOP detected int enable */ ++#define ICR_ALDIE (1 << 12) /* enable arbitration interrupt */ ++#define ICR_SADIE (1 << 13) /* slave address detected int enable */ ++#define ICR_UR (1 << 14) /* unit reset */ ++#define ICR_FM (1 << 15) /* fast mode */ ++#define ICR_HS (1 << 16) /* High Speed mode */ ++#define ICR_A3700_FM (1 << 16) /* fast mode for armada-3700 */ ++#define ICR_A3700_HS (1 << 17) /* high speed mode for armada-3700 */ ++#define ICR_GPIOEN (1 << 19) /* enable GPIO mode for SCL in HS */ ++ ++#define ISR_RWM (1 << 0) /* read/write mode */ ++#define ISR_ACKNAK (1 << 1) /* ack/nak status */ ++#define ISR_UB (1 << 2) /* unit busy */ ++#define ISR_IBB (1 << 3) /* bus busy */ ++#define ISR_SSD (1 << 4) /* slave stop detected */ ++#define ISR_ALD (1 << 5) /* arbitration loss detected */ ++#define ISR_ITE (1 << 6) /* tx buffer empty */ ++#define ISR_IRF (1 << 7) /* rx buffer full */ ++#define ISR_GCAD (1 << 8) /* general call address detected */ ++#define ISR_SAD (1 << 9) /* slave address detected */ ++#define ISR_BED (1 << 10) /* bus error no ACK/NAK */ ++ ++#define ILCR_SLV_SHIFT 0 ++#define ILCR_SLV_MASK (0x1FF << ILCR_SLV_SHIFT) ++#define ILCR_FLV_SHIFT 9 ++#define ILCR_FLV_MASK (0x1FF << ILCR_FLV_SHIFT) ++#define ILCR_HLVL_SHIFT 18 ++#define ILCR_HLVL_MASK (0x1FF << ILCR_HLVL_SHIFT) ++#define ILCR_HLVH_SHIFT 27 ++#define ILCR_HLVH_MASK (0x1F << ILCR_HLVH_SHIFT) ++ ++#define IWCR_CNT_SHIFT 0 ++#define IWCR_CNT_MASK (0x1F << IWCR_CNT_SHIFT) ++#define IWCR_HS_CNT1_SHIFT 5 ++#define IWCR_HS_CNT1_MASK (0x1F << IWCR_HS_CNT1_SHIFT) ++#define IWCR_HS_CNT2_SHIFT 10 ++#define IWCR_HS_CNT2_MASK (0x1F << IWCR_HS_CNT2_SHIFT) ++ + struct pxa_reg_layout { + u32 ibmr; + u32 idbr; +@@ -53,12 +103,7 @@ enum pxa_i2c_types { + REGS_A3700, + }; + +-#define ICR_BUSMODE_FM (1 << 16) /* shifted fast mode for armada-3700 */ +-#define ICR_BUSMODE_HS (1 << 17) /* shifted high speed mode for armada-3700 */ +- +-/* +- * I2C registers definitions +- */ ++/* I2C register layout definitions */ + static struct pxa_reg_layout pxa_reg_layout[] = { + [REGS_PXA2XX] = { + .ibmr = 0x00, +@@ -96,8 +141,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = { + .icr = 0x08, + .isr = 0x0c, + .isar = 0x10, +- .fm = ICR_BUSMODE_FM, +- .hs = ICR_BUSMODE_HS, ++ .fm = ICR_A3700_FM, ++ .hs = ICR_A3700_HS, + }, + }; + +@@ -111,58 +156,6 @@ static const struct platform_device_id i2c_pxa_id_table[] = { + }; + MODULE_DEVICE_TABLE(platform, i2c_pxa_id_table); + +-/* +- * I2C bit definitions +- */ +- +-#define ICR_START (1 << 0) /* start bit */ +-#define ICR_STOP (1 << 1) /* stop bit */ +-#define ICR_ACKNAK (1 << 2) /* send ACK(0) or NAK(1) */ +-#define ICR_TB (1 << 3) /* transfer byte bit */ +-#define ICR_MA (1 << 4) /* master abort */ +-#define ICR_SCLE (1 << 5) /* master clock enable */ +-#define ICR_IUE (1 << 6) /* unit enable */ +-#define ICR_GCD (1 << 7) /* general call disable */ +-#define ICR_ITEIE (1 << 8) /* enable tx interrupts */ +-#define ICR_IRFIE (1 << 9) /* enable rx interrupts */ +-#define ICR_BEIE (1 << 10) /* enable bus error ints */ +-#define ICR_SSDIE (1 << 11) /* slave STOP detected int enable */ +-#define ICR_ALDIE (1 << 12) /* enable arbitration interrupt */ +-#define ICR_SADIE (1 << 13) /* slave address detected int enable */ +-#define ICR_UR (1 << 14) /* unit reset */ +-#define ICR_FM (1 << 15) /* fast mode */ +-#define ICR_HS (1 << 16) /* High Speed mode */ +-#define ICR_GPIOEN (1 << 19) /* enable GPIO mode for SCL in HS */ +- +-#define ISR_RWM (1 << 0) /* read/write mode */ +-#define ISR_ACKNAK (1 << 1) /* ack/nak status */ +-#define ISR_UB (1 << 2) /* unit busy */ +-#define ISR_IBB (1 << 3) /* bus busy */ +-#define ISR_SSD (1 << 4) /* slave stop detected */ +-#define ISR_ALD (1 << 5) /* arbitration loss detected */ +-#define ISR_ITE (1 << 6) /* tx buffer empty */ +-#define ISR_IRF (1 << 7) /* rx buffer full */ +-#define ISR_GCAD (1 << 8) /* general call address detected */ +-#define ISR_SAD (1 << 9) /* slave address detected */ +-#define ISR_BED (1 << 10) /* bus error no ACK/NAK */ +- +-/* bit field shift & mask */ +-#define ILCR_SLV_SHIFT 0 +-#define ILCR_SLV_MASK (0x1FF << ILCR_SLV_SHIFT) +-#define ILCR_FLV_SHIFT 9 +-#define ILCR_FLV_MASK (0x1FF << ILCR_FLV_SHIFT) +-#define ILCR_HLVL_SHIFT 18 +-#define ILCR_HLVL_MASK (0x1FF << ILCR_HLVL_SHIFT) +-#define ILCR_HLVH_SHIFT 27 +-#define ILCR_HLVH_MASK (0x1F << ILCR_HLVH_SHIFT) +- +-#define IWCR_CNT_SHIFT 0 +-#define IWCR_CNT_MASK (0x1F << IWCR_CNT_SHIFT) +-#define IWCR_HS_CNT1_SHIFT 5 +-#define IWCR_HS_CNT1_MASK (0x1F << IWCR_HS_CNT1_SHIFT) +-#define IWCR_HS_CNT2_SHIFT 10 +-#define IWCR_HS_CNT2_MASK (0x1F << IWCR_HS_CNT2_SHIFT) +- + struct pxa_i2c { + spinlock_t lock; + wait_queue_head_t wait; +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/808-v5.8-i2c-pxa-add-and-use-definitions-for-IBMR-register.patch b/target/linux/generic/backport-5.4/808-v5.8-i2c-pxa-add-and-use-definitions-for-IBMR-register.patch new file mode 100644 index 0000000000..9d7c501640 --- /dev/null +++ b/target/linux/generic/backport-5.4/808-v5.8-i2c-pxa-add-and-use-definitions-for-IBMR-register.patch @@ -0,0 +1,71 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 06/17] i2c: pxa: add and use definitions for IBMR register +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Add definitions for the bits in the IBMR register, and use them in the +code. This improves readability. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index ea96dfa6b9d5..b3286d7ab75d 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -34,6 +34,9 @@ + #include + + /* I2C register field definitions */ ++#define IBMR_SDAS (1 << 0) ++#define IBMR_SCLS (1 << 1) ++ + #define ICR_START (1 << 0) /* start bit */ + #define ICR_STOP (1 << 1) /* stop bit */ + #define ICR_ACKNAK (1 << 2) /* send ACK(0) or NAK(1) */ +@@ -335,7 +338,7 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c) + return; + } + +- while ((i > 0) && (readl(_IBMR(i2c)) & 0x1) == 0) { ++ while ((i > 0) && (readl(_IBMR(i2c)) & IBMR_SDAS) == 0) { + unsigned long icr = readl(_ICR(i2c)); + + icr &= ~ICR_START; +@@ -390,7 +393,8 @@ static int i2c_pxa_wait_master(struct pxa_i2c *i2c) + * quick check of the i2c lines themselves to ensure they've + * gone high... + */ +- if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) == 0 && readl(_IBMR(i2c)) == 3) { ++ if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) == 0 && ++ readl(_IBMR(i2c)) == (IBMR_SCLS | IBMR_SDAS)) { + if (i2c_debug > 0) + dev_dbg(&i2c->adap.dev, "%s: done\n", __func__); + return 1; +@@ -575,7 +579,7 @@ static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr) + timeout = 0x10000; + + while (1) { +- if ((readl(_IBMR(i2c)) & 2) == 2) ++ if ((readl(_IBMR(i2c)) & IBMR_SCLS) == IBMR_SCLS) + break; + + timeout--; +@@ -638,7 +642,7 @@ static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr) + timeout = 0x10000; + + while (1) { +- if ((readl(_IBMR(i2c)) & 2) == 2) ++ if ((readl(_IBMR(i2c)) & IBMR_SCLS) == IBMR_SCLS) + break; + + timeout--; +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/809-v5.8-i2c-pxa-always-set-fm-and-hs-members-for-each-type.patch b/target/linux/generic/backport-5.4/809-v5.8-i2c-pxa-always-set-fm-and-hs-members-for-each-type.patch new file mode 100644 index 0000000000..2e98c7ba00 --- /dev/null +++ b/target/linux/generic/backport-5.4/809-v5.8-i2c-pxa-always-set-fm-and-hs-members-for-each-type.patch @@ -0,0 +1,71 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 07/17] i2c: pxa: always set fm and hs members for each type +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Always set the fm and hs members of struct pxa_reg_layout. These +members are already taking space, we don't need code as well. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index b3286d7ab75d..05dbe6bf4633 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -114,6 +114,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = { + .icr = 0x10, + .isr = 0x18, + .isar = 0x20, ++ .fm = ICR_FM, ++ .hs = ICR_HS, + }, + [REGS_PXA3XX] = { + .ibmr = 0x00, +@@ -121,6 +123,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = { + .icr = 0x08, + .isr = 0x0c, + .isar = 0x10, ++ .fm = ICR_FM, ++ .hs = ICR_HS, + }, + [REGS_CE4100] = { + .ibmr = 0x14, +@@ -128,6 +132,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = { + .icr = 0x00, + .isr = 0x04, + /* no isar register */ ++ .fm = ICR_FM, ++ .hs = ICR_HS, + }, + [REGS_PXA910] = { + .ibmr = 0x00, +@@ -137,6 +143,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = { + .isar = 0x20, + .ilcr = 0x28, + .iwcr = 0x30, ++ .fm = ICR_FM, ++ .hs = ICR_HS, + }, + [REGS_A3700] = { + .ibmr = 0x00, +@@ -1235,8 +1243,8 @@ static int i2c_pxa_probe(struct platform_device *dev) + i2c->reg_idbr = i2c->reg_base + pxa_reg_layout[i2c_type].idbr; + i2c->reg_icr = i2c->reg_base + pxa_reg_layout[i2c_type].icr; + i2c->reg_isr = i2c->reg_base + pxa_reg_layout[i2c_type].isr; +- i2c->fm_mask = pxa_reg_layout[i2c_type].fm ? : ICR_FM; +- i2c->hs_mask = pxa_reg_layout[i2c_type].hs ? : ICR_HS; ++ i2c->fm_mask = pxa_reg_layout[i2c_type].fm; ++ i2c->hs_mask = pxa_reg_layout[i2c_type].hs; + + if (i2c_type != REGS_CE4100) + i2c->reg_isar = i2c->reg_base + pxa_reg_layout[i2c_type].isar; +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/810-v5.8-i2c-pxa-move-private-definitions-to-i2c-pxa.c.patch b/target/linux/generic/backport-5.4/810-v5.8-i2c-pxa-move-private-definitions-to-i2c-pxa.c.patch new file mode 100644 index 0000000000..a7bbdd9546 --- /dev/null +++ b/target/linux/generic/backport-5.4/810-v5.8-i2c-pxa-move-private-definitions-to-i2c-pxa.c.patch @@ -0,0 +1,135 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 08/17] i2c: pxa: move private definitions to i2c-pxa.c +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Move driver-private definitions out of the i2c-pxa.h platform data +header file into the driver itself. Nothing outside of the driver +makes use of these constants. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 43 ++++++++++++++++++++++++ + include/linux/platform_data/i2c-pxa.h | 48 --------------------------- + 2 files changed, 43 insertions(+), 48 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index 05dbe6bf4633..482768a9fdd2 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -86,6 +86,49 @@ + #define IWCR_HS_CNT2_SHIFT 10 + #define IWCR_HS_CNT2_MASK (0x1F << IWCR_HS_CNT2_SHIFT) + ++/* need a longer timeout if we're dealing with the fact we may well be ++ * looking at a multi-master environment ++ */ ++#define DEF_TIMEOUT 32 ++ ++#define BUS_ERROR (-EREMOTEIO) ++#define XFER_NAKED (-ECONNREFUSED) ++#define I2C_RETRY (-2000) /* an error has occurred retry transmit */ ++ ++/* ICR initialize bit values ++ * ++ * 15 FM 0 (100 kHz operation) ++ * 14 UR 0 (No unit reset) ++ * 13 SADIE 0 (Disables the unit from interrupting on slave addresses ++ * matching its slave address) ++ * 12 ALDIE 0 (Disables the unit from interrupt when it loses arbitration ++ * in master mode) ++ * 11 SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode) ++ * 10 BEIE 1 (Enable interrupts from detected bus errors, no ACK sent) ++ * 9 IRFIE 1 (Enable interrupts from full buffer received) ++ * 8 ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty) ++ * 7 GCD 1 (Disables i2c unit response to general call messages as a slave) ++ * 6 IUE 0 (Disable unit until we change settings) ++ * 5 SCLE 1 (Enables the i2c clock output for master mode (drives SCL) ++ * 4 MA 0 (Only send stop with the ICR stop bit) ++ * 3 TB 0 (We are not transmitting a byte initially) ++ * 2 ACKNAK 0 (Send an ACK after the unit receives a byte) ++ * 1 STOP 0 (Do not send a STOP) ++ * 0 START 0 (Do not send a START) ++ */ ++#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) ++ ++/* I2C status register init values ++ * ++ * 10 BED 1 (Clear bus error detected) ++ * 9 SAD 1 (Clear slave address detected) ++ * 7 IRF 1 (Clear IDBR Receive Full) ++ * 6 ITE 1 (Clear IDBR Transmit Empty) ++ * 5 ALD 1 (Clear Arbitration Loss Detected) ++ * 4 SSD 1 (Clear Slave Stop Detected) ++ */ ++#define I2C_ISR_INIT 0x7FF /* status register init */ ++ + struct pxa_reg_layout { + u32 ibmr; + u32 idbr; +diff --git a/include/linux/platform_data/i2c-pxa.h b/include/linux/platform_data/i2c-pxa.h +index cb290092599c..5c08a6ff3444 100644 +--- a/include/linux/platform_data/i2c-pxa.h ++++ b/include/linux/platform_data/i2c-pxa.h +@@ -7,54 +7,6 @@ + #ifndef _I2C_PXA_H_ + #define _I2C_PXA_H_ + +-#if 0 +-#define DEF_TIMEOUT 3 +-#else +-/* need a longer timeout if we're dealing with the fact we may well be +- * looking at a multi-master environment +-*/ +-#define DEF_TIMEOUT 32 +-#endif +- +-#define BUS_ERROR (-EREMOTEIO) +-#define XFER_NAKED (-ECONNREFUSED) +-#define I2C_RETRY (-2000) /* an error has occurred retry transmit */ +- +-/* ICR initialize bit values +-* +-* 15. FM 0 (100 Khz operation) +-* 14. UR 0 (No unit reset) +-* 13. SADIE 0 (Disables the unit from interrupting on slave addresses +-* matching its slave address) +-* 12. ALDIE 0 (Disables the unit from interrupt when it loses arbitration +-* in master mode) +-* 11. SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode) +-* 10. BEIE 1 (Enable interrupts from detected bus errors, no ACK sent) +-* 9. IRFIE 1 (Enable interrupts from full buffer received) +-* 8. ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty) +-* 7. GCD 1 (Disables i2c unit response to general call messages as a slave) +-* 6. IUE 0 (Disable unit until we change settings) +-* 5. SCLE 1 (Enables the i2c clock output for master mode (drives SCL) +-* 4. MA 0 (Only send stop with the ICR stop bit) +-* 3. TB 0 (We are not transmitting a byte initially) +-* 2. ACKNAK 0 (Send an ACK after the unit receives a byte) +-* 1. STOP 0 (Do not send a STOP) +-* 0. START 0 (Do not send a START) +-* +-*/ +-#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) +- +-/* I2C status register init values +- * +- * 10. BED 1 (Clear bus error detected) +- * 9. SAD 1 (Clear slave address detected) +- * 7. IRF 1 (Clear IDBR Receive Full) +- * 6. ITE 1 (Clear IDBR Transmit Empty) +- * 5. ALD 1 (Clear Arbitration Loss Detected) +- * 4. SSD 1 (Clear Slave Stop Detected) +- */ +-#define I2C_ISR_INIT 0x7FF /* status register init */ +- + struct i2c_slave_client; + + struct i2c_pxa_platform_data { +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/811-v5.8-i2c-pxa-move-DT-IDs-along-side-platform-IDs.patch b/target/linux/generic/backport-5.4/811-v5.8-i2c-pxa-move-DT-IDs-along-side-platform-IDs.patch new file mode 100644 index 0000000000..3f1b96a8d6 --- /dev/null +++ b/target/linux/generic/backport-5.4/811-v5.8-i2c-pxa-move-DT-IDs-along-side-platform-IDs.patch @@ -0,0 +1,55 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 09/17] i2c: pxa: move DT IDs along side platform IDs +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Move the ID tables into one place, near the device dependent data. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index 482768a9fdd2..760a29fb6af5 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -200,6 +200,15 @@ static struct pxa_reg_layout pxa_reg_layout[] = { + }, + }; + ++static const struct of_device_id i2c_pxa_dt_ids[] = { ++ { .compatible = "mrvl,pxa-i2c", .data = (void *)REGS_PXA2XX }, ++ { .compatible = "mrvl,pwri2c", .data = (void *)REGS_PXA3XX }, ++ { .compatible = "mrvl,mmp-twsi", .data = (void *)REGS_PXA910 }, ++ { .compatible = "marvell,armada-3700-i2c", .data = (void *)REGS_A3700 }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids); ++ + static const struct platform_device_id i2c_pxa_id_table[] = { + { "pxa2xx-i2c", REGS_PXA2XX }, + { "pxa3xx-pwri2c", REGS_PXA3XX }, +@@ -1184,15 +1193,6 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = { + .functionality = i2c_pxa_functionality, + }; + +-static const struct of_device_id i2c_pxa_dt_ids[] = { +- { .compatible = "mrvl,pxa-i2c", .data = (void *)REGS_PXA2XX }, +- { .compatible = "mrvl,pwri2c", .data = (void *)REGS_PXA3XX }, +- { .compatible = "mrvl,mmp-twsi", .data = (void *)REGS_PXA910 }, +- { .compatible = "marvell,armada-3700-i2c", .data = (void *)REGS_A3700 }, +- {} +-}; +-MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids); +- + static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c, + enum pxa_i2c_types *i2c_types) + { +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/812-v5.8-i2c-pxa-fix-i2c_pxa_scream_blue_murder-debug-output.patch b/target/linux/generic/backport-5.4/812-v5.8-i2c-pxa-fix-i2c_pxa_scream_blue_murder-debug-output.patch new file mode 100644 index 0000000000..6c912e6254 --- /dev/null +++ b/target/linux/generic/backport-5.4/812-v5.8-i2c-pxa-fix-i2c_pxa_scream_blue_murder-debug-output.patch @@ -0,0 +1,52 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 10/17] i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +The IRQ log output is supposed to appear on a single line. However, +commit 3a2dc1677b60 ("i2c: pxa: Update debug function to dump more info +on error") resulted in it being printed one-entry-per-line, which is +excessively long. + +Fixing this is not a trivial matter; using pr_cont() doesn't work as +the previous dev_dbg() may not have been compiled in, or may be +dynamic. + +Since the rest of this function output is at error level, and is also +debug output, promote this to error level as well to avoid this +problem. + +Reduce the number of always zero prefix digits to save screen real- +estate. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index 760a29fb6af5..f3a11050053c 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -364,11 +364,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) + dev_err(dev, "IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n", + readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)), + readl(_ISR(i2c))); +- dev_dbg(dev, "log: "); ++ dev_err(dev, "log:"); + for (i = 0; i < i2c->irqlogidx; i++) +- pr_debug("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]); +- +- pr_debug("\n"); ++ pr_cont(" [%03x:%05x]", i2c->isrlog[i], i2c->icrlog[i]); ++ pr_cont("\n"); + } + + #else /* ifdef DEBUG */ +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/813-v5.8-i2c-pxa-clean-up-decode_bits.patch b/target/linux/generic/backport-5.4/813-v5.8-i2c-pxa-clean-up-decode_bits.patch new file mode 100644 index 0000000000..552630eaf7 --- /dev/null +++ b/target/linux/generic/backport-5.4/813-v5.8-i2c-pxa-clean-up-decode_bits.patch @@ -0,0 +1,58 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 11/17] i2c: pxa: clean up decode_bits() +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Clean up decode_bits() to use pr_cont(), and move the newline into the +function rather than at its two callsites. Avoid printing an +unnecessary space before the newline. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index f3a11050053c..b2c7765756e2 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -287,13 +287,14 @@ struct bits { + static inline void + decode_bits(const char *prefix, const struct bits *bits, int num, u32 val) + { +- printk("%s %08x: ", prefix, val); ++ printk("%s %08x:", prefix, val); + while (num--) { + const char *str = val & bits->mask ? bits->set : bits->unset; + if (str) +- printk("%s ", str); ++ pr_cont(" %s", str); + bits++; + } ++ pr_cont("\n"); + } + + static const struct bits isr_bits[] = { +@@ -313,7 +314,6 @@ static const struct bits isr_bits[] = { + static void decode_ISR(unsigned int val) + { + decode_bits(KERN_DEBUG "ISR", isr_bits, ARRAY_SIZE(isr_bits), val); +- printk("\n"); + } + + static const struct bits icr_bits[] = { +@@ -338,7 +338,6 @@ static const struct bits icr_bits[] = { + static void decode_ICR(unsigned int val) + { + decode_bits(KERN_DEBUG "ICR", icr_bits, ARRAY_SIZE(icr_bits), val); +- printk("\n"); + } + #endif + +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/814-v5.8-i2c-pxa-fix-i2c_pxa_wait_bus_not_busy-boundary-condi.patch b/target/linux/generic/backport-5.4/814-v5.8-i2c-pxa-fix-i2c_pxa_wait_bus_not_busy-boundary-condi.patch new file mode 100644 index 0000000000..d5aded5479 --- /dev/null +++ b/target/linux/generic/backport-5.4/814-v5.8-i2c-pxa-fix-i2c_pxa_wait_bus_not_busy-boundary-condi.patch @@ -0,0 +1,58 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: linux-i2c@vger.kernel.org +Subject: [PATCH 12/17] i2c: pxa: fix i2c_pxa_wait_bus_not_busy() boundary + condition +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Fix i2c_pxa_wait_bus_not_busy()'s boundary conditions, so that a +coincidental success and timeout results in the function returning +success. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index b2c7765756e2..19505ffbb8f1 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -417,19 +417,26 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c) + static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c) + { + int timeout = DEF_TIMEOUT; ++ u32 isr; + +- while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) { +- if ((readl(_ISR(i2c)) & ISR_SAD) != 0) ++ while (1) { ++ isr = readl(_ISR(i2c)); ++ if (!(isr & (ISR_IBB | ISR_UB))) ++ return 0; ++ ++ if (isr & ISR_SAD) + timeout += 4; + ++ if (!timeout--) ++ break; ++ + msleep(2); + show_state(i2c); + } + +- if (timeout < 0) +- show_state(i2c); ++ show_state(i2c); + +- return timeout < 0 ? I2C_RETRY : 0; ++ return I2C_RETRY; + } + + static int i2c_pxa_wait_master(struct pxa_i2c *i2c) +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/815-v5.8-i2c-pxa-consolidate-i2c_pxa_-xfer-implementations.patch b/target/linux/generic/backport-5.4/815-v5.8-i2c-pxa-consolidate-i2c_pxa_-xfer-implementations.patch new file mode 100644 index 0000000000..f66759f48b --- /dev/null +++ b/target/linux/generic/backport-5.4/815-v5.8-i2c-pxa-consolidate-i2c_pxa_-xfer-implementations.patch @@ -0,0 +1,96 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Subject: [PATCH 1/7] i2c: pxa: consolidate i2c_pxa_*xfer() implementations +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Most of i2c_pxa_pio_xfer() and i2c_pxa_xfer() are identical; the only +differences are that i2c_pxa_pio_xfer() may reset the bus, and they +use different underlying transfer functions. The retry loop is the +same. Consolidate these two functions. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 36 ++++++++++++++++-------------------- + 1 file changed, 16 insertions(+), 20 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index c1e50c0b9756..46f1cf97d955 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -1102,18 +1102,20 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num) + return ret; + } + +-static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) ++static int i2c_pxa_internal_xfer(struct pxa_i2c *i2c, ++ struct i2c_msg *msgs, int num, ++ int (*xfer)(struct pxa_i2c *, ++ struct i2c_msg *, int num)) + { +- struct pxa_i2c *i2c = adap->algo_data; + int ret, i; + +- for (i = adap->retries; i >= 0; i--) { +- ret = i2c_pxa_do_xfer(i2c, msgs, num); ++ for (i = i2c->adap.retries; i >= 0; i--) { ++ ret = xfer(i2c, msgs, num); + if (ret != I2C_RETRY) + goto out; + + if (i2c_debug) +- dev_dbg(&adap->dev, "Retrying transmission\n"); ++ dev_dbg(&i2c->adap.dev, "Retrying transmission\n"); + udelay(100); + } + i2c_pxa_scream_blue_murder(i2c, "exhausted retries"); +@@ -1123,6 +1125,14 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num + return ret; + } + ++static int i2c_pxa_xfer(struct i2c_adapter *adap, ++ struct i2c_msg msgs[], int num) ++{ ++ struct pxa_i2c *i2c = adap->algo_data; ++ ++ return i2c_pxa_internal_xfer(i2c, msgs, num, i2c_pxa_do_xfer); ++} ++ + static u32 i2c_pxa_functionality(struct i2c_adapter *adap) + { + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | +@@ -1210,7 +1220,6 @@ static int i2c_pxa_pio_xfer(struct i2c_adapter *adap, + struct i2c_msg msgs[], int num) + { + struct pxa_i2c *i2c = adap->algo_data; +- int ret, i; + + /* If the I2C controller is disabled we need to reset it + (probably due to a suspend/resume destroying state). We do +@@ -1219,20 +1228,7 @@ static int i2c_pxa_pio_xfer(struct i2c_adapter *adap, + if (!(readl(_ICR(i2c)) & ICR_IUE)) + i2c_pxa_reset(i2c); + +- for (i = adap->retries; i >= 0; i--) { +- ret = i2c_pxa_do_pio_xfer(i2c, msgs, num); +- if (ret != I2C_RETRY) +- goto out; +- +- if (i2c_debug) +- dev_dbg(&adap->dev, "Retrying transmission\n"); +- udelay(100); +- } +- i2c_pxa_scream_blue_murder(i2c, "exhausted retries"); +- ret = -EREMOTEIO; +- out: +- i2c_pxa_set_slave(i2c, ret); +- return ret; ++ return i2c_pxa_internal_xfer(i2c, msgs, num, i2c_pxa_do_pio_xfer); + } + + static const struct i2c_algorithm i2c_pxa_pio_algorithm = { +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/816-v5.8-i2c-pxa-avoid-complaints-with-non-responsive-slaves.patch b/target/linux/generic/backport-5.4/816-v5.8-i2c-pxa-avoid-complaints-with-non-responsive-slaves.patch new file mode 100644 index 0000000000..308dba0fb9 --- /dev/null +++ b/target/linux/generic/backport-5.4/816-v5.8-i2c-pxa-avoid-complaints-with-non-responsive-slaves.patch @@ -0,0 +1,72 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Subject: [PATCH 2/7] i2c: pxa: avoid complaints with non-responsive slaves +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Running i2cdetect on a PXA I2C adapter is very noisy; it complains +whenever a slave fails to respond to the address cycle. Since it is +normal to probe for slaves in this way, we should not fill the kernel +log. This is especially true with SFP modules that take a while to +respond on the I2C bus, and probing via the I2C bus is the only way to +detect that they are ready. + +Fix this by changing the internal transfer return code from I2C_RETRY +to a new NO_SLAVE code (mapped to -ENXIO, as per the I2C documentation +for this condition, but we still return -EREMOTEIO to the I2C stack to +maintain long established driver behaviour.) + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index 46f1cf97d955..f20f8b905793 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -90,6 +90,7 @@ + */ + #define DEF_TIMEOUT 32 + ++#define NO_SLAVE (-ENXIO) + #define BUS_ERROR (-EREMOTEIO) + #define XFER_NAKED (-ECONNREFUSED) + #define I2C_RETRY (-2000) /* an error has occurred retry transmit */ +@@ -881,7 +882,7 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) + */ + if (isr & ISR_ACKNAK) { + if (i2c->msg_ptr == 0 && i2c->msg_idx == 0) +- ret = I2C_RETRY; ++ ret = NO_SLAVE; + else + ret = XFER_NAKED; + } +@@ -1109,16 +1110,19 @@ static int i2c_pxa_internal_xfer(struct pxa_i2c *i2c, + { + int ret, i; + +- for (i = i2c->adap.retries; i >= 0; i--) { ++ for (i = 0; ; ) { + ret = xfer(i2c, msgs, num); +- if (ret != I2C_RETRY) ++ if (ret != I2C_RETRY && ret != NO_SLAVE) + goto out; ++ if (++i >= i2c->adap.retries) ++ break; + + if (i2c_debug) + dev_dbg(&i2c->adap.dev, "Retrying transmission\n"); + udelay(100); + } +- i2c_pxa_scream_blue_murder(i2c, "exhausted retries"); ++ if (ret != NO_SLAVE) ++ i2c_pxa_scream_blue_murder(i2c, "exhausted retries"); + ret = -EREMOTEIO; + out: + i2c_pxa_set_slave(i2c, ret); +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/817-v5.8-i2c-pxa-ensure-timeout-messages-are-unique.patch b/target/linux/generic/backport-5.4/817-v5.8-i2c-pxa-ensure-timeout-messages-are-unique.patch new file mode 100644 index 0000000000..39ca935ae9 --- /dev/null +++ b/target/linux/generic/backport-5.4/817-v5.8-i2c-pxa-ensure-timeout-messages-are-unique.patch @@ -0,0 +1,50 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Subject: [PATCH 3/7] i2c: pxa: ensure timeout messages are unique +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Ensure that the various timeout messages can identify where in the code +they were produced from to aid debugging. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index f20f8b905793..0becab239476 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -1095,7 +1095,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num) + ret = i2c->msg_idx; + + if (!timeout && i2c->msg_num) { +- i2c_pxa_scream_blue_murder(i2c, "timeout"); ++ i2c_pxa_scream_blue_murder(i2c, "timeout with active message"); + ret = I2C_RETRY; + } + +@@ -1169,7 +1169,7 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c) + if (timeout < 0) { + show_state(i2c); + dev_err(&i2c->adap.dev, +- "i2c_pxa: timeout waiting for bus free\n"); ++ "i2c_pxa: timeout waiting for bus free (set_master)\n"); + return I2C_RETRY; + } + +@@ -1213,7 +1213,7 @@ static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c, + + out: + if (timeout == 0) { +- i2c_pxa_scream_blue_murder(i2c, "timeout"); ++ i2c_pxa_scream_blue_murder(i2c, "timeout (do_pio_xfer)"); + ret = I2C_RETRY; + } + +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/818-v5.8-i2c-pxa-remove-some-unnecessary-debug.patch b/target/linux/generic/backport-5.4/818-v5.8-i2c-pxa-remove-some-unnecessary-debug.patch new file mode 100644 index 0000000000..4676d7721f --- /dev/null +++ b/target/linux/generic/backport-5.4/818-v5.8-i2c-pxa-remove-some-unnecessary-debug.patch @@ -0,0 +1,39 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Subject: [PATCH 4/7] i2c: pxa: remove some unnecessary debug +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Remove unnecessary show_state() in the loop inside +i2c_pxa_pio_set_master(), which can be unnecessarily verbose. + +Remove the i2c_pxa_scream_blue_murder() in i2c_pxa_pio_xfer(), which +will trigger if we are probing the I2C bus and a slave does not +respond; this is a normal event, and not something to report. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index 0becab239476..db739cce93ac 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -1161,10 +1161,8 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c) + /* + * Wait for the bus to become free. + */ +- while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) { ++ while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) + udelay(1000); +- show_state(i2c); +- } + + if (timeout < 0) { + show_state(i2c); +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/819-v5.8-i2c-pxa-clear-all-master-action-bits-in-i2c_pxa_stop.patch b/target/linux/generic/backport-5.4/819-v5.8-i2c-pxa-clear-all-master-action-bits-in-i2c_pxa_stop.patch new file mode 100644 index 0000000000..997670716f --- /dev/null +++ b/target/linux/generic/backport-5.4/819-v5.8-i2c-pxa-clear-all-master-action-bits-in-i2c_pxa_stop.patch @@ -0,0 +1,43 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Subject: [PATCH 5/7] i2c: pxa: clear all master action bits in + i2c_pxa_stop_message() +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +If we timeout during a message transfer, the control register may +contain bits that cause an action to be set. Read-modify-writing the +register leaving these bits set may trigger the hardware to attempt +one of these actions unintentionally. + +Always clear these bits when cleaning up after a message or after +a timeout. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index db739cce93ac..a72d07bdb793 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -795,11 +795,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) + { + u32 icr; + +- /* +- * Clear the STOP and ACK flags +- */ ++ /* Clear the START, STOP, ACK, TB and MA flags */ + icr = readl(_ICR(i2c)); +- icr &= ~(ICR_STOP | ICR_ACKNAK); ++ icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA); + writel(icr, _ICR(i2c)); + } + +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/820-v5.8-i2c-pxa-use-master-abort-for-device-probes.patch b/target/linux/generic/backport-5.4/820-v5.8-i2c-pxa-use-master-abort-for-device-probes.patch new file mode 100644 index 0000000000..2fde9e7322 --- /dev/null +++ b/target/linux/generic/backport-5.4/820-v5.8-i2c-pxa-use-master-abort-for-device-probes.patch @@ -0,0 +1,40 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Subject: [PATCH 6/7] i2c: pxa: use master-abort for device probes +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Use master-abort to send the stop condition after an address cycle +rather than resetting the controller. + +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 10 ++-------- + 1 file changed, 2 insertions(+), 8 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index a72d07bdb793..0e194d6cd1b5 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -940,14 +940,8 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) + icr &= ~ICR_ALDIE; + icr |= ICR_START | ICR_TB; + } else { +- if (i2c->msg->len == 0) { +- /* +- * Device probes have a message length of zero +- * and need the bus to be reset before it can +- * be used again. +- */ +- i2c_pxa_reset(i2c); +- } ++ if (i2c->msg->len == 0) ++ icr |= ICR_MA; + i2c_pxa_master_complete(i2c, 0); + } + +-- +2.20.1 + diff --git a/target/linux/generic/backport-5.4/821-v5.8-i2c-pxa-implement-generic-i2c-bus-recovery.patch b/target/linux/generic/backport-5.4/821-v5.8-i2c-pxa-implement-generic-i2c-bus-recovery.patch new file mode 100644 index 0000000000..745cb6567c --- /dev/null +++ b/target/linux/generic/backport-5.4/821-v5.8-i2c-pxa-implement-generic-i2c-bus-recovery.patch @@ -0,0 +1,290 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Subject: [PATCH 7/7] i2c: pxa: implement generic i2c bus recovery +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Implement generic GPIO-based I2C bus recovery for the PXA I2C driver. + +Reviewed-by: Andrew Lunn +Signed-off-by: Russell King +--- + drivers/i2c/busses/i2c-pxa.c | 176 +++++++++++++++++++++++++++++++---- + 1 file changed, 159 insertions(+), 17 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c +index 0e194d6cd1b5..a7885b8b5031 100644 +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -28,6 +29,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -260,6 +262,11 @@ struct pxa_i2c { + bool highmode_enter; + u32 fm_mask; + u32 hs_mask; ++ ++ struct i2c_bus_recovery_info recovery; ++ struct pinctrl *pinctrl; ++ struct pinctrl_state *pinctrl_default; ++ struct pinctrl_state *pinctrl_recovery; + }; + + #define _IBMR(i2c) ((i2c)->reg_ibmr) +@@ -559,13 +566,8 @@ static void i2c_pxa_set_slave(struct pxa_i2c *i2c, int errcode) + #define i2c_pxa_set_slave(i2c, err) do { } while (0) + #endif + +-static void i2c_pxa_reset(struct pxa_i2c *i2c) ++static void i2c_pxa_do_reset(struct pxa_i2c *i2c) + { +- pr_debug("Resetting I2C Controller Unit\n"); +- +- /* abort any transfer currently under way */ +- i2c_pxa_abort(i2c); +- + /* reset according to 9.8 */ + writel(ICR_UR, _ICR(i2c)); + writel(I2C_ISR_INIT, _ISR(i2c)); +@@ -584,12 +586,25 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c) + #endif + + i2c_pxa_set_slave(i2c, 0); ++} + ++static void i2c_pxa_enable(struct pxa_i2c *i2c) ++{ + /* enable unit */ + writel(readl(_ICR(i2c)) | ICR_IUE, _ICR(i2c)); + udelay(100); + } + ++static void i2c_pxa_reset(struct pxa_i2c *i2c) ++{ ++ pr_debug("Resetting I2C Controller Unit\n"); ++ ++ /* abort any transfer currently under way */ ++ i2c_pxa_abort(i2c); ++ i2c_pxa_do_reset(i2c); ++ i2c_pxa_enable(i2c); ++} ++ + + #ifdef CONFIG_I2C_PXA_SLAVE + /* +@@ -1043,6 +1058,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num) + ret = i2c_pxa_wait_bus_not_busy(i2c); + if (ret) { + dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for bus free\n"); ++ i2c_recover_bus(&i2c->adap); + goto out; + } + +@@ -1088,6 +1104,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num) + + if (!timeout && i2c->msg_num) { + i2c_pxa_scream_blue_murder(i2c, "timeout with active message"); ++ i2c_recover_bus(&i2c->adap); + ret = I2C_RETRY; + } + +@@ -1277,6 +1294,129 @@ static int i2c_pxa_probe_pdata(struct platform_device *pdev, + return 0; + } + ++static void i2c_pxa_prepare_recovery(struct i2c_adapter *adap) ++{ ++ struct pxa_i2c *i2c = adap->algo_data; ++ u32 ibmr = readl(_IBMR(i2c)); ++ ++ /* ++ * Program the GPIOs to reflect the current I2C bus state while ++ * we transition to recovery; this avoids glitching the bus. ++ */ ++ gpiod_set_value(i2c->recovery.scl_gpiod, ibmr & IBMR_SCLS); ++ gpiod_set_value(i2c->recovery.sda_gpiod, ibmr & IBMR_SDAS); ++ ++ WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery)); ++} ++ ++static void i2c_pxa_unprepare_recovery(struct i2c_adapter *adap) ++{ ++ struct pxa_i2c *i2c = adap->algo_data; ++ u32 isr; ++ ++ /* ++ * The bus should now be free. Clear up the I2C controller before ++ * handing control of the bus back to avoid the bus changing state. ++ */ ++ isr = readl(_ISR(i2c)); ++ if (isr & (ISR_UB | ISR_IBB)) { ++ dev_dbg(&i2c->adap.dev, ++ "recovery: resetting controller, ISR=0x%08x\n", isr); ++ i2c_pxa_do_reset(i2c); ++ } ++ ++ WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default)); ++ ++ dev_dbg(&i2c->adap.dev, "recovery: IBMR 0x%08x ISR 0x%08x\n", ++ readl(_IBMR(i2c)), readl(_ISR(i2c))); ++ ++ i2c_pxa_enable(i2c); ++} ++ ++static int i2c_pxa_init_recovery(struct pxa_i2c *i2c) ++{ ++ struct i2c_bus_recovery_info *bri = &i2c->recovery; ++ struct device *dev = i2c->adap.dev.parent; ++ ++ /* ++ * When slave mode is enabled, we are not the only master on the bus. ++ * Bus recovery can only be performed when we are the master, which ++ * we can't be certain of. Therefore, when slave mode is enabled, do ++ * not configure bus recovery. ++ */ ++ if (IS_ENABLED(CONFIG_I2C_PXA_SLAVE)) ++ return 0; ++ ++ i2c->pinctrl = devm_pinctrl_get(dev); ++ if (IS_ERR(i2c->pinctrl)) ++ return PTR_ERR(i2c->pinctrl); ++ ++ if (!i2c->pinctrl) ++ return 0; ++ ++ i2c->pinctrl_default = pinctrl_lookup_state(i2c->pinctrl, ++ PINCTRL_STATE_DEFAULT); ++ i2c->pinctrl_recovery = pinctrl_lookup_state(i2c->pinctrl, "recovery"); ++ ++ if (IS_ERR(i2c->pinctrl_default) || IS_ERR(i2c->pinctrl_recovery)) { ++ dev_info(dev, "missing pinmux recovery information: %ld %ld\n", ++ PTR_ERR(i2c->pinctrl_default), ++ PTR_ERR(i2c->pinctrl_recovery)); ++ return 0; ++ } ++ ++ /* ++ * Claiming GPIOs can influence the pinmux state, and may glitch the ++ * I2C bus. Do this carefully. ++ */ ++ bri->scl_gpiod = devm_gpiod_get(dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN); ++ if (bri->scl_gpiod == ERR_PTR(-EPROBE_DEFER)) ++ return -EPROBE_DEFER; ++ if (IS_ERR(bri->scl_gpiod)) { ++ dev_info(dev, "missing scl gpio recovery information: %pe\n", ++ bri->scl_gpiod); ++ return 0; ++ } ++ ++ /* ++ * We have SCL. Pull SCL low and wait a bit so that SDA glitches ++ * have no effect. ++ */ ++ gpiod_direction_output(bri->scl_gpiod, 0); ++ udelay(10); ++ bri->sda_gpiod = devm_gpiod_get(dev, "sda", GPIOD_OUT_HIGH_OPEN_DRAIN); ++ ++ /* Wait a bit in case of a SDA glitch, and then release SCL. */ ++ udelay(10); ++ gpiod_direction_output(bri->scl_gpiod, 1); ++ ++ if (bri->sda_gpiod == ERR_PTR(-EPROBE_DEFER)) ++ return -EPROBE_DEFER; ++ ++ if (IS_ERR(bri->sda_gpiod)) { ++ dev_info(dev, "missing sda gpio recovery information: %pe\n", ++ bri->sda_gpiod); ++ return 0; ++ } ++ ++ bri->prepare_recovery = i2c_pxa_prepare_recovery; ++ bri->unprepare_recovery = i2c_pxa_unprepare_recovery; ++ bri->recover_bus = i2c_generic_scl_recovery; ++ ++ i2c->adap.bus_recovery_info = bri; ++ ++ /* ++ * Claiming GPIOs can change the pinmux state, which confuses the ++ * pinctrl since pinctrl's idea of the current setting is unaffected ++ * by the pinmux change caused by claiming the GPIO. Work around that ++ * by switching pinctrl to the GPIO state here. We do it this way to ++ * avoid glitching the I2C bus. ++ */ ++ pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery); ++ ++ return pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default); ++} ++ + static int i2c_pxa_probe(struct platform_device *dev) + { + struct i2c_pxa_platform_data *plat = dev_get_platdata(&dev->dev); +@@ -1289,6 +1429,16 @@ static int i2c_pxa_probe(struct platform_device *dev) + if (!i2c) + return -ENOMEM; + ++ /* Default adapter num to device id; i2c_pxa_probe_dt can override. */ ++ i2c->adap.nr = dev->id; ++ i2c->adap.owner = THIS_MODULE; ++ i2c->adap.retries = 5; ++ i2c->adap.algo_data = i2c; ++ i2c->adap.dev.parent = &dev->dev; ++#ifdef CONFIG_OF ++ i2c->adap.dev.of_node = dev->dev.of_node; ++#endif ++ + res = platform_get_resource(dev, IORESOURCE_MEM, 0); + i2c->reg_base = devm_ioremap_resource(&dev->dev, res); + if (IS_ERR(i2c->reg_base)) +@@ -1298,8 +1448,9 @@ static int i2c_pxa_probe(struct platform_device *dev) + if (irq < 0) + return irq; + +- /* Default adapter num to device id; i2c_pxa_probe_dt can override. */ +- i2c->adap.nr = dev->id; ++ ret = i2c_pxa_init_recovery(i2c); ++ if (ret) ++ return ret; + + ret = i2c_pxa_probe_dt(dev, i2c, &i2c_type); + if (ret > 0) +@@ -1307,9 +1458,6 @@ static int i2c_pxa_probe(struct platform_device *dev) + if (ret < 0) + return ret; + +- i2c->adap.owner = THIS_MODULE; +- i2c->adap.retries = 5; +- + spin_lock_init(&i2c->lock); + init_waitqueue_head(&i2c->wait); + +@@ -1375,12 +1523,6 @@ static int i2c_pxa_probe(struct platform_device *dev) + + i2c_pxa_reset(i2c); + +- i2c->adap.algo_data = i2c; +- i2c->adap.dev.parent = &dev->dev; +-#ifdef CONFIG_OF +- i2c->adap.dev.of_node = dev->dev.of_node; +-#endif +- + ret = i2c_add_numbered_adapter(&i2c->adap); + if (ret < 0) + goto ereqirq; +-- +2.20.1 + From 6593ea23e5173861e44f5f6a6fe3e7e6c3978f17 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 21 May 2020 09:57:32 +0100 Subject: [PATCH 07/21] kernel: backport the I2C bus recovery for uDPU Backport the I2C bus recovery DT configuration for the uDPU that has been queued for 5.8. Signed-off-by: Russell King --- ...-arm64-dts-add-uDPU-i2c-bus-recovery.patch | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 target/linux/mvebu/patches-5.4/551-v5.8-arm64-dts-add-uDPU-i2c-bus-recovery.patch diff --git a/target/linux/mvebu/patches-5.4/551-v5.8-arm64-dts-add-uDPU-i2c-bus-recovery.patch b/target/linux/mvebu/patches-5.4/551-v5.8-arm64-dts-add-uDPU-i2c-bus-recovery.patch new file mode 100644 index 0000000000..b1c508abab --- /dev/null +++ b/target/linux/mvebu/patches-5.4/551-v5.8-arm64-dts-add-uDPU-i2c-bus-recovery.patch @@ -0,0 +1,60 @@ +From: Russell King +Bcc: linux@mail.armlinux.org.uk +Cc: Vladimir Vid ,Jason Cooper ,Andrew Lunn ,Gregory Clement ,Sebastian Hesselbarth ,Rob Herring ,Mark Rutland ,linux-arm-kernel@lists.infradead.org,devicetree@vger.kernel.org +Subject: [PATCH] arm64: dts: add uDPU i2c bus recovery +MIME-Version: 1.0 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="utf-8" + +Signed-off-by: Russell King +--- + .../boot/dts/marvell/armada-3720-uDPU.dts | 22 +++++++++++++++++-- + 1 file changed, 20 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts b/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts +index 7eb6c1796cef..95d46e8d081c 100644 +--- a/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts +@@ -117,18 +117,36 @@ + }; + }; + ++&pinctrl_nb { ++ i2c1_recovery_pins: i2c1-recovery-pins { ++ groups = "i2c1"; ++ function = "gpio"; ++ }; ++ ++ i2c2_recovery_pins: i2c2-recovery-pins { ++ groups = "i2c2"; ++ function = "gpio"; ++ }; ++}; ++ + &i2c0 { + status = "okay"; +- pinctrl-names = "default"; ++ pinctrl-names = "default", "recovery"; + pinctrl-0 = <&i2c1_pins>; ++ pinctrl-1 = <&i2c1_recovery_pins>; + /delete-property/mrvl,i2c-fast-mode; ++ scl-gpios = <&gpionb 0 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ sda-gpios = <&gpionb 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + }; + + &i2c1 { + status = "okay"; +- pinctrl-names = "default"; ++ pinctrl-names = "default", "recovery"; + pinctrl-0 = <&i2c2_pins>; ++ pinctrl-1 = <&i2c2_recovery_pins>; + /delete-property/mrvl,i2c-fast-mode; ++ scl-gpios = <&gpionb 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ sda-gpios = <&gpionb 3 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + + lm75@48 { + status = "okay"; +-- +2.20.1 + From a4b50c4bce7b015c9d7c7d599ea29994a55f3f1f Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 28 Apr 2020 23:56:33 +0200 Subject: [PATCH 08/21] mac80211: Update to version 5.4.36-1 This updates the mac80211 backport to the latest minor version. The removed patch was a backport from the upstream kernel which is now integrated. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 8 +- ...-F2-blocksize-and-watermark-for-4359.patch | 2 +- .../subsys/140-tweak-TSQ-setting.patch | 2 +- .../subsys/150-disable_addr_notifier.patch | 8 +- .../300-mac80211-optimize-skb-resizing.patch | 10 +- ...l-remove-divisions-in-tx-status-path.patch | 4 +- ...l_ht-replace-rate-stats-ewma-with-a-.patch | 8 +- ...l_ht-rename-prob_ewma-to-prob_avg-us.patch | 2 +- ...ore-skb-ack-code-to-its-own-function.patch | 4 +- ...the-size-of-ack_frame_id-to-make-roo.patch | 2 +- ...new-sta_info-getter-by-sta-vif-addrs.patch | 2 +- ...t-airtime-calculation-code-from-mt76.patch | 2 +- ...lement-Airtime-based-Queue-Limit-AQL.patch | 16 +- ...time-based-Queue-Limits-AQL-on-packe.patch | 4 +- ...Turn-AQL-into-an-NL80211_EXT_FEATURE.patch | 22 +-- ...ta-frames-without-key-on-encrypted-l.patch | 148 ------------------ .../500-mac80211_configure_antenna_gain.patch | 4 +- 17 files changed, 50 insertions(+), 198 deletions(-) delete mode 100644 package/kernel/mac80211/patches/subsys/314-mac80211-drop-data-frames-without-key-on-encrypted-l.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 26c5ef4b1a..901c08b0de 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.4.27-1 -PKG_RELEASE:=3 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.4.27/ -PKG_HASH:=4c853a2f4c4fcc81cf60a3d59c5efbdb60c3e4acda22996cb192443581753950 +PKG_VERSION:=5.4.36-1 +PKG_RELEASE:=1 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.4.36/ +PKG_HASH:=5b39734986fba3b9c24c521d0499a2dc9cb17267bb58c02d9a520205add2d16b PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0002-brcmfmac-set-F2-blocksize-and-watermark-for-4359.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0002-brcmfmac-set-F2-blocksize-and-watermark-for-4359.patch index bdfe2ae85f..37ba7f360b 100644 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0002-brcmfmac-set-F2-blocksize-and-watermark-for-4359.patch +++ b/package/kernel/mac80211/patches/brcm/114-v5.6-0002-brcmfmac-set-F2-blocksize-and-watermark-for-4359.patch @@ -57,7 +57,7 @@ Signed-off-by: Kalle Valo #ifdef DEBUG -@@ -4206,6 +4208,19 @@ static void brcmf_sdio_firmware_callback +@@ -4208,6 +4210,19 @@ static void brcmf_sdio_firmware_callback brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl, &err); break; diff --git a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch index 64a92a16f6..fa12232f1b 100644 --- a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch +++ b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4024,6 +4024,12 @@ out: +@@ -4048,6 +4048,12 @@ out: netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev) { diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index ab845c04e5..3c5d1d63a8 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -18,7 +18,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1264,14 +1264,14 @@ int ieee80211_register_hw(struct ieee802 +@@ -1267,14 +1267,14 @@ int ieee80211_register_hw(struct ieee802 rtnl_unlock(); @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1280,13 +1280,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1283,13 +1283,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -51,8 +51,8 @@ +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6) fail_ifa: #endif - rtnl_lock(); -@@ -1314,10 +1314,10 @@ void ieee80211_unregister_hw(struct ieee + wiphy_unregister(local->hw.wiphy); +@@ -1317,10 +1317,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch b/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch index 3847b19547..dcdb94565d 100644 --- a/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch +++ b/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch @@ -50,7 +50,7 @@ Signed-off-by: Felix Fietkau if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -1937,37 +1937,53 @@ static bool ieee80211_tx(struct ieee8021 +@@ -1943,37 +1943,53 @@ static bool ieee80211_tx(struct ieee8021 } /* device xmit handlers */ @@ -123,7 +123,7 @@ Signed-off-by: Felix Fietkau wiphy_debug(local->hw.wiphy, "failed to reallocate TX buffer\n"); return -ENOMEM; -@@ -1983,18 +1999,8 @@ void ieee80211_xmit(struct ieee80211_sub +@@ -1989,18 +2005,8 @@ void ieee80211_xmit(struct ieee80211_sub struct ieee80211_local *local = sdata->local; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr; @@ -143,7 +143,7 @@ Signed-off-by: Felix Fietkau ieee80211_free_txskb(&local->hw, skb); return; } -@@ -2784,29 +2790,13 @@ static struct sk_buff *ieee80211_build_h +@@ -2790,29 +2796,13 @@ static struct sk_buff *ieee80211_build_h } skb_pull(skb, skip_header_bytes); @@ -179,7 +179,7 @@ Signed-off-by: Felix Fietkau } if (encaps_data) -@@ -3421,7 +3411,6 @@ static bool ieee80211_xmit_fast(struct i +@@ -3427,7 +3417,6 @@ static bool ieee80211_xmit_fast(struct i struct ieee80211_local *local = sdata->local; u16 ethertype = (skb->data[12] << 8) | skb->data[13]; int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); @@ -187,7 +187,7 @@ Signed-off-by: Felix Fietkau struct ethhdr eth; struct ieee80211_tx_info *info; struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -@@ -3473,10 +3462,7 @@ static bool ieee80211_xmit_fast(struct i +@@ -3479,10 +3468,7 @@ static bool ieee80211_xmit_fast(struct i * as the may-encrypt argument for the resize to not account for * more room than we already have in 'extra_head' */ diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-minstrel-remove-divisions-in-tx-status-path.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-minstrel-remove-divisions-in-tx-status-path.patch index 0bdeded529..91fb92f1b2 100644 --- a/package/kernel/mac80211/patches/subsys/301-mac80211-minstrel-remove-divisions-in-tx-status-path.patch +++ b/package/kernel/mac80211/patches/subsys/301-mac80211-minstrel-remove-divisions-in-tx-status-path.patch @@ -57,5 +57,5 @@ Signed-off-by: Felix Fietkau - mp->update_interval = 100; + mp->update_interval = HZ / 10; - #ifdef CPTCFG_MAC80211_DEBUGFS - mp->fixed_rate_idx = (u32) -1; + minstrel_ht_init_cck_rates(mp); + diff --git a/package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch b/package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch index bce9e75378..78e8527a5c 100644 --- a/package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch +++ b/package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch @@ -222,14 +222,14 @@ Signed-off-by: Felix Fietkau mp->update_interval = HZ / 10; + mp->new_avg = true; - #ifdef CPTCFG_MAC80211_DEBUGFS - mp->fixed_rate_idx = (u32) -1; -@@ -1672,6 +1679,8 @@ minstrel_ht_alloc(struct ieee80211_hw *h + minstrel_ht_init_cck_rates(mp); + +@@ -1682,6 +1689,8 @@ static void minstrel_ht_add_debugfs(stru &mp->fixed_rate_idx); debugfs_create_u32("sample_switch", S_IRUGO | S_IWUSR, debugfsdir, &mp->sample_switch); + debugfs_create_bool("new_avg", S_IRUGO | S_IWUSR, debugfsdir, + &mp->new_avg); + } #endif - minstrel_ht_init_cck_rates(mp); diff --git a/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch b/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch index 23419afb12..f4c4bdb94e 100644 --- a/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch +++ b/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch @@ -379,7 +379,7 @@ Signed-off-by: Felix Fietkau minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur) return -1; -@@ -1705,7 +1705,7 @@ static u32 minstrel_ht_get_expected_thro +@@ -1711,7 +1711,7 @@ static u32 minstrel_ht_get_expected_thro i = mi->max_tp_rate[0] / MCS_GROUP_RATES; j = mi->max_tp_rate[0] % MCS_GROUP_RATES; diff --git a/package/kernel/mac80211/patches/subsys/306-mac80211-move-store-skb-ack-code-to-its-own-function.patch b/package/kernel/mac80211/patches/subsys/306-mac80211-move-store-skb-ack-code-to-its-own-function.patch index 72e3d842d2..4f0a699c80 100644 --- a/package/kernel/mac80211/patches/subsys/306-mac80211-move-store-skb-ack-code-to-its-own-function.patch +++ b/package/kernel/mac80211/patches/subsys/306-mac80211-move-store-skb-ack-code-to-its-own-function.patch @@ -13,7 +13,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -2439,6 +2439,33 @@ static int ieee80211_lookup_ra_sta(struc +@@ -2445,6 +2445,33 @@ static int ieee80211_lookup_ra_sta(struc return 0; } @@ -47,7 +47,7 @@ Signed-off-by: Johannes Berg /** * ieee80211_build_hdr - build 802.11 header in the given frame * @sdata: virtual interface to build the header for -@@ -2732,26 +2759,8 @@ static struct sk_buff *ieee80211_build_h +@@ -2738,26 +2765,8 @@ static struct sk_buff *ieee80211_build_h } if (unlikely(!multicast && skb->sk && diff --git a/package/kernel/mac80211/patches/subsys/307-mac80211-Shrink-the-size-of-ack_frame_id-to-make-roo.patch b/package/kernel/mac80211/patches/subsys/307-mac80211-Shrink-the-size-of-ack_frame_id-to-make-roo.patch index 9fe2a924df..ff25ceff6e 100644 --- a/package/kernel/mac80211/patches/subsys/307-mac80211-Shrink-the-size-of-ack_frame_id-to-make-roo.patch +++ b/package/kernel/mac80211/patches/subsys/307-mac80211-Shrink-the-size-of-ack_frame_id-to-make-roo.patch @@ -56,7 +56,7 @@ Signed-off-by: Johannes Berg if (id < 0) { --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -2452,7 +2452,7 @@ static int ieee80211_store_ack_skb(struc +@@ -2458,7 +2458,7 @@ static int ieee80211_store_ack_skb(struc spin_lock_irqsave(&local->ack_status_lock, flags); id = idr_alloc(&local->ack_status_frames, ack_skb, diff --git a/package/kernel/mac80211/patches/subsys/308-mac80211-Add-new-sta_info-getter-by-sta-vif-addrs.patch b/package/kernel/mac80211/patches/subsys/308-mac80211-Add-new-sta_info-getter-by-sta-vif-addrs.patch index 75558faac7..a6b05f4b74 100644 --- a/package/kernel/mac80211/patches/subsys/308-mac80211-Add-new-sta_info-getter-by-sta-vif-addrs.patch +++ b/package/kernel/mac80211/patches/subsys/308-mac80211-Add-new-sta_info-getter-by-sta-vif-addrs.patch @@ -41,7 +41,7 @@ Signed-off-by: Johannes Berg { --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h -@@ -725,6 +725,10 @@ struct sta_info *sta_info_get(struct iee +@@ -726,6 +726,10 @@ struct sta_info *sta_info_get(struct iee struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, const u8 *addr); diff --git a/package/kernel/mac80211/patches/subsys/309-mac80211-Import-airtime-calculation-code-from-mt76.patch b/package/kernel/mac80211/patches/subsys/309-mac80211-Import-airtime-calculation-code-from-mt76.patch index 7bfe299cf4..7f049b8d0c 100644 --- a/package/kernel/mac80211/patches/subsys/309-mac80211-Import-airtime-calculation-code-from-mt76.patch +++ b/package/kernel/mac80211/patches/subsys/309-mac80211-Import-airtime-calculation-code-from-mt76.patch @@ -29,7 +29,7 @@ Signed-off-by: Johannes Berg --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6417,4 +6417,33 @@ void ieee80211_nan_func_match(struct iee +@@ -6419,4 +6419,33 @@ void ieee80211_nan_func_match(struct iee struct cfg80211_nan_match_params *match, gfp_t gfp); diff --git a/package/kernel/mac80211/patches/subsys/310-mac80211-Implement-Airtime-based-Queue-Limit-AQL.patch b/package/kernel/mac80211/patches/subsys/310-mac80211-Implement-Airtime-based-Queue-Limit-AQL.patch index 690d57cb12..b76286d15c 100644 --- a/package/kernel/mac80211/patches/subsys/310-mac80211-Implement-Airtime-based-Queue-Limit-AQL.patch +++ b/package/kernel/mac80211/patches/subsys/310-mac80211-Implement-Airtime-based-Queue-Limit-AQL.patch @@ -182,7 +182,7 @@ Signed-off-by: Johannes Berg /* if the dir failed, don't put all the other things into the root! */ --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c -@@ -197,10 +197,12 @@ static ssize_t sta_airtime_read(struct f +@@ -198,10 +198,12 @@ static ssize_t sta_airtime_read(struct f { struct sta_info *sta = file->private_data; struct ieee80211_local *local = sta->sdata->local; @@ -196,7 +196,7 @@ Signed-off-by: Johannes Berg ssize_t rv; int ac; -@@ -212,19 +214,22 @@ static ssize_t sta_airtime_read(struct f +@@ -213,19 +215,22 @@ static ssize_t sta_airtime_read(struct f rx_airtime += sta->airtime[ac].rx_airtime; tx_airtime += sta->airtime[ac].tx_airtime; deficit[ac] = sta->airtime[ac].deficit; @@ -227,7 +227,7 @@ Signed-off-by: Johannes Berg rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); kfree(buf); -@@ -236,7 +241,25 @@ static ssize_t sta_airtime_write(struct +@@ -237,7 +242,25 @@ static ssize_t sta_airtime_write(struct { struct sta_info *sta = file->private_data; struct ieee80211_local *local = sta->sdata->local; @@ -299,7 +299,7 @@ Signed-off-by: Johannes Berg } for (i = 0; i < IEEE80211_NUM_TIDS; i++) -@@ -1908,6 +1911,41 @@ void ieee80211_sta_register_airtime(stru +@@ -1913,6 +1916,41 @@ void ieee80211_sta_register_airtime(stru } EXPORT_SYMBOL(ieee80211_sta_register_airtime); @@ -343,7 +343,7 @@ Signed-off-by: Johannes Berg { --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h -@@ -127,13 +127,21 @@ enum ieee80211_agg_stop_reason { +@@ -128,13 +128,21 @@ enum ieee80211_agg_stop_reason { /* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */ #define AIRTIME_USE_TX BIT(0) #define AIRTIME_USE_RX BIT(1) @@ -367,7 +367,7 @@ Signed-off-by: Johannes Berg /** --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3676,7 +3676,8 @@ struct ieee80211_txq *ieee80211_next_txq +@@ -3700,7 +3700,8 @@ struct ieee80211_txq *ieee80211_next_txq { struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_txq *ret = NULL; @@ -377,7 +377,7 @@ Signed-off-by: Johannes Berg spin_lock_bh(&local->active_txq_lock[ac]); -@@ -3687,13 +3688,30 @@ struct ieee80211_txq *ieee80211_next_txq +@@ -3711,13 +3712,30 @@ struct ieee80211_txq *ieee80211_next_txq if (!txqi) goto out; @@ -410,7 +410,7 @@ Signed-off-by: Johannes Berg list_move_tail(&txqi->schedule_order, &local->active_txqs[txqi->txq.ac]); goto begin; -@@ -3747,6 +3765,33 @@ void __ieee80211_schedule_txq(struct iee +@@ -3771,6 +3789,33 @@ void __ieee80211_schedule_txq(struct iee } EXPORT_SYMBOL(__ieee80211_schedule_txq); diff --git a/package/kernel/mac80211/patches/subsys/311-mac80211-Use-Airtime-based-Queue-Limits-AQL-on-packe.patch b/package/kernel/mac80211/patches/subsys/311-mac80211-Use-Airtime-based-Queue-Limits-AQL-on-packe.patch index 103fc4fd52..a0548d9d05 100644 --- a/package/kernel/mac80211/patches/subsys/311-mac80211-Use-Airtime-based-Queue-Limits-AQL-on-packe.patch +++ b/package/kernel/mac80211/patches/subsys/311-mac80211-Use-Airtime-based-Queue-Limits-AQL-on-packe.patch @@ -112,7 +112,7 @@ Signed-off-by: Johannes Berg if (sta->status_stats.lost_packets) --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3553,6 +3553,9 @@ struct sk_buff *ieee80211_tx_dequeue(str +@@ -3559,6 +3559,9 @@ struct sk_buff *ieee80211_tx_dequeue(str WARN_ON_ONCE(softirq_count() == 0); @@ -122,7 +122,7 @@ Signed-off-by: Johannes Berg begin: spin_lock_bh(&fq->lock); -@@ -3663,6 +3666,21 @@ begin: +@@ -3687,6 +3690,21 @@ begin: } IEEE80211_SKB_CB(skb)->control.vif = vif; diff --git a/package/kernel/mac80211/patches/subsys/313-mac80211-Turn-AQL-into-an-NL80211_EXT_FEATURE.patch b/package/kernel/mac80211/patches/subsys/313-mac80211-Turn-AQL-into-an-NL80211_EXT_FEATURE.patch index 9129560f24..389f2ae225 100644 --- a/package/kernel/mac80211/patches/subsys/313-mac80211-Turn-AQL-into-an-NL80211_EXT_FEATURE.patch +++ b/package/kernel/mac80211/patches/subsys/313-mac80211-Turn-AQL-into-an-NL80211_EXT_FEATURE.patch @@ -64,7 +64,7 @@ Signed-off-by: Johannes Berg NUM_NL80211_EXT_FEATURES, --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c -@@ -201,8 +201,6 @@ static ssize_t sta_airtime_read(struct f +@@ -202,8 +202,6 @@ static ssize_t sta_airtime_read(struct f char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; u64 rx_airtime = 0, tx_airtime = 0; s64 deficit[IEEE80211_NUM_ACS]; @@ -73,7 +73,7 @@ Signed-off-by: Johannes Berg ssize_t rv; int ac; -@@ -214,6 +212,56 @@ static ssize_t sta_airtime_read(struct f +@@ -215,6 +213,56 @@ static ssize_t sta_airtime_read(struct f rx_airtime += sta->airtime[ac].rx_airtime; tx_airtime += sta->airtime[ac].tx_airtime; deficit[ac] = sta->airtime[ac].deficit; @@ -130,7 +130,7 @@ Signed-off-by: Johannes Berg q_limit_l[ac] = sta->airtime[ac].aql_limit_low; q_limit_h[ac] = sta->airtime[ac].aql_limit_high; spin_unlock_bh(&local->active_txq_lock[ac]); -@@ -221,12 +269,8 @@ static ssize_t sta_airtime_read(struct f +@@ -222,12 +270,8 @@ static ssize_t sta_airtime_read(struct f } p += scnprintf(p, bufsz + buf - p, @@ -143,7 +143,7 @@ Signed-off-by: Johannes Berg q_depth[0], q_depth[1], q_depth[2], q_depth[3], q_limit_l[0], q_limit_h[0], q_limit_l[1], q_limit_h[1], q_limit_l[2], q_limit_h[2], q_limit_l[3], q_limit_h[3]), -@@ -236,11 +280,10 @@ static ssize_t sta_airtime_read(struct f +@@ -237,11 +281,10 @@ static ssize_t sta_airtime_read(struct f return rv; } @@ -156,7 +156,7 @@ Signed-off-by: Johannes Berg u32 ac, q_limit_l, q_limit_h; char _buf[100] = {}, *buf = _buf; -@@ -251,7 +294,7 @@ static ssize_t sta_airtime_write(struct +@@ -252,7 +295,7 @@ static ssize_t sta_airtime_write(struct return -EFAULT; buf[sizeof(_buf) - 1] = '\0'; @@ -165,7 +165,7 @@ Signed-off-by: Johannes Berg != 3) return -EINVAL; -@@ -261,17 +304,10 @@ static ssize_t sta_airtime_write(struct +@@ -262,17 +305,10 @@ static ssize_t sta_airtime_write(struct sta->airtime[ac].aql_limit_low = q_limit_l; sta->airtime[ac].aql_limit_high = q_limit_h; @@ -185,7 +185,7 @@ Signed-off-by: Johannes Berg static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) -@@ -1001,6 +1037,10 @@ void ieee80211_sta_debugfs_add(struct st +@@ -1002,6 +1038,10 @@ void ieee80211_sta_debugfs_add(struct st NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) DEBUGFS_ADD(airtime); @@ -211,7 +211,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -1917,6 +1917,9 @@ void ieee80211_sta_update_pending_airtim +@@ -1922,6 +1922,9 @@ void ieee80211_sta_update_pending_airtim { int tx_pending; @@ -223,7 +223,7 @@ Signed-off-by: Johannes Berg atomic_add(tx_airtime, --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h -@@ -127,7 +127,6 @@ enum ieee80211_agg_stop_reason { +@@ -128,7 +128,6 @@ enum ieee80211_agg_stop_reason { /* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */ #define AIRTIME_USE_TX BIT(0) #define AIRTIME_USE_RX BIT(1) @@ -233,7 +233,7 @@ Signed-off-by: Johannes Berg u64 rx_airtime; --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3667,7 +3667,7 @@ begin: +@@ -3691,7 +3691,7 @@ begin: IEEE80211_SKB_CB(skb)->control.vif = vif; @@ -242,7 +242,7 @@ Signed-off-by: Johannes Berg u32 airtime; airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta, -@@ -3789,7 +3789,7 @@ bool ieee80211_txq_airtime_check(struct +@@ -3813,7 +3813,7 @@ bool ieee80211_txq_airtime_check(struct struct sta_info *sta; struct ieee80211_local *local = hw_to_local(hw); diff --git a/package/kernel/mac80211/patches/subsys/314-mac80211-drop-data-frames-without-key-on-encrypted-l.patch b/package/kernel/mac80211/patches/subsys/314-mac80211-drop-data-frames-without-key-on-encrypted-l.patch deleted file mode 100644 index 54e09af3b3..0000000000 --- a/package/kernel/mac80211/patches/subsys/314-mac80211-drop-data-frames-without-key-on-encrypted-l.patch +++ /dev/null @@ -1,148 +0,0 @@ -From a0761a301746ec2d92d7fcb82af69c0a6a4339aa Mon Sep 17 00:00:00 2001 -From: Johannes Berg -Date: Thu, 26 Mar 2020 15:09:42 +0200 -Subject: mac80211: drop data frames without key on encrypted links - -If we know that we have an encrypted link (based on having had -a key configured for TX in the past) then drop all data frames -in the key selection handler if there's no key anymore. - -This fixes an issue with mac80211 internal TXQs - there we can -buffer frames for an encrypted link, but then if the key is no -longer there when they're dequeued, the frames are sent without -encryption. This happens if a station is disconnected while the -frames are still on the TXQ. - -Detecting that a link should be encrypted based on a first key -having been configured for TX is fine as there are no use cases -for a connection going from with encryption to no encryption. -With extended key IDs, however, there is a case of having a key -configured for only decryption, so we can't just trigger this -behaviour on a key being configured. - -Cc: stable@vger.kernel.org -Reported-by: Jouni Malinen -Signed-off-by: Johannes Berg -Signed-off-by: Luca Coelho ---- - net/mac80211/debugfs_sta.c | 3 ++- - net/mac80211/key.c | 20 ++++++++++++-------- - net/mac80211/sta_info.h | 1 + - net/mac80211/tx.c | 12 +++++++++--- - 4 files changed, 24 insertions(+), 12 deletions(-) - ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -5,7 +5,7 @@ - * Copyright 2007 Johannes Berg - * Copyright 2013-2014 Intel Mobile Communications GmbH - * Copyright(c) 2016 Intel Deutschland GmbH -- * Copyright (C) 2018 - 2019 Intel Corporation -+ * Copyright (C) 2018 - 2020 Intel Corporation - */ - - #include -@@ -78,6 +78,7 @@ static const char * const sta_flag_names - FLAG(MPSP_OWNER), - FLAG(MPSP_RECIPIENT), - FLAG(PS_DELIVER), -+ FLAG(USES_ENCRYPTION), - #undef FLAG - }; - ---- a/net/mac80211/key.c -+++ b/net/mac80211/key.c -@@ -6,7 +6,7 @@ - * Copyright 2007-2008 Johannes Berg - * Copyright 2013-2014 Intel Mobile Communications GmbH - * Copyright 2015-2017 Intel Deutschland GmbH -- * Copyright 2018-2019 Intel Corporation -+ * Copyright 2018-2020 Intel Corporation - */ - - #include -@@ -262,22 +262,29 @@ static void ieee80211_key_disable_hw_acc - sta ? sta->sta.addr : bcast_addr, ret); - } - --int ieee80211_set_tx_key(struct ieee80211_key *key) -+static int _ieee80211_set_tx_key(struct ieee80211_key *key, bool force) - { - struct sta_info *sta = key->sta; - struct ieee80211_local *local = key->local; - - assert_key_lock(local); - -+ set_sta_flag(sta, WLAN_STA_USES_ENCRYPTION); -+ - sta->ptk_idx = key->conf.keyidx; - -- if (!ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT)) -+ if (force || !ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT)) - clear_sta_flag(sta, WLAN_STA_BLOCK_BA); - ieee80211_check_fast_xmit(sta); - - return 0; - } - -+int ieee80211_set_tx_key(struct ieee80211_key *key) -+{ -+ return _ieee80211_set_tx_key(key, false); -+} -+ - static void ieee80211_pairwise_rekey(struct ieee80211_key *old, - struct ieee80211_key *new) - { -@@ -441,11 +448,8 @@ static int ieee80211_key_replace(struct - if (pairwise) { - rcu_assign_pointer(sta->ptk[idx], new); - if (new && -- !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX)) { -- sta->ptk_idx = idx; -- clear_sta_flag(sta, WLAN_STA_BLOCK_BA); -- ieee80211_check_fast_xmit(sta); -- } -+ !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX)) -+ _ieee80211_set_tx_key(new, true); - } else { - rcu_assign_pointer(sta->gtk[idx], new); - } ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -98,6 +98,7 @@ enum ieee80211_sta_info_flags { - WLAN_STA_MPSP_OWNER, - WLAN_STA_MPSP_RECIPIENT, - WLAN_STA_PS_DELIVER, -+ WLAN_STA_USES_ENCRYPTION, - - NUM_WLAN_STA_FLAGS, - }; ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -590,10 +590,13 @@ ieee80211_tx_h_select_key(struct ieee802 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; - -- if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) -+ if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) { - tx->key = NULL; -- else if (tx->sta && -- (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx]))) -+ return TX_CONTINUE; -+ } -+ -+ if (tx->sta && -+ (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx]))) - tx->key = key; - else if (ieee80211_is_group_privacy_action(tx->skb) && - (key = rcu_dereference(tx->sdata->default_multicast_key))) -@@ -654,6 +657,9 @@ ieee80211_tx_h_select_key(struct ieee802 - if (!skip_hw && tx->key && - tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) - info->control.hw_key = &tx->key->conf; -+ } else if (!ieee80211_is_mgmt(hdr->frame_control) && tx->sta && -+ test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) { -+ return TX_DROP; - } - - return TX_CONTINUE; diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index a32f1b8e4d..ca028dd833 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -129,7 +129,7 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -630,6 +630,7 @@ const struct nla_policy nl80211_policy[N +@@ -628,6 +628,7 @@ const struct nla_policy nl80211_policy[N .len = SAE_PASSWORD_MAX_LEN }, [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG }, [NL80211_ATTR_HE_OBSS_PD] = NLA_POLICY_NESTED(he_obss_pd_policy), @@ -137,7 +137,7 @@ }; /* policy for the key attributes */ -@@ -2994,6 +2995,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -2992,6 +2993,20 @@ static int nl80211_set_wiphy(struct sk_b if (result) return result; } From 9ca21dc7d59e2e0c7f97e440e71ea93c5275219b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 13 Mar 2020 14:26:51 +0100 Subject: [PATCH 09/21] mac80211: Update to version 5.5.19 This updates the mac80211 backport. The removed patches are already integrated in the upstream version. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +- .../patches/ath/120-owl-loader-compat.patch | 6 +- .../patches/ath/403-world_regd_fixup.patch | 34 +- ...21-ath10k_init_devices_synchronously.patch | 2 +- .../ath/930-ath10k_add_tpt_led_trigger.patch | 4 +- ...-of-peer_bw_rxnss_override-parameter.patch | 10 +- ...dling-for-VHT160-in-recent-firmwares.patch | 4 +- ...rolling-support-for-various-chipsets.patch | 40 +- ...75-ath10k-use-tpt-trigger-by-default.patch | 4 +- ...980-ath10k-fix-max-antenna-gain-unit.patch | 6 +- ...-power-reduction-for-US-regulatory-d.patch | 8 +- ...on-t-WARN-when-there-are-no-requests.patch | 28 - ...suspend-resume-when-power-is-cut-off.patch | 109 --- ...set-but-not-used-variable-mpnum-nsp-.patch | 58 -- ...rors-when-setting-roaming-parameters.patch | 2 +- ...B-condition-when-setting-interface-c.patch | 10 +- ...-mbss-in-vif-if-firmware-does-not-su.patch | 4 +- ...lify-building-interface-combinations.patch | 6 +- ...add-initial-support-for-monitor-mode.patch | 16 +- ...62-brcmfmac-Disable-power-management.patch | 2 +- .../mac80211/patches/brcm/998-survey.patch | 8 +- .../patches/build/015-ipw200-mtu.patch | 4 +- .../patches/build/050-lib80211_option.patch | 4 +- .../subsys/140-tweak-TSQ-setting.patch | 2 +- .../subsys/150-disable_addr_notifier.patch | 6 +- ...ate-debugfs-only-after-cfg80211-init.patch | 248 +++++++ .../300-mac80211-optimize-skb-resizing.patch | 14 +- ...l-remove-divisions-in-tx-status-path.patch | 61 -- ...l_ht-replace-rate-stats-ewma-with-a-.patch | 235 ------ ...l_ht-rename-prob_ewma-to-prob_avg-us.patch | 424 ----------- ...domize-BA-session-dialog-token-alloc.patch | 2 +- ...80211-fix-tx-status-for-no-ack-cases.patch | 16 +- ...ore-skb-ack-code-to-its-own-function.patch | 78 -- ...the-size-of-ack_frame_id-to-make-roo.patch | 67 -- ...new-sta_info-getter-by-sta-vif-addrs.patch | 78 -- ...t-airtime-calculation-code-from-mt76.patch | 690 ------------------ ...lement-Airtime-based-Queue-Limit-AQL.patch | 446 ----------- ...time-based-Queue-Limits-AQL-on-packe.patch | 146 ---- ...-Fix-an-off-by-one-in-ieee80211_calc.patch | 31 - ...Turn-AQL-into-an-NL80211_EXT_FEATURE.patch | 253 ------- ...80211-use-more-bits-for-ack_frame_id.patch | 70 -- .../500-mac80211_configure_antenna_gain.patch | 22 +- .../utils/iw/patches/001-nl80211_h_sync.patch | 55 +- 43 files changed, 420 insertions(+), 2899 deletions(-) delete mode 100644 package/kernel/mac80211/patches/brcm/101-v5.5-0001-brcmfmac-don-t-WARN-when-there-are-no-requests.patch delete mode 100644 package/kernel/mac80211/patches/brcm/101-v5.5-0002-brcmfmac-fix-suspend-resume-when-power-is-cut-off.patch delete mode 100644 package/kernel/mac80211/patches/brcm/103-v5.5-brcmfmac-remove-set-but-not-used-variable-mpnum-nsp-.patch create mode 100644 package/kernel/mac80211/patches/subsys/250-mac80211-populate-debugfs-only-after-cfg80211-init.patch delete mode 100644 package/kernel/mac80211/patches/subsys/301-mac80211-minstrel-remove-divisions-in-tx-status-path.patch delete mode 100644 package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch delete mode 100644 package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch delete mode 100644 package/kernel/mac80211/patches/subsys/306-mac80211-move-store-skb-ack-code-to-its-own-function.patch delete mode 100644 package/kernel/mac80211/patches/subsys/307-mac80211-Shrink-the-size-of-ack_frame_id-to-make-roo.patch delete mode 100644 package/kernel/mac80211/patches/subsys/308-mac80211-Add-new-sta_info-getter-by-sta-vif-addrs.patch delete mode 100644 package/kernel/mac80211/patches/subsys/309-mac80211-Import-airtime-calculation-code-from-mt76.patch delete mode 100644 package/kernel/mac80211/patches/subsys/310-mac80211-Implement-Airtime-based-Queue-Limit-AQL.patch delete mode 100644 package/kernel/mac80211/patches/subsys/311-mac80211-Use-Airtime-based-Queue-Limits-AQL-on-packe.patch delete mode 100644 package/kernel/mac80211/patches/subsys/312-mac80211-airtime-Fix-an-off-by-one-in-ieee80211_calc.patch delete mode 100644 package/kernel/mac80211/patches/subsys/313-mac80211-Turn-AQL-into-an-NL80211_EXT_FEATURE.patch delete mode 100644 package/kernel/mac80211/patches/subsys/353-mac80211-use-more-bits-for-ack_frame_id.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 901c08b0de..aedaac4d32 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.4.36-1 +PKG_VERSION:=5.5.19-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.4.36/ -PKG_HASH:=5b39734986fba3b9c24c521d0499a2dc9cb17267bb58c02d9a520205add2d16b +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.5.19/ +PKG_HASH:=9dd9153df6082eaa079144193a3fab79d200942e1a2a1a80e032c9667b7b92a6 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch b/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch index 155f4fc365..d1d6c9e2e3 100644 --- a/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch +++ b/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch @@ -11,7 +11,7 @@ Signed-off-by: Christian Lamparter --- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c +++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c -@@ -104,6 +104,7 @@ static void owl_fw_cb(const struct firmw +@@ -103,6 +103,7 @@ static void owl_fw_cb(const struct firmw { struct pci_dev *pdev = (struct pci_dev *)context; struct owl_ctx *ctx = (struct owl_ctx *)pci_get_drvdata(pdev); @@ -19,7 +19,7 @@ Signed-off-by: Christian Lamparter struct pci_bus *bus; complete(&ctx->eeprom_load); -@@ -119,6 +120,16 @@ static void owl_fw_cb(const struct firmw +@@ -118,6 +119,16 @@ static void owl_fw_cb(const struct firmw goto release; } @@ -36,7 +36,7 @@ Signed-off-by: Christian Lamparter if (ath9k_pci_fixup(pdev, (const u16 *)fw->data, fw->size)) goto release; -@@ -138,8 +149,14 @@ release: +@@ -137,8 +148,14 @@ release: static const char *owl_get_eeprom_name(struct pci_dev *pdev) { struct device *dev = &pdev->dev; diff --git a/package/kernel/mac80211/patches/ath/403-world_regd_fixup.patch b/package/kernel/mac80211/patches/ath/403-world_regd_fixup.patch index 2043083158..ed616b7532 100644 --- a/package/kernel/mac80211/patches/ath/403-world_regd_fixup.patch +++ b/package/kernel/mac80211/patches/ath/403-world_regd_fixup.patch @@ -4,15 +4,15 @@ NL80211_RRF_NO_OFDM) /* We allow IBSS on these on a case by case basis by regulatory domain */ --#define ATH9K_5GHZ_5150_5350 REG_RULE(5150-10, 5350+10, 80, 0, 30,\ -+#define ATH9K_5GHZ_5150_5350 REG_RULE(5150-10, 5240+10, 80, 0, 30, 0),\ +-#define ATH_5GHZ_5150_5350 REG_RULE(5150-10, 5350+10, 80, 0, 30,\ ++#define ATH_5GHZ_5150_5350 REG_RULE(5150-10, 5240+10, 80, 0, 30, 0),\ + REG_RULE(5260-10, 5350+10, 80, 0, 30,\ NL80211_RRF_NO_IR) - #define ATH9K_5GHZ_5470_5850 REG_RULE(5470-10, 5850+10, 80, 0, 30,\ + #define ATH_5GHZ_5470_5850 REG_RULE(5470-10, 5850+10, 80, 0, 30,\ NL80211_RRF_NO_IR) @@ -62,57 +63,56 @@ static struct reg_dmn_pair_mapping *ath_ - #define ATH9K_5GHZ_NO_MIDBAND ATH9K_5GHZ_5150_5350, \ - ATH9K_5GHZ_5725_5850 + #define ATH_5GHZ_NO_MIDBAND ATH_5GHZ_5150_5350, \ + ATH_5GHZ_5725_5850 +#define REGD_RULES(...) \ + .reg_rules = { __VA_ARGS__ }, \ @@ -25,8 +25,8 @@ .alpha2 = "99", - .reg_rules = { + REGD_RULES( - ATH9K_2GHZ_ALL, - ATH9K_5GHZ_ALL, + ATH_2GHZ_ALL, + ATH_5GHZ_ALL, - } + ) }; @@ -37,9 +37,9 @@ .alpha2 = "99", - .reg_rules = { + REGD_RULES( - ATH9K_2GHZ_CH01_11, - ATH9K_2GHZ_CH12_13, - ATH9K_5GHZ_NO_MIDBAND, + ATH_2GHZ_CH01_11, + ATH_2GHZ_CH12_13, + ATH_5GHZ_NO_MIDBAND, - } + ) }; @@ -50,8 +50,8 @@ .alpha2 = "99", - .reg_rules = { + REGD_RULES( - ATH9K_2GHZ_CH01_11, - ATH9K_5GHZ_NO_MIDBAND, + ATH_2GHZ_CH01_11, + ATH_5GHZ_NO_MIDBAND, - } + ) }; @@ -62,8 +62,8 @@ .alpha2 = "99", - .reg_rules = { + REGD_RULES( - ATH9K_2GHZ_CH01_11, - ATH9K_5GHZ_ALL, + ATH_2GHZ_CH01_11, + ATH_5GHZ_ALL, - } + ) }; @@ -74,9 +74,9 @@ .alpha2 = "99", - .reg_rules = { + REGD_RULES( - ATH9K_2GHZ_CH01_11, - ATH9K_2GHZ_CH12_13, - ATH9K_5GHZ_ALL, + ATH_2GHZ_CH01_11, + ATH_2GHZ_CH12_13, + ATH_5GHZ_ALL, - } + ) }; diff --git a/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch index 69c29f15ee..728c86effb 100644 --- a/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3074,6 +3074,16 @@ int ath10k_core_register(struct ath10k * +@@ -3105,6 +3105,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch index 5a79c33702..6fe551f9d5 100644 --- a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -8673,6 +8673,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -8761,6 +8761,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -9000,6 +9015,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -9088,6 +9103,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch b/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch index c99ba55955..4d51205b5e 100644 --- a/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch +++ b/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch @@ -23,7 +23,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling 3 files changed, 52 insertions(+), 23 deletions(-) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -2515,7 +2515,7 @@ static void ath10k_peer_assoc_h_vht(stru +@@ -2516,7 +2516,7 @@ static void ath10k_peer_assoc_h_vht(stru const u16 *vht_mcs_mask; u8 ampdu_factor; u8 max_nss, vht_mcs; @@ -32,7 +32,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) return; -@@ -2575,23 +2575,45 @@ static void ath10k_peer_assoc_h_vht(stru +@@ -2576,23 +2576,45 @@ static void ath10k_peer_assoc_h_vht(stru __le16_to_cpu(vht_cap->vht_mcs.tx_highest); arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); @@ -92,7 +92,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling } static void ath10k_peer_assoc_h_qos(struct ath10k *ar, -@@ -2743,9 +2765,9 @@ static int ath10k_peer_assoc_prepare(str +@@ -2744,9 +2766,9 @@ static int ath10k_peer_assoc_prepare(str ath10k_peer_assoc_h_crypto(ar, vif, sta, arg); ath10k_peer_assoc_h_rates(ar, vif, sta, arg); ath10k_peer_assoc_h_ht(ar, vif, sta, arg); @@ -105,7 +105,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling } --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -7552,12 +7552,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a +@@ -7601,12 +7601,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf; ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg); @@ -121,7 +121,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling static int --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h -@@ -6478,7 +6478,19 @@ struct wmi_10_2_peer_assoc_complete_cmd +@@ -6501,7 +6501,19 @@ struct wmi_10_2_peer_assoc_complete_cmd __le32 info0; /* WMI_PEER_ASSOC_INFO0_ */ } __packed; diff --git a/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch b/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch index d0e293c6dd..d6a1ef0849 100644 --- a/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch +++ b/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch @@ -13,7 +13,7 @@ v2: fix trailing whitespace issue and fix some typos within the commit note 2 files changed, 8 insertions(+), 10 deletions(-) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -4575,13 +4575,6 @@ static struct ieee80211_sta_vht_cap ath1 +@@ -4576,13 +4576,6 @@ static struct ieee80211_sta_vht_cap ath1 vht_cap.cap |= val; } @@ -29,7 +29,7 @@ v2: fix trailing whitespace issue and fix some typos within the commit note if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -1700,13 +1700,18 @@ void ath10k_wmi_put_wmi_channel(struct w +@@ -1713,13 +1713,18 @@ void ath10k_wmi_put_wmi_channel(struct w flags |= WMI_CHAN_FLAG_HT40_PLUS; if (arg->chan_radar) flags |= WMI_CHAN_FLAG_DFS; diff --git a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index 70af3892d7..d72d515ad3 100644 --- a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -124,7 +124,7 @@ v13: WCN36XX= --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -24,6 +24,7 @@ +@@ -25,6 +25,7 @@ #include "testmode.h" #include "wmi-ops.h" #include "coredump.h" @@ -132,7 +132,7 @@ v13: unsigned int ath10k_debug_mask; EXPORT_SYMBOL(ath10k_debug_mask); -@@ -60,6 +61,7 @@ static const struct ath10k_hw_params ath +@@ -61,6 +62,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA988X_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca988x hw2.0", @@ -140,7 +140,7 @@ v13: .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -130,6 +132,7 @@ static const struct ath10k_hw_params ath +@@ -131,6 +133,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9887_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9887 hw1.0", @@ -148,7 +148,7 @@ v13: .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -337,6 +340,7 @@ static const struct ath10k_hw_params ath +@@ -338,6 +341,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA99X0_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca99x0 hw2.0", @@ -156,7 +156,7 @@ v13: .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .otp_exe_param = 0x00000700, -@@ -378,6 +382,7 @@ static const struct ath10k_hw_params ath +@@ -379,6 +383,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9984_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9984/qca9994 hw1.0", @@ -164,7 +164,7 @@ v13: .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -426,6 +431,7 @@ static const struct ath10k_hw_params ath +@@ -427,6 +432,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9888_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9888 hw2.0", @@ -172,7 +172,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -2791,6 +2797,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -2822,6 +2828,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3047,9 +3057,18 @@ static void ath10k_core_register_work(st +@@ -3078,9 +3088,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -202,7 +202,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3095,6 +3114,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3126,6 +3145,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -221,7 +221,7 @@ v13: #include "htt.h" #include "htc.h" -@@ -1170,6 +1171,13 @@ struct ath10k { +@@ -1179,6 +1180,13 @@ struct ath10k { } testmode; struct { @@ -237,7 +237,7 @@ v13: u32 fw_warm_reset_counter; --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h -@@ -514,6 +514,7 @@ struct ath10k_hw_params { +@@ -517,6 +517,7 @@ struct ath10k_hw_params { const char *name; u32 patch_load_addr; int uart_pin; @@ -397,7 +397,7 @@ v13: +#endif /* _LEDS_H_ */ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -23,6 +23,7 @@ +@@ -24,6 +24,7 @@ #include "wmi-tlv.h" #include "wmi-ops.h" #include "wow.h" @@ -456,7 +456,7 @@ v13: { --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c -@@ -4367,6 +4367,8 @@ static const struct wmi_ops wmi_tlv_ops +@@ -4444,6 +4444,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, @@ -467,7 +467,7 @@ v13: static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -7372,6 +7372,49 @@ ath10k_wmi_op_gen_peer_set_param(struct +@@ -7421,6 +7421,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -517,7 +517,7 @@ v13: static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -9029,6 +9072,9 @@ static const struct wmi_ops wmi_ops = { +@@ -9078,6 +9121,9 @@ static const struct wmi_ops wmi_ops = { .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -527,7 +527,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9099,6 +9145,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -9148,6 +9194,8 @@ static const struct wmi_ops wmi_10_1_ops .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -536,7 +536,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9171,6 +9219,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -9220,6 +9268,8 @@ static const struct wmi_ops wmi_10_2_ops .gen_delba_send = ath10k_wmi_op_gen_delba_send, .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, @@ -545,7 +545,7 @@ v13: /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -9242,6 +9292,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -9291,6 +9341,8 @@ static const struct wmi_ops wmi_10_2_4_o ath10k_wmi_op_gen_pdev_enable_adaptive_cca, .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, @@ -554,7 +554,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9322,6 +9374,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -9371,6 +9423,8 @@ static const struct wmi_ops wmi_10_4_ops .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, .gen_echo = ath10k_wmi_op_gen_echo, .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, @@ -565,7 +565,7 @@ v13: int ath10k_wmi_attach(struct ath10k *ar) --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h -@@ -3005,6 +3005,41 @@ enum wmi_10_4_feature_mask { +@@ -3007,6 +3007,41 @@ enum wmi_10_4_feature_mask { }; diff --git a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch index 0763d159e6..3973dc8cb3 100644 --- a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch @@ -16,7 +16,7 @@ Signed-off-by: Mathias Kresin --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -1219,6 +1219,10 @@ struct ath10k { +@@ -1228,6 +1228,10 @@ struct ath10k { struct ath10k_bus_params bus_param; struct completion peer_delete_done; @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -9032,7 +9032,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -9120,7 +9120,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch b/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch index f60163f941..149585b050 100644 --- a/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch +++ b/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch @@ -20,7 +20,7 @@ Forwarded: https://patchwork.kernel.org/patch/10986723/ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -1041,7 +1041,7 @@ static int ath10k_monitor_vdev_start(str +@@ -1042,7 +1042,7 @@ static int ath10k_monitor_vdev_start(str arg.channel.min_power = 0; arg.channel.max_power = channel->max_power * 2; arg.channel.max_reg_power = channel->max_reg_power * 2; @@ -29,7 +29,7 @@ Forwarded: https://patchwork.kernel.org/patch/10986723/ reinit_completion(&ar->vdev_setup_done); reinit_completion(&ar->vdev_delete_done); -@@ -1487,7 +1487,7 @@ static int ath10k_vdev_start_restart(str +@@ -1488,7 +1488,7 @@ static int ath10k_vdev_start_restart(str arg.channel.min_power = 0; arg.channel.max_power = chandef->chan->max_power * 2; arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; @@ -38,7 +38,7 @@ Forwarded: https://patchwork.kernel.org/patch/10986723/ if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; -@@ -3168,7 +3168,7 @@ static int ath10k_update_channel_list(st +@@ -3169,7 +3169,7 @@ static int ath10k_update_channel_list(st ch->min_power = 0; ch->max_power = channel->max_power * 2; ch->max_reg_power = channel->max_reg_power * 2; diff --git a/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch b/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch index 9fbb254127..36948e546f 100644 --- a/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch +++ b/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch @@ -28,7 +28,7 @@ Forwarded: no --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -1009,6 +1009,40 @@ static inline int ath10k_vdev_setup_sync +@@ -1010,6 +1010,40 @@ static inline int ath10k_vdev_setup_sync return ar->last_wmi_vdev_start_status; } @@ -69,7 +69,7 @@ Forwarded: no static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) { struct cfg80211_chan_def *chandef = NULL; -@@ -1041,7 +1075,8 @@ static int ath10k_monitor_vdev_start(str +@@ -1042,7 +1076,8 @@ static int ath10k_monitor_vdev_start(str arg.channel.min_power = 0; arg.channel.max_power = channel->max_power * 2; arg.channel.max_reg_power = channel->max_reg_power * 2; @@ -79,7 +79,7 @@ Forwarded: no reinit_completion(&ar->vdev_setup_done); reinit_completion(&ar->vdev_delete_done); -@@ -1487,7 +1522,8 @@ static int ath10k_vdev_start_restart(str +@@ -1488,7 +1523,8 @@ static int ath10k_vdev_start_restart(str arg.channel.min_power = 0; arg.channel.max_power = chandef->chan->max_power * 2; arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; @@ -89,7 +89,7 @@ Forwarded: no if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; -@@ -3168,7 +3204,8 @@ static int ath10k_update_channel_list(st +@@ -3169,7 +3205,8 @@ static int ath10k_update_channel_list(st ch->min_power = 0; ch->max_power = channel->max_power * 2; ch->max_reg_power = channel->max_reg_power * 2; diff --git a/package/kernel/mac80211/patches/brcm/101-v5.5-0001-brcmfmac-don-t-WARN-when-there-are-no-requests.patch b/package/kernel/mac80211/patches/brcm/101-v5.5-0001-brcmfmac-don-t-WARN-when-there-are-no-requests.patch deleted file mode 100644 index a1311e0a49..0000000000 --- a/package/kernel/mac80211/patches/brcm/101-v5.5-0001-brcmfmac-don-t-WARN-when-there-are-no-requests.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 1524cbf3621576c639405e7aabeac415f9617c8d Mon Sep 17 00:00:00 2001 -From: Adrian Ratiu -Date: Wed, 25 Sep 2019 16:44:57 +0300 -Subject: [PATCH] brcmfmac: don't WARN when there are no requests - -When n_reqs == 0 there is nothing to do so it doesn't make sense to -search for requests and issue a warning because none is found. - -Signed-off-by: Martyn Welch -Signed-off-by: Adrian Ratiu -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c -@@ -57,6 +57,10 @@ static int brcmf_pno_remove_request(stru - - mutex_lock(&pi->req_lock); - -+ /* Nothing to do if we have no requests */ -+ if (pi->n_reqs == 0) -+ goto done; -+ - /* find request */ - for (i = 0; i < pi->n_reqs; i++) { - if (pi->reqs[i]->reqid == reqid) diff --git a/package/kernel/mac80211/patches/brcm/101-v5.5-0002-brcmfmac-fix-suspend-resume-when-power-is-cut-off.patch b/package/kernel/mac80211/patches/brcm/101-v5.5-0002-brcmfmac-fix-suspend-resume-when-power-is-cut-off.patch deleted file mode 100644 index eafc96b901..0000000000 --- a/package/kernel/mac80211/patches/brcm/101-v5.5-0002-brcmfmac-fix-suspend-resume-when-power-is-cut-off.patch +++ /dev/null @@ -1,109 +0,0 @@ -From e0ae4bac22effbd644add326f658a3aeeb8d45ee Mon Sep 17 00:00:00 2001 -From: Adrian Ratiu -Date: Wed, 25 Sep 2019 16:44:58 +0300 -Subject: [PATCH] brcmfmac: fix suspend/resume when power is cut off - -brcmfmac assumed the wifi device always remains powered on and thus -hardcoded the MMC_PM_KEEP_POWER flag expecting the wifi device to -remain on even during suspend/resume cycles. - -This is not always the case, some appliances cut power to everything -connected via SDIO for efficiency reasons and this leads to wifi not -being usable after coming out of suspend because the device was not -correctly reinitialized. - -So we check for the keep_power capability and if it's not present then -we remove the device and probe it again during resume to mirror what's -happening in hardware and ensure correct reinitialization in the case -when MMC_PM_KEEP_POWER is not supported. - -Suggested-by: Gustavo Padovan -Signed-off-by: Adrian Ratiu -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/bcmsdh.c | 53 ++++++++++++++----- - 1 file changed, 39 insertions(+), 14 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -1108,7 +1108,8 @@ static int brcmf_ops_sdio_suspend(struct - struct sdio_func *func; - struct brcmf_bus *bus_if; - struct brcmf_sdio_dev *sdiodev; -- mmc_pm_flag_t sdio_flags; -+ mmc_pm_flag_t pm_caps, sdio_flags; -+ int ret = 0; - - func = container_of(dev, struct sdio_func, dev); - brcmf_dbg(SDIO, "Enter: F%d\n", func->num); -@@ -1119,19 +1120,33 @@ static int brcmf_ops_sdio_suspend(struct - bus_if = dev_get_drvdata(dev); - sdiodev = bus_if->bus_priv.sdio; - -- brcmf_sdiod_freezer_on(sdiodev); -- brcmf_sdio_wd_timer(sdiodev->bus, 0); -+ pm_caps = sdio_get_host_pm_caps(func); - -- sdio_flags = MMC_PM_KEEP_POWER; -- if (sdiodev->wowl_enabled) { -- if (sdiodev->settings->bus.sdio.oob_irq_supported) -- enable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr); -- else -- sdio_flags |= MMC_PM_WAKE_SDIO_IRQ; -+ if (pm_caps & MMC_PM_KEEP_POWER) { -+ /* preserve card power during suspend */ -+ brcmf_sdiod_freezer_on(sdiodev); -+ brcmf_sdio_wd_timer(sdiodev->bus, 0); -+ -+ sdio_flags = MMC_PM_KEEP_POWER; -+ if (sdiodev->wowl_enabled) { -+ if (sdiodev->settings->bus.sdio.oob_irq_supported) -+ enable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr); -+ else -+ sdio_flags |= MMC_PM_WAKE_SDIO_IRQ; -+ } -+ -+ if (sdio_set_host_pm_flags(sdiodev->func1, sdio_flags)) -+ brcmf_err("Failed to set pm_flags %x\n", sdio_flags); -+ -+ } else { -+ /* power will be cut so remove device, probe again in resume */ -+ brcmf_sdiod_intr_unregister(sdiodev); -+ ret = brcmf_sdiod_remove(sdiodev); -+ if (ret) -+ brcmf_err("Failed to remove device on suspend\n"); - } -- if (sdio_set_host_pm_flags(sdiodev->func1, sdio_flags)) -- brcmf_err("Failed to set pm_flags %x\n", sdio_flags); -- return 0; -+ -+ return ret; - } - - static int brcmf_ops_sdio_resume(struct device *dev) -@@ -1139,13 +1154,23 @@ static int brcmf_ops_sdio_resume(struct - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - struct sdio_func *func = container_of(dev, struct sdio_func, dev); -+ mmc_pm_flag_t pm_caps = sdio_get_host_pm_caps(func); -+ int ret = 0; - - brcmf_dbg(SDIO, "Enter: F%d\n", func->num); - if (func->num != 2) - return 0; - -- brcmf_sdiod_freezer_off(sdiodev); -- return 0; -+ if (!(pm_caps & MMC_PM_KEEP_POWER)) { -+ /* bus was powered off and device removed, probe again */ -+ ret = brcmf_sdiod_probe(sdiodev); -+ if (ret) -+ brcmf_err("Failed to probe device on resume\n"); -+ } else { -+ brcmf_sdiod_freezer_off(sdiodev); -+ } -+ -+ return ret; - } - - static const struct dev_pm_ops brcmf_sdio_pm_ops = { diff --git a/package/kernel/mac80211/patches/brcm/103-v5.5-brcmfmac-remove-set-but-not-used-variable-mpnum-nsp-.patch b/package/kernel/mac80211/patches/brcm/103-v5.5-brcmfmac-remove-set-but-not-used-variable-mpnum-nsp-.patch deleted file mode 100644 index 25b3ceb959..0000000000 --- a/package/kernel/mac80211/patches/brcm/103-v5.5-brcmfmac-remove-set-but-not-used-variable-mpnum-nsp-.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 7af496b9eb0433bc4cb478c9a46f85509cdb5541 Mon Sep 17 00:00:00 2001 -From: zhengbin -Date: Sat, 16 Nov 2019 15:22:47 +0800 -Subject: [PATCH] brcmfmac: remove set but not used variable - 'mpnum','nsp','nmp' - -Fixes gcc '-Wunused-but-set-variable' warning: - -drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function brcmf_chip_dmp_get_regaddr: -drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:790:5: warning: variable mpnum set but not used [-Wunused-but-set-variable] -drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function brcmf_chip_dmp_erom_scan: -drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:866:10: warning: variable nsp set but not used [-Wunused-but-set-variable] -drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function brcmf_chip_dmp_erom_scan: -drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:866:5: warning: variable nmp set but not used [-Wunused-but-set-variable] - -Reported-by: Hulk Robot -Signed-off-by: zhengbin -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -@@ -778,7 +778,6 @@ static int brcmf_chip_dmp_get_regaddr(st - { - u8 desc; - u32 val, szdesc; -- u8 mpnum = 0; - u8 stype, sztype, wraptype; - - *regbase = 0; -@@ -786,7 +785,6 @@ static int brcmf_chip_dmp_get_regaddr(st - - val = brcmf_chip_dmp_get_desc(ci, eromaddr, &desc); - if (desc == DMP_DESC_MASTER_PORT) { -- mpnum = (val & DMP_MASTER_PORT_NUM) >> DMP_MASTER_PORT_NUM_S; - wraptype = DMP_SLAVE_TYPE_MWRAP; - } else if (desc == DMP_DESC_ADDRESS) { - /* revert erom address */ -@@ -854,7 +852,7 @@ int brcmf_chip_dmp_erom_scan(struct brcm - u8 desc_type = 0; - u32 val; - u16 id; -- u8 nmp, nsp, nmw, nsw, rev; -+ u8 nmw, nsw, rev; - u32 base, wrap; - int err; - -@@ -880,8 +878,6 @@ int brcmf_chip_dmp_erom_scan(struct brcm - return -EFAULT; - - /* only look at cores with master port(s) */ -- nmp = (val & DMP_COMP_NUM_MPORT) >> DMP_COMP_NUM_MPORT_S; -- nsp = (val & DMP_COMP_NUM_SPORT) >> DMP_COMP_NUM_SPORT_S; - nmw = (val & DMP_COMP_NUM_MWRAP) >> DMP_COMP_NUM_MWRAP_S; - nsw = (val & DMP_COMP_NUM_SWRAP) >> DMP_COMP_NUM_SWRAP_S; - rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S; diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0004-brcmfmac-make-errors-when-setting-roaming-parameters.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0004-brcmfmac-make-errors-when-setting-roaming-parameters.patch index cd7ccb0439..76138fbc68 100644 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0004-brcmfmac-make-errors-when-setting-roaming-parameters.patch +++ b/package/kernel/mac80211/patches/brcm/114-v5.6-0004-brcmfmac-make-errors-when-setting-roaming-parameters.patch @@ -16,7 +16,7 @@ Signed-off-by: Kalle Valo --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -5944,19 +5944,17 @@ static s32 brcmf_dongle_roam(struct brcm +@@ -6012,19 +6012,17 @@ static s32 brcmf_dongle_roam(struct brcm roamtrigger[1] = cpu_to_le32(BRCM_BAND_ALL); err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER, (void *)roamtrigger, sizeof(roamtrigger)); diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0006-brcmfmac-add-RSDB-condition-when-setting-interface-c.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0006-brcmfmac-add-RSDB-condition-when-setting-interface-c.patch index d00c59c07c..09059defe5 100644 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0006-brcmfmac-add-RSDB-condition-when-setting-interface-c.patch +++ b/package/kernel/mac80211/patches/brcm/114-v5.6-0006-brcmfmac-add-RSDB-condition-when-setting-interface-c.patch @@ -20,7 +20,7 @@ Signed-off-by: Kalle Valo --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6452,6 +6452,9 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = +@@ -6520,6 +6520,9 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = * #STA <= 1, #AP <= 1, channels = 1, 2 total * #AP <= 4, matching BI, channels = 1, 4 total * @@ -30,7 +30,7 @@ Signed-off-by: Kalle Valo * p2p, no mchan, and mbss: * * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total -@@ -6463,6 +6466,10 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = +@@ -6531,6 +6534,10 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total * #AP <= 4, matching BI, channels = 1, 4 total @@ -41,7 +41,7 @@ Signed-off-by: Kalle Valo */ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) { -@@ -6470,13 +6477,14 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6538,13 +6545,14 @@ static int brcmf_setup_ifmodes(struct wi struct ieee80211_iface_limit *c0_limits = NULL; struct ieee80211_iface_limit *p2p_limits = NULL; struct ieee80211_iface_limit *mbss_limits = NULL; @@ -58,7 +58,7 @@ Signed-off-by: Kalle Valo combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL); if (!combo) goto err; -@@ -6487,16 +6495,36 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6555,16 +6563,36 @@ static int brcmf_setup_ifmodes(struct wi c = 0; i = 0; @@ -99,7 +99,7 @@ Signed-off-by: Kalle Valo wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) | BIT(NL80211_IFTYPE_P2P_DEVICE); -@@ -6505,16 +6533,26 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6573,16 +6601,26 @@ static int brcmf_setup_ifmodes(struct wi c0_limits[i].max = 1; c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO); diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0007-brcmfmac-not-set-mbss-in-vif-if-firmware-does-not-su.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0007-brcmfmac-not-set-mbss-in-vif-if-firmware-does-not-su.patch index 9c211a68d0..1870088bf6 100644 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0007-brcmfmac-not-set-mbss-in-vif-if-firmware-does-not-su.patch +++ b/package/kernel/mac80211/patches/brcm/114-v5.6-0007-brcmfmac-not-set-mbss-in-vif-if-firmware-does-not-su.patch @@ -18,7 +18,7 @@ Signed-off-by: Kalle Valo --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -5301,6 +5301,7 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v +@@ -5363,6 +5363,7 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v struct brcmf_cfg80211_vif *vif_walk; struct brcmf_cfg80211_vif *vif; bool mbss; @@ -26,7 +26,7 @@ Signed-off-by: Kalle Valo brcmf_dbg(TRACE, "allocating virtual interface (size=%zu)\n", sizeof(*vif)); -@@ -5313,7 +5314,8 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v +@@ -5375,7 +5376,8 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v brcmf_init_prof(&vif->profile); diff --git a/package/kernel/mac80211/patches/brcm/119-v5.6-0001-brcmfmac-simplify-building-interface-combinations.patch b/package/kernel/mac80211/patches/brcm/119-v5.6-0001-brcmfmac-simplify-building-interface-combinations.patch index d52a7a1cc0..73fc17aa5a 100644 --- a/package/kernel/mac80211/patches/brcm/119-v5.6-0001-brcmfmac-simplify-building-interface-combinations.patch +++ b/package/kernel/mac80211/patches/brcm/119-v5.6-0001-brcmfmac-simplify-building-interface-combinations.patch @@ -18,7 +18,7 @@ Signed-off-by: Kalle Valo --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6479,12 +6479,13 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6547,12 +6547,13 @@ static int brcmf_setup_ifmodes(struct wi struct ieee80211_iface_limit *c0_limits = NULL; struct ieee80211_iface_limit *p2p_limits = NULL; struct ieee80211_iface_limit *mbss_limits = NULL; @@ -33,7 +33,7 @@ Signed-off-by: Kalle Valo n_combos = 1 + !!(p2p && !rsdb) + !!mbss; combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL); -@@ -6494,6 +6495,10 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6562,6 +6563,10 @@ static int brcmf_setup_ifmodes(struct wi wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); @@ -44,7 +44,7 @@ Signed-off-by: Kalle Valo c = 0; i = 0; -@@ -6505,48 +6510,28 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6573,48 +6578,28 @@ static int brcmf_setup_ifmodes(struct wi c0_limits = kcalloc(2, sizeof(*c0_limits), GFP_KERNEL); if (!c0_limits) goto err; diff --git a/package/kernel/mac80211/patches/brcm/119-v5.6-0002-brcmfmac-add-initial-support-for-monitor-mode.patch b/package/kernel/mac80211/patches/brcm/119-v5.6-0002-brcmfmac-add-initial-support-for-monitor-mode.patch index 08fa1544ec..0682c0b0ea 100644 --- a/package/kernel/mac80211/patches/brcm/119-v5.6-0002-brcmfmac-add-initial-support-for-monitor-mode.patch +++ b/package/kernel/mac80211/patches/brcm/119-v5.6-0002-brcmfmac-add-initial-support-for-monitor-mode.patch @@ -139,7 +139,7 @@ Signed-off-by: Kalle Valo case NL80211_IFTYPE_AP: return brcmf_cfg80211_del_ap_iface(wiphy, wdev); case NL80211_IFTYPE_P2P_CLIENT: -@@ -6479,9 +6558,10 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6547,9 +6626,10 @@ static int brcmf_setup_ifmodes(struct wi struct ieee80211_iface_limit *c0_limits = NULL; struct ieee80211_iface_limit *p2p_limits = NULL; struct ieee80211_iface_limit *mbss_limits = NULL; @@ -152,7 +152,7 @@ Signed-off-by: Kalle Valo mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS); p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P); rsdb = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB); -@@ -6495,6 +6575,8 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6563,6 +6643,8 @@ static int brcmf_setup_ifmodes(struct wi wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); @@ -161,7 +161,7 @@ Signed-off-by: Kalle Valo if (p2p) wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) | -@@ -6502,18 +6584,18 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6570,18 +6652,18 @@ static int brcmf_setup_ifmodes(struct wi c = 0; i = 0; @@ -186,7 +186,7 @@ Signed-off-by: Kalle Valo if (p2p) { c0_limits[i].max = 1; c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE); -@@ -6562,14 +6644,20 @@ static int brcmf_setup_ifmodes(struct wi +@@ -6630,14 +6712,20 @@ static int brcmf_setup_ifmodes(struct wi if (mbss) { c++; i = 0; @@ -312,8 +312,8 @@ Signed-off-by: Kalle Valo { BRCMF_FEAT_MONITOR, "monitor" }, + { BRCMF_FEAT_MONITOR_FLAG, "rtap" }, { BRCMF_FEAT_MONITOR_FMT_RADIOTAP, "rtap" }, - { BRCMF_FEAT_DOT11H, "802.11h" } - }; + { BRCMF_FEAT_DOT11H, "802.11h" }, + { BRCMF_FEAT_SAE, "sae" }, --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h @@ -23,6 +23,7 @@ @@ -324,14 +324,14 @@ Signed-off-by: Kalle Valo * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header * MONITOR_FMT_HW_RX_HDR: firmware provides monitor packets with hw/ucode header * DOT11H: firmware supports 802.11h -@@ -43,6 +44,7 @@ +@@ -44,6 +45,7 @@ BRCMF_FEAT_DEF(GSCAN) \ BRCMF_FEAT_DEF(FWSUP) \ BRCMF_FEAT_DEF(MONITOR) \ + BRCMF_FEAT_DEF(MONITOR_FLAG) \ BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \ BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) \ - BRCMF_FEAT_DEF(DOT11H) + BRCMF_FEAT_DEF(DOT11H) \ --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h @@ -49,6 +49,8 @@ diff --git a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch index 988ece1f5f..905fd4b56e 100644 --- a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2874,6 +2874,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2936,6 +2936,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ diff --git a/package/kernel/mac80211/patches/brcm/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index 3c52cec0b9..b98cb0632c 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2826,6 +2826,63 @@ done: +@@ -2888,6 +2888,63 @@ done: } static int @@ -64,7 +64,7 @@ brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev, int idx, u8 *mac, struct station_info *sinfo) { -@@ -2915,6 +2972,7 @@ static s32 brcmf_inform_single_bss(struc +@@ -2977,6 +3034,7 @@ static s32 brcmf_inform_single_bss(struc struct brcmu_chan ch; u16 channel; u32 freq; @@ -72,7 +72,7 @@ u16 notify_capability; u16 notify_interval; u8 *notify_ie; -@@ -2939,6 +2997,17 @@ static s32 brcmf_inform_single_bss(struc +@@ -3001,6 +3059,17 @@ static s32 brcmf_inform_single_bss(struc band = NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(channel, band); @@ -90,7 +90,7 @@ bss_data.chan = ieee80211_get_channel(wiphy, freq); bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); -@@ -5356,6 +5425,7 @@ static struct cfg80211_ops brcmf_cfg8021 +@@ -5418,6 +5487,7 @@ static struct cfg80211_ops brcmf_cfg8021 .leave_ibss = brcmf_cfg80211_leave_ibss, .get_station = brcmf_cfg80211_get_station, .dump_station = brcmf_cfg80211_dump_station, diff --git a/package/kernel/mac80211/patches/build/015-ipw200-mtu.patch b/package/kernel/mac80211/patches/build/015-ipw200-mtu.patch index 0e51b0ffbc..59d3b62f9d 100644 --- a/package/kernel/mac80211/patches/build/015-ipw200-mtu.patch +++ b/package/kernel/mac80211/patches/build/015-ipw200-mtu.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c -@@ -11482,6 +11482,15 @@ static const struct attribute_group ipw_ +@@ -11479,6 +11479,15 @@ static const struct attribute_group ipw_ .attrs = ipw_sysfs_entries, }; @@ -16,7 +16,7 @@ #ifdef CPTCFG_IPW2200_PROMISCUOUS static int ipw_prom_open(struct net_device *dev) { -@@ -11530,15 +11539,6 @@ static netdev_tx_t ipw_prom_hard_start_x +@@ -11527,15 +11536,6 @@ static netdev_tx_t ipw_prom_hard_start_x return NETDEV_TX_OK; } diff --git a/package/kernel/mac80211/patches/build/050-lib80211_option.patch b/package/kernel/mac80211/patches/build/050-lib80211_option.patch index 1578286c2b..c6174449c6 100644 --- a/package/kernel/mac80211/patches/build/050-lib80211_option.patch +++ b/package/kernel/mac80211/patches/build/050-lib80211_option.patch @@ -1,6 +1,6 @@ --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig -@@ -186,7 +186,7 @@ config CFG80211_WEXT_EXPORT +@@ -187,7 +187,7 @@ config CFG80211_WEXT_EXPORT endif # CFG80211 config LIB80211 @@ -9,7 +9,7 @@ depends on m default n help -@@ -196,18 +196,18 @@ config LIB80211 +@@ -197,18 +197,18 @@ config LIB80211 Drivers should select this themselves if needed. config LIB80211_CRYPT_WEP diff --git a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch index fa12232f1b..3b89013d3c 100644 --- a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch +++ b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4048,6 +4048,12 @@ out: +@@ -4116,6 +4116,12 @@ out: netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev) { diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index 3c5d1d63a8..428c1892d5 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -18,7 +18,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1267,14 +1267,14 @@ int ieee80211_register_hw(struct ieee802 +@@ -1272,14 +1272,14 @@ int ieee80211_register_hw(struct ieee802 rtnl_unlock(); @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1283,13 +1283,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1288,13 +1288,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1317,10 +1317,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1322,10 +1322,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/250-mac80211-populate-debugfs-only-after-cfg80211-init.patch b/package/kernel/mac80211/patches/subsys/250-mac80211-populate-debugfs-only-after-cfg80211-init.patch new file mode 100644 index 0000000000..efe216c530 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/250-mac80211-populate-debugfs-only-after-cfg80211-init.patch @@ -0,0 +1,248 @@ +From 6cb5f3ea4654faf8c28b901266e960b1a4787b26 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Thu, 23 Apr 2020 11:13:49 +0200 +Subject: [PATCH] mac80211: populate debugfs only after cfg80211 init + +When fixing the initialization race, we neglected to account for +the fact that debugfs is initialized in wiphy_register(), and +some debugfs things went missing (or rather were rerooted to the +global debugfs root). + +Fix this by adding debugfs entries only after wiphy_register(). +This requires some changes in the rate control code since it +currently adds debugfs at alloc time, which can no longer be +done after the reordering. + +Reported-by: Jouni Malinen +Reported-by: kernel test robot +Reported-by: Hauke Mehrtens +Reported-by: Felix Fietkau +Cc: stable@vger.kernel.org +Fixes: 52e04b4ce5d0 ("mac80211: fix race in ieee80211_register_hw()") +Signed-off-by: Johannes Berg +Acked-by: Sumit Garg +Link: https://lore.kernel.org/r/20200423111344.0e00d3346f12.Iadc76a03a55093d94391fc672e996a458702875d@changeid +Signed-off-by: Johannes Berg +--- + drivers/net/wireless/intel/iwlegacy/3945-rs.c | 2 +- + drivers/net/wireless/intel/iwlegacy/4965-rs.c | 2 +- + drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 2 +- + drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 2 +- + drivers/net/wireless/realtek/rtlwifi/rc.c | 2 +- + include/net/mac80211.h | 4 +++- + net/mac80211/main.c | 5 ++-- + net/mac80211/rate.c | 15 ++++-------- + net/mac80211/rate.h | 23 +++++++++++++++++++ + net/mac80211/rc80211_minstrel_ht.c | 19 ++++++++++----- + 10 files changed, 51 insertions(+), 25 deletions(-) + +--- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c ++++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c +@@ -374,7 +374,7 @@ out: + } + + static void * +-il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) ++il3945_rs_alloc(struct ieee80211_hw *hw) + { + return hw->priv; + } +--- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c ++++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c +@@ -2474,7 +2474,7 @@ il4965_rs_fill_link_cmd(struct il_priv * + } + + static void * +-il4965_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) ++il4965_rs_alloc(struct ieee80211_hw *hw) + { + return hw->priv; + } +--- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c ++++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c +@@ -3019,7 +3019,7 @@ static void rs_fill_link_cmd(struct iwl_ + cpu_to_le16(priv->lib->bt_params->agg_time_limit); + } + +-static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) ++static void *rs_alloc(struct ieee80211_hw *hw) + { + return hw->priv; + } +--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c +@@ -3665,7 +3665,7 @@ static void rs_fill_lq_cmd(struct iwl_mv + cpu_to_le16(iwl_mvm_coex_agg_time_limit(mvm, sta)); + } + +-static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) ++static void *rs_alloc(struct ieee80211_hw *hw) + { + return hw->priv; + } +--- a/drivers/net/wireless/realtek/rtlwifi/rc.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rc.c +@@ -261,7 +261,7 @@ static void rtl_rate_update(void *ppriv, + { + } + +-static void *rtl_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) ++static void *rtl_rate_alloc(struct ieee80211_hw *hw) + { + struct rtl_priv *rtlpriv = rtl_priv(hw); + return rtlpriv; +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -5969,7 +5969,9 @@ enum rate_control_capabilities { + struct rate_control_ops { + unsigned long capa; + const char *name; +- void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); ++ void *(*alloc)(struct ieee80211_hw *hw); ++ void (*add_debugfs)(struct ieee80211_hw *hw, void *priv, ++ struct dentry *debugfsdir); + void (*free)(void *priv); + + void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -1163,8 +1163,6 @@ int ieee80211_register_hw(struct ieee802 + local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, + IEEE80211_TX_STATUS_HEADROOM); + +- debugfs_hw_add(local); +- + /* + * if the driver doesn't specify a max listen interval we + * use 5 which should be a safe default +@@ -1256,6 +1254,9 @@ int ieee80211_register_hw(struct ieee802 + if (result < 0) + goto fail_wiphy_register; + ++ debugfs_hw_add(local); ++ rate_control_add_debugfs(local); ++ + rtnl_lock(); + + /* add one default STA interface if supported */ +--- a/net/mac80211/rate.c ++++ b/net/mac80211/rate.c +@@ -214,17 +214,16 @@ static ssize_t rcname_read(struct file * + ref->ops->name, len); + } + +-static const struct file_operations rcname_ops = { ++const struct file_operations rcname_ops = { + .read = rcname_read, + .open = simple_open, + .llseek = default_llseek, + }; + #endif + +-static struct rate_control_ref *rate_control_alloc(const char *name, +- struct ieee80211_local *local) ++static struct rate_control_ref * ++rate_control_alloc(const char *name, struct ieee80211_local *local) + { +- struct dentry *debugfsdir = NULL; + struct rate_control_ref *ref; + + ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); +@@ -234,13 +233,7 @@ static struct rate_control_ref *rate_con + if (!ref->ops) + goto free; + +-#ifdef CPTCFG_MAC80211_DEBUGFS +- debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); +- local->debugfs.rcdir = debugfsdir; +- debugfs_create_file("name", 0400, debugfsdir, ref, &rcname_ops); +-#endif +- +- ref->priv = ref->ops->alloc(&local->hw, debugfsdir); ++ ref->priv = ref->ops->alloc(&local->hw); + if (!ref->priv) + goto free; + return ref; +--- a/net/mac80211/rate.h ++++ b/net/mac80211/rate.h +@@ -60,6 +60,29 @@ static inline void rate_control_add_sta_ + #endif + } + ++extern const struct file_operations rcname_ops; ++ ++static inline void rate_control_add_debugfs(struct ieee80211_local *local) ++{ ++#ifdef CPTCFG_MAC80211_DEBUGFS ++ struct dentry *debugfsdir; ++ ++ if (!local->rate_ctrl) ++ return; ++ ++ if (!local->rate_ctrl->ops->add_debugfs) ++ return; ++ ++ debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); ++ local->debugfs.rcdir = debugfsdir; ++ debugfs_create_file("name", 0400, debugfsdir, ++ local->rate_ctrl, &rcname_ops); ++ ++ local->rate_ctrl->ops->add_debugfs(&local->hw, local->rate_ctrl->priv, ++ debugfsdir); ++#endif ++} ++ + void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata); + + /* Get a reference to the rate control algorithm. If `name' is NULL, get the +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -1635,7 +1635,7 @@ minstrel_ht_init_cck_rates(struct minstr + } + + static void * +-minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) ++minstrel_ht_alloc(struct ieee80211_hw *hw) + { + struct minstrel_priv *mp; + +@@ -1673,7 +1673,17 @@ minstrel_ht_alloc(struct ieee80211_hw *h + mp->update_interval = HZ / 10; + mp->new_avg = true; + ++ minstrel_ht_init_cck_rates(mp); ++ ++ return mp; ++} ++ + #ifdef CPTCFG_MAC80211_DEBUGFS ++static void minstrel_ht_add_debugfs(struct ieee80211_hw *hw, void *priv, ++ struct dentry *debugfsdir) ++{ ++ struct minstrel_priv *mp = priv; ++ + mp->fixed_rate_idx = (u32) -1; + debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, + &mp->fixed_rate_idx); +@@ -1681,12 +1691,8 @@ minstrel_ht_alloc(struct ieee80211_hw *h + &mp->sample_switch); + debugfs_create_bool("new_avg", S_IRUGO | S_IWUSR, debugfsdir, + &mp->new_avg); +-#endif +- +- minstrel_ht_init_cck_rates(mp); +- +- return mp; + } ++#endif + + static void + minstrel_ht_free(void *priv) +@@ -1725,6 +1731,7 @@ static const struct rate_control_ops mac + .alloc = minstrel_ht_alloc, + .free = minstrel_ht_free, + #ifdef CPTCFG_MAC80211_DEBUGFS ++ .add_debugfs = minstrel_ht_add_debugfs, + .add_sta_debugfs = minstrel_ht_add_sta_debugfs, + #endif + .get_expected_throughput = minstrel_ht_get_expected_throughput, diff --git a/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch b/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch index dcdb94565d..8c019530d1 100644 --- a/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch +++ b/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch @@ -24,7 +24,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1782,6 +1782,9 @@ int ieee80211_tx_control_port(struct wip +@@ -1786,6 +1786,9 @@ int ieee80211_tx_control_port(struct wip const u8 *dest, __be16 proto, bool unencrypted); int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, const u8 *buf, size_t len); @@ -36,7 +36,7 @@ Signed-off-by: Felix Fietkau void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, --- a/net/mac80211/status.c +++ b/net/mac80211/status.c -@@ -815,6 +815,11 @@ void ieee80211_tx_monitor(struct ieee802 +@@ -829,6 +829,11 @@ void ieee80211_tx_monitor(struct ieee802 struct net_device *prev_dev = NULL; int rtap_len; @@ -50,7 +50,7 @@ Signed-off-by: Felix Fietkau if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -1943,37 +1943,53 @@ static bool ieee80211_tx(struct ieee8021 +@@ -1936,37 +1936,53 @@ static bool ieee80211_tx(struct ieee8021 } /* device xmit handlers */ @@ -123,7 +123,7 @@ Signed-off-by: Felix Fietkau wiphy_debug(local->hw.wiphy, "failed to reallocate TX buffer\n"); return -ENOMEM; -@@ -1989,18 +2005,8 @@ void ieee80211_xmit(struct ieee80211_sub +@@ -1982,18 +1998,8 @@ void ieee80211_xmit(struct ieee80211_sub struct ieee80211_local *local = sdata->local; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr; @@ -143,7 +143,7 @@ Signed-off-by: Felix Fietkau ieee80211_free_txskb(&local->hw, skb); return; } -@@ -2790,29 +2796,13 @@ static struct sk_buff *ieee80211_build_h +@@ -2795,29 +2801,13 @@ static struct sk_buff *ieee80211_build_h } skb_pull(skb, skip_header_bytes); @@ -179,7 +179,7 @@ Signed-off-by: Felix Fietkau } if (encaps_data) -@@ -3427,7 +3417,6 @@ static bool ieee80211_xmit_fast(struct i +@@ -3432,7 +3422,6 @@ static bool ieee80211_xmit_fast(struct i struct ieee80211_local *local = sdata->local; u16 ethertype = (skb->data[12] << 8) | skb->data[13]; int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); @@ -187,7 +187,7 @@ Signed-off-by: Felix Fietkau struct ethhdr eth; struct ieee80211_tx_info *info; struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -@@ -3479,10 +3468,7 @@ static bool ieee80211_xmit_fast(struct i +@@ -3484,10 +3473,7 @@ static bool ieee80211_xmit_fast(struct i * as the may-encrypt argument for the resize to not account for * more room than we already have in 'extra_head' */ diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-minstrel-remove-divisions-in-tx-status-path.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-minstrel-remove-divisions-in-tx-status-path.patch deleted file mode 100644 index 91fb92f1b2..0000000000 --- a/package/kernel/mac80211/patches/subsys/301-mac80211-minstrel-remove-divisions-in-tx-status-path.patch +++ /dev/null @@ -1,61 +0,0 @@ -From: Felix Fietkau -Date: Sat, 28 Sep 2019 15:44:06 +0200 -Subject: [PATCH] mac80211: minstrel: remove divisions in tx status path - -Use a slightly different threshold for downgrading spatial streams to -make it easier to calculate without divisions. -Slightly reduces CPU overhead. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel.c -+++ b/net/mac80211/rc80211_minstrel.c -@@ -289,8 +289,7 @@ minstrel_tx_status(void *priv, struct ie - if (mi->sample_deferred > 0) - mi->sample_deferred--; - -- if (time_after(jiffies, mi->last_stats_update + -- (mp->update_interval * HZ) / 1000)) -+ if (time_after(jiffies, mi->last_stats_update + mp->update_interval)) - minstrel_update_stats(mp, mi); - } - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -970,23 +970,21 @@ minstrel_ht_tx_status(void *priv, struct - */ - rate = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); - if (rate->attempts > 30 && -- MINSTREL_FRAC(rate->success, rate->attempts) < -- MINSTREL_FRAC(20, 100)) { -+ rate->success < rate->attempts / 4) { - minstrel_downgrade_rate(mi, &mi->max_tp_rate[0], true); - update = true; - } - - rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate[1]); - if (rate2->attempts > 30 && -- MINSTREL_FRAC(rate2->success, rate2->attempts) < -- MINSTREL_FRAC(20, 100)) { -+ rate2->success < rate2->attempts / 4) { - minstrel_downgrade_rate(mi, &mi->max_tp_rate[1], false); - update = true; - } - } - - if (time_after(jiffies, mi->last_stats_update + -- (mp->update_interval / 2 * HZ) / 1000)) { -+ mp->update_interval / 2)) { - update = true; - minstrel_ht_update_stats(mp, mi, true); - } -@@ -1666,7 +1664,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h - mp->has_mrr = true; - - mp->hw = hw; -- mp->update_interval = 100; -+ mp->update_interval = HZ / 10; - - minstrel_ht_init_cck_rates(mp); - diff --git a/package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch b/package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch deleted file mode 100644 index 78e8527a5c..0000000000 --- a/package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch +++ /dev/null @@ -1,235 +0,0 @@ -From: Felix Fietkau -Date: Sat, 28 Sep 2019 15:46:06 +0200 -Subject: [PATCH] mac80211: minstrel_ht: replace rate stats ewma with a - better moving average - -Rate success probability usually fluctuates a lot under normal conditions. -With a simple EWMA, noise and fluctuation can be reduced by increasing the -window length, but that comes at the cost of introducing lag on sudden -changes. - -This change replaces the EWMA implementation with a moving average that's -designed to significantly reduce lag while keeping a bigger window size -by being better at filtering out noise. - -It is only slightly more expensive than the simple EWMA and still avoids -divisions in its calculation. - -The algorithm is adapted from an implementation intended for a completely -different field (stock market trading), where the tradeoff of lag vs -noise filtering is equally important. - -The algorithm works in the same way as the "smoothing filter" from -http://www.stockspotter.com/files/PredictiveIndicators.pdf adapted for -fixed-point math with some constants, using only addition, bit shifts -and multiplication - -To better make use of the filtering and bigger window size, the update -interval is cut in half. - -For testing, the algorithm can be reverted to the older one via debugfs - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel.c -+++ b/net/mac80211/rc80211_minstrel.c -@@ -157,14 +157,18 @@ minstrel_update_rates(struct minstrel_pr - * Recalculate statistics and counters of a given rate - */ - void --minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs) -+minstrel_calc_rate_stats(struct minstrel_priv *mp, -+ struct minstrel_rate_stats *mrs) - { - unsigned int cur_prob; - - if (unlikely(mrs->attempts > 0)) { - mrs->sample_skipped = 0; - cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); -- if (unlikely(!mrs->att_hist)) { -+ if (mp->new_avg) { -+ mrs->prob_ewma = minstrel_filter_avg_add(&mrs->avg, -+ cur_prob); -+ } else if (unlikely(!mrs->att_hist)) { - mrs->prob_ewma = cur_prob; - } else { - /*update exponential weighted moving avarage */ -@@ -200,7 +204,7 @@ minstrel_update_stats(struct minstrel_pr - struct minstrel_rate_stats *tmp_mrs = &mi->r[tmp_prob_rate].stats; - - /* Update statistics of success probability per rate */ -- minstrel_calc_rate_stats(mrs); -+ minstrel_calc_rate_stats(mp, mrs); - - /* Sample less often below the 10% chance of success. - * Sample less often above the 95% chance of success. */ -@@ -289,7 +293,8 @@ minstrel_tx_status(void *priv, struct ie - if (mi->sample_deferred > 0) - mi->sample_deferred--; - -- if (time_after(jiffies, mi->last_stats_update + mp->update_interval)) -+ if (time_after(jiffies, mi->last_stats_update + -+ mp->update_interval / (mp->new_avg ? 2 : 1))) - minstrel_update_stats(mp, mi); - } - ---- a/net/mac80211/rc80211_minstrel.h -+++ b/net/mac80211/rc80211_minstrel.h -@@ -19,6 +19,21 @@ - #define MAX_THR_RATES 4 - - /* -+ * Coefficients for moving average with noise filter (period=16), -+ * scaled by 10 bits -+ * -+ * a1 = exp(-pi * sqrt(2) / period) -+ * coeff2 = 2 * a1 * cos(sqrt(2) * 2 * pi / period) -+ * coeff3 = -sqr(a1) -+ * coeff1 = 1 - coeff2 - coeff3 -+ */ -+#define MINSTREL_AVG_COEFF1 (MINSTREL_FRAC(1, 1) - \ -+ MINSTREL_AVG_COEFF2 - \ -+ MINSTREL_AVG_COEFF3) -+#define MINSTREL_AVG_COEFF2 0x00001499 -+#define MINSTREL_AVG_COEFF3 -0x0000092e -+ -+/* - * Perform EWMA (Exponentially Weighted Moving Average) calculation - */ - static inline int -@@ -32,6 +47,41 @@ minstrel_ewma(int old, int new, int weig - return old + incr; - } - -+struct minstrel_avg_ctx { -+ s32 prev[2]; -+}; -+ -+static inline int minstrel_filter_avg_add(struct minstrel_avg_ctx *ctx, s32 in) -+{ -+ s32 out_1 = ctx->prev[0]; -+ s32 out_2 = ctx->prev[1]; -+ s32 val; -+ -+ if (!in) -+ in += 1; -+ -+ if (!out_1) { -+ val = out_1 = in; -+ goto out; -+ } -+ -+ val = MINSTREL_AVG_COEFF1 * in; -+ val += MINSTREL_AVG_COEFF2 * out_1; -+ val += MINSTREL_AVG_COEFF3 * out_2; -+ val >>= MINSTREL_SCALE; -+ -+ if (val > 1 << MINSTREL_SCALE) -+ val = 1 << MINSTREL_SCALE; -+ if (val < 0) -+ val = 1; -+ -+out: -+ ctx->prev[1] = out_1; -+ ctx->prev[0] = val; -+ -+ return val; -+} -+ - struct minstrel_rate_stats { - /* current / last sampling period attempts/success counters */ - u16 attempts, last_attempts; -@@ -40,6 +90,8 @@ struct minstrel_rate_stats { - /* total attempts/success counters */ - u32 att_hist, succ_hist; - -+ struct minstrel_avg_ctx avg; -+ - /* prob_ewma - exponential weighted moving average of prob */ - u16 prob_ewma; - -@@ -95,6 +147,7 @@ struct minstrel_sta_info { - struct minstrel_priv { - struct ieee80211_hw *hw; - bool has_mrr; -+ bool new_avg; - u32 sample_switch; - unsigned int cw_min; - unsigned int cw_max; -@@ -126,7 +179,8 @@ extern const struct rate_control_ops mac - void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); - - /* Recalculate success probabilities and counters for a given rate using EWMA */ --void minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs); -+void minstrel_calc_rate_stats(struct minstrel_priv *mp, -+ struct minstrel_rate_stats *mrs); - int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma); - - /* debugfs */ ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -737,7 +737,7 @@ minstrel_ht_update_stats(struct minstrel - - mrs = &mg->rates[i]; - mrs->retry_updated = false; -- minstrel_calc_rate_stats(mrs); -+ minstrel_calc_rate_stats(mp, mrs); - cur_prob = mrs->prob_ewma; - - if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0) -@@ -773,6 +773,8 @@ minstrel_ht_update_stats(struct minstrel - - /* try to sample all available rates during each interval */ - mi->sample_count *= 8; -+ if (mp->new_avg) -+ mi->sample_count /= 2; - - if (sample) - minstrel_ht_rate_sample_switch(mp, mi); -@@ -889,6 +891,7 @@ minstrel_ht_tx_status(void *priv, struct - struct ieee80211_tx_rate *ar = info->status.rates; - struct minstrel_rate_stats *rate, *rate2, *rate_sample = NULL; - struct minstrel_priv *mp = priv; -+ u32 update_interval = mp->update_interval / 2; - bool last, update = false; - bool sample_status = false; - int i; -@@ -943,6 +946,10 @@ minstrel_ht_tx_status(void *priv, struct - - switch (mi->sample_mode) { - case MINSTREL_SAMPLE_IDLE: -+ if (mp->new_avg && -+ (mp->hw->max_rates > 1 || -+ mi->total_packets_cur < SAMPLE_SWITCH_THR)) -+ update_interval /= 2; - break; - - case MINSTREL_SAMPLE_ACTIVE: -@@ -983,8 +990,7 @@ minstrel_ht_tx_status(void *priv, struct - } - } - -- if (time_after(jiffies, mi->last_stats_update + -- mp->update_interval / 2)) { -+ if (time_after(jiffies, mi->last_stats_update + update_interval)) { - update = true; - minstrel_ht_update_stats(mp, mi, true); - } -@@ -1665,6 +1671,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h - - mp->hw = hw; - mp->update_interval = HZ / 10; -+ mp->new_avg = true; - - minstrel_ht_init_cck_rates(mp); - -@@ -1682,6 +1689,8 @@ static void minstrel_ht_add_debugfs(stru - &mp->fixed_rate_idx); - debugfs_create_u32("sample_switch", S_IRUGO | S_IWUSR, debugfsdir, - &mp->sample_switch); -+ debugfs_create_bool("new_avg", S_IRUGO | S_IWUSR, debugfsdir, -+ &mp->new_avg); - } - #endif - diff --git a/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch b/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch deleted file mode 100644 index f4c4bdb94e..0000000000 --- a/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch +++ /dev/null @@ -1,424 +0,0 @@ -From: Felix Fietkau -Date: Tue, 8 Oct 2019 18:54:46 +0200 -Subject: [PATCH] mac80211: minstrel_ht: rename prob_ewma to prob_avg, use it - for the new average - -Reduces per-rate data structure size - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel.c -+++ b/net/mac80211/rc80211_minstrel.c -@@ -70,7 +70,7 @@ rix_to_ndx(struct minstrel_sta_info *mi, - } - - /* return current EMWA throughput */ --int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma) -+int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_avg) - { - int usecs; - -@@ -79,13 +79,13 @@ int minstrel_get_tp_avg(struct minstrel_ - usecs = 1000000; - - /* reset thr. below 10% success */ -- if (mr->stats.prob_ewma < MINSTREL_FRAC(10, 100)) -+ if (mr->stats.prob_avg < MINSTREL_FRAC(10, 100)) - return 0; - -- if (prob_ewma > MINSTREL_FRAC(90, 100)) -+ if (prob_avg > MINSTREL_FRAC(90, 100)) - return MINSTREL_TRUNC(100000 * (MINSTREL_FRAC(90, 100) / usecs)); - else -- return MINSTREL_TRUNC(100000 * (prob_ewma / usecs)); -+ return MINSTREL_TRUNC(100000 * (prob_avg / usecs)); - } - - /* find & sort topmost throughput rates */ -@@ -98,8 +98,8 @@ minstrel_sort_best_tp_rates(struct minst - - for (j = MAX_THR_RATES; j > 0; --j) { - tmp_mrs = &mi->r[tp_list[j - 1]].stats; -- if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <= -- minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma)) -+ if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_avg) <= -+ minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_avg)) - break; - } - -@@ -166,15 +166,15 @@ minstrel_calc_rate_stats(struct minstrel - mrs->sample_skipped = 0; - cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); - if (mp->new_avg) { -- mrs->prob_ewma = minstrel_filter_avg_add(&mrs->avg, -- cur_prob); -+ minstrel_filter_avg_add(&mrs->prob_avg, -+ &mrs->prob_avg_1, cur_prob); - } else if (unlikely(!mrs->att_hist)) { -- mrs->prob_ewma = cur_prob; -+ mrs->prob_avg = cur_prob; - } else { - /*update exponential weighted moving avarage */ -- mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma, -- cur_prob, -- EWMA_LEVEL); -+ mrs->prob_avg = minstrel_ewma(mrs->prob_avg, -+ cur_prob, -+ EWMA_LEVEL); - } - mrs->att_hist += mrs->attempts; - mrs->succ_hist += mrs->success; -@@ -208,8 +208,8 @@ minstrel_update_stats(struct minstrel_pr - - /* Sample less often below the 10% chance of success. - * Sample less often above the 95% chance of success. */ -- if (mrs->prob_ewma > MINSTREL_FRAC(95, 100) || -- mrs->prob_ewma < MINSTREL_FRAC(10, 100)) { -+ if (mrs->prob_avg > MINSTREL_FRAC(95, 100) || -+ mrs->prob_avg < MINSTREL_FRAC(10, 100)) { - mr->adjusted_retry_count = mrs->retry_count >> 1; - if (mr->adjusted_retry_count > 2) - mr->adjusted_retry_count = 2; -@@ -229,14 +229,14 @@ minstrel_update_stats(struct minstrel_pr - * choose the maximum throughput rate as max_prob_rate - * (2) if all success probabilities < 95%, the rate with - * highest success probability is chosen as max_prob_rate */ -- if (mrs->prob_ewma >= MINSTREL_FRAC(95, 100)) { -- tmp_cur_tp = minstrel_get_tp_avg(mr, mrs->prob_ewma); -+ if (mrs->prob_avg >= MINSTREL_FRAC(95, 100)) { -+ tmp_cur_tp = minstrel_get_tp_avg(mr, mrs->prob_avg); - tmp_prob_tp = minstrel_get_tp_avg(&mi->r[tmp_prob_rate], -- tmp_mrs->prob_ewma); -+ tmp_mrs->prob_avg); - if (tmp_cur_tp >= tmp_prob_tp) - tmp_prob_rate = i; - } else { -- if (mrs->prob_ewma >= tmp_mrs->prob_ewma) -+ if (mrs->prob_avg >= tmp_mrs->prob_avg) - tmp_prob_rate = i; - } - } -@@ -426,7 +426,7 @@ minstrel_get_rate(void *priv, struct iee - * has a probability of >95%, we shouldn't be attempting - * to use it, as this only wastes precious airtime */ - if (!mrr_capable && -- (mi->r[ndx].stats.prob_ewma > MINSTREL_FRAC(95, 100))) -+ (mi->r[ndx].stats.prob_avg > MINSTREL_FRAC(95, 100))) - return; - - mi->prev_sample = true; -@@ -577,7 +577,7 @@ static u32 minstrel_get_expected_through - * computing cur_tp - */ - tmp_mrs = &mi->r[idx].stats; -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10; -+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_avg) * 10; - tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024; - - return tmp_cur_tp; ---- a/net/mac80211/rc80211_minstrel.h -+++ b/net/mac80211/rc80211_minstrel.h -@@ -47,14 +47,10 @@ minstrel_ewma(int old, int new, int weig - return old + incr; - } - --struct minstrel_avg_ctx { -- s32 prev[2]; --}; -- --static inline int minstrel_filter_avg_add(struct minstrel_avg_ctx *ctx, s32 in) -+static inline int minstrel_filter_avg_add(u16 *prev_1, u16 *prev_2, s32 in) - { -- s32 out_1 = ctx->prev[0]; -- s32 out_2 = ctx->prev[1]; -+ s32 out_1 = *prev_1; -+ s32 out_2 = *prev_2; - s32 val; - - if (!in) -@@ -76,8 +72,8 @@ static inline int minstrel_filter_avg_ad - val = 1; - - out: -- ctx->prev[1] = out_1; -- ctx->prev[0] = val; -+ *prev_2 = out_1; -+ *prev_1 = val; - - return val; - } -@@ -90,10 +86,9 @@ struct minstrel_rate_stats { - /* total attempts/success counters */ - u32 att_hist, succ_hist; - -- struct minstrel_avg_ctx avg; -- -- /* prob_ewma - exponential weighted moving average of prob */ -- u16 prob_ewma; -+ /* prob_avg - moving average of prob */ -+ u16 prob_avg; -+ u16 prob_avg_1; - - /* maximum retry counts */ - u8 retry_count; -@@ -181,7 +176,7 @@ void minstrel_add_sta_debugfs(void *priv - /* Recalculate success probabilities and counters for a given rate using EWMA */ - void minstrel_calc_rate_stats(struct minstrel_priv *mp, - struct minstrel_rate_stats *mrs); --int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma); -+int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_avg); - - /* debugfs */ - int minstrel_stats_open(struct inode *inode, struct file *file); ---- a/net/mac80211/rc80211_minstrel_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_debugfs.c -@@ -90,8 +90,8 @@ minstrel_stats_open(struct inode *inode, - p += sprintf(p, "%6u ", mr->perfect_tx_time); - - tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); -- tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); -- eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); -+ tp_avg = minstrel_get_tp_avg(mr, mrs->prob_avg); -+ eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); - - p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u" - " %3u %3u %-3u " -@@ -147,8 +147,8 @@ minstrel_stats_csv_open(struct inode *in - p += sprintf(p, "%u,",mr->perfect_tx_time); - - tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); -- tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); -- eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); -+ tp_avg = minstrel_get_tp_avg(mr, mrs->prob_avg); -+ eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); - - p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u,%u,%u," - "%llu,%llu,%d,%d\n", ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -346,12 +346,12 @@ minstrel_ht_avg_ampdu_len(struct minstre - */ - int - minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, -- int prob_ewma) -+ int prob_avg) - { - unsigned int nsecs = 0; - - /* do not account throughput if sucess prob is below 10% */ -- if (prob_ewma < MINSTREL_FRAC(10, 100)) -+ if (prob_avg < MINSTREL_FRAC(10, 100)) - return 0; - - if (group != MINSTREL_CCK_GROUP) -@@ -365,11 +365,11 @@ minstrel_ht_get_tp_avg(struct minstrel_h - * account for collision related packet error rate fluctuation - * (prob is scaled - see MINSTREL_FRAC above) - */ -- if (prob_ewma > MINSTREL_FRAC(90, 100)) -+ if (prob_avg > MINSTREL_FRAC(90, 100)) - return MINSTREL_TRUNC(100000 * ((MINSTREL_FRAC(90, 100) * 1000) - / nsecs)); - else -- return MINSTREL_TRUNC(100000 * ((prob_ewma * 1000) / nsecs)); -+ return MINSTREL_TRUNC(100000 * ((prob_avg * 1000) / nsecs)); - } - - /* -@@ -389,13 +389,13 @@ minstrel_ht_sort_best_tp_rates(struct mi - - cur_group = index / MCS_GROUP_RATES; - cur_idx = index % MCS_GROUP_RATES; -- cur_prob = mi->groups[cur_group].rates[cur_idx].prob_ewma; -+ cur_prob = mi->groups[cur_group].rates[cur_idx].prob_avg; - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, cur_prob); - - do { - tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; - tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; -- tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; -+ tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_tp_avg = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, - tmp_prob); - if (cur_tp_avg < tmp_tp_avg || -@@ -432,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi - - tmp_group = mi->max_prob_rate / MCS_GROUP_RATES; - tmp_idx = mi->max_prob_rate % MCS_GROUP_RATES; -- tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; -+ tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_tp_avg = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); - - /* if max_tp_rate[0] is from MCS_GROUP max_prob_rate get selected from -@@ -444,11 +444,11 @@ minstrel_ht_set_best_prob_rate(struct mi - - max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES; - max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; -- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma; -+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_avg; - -- if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) { -+ if (mrs->prob_avg > MINSTREL_FRAC(75, 100)) { - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, -- mrs->prob_ewma); -+ mrs->prob_avg); - if (cur_tp_avg > tmp_tp_avg) - mi->max_prob_rate = index; - -@@ -458,9 +458,9 @@ minstrel_ht_set_best_prob_rate(struct mi - if (cur_tp_avg > max_gpr_tp_avg) - mg->max_group_prob_rate = index; - } else { -- if (mrs->prob_ewma > tmp_prob) -+ if (mrs->prob_avg > tmp_prob) - mi->max_prob_rate = index; -- if (mrs->prob_ewma > max_gpr_prob) -+ if (mrs->prob_avg > max_gpr_prob) - mg->max_group_prob_rate = index; - } - } -@@ -482,12 +482,12 @@ minstrel_ht_assign_best_tp_rates(struct - - tmp_group = tmp_cck_tp_rate[0] / MCS_GROUP_RATES; - tmp_idx = tmp_cck_tp_rate[0] % MCS_GROUP_RATES; -- tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; -+ tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_cck_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); - - tmp_group = tmp_mcs_tp_rate[0] / MCS_GROUP_RATES; - tmp_idx = tmp_mcs_tp_rate[0] % MCS_GROUP_RATES; -- tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; -+ tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_mcs_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); - - if (tmp_cck_tp_rate && tmp_cck_tp > tmp_mcs_tp) { -@@ -518,7 +518,7 @@ minstrel_ht_prob_rate_reduce_streams(str - continue; - - tmp_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; -- tmp_prob = mi->groups[group].rates[tmp_idx].prob_ewma; -+ tmp_prob = mi->groups[group].rates[tmp_idx].prob_avg; - - if (tmp_tp < minstrel_ht_get_tp_avg(mi, group, tmp_idx, tmp_prob) && - (minstrel_mcs_groups[group].streams < tmp_max_streams)) { -@@ -623,7 +623,7 @@ minstrel_ht_rate_sample_switch(struct mi - * If that fails, look again for a rate that is at least as fast - */ - mrs = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); -- faster_rate = mrs->prob_ewma > MINSTREL_FRAC(75, 100); -+ faster_rate = mrs->prob_avg > MINSTREL_FRAC(75, 100); - minstrel_ht_find_probe_rates(mi, rates, &n_rates, faster_rate); - if (!n_rates && faster_rate) - minstrel_ht_find_probe_rates(mi, rates, &n_rates, false); -@@ -738,7 +738,7 @@ minstrel_ht_update_stats(struct minstrel - mrs = &mg->rates[i]; - mrs->retry_updated = false; - minstrel_calc_rate_stats(mp, mrs); -- cur_prob = mrs->prob_ewma; -+ cur_prob = mrs->prob_avg; - - if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0) - continue; -@@ -1012,7 +1012,7 @@ minstrel_calc_retransmit(struct minstrel - unsigned int overhead = 0, overhead_rtscts = 0; - - mrs = minstrel_get_ratestats(mi, index); -- if (mrs->prob_ewma < MINSTREL_FRAC(1, 10)) { -+ if (mrs->prob_avg < MINSTREL_FRAC(1, 10)) { - mrs->retry_count = 1; - mrs->retry_count_rtscts = 1; - return; -@@ -1069,7 +1069,7 @@ minstrel_ht_set_rate(struct minstrel_pri - if (!mrs->retry_updated) - minstrel_calc_retransmit(mp, mi, index); - -- if (mrs->prob_ewma < MINSTREL_FRAC(20, 100) || !mrs->retry_count) { -+ if (mrs->prob_avg < MINSTREL_FRAC(20, 100) || !mrs->retry_count) { - ratetbl->rate[offset].count = 2; - ratetbl->rate[offset].count_rts = 2; - ratetbl->rate[offset].count_cts = 2; -@@ -1103,11 +1103,11 @@ minstrel_ht_set_rate(struct minstrel_pri - } - - static inline int --minstrel_ht_get_prob_ewma(struct minstrel_ht_sta *mi, int rate) -+minstrel_ht_get_prob_avg(struct minstrel_ht_sta *mi, int rate) - { - int group = rate / MCS_GROUP_RATES; - rate %= MCS_GROUP_RATES; -- return mi->groups[group].rates[rate].prob_ewma; -+ return mi->groups[group].rates[rate].prob_avg; - } - - static int -@@ -1119,7 +1119,7 @@ minstrel_ht_get_max_amsdu_len(struct min - unsigned int duration; - - /* Disable A-MSDU if max_prob_rate is bad */ -- if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100)) -+ if (mi->groups[group].rates[rate].prob_avg < MINSTREL_FRAC(50, 100)) - return 1; - - duration = g->duration[rate]; -@@ -1142,7 +1142,7 @@ minstrel_ht_get_max_amsdu_len(struct min - * data packet size - */ - if (duration > MCS_DURATION(1, 0, 260) || -- (minstrel_ht_get_prob_ewma(mi, mi->max_tp_rate[0]) < -+ (minstrel_ht_get_prob_avg(mi, mi->max_tp_rate[0]) < - MINSTREL_FRAC(75, 100))) - return 3200; - -@@ -1247,7 +1247,7 @@ minstrel_get_sample_rate(struct minstrel - * rate, to avoid wasting airtime. - */ - sample_dur = minstrel_get_duration(sample_idx); -- if (mrs->prob_ewma > MINSTREL_FRAC(95, 100) || -+ if (mrs->prob_avg > MINSTREL_FRAC(95, 100) || - minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur) - return -1; - -@@ -1711,7 +1711,7 @@ static u32 minstrel_ht_get_expected_thro - - i = mi->max_tp_rate[0] / MCS_GROUP_RATES; - j = mi->max_tp_rate[0] % MCS_GROUP_RATES; -- prob = mi->groups[i].rates[j].prob_ewma; -+ prob = mi->groups[i].rates[j].prob_avg; - - /* convert tp_avg from pkt per second in kbps */ - tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10; ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -119,6 +119,6 @@ struct minstrel_ht_sta_priv { - - void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); - int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, -- int prob_ewma); -+ int prob_avg); - - #endif ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -98,8 +98,8 @@ minstrel_ht_stats_dump(struct minstrel_h - p += sprintf(p, "%6u ", tx_time); - - tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); -- eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_avg); -+ eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); - - p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u" - " %3u %3u %-3u " -@@ -243,8 +243,8 @@ minstrel_ht_stats_csv_dump(struct minstr - p += sprintf(p, "%u,", tx_time); - - tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); -- eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_avg); -+ eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); - - p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u,%u," - "%u,%llu,%llu,", diff --git a/package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch b/package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch index dc7cac5ad1..64ae487be2 100644 --- a/package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch +++ b/package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch @@ -28,7 +28,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -324,6 +324,7 @@ struct sta_info *sta_info_alloc(struct i +@@ -338,6 +338,7 @@ struct sta_info *sta_info_alloc(struct i INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames); INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); mutex_init(&sta->ampdu_mlme.mtx); diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch index ee8f5d0277..16108c83f3 100644 --- a/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch +++ b/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch @@ -12,7 +12,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/status.c +++ b/net/mac80211/status.c -@@ -881,6 +881,7 @@ static void __ieee80211_tx_status(struct +@@ -895,6 +895,7 @@ static void __ieee80211_tx_status(struct int rates_idx; bool send_to_cooked; bool acked; @@ -20,7 +20,7 @@ Signed-off-by: Johannes Berg struct ieee80211_bar *bar; int shift = 0; int tid = IEEE80211_NUM_TIDS; -@@ -898,6 +899,8 @@ static void __ieee80211_tx_status(struct +@@ -913,6 +914,8 @@ static void __ieee80211_tx_status(struct clear_sta_flag(sta, WLAN_STA_SP); acked = !!(info->flags & IEEE80211_TX_STAT_ACK); @@ -29,7 +29,7 @@ Signed-off-by: Johannes Berg /* mesh Peer Service Period support */ if (ieee80211_vif_is_mesh(&sta->sdata->vif) && -@@ -962,12 +965,12 @@ static void __ieee80211_tx_status(struct +@@ -977,12 +980,12 @@ static void __ieee80211_tx_status(struct ieee80211_handle_filtered_frame(local, sta, skb); return; } else { @@ -44,8 +44,8 @@ Signed-off-by: Johannes Berg sta->status_stats.msdu_failed[tid]++; sta->status_stats.msdu_retries[tid] += -@@ -994,7 +997,7 @@ static void __ieee80211_tx_status(struct - info->status.tx_time, 0); +@@ -1020,7 +1023,7 @@ static void __ieee80211_tx_status(struct + } if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { - if (info->flags & IEEE80211_TX_STAT_ACK) { @@ -53,7 +53,7 @@ Signed-off-by: Johannes Berg if (sta->status_stats.lost_packets) sta->status_stats.lost_packets = 0; -@@ -1002,6 +1005,8 @@ static void __ieee80211_tx_status(struct +@@ -1028,6 +1031,8 @@ static void __ieee80211_tx_status(struct if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) sta->status_stats.last_tdls_pkt_time = jiffies; @@ -62,7 +62,7 @@ Signed-off-by: Johannes Berg } else { ieee80211_lost_packet(sta, info); } -@@ -1128,7 +1133,7 @@ void ieee80211_tx_status_ext(struct ieee +@@ -1148,7 +1153,7 @@ void ieee80211_tx_status_ext(struct ieee sta = container_of(pubsta, struct sta_info, sta); @@ -71,7 +71,7 @@ Signed-off-by: Johannes Berg sta->status_stats.retry_failed++; sta->status_stats.retry_count += retry_count; -@@ -1143,6 +1148,8 @@ void ieee80211_tx_status_ext(struct ieee +@@ -1163,6 +1168,8 @@ void ieee80211_tx_status_ext(struct ieee sta->status_stats.last_tdls_pkt_time = jiffies; } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { return; diff --git a/package/kernel/mac80211/patches/subsys/306-mac80211-move-store-skb-ack-code-to-its-own-function.patch b/package/kernel/mac80211/patches/subsys/306-mac80211-move-store-skb-ack-code-to-its-own-function.patch deleted file mode 100644 index 4f0a699c80..0000000000 --- a/package/kernel/mac80211/patches/subsys/306-mac80211-move-store-skb-ack-code-to-its-own-function.patch +++ /dev/null @@ -1,78 +0,0 @@ -From: John Crispin -Date: Tue, 29 Oct 2019 10:13:02 +0100 -Subject: [PATCH] mac80211: move store skb ack code to its own function - -This patch moves the code handling SKBTX_WIFI_STATUS inside the TX path -into an extra function. This allows us to reuse it inside the 802.11 encap -offloading datapath. - -Signed-off-by: John Crispin -Link: https://lore.kernel.org/r/20191029091304.7330-2-john@phrozen.org -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -2445,6 +2445,33 @@ static int ieee80211_lookup_ra_sta(struc - return 0; - } - -+static int ieee80211_store_ack_skb(struct ieee80211_local *local, -+ struct sk_buff *skb, -+ u32 *info_flags) -+{ -+ struct sk_buff *ack_skb = skb_clone_sk(skb); -+ u16 info_id = 0; -+ -+ if (ack_skb) { -+ unsigned long flags; -+ int id; -+ -+ spin_lock_irqsave(&local->ack_status_lock, flags); -+ id = idr_alloc(&local->ack_status_frames, ack_skb, -+ 1, 0x10000, GFP_ATOMIC); -+ spin_unlock_irqrestore(&local->ack_status_lock, flags); -+ -+ if (id >= 0) { -+ info_id = id; -+ *info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; -+ } else { -+ kfree_skb(ack_skb); -+ } -+ } -+ -+ return info_id; -+} -+ - /** - * ieee80211_build_hdr - build 802.11 header in the given frame - * @sdata: virtual interface to build the header for -@@ -2738,26 +2765,8 @@ static struct sk_buff *ieee80211_build_h - } - - if (unlikely(!multicast && skb->sk && -- skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) { -- struct sk_buff *ack_skb = skb_clone_sk(skb); -- -- if (ack_skb) { -- unsigned long flags; -- int id; -- -- spin_lock_irqsave(&local->ack_status_lock, flags); -- id = idr_alloc(&local->ack_status_frames, ack_skb, -- 1, 0x10000, GFP_ATOMIC); -- spin_unlock_irqrestore(&local->ack_status_lock, flags); -- -- if (id >= 0) { -- info_id = id; -- info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; -- } else { -- kfree_skb(ack_skb); -- } -- } -- } -+ skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) -+ info_id = ieee80211_store_ack_skb(local, skb, &info_flags); - - /* - * If the skb is shared we need to obtain our own copy. diff --git a/package/kernel/mac80211/patches/subsys/307-mac80211-Shrink-the-size-of-ack_frame_id-to-make-roo.patch b/package/kernel/mac80211/patches/subsys/307-mac80211-Shrink-the-size-of-ack_frame_id-to-make-roo.patch deleted file mode 100644 index ff25ceff6e..0000000000 --- a/package/kernel/mac80211/patches/subsys/307-mac80211-Shrink-the-size-of-ack_frame_id-to-make-roo.patch +++ /dev/null @@ -1,67 +0,0 @@ -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Wed, 23 Oct 2019 11:59:00 +0200 -Subject: [PATCH] mac80211: Shrink the size of ack_frame_id to make room for - tx_time_est -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -To implement airtime queue limiting, we need to keep a running account of -the estimated airtime of all skbs queued into the device. Do to this -correctly, we need to store the airtime estimate into the skb so we can -decrease the outstanding balance when the skb is freed. This means that the -time estimate must be stored somewhere that will survive for the lifetime -of the skb. - -To get this, decrease the size of the ack_frame_id field to 6 bits, and -lower the size of the ID space accordingly. This leaves 10 bits for use for -tx_time_est, which is enough to store a maximum of 4096 us, if we shift the -values so they become units of 4us. - -Signed-off-by: Toke Høiland-Jørgensen -Link: https://lore.kernel.org/r/157182474063.150713.16132669599100802716.stgit@toke.dk -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -967,6 +967,7 @@ ieee80211_rate_get_vht_nss(const struct - * @band: the band to transmit on (use for checking for races) - * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC - * @ack_frame_id: internal frame ID for TX status, used internally -+ * @tx_time_est: TX time estimate in units of 4us, used internally - * @control: union part for control data - * @control.rates: TX rates array to try - * @control.rts_cts_rate_idx: rate for RTS or CTS -@@ -1007,7 +1008,8 @@ struct ieee80211_tx_info { - - u8 hw_queue; - -- u16 ack_frame_id; -+ u16 ack_frame_id:6; -+ u16 tx_time_est:10; - - union { - struct { ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -3449,7 +3449,7 @@ int ieee80211_attach_ack_skb(struct ieee - - spin_lock_irqsave(&local->ack_status_lock, spin_flags); - id = idr_alloc(&local->ack_status_frames, ack_skb, -- 1, 0x10000, GFP_ATOMIC); -+ 1, 0x40, GFP_ATOMIC); - spin_unlock_irqrestore(&local->ack_status_lock, spin_flags); - - if (id < 0) { ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -2458,7 +2458,7 @@ static int ieee80211_store_ack_skb(struc - - spin_lock_irqsave(&local->ack_status_lock, flags); - id = idr_alloc(&local->ack_status_frames, ack_skb, -- 1, 0x10000, GFP_ATOMIC); -+ 1, 0x40, GFP_ATOMIC); - spin_unlock_irqrestore(&local->ack_status_lock, flags); - - if (id >= 0) { diff --git a/package/kernel/mac80211/patches/subsys/308-mac80211-Add-new-sta_info-getter-by-sta-vif-addrs.patch b/package/kernel/mac80211/patches/subsys/308-mac80211-Add-new-sta_info-getter-by-sta-vif-addrs.patch deleted file mode 100644 index a6b05f4b74..0000000000 --- a/package/kernel/mac80211/patches/subsys/308-mac80211-Add-new-sta_info-getter-by-sta-vif-addrs.patch +++ /dev/null @@ -1,78 +0,0 @@ -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Tue, 12 Nov 2019 14:08:35 +0100 -Subject: [PATCH] mac80211: Add new sta_info getter by sta/vif addrs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In ieee80211_tx_status() we don't have an sdata struct when looking up the -destination sta. Instead, we just do a lookup by the vif addr that is the -source of the packet being completed. Factor this out into a new sta_info -getter helper, since we need to use it for accounting AQL as well. - -Signed-off-by: Toke Høiland-Jørgensen -Link: https://lore.kernel.org/r/20191112130835.382062-1-toke@redhat.com -[remove internal rcu_read_lock(), document instead] -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -210,6 +210,20 @@ struct sta_info *sta_info_get_bss(struct - return NULL; - } - -+struct sta_info *sta_info_get_by_addrs(struct ieee80211_local *local, -+ const u8 *sta_addr, const u8 *vif_addr) -+{ -+ struct rhlist_head *tmp; -+ struct sta_info *sta; -+ -+ for_each_sta_info(local, sta_addr, sta, tmp) { -+ if (ether_addr_equal(vif_addr, sta->sdata->vif.addr)) -+ return sta; -+ } -+ -+ return NULL; -+} -+ - struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, - int idx) - { ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -726,6 +726,10 @@ struct sta_info *sta_info_get(struct iee - struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, - const u8 *addr); - -+/* user must hold sta_mtx or be in RCU critical section */ -+struct sta_info *sta_info_get_by_addrs(struct ieee80211_local *local, -+ const u8 *sta_addr, const u8 *vif_addr); -+ - #define for_each_sta_info(local, _addr, _sta, _tmp) \ - rhl_for_each_entry_rcu(_sta, _tmp, \ - sta_info_hash_lookup(local, _addr), hash_node) ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -1086,19 +1086,13 @@ void ieee80211_tx_status(struct ieee8021 - .skb = skb, - .info = IEEE80211_SKB_CB(skb), - }; -- struct rhlist_head *tmp; - struct sta_info *sta; - - rcu_read_lock(); - -- for_each_sta_info(local, hdr->addr1, sta, tmp) { -- /* skip wrong virtual interface */ -- if (!ether_addr_equal(hdr->addr2, sta->sdata->vif.addr)) -- continue; -- -+ sta = sta_info_get_by_addrs(local, hdr->addr1, hdr->addr2); -+ if (sta) - status.sta = &sta->sta; -- break; -- } - - __ieee80211_tx_status(hw, &status); - rcu_read_unlock(); diff --git a/package/kernel/mac80211/patches/subsys/309-mac80211-Import-airtime-calculation-code-from-mt76.patch b/package/kernel/mac80211/patches/subsys/309-mac80211-Import-airtime-calculation-code-from-mt76.patch deleted file mode 100644 index 7f049b8d0c..0000000000 --- a/package/kernel/mac80211/patches/subsys/309-mac80211-Import-airtime-calculation-code-from-mt76.patch +++ /dev/null @@ -1,690 +0,0 @@ -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Mon, 18 Nov 2019 22:06:08 -0800 -Subject: [PATCH] mac80211: Import airtime calculation code from mt76 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Felix recently added code to calculate airtime of packets to the mt76 -driver. Import this into mac80211 so we can use it for airtime queue limit -calculations. - -The airtime.c file is copied verbatim from the mt76 driver, and adjusted to -be usable in mac80211. This involves: - -- Switching to mac80211 data structures. -- Adding support for 160 MHz channels and HE mode. -- Moving the symbol and duration calculations around a bit to avoid - rounding with the higher rates and longer symbol times used for HE rates. - -The per-rate TX rate calculation is also split out to its own function so -it can be used directly for the AQL calculations later. - -Signed-off-by: Toke Høiland-Jørgensen -Link: https://lore.kernel.org/r/20191119060610.76681-3-kyan@google.com -[fix HE_GROUP_IDX() to use 3 * bw, since there are 3 _gi values] -Signed-off-by: Johannes Berg ---- - create mode 100644 net/mac80211/airtime.c - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -6419,4 +6419,33 @@ void ieee80211_nan_func_match(struct iee - struct cfg80211_nan_match_params *match, - gfp_t gfp); - -+/** -+ * ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX. -+ * -+ * This function calculates the estimated airtime usage of a frame based on the -+ * rate information in the RX status struct and the frame length. -+ * -+ * @hw: pointer as obtained from ieee80211_alloc_hw() -+ * @status: &struct ieee80211_rx_status containing the transmission rate -+ * information. -+ * @len: frame length in bytes -+ */ -+u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, -+ struct ieee80211_rx_status *status, -+ int len); -+ -+/** -+ * ieee80211_calc_tx_airtime - calculate estimated transmission airtime for TX. -+ * -+ * This function calculates the estimated airtime usage of a frame based on the -+ * rate information in the TX info struct and the frame length. -+ * -+ * @hw: pointer as obtained from ieee80211_alloc_hw() -+ * @info: &struct ieee80211_tx_info of the frame. -+ * @len: frame length in bytes -+ */ -+u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw, -+ struct ieee80211_tx_info *info, -+ int len); -+ - #endif /* MAC80211_H */ ---- a/net/mac80211/Makefile -+++ b/net/mac80211/Makefile -@@ -31,7 +31,8 @@ mac80211-y := \ - chan.o \ - trace.o mlme.o \ - tdls.o \ -- ocb.o -+ ocb.o \ -+ airtime.o - - mac80211-$(CPTCFG_MAC80211_LEDS) += led.o - mac80211-$(CPTCFG_MAC80211_DEBUGFS) += \ ---- /dev/null -+++ b/net/mac80211/airtime.c -@@ -0,0 +1,597 @@ -+// SPDX-License-Identifier: ISC -+/* -+ * Copyright (C) 2019 Felix Fietkau -+ */ -+ -+#include -+#include "ieee80211_i.h" -+#include "sta_info.h" -+ -+#define AVG_PKT_SIZE 1024 -+ -+/* Number of bits for an average sized packet */ -+#define MCS_NBITS (AVG_PKT_SIZE << 3) -+ -+/* Number of kilo-symbols (symbols * 1024) for a packet with (bps) bits per -+ * symbol. We use k-symbols to avoid rounding in the _TIME macros below. -+ */ -+#define MCS_N_KSYMS(bps) DIV_ROUND_UP(MCS_NBITS << 10, (bps)) -+ -+/* Transmission time (in 1024 * usec) for a packet containing (ksyms) * 1024 -+ * symbols. -+ */ -+#define MCS_SYMBOL_TIME(sgi, ksyms) \ -+ (sgi ? \ -+ ((ksyms) * 4 * 18) / 20 : /* 3.6 us per sym */ \ -+ ((ksyms) * 4) /* 4.0 us per sym */ \ -+ ) -+ -+/* Transmit duration for the raw data part of an average sized packet */ -+#define MCS_DURATION(streams, sgi, bps) \ -+ ((u32)MCS_SYMBOL_TIME(sgi, MCS_N_KSYMS((streams) * (bps)))) -+ -+#define MCS_DURATION_S(shift, streams, sgi, bps) \ -+ ((u16)((MCS_DURATION(streams, sgi, bps) >> shift))) -+ -+/* These should match the values in enum nl80211_he_gi */ -+#define HE_GI_08 0 -+#define HE_GI_16 1 -+#define HE_GI_32 2 -+ -+/* Transmission time (1024 usec) for a packet containing (ksyms) * k-symbols */ -+#define HE_SYMBOL_TIME(gi, ksyms) \ -+ (gi == HE_GI_08 ? \ -+ ((ksyms) * 16 * 17) / 20 : /* 13.6 us per sym */ \ -+ (gi == HE_GI_16 ? \ -+ ((ksyms) * 16 * 18) / 20 : /* 14.4 us per sym */ \ -+ ((ksyms) * 16) /* 16.0 us per sym */ \ -+ )) -+ -+/* Transmit duration for the raw data part of an average sized packet */ -+#define HE_DURATION(streams, gi, bps) \ -+ ((u32)HE_SYMBOL_TIME(gi, MCS_N_KSYMS((streams) * (bps)))) -+ -+#define HE_DURATION_S(shift, streams, gi, bps) \ -+ (HE_DURATION(streams, gi, bps) >> shift) -+ -+#define BW_20 0 -+#define BW_40 1 -+#define BW_80 2 -+#define BW_160 3 -+ -+/* -+ * Define group sort order: HT40 -> SGI -> #streams -+ */ -+#define IEEE80211_MAX_STREAMS 4 -+#define IEEE80211_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */ -+#define IEEE80211_VHT_STREAM_GROUPS 8 /* BW(=4) * SGI(=2) */ -+ -+#define IEEE80211_HE_MAX_STREAMS 8 -+#define IEEE80211_HE_STREAM_GROUPS 12 /* BW(=4) * GI(=3) */ -+ -+#define IEEE80211_HT_GROUPS_NB (IEEE80211_MAX_STREAMS * \ -+ IEEE80211_HT_STREAM_GROUPS) -+#define IEEE80211_VHT_GROUPS_NB (IEEE80211_MAX_STREAMS * \ -+ IEEE80211_VHT_STREAM_GROUPS) -+#define IEEE80211_HE_GROUPS_NB (IEEE80211_HE_MAX_STREAMS * \ -+ IEEE80211_HE_STREAM_GROUPS) -+#define IEEE80211_GROUPS_NB (IEEE80211_HT_GROUPS_NB + \ -+ IEEE80211_VHT_GROUPS_NB + \ -+ IEEE80211_HE_GROUPS_NB) -+ -+#define IEEE80211_HT_GROUP_0 0 -+#define IEEE80211_VHT_GROUP_0 (IEEE80211_HT_GROUP_0 + IEEE80211_HT_GROUPS_NB) -+#define IEEE80211_HE_GROUP_0 (IEEE80211_VHT_GROUP_0 + IEEE80211_VHT_GROUPS_NB) -+ -+#define MCS_GROUP_RATES 12 -+ -+#define HT_GROUP_IDX(_streams, _sgi, _ht40) \ -+ IEEE80211_HT_GROUP_0 + \ -+ IEEE80211_MAX_STREAMS * 2 * _ht40 + \ -+ IEEE80211_MAX_STREAMS * _sgi + \ -+ _streams - 1 -+ -+#define _MAX(a, b) (((a)>(b))?(a):(b)) -+ -+#define GROUP_SHIFT(duration) \ -+ _MAX(0, 16 - __builtin_clz(duration)) -+ -+/* MCS rate information for an MCS group */ -+#define __MCS_GROUP(_streams, _sgi, _ht40, _s) \ -+ [HT_GROUP_IDX(_streams, _sgi, _ht40)] = { \ -+ .shift = _s, \ -+ .duration = { \ -+ MCS_DURATION_S(_s, _streams, _sgi, _ht40 ? 54 : 26), \ -+ MCS_DURATION_S(_s, _streams, _sgi, _ht40 ? 108 : 52), \ -+ MCS_DURATION_S(_s, _streams, _sgi, _ht40 ? 162 : 78), \ -+ MCS_DURATION_S(_s, _streams, _sgi, _ht40 ? 216 : 104), \ -+ MCS_DURATION_S(_s, _streams, _sgi, _ht40 ? 324 : 156), \ -+ MCS_DURATION_S(_s, _streams, _sgi, _ht40 ? 432 : 208), \ -+ MCS_DURATION_S(_s, _streams, _sgi, _ht40 ? 486 : 234), \ -+ MCS_DURATION_S(_s, _streams, _sgi, _ht40 ? 540 : 260) \ -+ } \ -+} -+ -+#define MCS_GROUP_SHIFT(_streams, _sgi, _ht40) \ -+ GROUP_SHIFT(MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26)) -+ -+#define MCS_GROUP(_streams, _sgi, _ht40) \ -+ __MCS_GROUP(_streams, _sgi, _ht40, \ -+ MCS_GROUP_SHIFT(_streams, _sgi, _ht40)) -+ -+#define VHT_GROUP_IDX(_streams, _sgi, _bw) \ -+ (IEEE80211_VHT_GROUP_0 + \ -+ IEEE80211_MAX_STREAMS * 2 * (_bw) + \ -+ IEEE80211_MAX_STREAMS * (_sgi) + \ -+ (_streams) - 1) -+ -+#define BW2VBPS(_bw, r4, r3, r2, r1) \ -+ (_bw == BW_160 ? r4 : _bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1) -+ -+#define __VHT_GROUP(_streams, _sgi, _bw, _s) \ -+ [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \ -+ .shift = _s, \ -+ .duration = { \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 234, 117, 54, 26)), \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 468, 234, 108, 52)), \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 702, 351, 162, 78)), \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 936, 468, 216, 104)), \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 1404, 702, 324, 156)), \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 1872, 936, 432, 208)), \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 2106, 1053, 486, 234)), \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 2340, 1170, 540, 260)), \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 2808, 1404, 648, 312)), \ -+ MCS_DURATION_S(_s, _streams, _sgi, \ -+ BW2VBPS(_bw, 3120, 1560, 720, 346)) \ -+ } \ -+} -+ -+#define VHT_GROUP_SHIFT(_streams, _sgi, _bw) \ -+ GROUP_SHIFT(MCS_DURATION(_streams, _sgi, \ -+ BW2VBPS(_bw, 243, 117, 54, 26))) -+ -+#define VHT_GROUP(_streams, _sgi, _bw) \ -+ __VHT_GROUP(_streams, _sgi, _bw, \ -+ VHT_GROUP_SHIFT(_streams, _sgi, _bw)) -+ -+ -+#define HE_GROUP_IDX(_streams, _gi, _bw) \ -+ (IEEE80211_HE_GROUP_0 + \ -+ IEEE80211_HE_MAX_STREAMS * 3 * (_bw) + \ -+ IEEE80211_HE_MAX_STREAMS * (_gi) + \ -+ (_streams) - 1) -+ -+#define __HE_GROUP(_streams, _gi, _bw, _s) \ -+ [HE_GROUP_IDX(_streams, _gi, _bw)] = { \ -+ .shift = _s, \ -+ .duration = { \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 979, 489, 230, 115)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 1958, 979, 475, 230)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 2937, 1468, 705, 345)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 3916, 1958, 936, 475)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 5875, 2937, 1411, 705)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 7833, 3916, 1872, 936)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 8827, 4406, 2102, 1051)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 9806, 4896, 2347, 1166)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 11764, 5875, 2808, 1411)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 13060, 6523, 3124, 1555)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 14702, 7344, 3513, 1756)), \ -+ HE_DURATION_S(_s, _streams, _gi, \ -+ BW2VBPS(_bw, 16329, 8164, 3902, 1944)) \ -+ } \ -+} -+ -+#define HE_GROUP_SHIFT(_streams, _gi, _bw) \ -+ GROUP_SHIFT(HE_DURATION(_streams, _gi, \ -+ BW2VBPS(_bw, 979, 489, 230, 115))) -+ -+#define HE_GROUP(_streams, _gi, _bw) \ -+ __HE_GROUP(_streams, _gi, _bw, \ -+ HE_GROUP_SHIFT(_streams, _gi, _bw)) -+struct mcs_group { -+ u8 shift; -+ u16 duration[MCS_GROUP_RATES]; -+}; -+ -+static const struct mcs_group airtime_mcs_groups[] = { -+ MCS_GROUP(1, 0, BW_20), -+ MCS_GROUP(2, 0, BW_20), -+ MCS_GROUP(3, 0, BW_20), -+ MCS_GROUP(4, 0, BW_20), -+ -+ MCS_GROUP(1, 1, BW_20), -+ MCS_GROUP(2, 1, BW_20), -+ MCS_GROUP(3, 1, BW_20), -+ MCS_GROUP(4, 1, BW_20), -+ -+ MCS_GROUP(1, 0, BW_40), -+ MCS_GROUP(2, 0, BW_40), -+ MCS_GROUP(3, 0, BW_40), -+ MCS_GROUP(4, 0, BW_40), -+ -+ MCS_GROUP(1, 1, BW_40), -+ MCS_GROUP(2, 1, BW_40), -+ MCS_GROUP(3, 1, BW_40), -+ MCS_GROUP(4, 1, BW_40), -+ -+ VHT_GROUP(1, 0, BW_20), -+ VHT_GROUP(2, 0, BW_20), -+ VHT_GROUP(3, 0, BW_20), -+ VHT_GROUP(4, 0, BW_20), -+ -+ VHT_GROUP(1, 1, BW_20), -+ VHT_GROUP(2, 1, BW_20), -+ VHT_GROUP(3, 1, BW_20), -+ VHT_GROUP(4, 1, BW_20), -+ -+ VHT_GROUP(1, 0, BW_40), -+ VHT_GROUP(2, 0, BW_40), -+ VHT_GROUP(3, 0, BW_40), -+ VHT_GROUP(4, 0, BW_40), -+ -+ VHT_GROUP(1, 1, BW_40), -+ VHT_GROUP(2, 1, BW_40), -+ VHT_GROUP(3, 1, BW_40), -+ VHT_GROUP(4, 1, BW_40), -+ -+ VHT_GROUP(1, 0, BW_80), -+ VHT_GROUP(2, 0, BW_80), -+ VHT_GROUP(3, 0, BW_80), -+ VHT_GROUP(4, 0, BW_80), -+ -+ VHT_GROUP(1, 1, BW_80), -+ VHT_GROUP(2, 1, BW_80), -+ VHT_GROUP(3, 1, BW_80), -+ VHT_GROUP(4, 1, BW_80), -+ -+ VHT_GROUP(1, 0, BW_160), -+ VHT_GROUP(2, 0, BW_160), -+ VHT_GROUP(3, 0, BW_160), -+ VHT_GROUP(4, 0, BW_160), -+ -+ VHT_GROUP(1, 1, BW_160), -+ VHT_GROUP(2, 1, BW_160), -+ VHT_GROUP(3, 1, BW_160), -+ VHT_GROUP(4, 1, BW_160), -+ -+ HE_GROUP(1, HE_GI_08, BW_20), -+ HE_GROUP(2, HE_GI_08, BW_20), -+ HE_GROUP(3, HE_GI_08, BW_20), -+ HE_GROUP(4, HE_GI_08, BW_20), -+ HE_GROUP(5, HE_GI_08, BW_20), -+ HE_GROUP(6, HE_GI_08, BW_20), -+ HE_GROUP(7, HE_GI_08, BW_20), -+ HE_GROUP(8, HE_GI_08, BW_20), -+ -+ HE_GROUP(1, HE_GI_16, BW_20), -+ HE_GROUP(2, HE_GI_16, BW_20), -+ HE_GROUP(3, HE_GI_16, BW_20), -+ HE_GROUP(4, HE_GI_16, BW_20), -+ HE_GROUP(5, HE_GI_16, BW_20), -+ HE_GROUP(6, HE_GI_16, BW_20), -+ HE_GROUP(7, HE_GI_16, BW_20), -+ HE_GROUP(8, HE_GI_16, BW_20), -+ -+ HE_GROUP(1, HE_GI_32, BW_20), -+ HE_GROUP(2, HE_GI_32, BW_20), -+ HE_GROUP(3, HE_GI_32, BW_20), -+ HE_GROUP(4, HE_GI_32, BW_20), -+ HE_GROUP(5, HE_GI_32, BW_20), -+ HE_GROUP(6, HE_GI_32, BW_20), -+ HE_GROUP(7, HE_GI_32, BW_20), -+ HE_GROUP(8, HE_GI_32, BW_20), -+ -+ HE_GROUP(1, HE_GI_08, BW_40), -+ HE_GROUP(2, HE_GI_08, BW_40), -+ HE_GROUP(3, HE_GI_08, BW_40), -+ HE_GROUP(4, HE_GI_08, BW_40), -+ HE_GROUP(5, HE_GI_08, BW_40), -+ HE_GROUP(6, HE_GI_08, BW_40), -+ HE_GROUP(7, HE_GI_08, BW_40), -+ HE_GROUP(8, HE_GI_08, BW_40), -+ -+ HE_GROUP(1, HE_GI_16, BW_40), -+ HE_GROUP(2, HE_GI_16, BW_40), -+ HE_GROUP(3, HE_GI_16, BW_40), -+ HE_GROUP(4, HE_GI_16, BW_40), -+ HE_GROUP(5, HE_GI_16, BW_40), -+ HE_GROUP(6, HE_GI_16, BW_40), -+ HE_GROUP(7, HE_GI_16, BW_40), -+ HE_GROUP(8, HE_GI_16, BW_40), -+ -+ HE_GROUP(1, HE_GI_32, BW_40), -+ HE_GROUP(2, HE_GI_32, BW_40), -+ HE_GROUP(3, HE_GI_32, BW_40), -+ HE_GROUP(4, HE_GI_32, BW_40), -+ HE_GROUP(5, HE_GI_32, BW_40), -+ HE_GROUP(6, HE_GI_32, BW_40), -+ HE_GROUP(7, HE_GI_32, BW_40), -+ HE_GROUP(8, HE_GI_32, BW_40), -+ -+ HE_GROUP(1, HE_GI_08, BW_80), -+ HE_GROUP(2, HE_GI_08, BW_80), -+ HE_GROUP(3, HE_GI_08, BW_80), -+ HE_GROUP(4, HE_GI_08, BW_80), -+ HE_GROUP(5, HE_GI_08, BW_80), -+ HE_GROUP(6, HE_GI_08, BW_80), -+ HE_GROUP(7, HE_GI_08, BW_80), -+ HE_GROUP(8, HE_GI_08, BW_80), -+ -+ HE_GROUP(1, HE_GI_16, BW_80), -+ HE_GROUP(2, HE_GI_16, BW_80), -+ HE_GROUP(3, HE_GI_16, BW_80), -+ HE_GROUP(4, HE_GI_16, BW_80), -+ HE_GROUP(5, HE_GI_16, BW_80), -+ HE_GROUP(6, HE_GI_16, BW_80), -+ HE_GROUP(7, HE_GI_16, BW_80), -+ HE_GROUP(8, HE_GI_16, BW_80), -+ -+ HE_GROUP(1, HE_GI_32, BW_80), -+ HE_GROUP(2, HE_GI_32, BW_80), -+ HE_GROUP(3, HE_GI_32, BW_80), -+ HE_GROUP(4, HE_GI_32, BW_80), -+ HE_GROUP(5, HE_GI_32, BW_80), -+ HE_GROUP(6, HE_GI_32, BW_80), -+ HE_GROUP(7, HE_GI_32, BW_80), -+ HE_GROUP(8, HE_GI_32, BW_80), -+ -+ HE_GROUP(1, HE_GI_08, BW_160), -+ HE_GROUP(2, HE_GI_08, BW_160), -+ HE_GROUP(3, HE_GI_08, BW_160), -+ HE_GROUP(4, HE_GI_08, BW_160), -+ HE_GROUP(5, HE_GI_08, BW_160), -+ HE_GROUP(6, HE_GI_08, BW_160), -+ HE_GROUP(7, HE_GI_08, BW_160), -+ HE_GROUP(8, HE_GI_08, BW_160), -+ -+ HE_GROUP(1, HE_GI_16, BW_160), -+ HE_GROUP(2, HE_GI_16, BW_160), -+ HE_GROUP(3, HE_GI_16, BW_160), -+ HE_GROUP(4, HE_GI_16, BW_160), -+ HE_GROUP(5, HE_GI_16, BW_160), -+ HE_GROUP(6, HE_GI_16, BW_160), -+ HE_GROUP(7, HE_GI_16, BW_160), -+ HE_GROUP(8, HE_GI_16, BW_160), -+ -+ HE_GROUP(1, HE_GI_32, BW_160), -+ HE_GROUP(2, HE_GI_32, BW_160), -+ HE_GROUP(3, HE_GI_32, BW_160), -+ HE_GROUP(4, HE_GI_32, BW_160), -+ HE_GROUP(5, HE_GI_32, BW_160), -+ HE_GROUP(6, HE_GI_32, BW_160), -+ HE_GROUP(7, HE_GI_32, BW_160), -+ HE_GROUP(8, HE_GI_32, BW_160), -+}; -+ -+static u32 -+ieee80211_calc_legacy_rate_duration(u16 bitrate, bool short_pre, -+ bool cck, int len) -+{ -+ u32 duration; -+ -+ if (cck) { -+ duration = 144 + 48; /* preamble + PLCP */ -+ if (short_pre) -+ duration >>= 1; -+ -+ duration += 10; /* SIFS */ -+ } else { -+ duration = 20 + 16; /* premable + SIFS */ -+ } -+ -+ len <<= 3; -+ duration += (len * 10) / bitrate; -+ -+ return duration; -+} -+ -+u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, -+ struct ieee80211_rx_status *status, -+ int len) -+{ -+ struct ieee80211_supported_band *sband; -+ const struct ieee80211_rate *rate; -+ bool sgi = status->enc_flags & RX_ENC_FLAG_SHORT_GI; -+ bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE; -+ int bw, streams; -+ int group, idx; -+ u32 duration; -+ bool cck; -+ -+ switch (status->bw) { -+ case RATE_INFO_BW_20: -+ bw = BW_20; -+ break; -+ case RATE_INFO_BW_40: -+ bw = BW_40; -+ break; -+ case RATE_INFO_BW_80: -+ bw = BW_80; -+ break; -+ case RATE_INFO_BW_160: -+ bw = BW_160; -+ break; -+ default: -+ WARN_ON_ONCE(1); -+ return 0; -+ } -+ -+ switch (status->encoding) { -+ case RX_ENC_LEGACY: -+ if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ)) -+ return 0; -+ -+ sband = hw->wiphy->bands[status->band]; -+ if (!sband || status->rate_idx > sband->n_bitrates) -+ return 0; -+ -+ rate = &sband->bitrates[status->rate_idx]; -+ cck = rate->flags & IEEE80211_RATE_MANDATORY_B; -+ -+ return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp, -+ cck, len); -+ -+ case RX_ENC_VHT: -+ streams = status->nss; -+ idx = status->rate_idx; -+ group = VHT_GROUP_IDX(streams, sgi, bw); -+ break; -+ case RX_ENC_HT: -+ streams = ((status->rate_idx >> 3) & 3) + 1; -+ idx = status->rate_idx & 7; -+ group = HT_GROUP_IDX(streams, sgi, bw); -+ break; -+ case RX_ENC_HE: -+ streams = status->nss; -+ idx = status->rate_idx; -+ group = HE_GROUP_IDX(streams, status->he_gi, bw); -+ break; -+ default: -+ WARN_ON_ONCE(1); -+ return 0; -+ } -+ -+ if (WARN_ON_ONCE((status->encoding != RX_ENC_HE && streams > 4) || -+ (status->encoding == RX_ENC_HE && streams > 8))) -+ return 0; -+ -+ duration = airtime_mcs_groups[group].duration[idx]; -+ duration <<= airtime_mcs_groups[group].shift; -+ duration *= len; -+ duration /= AVG_PKT_SIZE; -+ duration /= 1024; -+ -+ duration += 36 + (streams << 2); -+ -+ return duration; -+} -+EXPORT_SYMBOL_GPL(ieee80211_calc_rx_airtime); -+ -+static u32 ieee80211_calc_tx_airtime_rate(struct ieee80211_hw *hw, -+ struct ieee80211_tx_rate *rate, -+ u8 band, int len) -+{ -+ struct ieee80211_rx_status stat = { -+ .band = band, -+ }; -+ -+ if (rate->idx < 0 || !rate->count) -+ return 0; -+ -+ if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) -+ stat.bw = RATE_INFO_BW_80; -+ else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) -+ stat.bw = RATE_INFO_BW_40; -+ else -+ stat.bw = RATE_INFO_BW_20; -+ -+ stat.enc_flags = 0; -+ if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) -+ stat.enc_flags |= RX_ENC_FLAG_SHORTPRE; -+ if (rate->flags & IEEE80211_TX_RC_SHORT_GI) -+ stat.enc_flags |= RX_ENC_FLAG_SHORT_GI; -+ -+ stat.rate_idx = rate->idx; -+ if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { -+ stat.encoding = RX_ENC_VHT; -+ stat.rate_idx = ieee80211_rate_get_vht_mcs(rate); -+ stat.nss = ieee80211_rate_get_vht_nss(rate); -+ } else if (rate->flags & IEEE80211_TX_RC_MCS) { -+ stat.encoding = RX_ENC_HT; -+ } else { -+ stat.encoding = RX_ENC_LEGACY; -+ } -+ -+ return ieee80211_calc_rx_airtime(hw, &stat, len); -+} -+ -+u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw, -+ struct ieee80211_tx_info *info, -+ int len) -+{ -+ u32 duration = 0; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(info->status.rates); i++) { -+ struct ieee80211_tx_rate *rate = &info->status.rates[i]; -+ u32 cur_duration; -+ -+ cur_duration = ieee80211_calc_tx_airtime_rate(hw, rate, -+ info->band, len); -+ if (!cur_duration) -+ break; -+ -+ duration += cur_duration * rate->count; -+ } -+ -+ return duration; -+} -+EXPORT_SYMBOL_GPL(ieee80211_calc_tx_airtime); -+ -+u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta *pubsta, -+ int len) -+{ -+ struct ieee80211_supported_band *sband; -+ struct ieee80211_chanctx_conf *conf; -+ int rateidx, shift = 0; -+ bool cck, short_pream; -+ u32 basic_rates; -+ u8 band = 0; -+ u16 rate; -+ -+ len += 38; /* Ethernet header length */ -+ -+ conf = rcu_dereference(vif->chanctx_conf); -+ if (conf) { -+ band = conf->def.chan->band; -+ shift = ieee80211_chandef_get_shift(&conf->def); -+ } -+ -+ if (pubsta) { -+ struct sta_info *sta = container_of(pubsta, struct sta_info, -+ sta); -+ -+ return ieee80211_calc_tx_airtime_rate(hw, -+ &sta->tx_stats.last_rate, -+ band, len); -+ } -+ -+ if (!conf) -+ return 0; -+ -+ /* No station to get latest rate from, so calculate the worst-case -+ * duration using the lowest configured basic rate. -+ */ -+ sband = hw->wiphy->bands[band]; -+ -+ basic_rates = vif->bss_conf.basic_rates; -+ short_pream = vif->bss_conf.use_short_preamble; -+ -+ rateidx = basic_rates ? ffs(basic_rates) - 1 : 0; -+ rate = sband->bitrates[rateidx].bitrate << shift; -+ cck = sband->bitrates[rateidx].flags & IEEE80211_RATE_MANDATORY_B; -+ -+ return ieee80211_calc_legacy_rate_duration(rate, short_pream, cck, len); -+} ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -2253,6 +2253,10 @@ const char *ieee80211_get_reason_code_st - - extern const struct ethtool_ops ieee80211_ethtool_ops; - -+u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta *pubsta, -+ int len); - #ifdef CPTCFG_MAC80211_NOINLINE - #define debug_noinline noinline - #else diff --git a/package/kernel/mac80211/patches/subsys/310-mac80211-Implement-Airtime-based-Queue-Limit-AQL.patch b/package/kernel/mac80211/patches/subsys/310-mac80211-Implement-Airtime-based-Queue-Limit-AQL.patch deleted file mode 100644 index b76286d15c..0000000000 --- a/package/kernel/mac80211/patches/subsys/310-mac80211-Implement-Airtime-based-Queue-Limit-AQL.patch +++ /dev/null @@ -1,446 +0,0 @@ -From: Kan Yan -Date: Mon, 18 Nov 2019 22:06:09 -0800 -Subject: [PATCH] mac80211: Implement Airtime-based Queue Limit (AQL) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In order for the Fq_CoDel algorithm integrated in mac80211 layer to operate -effectively to control excessive queueing latency, the CoDel algorithm -requires an accurate measure of how long packets stays in the queue, AKA -sojourn time. The sojourn time measured at the mac80211 layer doesn't -include queueing latency in the lower layer (firmware/hardware) and CoDel -expects lower layer to have a short queue. However, most 802.11ac chipsets -offload tasks such TX aggregation to firmware or hardware, thus have a deep -lower layer queue. - -Without a mechanism to control the lower layer queue size, packets only -stay in mac80211 layer transiently before being sent to firmware queue. -As a result, the sojourn time measured by CoDel in the mac80211 layer is -almost always lower than the CoDel latency target, hence CoDel does little -to control the latency, even when the lower layer queue causes excessive -latency. - -The Byte Queue Limits (BQL) mechanism is commonly used to address the -similar issue with wired network interface. However, this method cannot be -applied directly to the wireless network interface. "Bytes" is not a -suitable measure of queue depth in the wireless network, as the data rate -can vary dramatically from station to station in the same network, from a -few Mbps to over Gbps. - -This patch implements an Airtime-based Queue Limit (AQL) to make CoDel work -effectively with wireless drivers that utilized firmware/hardware -offloading. AQL allows each txq to release just enough packets to the lower -layer to form 1-2 large aggregations to keep hardware fully utilized and -retains the rest of the frames in mac80211 layer to be controlled by the -CoDel algorithm. - -Signed-off-by: Kan Yan -[ Toke: Keep API to set pending airtime internal, fix nits in commit msg ] -Signed-off-by: Toke Høiland-Jørgensen -Link: https://lore.kernel.org/r/20191119060610.76681-4-kyan@google.com -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -2603,6 +2603,13 @@ enum wiphy_params_flags { - - #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 - -+/* The per TXQ device queue limit in airtime */ -+#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000 -+#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000 -+ -+/* The per interface airtime threshold to switch to lower queue limit */ -+#define IEEE80211_AQL_THRESHOLD 24000 -+ - /** - * struct cfg80211_pmksa - PMK Security Association - * ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -5559,6 +5559,18 @@ void ieee80211_sta_register_airtime(stru - u32 tx_airtime, u32 rx_airtime); - - /** -+ * ieee80211_txq_airtime_check - check if a txq can send frame to device -+ * -+ * @hw: pointer obtained from ieee80211_alloc_hw() -+ * @txq: pointer obtained from station or virtual interface -+ * -+ * Return true if the AQL's airtime limit has not been reached and the txq can -+ * continue to send more packets to the device. Otherwise return false. -+ */ -+bool -+ieee80211_txq_airtime_check(struct ieee80211_hw *hw, struct ieee80211_txq *txq); -+ -+/** - * ieee80211_iter_keys - iterate keys programmed into the device - * @hw: pointer obtained from ieee80211_alloc_hw() - * @vif: virtual interface to iterate, may be %NULL for all ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -148,6 +148,87 @@ static const struct file_operations aqm_ - .llseek = default_llseek, - }; - -+static ssize_t aql_txq_limit_read(struct file *file, -+ char __user *user_buf, -+ size_t count, -+ loff_t *ppos) -+{ -+ struct ieee80211_local *local = file->private_data; -+ char buf[400]; -+ int len = 0; -+ -+ len = scnprintf(buf, sizeof(buf), -+ "AC AQL limit low AQL limit high\n" -+ "VO %u %u\n" -+ "VI %u %u\n" -+ "BE %u %u\n" -+ "BK %u %u\n", -+ local->aql_txq_limit_low[IEEE80211_AC_VO], -+ local->aql_txq_limit_high[IEEE80211_AC_VO], -+ local->aql_txq_limit_low[IEEE80211_AC_VI], -+ local->aql_txq_limit_high[IEEE80211_AC_VI], -+ local->aql_txq_limit_low[IEEE80211_AC_BE], -+ local->aql_txq_limit_high[IEEE80211_AC_BE], -+ local->aql_txq_limit_low[IEEE80211_AC_BK], -+ local->aql_txq_limit_high[IEEE80211_AC_BK]); -+ return simple_read_from_buffer(user_buf, count, ppos, -+ buf, len); -+} -+ -+static ssize_t aql_txq_limit_write(struct file *file, -+ const char __user *user_buf, -+ size_t count, -+ loff_t *ppos) -+{ -+ struct ieee80211_local *local = file->private_data; -+ char buf[100]; -+ size_t len; -+ u32 ac, q_limit_low, q_limit_high, q_limit_low_old, q_limit_high_old; -+ struct sta_info *sta; -+ -+ if (count > sizeof(buf)) -+ return -EINVAL; -+ -+ if (copy_from_user(buf, user_buf, count)) -+ return -EFAULT; -+ -+ buf[sizeof(buf) - 1] = 0; -+ len = strlen(buf); -+ if (len > 0 && buf[len - 1] == '\n') -+ buf[len - 1] = 0; -+ -+ if (sscanf(buf, "%u %u %u", &ac, &q_limit_low, &q_limit_high) != 3) -+ return -EINVAL; -+ -+ if (ac >= IEEE80211_NUM_ACS) -+ return -EINVAL; -+ -+ q_limit_low_old = local->aql_txq_limit_low[ac]; -+ q_limit_high_old = local->aql_txq_limit_high[ac]; -+ -+ local->aql_txq_limit_low[ac] = q_limit_low; -+ local->aql_txq_limit_high[ac] = q_limit_high; -+ -+ mutex_lock(&local->sta_mtx); -+ list_for_each_entry(sta, &local->sta_list, list) { -+ /* If a sta has customized queue limits, keep it */ -+ if (sta->airtime[ac].aql_limit_low == q_limit_low_old && -+ sta->airtime[ac].aql_limit_high == q_limit_high_old) { -+ sta->airtime[ac].aql_limit_low = q_limit_low; -+ sta->airtime[ac].aql_limit_high = q_limit_high; -+ } -+ } -+ mutex_unlock(&local->sta_mtx); -+ return count; -+} -+ -+static const struct file_operations aql_txq_limit_ops = { -+ .write = aql_txq_limit_write, -+ .read = aql_txq_limit_read, -+ .open = simple_open, -+ .llseek = default_llseek, -+}; -+ - static ssize_t force_tx_status_read(struct file *file, - char __user *user_buf, - size_t count, -@@ -441,6 +522,10 @@ void debugfs_hw_add(struct ieee80211_loc - debugfs_create_u16("airtime_flags", 0600, - phyd, &local->airtime_flags); - -+ DEBUGFS_ADD(aql_txq_limit); -+ debugfs_create_u32("aql_threshold", 0600, -+ phyd, &local->aql_threshold); -+ - statsd = debugfs_create_dir("statistics", phyd); - - /* if the dir failed, don't put all the other things into the root! */ ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -198,10 +198,12 @@ static ssize_t sta_airtime_read(struct f - { - struct sta_info *sta = file->private_data; - struct ieee80211_local *local = sta->sdata->local; -- size_t bufsz = 200; -+ size_t bufsz = 400; - char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; - u64 rx_airtime = 0, tx_airtime = 0; - s64 deficit[IEEE80211_NUM_ACS]; -+ u32 q_depth[IEEE80211_NUM_ACS]; -+ u32 q_limit_l[IEEE80211_NUM_ACS], q_limit_h[IEEE80211_NUM_ACS]; - ssize_t rv; - int ac; - -@@ -213,19 +215,22 @@ static ssize_t sta_airtime_read(struct f - rx_airtime += sta->airtime[ac].rx_airtime; - tx_airtime += sta->airtime[ac].tx_airtime; - deficit[ac] = sta->airtime[ac].deficit; -+ q_limit_l[ac] = sta->airtime[ac].aql_limit_low; -+ q_limit_h[ac] = sta->airtime[ac].aql_limit_high; - spin_unlock_bh(&local->active_txq_lock[ac]); -+ q_depth[ac] = atomic_read(&sta->airtime[ac].aql_tx_pending); - } - - p += scnprintf(p, bufsz + buf - p, - "RX: %llu us\nTX: %llu us\nWeight: %u\n" -- "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", -- rx_airtime, -- tx_airtime, -- sta->airtime_weight, -- deficit[0], -- deficit[1], -- deficit[2], -- deficit[3]); -+ "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n" -+ "Q depth: VO: %u us VI: %u us BE: %u us BK: %u us\n" -+ "Q limit[low/high]: VO: %u/%u VI: %u/%u BE: %u/%u BK: %u/%u\n", -+ rx_airtime, tx_airtime, sta->airtime_weight, -+ deficit[0], deficit[1], deficit[2], deficit[3], -+ q_depth[0], q_depth[1], q_depth[2], q_depth[3], -+ q_limit_l[0], q_limit_h[0], q_limit_l[1], q_limit_h[1], -+ q_limit_l[2], q_limit_h[2], q_limit_l[3], q_limit_h[3]), - - rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); - kfree(buf); -@@ -237,7 +242,25 @@ static ssize_t sta_airtime_write(struct - { - struct sta_info *sta = file->private_data; - struct ieee80211_local *local = sta->sdata->local; -- int ac; -+ u32 ac, q_limit_l, q_limit_h; -+ char _buf[100] = {}, *buf = _buf; -+ -+ if (count > sizeof(_buf)) -+ return -EINVAL; -+ -+ if (copy_from_user(buf, userbuf, count)) -+ return -EFAULT; -+ -+ buf[sizeof(_buf) - 1] = '\0'; -+ if (sscanf(buf, "queue limit %u %u %u", &ac, &q_limit_l, &q_limit_h) -+ != 3) -+ return -EINVAL; -+ -+ if (ac >= IEEE80211_NUM_ACS) -+ return -EINVAL; -+ -+ sta->airtime[ac].aql_limit_low = q_limit_l; -+ sta->airtime[ac].aql_limit_high = q_limit_h; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - spin_lock_bh(&local->active_txq_lock[ac]); ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1142,6 +1142,10 @@ struct ieee80211_local { - u16 schedule_round[IEEE80211_NUM_ACS]; - - u16 airtime_flags; -+ u32 aql_txq_limit_low[IEEE80211_NUM_ACS]; -+ u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; -+ u32 aql_threshold; -+ atomic_t aql_total_pending_airtime; - - const struct ieee80211_ops *ops; - ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -669,8 +669,16 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - INIT_LIST_HEAD(&local->active_txqs[i]); - spin_lock_init(&local->active_txq_lock[i]); -+ local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; -+ local->aql_txq_limit_high[i] = -+ IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; - } -- local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; -+ -+ local->airtime_flags = AIRTIME_USE_TX | -+ AIRTIME_USE_RX | -+ AIRTIME_USE_AQL; -+ local->aql_threshold = IEEE80211_AQL_THRESHOLD; -+ atomic_set(&local->aql_total_pending_airtime, 0); - - INIT_LIST_HEAD(&local->chanctx_list); - mutex_init(&local->chanctx_mtx); ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -411,6 +411,9 @@ struct sta_info *sta_info_alloc(struct i - skb_queue_head_init(&sta->ps_tx_buf[i]); - skb_queue_head_init(&sta->tx_filtered[i]); - sta->airtime[i].deficit = sta->airtime_weight; -+ atomic_set(&sta->airtime[i].aql_tx_pending, 0); -+ sta->airtime[i].aql_limit_low = local->aql_txq_limit_low[i]; -+ sta->airtime[i].aql_limit_high = local->aql_txq_limit_high[i]; - } - - for (i = 0; i < IEEE80211_NUM_TIDS; i++) -@@ -1913,6 +1916,41 @@ void ieee80211_sta_register_airtime(stru - } - EXPORT_SYMBOL(ieee80211_sta_register_airtime); - -+void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local, -+ struct sta_info *sta, u8 ac, -+ u16 tx_airtime, bool tx_completed) -+{ -+ int tx_pending; -+ -+ if (!tx_completed) { -+ if (sta) -+ atomic_add(tx_airtime, -+ &sta->airtime[ac].aql_tx_pending); -+ -+ atomic_add(tx_airtime, &local->aql_total_pending_airtime); -+ return; -+ } -+ -+ if (sta) { -+ tx_pending = atomic_sub_return(tx_airtime, -+ &sta->airtime[ac].aql_tx_pending); -+ if (WARN_ONCE(tx_pending < 0, -+ "STA %pM AC %d txq pending airtime underflow: %u, %u", -+ sta->addr, ac, tx_pending, tx_airtime)) -+ atomic_cmpxchg(&sta->airtime[ac].aql_tx_pending, -+ tx_pending, 0); -+ } -+ -+ tx_pending = atomic_sub_return(tx_airtime, -+ &local->aql_total_pending_airtime); -+ if (WARN_ONCE(tx_pending < 0, -+ "Device %s AC %d pending airtime underflow: %u, %u", -+ wiphy_name(local->hw.wiphy), ac, tx_pending, -+ tx_airtime)) -+ atomic_cmpxchg(&local->aql_total_pending_airtime, -+ tx_pending, 0); -+} -+ - int sta_info_move_state(struct sta_info *sta, - enum ieee80211_sta_state new_state) - { ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -128,13 +128,21 @@ enum ieee80211_agg_stop_reason { - /* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */ - #define AIRTIME_USE_TX BIT(0) - #define AIRTIME_USE_RX BIT(1) -+#define AIRTIME_USE_AQL BIT(2) - - struct airtime_info { - u64 rx_airtime; - u64 tx_airtime; - s64 deficit; -+ atomic_t aql_tx_pending; /* Estimated airtime for frames pending */ -+ u32 aql_limit_low; -+ u32 aql_limit_high; - }; - -+void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local, -+ struct sta_info *sta, u8 ac, -+ u16 tx_airtime, bool tx_completed); -+ - struct sta_info; - - /** ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3700,7 +3700,8 @@ struct ieee80211_txq *ieee80211_next_txq - { - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_txq *ret = NULL; -- struct txq_info *txqi = NULL; -+ struct txq_info *txqi = NULL, *head = NULL; -+ bool found_eligible_txq = false; - - spin_lock_bh(&local->active_txq_lock[ac]); - -@@ -3711,13 +3712,30 @@ struct ieee80211_txq *ieee80211_next_txq - if (!txqi) - goto out; - -+ if (txqi == head) { -+ if (!found_eligible_txq) -+ goto out; -+ else -+ found_eligible_txq = false; -+ } -+ -+ if (!head) -+ head = txqi; -+ - if (txqi->txq.sta) { - struct sta_info *sta = container_of(txqi->txq.sta, -- struct sta_info, sta); -+ struct sta_info, sta); -+ bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); -+ s64 deficit = sta->airtime[txqi->txq.ac].deficit; - -- if (sta->airtime[txqi->txq.ac].deficit < 0) { -+ if (aql_check) -+ found_eligible_txq = true; -+ -+ if (deficit < 0) - sta->airtime[txqi->txq.ac].deficit += - sta->airtime_weight; -+ -+ if (deficit < 0 || !aql_check) { - list_move_tail(&txqi->schedule_order, - &local->active_txqs[txqi->txq.ac]); - goto begin; -@@ -3771,6 +3789,33 @@ void __ieee80211_schedule_txq(struct iee - } - EXPORT_SYMBOL(__ieee80211_schedule_txq); - -+bool ieee80211_txq_airtime_check(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq) -+{ -+ struct sta_info *sta; -+ struct ieee80211_local *local = hw_to_local(hw); -+ -+ if (!(local->airtime_flags & AIRTIME_USE_AQL)) -+ return true; -+ -+ if (!txq->sta) -+ return true; -+ -+ sta = container_of(txq->sta, struct sta_info, sta); -+ if (atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < -+ sta->airtime[txq->ac].aql_limit_low) -+ return true; -+ -+ if (atomic_read(&local->aql_total_pending_airtime) < -+ local->aql_threshold && -+ atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < -+ sta->airtime[txq->ac].aql_limit_high) -+ return true; -+ -+ return false; -+} -+EXPORT_SYMBOL(ieee80211_txq_airtime_check); -+ - bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, - struct ieee80211_txq *txq) - { diff --git a/package/kernel/mac80211/patches/subsys/311-mac80211-Use-Airtime-based-Queue-Limits-AQL-on-packe.patch b/package/kernel/mac80211/patches/subsys/311-mac80211-Use-Airtime-based-Queue-Limits-AQL-on-packe.patch deleted file mode 100644 index a0548d9d05..0000000000 --- a/package/kernel/mac80211/patches/subsys/311-mac80211-Use-Airtime-based-Queue-Limits-AQL-on-packe.patch +++ /dev/null @@ -1,146 +0,0 @@ -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Mon, 18 Nov 2019 22:06:10 -0800 -Subject: [PATCH] mac80211: Use Airtime-based Queue Limits (AQL) on packet - dequeue -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The previous commit added the ability to throttle stations when they queue -too much airtime in the hardware. This commit enables the functionality by -calculating the expected airtime usage of each packet that is dequeued from -the TXQs in mac80211, and accounting that as pending airtime. - -The estimated airtime for each skb is stored in the tx_info, so we can -subtract the same amount from the running total when the skb is freed or -recycled. The throttling mechanism relies on this accounting to be -accurate (i.e., that we are not freeing skbs without subtracting any -airtime they were accounted for), so we put the subtraction into -ieee80211_report_used_skb(). As an optimisation, we also subtract the -airtime on regular TX completion, zeroing out the value stored in the -packet afterwards, to avoid having to do an expensive lookup of the station -from the packet data on every packet. - -This patch does *not* include any mechanism to wake a throttled TXQ again, -on the assumption that this will happen anyway as a side effect of whatever -freed the skb (most commonly a TX completion). - -Signed-off-by: Toke Høiland-Jørgensen -Link: https://lore.kernel.org/r/20191119060610.76681-5-kyan@google.com -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -1060,6 +1060,22 @@ struct ieee80211_tx_info { - }; - }; - -+static inline u16 -+ieee80211_info_set_tx_time_est(struct ieee80211_tx_info *info, u16 tx_time_est) -+{ -+ /* We only have 10 bits in tx_time_est, so store airtime -+ * in increments of 4us and clamp the maximum to 2**12-1 -+ */ -+ info->tx_time_est = min_t(u16, tx_time_est, 4095) >> 2; -+ return info->tx_time_est << 2; -+} -+ -+static inline u16 -+ieee80211_info_get_tx_time_est(struct ieee80211_tx_info *info) -+{ -+ return info->tx_time_est << 2; -+} -+ - /** - * struct ieee80211_tx_status - extended tx staus info for rate control - * ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -670,12 +670,26 @@ static void ieee80211_report_used_skb(st - struct sk_buff *skb, bool dropped) - { - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ u16 tx_time_est = ieee80211_info_get_tx_time_est(info); - struct ieee80211_hdr *hdr = (void *)skb->data; - bool acked = info->flags & IEEE80211_TX_STAT_ACK; - - if (dropped) - acked = false; - -+ if (tx_time_est) { -+ struct sta_info *sta; -+ -+ rcu_read_lock(); -+ -+ sta = sta_info_get_by_addrs(local, hdr->addr1, hdr->addr2); -+ ieee80211_sta_update_pending_airtime(local, sta, -+ skb_get_queue_mapping(skb), -+ tx_time_est, -+ true); -+ rcu_read_unlock(); -+ } -+ - if (info->flags & IEEE80211_TX_INTFL_MLME_CONN_TX) { - struct ieee80211_sub_if_data *sdata; - -@@ -885,6 +899,7 @@ static void __ieee80211_tx_status(struct - struct ieee80211_bar *bar; - int shift = 0; - int tid = IEEE80211_NUM_TIDS; -+ u16 tx_time_est; - - rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count); - -@@ -996,6 +1011,17 @@ static void __ieee80211_tx_status(struct - ieee80211_sta_register_airtime(&sta->sta, tid, - info->status.tx_time, 0); - -+ if ((tx_time_est = ieee80211_info_get_tx_time_est(info)) > 0) { -+ /* Do this here to avoid the expensive lookup of the sta -+ * in ieee80211_report_used_skb(). -+ */ -+ ieee80211_sta_update_pending_airtime(local, sta, -+ skb_get_queue_mapping(skb), -+ tx_time_est, -+ true); -+ ieee80211_info_set_tx_time_est(info, 0); -+ } -+ - if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { - if (acked) { - if (sta->status_stats.lost_packets) ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3559,6 +3559,9 @@ struct sk_buff *ieee80211_tx_dequeue(str - - WARN_ON_ONCE(softirq_count() == 0); - -+ if (!ieee80211_txq_airtime_check(hw, txq)) -+ return NULL; -+ - begin: - spin_lock_bh(&fq->lock); - -@@ -3687,6 +3690,21 @@ begin: - } - - IEEE80211_SKB_CB(skb)->control.vif = vif; -+ -+ if (local->airtime_flags & AIRTIME_USE_AQL) { -+ u32 airtime; -+ -+ airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta, -+ skb->len); -+ if (airtime) { -+ airtime = ieee80211_info_set_tx_time_est(info, airtime); -+ ieee80211_sta_update_pending_airtime(local, tx.sta, -+ txq->ac, -+ airtime, -+ false); -+ } -+ } -+ - return skb; - - out: diff --git a/package/kernel/mac80211/patches/subsys/312-mac80211-airtime-Fix-an-off-by-one-in-ieee80211_calc.patch b/package/kernel/mac80211/patches/subsys/312-mac80211-airtime-Fix-an-off-by-one-in-ieee80211_calc.patch deleted file mode 100644 index 4ff496c12e..0000000000 --- a/package/kernel/mac80211/patches/subsys/312-mac80211-airtime-Fix-an-off-by-one-in-ieee80211_calc.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Dan Carpenter -Date: Tue, 26 Nov 2019 15:09:39 +0300 -Subject: [PATCH] mac80211: airtime: Fix an off by one in - ieee80211_calc_rx_airtime() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This code was copied from mt76 and inherited an off by one bug from -there. The > should be >= so that we don't read one element beyond -the end of the array. - -Fixes: db3e1c40cf2f ("mac80211: Import airtime calculation code from mt76") -Reported-by: Toke Høiland-Jørgensen -Signed-off-by: Dan Carpenter -Acked-by: Toke Høiland-Jørgensen -Link: https://lore.kernel.org/r/20191126120910.ftr4t7me3by32aiz@kili.mountain -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/airtime.c -+++ b/net/mac80211/airtime.c -@@ -442,7 +442,7 @@ u32 ieee80211_calc_rx_airtime(struct iee - return 0; - - sband = hw->wiphy->bands[status->band]; -- if (!sband || status->rate_idx > sband->n_bitrates) -+ if (!sband || status->rate_idx >= sband->n_bitrates) - return 0; - - rate = &sband->bitrates[status->rate_idx]; diff --git a/package/kernel/mac80211/patches/subsys/313-mac80211-Turn-AQL-into-an-NL80211_EXT_FEATURE.patch b/package/kernel/mac80211/patches/subsys/313-mac80211-Turn-AQL-into-an-NL80211_EXT_FEATURE.patch deleted file mode 100644 index 389f2ae225..0000000000 --- a/package/kernel/mac80211/patches/subsys/313-mac80211-Turn-AQL-into-an-NL80211_EXT_FEATURE.patch +++ /dev/null @@ -1,253 +0,0 @@ -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Thu, 12 Dec 2019 12:14:37 +0100 -Subject: [PATCH] mac80211: Turn AQL into an NL80211_EXT_FEATURE -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Instead of just having an airtime flag in debugfs, turn AQL into a proper -NL80211_EXT_FEATURE, so drivers can turn it on when they are ready, and so -we also expose the presence of the feature to userspace. - -This also has the effect of flipping the default, so drivers have to opt in -to using AQL instead of getting it by default with TXQs. To keep -functionality the same as pre-patch, we set this feature for ath10k (which -is where it is needed the most). - -While we're at it, split out the debugfs interface so AQL gets its own -per-station debugfs file instead of using the 'airtime' file. - -[Johannes:] -This effectively disables AQL for iwlwifi, where it fixes a number of -issues: - * TSO in iwlwifi is causing underflows and associated warnings in AQL - * HE (802.11ax) rates aren't reported properly so at HE rates, AQL could - never have a valid estimate (it'd use 6 Mbps instead of up to 2400!) - -Signed-off-by: Toke Høiland-Jørgensen -Link: https://lore.kernel.org/r/20191212111437.224294-1-toke@redhat.com -Fixes: 3ace10f5b5ad ("mac80211: Implement Airtime-based Queue Limit (AQL)") -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -8870,6 +8870,7 @@ int ath10k_mac_register(struct ath10k *a - wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_SET_SCAN_DWELL); -+ wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); - - if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) || - test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map)) ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -5484,6 +5484,10 @@ enum nl80211_feature_flags { - * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in - * station mode (SAE password is passed as part of the connect command). - * -+ * @NL80211_EXT_FEATURE_AQL: The driver supports the Airtime Queue Limit (AQL) -+ * feature, which prevents bufferbloat by using the expected transmission -+ * time to limit the amount of data buffered in the hardware. -+ * - * @NUM_NL80211_EXT_FEATURES: number of extended features. - * @MAX_NL80211_EXT_FEATURES: highest extended feature index. - */ -@@ -5529,6 +5533,8 @@ enum nl80211_ext_feature_index { - NL80211_EXT_FEATURE_EXT_KEY_ID, - NL80211_EXT_FEATURE_STA_TX_PWR, - NL80211_EXT_FEATURE_SAE_OFFLOAD, -+ NL80211_EXT_FEATURE_VLAN_OFFLOAD, -+ NL80211_EXT_FEATURE_AQL, - - /* add new features before the definition below */ - NUM_NL80211_EXT_FEATURES, ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -202,8 +202,6 @@ static ssize_t sta_airtime_read(struct f - char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; - u64 rx_airtime = 0, tx_airtime = 0; - s64 deficit[IEEE80211_NUM_ACS]; -- u32 q_depth[IEEE80211_NUM_ACS]; -- u32 q_limit_l[IEEE80211_NUM_ACS], q_limit_h[IEEE80211_NUM_ACS]; - ssize_t rv; - int ac; - -@@ -215,6 +213,56 @@ static ssize_t sta_airtime_read(struct f - rx_airtime += sta->airtime[ac].rx_airtime; - tx_airtime += sta->airtime[ac].tx_airtime; - deficit[ac] = sta->airtime[ac].deficit; -+ spin_unlock_bh(&local->active_txq_lock[ac]); -+ } -+ -+ p += scnprintf(p, bufsz + buf - p, -+ "RX: %llu us\nTX: %llu us\nWeight: %u\n" -+ "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", -+ rx_airtime, tx_airtime, sta->airtime_weight, -+ deficit[0], deficit[1], deficit[2], deficit[3]); -+ -+ rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); -+ kfree(buf); -+ return rv; -+} -+ -+static ssize_t sta_airtime_write(struct file *file, const char __user *userbuf, -+ size_t count, loff_t *ppos) -+{ -+ struct sta_info *sta = file->private_data; -+ struct ieee80211_local *local = sta->sdata->local; -+ int ac; -+ -+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -+ spin_lock_bh(&local->active_txq_lock[ac]); -+ sta->airtime[ac].rx_airtime = 0; -+ sta->airtime[ac].tx_airtime = 0; -+ sta->airtime[ac].deficit = sta->airtime_weight; -+ spin_unlock_bh(&local->active_txq_lock[ac]); -+ } -+ -+ return count; -+} -+STA_OPS_RW(airtime); -+ -+static ssize_t sta_aql_read(struct file *file, char __user *userbuf, -+ size_t count, loff_t *ppos) -+{ -+ struct sta_info *sta = file->private_data; -+ struct ieee80211_local *local = sta->sdata->local; -+ size_t bufsz = 400; -+ char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; -+ u32 q_depth[IEEE80211_NUM_ACS]; -+ u32 q_limit_l[IEEE80211_NUM_ACS], q_limit_h[IEEE80211_NUM_ACS]; -+ ssize_t rv; -+ int ac; -+ -+ if (!buf) -+ return -ENOMEM; -+ -+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -+ spin_lock_bh(&local->active_txq_lock[ac]); - q_limit_l[ac] = sta->airtime[ac].aql_limit_low; - q_limit_h[ac] = sta->airtime[ac].aql_limit_high; - spin_unlock_bh(&local->active_txq_lock[ac]); -@@ -222,12 +270,8 @@ static ssize_t sta_airtime_read(struct f - } - - p += scnprintf(p, bufsz + buf - p, -- "RX: %llu us\nTX: %llu us\nWeight: %u\n" -- "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n" - "Q depth: VO: %u us VI: %u us BE: %u us BK: %u us\n" - "Q limit[low/high]: VO: %u/%u VI: %u/%u BE: %u/%u BK: %u/%u\n", -- rx_airtime, tx_airtime, sta->airtime_weight, -- deficit[0], deficit[1], deficit[2], deficit[3], - q_depth[0], q_depth[1], q_depth[2], q_depth[3], - q_limit_l[0], q_limit_h[0], q_limit_l[1], q_limit_h[1], - q_limit_l[2], q_limit_h[2], q_limit_l[3], q_limit_h[3]), -@@ -237,11 +281,10 @@ static ssize_t sta_airtime_read(struct f - return rv; - } - --static ssize_t sta_airtime_write(struct file *file, const char __user *userbuf, -+static ssize_t sta_aql_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) - { - struct sta_info *sta = file->private_data; -- struct ieee80211_local *local = sta->sdata->local; - u32 ac, q_limit_l, q_limit_h; - char _buf[100] = {}, *buf = _buf; - -@@ -252,7 +295,7 @@ static ssize_t sta_airtime_write(struct - return -EFAULT; - - buf[sizeof(_buf) - 1] = '\0'; -- if (sscanf(buf, "queue limit %u %u %u", &ac, &q_limit_l, &q_limit_h) -+ if (sscanf(buf, "limit %u %u %u", &ac, &q_limit_l, &q_limit_h) - != 3) - return -EINVAL; - -@@ -262,17 +305,10 @@ static ssize_t sta_airtime_write(struct - sta->airtime[ac].aql_limit_low = q_limit_l; - sta->airtime[ac].aql_limit_high = q_limit_h; - -- for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -- spin_lock_bh(&local->active_txq_lock[ac]); -- sta->airtime[ac].rx_airtime = 0; -- sta->airtime[ac].tx_airtime = 0; -- sta->airtime[ac].deficit = sta->airtime_weight; -- spin_unlock_bh(&local->active_txq_lock[ac]); -- } -- - return count; - } --STA_OPS_RW(airtime); -+STA_OPS_RW(aql); -+ - - static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -@@ -1002,6 +1038,10 @@ void ieee80211_sta_debugfs_add(struct st - NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) - DEBUGFS_ADD(airtime); - -+ if (wiphy_ext_feature_isset(local->hw.wiphy, -+ NL80211_EXT_FEATURE_AQL)) -+ DEBUGFS_ADD(aql); -+ - if (sizeof(sta->driver_buffered_tids) == sizeof(u32)) - debugfs_create_x32("driver_buffered_tids", 0400, - sta->debugfs_dir, ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -674,9 +674,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; - } - -- local->airtime_flags = AIRTIME_USE_TX | -- AIRTIME_USE_RX | -- AIRTIME_USE_AQL; -+ local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; - local->aql_threshold = IEEE80211_AQL_THRESHOLD; - atomic_set(&local->aql_total_pending_airtime, 0); - ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -1922,6 +1922,9 @@ void ieee80211_sta_update_pending_airtim - { - int tx_pending; - -+ if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) -+ return; -+ - if (!tx_completed) { - if (sta) - atomic_add(tx_airtime, ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -128,7 +128,6 @@ enum ieee80211_agg_stop_reason { - /* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */ - #define AIRTIME_USE_TX BIT(0) - #define AIRTIME_USE_RX BIT(1) --#define AIRTIME_USE_AQL BIT(2) - - struct airtime_info { - u64 rx_airtime; ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3691,7 +3691,7 @@ begin: - - IEEE80211_SKB_CB(skb)->control.vif = vif; - -- if (local->airtime_flags & AIRTIME_USE_AQL) { -+ if (wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) { - u32 airtime; - - airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta, -@@ -3813,7 +3813,7 @@ bool ieee80211_txq_airtime_check(struct - struct sta_info *sta; - struct ieee80211_local *local = hw_to_local(hw); - -- if (!(local->airtime_flags & AIRTIME_USE_AQL)) -+ if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) - return true; - - if (!txq->sta) diff --git a/package/kernel/mac80211/patches/subsys/353-mac80211-use-more-bits-for-ack_frame_id.patch b/package/kernel/mac80211/patches/subsys/353-mac80211-use-more-bits-for-ack_frame_id.patch deleted file mode 100644 index a2fb9d4b10..0000000000 --- a/package/kernel/mac80211/patches/subsys/353-mac80211-use-more-bits-for-ack_frame_id.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: Johannes Berg -Date: Wed, 15 Jan 2020 12:25:50 +0100 -Subject: [PATCH] mac80211: use more bits for ack_frame_id -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It turns out that this wasn't a good idea, I hit a test failure in -hwsim due to this. That particular failure was easily worked around, -but it raised questions: if an AP needs to, for example, send action -frames to each connected station, the current limit is nowhere near -enough (especially if those stations are sleeping and the frames are -queued for a while.) - -Shuffle around some bits to make more room for ack_frame_id to allow -up to 8192 queued up frames, that's enough for queueing 4 frames to -each connected station, even at the maximum of 2007 stations on a -single AP. - -We take the bits from band (which currently only 2 but I leave 3 in -case we add another band) and from the hw_queue, which can only need -4 since it has a limit of 16 queues. - -Fixes: 6912daed05e1 ("mac80211: Shrink the size of ack_frame_id to make room for tx_time_est") -Signed-off-by: Johannes Berg -Acked-by: Toke Høiland-Jørgensen ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -1004,12 +1004,11 @@ ieee80211_rate_get_vht_nss(const struct - struct ieee80211_tx_info { - /* common information */ - u32 flags; -- u8 band; -- -- u8 hw_queue; -- -- u16 ack_frame_id:6; -- u16 tx_time_est:10; -+ u32 band:3, -+ ack_frame_id:13, -+ hw_queue:4, -+ tx_time_est:10; -+ /* 2 free bits */ - - union { - struct { ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -3449,7 +3449,7 @@ int ieee80211_attach_ack_skb(struct ieee - - spin_lock_irqsave(&local->ack_status_lock, spin_flags); - id = idr_alloc(&local->ack_status_frames, ack_skb, -- 1, 0x40, GFP_ATOMIC); -+ 1, 0x2000, GFP_ATOMIC); - spin_unlock_irqrestore(&local->ack_status_lock, spin_flags); - - if (id < 0) { ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -2458,7 +2458,7 @@ static int ieee80211_store_ack_skb(struc - - spin_lock_irqsave(&local->ack_status_lock, flags); - id = idr_alloc(&local->ack_status_frames, ack_skb, -- 1, 0x40, GFP_ATOMIC); -+ 1, 0x2000, GFP_ATOMIC); - spin_unlock_irqrestore(&local->ack_status_lock, flags); - - if (id >= 0) { diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index ca028dd833..151ca25d18 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3454,6 +3454,7 @@ struct cfg80211_update_owe_info { +@@ -3458,6 +3458,7 @@ struct cfg80211_update_owe_info { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @set_wds_peer: set the WDS peer for a WDS interface * -@@ -3769,6 +3770,7 @@ struct cfg80211_ops { +@@ -3773,6 +3774,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -36,9 +36,9 @@ u8 ps_dtim_period; --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h -@@ -2373,6 +2373,9 @@ enum nl80211_commands { - * the allowed channel bandwidth configurations. (u8 attribute) - * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. +@@ -2400,6 +2400,9 @@ enum nl80211_commands { + * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key + * (u16). * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. @@ -46,9 +46,9 @@ * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2835,6 +2838,8 @@ enum nl80211_attrs { - NL80211_ATTR_WIPHY_EDMG_CHANNELS, - NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, +@@ -2864,6 +2867,8 @@ enum nl80211_attrs { + + NL80211_ATTR_VLAN_ID, + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + @@ -129,15 +129,15 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -628,6 +628,7 @@ const struct nla_policy nl80211_policy[N - .len = SAE_PASSWORD_MAX_LEN }, +@@ -630,6 +630,7 @@ const struct nla_policy nl80211_policy[N [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG }, [NL80211_ATTR_HE_OBSS_PD] = NLA_POLICY_NESTED(he_obss_pd_policy), + [NL80211_ATTR_VLAN_ID] = NLA_POLICY_RANGE(NLA_U16, 1, VLAN_N_VID - 2), + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, }; /* policy for the key attributes */ -@@ -2992,6 +2993,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -2994,6 +2995,20 @@ static int nl80211_set_wiphy(struct sk_b if (result) return result; } diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch index 6b65f61846..57f05b711a 100644 --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch @@ -1,28 +1,75 @@ --- a/nl80211.h +++ b/nl80211.h -@@ -2373,6 +2373,9 @@ enum nl80211_commands { +@@ -249,6 +249,22 @@ + */ + + /** ++ * DOC: VLAN offload support for setting group keys and binding STAs to VLANs ++ * ++ * By setting @NL80211_EXT_FEATURE_VLAN_OFFLOAD flag drivers can indicate they ++ * support offloading VLAN functionality in a manner where the driver exposes a ++ * single netdev that uses VLAN tagged frames and separate VLAN-specific netdevs ++ * can then be added using RTM_NEWLINK/IFLA_VLAN_ID similarly to the Ethernet ++ * case. Frames received from stations that are not assigned to any VLAN are ++ * delivered on the main netdev and frames to such stations can be sent through ++ * that main netdev. ++ * ++ * %NL80211_CMD_NEW_KEY (for group keys), %NL80211_CMD_NEW_STATION, and ++ * %NL80211_CMD_SET_STATION will optionally specify vlan_id using ++ * %NL80211_ATTR_VLAN_ID. ++ */ ++ ++/** + * enum nl80211_commands - supported nl80211 commands + * + * @NL80211_CMD_UNSPEC: unspecified command to catch errors +@@ -571,6 +587,14 @@ + * set of BSSID,frequency parameters is used (i.e., either the enforcing + * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict + * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT). ++ * Driver shall not modify the IEs specified through %NL80211_ATTR_IE if ++ * %NL80211_ATTR_MAC is included. However, if %NL80211_ATTR_MAC_HINT is ++ * included, these IEs through %NL80211_ATTR_IE are specified by the user ++ * space based on the best possible BSS selected. Thus, if the driver ends ++ * up selecting a different BSS, it can modify these IEs accordingly (e.g. ++ * userspace asks the driver to perform PMKSA caching with BSS1 and the ++ * driver ends up selecting BSS2 with different PMKSA cache entry; RSNIE ++ * has to get updated with the apt PMKID). + * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within + * the ESS in case the device is already associated and an association with + * a different BSS is desired. +@@ -2373,6 +2397,12 @@ enum nl80211_commands { * the allowed channel bandwidth configurations. (u8 attribute) * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. * ++ * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key ++ * (u16). ++ * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2835,6 +2838,8 @@ enum nl80211_attrs { +@@ -2835,6 +2865,10 @@ enum nl80211_attrs { NL80211_ATTR_WIPHY_EDMG_CHANNELS, NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, ++ NL80211_ATTR_VLAN_ID, ++ + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, -@@ -5484,6 +5489,10 @@ enum nl80211_feature_flags { +@@ -5484,6 +5518,14 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in * station mode (SAE password is passed as part of the connect command). * ++ * @NL80211_EXT_FEATURE_VLAN_OFFLOAD: The driver supports a single netdev ++ * with VLAN tagged frames and separate VLAN-specific netdevs added using ++ * vconfig similarly to the Ethernet case. ++ * + * @NL80211_EXT_FEATURE_AQL: The driver supports the Airtime Queue Limit (AQL) + * feature, which prevents bufferbloat by using the expected transmission + * time to limit the amount of data buffered in the hardware. @@ -30,7 +77,7 @@ * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ -@@ -5529,6 +5538,8 @@ enum nl80211_ext_feature_index { +@@ -5529,6 +5571,8 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_EXT_KEY_ID, NL80211_EXT_FEATURE_STA_TX_PWR, NL80211_EXT_FEATURE_SAE_OFFLOAD, From 64f343a881a95fd82359eeb81651a2845a8a2dc4 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 18 Apr 2020 23:36:48 +0200 Subject: [PATCH 10/21] mac80211: Update to version 5.6.8-1 This updates the mac80211 backport. The removed patches are already integrated in the upstream version. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +- .../patches/ath/400-ath_move_debug_code.patch | 2 +- ...21-ath10k_init_devices_synchronously.patch | 2 +- ...h10k-increase-rx-buffer-size-to-2048.patch | 2 +- .../ath/930-ath10k_add_tpt_led_trigger.patch | 4 +- ...-of-peer_bw_rxnss_override-parameter.patch | 2 +- ...rolling-support-for-various-chipsets.patch | 30 +- ...75-ath10k-use-tpt-trigger-by-default.patch | 4 +- ...-interface-carrier-to-off-by-default.patch | 29 -- ...wo-D11-cores-if-chip-has-two-D11-cor.patch | 121 ------ ...-F2-blocksize-and-watermark-for-4359.patch | 79 ---- ...0003-brcmfmac-fix-rambase-for-4359-9.patch | 34 -- ...rors-when-setting-roaming-parameters.patch | 42 --- ...add-support-for-BCM4359-SDIO-chipset.patch | 75 ---- ...B-condition-when-setting-interface-c.patch | 130 ------- ...-mbss-in-vif-if-firmware-does-not-su.patch | 38 -- ...B-wake-interrupt-disabled-when-it-sh.patch | 66 ---- ...mac-use-true-false-for-bool-variable.patch | 27 -- ...lify-building-interface-combinations.patch | 103 ------ ...add-initial-support-for-monitor-mode.patch | 345 ------------------ ...-Remove-always-false-idx-0-statement.patch | 24 -- ...und-bug-with-some-inconsistent-BSSes.patch | 2 +- ...62-brcmfmac-Disable-power-management.patch | 2 +- .../mac80211/patches/brcm/998-survey.patch | 8 +- .../patches/build/060-no_local_ssb_bcma.patch | 4 +- .../602-rt2x00-introduce-rt2x00eeprom.patch | 8 +- ...c-loadable-via-OF-on-rt288x-305x-SoC.patch | 2 +- ...0-rt2x00-change-led-polarity-from-OF.patch | 2 +- .../611-rt2x00-add-AP+STA-support.patch | 2 +- ...dd-support-for-external-PA-on-MT7620.patch | 6 +- ...-rt2x00-add-rf-self-txdc-calibration.patch | 4 +- .../rt2x00/983-rt2x00-add-r-calibration.patch | 4 +- .../984-rt2x00-add-rxdcoc-calibration.patch | 4 +- .../985-rt2x00-add-rxiq-calibration.patch | 4 +- .../986-rt2x00-add-TX-LOFT-calibration.patch | 4 +- .../subsys/140-tweak-TSQ-setting.patch | 2 +- .../subsys/150-disable_addr_notifier.patch | 6 +- ...ate-debugfs-only-after-cfg80211-init.patch | 248 ------------- 38 files changed, 58 insertions(+), 1419 deletions(-) delete mode 100644 package/kernel/mac80211/patches/brcm/112-v5.6-brcmfmac-set-interface-carrier-to-off-by-default.patch delete mode 100644 package/kernel/mac80211/patches/brcm/114-v5.6-0001-brcmfmac-reset-two-D11-cores-if-chip-has-two-D11-cor.patch delete mode 100644 package/kernel/mac80211/patches/brcm/114-v5.6-0002-brcmfmac-set-F2-blocksize-and-watermark-for-4359.patch delete mode 100644 package/kernel/mac80211/patches/brcm/114-v5.6-0003-brcmfmac-fix-rambase-for-4359-9.patch delete mode 100644 package/kernel/mac80211/patches/brcm/114-v5.6-0004-brcmfmac-make-errors-when-setting-roaming-parameters.patch delete mode 100644 package/kernel/mac80211/patches/brcm/114-v5.6-0005-brcmfmac-add-support-for-BCM4359-SDIO-chipset.patch delete mode 100644 package/kernel/mac80211/patches/brcm/114-v5.6-0006-brcmfmac-add-RSDB-condition-when-setting-interface-c.patch delete mode 100644 package/kernel/mac80211/patches/brcm/114-v5.6-0007-brcmfmac-not-set-mbss-in-vif-if-firmware-does-not-su.patch delete mode 100644 package/kernel/mac80211/patches/brcm/116-v5.6-brcmfmac-Keep-OOB-wake-interrupt-disabled-when-it-sh.patch delete mode 100644 package/kernel/mac80211/patches/brcm/117-v5.6-brcmfmac-use-true-false-for-bool-variable.patch delete mode 100644 package/kernel/mac80211/patches/brcm/119-v5.6-0001-brcmfmac-simplify-building-interface-combinations.patch delete mode 100644 package/kernel/mac80211/patches/brcm/119-v5.6-0002-brcmfmac-add-initial-support-for-monitor-mode.patch delete mode 100644 package/kernel/mac80211/patches/brcm/120-v5.6-brcmfmac-Remove-always-false-idx-0-statement.patch delete mode 100644 package/kernel/mac80211/patches/subsys/250-mac80211-populate-debugfs-only-after-cfg80211-init.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index aedaac4d32..f85142bbe9 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.5.19-1 +PKG_VERSION:=5.6.8-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.5.19/ -PKG_HASH:=9dd9153df6082eaa079144193a3fab79d200942e1a2a1a80e032c9667b7b92a6 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.6.8/ +PKG_HASH:=547c5e17b9e23dd23cdf4d617a7550b80869e02114a7d404911c5ae928ae1da5 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch index e7df0e14be..db10c45104 100644 --- a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch +++ b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/Makefile +++ b/drivers/net/wireless/ath/Makefile -@@ -14,10 +14,10 @@ ath-objs := main.o \ +@@ -15,10 +15,10 @@ ath-objs := main.o \ regd.o \ hw.o \ key.o \ diff --git a/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch index 728c86effb..7409db7cfd 100644 --- a/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3105,6 +3105,16 @@ int ath10k_core_register(struct ath10k * +@@ -3094,6 +3094,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch b/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch index 55429139fa..a8ae3204d3 100644 --- a/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch +++ b/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch @@ -26,7 +26,7 @@ Forwarded: https://patchwork.kernel.org/patch/11367055/ --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h -@@ -2219,7 +2219,7 @@ struct htt_rx_chan_info { +@@ -2221,7 +2221,7 @@ struct htt_rx_chan_info { * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size, * rounded up to a cache line size. */ diff --git a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch index 6fe551f9d5..ae03951908 100644 --- a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -8761,6 +8761,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -8764,6 +8764,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -9088,6 +9103,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -9092,6 +9107,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch b/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch index 4d51205b5e..dbf30418e0 100644 --- a/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch +++ b/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch @@ -105,7 +105,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling } --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -7601,12 +7601,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a +@@ -7615,12 +7615,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf; ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg); diff --git a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index d72d515ad3..fb49ed036a 100644 --- a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -148,7 +148,7 @@ v13: .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -338,6 +341,7 @@ static const struct ath10k_hw_params ath +@@ -339,6 +342,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA99X0_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca99x0 hw2.0", @@ -156,7 +156,7 @@ v13: .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .otp_exe_param = 0x00000700, -@@ -379,6 +383,7 @@ static const struct ath10k_hw_params ath +@@ -380,6 +384,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9984_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9984/qca9994 hw1.0", @@ -164,7 +164,7 @@ v13: .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -427,6 +432,7 @@ static const struct ath10k_hw_params ath +@@ -428,6 +433,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9888_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9888 hw2.0", @@ -172,7 +172,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -2822,6 +2828,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -2811,6 +2817,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3078,9 +3088,18 @@ static void ath10k_core_register_work(st +@@ -3067,9 +3077,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -202,7 +202,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3126,6 +3145,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3115,6 +3134,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -221,7 +221,7 @@ v13: #include "htt.h" #include "htc.h" -@@ -1179,6 +1180,13 @@ struct ath10k { +@@ -1180,6 +1181,13 @@ struct ath10k { } testmode; struct { @@ -233,8 +233,8 @@ v13: + + struct { /* protected by data_lock */ + u32 rx_crc_err_drop; u32 fw_crash_counter; - u32 fw_warm_reset_counter; --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -517,6 +517,7 @@ struct ath10k_hw_params { @@ -456,7 +456,7 @@ v13: { --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c -@@ -4444,6 +4444,8 @@ static const struct wmi_ops wmi_tlv_ops +@@ -4447,6 +4447,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, @@ -467,7 +467,7 @@ v13: static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -7421,6 +7421,49 @@ ath10k_wmi_op_gen_peer_set_param(struct +@@ -7435,6 +7435,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -517,7 +517,7 @@ v13: static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -9078,6 +9121,9 @@ static const struct wmi_ops wmi_ops = { +@@ -9092,6 +9135,9 @@ static const struct wmi_ops wmi_ops = { .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -527,7 +527,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9148,6 +9194,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -9162,6 +9208,8 @@ static const struct wmi_ops wmi_10_1_ops .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -536,7 +536,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9220,6 +9268,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -9234,6 +9282,8 @@ static const struct wmi_ops wmi_10_2_ops .gen_delba_send = ath10k_wmi_op_gen_delba_send, .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, @@ -545,7 +545,7 @@ v13: /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -9291,6 +9341,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -9305,6 +9355,8 @@ static const struct wmi_ops wmi_10_2_4_o ath10k_wmi_op_gen_pdev_enable_adaptive_cca, .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, @@ -554,7 +554,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9371,6 +9423,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -9385,6 +9437,8 @@ static const struct wmi_ops wmi_10_4_ops .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, .gen_echo = ath10k_wmi_op_gen_echo, .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, diff --git a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch index 3973dc8cb3..80175367fe 100644 --- a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch @@ -16,7 +16,7 @@ Signed-off-by: Mathias Kresin --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -1228,6 +1228,10 @@ struct ath10k { +@@ -1230,6 +1230,10 @@ struct ath10k { struct ath10k_bus_params bus_param; struct completion peer_delete_done; @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -9120,7 +9120,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -9124,7 +9124,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/brcm/112-v5.6-brcmfmac-set-interface-carrier-to-off-by-default.patch b/package/kernel/mac80211/patches/brcm/112-v5.6-brcmfmac-set-interface-carrier-to-off-by-default.patch deleted file mode 100644 index bb4782a7a4..0000000000 --- a/package/kernel/mac80211/patches/brcm/112-v5.6-brcmfmac-set-interface-carrier-to-off-by-default.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8d9627b05b2c33e4468e65739eb7caf9c3f274d8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 10 Dec 2019 12:35:55 +0100 -Subject: [PATCH] brcmfmac: set interface carrier to off by default -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's important as brcmfmac creates one main interface for each PHY and -doesn't allow deleting it. Not setting carrier could result in other -subsystems misbehaving (e.g. LEDs "netdev" trigger turning LED on). - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -678,6 +678,8 @@ int brcmf_net_attach(struct brcmf_if *if - goto fail; - } - -+ netif_carrier_off(ndev); -+ - netdev_set_priv_destructor(ndev, brcmf_cfg80211_free_netdev); - brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name); - return 0; diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0001-brcmfmac-reset-two-D11-cores-if-chip-has-two-D11-cor.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0001-brcmfmac-reset-two-D11-cores-if-chip-has-two-D11-cor.patch deleted file mode 100644 index 19bf41ad9b..0000000000 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0001-brcmfmac-reset-two-D11-cores-if-chip-has-two-D11-cor.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 1b8d2e0a9e4221b99eea375c079507ce8ef655f5 Mon Sep 17 00:00:00 2001 -From: Wright Feng -Date: Thu, 12 Dec 2019 00:52:45 +0100 -Subject: [PATCH 1/7] brcmfmac: reset two D11 cores if chip has two D11 cores - -There are two D11 cores in RSDB chips like 4359. We have to reset two -D11 cores simutaneously before firmware download, or the firmware may -not be initialized correctly and cause "fw initialized failed" error. - -Signed-off-by: Wright Feng -Signed-off-by: Soeren Moch -Reviewed-by: Chi-Hsien Lin -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/chip.c | 50 +++++++++++++++++++ - .../broadcom/brcm80211/brcmfmac/chip.h | 1 + - .../broadcom/brcm80211/brcmfmac/pcie.c | 2 +- - 3 files changed, 52 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -@@ -433,11 +433,25 @@ static void brcmf_chip_ai_resetcore(stru - { - struct brcmf_chip_priv *ci; - int count; -+ struct brcmf_core *d11core2 = NULL; -+ struct brcmf_core_priv *d11priv2 = NULL; - - ci = core->chip; - -+ /* special handle two D11 cores reset */ -+ if (core->pub.id == BCMA_CORE_80211) { -+ d11core2 = brcmf_chip_get_d11core(&ci->pub, 1); -+ if (d11core2) { -+ brcmf_dbg(INFO, "found two d11 cores, reset both\n"); -+ d11priv2 = container_of(d11core2, -+ struct brcmf_core_priv, pub); -+ } -+ } -+ - /* must disable first to work for arbitrary current core state */ - brcmf_chip_ai_coredisable(core, prereset, reset); -+ if (d11priv2) -+ brcmf_chip_ai_coredisable(d11priv2, prereset, reset); - - count = 0; - while (ci->ops->read32(ci->ctx, core->wrapbase + BCMA_RESET_CTL) & -@@ -449,9 +463,30 @@ static void brcmf_chip_ai_resetcore(stru - usleep_range(40, 60); - } - -+ if (d11priv2) { -+ count = 0; -+ while (ci->ops->read32(ci->ctx, -+ d11priv2->wrapbase + BCMA_RESET_CTL) & -+ BCMA_RESET_CTL_RESET) { -+ ci->ops->write32(ci->ctx, -+ d11priv2->wrapbase + BCMA_RESET_CTL, -+ 0); -+ count++; -+ if (count > 50) -+ break; -+ usleep_range(40, 60); -+ } -+ } -+ - ci->ops->write32(ci->ctx, core->wrapbase + BCMA_IOCTL, - postreset | BCMA_IOCTL_CLK); - ci->ops->read32(ci->ctx, core->wrapbase + BCMA_IOCTL); -+ -+ if (d11priv2) { -+ ci->ops->write32(ci->ctx, d11priv2->wrapbase + BCMA_IOCTL, -+ postreset | BCMA_IOCTL_CLK); -+ ci->ops->read32(ci->ctx, d11priv2->wrapbase + BCMA_IOCTL); -+ } - } - - char *brcmf_chip_name(u32 id, u32 rev, char *buf, uint len) -@@ -1109,6 +1144,21 @@ void brcmf_chip_detach(struct brcmf_chip - kfree(chip); - } - -+struct brcmf_core *brcmf_chip_get_d11core(struct brcmf_chip *pub, u8 unit) -+{ -+ struct brcmf_chip_priv *chip; -+ struct brcmf_core_priv *core; -+ -+ chip = container_of(pub, struct brcmf_chip_priv, pub); -+ list_for_each_entry(core, &chip->cores, list) { -+ if (core->pub.id == BCMA_CORE_80211) { -+ if (unit-- == 0) -+ return &core->pub; -+ } -+ } -+ return NULL; -+} -+ - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *pub, u16 coreid) - { - struct brcmf_chip_priv *chip; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h -@@ -74,6 +74,7 @@ struct brcmf_chip *brcmf_chip_attach(voi - const struct brcmf_buscore_ops *ops); - void brcmf_chip_detach(struct brcmf_chip *chip); - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid); -+struct brcmf_core *brcmf_chip_get_d11core(struct brcmf_chip *pub, u8 unit); - struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip); - struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub); - bool brcmf_chip_iscoreup(struct brcmf_core *core); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -78,7 +78,7 @@ static const struct brcmf_firmware_mappi - BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), - }; - --#define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */ -+#define BRCMF_PCIE_FW_UP_TIMEOUT 5000 /* msec */ - - #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024) - diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0002-brcmfmac-set-F2-blocksize-and-watermark-for-4359.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0002-brcmfmac-set-F2-blocksize-and-watermark-for-4359.patch deleted file mode 100644 index 37ba7f360b..0000000000 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0002-brcmfmac-set-F2-blocksize-and-watermark-for-4359.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 172f6854551d48d1c9530f84513b421db944e714 Mon Sep 17 00:00:00 2001 -From: Chung-Hsien Hsu -Date: Thu, 12 Dec 2019 00:52:46 +0100 -Subject: [PATCH 2/7] brcmfmac: set F2 blocksize and watermark for 4359 - -Set F2 blocksize to 256 bytes and watermark to 0x40 for 4359. Also -enable and configure F1 MesBusyCtrl. It fixes DMA error while having -UDP bi-directional traffic. - -Signed-off-by: Chung-Hsien Hsu -[slightly adapted for rebase on mainline linux] -Signed-off-by: Soeren Moch -Reviewed-by: Chi-Hsien Lin -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 6 +++++- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 15 +++++++++++++++ - 2 files changed, 20 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -43,6 +43,7 @@ - - #define SDIO_FUNC1_BLOCKSIZE 64 - #define SDIO_FUNC2_BLOCKSIZE 512 -+#define SDIO_4359_FUNC2_BLOCKSIZE 256 - /* Maximum milliseconds to wait for F2 to come up */ - #define SDIO_WAIT_F2RDY 3000 - -@@ -903,6 +904,7 @@ static void brcmf_sdiod_host_fixup(struc - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) - { - int ret = 0; -+ unsigned int f2_blksz = SDIO_FUNC2_BLOCKSIZE; - - sdio_claim_host(sdiodev->func1); - -@@ -912,7 +914,9 @@ static int brcmf_sdiod_probe(struct brcm - sdio_release_host(sdiodev->func1); - goto out; - } -- ret = sdio_set_block_size(sdiodev->func2, SDIO_FUNC2_BLOCKSIZE); -+ if (sdiodev->func2->device == SDIO_DEVICE_ID_BROADCOM_4359) -+ f2_blksz = SDIO_4359_FUNC2_BLOCKSIZE; -+ ret = sdio_set_block_size(sdiodev->func2, f2_blksz); - if (ret) { - brcmf_err("Failed to set F2 blocksize\n"); - sdio_release_host(sdiodev->func1); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -42,6 +42,8 @@ - #define DEFAULT_F2_WATERMARK 0x8 - #define CY_4373_F2_WATERMARK 0x40 - #define CY_43012_F2_WATERMARK 0x60 -+#define CY_4359_F2_WATERMARK 0x40 -+#define CY_4359_F1_MESBUSYCTRL (CY_4359_F2_WATERMARK | SBSDIO_MESBUSYCTRL_ENAB) - - #ifdef DEBUG - -@@ -4208,6 +4210,19 @@ static void brcmf_sdio_firmware_callback - brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl, - &err); - break; -+ case SDIO_DEVICE_ID_BROADCOM_4359: -+ brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n", -+ CY_4359_F2_WATERMARK); -+ brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, -+ CY_4359_F2_WATERMARK, &err); -+ devctl = brcmf_sdiod_readb(sdiod, SBSDIO_DEVICE_CTL, -+ &err); -+ devctl |= SBSDIO_DEVCTL_F2WM_ENAB; -+ brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl, -+ &err); -+ brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_MESBUSYCTRL, -+ CY_4359_F1_MESBUSYCTRL, &err); -+ break; - default: - brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, - DEFAULT_F2_WATERMARK, &err); diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0003-brcmfmac-fix-rambase-for-4359-9.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0003-brcmfmac-fix-rambase-for-4359-9.patch deleted file mode 100644 index 7e4e32ffdd..0000000000 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0003-brcmfmac-fix-rambase-for-4359-9.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 6647274ed995a172369cb04754eb5f8b85f68f6d Mon Sep 17 00:00:00 2001 -From: Soeren Moch -Date: Thu, 12 Dec 2019 00:52:47 +0100 -Subject: [PATCH 3/7] brcmfmac: fix rambase for 4359/9 - -Newer 4359 chip revisions need a different rambase address. -This fixes firmware download on such devices which fails otherwise. - -Signed-off-by: Soeren Moch -Acked-by: Chi-Hsien Lin -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -@@ -712,7 +712,6 @@ static u32 brcmf_chip_tcm_rambase(struct - case BRCM_CC_43569_CHIP_ID: - case BRCM_CC_43570_CHIP_ID: - case BRCM_CC_4358_CHIP_ID: -- case BRCM_CC_4359_CHIP_ID: - case BRCM_CC_43602_CHIP_ID: - case BRCM_CC_4371_CHIP_ID: - return 0x180000; -@@ -722,6 +721,8 @@ static u32 brcmf_chip_tcm_rambase(struct - case BRCM_CC_4366_CHIP_ID: - case BRCM_CC_43664_CHIP_ID: - return 0x200000; -+ case BRCM_CC_4359_CHIP_ID: -+ return (ci->pub.chiprev < 9) ? 0x180000 : 0x160000; - case CY_CC_4373_CHIP_ID: - return 0x160000; - default: diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0004-brcmfmac-make-errors-when-setting-roaming-parameters.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0004-brcmfmac-make-errors-when-setting-roaming-parameters.patch deleted file mode 100644 index 76138fbc68..0000000000 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0004-brcmfmac-make-errors-when-setting-roaming-parameters.patch +++ /dev/null @@ -1,42 +0,0 @@ -From c12c8913d79c49ceccb38f42714d25b783833758 Mon Sep 17 00:00:00 2001 -From: Soeren Moch -Date: Thu, 12 Dec 2019 00:52:48 +0100 -Subject: [PATCH 4/7] brcmfmac: make errors when setting roaming parameters - non-fatal - -4359 dongles do not support setting roaming parameters (error -52). -Do not fail the 80211 configuration in this case. - -Signed-off-by: Soeren Moch -Acked-by: Chi-Hsien Lin -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6012,19 +6012,17 @@ static s32 brcmf_dongle_roam(struct brcm - roamtrigger[1] = cpu_to_le32(BRCM_BAND_ALL); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER, - (void *)roamtrigger, sizeof(roamtrigger)); -- if (err) { -+ if (err) - bphy_err(drvr, "WLC_SET_ROAM_TRIGGER error (%d)\n", err); -- goto roam_setup_done; -- } - - roam_delta[0] = cpu_to_le32(WL_ROAM_DELTA); - roam_delta[1] = cpu_to_le32(BRCM_BAND_ALL); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA, - (void *)roam_delta, sizeof(roam_delta)); -- if (err) { -+ if (err) - bphy_err(drvr, "WLC_SET_ROAM_DELTA error (%d)\n", err); -- goto roam_setup_done; -- } -+ -+ return 0; - - roam_setup_done: - return err; diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0005-brcmfmac-add-support-for-BCM4359-SDIO-chipset.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0005-brcmfmac-add-support-for-BCM4359-SDIO-chipset.patch deleted file mode 100644 index 0001fb17a7..0000000000 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0005-brcmfmac-add-support-for-BCM4359-SDIO-chipset.patch +++ /dev/null @@ -1,75 +0,0 @@ -From d4aef159394d5940bd7158ab789969dab82f7c76 Mon Sep 17 00:00:00 2001 -From: Soeren Moch -Date: Thu, 12 Dec 2019 00:52:49 +0100 -Subject: [PATCH 5/7] brcmfmac: add support for BCM4359 SDIO chipset - -BCM4359 is a 2x2 802.11 abgn+ac Dual-Band HT80 combo chip and it -supports Real Simultaneous Dual Band feature. - -Based on a similar patch by: Wright Feng - -Signed-off-by: Soeren Moch -Acked-by: Chi-Hsien Lin -Acked-by: Ulf Hansson -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 ++ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 1 + - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++ - include/linux/mmc/sdio_ids.h | 2 ++ - 4 files changed, 7 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -973,8 +973,10 @@ static const struct sdio_device_id brcmf - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43455), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356), -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4359), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_CYPRESS_4373), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_CYPRESS_43012), -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_CYPRESS_89359), - { /* end: all zeroes */ } - }; - MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -@@ -1408,6 +1408,7 @@ bool brcmf_chip_sr_capable(struct brcmf_ - addr = CORE_CC_REG(base, sr_control0); - reg = chip->ops->read32(chip->ctx, addr); - return (reg & CC_SR_CTL0_ENABLE_MASK) != 0; -+ case BRCM_CC_4359_CHIP_ID: - case CY_CC_43012_CHIP_ID: - addr = CORE_CC_REG(pmu->base, retention_ctl); - reg = chip->ops->read32(chip->ctx, addr); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -616,6 +616,7 @@ BRCMF_FW_DEF(43455, "brcmfmac43455-sdio" - BRCMF_FW_DEF(43456, "brcmfmac43456-sdio"); - BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); - BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); -+BRCMF_FW_DEF(4359, "brcmfmac4359-sdio"); - BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); - BRCMF_FW_DEF(43012, "brcmfmac43012-sdio"); - -@@ -638,6 +639,7 @@ static const struct brcmf_firmware_mappi - BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFDC0, 43455), - BRCMF_FW_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354), - BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), -+ BRCMF_FW_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359), - BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373), - BRCMF_FW_ENTRY(CY_CC_43012_CHIP_ID, 0xFFFFFFFF, 43012) - }; ---- a/include/linux/mmc/sdio_ids.h -+++ b/include/linux/mmc/sdio_ids.h -@@ -41,8 +41,10 @@ - #define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354 - #define SDIO_DEVICE_ID_BROADCOM_4356 0x4356 -+#define SDIO_DEVICE_ID_BROADCOM_4359 0x4359 - #define SDIO_DEVICE_ID_CYPRESS_4373 0x4373 - #define SDIO_DEVICE_ID_CYPRESS_43012 43012 -+#define SDIO_DEVICE_ID_CYPRESS_89359 0x4355 - - #define SDIO_VENDOR_ID_INTEL 0x0089 - #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402 diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0006-brcmfmac-add-RSDB-condition-when-setting-interface-c.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0006-brcmfmac-add-RSDB-condition-when-setting-interface-c.patch deleted file mode 100644 index 09059defe5..0000000000 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0006-brcmfmac-add-RSDB-condition-when-setting-interface-c.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 837482e69a3f0d7cbc73922020012f83635f5ddb Mon Sep 17 00:00:00 2001 -From: Wright Feng -Date: Thu, 12 Dec 2019 00:52:50 +0100 -Subject: [PATCH 6/7] brcmfmac: add RSDB condition when setting interface - combinations - -With firmware RSDB feature -1. The maximum support interface is four. -2. The maximum difference channel is two. -3. The maximum interfaces of {station/p2p client/AP} are two. -4. The maximum interface of p2p device is one. - -Signed-off-by: Wright Feng -Signed-off-by: Soeren Moch -Reviewed-by: Chi-Hsien Lin -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 54 ++++++++++++++++--- - 1 file changed, 46 insertions(+), 8 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6520,6 +6520,9 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = - * #STA <= 1, #AP <= 1, channels = 1, 2 total - * #AP <= 4, matching BI, channels = 1, 4 total - * -+ * no p2p and rsdb: -+ * #STA <= 2, #AP <= 2, channels = 2, 4 total -+ * - * p2p, no mchan, and mbss: - * - * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total -@@ -6531,6 +6534,10 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = - * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total - * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total - * #AP <= 4, matching BI, channels = 1, 4 total -+ * -+ * p2p, rsdb, and no mbss: -+ * #STA <= 2, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 2, AP <= 2, -+ * channels = 2, 4 total - */ - static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) - { -@@ -6538,13 +6545,14 @@ static int brcmf_setup_ifmodes(struct wi - struct ieee80211_iface_limit *c0_limits = NULL; - struct ieee80211_iface_limit *p2p_limits = NULL; - struct ieee80211_iface_limit *mbss_limits = NULL; -- bool mbss, p2p; -+ bool mbss, p2p, rsdb; - int i, c, n_combos; - - mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS); - p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P); -+ rsdb = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB); - -- n_combos = 1 + !!p2p + !!mbss; -+ n_combos = 1 + !!(p2p && !rsdb) + !!mbss; - combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL); - if (!combo) - goto err; -@@ -6555,16 +6563,36 @@ static int brcmf_setup_ifmodes(struct wi - - c = 0; - i = 0; -- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL); -+ if (p2p && rsdb) -+ c0_limits = kcalloc(4, sizeof(*c0_limits), GFP_KERNEL); -+ else if (p2p) -+ c0_limits = kcalloc(3, sizeof(*c0_limits), GFP_KERNEL); -+ else -+ c0_limits = kcalloc(2, sizeof(*c0_limits), GFP_KERNEL); - if (!c0_limits) - goto err; -- c0_limits[i].max = 1; -- c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); -- if (p2p) { -+ if (p2p && rsdb) { -+ combo[c].num_different_channels = 2; -+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | -+ BIT(NL80211_IFTYPE_P2P_GO) | -+ BIT(NL80211_IFTYPE_P2P_DEVICE); -+ c0_limits[i].max = 2; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); -+ c0_limits[i].max = 1; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE); -+ c0_limits[i].max = 2; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) | -+ BIT(NL80211_IFTYPE_P2P_GO); -+ c0_limits[i].max = 2; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP); -+ combo[c].max_interfaces = 5; -+ } else if (p2p) { - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN)) - combo[c].num_different_channels = 2; - else - combo[c].num_different_channels = 1; -+ c0_limits[i].max = 1; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); - wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_P2P_DEVICE); -@@ -6573,16 +6601,26 @@ static int brcmf_setup_ifmodes(struct wi - c0_limits[i].max = 1; - c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO); -+ combo[c].max_interfaces = i; -+ } else if (rsdb) { -+ combo[c].num_different_channels = 2; -+ c0_limits[i].max = 2; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); -+ c0_limits[i].max = 2; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP); -+ combo[c].max_interfaces = 3; - } else { - combo[c].num_different_channels = 1; - c0_limits[i].max = 1; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); -+ c0_limits[i].max = 1; - c0_limits[i++].types = BIT(NL80211_IFTYPE_AP); -+ combo[c].max_interfaces = i; - } -- combo[c].max_interfaces = i; - combo[c].n_limits = i; - combo[c].limits = c0_limits; - -- if (p2p) { -+ if (p2p && !rsdb) { - c++; - i = 0; - p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL); diff --git a/package/kernel/mac80211/patches/brcm/114-v5.6-0007-brcmfmac-not-set-mbss-in-vif-if-firmware-does-not-su.patch b/package/kernel/mac80211/patches/brcm/114-v5.6-0007-brcmfmac-not-set-mbss-in-vif-if-firmware-does-not-su.patch deleted file mode 100644 index 1870088bf6..0000000000 --- a/package/kernel/mac80211/patches/brcm/114-v5.6-0007-brcmfmac-not-set-mbss-in-vif-if-firmware-does-not-su.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 2635853ce4ab7654a77ab7080fb56de83408606b Mon Sep 17 00:00:00 2001 -From: Wright Feng -Date: Thu, 12 Dec 2019 00:52:51 +0100 -Subject: [PATCH 7/7] brcmfmac: not set mbss in vif if firmware does not - support MBSS - -With RSDB mode, FMAC and firmware are able to create 2 or more AP, -so we should not set mbss in vif structure if firmware does not -support MBSS feature. - -Signed-off-by: Wright Feng -Signed-off-by: Soeren Moch -Reviewed-by: Chi-Hsien Lin -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -5363,6 +5363,7 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v - struct brcmf_cfg80211_vif *vif_walk; - struct brcmf_cfg80211_vif *vif; - bool mbss; -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); - - brcmf_dbg(TRACE, "allocating virtual interface (size=%zu)\n", - sizeof(*vif)); -@@ -5375,7 +5376,8 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v - - brcmf_init_prof(&vif->profile); - -- if (type == NL80211_IFTYPE_AP) { -+ if (type == NL80211_IFTYPE_AP && -+ brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) { - mbss = false; - list_for_each_entry(vif_walk, &cfg->vif_list, list) { - if (vif_walk->wdev.iftype == NL80211_IFTYPE_AP) { diff --git a/package/kernel/mac80211/patches/brcm/116-v5.6-brcmfmac-Keep-OOB-wake-interrupt-disabled-when-it-sh.patch b/package/kernel/mac80211/patches/brcm/116-v5.6-brcmfmac-Keep-OOB-wake-interrupt-disabled-when-it-sh.patch deleted file mode 100644 index f579e16a7f..0000000000 --- a/package/kernel/mac80211/patches/brcm/116-v5.6-brcmfmac-Keep-OOB-wake-interrupt-disabled-when-it-sh.patch +++ /dev/null @@ -1,66 +0,0 @@ -From a32de68edab7b73ded850bcf76cdf6858e92a7e5 Mon Sep 17 00:00:00 2001 -From: Dmitry Osipenko -Date: Sun, 15 Dec 2019 21:42:24 +0300 -Subject: [PATCH] brcmfmac: Keep OOB wake-interrupt disabled when it shouldn't - be enabled - -NVIDIA Tegra SoCs do not like when OOB wake is enabled and WiFi interface -is in DOWN state during suspend. This results in a CPU hang on programming -OOB wake-up state of the GPIO controller during of system's suspend. - -The solution is trivial: don't enable wake for the OOB interrupt when it -should be disabled. - -This fixes hang on Tegra20 (Acer A500) and Tegra30 (Nexus 7) devices which -are using BCM4329 and BCM4330 WiFi chips respectively. - -Signed-off-by: Dmitry Osipenko -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 10 +++++----- - .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 1 - - 2 files changed, 5 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -120,7 +120,7 @@ int brcmf_sdiod_intr_register(struct brc - brcmf_err("enable_irq_wake failed %d\n", ret); - return ret; - } -- sdiodev->irq_wake = true; -+ disable_irq_wake(pdata->oob_irq_nr); - - sdio_claim_host(sdiodev->func1); - -@@ -179,10 +179,6 @@ void brcmf_sdiod_intr_unregister(struct - sdio_release_host(sdiodev->func1); - - sdiodev->oob_irq_requested = false; -- if (sdiodev->irq_wake) { -- disable_irq_wake(pdata->oob_irq_nr); -- sdiodev->irq_wake = false; -- } - free_irq(pdata->oob_irq_nr, &sdiodev->func1->dev); - sdiodev->irq_en = false; - sdiodev->oob_irq_requested = false; -@@ -1173,6 +1169,10 @@ static int brcmf_ops_sdio_resume(struct - if (ret) - brcmf_err("Failed to probe device on resume\n"); - } else { -+ if (sdiodev->wowl_enabled && -+ sdiodev->settings->bus.sdio.oob_irq_supported) -+ disable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr); -+ - brcmf_sdiod_freezer_off(sdiodev); - } - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -178,7 +178,6 @@ struct brcmf_sdio_dev { - bool sd_irq_requested; - bool irq_en; /* irq enable flags */ - spinlock_t irq_en_lock; -- bool irq_wake; /* irq wake enable flags */ - bool sg_support; - uint max_request_size; - ushort max_segment_count; diff --git a/package/kernel/mac80211/patches/brcm/117-v5.6-brcmfmac-use-true-false-for-bool-variable.patch b/package/kernel/mac80211/patches/brcm/117-v5.6-brcmfmac-use-true-false-for-bool-variable.patch deleted file mode 100644 index 0eb169c2d3..0000000000 --- a/package/kernel/mac80211/patches/brcm/117-v5.6-brcmfmac-use-true-false-for-bool-variable.patch +++ /dev/null @@ -1,27 +0,0 @@ -From b92c017deda819e45a0f054f6df6b53e645d7fe4 Mon Sep 17 00:00:00 2001 -From: zhengbin -Date: Tue, 24 Dec 2019 22:16:06 +0800 -Subject: [PATCH] brcmfmac: use true,false for bool variable - -Fixes coccicheck warning: - -drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c:911:2-24: WARNING: Assignment of 0/1 to bool variable - -Reported-by: Hulk Robot -Signed-off-by: zhengbin -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -@@ -908,7 +908,7 @@ static u8 brcmf_fws_hdrpush(struct brcmf - wlh += wlh[1] + 2; - - if (entry->send_tim_signal) { -- entry->send_tim_signal = 0; -+ entry->send_tim_signal = false; - wlh[0] = BRCMF_FWS_TYPE_PENDING_TRAFFIC_BMP; - wlh[1] = BRCMF_FWS_TYPE_PENDING_TRAFFIC_BMP_LEN; - wlh[2] = entry->mac_handle; diff --git a/package/kernel/mac80211/patches/brcm/119-v5.6-0001-brcmfmac-simplify-building-interface-combinations.patch b/package/kernel/mac80211/patches/brcm/119-v5.6-0001-brcmfmac-simplify-building-interface-combinations.patch deleted file mode 100644 index 73fc17aa5a..0000000000 --- a/package/kernel/mac80211/patches/brcm/119-v5.6-0001-brcmfmac-simplify-building-interface-combinations.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 24332f8068ff6df7f16aefee45d514de1de4de80 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 26 Dec 2019 14:30:49 +0100 -Subject: [PATCH] brcmfmac: simplify building interface combinations -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Move similar/duplicated code out of combination specific code blocks. -This simplifies code a bit and allows adding more combinations later. -A list of combinations remains unchanged. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 43 ++++++------------- - 1 file changed, 14 insertions(+), 29 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6547,12 +6547,13 @@ static int brcmf_setup_ifmodes(struct wi - struct ieee80211_iface_limit *c0_limits = NULL; - struct ieee80211_iface_limit *p2p_limits = NULL; - struct ieee80211_iface_limit *mbss_limits = NULL; -- bool mbss, p2p, rsdb; -+ bool mbss, p2p, rsdb, mchan; - int i, c, n_combos; - - mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS); - p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P); - rsdb = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB); -+ mchan = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN); - - n_combos = 1 + !!(p2p && !rsdb) + !!mbss; - combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL); -@@ -6562,6 +6563,10 @@ static int brcmf_setup_ifmodes(struct wi - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP); -+ if (p2p) -+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | -+ BIT(NL80211_IFTYPE_P2P_GO) | -+ BIT(NL80211_IFTYPE_P2P_DEVICE); - - c = 0; - i = 0; -@@ -6573,48 +6578,28 @@ static int brcmf_setup_ifmodes(struct wi - c0_limits = kcalloc(2, sizeof(*c0_limits), GFP_KERNEL); - if (!c0_limits) - goto err; -- if (p2p && rsdb) { -- combo[c].num_different_channels = 2; -- wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | -- BIT(NL80211_IFTYPE_P2P_GO) | -- BIT(NL80211_IFTYPE_P2P_DEVICE); -- c0_limits[i].max = 2; -- c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); -+ -+ combo[c].num_different_channels = 1 + (rsdb || (p2p && mchan)); -+ c0_limits[i].max = 1 + rsdb; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); -+ if (p2p) { - c0_limits[i].max = 1; - c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE); -- c0_limits[i].max = 2; -+ c0_limits[i].max = 1 + rsdb; - c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO); -+ } -+ if (p2p && rsdb) { - c0_limits[i].max = 2; - c0_limits[i++].types = BIT(NL80211_IFTYPE_AP); - combo[c].max_interfaces = 5; - } else if (p2p) { -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN)) -- combo[c].num_different_channels = 2; -- else -- combo[c].num_different_channels = 1; -- c0_limits[i].max = 1; -- c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); -- wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | -- BIT(NL80211_IFTYPE_P2P_GO) | -- BIT(NL80211_IFTYPE_P2P_DEVICE); -- c0_limits[i].max = 1; -- c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE); -- c0_limits[i].max = 1; -- c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) | -- BIT(NL80211_IFTYPE_P2P_GO); - combo[c].max_interfaces = i; - } else if (rsdb) { -- combo[c].num_different_channels = 2; -- c0_limits[i].max = 2; -- c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); - c0_limits[i].max = 2; - c0_limits[i++].types = BIT(NL80211_IFTYPE_AP); - combo[c].max_interfaces = 3; - } else { -- combo[c].num_different_channels = 1; -- c0_limits[i].max = 1; -- c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); - c0_limits[i].max = 1; - c0_limits[i++].types = BIT(NL80211_IFTYPE_AP); - combo[c].max_interfaces = i; diff --git a/package/kernel/mac80211/patches/brcm/119-v5.6-0002-brcmfmac-add-initial-support-for-monitor-mode.patch b/package/kernel/mac80211/patches/brcm/119-v5.6-0002-brcmfmac-add-initial-support-for-monitor-mode.patch deleted file mode 100644 index 0682c0b0ea..0000000000 --- a/package/kernel/mac80211/patches/brcm/119-v5.6-0002-brcmfmac-add-initial-support-for-monitor-mode.patch +++ /dev/null @@ -1,345 +0,0 @@ -From 20f2c5fa3af060401c72e444999470a4cab641cf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 26 Dec 2019 14:30:50 +0100 -Subject: [PATCH] brcmfmac: add initial support for monitor mode -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Report monitor interface availability using cfg80211 and support it in -the add_virtual_intf() and del_virtual_intf() callbacks. This new -feature is conditional and depends on firmware flagging monitor packets. -Receiving monitor frames is already handled by the brcmf_netif_mon_rx(). - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 112 ++++++++++++++++-- - .../broadcom/brcm80211/brcmfmac/core.c | 68 ++++++++++- - .../broadcom/brcm80211/brcmfmac/core.h | 2 + - .../broadcom/brcm80211/brcmfmac/feature.c | 1 + - .../broadcom/brcm80211/brcmfmac/feature.h | 2 + - .../broadcom/brcm80211/brcmfmac/fwil.h | 2 + - 6 files changed, 174 insertions(+), 13 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -619,6 +620,82 @@ static bool brcmf_is_ibssmode(struct brc - return vif->wdev.iftype == NL80211_IFTYPE_ADHOC; - } - -+/** -+ * brcmf_mon_add_vif() - create monitor mode virtual interface -+ * -+ * @wiphy: wiphy device of new interface. -+ * @name: name of the new interface. -+ */ -+static struct wireless_dev *brcmf_mon_add_vif(struct wiphy *wiphy, -+ const char *name) -+{ -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); -+ struct brcmf_cfg80211_vif *vif; -+ struct net_device *ndev; -+ struct brcmf_if *ifp; -+ int err; -+ -+ if (cfg->pub->mon_if) { -+ err = -EEXIST; -+ goto err_out; -+ } -+ -+ vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_MONITOR); -+ if (IS_ERR(vif)) { -+ err = PTR_ERR(vif); -+ goto err_out; -+ } -+ -+ ndev = alloc_netdev(sizeof(*ifp), name, NET_NAME_UNKNOWN, ether_setup); -+ if (!ndev) { -+ err = -ENOMEM; -+ goto err_free_vif; -+ } -+ ndev->type = ARPHRD_IEEE80211_RADIOTAP; -+ ndev->ieee80211_ptr = &vif->wdev; -+ ndev->needs_free_netdev = true; -+ ndev->priv_destructor = brcmf_cfg80211_free_netdev; -+ SET_NETDEV_DEV(ndev, wiphy_dev(cfg->wiphy)); -+ -+ ifp = netdev_priv(ndev); -+ ifp->vif = vif; -+ ifp->ndev = ndev; -+ ifp->drvr = cfg->pub; -+ -+ vif->ifp = ifp; -+ vif->wdev.netdev = ndev; -+ -+ err = brcmf_net_mon_attach(ifp); -+ if (err) { -+ brcmf_err("Failed to attach %s device\n", ndev->name); -+ free_netdev(ndev); -+ goto err_free_vif; -+ } -+ -+ cfg->pub->mon_if = ifp; -+ -+ return &vif->wdev; -+ -+err_free_vif: -+ brcmf_free_vif(vif); -+err_out: -+ return ERR_PTR(err); -+} -+ -+static int brcmf_mon_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) -+{ -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); -+ struct net_device *ndev = wdev->netdev; -+ -+ ndev->netdev_ops->ndo_stop(ndev); -+ -+ brcmf_net_detach(ndev, true); -+ -+ cfg->pub->mon_if = NULL; -+ -+ return 0; -+} -+ - static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, - const char *name, - unsigned char name_assign_type, -@@ -641,9 +718,10 @@ static struct wireless_dev *brcmf_cfg802 - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_WDS: -- case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_MESH_POINT: - return ERR_PTR(-EOPNOTSUPP); -+ case NL80211_IFTYPE_MONITOR: -+ return brcmf_mon_add_vif(wiphy, name); - case NL80211_IFTYPE_AP: - wdev = brcmf_ap_add_vif(wiphy, name, params); - break; -@@ -826,9 +904,10 @@ int brcmf_cfg80211_del_iface(struct wiph - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_WDS: -- case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_MESH_POINT: - return -EOPNOTSUPP; -+ case NL80211_IFTYPE_MONITOR: -+ return brcmf_mon_del_vif(wiphy, wdev); - case NL80211_IFTYPE_AP: - return brcmf_cfg80211_del_ap_iface(wiphy, wdev); - case NL80211_IFTYPE_P2P_CLIENT: -@@ -6547,9 +6626,10 @@ static int brcmf_setup_ifmodes(struct wi - struct ieee80211_iface_limit *c0_limits = NULL; - struct ieee80211_iface_limit *p2p_limits = NULL; - struct ieee80211_iface_limit *mbss_limits = NULL; -- bool mbss, p2p, rsdb, mchan; -- int i, c, n_combos; -+ bool mon_flag, mbss, p2p, rsdb, mchan; -+ int i, c, n_combos, n_limits; - -+ mon_flag = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FLAG); - mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS); - p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P); - rsdb = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB); -@@ -6563,6 +6643,8 @@ static int brcmf_setup_ifmodes(struct wi - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP); -+ if (mon_flag) -+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); - if (p2p) - wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO) | -@@ -6570,18 +6652,18 @@ static int brcmf_setup_ifmodes(struct wi - - c = 0; - i = 0; -- if (p2p && rsdb) -- c0_limits = kcalloc(4, sizeof(*c0_limits), GFP_KERNEL); -- else if (p2p) -- c0_limits = kcalloc(3, sizeof(*c0_limits), GFP_KERNEL); -- else -- c0_limits = kcalloc(2, sizeof(*c0_limits), GFP_KERNEL); -+ n_limits = 1 + mon_flag + (p2p ? 2 : 0) + (rsdb || !p2p); -+ c0_limits = kcalloc(n_limits, sizeof(*c0_limits), GFP_KERNEL); - if (!c0_limits) - goto err; - - combo[c].num_different_channels = 1 + (rsdb || (p2p && mchan)); - c0_limits[i].max = 1 + rsdb; - c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); -+ if (mon_flag) { -+ c0_limits[i].max = 1; -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_MONITOR); -+ } - if (p2p) { - c0_limits[i].max = 1; - c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE); -@@ -6630,14 +6712,20 @@ static int brcmf_setup_ifmodes(struct wi - if (mbss) { - c++; - i = 0; -- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL); -+ n_limits = 1 + mon_flag; -+ mbss_limits = kcalloc(n_limits, sizeof(*mbss_limits), -+ GFP_KERNEL); - if (!mbss_limits) - goto err; - mbss_limits[i].max = 4; - mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP); -+ if (mon_flag) { -+ mbss_limits[i].max = 1; -+ mbss_limits[i++].types = BIT(NL80211_IFTYPE_MONITOR); -+ } - combo[c].beacon_int_infra_match = true; - combo[c].num_different_channels = 1; -- combo[c].max_interfaces = 4; -+ combo[c].max_interfaces = 4 + mon_flag; - combo[c].n_limits = i; - combo[c].limits = mbss_limits; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -690,7 +690,7 @@ fail: - return -EBADE; - } - --static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked) -+void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked) - { - if (ndev->reg_state == NETREG_REGISTERED) { - if (rtnl_locked) -@@ -703,6 +703,72 @@ static void brcmf_net_detach(struct net_ - } - } - -+static int brcmf_net_mon_open(struct net_device *ndev) -+{ -+ struct brcmf_if *ifp = netdev_priv(ndev); -+ struct brcmf_pub *drvr = ifp->drvr; -+ u32 monitor; -+ int err; -+ -+ brcmf_dbg(TRACE, "Enter\n"); -+ -+ err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_MONITOR, &monitor); -+ if (err) { -+ bphy_err(drvr, "BRCMF_C_GET_MONITOR error (%d)\n", err); -+ return err; -+ } else if (monitor) { -+ bphy_err(drvr, "Monitor mode is already enabled\n"); -+ return -EEXIST; -+ } -+ -+ monitor = 3; -+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_MONITOR, monitor); -+ if (err) -+ bphy_err(drvr, "BRCMF_C_SET_MONITOR error (%d)\n", err); -+ -+ return err; -+} -+ -+static int brcmf_net_mon_stop(struct net_device *ndev) -+{ -+ struct brcmf_if *ifp = netdev_priv(ndev); -+ struct brcmf_pub *drvr = ifp->drvr; -+ u32 monitor; -+ int err; -+ -+ brcmf_dbg(TRACE, "Enter\n"); -+ -+ monitor = 0; -+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_MONITOR, monitor); -+ if (err) -+ bphy_err(drvr, "BRCMF_C_SET_MONITOR error (%d)\n", err); -+ -+ return err; -+} -+ -+static const struct net_device_ops brcmf_netdev_ops_mon = { -+ .ndo_open = brcmf_net_mon_open, -+ .ndo_stop = brcmf_net_mon_stop, -+}; -+ -+int brcmf_net_mon_attach(struct brcmf_if *ifp) -+{ -+ struct brcmf_pub *drvr = ifp->drvr; -+ struct net_device *ndev; -+ int err; -+ -+ brcmf_dbg(TRACE, "Enter\n"); -+ -+ ndev = ifp->ndev; -+ ndev->netdev_ops = &brcmf_netdev_ops_mon; -+ -+ err = register_netdevice(ndev); -+ if (err) -+ bphy_err(drvr, "Failed to register %s device\n", ndev->name); -+ -+ return err; -+} -+ - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on) - { - struct net_device *ndev; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -210,6 +210,8 @@ void brcmf_txflowblock_if(struct brcmf_i - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success); - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb); - void brcmf_netif_mon_rx(struct brcmf_if *ifp, struct sk_buff *skb); -+void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked); -+int brcmf_net_mon_attach(struct brcmf_if *ifp); - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on); - int __init brcmf_core_init(void); - void __exit brcmf_core_exit(void); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -@@ -38,6 +38,7 @@ static const struct brcmf_feat_fwcap brc - { BRCMF_FEAT_MCHAN, "mchan" }, - { BRCMF_FEAT_P2P, "p2p" }, - { BRCMF_FEAT_MONITOR, "monitor" }, -+ { BRCMF_FEAT_MONITOR_FLAG, "rtap" }, - { BRCMF_FEAT_MONITOR_FMT_RADIOTAP, "rtap" }, - { BRCMF_FEAT_DOT11H, "802.11h" }, - { BRCMF_FEAT_SAE, "sae" }, ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h -@@ -23,6 +23,7 @@ - * GSCAN: enhanced scan offload feature. - * FWSUP: Firmware supplicant. - * MONITOR: firmware can pass monitor packets to host. -+ * MONITOR_FLAG: firmware flags monitor packets. - * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header - * MONITOR_FMT_HW_RX_HDR: firmware provides monitor packets with hw/ucode header - * DOT11H: firmware supports 802.11h -@@ -44,6 +45,7 @@ - BRCMF_FEAT_DEF(GSCAN) \ - BRCMF_FEAT_DEF(FWSUP) \ - BRCMF_FEAT_DEF(MONITOR) \ -+ BRCMF_FEAT_DEF(MONITOR_FLAG) \ - BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \ - BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) \ - BRCMF_FEAT_DEF(DOT11H) \ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h -@@ -49,6 +49,8 @@ - #define BRCMF_C_GET_PM 85 - #define BRCMF_C_SET_PM 86 - #define BRCMF_C_GET_REVINFO 98 -+#define BRCMF_C_GET_MONITOR 107 -+#define BRCMF_C_SET_MONITOR 108 - #define BRCMF_C_GET_CURR_RATESET 114 - #define BRCMF_C_GET_AP 117 - #define BRCMF_C_SET_AP 118 diff --git a/package/kernel/mac80211/patches/brcm/120-v5.6-brcmfmac-Remove-always-false-idx-0-statement.patch b/package/kernel/mac80211/patches/brcm/120-v5.6-brcmfmac-Remove-always-false-idx-0-statement.patch deleted file mode 100644 index 9efa762830..0000000000 --- a/package/kernel/mac80211/patches/brcm/120-v5.6-brcmfmac-Remove-always-false-idx-0-statement.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 627b0d094240c38393b2f2d40626c33a8fff6103 Mon Sep 17 00:00:00 2001 -From: yuehaibing -Date: Wed, 8 Jan 2020 21:57:48 +0800 -Subject: [PATCH] brcmfmac: Remove always false 'idx < 0' statement - -idx is declared as u32, it will never less than 0. - -Signed-off-by: yuehaibing -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -@@ -365,7 +365,7 @@ brcmf_msgbuf_get_pktid(struct device *de - struct brcmf_msgbuf_pktid *pktid; - struct sk_buff *skb; - -- if (idx < 0 || idx >= pktids->array_size) { -+ if (idx >= pktids->array_size) { - brcmf_err("Invalid packet id %d (max %d)\n", idx, - pktids->array_size); - return NULL; diff --git a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch index 37ebb5190b..81c170c43f 100644 --- a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch +++ b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -705,8 +705,36 @@ static struct wireless_dev *brcmf_cfg802 +@@ -711,8 +711,36 @@ static struct wireless_dev *brcmf_cfg802 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_pub *drvr = cfg->pub; struct wireless_dev *wdev; diff --git a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch index 905fd4b56e..8120af3293 100644 --- a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2936,6 +2936,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2942,6 +2942,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ diff --git a/package/kernel/mac80211/patches/brcm/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index b98cb0632c..6cc370571d 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2888,6 +2888,63 @@ done: +@@ -2894,6 +2894,63 @@ done: } static int @@ -64,7 +64,7 @@ brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev, int idx, u8 *mac, struct station_info *sinfo) { -@@ -2977,6 +3034,7 @@ static s32 brcmf_inform_single_bss(struc +@@ -2983,6 +3040,7 @@ static s32 brcmf_inform_single_bss(struc struct brcmu_chan ch; u16 channel; u32 freq; @@ -72,7 +72,7 @@ u16 notify_capability; u16 notify_interval; u8 *notify_ie; -@@ -3001,6 +3059,17 @@ static s32 brcmf_inform_single_bss(struc +@@ -3007,6 +3065,17 @@ static s32 brcmf_inform_single_bss(struc band = NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(channel, band); @@ -90,7 +90,7 @@ bss_data.chan = ieee80211_get_channel(wiphy, freq); bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); -@@ -5418,6 +5487,7 @@ static struct cfg80211_ops brcmf_cfg8021 +@@ -5424,6 +5493,7 @@ static struct cfg80211_ops brcmf_cfg8021 .leave_ibss = brcmf_cfg80211_leave_ibss, .get_station = brcmf_cfg80211_get_station, .dump_station = brcmf_cfg80211_dump_station, diff --git a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch index 290d254238..12f907dcb5 100644 --- a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch +++ b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -412,43 +412,6 @@ USB_SIERRA_NET= +@@ -416,43 +416,6 @@ USB_SIERRA_NET= USB_VL600= USB_NET_CH9200= USB_NET_AQC111= @@ -192,7 +192,7 @@ select BRCMUTIL --- a/Kconfig.local +++ b/Kconfig.local -@@ -1240,117 +1240,6 @@ config BACKPORTED_USB_NET_CH9200 +@@ -1252,117 +1252,6 @@ config BACKPORTED_USB_NET_CH9200 config BACKPORTED_USB_NET_AQC111 tristate default USB_NET_AQC111 diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch index 0c6e5a03b0..968adb71e2 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -313,6 +313,7 @@ RT2X00_LIB_FIRMWARE= +@@ -317,6 +317,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= @@ -95,7 +95,7 @@ /* Firmware functions */ static char *rt2800soc_get_firmware_name(struct rt2x00_dev *rt2x00dev) { -@@ -166,7 +153,6 @@ static const struct rt2800_ops rt2800soc +@@ -167,7 +154,6 @@ static const struct rt2800_ops rt2800soc .register_multiread = rt2x00mmio_register_multiread, .register_multiwrite = rt2x00mmio_register_multiwrite, .regbusy_read = rt2x00mmio_regbusy_read, @@ -127,7 +127,7 @@ DECLARE_KFIFO_PTR(txstatus_fifo, u32); --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1418,6 +1418,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de +@@ -1407,6 +1407,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); @@ -138,7 +138,7 @@ /* * Let the driver probe the device to detect the capabilities. */ -@@ -1561,6 +1565,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ +@@ -1550,6 +1554,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ * Free the driver data. */ kfree(rt2x00dev->drv_data); diff --git a/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch b/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch index 35714c04d2..38f8b77176 100644 --- a/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch +++ b/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -@@ -223,10 +223,17 @@ static int rt2800soc_probe(struct platfo +@@ -224,10 +224,17 @@ static int rt2800soc_probe(struct platfo return rt2x00soc_probe(pdev, &rt2800soc_ops); } diff --git a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch index fb6647350e..5f60b60d95 100644 --- a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch +++ b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch @@ -8,7 +8,7 @@ #include "rt2x00.h" #include "rt2800lib.h" -@@ -9531,6 +9532,17 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9528,6 +9529,17 @@ static int rt2800_init_eeprom(struct rt2 rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); diff --git a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch index d909a2e6c6..15f46fc98a 100644 --- a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch +++ b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1356,7 +1356,7 @@ static inline void rt2x00lib_set_if_comb +@@ -1345,7 +1345,7 @@ static inline void rt2x00lib_set_if_comb */ if_limit = &rt2x00dev->if_limits_ap; if_limit->max = rt2x00dev->ops->max_ap_intf; diff --git a/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch index df234fe0df..88ce5ec529 100644 --- a/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch @@ -30,7 +30,7 @@ Signed-off-by: Tomislav Po=C5=BEega * EEPROM LNA --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4359,6 +4359,45 @@ static void rt2800_config_channel(struct +@@ -4356,6 +4356,45 @@ static void rt2800_config_channel(struct rt2800_iq_calibrate(rt2x00dev, rf->channel); } @@ -76,7 +76,7 @@ Signed-off-by: Tomislav Po=C5=BEega bbp = rt2800_bbp_read(rt2x00dev, 4); rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); rt2800_bbp_write(rt2x00dev, 4, bbp); -@@ -9560,7 +9599,8 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9557,7 +9596,8 @@ static int rt2800_init_eeprom(struct rt2 */ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); @@ -86,7 +86,7 @@ Signed-off-by: Tomislav Po=C5=BEega if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) __set_bit(CAPABILITY_EXTERNAL_PA_TX0, -@@ -9571,6 +9611,18 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9568,6 +9608,18 @@ static int rt2800_init_eeprom(struct rt2 &rt2x00dev->cap_flags); } diff --git a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch index 4addb8e545..6be847478e 100644 --- a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8422,6 +8422,56 @@ static void rt2800_init_rfcsr_5592(struc +@@ -8419,6 +8419,56 @@ static void rt2800_init_rfcsr_5592(struc rt2800_led_open_drain_enable(rt2x00dev); } @@ -57,7 +57,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9029,6 +9079,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9026,6 +9076,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch index 8041580411..3ed0ff7ef5 100644 --- a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8472,6 +8472,155 @@ static void rt2800_rf_self_txdc_cal(stru +@@ -8469,6 +8469,155 @@ static void rt2800_rf_self_txdc_cal(stru rt2x00_info(rt2x00dev, "RF Tx self calibration end\n"); } @@ -156,7 +156,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9079,6 +9228,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9076,6 +9225,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch index 89a4ccb961..77be986d18 100644 --- a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8621,6 +8621,70 @@ static void rt2800_r_calibration(struct +@@ -8618,6 +8618,70 @@ static void rt2800_r_calibration(struct rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); } @@ -71,7 +71,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9230,6 +9294,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9227,6 +9291,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); diff --git a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch index 9a03efdef8..7352ad036c 100644 --- a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8685,6 +8685,384 @@ static void rt2800_rxdcoc_calibration(st +@@ -8682,6 +8682,384 @@ static void rt2800_rxdcoc_calibration(st rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); } @@ -385,7 +385,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9297,6 +9675,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9294,6 +9672,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch index fc5e4ca5d7..fe0961baa7 100644 --- a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9063,6 +9063,943 @@ restore_value: +@@ -9060,6 +9060,943 @@ restore_value: rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); } @@ -944,7 +944,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9675,6 +10612,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9672,6 +10609,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch index 3b89013d3c..668064cfa8 100644 --- a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch +++ b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4116,6 +4116,12 @@ out: +@@ -4113,6 +4113,12 @@ out: netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev) { diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index 428c1892d5..ebc1ef489e 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -18,7 +18,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1272,14 +1272,14 @@ int ieee80211_register_hw(struct ieee802 +@@ -1273,14 +1273,14 @@ int ieee80211_register_hw(struct ieee802 rtnl_unlock(); @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1288,13 +1288,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1289,13 +1289,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1322,10 +1322,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1323,10 +1323,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/250-mac80211-populate-debugfs-only-after-cfg80211-init.patch b/package/kernel/mac80211/patches/subsys/250-mac80211-populate-debugfs-only-after-cfg80211-init.patch deleted file mode 100644 index efe216c530..0000000000 --- a/package/kernel/mac80211/patches/subsys/250-mac80211-populate-debugfs-only-after-cfg80211-init.patch +++ /dev/null @@ -1,248 +0,0 @@ -From 6cb5f3ea4654faf8c28b901266e960b1a4787b26 Mon Sep 17 00:00:00 2001 -From: Johannes Berg -Date: Thu, 23 Apr 2020 11:13:49 +0200 -Subject: [PATCH] mac80211: populate debugfs only after cfg80211 init - -When fixing the initialization race, we neglected to account for -the fact that debugfs is initialized in wiphy_register(), and -some debugfs things went missing (or rather were rerooted to the -global debugfs root). - -Fix this by adding debugfs entries only after wiphy_register(). -This requires some changes in the rate control code since it -currently adds debugfs at alloc time, which can no longer be -done after the reordering. - -Reported-by: Jouni Malinen -Reported-by: kernel test robot -Reported-by: Hauke Mehrtens -Reported-by: Felix Fietkau -Cc: stable@vger.kernel.org -Fixes: 52e04b4ce5d0 ("mac80211: fix race in ieee80211_register_hw()") -Signed-off-by: Johannes Berg -Acked-by: Sumit Garg -Link: https://lore.kernel.org/r/20200423111344.0e00d3346f12.Iadc76a03a55093d94391fc672e996a458702875d@changeid -Signed-off-by: Johannes Berg ---- - drivers/net/wireless/intel/iwlegacy/3945-rs.c | 2 +- - drivers/net/wireless/intel/iwlegacy/4965-rs.c | 2 +- - drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 2 +- - drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 2 +- - drivers/net/wireless/realtek/rtlwifi/rc.c | 2 +- - include/net/mac80211.h | 4 +++- - net/mac80211/main.c | 5 ++-- - net/mac80211/rate.c | 15 ++++-------- - net/mac80211/rate.h | 23 +++++++++++++++++++ - net/mac80211/rc80211_minstrel_ht.c | 19 ++++++++++----- - 10 files changed, 51 insertions(+), 25 deletions(-) - ---- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c -+++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c -@@ -374,7 +374,7 @@ out: - } - - static void * --il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -+il3945_rs_alloc(struct ieee80211_hw *hw) - { - return hw->priv; - } ---- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c -+++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c -@@ -2474,7 +2474,7 @@ il4965_rs_fill_link_cmd(struct il_priv * - } - - static void * --il4965_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -+il4965_rs_alloc(struct ieee80211_hw *hw) - { - return hw->priv; - } ---- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c -+++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c -@@ -3019,7 +3019,7 @@ static void rs_fill_link_cmd(struct iwl_ - cpu_to_le16(priv->lib->bt_params->agg_time_limit); - } - --static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -+static void *rs_alloc(struct ieee80211_hw *hw) - { - return hw->priv; - } ---- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c -@@ -3665,7 +3665,7 @@ static void rs_fill_lq_cmd(struct iwl_mv - cpu_to_le16(iwl_mvm_coex_agg_time_limit(mvm, sta)); - } - --static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -+static void *rs_alloc(struct ieee80211_hw *hw) - { - return hw->priv; - } ---- a/drivers/net/wireless/realtek/rtlwifi/rc.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rc.c -@@ -261,7 +261,7 @@ static void rtl_rate_update(void *ppriv, - { - } - --static void *rtl_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -+static void *rtl_rate_alloc(struct ieee80211_hw *hw) - { - struct rtl_priv *rtlpriv = rtl_priv(hw); - return rtlpriv; ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -5969,7 +5969,9 @@ enum rate_control_capabilities { - struct rate_control_ops { - unsigned long capa; - const char *name; -- void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); -+ void *(*alloc)(struct ieee80211_hw *hw); -+ void (*add_debugfs)(struct ieee80211_hw *hw, void *priv, -+ struct dentry *debugfsdir); - void (*free)(void *priv); - - void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -1163,8 +1163,6 @@ int ieee80211_register_hw(struct ieee802 - local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, - IEEE80211_TX_STATUS_HEADROOM); - -- debugfs_hw_add(local); -- - /* - * if the driver doesn't specify a max listen interval we - * use 5 which should be a safe default -@@ -1256,6 +1254,9 @@ int ieee80211_register_hw(struct ieee802 - if (result < 0) - goto fail_wiphy_register; - -+ debugfs_hw_add(local); -+ rate_control_add_debugfs(local); -+ - rtnl_lock(); - - /* add one default STA interface if supported */ ---- a/net/mac80211/rate.c -+++ b/net/mac80211/rate.c -@@ -214,17 +214,16 @@ static ssize_t rcname_read(struct file * - ref->ops->name, len); - } - --static const struct file_operations rcname_ops = { -+const struct file_operations rcname_ops = { - .read = rcname_read, - .open = simple_open, - .llseek = default_llseek, - }; - #endif - --static struct rate_control_ref *rate_control_alloc(const char *name, -- struct ieee80211_local *local) -+static struct rate_control_ref * -+rate_control_alloc(const char *name, struct ieee80211_local *local) - { -- struct dentry *debugfsdir = NULL; - struct rate_control_ref *ref; - - ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); -@@ -234,13 +233,7 @@ static struct rate_control_ref *rate_con - if (!ref->ops) - goto free; - --#ifdef CPTCFG_MAC80211_DEBUGFS -- debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); -- local->debugfs.rcdir = debugfsdir; -- debugfs_create_file("name", 0400, debugfsdir, ref, &rcname_ops); --#endif -- -- ref->priv = ref->ops->alloc(&local->hw, debugfsdir); -+ ref->priv = ref->ops->alloc(&local->hw); - if (!ref->priv) - goto free; - return ref; ---- a/net/mac80211/rate.h -+++ b/net/mac80211/rate.h -@@ -60,6 +60,29 @@ static inline void rate_control_add_sta_ - #endif - } - -+extern const struct file_operations rcname_ops; -+ -+static inline void rate_control_add_debugfs(struct ieee80211_local *local) -+{ -+#ifdef CPTCFG_MAC80211_DEBUGFS -+ struct dentry *debugfsdir; -+ -+ if (!local->rate_ctrl) -+ return; -+ -+ if (!local->rate_ctrl->ops->add_debugfs) -+ return; -+ -+ debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); -+ local->debugfs.rcdir = debugfsdir; -+ debugfs_create_file("name", 0400, debugfsdir, -+ local->rate_ctrl, &rcname_ops); -+ -+ local->rate_ctrl->ops->add_debugfs(&local->hw, local->rate_ctrl->priv, -+ debugfsdir); -+#endif -+} -+ - void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata); - - /* Get a reference to the rate control algorithm. If `name' is NULL, get the ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1635,7 +1635,7 @@ minstrel_ht_init_cck_rates(struct minstr - } - - static void * --minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -+minstrel_ht_alloc(struct ieee80211_hw *hw) - { - struct minstrel_priv *mp; - -@@ -1673,7 +1673,17 @@ minstrel_ht_alloc(struct ieee80211_hw *h - mp->update_interval = HZ / 10; - mp->new_avg = true; - -+ minstrel_ht_init_cck_rates(mp); -+ -+ return mp; -+} -+ - #ifdef CPTCFG_MAC80211_DEBUGFS -+static void minstrel_ht_add_debugfs(struct ieee80211_hw *hw, void *priv, -+ struct dentry *debugfsdir) -+{ -+ struct minstrel_priv *mp = priv; -+ - mp->fixed_rate_idx = (u32) -1; - debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, - &mp->fixed_rate_idx); -@@ -1681,12 +1691,8 @@ minstrel_ht_alloc(struct ieee80211_hw *h - &mp->sample_switch); - debugfs_create_bool("new_avg", S_IRUGO | S_IWUSR, debugfsdir, - &mp->new_avg); --#endif -- -- minstrel_ht_init_cck_rates(mp); -- -- return mp; - } -+#endif - - static void - minstrel_ht_free(void *priv) -@@ -1725,6 +1731,7 @@ static const struct rate_control_ops mac - .alloc = minstrel_ht_alloc, - .free = minstrel_ht_free, - #ifdef CPTCFG_MAC80211_DEBUGFS -+ .add_debugfs = minstrel_ht_add_debugfs, - .add_sta_debugfs = minstrel_ht_add_sta_debugfs, - #endif - .get_expected_throughput = minstrel_ht_get_expected_throughput, From 289c6324259e46a35885af112dff5588c866a5a3 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 20 Apr 2020 00:33:55 +0200 Subject: [PATCH 11/21] mac80211: Update to version 5.7-rc3-1 This updates the mac80211 backport. The removed patches are already integrated in the upstream version. The 131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch patch was manually adapted to the changes in kernel 5.7. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +- .../patches/ath/404-regd_no_assoc_hints.patch | 4 +- ...21-ath10k_init_devices_synchronously.patch | 2 +- .../ath/930-ath10k_add_tpt_led_trigger.patch | 4 +- ...-of-peer_bw_rxnss_override-parameter.patch | 10 +- ...dling-for-VHT160-in-recent-firmwares.patch | 2 +- ...rolling-support-for-various-chipsets.patch | 22 +- ...75-ath10k-use-tpt-trigger-by-default.patch | 8 +- ...980-ath10k-fix-max-antenna-gain-unit.patch | 6 +- ...-power-reduction-for-US-regulatory-d.patch | 8 +- ...-add-stub-for-monitor-interface-xmit.patch | 100 ----- .../patches/build/060-no_local_ssb_bcma.patch | 4 +- .../602-rt2x00-introduce-rt2x00eeprom.patch | 2 +- .../100-remove-cryptoapi-dependencies.patch | 2 +- .../110-mac80211_keep_keys_on_stop_ap.patch | 2 +- .../patches/subsys/130-disable-fils.patch | 2 +- ...aes-cmac-switch-to-shash-CMAC-driver.patch | 99 +++-- .../subsys/140-tweak-TSQ-setting.patch | 2 +- .../subsys/150-disable_addr_notifier.patch | 10 +- .../300-mac80211-optimize-skb-resizing.patch | 14 +- ...domize-BA-session-dialog-token-alloc.patch | 2 +- ...80211-fix-tx-status-for-no-ack-cases.patch | 82 ---- .../500-mac80211_configure_antenna_gain.patch | 38 +- .../utils/iw/patches/001-nl80211_h_sync.patch | 377 +++++++++++++++++- 24 files changed, 511 insertions(+), 297 deletions(-) delete mode 100644 package/kernel/mac80211/patches/brcm/300-brcmfmac-add-stub-for-monitor-interface-xmit.patch delete mode 100644 package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index f85142bbe9..f2279180df 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.6.8-1 +PKG_VERSION:=5.7-rc3-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.6.8/ -PKG_HASH:=547c5e17b9e23dd23cdf4d617a7550b80869e02114a7d404911c5ae928ae1da5 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.7-rc3/ +PKG_HASH:=7bc785c932f011c65adb75ffa746be2fa90b16ab61a6e1fd883acee403ffeed1 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch index 8bb1d6c813..b186e8fa47 100644 --- a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch +++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch @@ -1,6 +1,6 @@ --- a/net/wireless/reg.c +++ b/net/wireless/reg.c -@@ -3039,6 +3039,8 @@ void regulatory_hint_country_ie(struct w +@@ -3041,6 +3041,8 @@ void regulatory_hint_country_ie(struct w enum environment_cap env = ENVIRON_ANY; struct regulatory_request *request = NULL, *lr; @@ -9,7 +9,7 @@ /* IE len must be evenly divisible by 2 */ if (country_ie_len & 0x01) return; -@@ -3290,6 +3292,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3292,6 +3294,7 @@ static bool is_wiphy_all_set_reg_flag(en void regulatory_hint_disconnect(void) { diff --git a/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch index 7409db7cfd..417dc58436 100644 --- a/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3094,6 +3094,16 @@ int ath10k_core_register(struct ath10k * +@@ -3174,6 +3174,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch index ae03951908..c95d0764c3 100644 --- a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -8764,6 +8764,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -8781,6 +8781,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -9092,6 +9107,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -9109,6 +9124,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch b/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch index dbf30418e0..9cb2198ca2 100644 --- a/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch +++ b/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch @@ -23,7 +23,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling 3 files changed, 52 insertions(+), 23 deletions(-) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -2516,7 +2516,7 @@ static void ath10k_peer_assoc_h_vht(stru +@@ -2517,7 +2517,7 @@ static void ath10k_peer_assoc_h_vht(stru const u16 *vht_mcs_mask; u8 ampdu_factor; u8 max_nss, vht_mcs; @@ -32,7 +32,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) return; -@@ -2576,23 +2576,45 @@ static void ath10k_peer_assoc_h_vht(stru +@@ -2577,23 +2577,45 @@ static void ath10k_peer_assoc_h_vht(stru __le16_to_cpu(vht_cap->vht_mcs.tx_highest); arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); @@ -92,7 +92,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling } static void ath10k_peer_assoc_h_qos(struct ath10k *ar, -@@ -2744,9 +2766,9 @@ static int ath10k_peer_assoc_prepare(str +@@ -2745,9 +2767,9 @@ static int ath10k_peer_assoc_prepare(str ath10k_peer_assoc_h_crypto(ar, vif, sta, arg); ath10k_peer_assoc_h_rates(ar, vif, sta, arg); ath10k_peer_assoc_h_ht(ar, vif, sta, arg); @@ -105,7 +105,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling } --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -7615,12 +7615,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a +@@ -7628,12 +7628,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf; ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg); @@ -121,7 +121,7 @@ v9: use SM/MS macros from code.h to simplify shift/mask handling static int --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h -@@ -6501,7 +6501,19 @@ struct wmi_10_2_peer_assoc_complete_cmd +@@ -6508,7 +6508,19 @@ struct wmi_10_2_peer_assoc_complete_cmd __le32 info0; /* WMI_PEER_ASSOC_INFO0_ */ } __packed; diff --git a/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch b/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch index d6a1ef0849..bd0104592d 100644 --- a/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch +++ b/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch @@ -13,7 +13,7 @@ v2: fix trailing whitespace issue and fix some typos within the commit note 2 files changed, 8 insertions(+), 10 deletions(-) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -4576,13 +4576,6 @@ static struct ieee80211_sta_vht_cap ath1 +@@ -4585,13 +4585,6 @@ static struct ieee80211_sta_vht_cap ath1 vht_cap.cap |= val; } diff --git a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index fb49ed036a..65899cdd60 100644 --- a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -172,7 +172,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -2811,6 +2817,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -2889,6 +2895,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3067,9 +3077,18 @@ static void ath10k_core_register_work(st +@@ -3147,9 +3157,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -202,7 +202,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3115,6 +3134,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3195,6 +3214,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -221,7 +221,7 @@ v13: #include "htt.h" #include "htc.h" -@@ -1180,6 +1181,13 @@ struct ath10k { +@@ -1182,6 +1183,13 @@ struct ath10k { } testmode; struct { @@ -467,7 +467,7 @@ v13: static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -7435,6 +7435,49 @@ ath10k_wmi_op_gen_peer_set_param(struct +@@ -7448,6 +7448,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -517,7 +517,7 @@ v13: static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -9092,6 +9135,9 @@ static const struct wmi_ops wmi_ops = { +@@ -9105,6 +9148,9 @@ static const struct wmi_ops wmi_ops = { .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -527,7 +527,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9162,6 +9208,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -9175,6 +9221,8 @@ static const struct wmi_ops wmi_10_1_ops .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -536,7 +536,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9234,6 +9282,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -9247,6 +9295,8 @@ static const struct wmi_ops wmi_10_2_ops .gen_delba_send = ath10k_wmi_op_gen_delba_send, .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, @@ -545,7 +545,7 @@ v13: /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -9305,6 +9355,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -9318,6 +9368,8 @@ static const struct wmi_ops wmi_10_2_4_o ath10k_wmi_op_gen_pdev_enable_adaptive_cca, .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, @@ -554,7 +554,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9385,6 +9437,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -9398,6 +9450,8 @@ static const struct wmi_ops wmi_10_4_ops .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, .gen_echo = ath10k_wmi_op_gen_echo, .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, @@ -565,7 +565,7 @@ v13: int ath10k_wmi_attach(struct ath10k *ar) --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h -@@ -3007,6 +3007,41 @@ enum wmi_10_4_feature_mask { +@@ -3014,6 +3014,41 @@ enum wmi_10_4_feature_mask { }; diff --git a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch index 80175367fe..f10fe85c5f 100644 --- a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch @@ -16,9 +16,9 @@ Signed-off-by: Mathias Kresin --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -1230,6 +1230,10 @@ struct ath10k { - struct ath10k_bus_params bus_param; - struct completion peer_delete_done; +@@ -1235,6 +1235,10 @@ struct ath10k { + bool coex_support; + int coex_gpio_pin; +#ifdef CPTCFG_MAC80211_LEDS + const char *led_default_trigger; @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -9124,7 +9124,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -9141,7 +9141,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch b/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch index 149585b050..7742c27966 100644 --- a/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch +++ b/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch @@ -20,7 +20,7 @@ Forwarded: https://patchwork.kernel.org/patch/10986723/ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -1042,7 +1042,7 @@ static int ath10k_monitor_vdev_start(str +@@ -1043,7 +1043,7 @@ static int ath10k_monitor_vdev_start(str arg.channel.min_power = 0; arg.channel.max_power = channel->max_power * 2; arg.channel.max_reg_power = channel->max_reg_power * 2; @@ -29,7 +29,7 @@ Forwarded: https://patchwork.kernel.org/patch/10986723/ reinit_completion(&ar->vdev_setup_done); reinit_completion(&ar->vdev_delete_done); -@@ -1488,7 +1488,7 @@ static int ath10k_vdev_start_restart(str +@@ -1489,7 +1489,7 @@ static int ath10k_vdev_start_restart(str arg.channel.min_power = 0; arg.channel.max_power = chandef->chan->max_power * 2; arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; @@ -38,7 +38,7 @@ Forwarded: https://patchwork.kernel.org/patch/10986723/ if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; -@@ -3169,7 +3169,7 @@ static int ath10k_update_channel_list(st +@@ -3170,7 +3170,7 @@ static int ath10k_update_channel_list(st ch->min_power = 0; ch->max_power = channel->max_power * 2; ch->max_reg_power = channel->max_reg_power * 2; diff --git a/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch b/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch index 36948e546f..1501d4bc0c 100644 --- a/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch +++ b/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch @@ -28,7 +28,7 @@ Forwarded: no --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -1010,6 +1010,40 @@ static inline int ath10k_vdev_setup_sync +@@ -1011,6 +1011,40 @@ static inline int ath10k_vdev_setup_sync return ar->last_wmi_vdev_start_status; } @@ -69,7 +69,7 @@ Forwarded: no static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) { struct cfg80211_chan_def *chandef = NULL; -@@ -1042,7 +1076,8 @@ static int ath10k_monitor_vdev_start(str +@@ -1043,7 +1077,8 @@ static int ath10k_monitor_vdev_start(str arg.channel.min_power = 0; arg.channel.max_power = channel->max_power * 2; arg.channel.max_reg_power = channel->max_reg_power * 2; @@ -79,7 +79,7 @@ Forwarded: no reinit_completion(&ar->vdev_setup_done); reinit_completion(&ar->vdev_delete_done); -@@ -1488,7 +1523,8 @@ static int ath10k_vdev_start_restart(str +@@ -1489,7 +1524,8 @@ static int ath10k_vdev_start_restart(str arg.channel.min_power = 0; arg.channel.max_power = chandef->chan->max_power * 2; arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; @@ -89,7 +89,7 @@ Forwarded: no if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; -@@ -3169,7 +3205,8 @@ static int ath10k_update_channel_list(st +@@ -3170,7 +3206,8 @@ static int ath10k_update_channel_list(st ch->min_power = 0; ch->max_power = channel->max_power * 2; ch->max_reg_power = channel->max_reg_power * 2; diff --git a/package/kernel/mac80211/patches/brcm/300-brcmfmac-add-stub-for-monitor-interface-xmit.patch b/package/kernel/mac80211/patches/brcm/300-brcmfmac-add-stub-for-monitor-interface-xmit.patch deleted file mode 100644 index 8280918fa2..0000000000 --- a/package/kernel/mac80211/patches/brcm/300-brcmfmac-add-stub-for-monitor-interface-xmit.patch +++ /dev/null @@ -1,100 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 27 Mar 2020 13:40:50 +0100 -Subject: [PATCH] brcmfmac: add stub for monitor interface xmit -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -According to the struct net_device_ops documentation .ndo_start_xmit is -"Required; cannot be NULL.". Missing it may crash kernel easily: - -[ 341.216709] Unable to handle kernel NULL pointer dereference at virtual address 00000000 -[ 341.224836] pgd = 26088755 -[ 341.227544] [00000000] *pgd=00000000 -[ 341.231135] Internal error: Oops: 80000007 [#1] SMP ARM -[ 341.236367] Modules linked in: pppoe ppp_async iptable_nat brcmfmac xt_state xt_nat xt_conntrack xt_REDIRECT xt_MASQU -[ 341.304689] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.24 #0 -[ 341.310621] Hardware name: BCM5301X -[ 341.314116] PC is at 0x0 -[ 341.316664] LR is at dev_hard_start_xmit+0x8c/0x11c -[ 341.321546] pc : [<00000000>] lr : [] psr: 60000113 -[ 341.327821] sp : c0801c30 ip : c610cf00 fp : c08048e4 -[ 341.333051] r10: c073a63a r9 : c08044dc r8 : c6c04e00 -[ 341.338283] r7 : 00000000 r6 : c60f5000 r5 : 00000000 r4 : c6a9c3c0 -[ 341.344820] r3 : 00000000 r2 : bf25a13c r1 : c60f5000 r0 : c6a9c3c0 -[ 341.351358] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none -[ 341.358504] Control: 10c5387d Table: 0611c04a DAC: 00000051 -[ 341.364257] Process swapper/0 (pid: 0, stack limit = 0xc68ed0ca) -[ 341.370271] Stack: (0xc0801c30 to 0xc0802000) -[ 341.374633] 1c20: c6e7d480 c0802d00 c60f5050 c0801c6c -[ 341.382825] 1c40: c60f5000 c6a9c3c0 c6f90000 c6f9005c c6c04e00 c60f5000 00000000 c6f9005c -[ 341.391015] 1c60: 00000000 c04a033c 00f90200 00000010 c6a9c3c0 c6a9c3c0 c6f90000 00000000 -[ 341.399205] 1c80: 00000000 00000000 00000000 c046a7ac c6f9005c 00000001 fffffff4 00000000 -[ 341.407395] 1ca0: c6f90200 00000000 c60f5000 c0479550 00000000 c6f90200 c6a9c3c0 16000000 -[ 341.415586] 1cc0: 0000001c 6f4ad52f c6197040 b6df9387 36000000 c0520404 c073a80c c6a9c3c0 -[ 341.423777] 1ce0: 00000000 c6d643c0 c6a9c3c0 c0800024 00000001 00000001 c6d643c8 c6a9c3c0 -[ 341.431967] 1d00: c081b9c0 c7abca80 c610c840 c081b9c0 0000001c 00400000 c6bc5e6c c0522fb4 -[ 341.440157] 1d20: c6d64400 00000004 c6bc5e0a 00000000 c60f5000 c7abca80 c081b9c0 c0522f54 -[ 341.448348] 1d40: c6a9c3c0 c7abca80 c0803e48 c0549c94 c610c828 0000000a c0801d74 00000003 -[ 341.456538] 1d60: c6ec8f0a 00000000 c60f5000 c7abca80 c081b9c0 c0548520 0000000a 00000000 -[ 341.464728] 1d80: 00000000 003a0000 00000000 00000000 00000000 00000000 00000000 00000000 -[ 341.472919] 1da0: 000002ff 00000000 00000000 16000000 00000000 00000000 00000000 00000000 -[ 341.481110] 1dc0: 00000000 0000008f 00000000 00000000 00000000 2d132a69 c6bc5e40 00000000 -[ 341.489300] 1de0: c6bc5e40 c6a9c3c0 00000000 c6ec8e50 00000001 c054b070 00000001 00000000 -[ 341.497490] 1e00: c0807200 c6bc5e00 00000000 ffffe000 00000100 c054aea4 00000000 00000000 -[ 341.505681] 1e20: 00000122 00400000 c0802d00 c0172e80 6f56a70e ffffffff 6f56a70e c7eb9cc0 -[ 341.513871] 1e40: c7eb82c0 00000000 c0801e60 c017309c 00000000 00000000 07780000 c07382c0 -[ 341.522061] 1e60: 00000000 c7eb9cc0 c0739cc0 c0803f74 c0801e70 c0801e70 c0801ea4 c013d380 -[ 341.530253] 1e80: 00000000 000000a0 00000001 c0802084 c0802080 40000001 ffffe000 00000100 -[ 341.538443] 1ea0: c0802080 c01021e8 c8803100 10c5387d 00000000 c07341f0 c0739880 0000000a -[ 341.546633] 1ec0: c0734180 00001017 c0802d00 c062aa98 00200002 c062aa60 c8803100 c073984c -[ 341.554823] 1ee0: 00000000 00000001 00000000 c7810000 c8803100 10c5387d 00000000 c011c188 -[ 341.563014] 1f00: c073984c c015f0f8 c0804244 c0815ae4 c880210c c8802100 c0801f40 c037c584 -[ 341.571204] 1f20: c01035f8 60000013 ffffffff c0801f74 c080afd4 c0800000 10c5387d c0101a8c -[ 341.579395] 1f40: 00000000 004ac9dc c7eba4b4 c010ee60 ffffe000 c0803e68 c0803ea8 00000001 -[ 341.587587] 1f60: c080afd4 c062ca20 10c5387d 00000000 00000000 c0801f90 c01035f4 c01035f8 -[ 341.595776] 1f80: 60000013 ffffffff 00000051 00000000 ffffe000 c013ff50 000000ce c0803e40 -[ 341.603967] 1fa0: c082216c 00000000 00000001 c072ba38 10c5387d c0140214 c0822184 c0700df8 -[ 341.612157] 1fc0: ffffffff ffffffff 00000000 c070058c c072ba38 2d162e71 00000000 c0700330 -[ 341.620348] 1fe0: 00000051 10c0387d 000000ff 00a521d0 413fc090 00000000 00000000 00000000 -[ 341.628558] [] (dev_hard_start_xmit) from [] (sch_direct_xmit+0xe4/0x2bc) -[ 341.637106] [] (sch_direct_xmit) from [] (__dev_queue_xmit+0x6a4/0x72c) -[ 341.645481] [] (__dev_queue_xmit) from [] (ip6_finish_output2+0x18c/0x434) -[ 341.654112] [] (ip6_finish_output2) from [] (ip6_output+0x5c/0xd0) -[ 341.662053] [] (ip6_output) from [] (mld_sendpack+0x1a0/0x1a8) -[ 341.669640] [] (mld_sendpack) from [] (mld_ifc_timer_expire+0x1cc/0x2e4) -[ 341.678111] [] (mld_ifc_timer_expire) from [] (call_timer_fn.constprop.3+0x24/0x98) -[ 341.687527] [] (call_timer_fn.constprop.3) from [] (run_timer_softirq+0x1a8/0x1e4) -[ 341.696860] [] (run_timer_softirq) from [] (__do_softirq+0x120/0x2b0) -[ 341.705066] [] (__do_softirq) from [] (irq_exit+0x78/0x84) -[ 341.712317] [] (irq_exit) from [] (__handle_domain_irq+0x60/0xb4) -[ 341.720179] [] (__handle_domain_irq) from [] (gic_handle_irq+0x4c/0x90) -[ 341.728549] [] (gic_handle_irq) from [] (__irq_svc+0x6c/0x90) - -Fixes: 20f2c5fa3af0 ("brcmfmac: add initial support for monitor mode") -Signed-off-by: Rafał Miłecki ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -746,9 +746,18 @@ static int brcmf_net_mon_stop(struct net - return err; - } - -+static netdev_tx_t brcmf_net_mon_start_xmit(struct sk_buff *skb, -+ struct net_device *ndev) -+{ -+ dev_kfree_skb_any(skb); -+ -+ return NETDEV_TX_OK; -+} -+ - static const struct net_device_ops brcmf_netdev_ops_mon = { - .ndo_open = brcmf_net_mon_open, - .ndo_stop = brcmf_net_mon_stop, -+ .ndo_start_xmit = brcmf_net_mon_start_xmit, - }; - - int brcmf_net_mon_attach(struct brcmf_if *ifp) diff --git a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch index 12f907dcb5..93b6992f72 100644 --- a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch +++ b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -416,43 +416,6 @@ USB_SIERRA_NET= +@@ -417,43 +417,6 @@ USB_SIERRA_NET= USB_VL600= USB_NET_CH9200= USB_NET_AQC111= @@ -192,7 +192,7 @@ select BRCMUTIL --- a/Kconfig.local +++ b/Kconfig.local -@@ -1252,117 +1252,6 @@ config BACKPORTED_USB_NET_CH9200 +@@ -1255,117 +1255,6 @@ config BACKPORTED_USB_NET_CH9200 config BACKPORTED_USB_NET_AQC111 tristate default USB_NET_AQC111 diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch index 968adb71e2..6cd504228f 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -317,6 +317,7 @@ RT2X00_LIB_FIRMWARE= +@@ -318,6 +318,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= diff --git a/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch index 5fe7616143..5556f9b72a 100644 --- a/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch +++ b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch @@ -687,7 +687,7 @@ #endif /* AES_GMAC_H */ --- a/net/mac80211/key.h +++ b/net/mac80211/key.h -@@ -88,7 +88,7 @@ struct ieee80211_key { +@@ -89,7 +89,7 @@ struct ieee80211_key { * Management frames. */ u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN]; diff --git a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch index 8e0fddd10a..cceb6d5d7d 100644 --- a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch +++ b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1172,7 +1172,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1186,7 +1186,6 @@ static int ieee80211_stop_ap(struct wiph sdata->vif.bss_conf.ftmr_params = NULL; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/subsys/130-disable-fils.patch b/package/kernel/mac80211/patches/subsys/130-disable-fils.patch index f370dd52ee..5ca64d2c73 100644 --- a/package/kernel/mac80211/patches/subsys/130-disable-fils.patch +++ b/package/kernel/mac80211/patches/subsys/130-disable-fils.patch @@ -21,7 +21,7 @@ Disable FILS support, since it pulls in crypto hash support * FILS AEAD for (Re)Association Request/Response frames --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -571,7 +571,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -586,7 +586,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ NL80211_FEATURE_MAC_ON_CREATE | NL80211_FEATURE_USERSPACE_MPM | NL80211_FEATURE_FULL_AP_CLIENT_STATE; diff --git a/package/kernel/mac80211/patches/subsys/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch b/package/kernel/mac80211/patches/subsys/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch index 02e523878e..c3bf7ccc7a 100644 --- a/package/kernel/mac80211/patches/subsys/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch +++ b/package/kernel/mac80211/patches/subsys/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch @@ -11,14 +11,13 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/aes_cmac.c +++ b/net/mac80211/aes_cmac.c -@@ -19,50 +19,126 @@ +@@ -19,67 +19,151 @@ #define CMAC_TLEN_256 16 /* CMAC TLen = 128 bits (16 octets) */ #define AAD_LEN 20 -static const u8 zero[CMAC_TLEN_256]; -void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, -- const u8 *data, size_t data_len, u8 *mic) +void gf_mulx(u8 *pad) +{ + int i, carry; @@ -34,9 +33,7 @@ Signed-off-by: Felix Fietkau +void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac, + size_t mac_len) - { -- SHASH_DESC_ON_STACK(desc, tfm); -- u8 out[AES_BLOCK_SIZE]; ++{ + u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE]; + const u8 *pos, *end; + size_t i, e, left, total_len; @@ -88,30 +85,48 @@ Signed-off-by: Felix Fietkau + crypto_cipher_encrypt_one(tfm, pad, pad); + memcpy(mac, pad, mac_len); +} ++ ++ ++void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad, + const u8 *data, size_t data_len, u8 *mic) + { +- SHASH_DESC_ON_STACK(desc, tfm); +- u8 out[AES_BLOCK_SIZE]; ++ const u8 *addr[4]; ++ size_t len[4]; ++ u8 zero[CMAC_TLEN]; + const __le16 *fc; - desc->tfm = tfm; - +- - crypto_shash_init(desc); - crypto_shash_update(desc, aad, AAD_LEN); -- crypto_shash_update(desc, data, data_len - CMAC_TLEN); -- crypto_shash_finup(desc, zero, CMAC_TLEN, out); -+void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad, -+ const u8 *data, size_t data_len, u8 *mic) -+{ -+ const u8 *addr[3]; -+ size_t len[3]; -+ u8 zero[CMAC_TLEN]; -+ + memset(zero, 0, CMAC_TLEN); + addr[0] = aad; + len[0] = AAD_LEN; -+ addr[1] = data; -+ len[1] = data_len - CMAC_TLEN; -+ addr[2] = zero; -+ len[2] = CMAC_TLEN; - + fc = (const __le16 *)aad; + if (ieee80211_is_beacon(*fc)) { + /* mask Timestamp field to zero */ +- crypto_shash_update(desc, zero, 8); +- crypto_shash_update(desc, data + 8, data_len - 8 - CMAC_TLEN); ++ addr[1] = zero; ++ len[1] = 8; ++ addr[2] = data + 8; ++ len[2] = data_len - 8 - CMAC_TLEN; ++ addr[3] = zero; ++ len[3] = CMAC_TLEN; ++ aes_cmac_vector(tfm, 4, addr, len, mic, CMAC_TLEN); + } else { +- crypto_shash_update(desc, data, data_len - CMAC_TLEN); ++ addr[1] = data; ++ len[1] = data_len - CMAC_TLEN; ++ addr[2] = zero; ++ len[2] = CMAC_TLEN; ++ aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN); + } +- crypto_shash_finup(desc, zero, CMAC_TLEN, out); +- - memcpy(mic, out, CMAC_TLEN); -+ aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN); } -void ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad, @@ -119,25 +134,41 @@ Signed-off-by: Felix Fietkau const u8 *data, size_t data_len, u8 *mic) { - SHASH_DESC_ON_STACK(desc, tfm); -+ const u8 *addr[3]; -+ size_t len[3]; ++ const u8 *addr[4]; ++ size_t len[4]; + u8 zero[CMAC_TLEN_256]; -+ -+ memset(zero, 0, CMAC_TLEN_256); -+ addr[0] = aad; -+ len[0] = AAD_LEN; -+ addr[1] = data; -+ len[1] = data_len - CMAC_TLEN_256; -+ addr[2] = zero; -+ len[2] = CMAC_TLEN_256; + const __le16 *fc; - desc->tfm = tfm; - - crypto_shash_init(desc); - crypto_shash_update(desc, aad, AAD_LEN); -- crypto_shash_update(desc, data, data_len - CMAC_TLEN_256); ++ memset(zero, 0, CMAC_TLEN_256); ++ addr[0] = aad; ++ len[0] = AAD_LEN; ++ addr[1] = data; + fc = (const __le16 *)aad; + if (ieee80211_is_beacon(*fc)) { + /* mask Timestamp field to zero */ +- crypto_shash_update(desc, zero, 8); +- crypto_shash_update(desc, data + 8, +- data_len - 8 - CMAC_TLEN_256); ++ addr[1] = zero; ++ len[1] = 8; ++ addr[2] = data + 8; ++ len[2] = data_len - 8 - CMAC_TLEN_256; ++ addr[3] = zero; ++ len[3] = CMAC_TLEN_256; ++ aes_cmac_vector(tfm, 4, addr, len, mic, CMAC_TLEN_256); + } else { +- crypto_shash_update(desc, data, data_len - CMAC_TLEN_256); ++ addr[1] = data; ++ len[1] = data_len - CMAC_TLEN_256; ++ addr[2] = zero; ++ len[2] = CMAC_TLEN_256; ++ aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN_256); + } - crypto_shash_finup(desc, zero, CMAC_TLEN_256, mic); -+ aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN_256); } -struct crypto_shash *ieee80211_aes_cmac_key_setup(const u8 key[], @@ -188,7 +219,7 @@ Signed-off-by: Felix Fietkau #endif /* AES_CMAC_H */ --- a/net/mac80211/key.h +++ b/net/mac80211/key.h -@@ -93,7 +93,7 @@ struct ieee80211_key { +@@ -94,7 +94,7 @@ struct ieee80211_key { } ccmp; struct { u8 rx_pn[IEEE80211_CMAC_PN_LEN]; diff --git a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch index 668064cfa8..84cfaea8a4 100644 --- a/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch +++ b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4113,6 +4113,12 @@ out: +@@ -4119,6 +4119,12 @@ out: netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev) { diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index ebc1ef489e..2f515be8f0 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -314,7 +314,7 @@ void ieee80211_restart_hw(struct ieee802 +@@ -316,7 +316,7 @@ void ieee80211_restart_hw(struct ieee802 } EXPORT_SYMBOL(ieee80211_restart_hw); @@ -9,7 +9,7 @@ static int ieee80211_ifa_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -373,7 +373,7 @@ static int ieee80211_ifa_changed(struct +@@ -375,7 +375,7 @@ static int ieee80211_ifa_changed(struct } #endif @@ -18,7 +18,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1273,14 +1273,14 @@ int ieee80211_register_hw(struct ieee802 +@@ -1292,14 +1292,14 @@ int ieee80211_register_hw(struct ieee802 rtnl_unlock(); @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1289,13 +1289,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1308,13 +1308,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1323,10 +1323,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1342,10 +1342,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch b/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch index 8c019530d1..13fb2fd077 100644 --- a/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch +++ b/package/kernel/mac80211/patches/subsys/300-mac80211-optimize-skb-resizing.patch @@ -24,7 +24,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1786,6 +1786,9 @@ int ieee80211_tx_control_port(struct wip +@@ -1801,6 +1801,9 @@ int ieee80211_tx_control_port(struct wip const u8 *dest, __be16 proto, bool unencrypted); int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, const u8 *buf, size_t len); @@ -36,7 +36,7 @@ Signed-off-by: Felix Fietkau void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, --- a/net/mac80211/status.c +++ b/net/mac80211/status.c -@@ -829,6 +829,11 @@ void ieee80211_tx_monitor(struct ieee802 +@@ -828,6 +828,11 @@ void ieee80211_tx_monitor(struct ieee802 struct net_device *prev_dev = NULL; int rtap_len; @@ -50,7 +50,7 @@ Signed-off-by: Felix Fietkau if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -1936,37 +1936,53 @@ static bool ieee80211_tx(struct ieee8021 +@@ -1937,37 +1937,53 @@ static bool ieee80211_tx(struct ieee8021 } /* device xmit handlers */ @@ -123,7 +123,7 @@ Signed-off-by: Felix Fietkau wiphy_debug(local->hw.wiphy, "failed to reallocate TX buffer\n"); return -ENOMEM; -@@ -1982,18 +1998,8 @@ void ieee80211_xmit(struct ieee80211_sub +@@ -1983,18 +1999,8 @@ void ieee80211_xmit(struct ieee80211_sub struct ieee80211_local *local = sdata->local; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr; @@ -143,7 +143,7 @@ Signed-off-by: Felix Fietkau ieee80211_free_txskb(&local->hw, skb); return; } -@@ -2795,29 +2801,13 @@ static struct sk_buff *ieee80211_build_h +@@ -2796,29 +2802,13 @@ static struct sk_buff *ieee80211_build_h } skb_pull(skb, skip_header_bytes); @@ -179,7 +179,7 @@ Signed-off-by: Felix Fietkau } if (encaps_data) -@@ -3432,7 +3422,6 @@ static bool ieee80211_xmit_fast(struct i +@@ -3433,7 +3423,6 @@ static bool ieee80211_xmit_fast(struct i struct ieee80211_local *local = sdata->local; u16 ethertype = (skb->data[12] << 8) | skb->data[13]; int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); @@ -187,7 +187,7 @@ Signed-off-by: Felix Fietkau struct ethhdr eth; struct ieee80211_tx_info *info; struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -@@ -3484,10 +3473,7 @@ static bool ieee80211_xmit_fast(struct i +@@ -3485,10 +3474,7 @@ static bool ieee80211_xmit_fast(struct i * as the may-encrypt argument for the resize to not account for * more room than we already have in 'extra_head' */ diff --git a/package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch b/package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch index 64ae487be2..10d8ad8d71 100644 --- a/package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch +++ b/package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch @@ -28,7 +28,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -338,6 +338,7 @@ struct sta_info *sta_info_alloc(struct i +@@ -339,6 +339,7 @@ struct sta_info *sta_info_alloc(struct i INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames); INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); mutex_init(&sta->ampdu_mlme.mtx); diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch deleted file mode 100644 index 16108c83f3..0000000000 --- a/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Markus Theil -Date: Wed, 18 Dec 2019 15:27:36 +0100 -Subject: [PATCH] mac80211: fix tx status for no ack cases - -Before this patch, frames which where successfully transmitted without -requiring acks where accounted as lost frames. - -Signed-off-by: Markus Theil -Link: https://lore.kernel.org/r/20191218142736.15843-1-markus.theil@tu-ilmenau.de -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -895,6 +895,7 @@ static void __ieee80211_tx_status(struct - int rates_idx; - bool send_to_cooked; - bool acked; -+ bool noack_success; - struct ieee80211_bar *bar; - int shift = 0; - int tid = IEEE80211_NUM_TIDS; -@@ -913,6 +914,8 @@ static void __ieee80211_tx_status(struct - clear_sta_flag(sta, WLAN_STA_SP); - - acked = !!(info->flags & IEEE80211_TX_STAT_ACK); -+ noack_success = !!(info->flags & -+ IEEE80211_TX_STAT_NOACK_TRANSMITTED); - - /* mesh Peer Service Period support */ - if (ieee80211_vif_is_mesh(&sta->sdata->vif) && -@@ -977,12 +980,12 @@ static void __ieee80211_tx_status(struct - ieee80211_handle_filtered_frame(local, sta, skb); - return; - } else { -- if (!acked) -+ if (!acked && !noack_success) - sta->status_stats.retry_failed++; - sta->status_stats.retry_count += retry_count; - - if (ieee80211_is_data_present(fc)) { -- if (!acked) -+ if (!acked && !noack_success) - sta->status_stats.msdu_failed[tid]++; - - sta->status_stats.msdu_retries[tid] += -@@ -1020,7 +1023,7 @@ static void __ieee80211_tx_status(struct - } - - if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { -- if (info->flags & IEEE80211_TX_STAT_ACK) { -+ if (acked) { - if (sta->status_stats.lost_packets) - sta->status_stats.lost_packets = 0; - -@@ -1028,6 +1031,8 @@ static void __ieee80211_tx_status(struct - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) - sta->status_stats.last_tdls_pkt_time = - jiffies; -+ } else if (noack_success) { -+ /* nothing to do here, do not account as lost */ - } else { - ieee80211_lost_packet(sta, info); - } -@@ -1148,7 +1153,7 @@ void ieee80211_tx_status_ext(struct ieee - - sta = container_of(pubsta, struct sta_info, sta); - -- if (!acked) -+ if (!acked && !noack_success) - sta->status_stats.retry_failed++; - sta->status_stats.retry_count += retry_count; - -@@ -1163,6 +1168,8 @@ void ieee80211_tx_status_ext(struct ieee - sta->status_stats.last_tdls_pkt_time = jiffies; - } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { - return; -+ } else if (noack_success) { -+ /* nothing to do here, do not account as lost */ - } else { - ieee80211_lost_packet(sta, info); - } diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 151ca25d18..f4573f124a 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3458,6 +3458,7 @@ struct cfg80211_update_owe_info { +@@ -3552,6 +3552,7 @@ struct cfg80211_update_owe_info { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @set_wds_peer: set the WDS peer for a WDS interface * -@@ -3773,6 +3774,7 @@ struct cfg80211_ops { +@@ -3874,6 +3875,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -18,7 +18,7 @@ const u8 *addr); --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1501,6 +1501,7 @@ enum ieee80211_smps_mode { +@@ -1504,6 +1504,7 @@ enum ieee80211_smps_mode { * * @power_level: requested transmit power (in dBm), backward compatibility * value only that is set to the minimum of all interfaces @@ -26,7 +26,7 @@ * * @chandef: the channel definition to tune to * @radar_enabled: whether radar detection is enabled -@@ -1521,6 +1522,7 @@ enum ieee80211_smps_mode { +@@ -1524,6 +1525,7 @@ enum ieee80211_smps_mode { struct ieee80211_conf { u32 flags; int power_level, dynamic_ps_timeout; @@ -36,9 +36,9 @@ u8 ps_dtim_period; --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h -@@ -2400,6 +2400,9 @@ enum nl80211_commands { - * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key - * (u16). +@@ -2470,6 +2470,9 @@ enum nl80211_commands { + * no roaming occurs between the reauth threshold and PMK expiration, + * disassociation is still forced. * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. @@ -46,9 +46,9 @@ * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2864,6 +2867,8 @@ enum nl80211_attrs { - - NL80211_ATTR_VLAN_ID, +@@ -2945,6 +2948,8 @@ enum nl80211_attrs { + NL80211_ATTR_PMK_LIFETIME, + NL80211_ATTR_PMK_REAUTH_THRESHOLD, + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + @@ -77,7 +77,7 @@ static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, const u8 *addr) { -@@ -4017,6 +4030,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4004,6 +4017,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, @@ -87,7 +87,7 @@ CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1376,6 +1376,7 @@ struct ieee80211_local { +@@ -1380,6 +1380,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ @@ -106,7 +106,7 @@ u32 offchannel_flag; offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; -@@ -150,6 +150,12 @@ static u32 ieee80211_hw_conf_chan(struct +@@ -152,6 +152,12 @@ static u32 ieee80211_hw_conf_chan(struct } rcu_read_unlock(); @@ -119,7 +119,7 @@ if (local->hw.conf.power_level != power) { changed |= IEEE80211_CONF_CHANGE_POWER; local->hw.conf.power_level = power; -@@ -639,6 +645,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -656,6 +662,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ IEEE80211_RADIOTAP_MCS_HAVE_BW; local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; @@ -129,15 +129,15 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -630,6 +630,7 @@ const struct nla_policy nl80211_policy[N - [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG }, - [NL80211_ATTR_HE_OBSS_PD] = NLA_POLICY_NESTED(he_obss_pd_policy), - [NL80211_ATTR_VLAN_ID] = NLA_POLICY_RANGE(NLA_U16, 1, VLAN_N_VID - 2), +@@ -661,6 +661,7 @@ const struct nla_policy nl80211_policy[N + [NL80211_ATTR_CONTROL_PORT_NO_PREAUTH] = { .type = NLA_FLAG }, + [NL80211_ATTR_PMK_LIFETIME] = NLA_POLICY_MIN(NLA_U32, 1), + [NL80211_ATTR_PMK_REAUTH_THRESHOLD] = NLA_POLICY_RANGE(NLA_U8, 1, 100), + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, }; /* policy for the key attributes */ -@@ -2994,6 +2995,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -3132,6 +3133,20 @@ static int nl80211_set_wiphy(struct sk_b if (result) return result; } diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch index 57f05b711a..5084c5d45f 100644 --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch @@ -1,6 +1,15 @@ --- a/nl80211.h +++ b/nl80211.h -@@ -249,6 +249,22 @@ +@@ -11,7 +11,7 @@ + * Copyright 2008 Jouni Malinen + * Copyright 2008 Colin McCabe + * Copyright 2015-2017 Intel Deutschland GmbH +- * Copyright (C) 2018-2019 Intel Corporation ++ * Copyright (C) 2018-2020 Intel Corporation + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above +@@ -249,6 +249,45 @@ */ /** @@ -19,11 +28,34 @@ + * %NL80211_ATTR_VLAN_ID. + */ + ++/** ++ * DOC: TID configuration ++ * ++ * TID config support can be checked in the %NL80211_ATTR_TID_CONFIG ++ * attribute given in wiphy capabilities. ++ * ++ * The necessary configuration parameters are mentioned in ++ * &enum nl80211_tid_config_attr and it will be passed to the ++ * %NL80211_CMD_SET_TID_CONFIG command in %NL80211_ATTR_TID_CONFIG. ++ * ++ * If the configuration needs to be applied for specific peer then the MAC ++ * address of the peer needs to be passed in %NL80211_ATTR_MAC, otherwise the ++ * configuration will be applied for all the connected peers in the vif except ++ * any peers that have peer specific configuration for the TID by default; if ++ * the %NL80211_TID_CONFIG_ATTR_OVERRIDE flag is set, peer specific values ++ * will be overwritten. ++ * ++ * All this configuration is valid only for STA's current connection ++ * i.e. the configuration will be reset to default when the STA connects back ++ * after disconnection/roaming, and this configuration will be cleared when ++ * the interface goes down. ++ */ ++ +/** * enum nl80211_commands - supported nl80211 commands * * @NL80211_CMD_UNSPEC: unspecified command to catch errors -@@ -571,6 +587,14 @@ +@@ -571,6 +610,14 @@ * set of BSSID,frequency parameters is used (i.e., either the enforcing * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT). @@ -38,31 +70,231 @@ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within * the ESS in case the device is already associated and an association with * a different BSS is desired. -@@ -2373,6 +2397,12 @@ enum nl80211_commands { +@@ -1101,6 +1148,9 @@ + * peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame + * content. The frame is ethernet data. + * ++ * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration ++ * is passed using %NL80211_ATTR_TID_CONFIG attribute. ++ * + * @NL80211_CMD_MAX: highest used command number + * @__NL80211_CMD_AFTER_LAST: internal use + */ +@@ -1325,6 +1375,8 @@ enum nl80211_commands { + + NL80211_CMD_PROBE_MESH_LINK, + ++ NL80211_CMD_SET_TID_CONFIG, ++ + /* add new commands above here */ + + /* used to define NL80211_CMD_MAX below */ +@@ -1580,7 +1632,8 @@ enum nl80211_commands { + * flag is included, then control port frames are sent over NL80211 instead + * using %CMD_CONTROL_PORT_FRAME. If control port routing over NL80211 is + * to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER +- * flag. ++ * flag. When used with %NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, pre-auth ++ * frames are not forwared over the control port. + * + * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. + * We recommend using nested, driver-specific attributes within this. +@@ -2373,6 +2426,53 @@ enum nl80211_commands { * the allowed channel bandwidth configurations. (u8 attribute) * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. * + * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key + * (u16). + * ++ * @NL80211_ATTR_HE_BSS_COLOR: nested attribute for BSS Color Settings. ++ * ++ * @NL80211_ATTR_IFTYPE_AKM_SUITES: nested array attribute, with each entry ++ * using attributes from &enum nl80211_iftype_akm_attributes. This ++ * attribute is sent in a response to %NL80211_CMD_GET_WIPHY indicating ++ * supported AKM suites capability per interface. AKMs advertised in ++ * %NL80211_ATTR_AKM_SUITES are default capabilities if AKM suites not ++ * advertised for a specific interface type. ++ * ++ * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a ++ * nested attribute with &enum nl80211_tid_config_attr sub-attributes; ++ * on output (in wiphy attributes) it contains only the feature sub- ++ * attributes. ++ * ++ * @NL80211_ATTR_CONTROL_PORT_NO_PREAUTH: disable preauth frame rx on control ++ * port in order to forward/receive them as ordinary data frames. ++ * ++ * @NL80211_ATTR_PMK_LIFETIME: Maximum lifetime for PMKSA in seconds (u32, ++ * dot11RSNAConfigPMKReauthThreshold; 0 is not a valid value). ++ * An optional parameter configured through %NL80211_CMD_SET_PMKSA. ++ * Drivers that trigger roaming need to know the lifetime of the ++ * configured PMKSA for triggering the full vs. PMKSA caching based ++ * authentication. This timeout helps authentication methods like SAE, ++ * where PMK gets updated only by going through a full (new SAE) ++ * authentication instead of getting updated during an association for EAP ++ * authentication. No new full authentication within the PMK expiry shall ++ * result in a disassociation at the end of the lifetime. ++ * ++ * @NL80211_ATTR_PMK_REAUTH_THRESHOLD: Reauthentication threshold time, in ++ * terms of percentage of %NL80211_ATTR_PMK_LIFETIME ++ * (u8, dot11RSNAConfigPMKReauthThreshold, 1..100). This is an optional ++ * parameter configured through %NL80211_CMD_SET_PMKSA. Requests the ++ * driver to trigger a full authentication roam (without PMKSA caching) ++ * after the reauthentication threshold time, but before the PMK lifetime ++ * has expired. ++ * ++ * Authentication methods like SAE need to be able to generate a new PMKSA ++ * entry without having to force a disconnection after the PMK timeout. If ++ * no roaming occurs between the reauth threshold and PMK expiration, ++ * disassociation is still forced. ++ * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2835,6 +2865,10 @@ enum nl80211_attrs { +@@ -2835,6 +2935,21 @@ enum nl80211_attrs { NL80211_ATTR_WIPHY_EDMG_CHANNELS, NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, + NL80211_ATTR_VLAN_ID, + ++ NL80211_ATTR_HE_BSS_COLOR, ++ ++ NL80211_ATTR_IFTYPE_AKM_SUITES, ++ ++ NL80211_ATTR_TID_CONFIG, ++ ++ NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, ++ ++ NL80211_ATTR_PMK_LIFETIME, ++ NL80211_ATTR_PMK_REAUTH_THRESHOLD, ++ + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, -@@ -5484,6 +5518,14 @@ enum nl80211_feature_flags { +@@ -3554,6 +3669,8 @@ enum nl80211_wmm_rule { + * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations. + * This is a nested attribute that contains the wmm limitation per AC. + * (see &enum nl80211_wmm_rule) ++ * @NL80211_FREQUENCY_ATTR_NO_HE: HE operation is not allowed on this channel ++ * in current regulatory domain. + * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number + * currently defined + * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use +@@ -3583,6 +3700,7 @@ enum nl80211_frequency_attr { + NL80211_FREQUENCY_ATTR_NO_20MHZ, + NL80211_FREQUENCY_ATTR_NO_10MHZ, + NL80211_FREQUENCY_ATTR_WMM, ++ NL80211_FREQUENCY_ATTR_NO_HE, + + /* keep last */ + __NL80211_FREQUENCY_ATTR_AFTER_LAST, +@@ -3780,6 +3898,7 @@ enum nl80211_sched_scan_match_attr { + * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation + * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed + * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed ++ * @NL80211_RRF_NO_HE: HE operation not allowed + */ + enum nl80211_reg_rule_flags { + NL80211_RRF_NO_OFDM = 1<<0, +@@ -3797,6 +3916,7 @@ enum nl80211_reg_rule_flags { + NL80211_RRF_NO_HT40PLUS = 1<<14, + NL80211_RRF_NO_80MHZ = 1<<15, + NL80211_RRF_NO_160MHZ = 1<<16, ++ NL80211_RRF_NO_HE = 1<<17, + }; + + #define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR +@@ -4503,6 +4623,7 @@ enum nl80211_key_default_types { + * See &enum nl80211_key_default_types. + * @NL80211_KEY_MODE: the mode from enum nl80211_key_mode. + * Defaults to @NL80211_KEY_RX_TX. ++ * @NL80211_KEY_DEFAULT_BEACON: flag indicating default Beacon frame key + * + * @__NL80211_KEY_AFTER_LAST: internal + * @NL80211_KEY_MAX: highest key attribute +@@ -4518,6 +4639,7 @@ enum nl80211_key_attributes { + NL80211_KEY_TYPE, + NL80211_KEY_DEFAULT_TYPES, + NL80211_KEY_MODE, ++ NL80211_KEY_DEFAULT_BEACON, + + /* keep last */ + __NL80211_KEY_AFTER_LAST, +@@ -4674,6 +4796,69 @@ enum nl80211_tx_power_setting { + }; + + /** ++ * enum nl80211_tid_config - TID config state ++ * @NL80211_TID_CONFIG_ENABLE: Enable config for the TID ++ * @NL80211_TID_CONFIG_DISABLE: Disable config for the TID ++ */ ++enum nl80211_tid_config { ++ NL80211_TID_CONFIG_ENABLE, ++ NL80211_TID_CONFIG_DISABLE, ++}; ++ ++/* enum nl80211_tid_config_attr - TID specific configuration. ++ * @NL80211_TID_CONFIG_ATTR_PAD: pad attribute for 64-bit values ++ * @NL80211_TID_CONFIG_ATTR_VIF_SUPP: a bitmap (u64) of attributes supported ++ * for per-vif configuration; doesn't list the ones that are generic ++ * (%NL80211_TID_CONFIG_ATTR_TIDS, %NL80211_TID_CONFIG_ATTR_OVERRIDE). ++ * @NL80211_TID_CONFIG_ATTR_PEER_SUPP: same as the previous per-vif one, but ++ * per peer instead. ++ * @NL80211_TID_CONFIG_ATTR_OVERRIDE: flag attribue, if no peer ++ * is selected, if set indicates that the new configuration overrides ++ * all previous peer configurations, otherwise previous peer specific ++ * configurations should be left untouched. If peer is selected then ++ * it will reset particular TID configuration of that peer and it will ++ * not accept other TID config attributes along with peer. ++ * @NL80211_TID_CONFIG_ATTR_TIDS: a bitmask value of TIDs (bit 0 to 7) ++ * Its type is u16. ++ * @NL80211_TID_CONFIG_ATTR_NOACK: Configure ack policy for the TID. ++ * specified in %NL80211_TID_CONFIG_ATTR_TID. see %enum nl80211_tid_config. ++ * Its type is u8. ++ * @NL80211_TID_CONFIG_ATTR_RETRY_SHORT: Number of retries used with data frame ++ * transmission, user-space sets this configuration in ++ * &NL80211_CMD_SET_TID_CONFIG. It is u8 type, min value is 1 and ++ * the max value is advertised by the driver in this attribute on ++ * output in wiphy capabilities. ++ * @NL80211_TID_CONFIG_ATTR_RETRY_LONG: Number of retries used with data frame ++ * transmission, user-space sets this configuration in ++ * &NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and ++ * the max value is advertised by the driver in this attribute on ++ * output in wiphy capabilities. ++ * @NL80211_TID_CONFIG_ATTR_AMPDU_CTRL: Enable/Disable aggregation for the TIDs ++ * specified in %NL80211_TID_CONFIG_ATTR_TIDS. Its type is u8, using ++ * the values from &nl80211_tid_config. ++ * @NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL: Enable/Disable RTS_CTS for the TIDs ++ * specified in %NL80211_TID_CONFIG_ATTR_TIDS. It is u8 type, using ++ * the values from &nl80211_tid_config. ++ */ ++enum nl80211_tid_config_attr { ++ __NL80211_TID_CONFIG_ATTR_INVALID, ++ NL80211_TID_CONFIG_ATTR_PAD, ++ NL80211_TID_CONFIG_ATTR_VIF_SUPP, ++ NL80211_TID_CONFIG_ATTR_PEER_SUPP, ++ NL80211_TID_CONFIG_ATTR_OVERRIDE, ++ NL80211_TID_CONFIG_ATTR_TIDS, ++ NL80211_TID_CONFIG_ATTR_NOACK, ++ NL80211_TID_CONFIG_ATTR_RETRY_SHORT, ++ NL80211_TID_CONFIG_ATTR_RETRY_LONG, ++ NL80211_TID_CONFIG_ATTR_AMPDU_CTRL, ++ NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL, ++ ++ /* keep last */ ++ __NL80211_TID_CONFIG_ATTR_AFTER_LAST, ++ NL80211_TID_CONFIG_ATTR_MAX = __NL80211_TID_CONFIG_ATTR_AFTER_LAST - 1 ++}; ++ ++/** + * enum nl80211_packet_pattern_attr - packet pattern attribute + * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute + * @NL80211_PKTPAT_PATTERN: the pattern, values where the mask has +@@ -5484,6 +5669,26 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in * station mode (SAE password is passed as part of the connect command). * @@ -73,16 +305,149 @@ + * @NL80211_EXT_FEATURE_AQL: The driver supports the Airtime Queue Limit (AQL) + * feature, which prevents bufferbloat by using the expected transmission + * time to limit the amount of data buffered in the hardware. ++ * ++ * @NL80211_EXT_FEATURE_BEACON_PROTECTION: The driver supports Beacon protection ++ * and can receive key configuration for BIGTK using key indexes 6 and 7. ++ * ++ * @NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH: The driver can disable the ++ * forwarding of preauth frames over the control port. They are then ++ * handled as ordinary data frames. ++ * ++ * @NL80211_EXT_FEATURE_PROTECTED_TWT: Driver supports protected TWT frames ++ * ++ * @NL80211_EXT_FEATURE_DEL_IBSS_STA: The driver supports removing stations ++ * in IBSS mode, essentially by dropping their state. + * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ -@@ -5529,6 +5571,8 @@ enum nl80211_ext_feature_index { +@@ -5529,6 +5734,12 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_EXT_KEY_ID, NL80211_EXT_FEATURE_STA_TX_PWR, NL80211_EXT_FEATURE_SAE_OFFLOAD, + NL80211_EXT_FEATURE_VLAN_OFFLOAD, + NL80211_EXT_FEATURE_AQL, ++ NL80211_EXT_FEATURE_BEACON_PROTECTION, ++ NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH, ++ NL80211_EXT_FEATURE_PROTECTED_TWT, ++ NL80211_EXT_FEATURE_DEL_IBSS_STA, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, +@@ -6151,12 +6362,14 @@ enum nl80211_ftm_responder_stats { + * @NL80211_PREAMBLE_HT: HT preamble + * @NL80211_PREAMBLE_VHT: VHT preamble + * @NL80211_PREAMBLE_DMG: DMG preamble ++ * @NL80211_PREAMBLE_HE: HE preamble + */ + enum nl80211_preamble { + NL80211_PREAMBLE_LEGACY, + NL80211_PREAMBLE_HT, + NL80211_PREAMBLE_VHT, + NL80211_PREAMBLE_DMG, ++ NL80211_PREAMBLE_HE, + }; + + /** +@@ -6349,6 +6562,10 @@ enum nl80211_peer_measurement_attrs { + * is valid) + * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST: u32 attribute indicating + * the maximum FTMs per burst (if not present anything is valid) ++ * @NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED: flag attribute indicating if ++ * trigger based ranging measurement is supported ++ * @NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED: flag attribute indicating ++ * if non trigger based ranging measurement is supported + * + * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal + * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number +@@ -6364,6 +6581,8 @@ enum nl80211_peer_measurement_ftm_capa { + NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS, + NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT, + NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST, ++ NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED, ++ NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED, + + /* keep last */ + NUM_NL80211_PMSR_FTM_CAPA_ATTR, +@@ -6393,6 +6612,20 @@ enum nl80211_peer_measurement_ftm_capa { + * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI: request LCI data (flag) + * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC: request civic location data + * (flag) ++ * @NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED: request trigger based ranging ++ * measurement (flag). ++ * This attribute and %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED are ++ * mutually exclusive. ++ * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor ++ * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based ++ * ranging will be used. ++ * @NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED: request non trigger based ++ * ranging measurement (flag) ++ * This attribute and %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED are ++ * mutually exclusive. ++ * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor ++ * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based ++ * ranging will be used. + * + * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal + * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number +@@ -6409,6 +6642,8 @@ enum nl80211_peer_measurement_ftm_req { + NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES, + NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI, + NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC, ++ NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED, ++ NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED, + + /* keep last */ + NUM_NL80211_PMSR_FTM_REQ_ATTR, +@@ -6548,5 +6783,51 @@ enum nl80211_obss_pd_attributes { + NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_HE_OBSS_PD_ATTR_LAST - 1, + }; + ++/** ++ * enum nl80211_bss_color_attributes - BSS Color attributes ++ * @__NL80211_HE_BSS_COLOR_ATTR_INVALID: Invalid ++ * ++ * @NL80211_HE_BSS_COLOR_ATTR_COLOR: the current BSS Color. ++ * @NL80211_HE_BSS_COLOR_ATTR_DISABLED: is BSS coloring disabled. ++ * @NL80211_HE_BSS_COLOR_ATTR_PARTIAL: the AID equation to be used.. ++ * ++ * @__NL80211_HE_BSS_COLOR_ATTR_LAST: Internal ++ * @NL80211_HE_BSS_COLOR_ATTR_MAX: highest BSS Color attribute. ++ */ ++enum nl80211_bss_color_attributes { ++ __NL80211_HE_BSS_COLOR_ATTR_INVALID, ++ ++ NL80211_HE_BSS_COLOR_ATTR_COLOR, ++ NL80211_HE_BSS_COLOR_ATTR_DISABLED, ++ NL80211_HE_BSS_COLOR_ATTR_PARTIAL, ++ ++ /* keep last */ ++ __NL80211_HE_BSS_COLOR_ATTR_LAST, ++ NL80211_HE_BSS_COLOR_ATTR_MAX = __NL80211_HE_BSS_COLOR_ATTR_LAST - 1, ++}; ++ ++/** ++ * enum nl80211_iftype_akm_attributes - interface type AKM attributes ++ * @__NL80211_IFTYPE_AKM_ATTR_INVALID: Invalid ++ * ++ * @NL80211_IFTYPE_AKM_ATTR_IFTYPES: nested attribute containing a flag ++ * attribute for each interface type that supports AKM suites specified in ++ * %NL80211_IFTYPE_AKM_ATTR_SUITES ++ * @NL80211_IFTYPE_AKM_ATTR_SUITES: an array of u32. Used to indicate supported ++ * AKM suites for the specified interface types. ++ * ++ * @__NL80211_IFTYPE_AKM_ATTR_LAST: Internal ++ * @NL80211_IFTYPE_AKM_ATTR_MAX: highest interface type AKM attribute. ++ */ ++enum nl80211_iftype_akm_attributes { ++ __NL80211_IFTYPE_AKM_ATTR_INVALID, ++ ++ NL80211_IFTYPE_AKM_ATTR_IFTYPES, ++ NL80211_IFTYPE_AKM_ATTR_SUITES, ++ ++ /* keep last */ ++ __NL80211_IFTYPE_AKM_ATTR_LAST, ++ NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1, ++}; + + #endif /* __LINUX_NL80211_H */ From 67861b2a66eb3af688691f941cabf334c81578f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 21 May 2020 08:58:19 +0200 Subject: [PATCH 12/21] bcm63xx: nand: fix v2.1 controller support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Page size shift is different from v2.2+ controllers Signed-off-by: Álvaro Fernández Rojas --- ...cmnand-support-v2.1-v2.2-controllers.patch | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/target/linux/bcm63xx/patches-5.4/441-mtd-rawnand-brcmnand-support-v2.1-v2.2-controllers.patch b/target/linux/bcm63xx/patches-5.4/441-mtd-rawnand-brcmnand-support-v2.1-v2.2-controllers.patch index a212a5bda9..0d68a61ade 100644 --- a/target/linux/bcm63xx/patches-5.4/441-mtd-rawnand-brcmnand-support-v2.1-v2.2-controllers.patch +++ b/target/linux/bcm63xx/patches-5.4/441-mtd-rawnand-brcmnand-support-v2.1-v2.2-controllers.patch @@ -1,6 +1,14 @@ --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -269,6 +269,36 @@ enum brcmnand_reg { +@@ -196,6 +196,7 @@ struct brcmnand_controller { + const unsigned int *block_sizes; + unsigned int max_page_size; + const unsigned int *page_sizes; ++ unsigned int page_size_shift; + unsigned int max_oob; + u32 features; + +@@ -269,6 +270,36 @@ enum brcmnand_reg { BRCMNAND_FC_BASE, }; @@ -37,7 +45,17 @@ /* BRCMNAND v3.3-v4.0 */ static const u16 brcmnand_regs_v33[] = { [BRCMNAND_CMD_START] = 0x04, -@@ -502,12 +532,16 @@ static int brcmnand_revision_init(struct +@@ -467,6 +498,9 @@ enum { + CFG_BUS_WIDTH = BIT(CFG_BUS_WIDTH_SHIFT), + CFG_DEVICE_SIZE_SHIFT = 24, + ++ /* Only for v2.1 */ ++ CFG_PAGE_SIZE_SHIFT_v2_1 = 30, ++ + /* Only for pre-v7.1 (with no CFG_EXT register) */ + CFG_PAGE_SIZE_SHIFT = 20, + CFG_BLK_SIZE_SHIFT = 28, +@@ -502,12 +536,16 @@ static int brcmnand_revision_init(struct { static const unsigned int block_sizes_v6[] = { 8, 16, 128, 256, 512, 1024, 2048, 0 }; static const unsigned int block_sizes_v4[] = { 16, 128, 8, 512, 256, 1024, 2048, 0 }; @@ -56,7 +74,7 @@ dev_err(ctrl->dev, "version %#x not supported\n", ctrl->nand_version); return -ENODEV; -@@ -524,6 +558,8 @@ static int brcmnand_revision_init(struct +@@ -524,6 +562,8 @@ static int brcmnand_revision_init(struct ctrl->reg_offsets = brcmnand_regs_v50; else if (ctrl->nand_version >= 0x0303) ctrl->reg_offsets = brcmnand_regs_v33; @@ -65,7 +83,7 @@ /* Chip-select stride */ if (ctrl->nand_version >= 0x0701) -@@ -549,14 +585,27 @@ static int brcmnand_revision_init(struct +@@ -549,14 +589,32 @@ static int brcmnand_revision_init(struct ctrl->max_page_size = 16 * 1024; ctrl->max_block_size = 2 * 1024 * 1024; } else { @@ -76,6 +94,11 @@ + ctrl->page_sizes = page_sizes_v2_2; + else + ctrl->page_sizes = page_sizes_v2_1; ++ ++ if (ctrl->nand_version >= 0x0202) ++ ctrl->page_size_shift = CFG_PAGE_SIZE_SHIFT; ++ else ++ ctrl->page_size_shift = CFG_PAGE_SIZE_SHIFT_v2_1; + if (ctrl->nand_version >= 0x0600) ctrl->block_sizes = block_sizes_v6; @@ -96,7 +119,7 @@ ctrl->max_block_size = 512 * 1024; } } -@@ -724,6 +773,9 @@ static void brcmnand_wr_corr_thresh(stru +@@ -724,6 +782,9 @@ static void brcmnand_wr_corr_thresh(stru enum brcmnand_reg reg = BRCMNAND_CORR_THRESHOLD; int cs = host->cs; @@ -106,7 +129,7 @@ if (ctrl->nand_version == 0x0702) bits = 7; else if (ctrl->nand_version >= 0x0600) -@@ -782,8 +834,10 @@ static inline u32 brcmnand_spare_area_ma +@@ -782,8 +843,10 @@ static inline u32 brcmnand_spare_area_ma return GENMASK(7, 0); else if (ctrl->nand_version >= 0x0600) return GENMASK(6, 0); @@ -118,7 +141,16 @@ } #define NAND_ACC_CONTROL_ECC_SHIFT 16 -@@ -2158,9 +2212,11 @@ static int brcmnand_set_cfg(struct brcmn +@@ -2146,7 +2209,7 @@ static int brcmnand_set_cfg(struct brcmn + (!!(cfg->device_width == 16) << CFG_BUS_WIDTH_SHIFT) | + (device_size << CFG_DEVICE_SIZE_SHIFT); + if (cfg_offs == cfg_ext_offs) { +- tmp |= (page_size << CFG_PAGE_SIZE_SHIFT) | ++ tmp |= (page_size << ctrl->page_size_shift) | + (block_size << CFG_BLK_SIZE_SHIFT); + nand_writereg(ctrl, cfg_offs, tmp); + } else { +@@ -2158,9 +2221,11 @@ static int brcmnand_set_cfg(struct brcmn tmp = nand_readreg(ctrl, acc_control_offs); tmp &= ~brcmnand_ecc_level_mask(ctrl); @@ -132,7 +164,7 @@ nand_writereg(ctrl, acc_control_offs, tmp); brcmnand_set_sector_size_1k(host, cfg->sector_size_1k); -@@ -2524,6 +2580,8 @@ const struct dev_pm_ops brcmnand_pm_ops +@@ -2524,6 +2589,8 @@ const struct dev_pm_ops brcmnand_pm_ops EXPORT_SYMBOL_GPL(brcmnand_pm_ops); static const struct of_device_id brcmnand_of_match[] = { From 7a817752f67119be746d55dd90f6c43036f0c725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 21 May 2020 09:01:45 +0200 Subject: [PATCH 13/21] bcm63xx: dgnd3700-v1: add NAND support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NAND is used as extra storage on this device. Signed-off-by: Daniel Gonzalez Cabanelas Signed-off-by: Álvaro Fernández Rojas --- .../dts/bcm6368-netgear-dgnd3700-v1.dts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts b/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts index 0c88d56c86..546b0b1f60 100644 --- a/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts +++ b/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts @@ -187,6 +187,32 @@ }; }; +&nflash { + status = "okay"; + + nandcs@0 { + compatible = "brcm,nandcs"; + #size-cells = <1>; + #address-cells = <1>; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <15>; + nand-on-flash-bbt; + brcm,nand-oob-sector-size = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "storage"; + reg = <0x0000000 0x8000000>; + }; + }; + }; +}; + &uart0 { status = "okay"; }; From 6dc3dce65848891468830105a63e36da1c8158bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 21 May 2020 14:58:36 +0200 Subject: [PATCH 14/21] bcm63xx: improve rgmii ctrl overrides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are older devices which require overriding the RGMII ports, so this shouldn't be limited and forced to BCM63268. Signed-off-by: Álvaro Fernández Rojas --- ...h => 428-bcm63xx_enet-rgmii-ctrl-fix.patch} | 18 +++++++++++++++--- .../patches-5.4/540-board_vw6339gu.patch | 8 +++++--- .../patches-5.4/541-board_963268gu_p300.patch | 14 +++++++++++--- .../patches-5.4/542-board_WAP-5813n.patch | 4 ++-- .../patches-5.4/543-board_VR-3025u.patch | 4 ++-- .../patches-5.4/544-board_VR-3025un.patch | 4 ++-- .../patches-5.4/545-board_P870HW-51a_v2.patch | 4 ++-- .../bcm63xx/patches-5.4/546-board_hw520.patch | 4 ++-- .../bcm63xx/patches-5.4/547-board_A4001N.patch | 4 ++-- .../patches-5.4/548-board_dsl-2751b_e1.patch | 4 ++-- .../549-board_DGND3700v1_3800B.patch | 4 ++-- .../patches-5.4/550-board_homehub2a.patch | 4 ++-- .../bcm63xx/patches-5.4/551-board_HG655b.patch | 4 ++-- .../patches-5.4/552-board_fast2704n.patch | 4 ++-- .../patches-5.4/553-board_VR-3026e.patch | 4 ++-- .../patches-5.4/554-board_R5010UNv2.patch | 4 ++-- .../bcm63xx/patches-5.4/555-board_HG622.patch | 4 ++-- .../patches-5.4/556-board_EVG2000.patch | 4 ++-- .../patches-5.4/557-board_AV4202N.patch | 4 ++-- .../patches-5.4/558-board_VH4032N.patch | 4 ++-- .../bcm63xx/patches-5.4/559-board_R1000H.patch | 4 ++-- .../patches-5.4/560-board_AR-5315u.patch | 4 ++-- .../bcm63xx/patches-5.4/561-board_AD1018.patch | 4 ++-- .../bcm63xx/patches-5.4/562-board_sr102.patch | 6 +++--- .../patches-5.4/563-board-VR-3032u.patch | 6 +++--- .../patches-5.4/564-board-DGND3700v2.patch | 4 ++-- .../patches-5.4/565-board-VG-8050.patch | 8 +++++--- 27 files changed, 84 insertions(+), 60 deletions(-) rename target/linux/bcm63xx/patches-5.4/{804-bcm63xx_enet_63268_rgmii_ports.patch => 428-bcm63xx_enet-rgmii-ctrl-fix.patch} (55%) diff --git a/target/linux/bcm63xx/patches-5.4/804-bcm63xx_enet_63268_rgmii_ports.patch b/target/linux/bcm63xx/patches-5.4/428-bcm63xx_enet-rgmii-ctrl-fix.patch similarity index 55% rename from target/linux/bcm63xx/patches-5.4/804-bcm63xx_enet_63268_rgmii_ports.patch rename to target/linux/bcm63xx/patches-5.4/428-bcm63xx_enet-rgmii-ctrl-fix.patch index c271436b3c..f744d3dab9 100644 --- a/target/linux/bcm63xx/patches-5.4/804-bcm63xx_enet_63268_rgmii_ports.patch +++ b/target/linux/bcm63xx/patches-5.4/428-bcm63xx_enet-rgmii-ctrl-fix.patch @@ -1,13 +1,25 @@ +--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h ++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h +@@ -79,6 +79,9 @@ struct bcm63xx_enetsw_port { + int force_speed; + int force_duplex_full; + ++ int mii_override; ++ int timing_sel; ++ + const char *name; + }; + --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -2209,6 +2209,10 @@ static int bcm_enetsw_open(struct net_de rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i)); rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN; -+ if (BCMCPU_IS_63268()) { -+ rgmii_ctrl |= ENETSW_RGMII_CTRL_TIMING_SEL_EN; ++ if (priv->used_ports[i].mii_override) + rgmii_ctrl |= ENETSW_RGMII_CTRL_MII_OVERRIDE_EN; -+ } ++ if (priv->used_ports[i].timing_sel) ++ rgmii_ctrl |= ENETSW_RGMII_CTRL_TIMING_SEL_EN; enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i)); } diff --git a/target/linux/bcm63xx/patches-5.4/540-board_vw6339gu.patch b/target/linux/bcm63xx/patches-5.4/540-board_vw6339gu.patch index 355bdb2767..da9000ac3e 100644 --- a/target/linux/bcm63xx/patches-5.4/540-board_vw6339gu.patch +++ b/target/linux/bcm63xx/patches-5.4/540-board_vw6339gu.patch @@ -1,6 +1,6 @@ --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1610,6 +1610,51 @@ static struct board_info __initdata boar +@@ -1610,6 +1610,53 @@ static struct board_info __initdata boar }, }, }; @@ -45,6 +45,8 @@ + .used = 1, + .phy_id = 7, + .name = "WAN", ++ .mii_override = 1, ++ .timing_sel = 1, + }, + }, + }, @@ -52,7 +54,7 @@ #endif /* CONFIG_BCM63XX_CPU_63268 */ /* -@@ -1696,6 +1741,7 @@ static const struct board_info __initcon +@@ -1696,6 +1743,7 @@ static const struct board_info __initcon #endif #ifdef CONFIG_BCM63XX_CPU_63268 &board_963269bhr, @@ -60,7 +62,7 @@ #endif }; -@@ -1786,6 +1832,7 @@ static struct of_device_id const bcm963x +@@ -1786,6 +1834,7 @@ static struct of_device_id const bcm963x #endif #ifdef CONFIG_BCM63XX_CPU_63268 { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, diff --git a/target/linux/bcm63xx/patches-5.4/541-board_963268gu_p300.patch b/target/linux/bcm63xx/patches-5.4/541-board_963268gu_p300.patch index b8a2af4319..2cd09b69e2 100644 --- a/target/linux/bcm63xx/patches-5.4/541-board_963268gu_p300.patch +++ b/target/linux/bcm63xx/patches-5.4/541-board_963268gu_p300.patch @@ -1,6 +1,6 @@ --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1572,6 +1572,64 @@ static struct board_info __initdata boar +@@ -1572,6 +1572,72 @@ static struct board_info __initdata boar * known 63268/63269 boards */ #ifdef CONFIG_BCM63XX_CPU_63268 @@ -39,24 +39,32 @@ + .used = 1, + .phy_id = 0, + .name = "GbE3", ++ .mii_override = 1, ++ .timing_sel = 1, + }, + + [5] = { + .used = 1, + .phy_id = 1, + .name = "GbE1", ++ .mii_override = 1, ++ .timing_sel = 1, + }, + + [6] = { + .used = 1, + .phy_id = 24, + .name = "GbE4", ++ .mii_override = 1, ++ .timing_sel = 1, + }, + + [7] = { + .used = 1, + .phy_id = 25, + .name = "GbE5", ++ .mii_override = 1, ++ .timing_sel = 1, + }, + }, + }, @@ -65,7 +73,7 @@ static struct board_info __initdata board_963269bhr = { .name = "963269BHR", .expected_cpu_id = 0x63268, -@@ -1740,6 +1798,7 @@ static const struct board_info __initcon +@@ -1742,6 +1808,7 @@ static const struct board_info __initcon &board_96368mvngr, #endif #ifdef CONFIG_BCM63XX_CPU_63268 @@ -73,7 +81,7 @@ &board_963269bhr, &board_vw6339gu, #endif -@@ -1831,6 +1890,7 @@ static struct of_device_id const bcm963x +@@ -1833,6 +1900,7 @@ static struct of_device_id const bcm963x { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, #endif #ifdef CONFIG_BCM63XX_CPU_63268 diff --git a/target/linux/bcm63xx/patches-5.4/542-board_WAP-5813n.patch b/target/linux/bcm63xx/patches-5.4/542-board_WAP-5813n.patch index 8b8b1ed829..c08c2c0fc0 100644 --- a/target/linux/bcm63xx/patches-5.4/542-board_WAP-5813n.patch +++ b/target/linux/bcm63xx/patches-5.4/542-board_WAP-5813n.patch @@ -57,7 +57,7 @@ #endif /* CONFIG_BCM63XX_CPU_6368 */ /* -@@ -1796,6 +1839,7 @@ static const struct board_info __initcon +@@ -1806,6 +1849,7 @@ static const struct board_info __initcon #ifdef CONFIG_BCM63XX_CPU_6368 &board_96368mvwg, &board_96368mvngr, @@ -65,7 +65,7 @@ #endif #ifdef CONFIG_BCM63XX_CPU_63268 &board_963268bu_p300, -@@ -1888,6 +1932,7 @@ static struct of_device_id const bcm963x +@@ -1898,6 +1942,7 @@ static struct of_device_id const bcm963x #ifdef CONFIG_BCM63XX_CPU_6368 { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, diff --git a/target/linux/bcm63xx/patches-5.4/543-board_VR-3025u.patch b/target/linux/bcm63xx/patches-5.4/543-board_VR-3025u.patch index 36014ea49a..b92f032047 100644 --- a/target/linux/bcm63xx/patches-5.4/543-board_VR-3025u.patch +++ b/target/linux/bcm63xx/patches-5.4/543-board_VR-3025u.patch @@ -60,7 +60,7 @@ static struct sprom_fixup __initdata wap5813n_fixups[] = { { .offset = 97, .value = 0xfeed }, { .offset = 98, .value = 0x15d1 }, -@@ -1839,6 +1892,7 @@ static const struct board_info __initcon +@@ -1849,6 +1902,7 @@ static const struct board_info __initcon #ifdef CONFIG_BCM63XX_CPU_6368 &board_96368mvwg, &board_96368mvngr, @@ -68,7 +68,7 @@ &board_WAP5813n, #endif #ifdef CONFIG_BCM63XX_CPU_63268 -@@ -1932,6 +1986,7 @@ static struct of_device_id const bcm963x +@@ -1942,6 +1996,7 @@ static struct of_device_id const bcm963x #ifdef CONFIG_BCM63XX_CPU_6368 { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, diff --git a/target/linux/bcm63xx/patches-5.4/544-board_VR-3025un.patch b/target/linux/bcm63xx/patches-5.4/544-board_VR-3025un.patch index a34b7a1f3f..ec0e13db56 100644 --- a/target/linux/bcm63xx/patches-5.4/544-board_VR-3025un.patch +++ b/target/linux/bcm63xx/patches-5.4/544-board_VR-3025un.patch @@ -60,7 +60,7 @@ static struct sprom_fixup __initdata wap5813n_fixups[] = { { .offset = 97, .value = 0xfeed }, { .offset = 98, .value = 0x15d1 }, -@@ -1893,6 +1946,7 @@ static const struct board_info __initcon +@@ -1903,6 +1956,7 @@ static const struct board_info __initcon &board_96368mvwg, &board_96368mvngr, &board_VR3025u, @@ -68,7 +68,7 @@ &board_WAP5813n, #endif #ifdef CONFIG_BCM63XX_CPU_63268 -@@ -1987,6 +2041,7 @@ static struct of_device_id const bcm963x +@@ -1997,6 +2051,7 @@ static struct of_device_id const bcm963x { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, diff --git a/target/linux/bcm63xx/patches-5.4/545-board_P870HW-51a_v2.patch b/target/linux/bcm63xx/patches-5.4/545-board_P870HW-51a_v2.patch index 9e068029e8..6b60a3fa86 100644 --- a/target/linux/bcm63xx/patches-5.4/545-board_P870HW-51a_v2.patch +++ b/target/linux/bcm63xx/patches-5.4/545-board_P870HW-51a_v2.patch @@ -49,7 +49,7 @@ static struct board_info __initdata board_VR3025u = { .name = "96368M-1541N", .expected_cpu_id = 0x6368, -@@ -1945,6 +1987,7 @@ static const struct board_info __initcon +@@ -1955,6 +1997,7 @@ static const struct board_info __initcon #ifdef CONFIG_BCM63XX_CPU_6368 &board_96368mvwg, &board_96368mvngr, @@ -57,7 +57,7 @@ &board_VR3025u, &board_VR3025un, &board_WAP5813n, -@@ -2043,6 +2086,7 @@ static struct of_device_id const bcm963x +@@ -2053,6 +2096,7 @@ static struct of_device_id const bcm963x { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, diff --git a/target/linux/bcm63xx/patches-5.4/546-board_hw520.patch b/target/linux/bcm63xx/patches-5.4/546-board_hw520.patch index 517df7d9f3..aaf662a76c 100644 --- a/target/linux/bcm63xx/patches-5.4/546-board_hw520.patch +++ b/target/linux/bcm63xx/patches-5.4/546-board_hw520.patch @@ -37,7 +37,7 @@ static struct board_info __initdata board_HW553 = { .name = "HW553", .expected_cpu_id = 0x6358, -@@ -1971,6 +2001,7 @@ static const struct board_info __initcon +@@ -1981,6 +2011,7 @@ static const struct board_info __initcon &board_nb4_ser_r0, &board_nb4_fxc_r1, &board_ct6373_1, @@ -45,7 +45,7 @@ &board_HW553, &board_HW556_A, &board_HW556_B, -@@ -2063,6 +2094,7 @@ static struct of_device_id const bcm963x +@@ -2073,6 +2104,7 @@ static struct of_device_id const bcm963x { .compatible = "d-link,dsl-274xb-c2", .data = &board_dsl_274xb_rev_c, }, { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, { .compatible = "d-link,dva-g3810bn-tl", .data = &board_DVAG3810BN, }, diff --git a/target/linux/bcm63xx/patches-5.4/547-board_A4001N.patch b/target/linux/bcm63xx/patches-5.4/547-board_A4001N.patch index 2dc61d5a4f..1992e0c6d4 100644 --- a/target/linux/bcm63xx/patches-5.4/547-board_A4001N.patch +++ b/target/linux/bcm63xx/patches-5.4/547-board_A4001N.patch @@ -50,7 +50,7 @@ static struct board_info __initdata board_A4001N1 = { .name = "963281T_TEF", .expected_cpu_id = 0x6328, -@@ -1952,6 +1995,7 @@ static const struct board_info __initcon +@@ -1962,6 +2005,7 @@ static const struct board_info __initcon &board_AR5381u, &board_AR5387un, &board_963281TAN, @@ -58,7 +58,7 @@ &board_A4001N1, &board_dsl_274xb_f1, &board_FAST2704V2, -@@ -2040,6 +2084,7 @@ static struct of_device_id const bcm963x +@@ -2050,6 +2094,7 @@ static struct of_device_id const bcm963x { .compatible = "brcm,bcm96318ref-p300", .data = &board_96318ref_p300, }, #endif #ifdef CONFIG_BCM63XX_CPU_6328 diff --git a/target/linux/bcm63xx/patches-5.4/548-board_dsl-2751b_e1.patch b/target/linux/bcm63xx/patches-5.4/548-board_dsl-2751b_e1.patch index b7e155de55..7eb52ae863 100644 --- a/target/linux/bcm63xx/patches-5.4/548-board_dsl-2751b_e1.patch +++ b/target/linux/bcm63xx/patches-5.4/548-board_dsl-2751b_e1.patch @@ -75,7 +75,7 @@ #endif /* CONFIG_BCM63XX_CPU_6318 */ /* -@@ -1989,6 +2057,7 @@ static const struct board_info __initcon +@@ -1999,6 +2067,7 @@ static const struct board_info __initcon #ifdef CONFIG_BCM63XX_CPU_6318 &board_96318ref, &board_96318ref_p300, @@ -83,7 +83,7 @@ #endif #ifdef CONFIG_BCM63XX_CPU_6328 &board_96328avng, -@@ -2082,6 +2151,7 @@ static struct of_device_id const bcm963x +@@ -2092,6 +2161,7 @@ static struct of_device_id const bcm963x #ifdef CONFIG_BCM63XX_CPU_6318 { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, }, { .compatible = "brcm,bcm96318ref-p300", .data = &board_96318ref_p300, }, diff --git a/target/linux/bcm63xx/patches-5.4/549-board_DGND3700v1_3800B.patch b/target/linux/bcm63xx/patches-5.4/549-board_DGND3700v1_3800B.patch index 29263bc9c8..936aab115b 100644 --- a/target/linux/bcm63xx/patches-5.4/549-board_DGND3700v1_3800B.patch +++ b/target/linux/bcm63xx/patches-5.4/549-board_DGND3700v1_3800B.patch @@ -31,7 +31,7 @@ static struct sprom_fixup __initdata vr3025u_fixups[] = { { .offset = 97, .value = 0xfeb3 }, { .offset = 98, .value = 0x1618 }, -@@ -2131,6 +2155,7 @@ static const struct board_info __initcon +@@ -2141,6 +2165,7 @@ static const struct board_info __initcon #ifdef CONFIG_BCM63XX_CPU_6368 &board_96368mvwg, &board_96368mvngr, @@ -39,7 +39,7 @@ &board_P870HW51A_V2, &board_VR3025u, &board_VR3025un, -@@ -2233,6 +2258,7 @@ static struct of_device_id const bcm963x +@@ -2243,6 +2268,7 @@ static struct of_device_id const bcm963x { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, diff --git a/target/linux/bcm63xx/patches-5.4/550-board_homehub2a.patch b/target/linux/bcm63xx/patches-5.4/550-board_homehub2a.patch index 990999479d..267143cf94 100644 --- a/target/linux/bcm63xx/patches-5.4/550-board_homehub2a.patch +++ b/target/linux/bcm63xx/patches-5.4/550-board_homehub2a.patch @@ -32,7 +32,7 @@ static struct board_info __initdata board_HW520 = { .name = "HW6358GW_B", .expected_cpu_id = 0x6358, -@@ -2138,6 +2163,7 @@ static const struct board_info __initcon +@@ -2148,6 +2173,7 @@ static const struct board_info __initcon &board_nb4_ser_r0, &board_nb4_fxc_r1, &board_ct6373_1, @@ -40,7 +40,7 @@ &board_HW520, &board_HW553, &board_HW556_A, -@@ -2247,6 +2273,7 @@ static struct of_device_id const bcm963x +@@ -2257,6 +2283,7 @@ static struct of_device_id const bcm963x { .compatible = "sfr,neufbox-4-foxconn-r1", .data = &board_nb4_fxc_r1, }, { .compatible = "t-com,speedport-w-303v", .data = &board_spw303v, }, { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, diff --git a/target/linux/bcm63xx/patches-5.4/551-board_HG655b.patch b/target/linux/bcm63xx/patches-5.4/551-board_HG655b.patch index 7b4d1fc727..d1b865134a 100644 --- a/target/linux/bcm63xx/patches-5.4/551-board_HG655b.patch +++ b/target/linux/bcm63xx/patches-5.4/551-board_HG655b.patch @@ -53,7 +53,7 @@ static struct sprom_fixup __initdata vr3025u_fixups[] = { { .offset = 97, .value = 0xfeb3 }, { .offset = 98, .value = 0x1618 }, -@@ -2182,6 +2228,7 @@ static const struct board_info __initcon +@@ -2192,6 +2238,7 @@ static const struct board_info __initcon &board_96368mvwg, &board_96368mvngr, &board_DGND3700v1_3800B, @@ -61,7 +61,7 @@ &board_P870HW51A_V2, &board_VR3025u, &board_VR3025un, -@@ -2285,6 +2332,7 @@ static struct of_device_id const bcm963x +@@ -2295,6 +2342,7 @@ static struct of_device_id const bcm963x { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, diff --git a/target/linux/bcm63xx/patches-5.4/552-board_fast2704n.patch b/target/linux/bcm63xx/patches-5.4/552-board_fast2704n.patch index fb84d8d70c..59f57bc8dc 100644 --- a/target/linux/bcm63xx/patches-5.4/552-board_fast2704n.patch +++ b/target/linux/bcm63xx/patches-5.4/552-board_fast2704n.patch @@ -46,7 +46,7 @@ #endif /* CONFIG_BCM63XX_CPU_6318 */ /* -@@ -2153,6 +2192,7 @@ static const struct board_info __initcon +@@ -2163,6 +2202,7 @@ static const struct board_info __initcon &board_96318ref, &board_96318ref_p300, &board_dsl_2751b_d1, @@ -54,7 +54,7 @@ #endif #ifdef CONFIG_BCM63XX_CPU_6328 &board_96328avng, -@@ -2250,6 +2290,7 @@ static struct of_device_id const bcm963x +@@ -2260,6 +2300,7 @@ static struct of_device_id const bcm963x { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, }, { .compatible = "brcm,bcm96318ref-p300", .data = &board_96318ref_p300, }, { .compatible = "d-link,dsl-275xb-d1", .data = &board_dsl_2751b_d1, }, diff --git a/target/linux/bcm63xx/patches-5.4/553-board_VR-3026e.patch b/target/linux/bcm63xx/patches-5.4/553-board_VR-3026e.patch index dec8adf709..1455b748ce 100644 --- a/target/linux/bcm63xx/patches-5.4/553-board_VR-3026e.patch +++ b/target/linux/bcm63xx/patches-5.4/553-board_VR-3026e.patch @@ -60,7 +60,7 @@ static struct sprom_fixup __initdata wap5813n_fixups[] = { { .offset = 97, .value = 0xfeed }, { .offset = 98, .value = 0x15d1 }, -@@ -2272,6 +2325,7 @@ static const struct board_info __initcon +@@ -2282,6 +2335,7 @@ static const struct board_info __initcon &board_P870HW51A_V2, &board_VR3025u, &board_VR3025un, @@ -68,7 +68,7 @@ &board_WAP5813n, #endif #ifdef CONFIG_BCM63XX_CPU_63268 -@@ -2372,6 +2426,7 @@ static struct of_device_id const bcm963x +@@ -2382,6 +2436,7 @@ static struct of_device_id const bcm963x { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, diff --git a/target/linux/bcm63xx/patches-5.4/554-board_R5010UNv2.patch b/target/linux/bcm63xx/patches-5.4/554-board_R5010UNv2.patch index ab3e6fea86..8c9cc3944f 100644 --- a/target/linux/bcm63xx/patches-5.4/554-board_R5010UNv2.patch +++ b/target/linux/bcm63xx/patches-5.4/554-board_R5010UNv2.patch @@ -51,7 +51,7 @@ #endif /* CONFIG_BCM63XX_CPU_6328 */ /* -@@ -2256,6 +2300,7 @@ static const struct board_info __initcon +@@ -2266,6 +2310,7 @@ static const struct board_info __initcon &board_A4001N1, &board_dsl_274xb_f1, &board_FAST2704V2, @@ -59,7 +59,7 @@ #endif #ifdef CONFIG_BCM63XX_CPU_6338 &board_96338gw, -@@ -2354,6 +2399,7 @@ static struct of_device_id const bcm963x +@@ -2364,6 +2409,7 @@ static struct of_device_id const bcm963x { .compatible = "comtrend,ar-5381u", .data = &board_AR5381u, }, { .compatible = "comtrend,ar-5387un", .data = &board_AR5387un, }, { .compatible = "d-link,dsl-274xb-f1", .data = &board_dsl_274xb_f1, }, diff --git a/target/linux/bcm63xx/patches-5.4/555-board_HG622.patch b/target/linux/bcm63xx/patches-5.4/555-board_HG622.patch index 3a14751d5c..31c83972cc 100644 --- a/target/linux/bcm63xx/patches-5.4/555-board_HG622.patch +++ b/target/linux/bcm63xx/patches-5.4/555-board_HG622.patch @@ -53,7 +53,7 @@ static struct sprom_fixup __initdata vr3025u_fixups[] = { { .offset = 97, .value = 0xfeb3 }, { .offset = 98, .value = 0x1618 }, -@@ -2366,6 +2412,7 @@ static const struct board_info __initcon +@@ -2376,6 +2422,7 @@ static const struct board_info __initcon &board_96368mvwg, &board_96368mvngr, &board_DGND3700v1_3800B, @@ -61,7 +61,7 @@ &board_HG655b, &board_P870HW51A_V2, &board_VR3025u, -@@ -2474,6 +2521,7 @@ static struct of_device_id const bcm963x +@@ -2484,6 +2531,7 @@ static struct of_device_id const bcm963x { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, { .compatible = "comtrend,vr-3026e", .data = &board_VR3026e, }, { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, diff --git a/target/linux/bcm63xx/patches-5.4/556-board_EVG2000.patch b/target/linux/bcm63xx/patches-5.4/556-board_EVG2000.patch index 1619376490..6981b2ae16 100644 --- a/target/linux/bcm63xx/patches-5.4/556-board_EVG2000.patch +++ b/target/linux/bcm63xx/patches-5.4/556-board_EVG2000.patch @@ -43,7 +43,7 @@ static struct board_info __initdata board_HG655b = { .name = "HW65x", .expected_cpu_id = 0x6368, -@@ -2412,6 +2448,7 @@ static const struct board_info __initcon +@@ -2422,6 +2458,7 @@ static const struct board_info __initcon &board_96368mvwg, &board_96368mvngr, &board_DGND3700v1_3800B, @@ -51,7 +51,7 @@ &board_HG622, &board_HG655b, &board_P870HW51A_V2, -@@ -2524,6 +2561,7 @@ static struct of_device_id const bcm963x +@@ -2534,6 +2571,7 @@ static struct of_device_id const bcm963x { .compatible = "huawei,echolife-hg622", .data = &board_HG622, }, { .compatible = "huawei,echolife-hg655b", .data = &board_HG655b, }, { .compatible = "netgear,dgnd3700-v1", .data = &board_DGND3700v1_3800B, }, diff --git a/target/linux/bcm63xx/patches-5.4/557-board_AV4202N.patch b/target/linux/bcm63xx/patches-5.4/557-board_AV4202N.patch index c61fcdd98a..fbf58fe33a 100644 --- a/target/linux/bcm63xx/patches-5.4/557-board_AV4202N.patch +++ b/target/linux/bcm63xx/patches-5.4/557-board_AV4202N.patch @@ -52,7 +52,7 @@ static struct board_info __initdata board_96368mvwg = { .name = "96368MVWG", .expected_cpu_id = 0x6368, -@@ -2445,6 +2490,7 @@ static const struct board_info __initcon +@@ -2455,6 +2500,7 @@ static const struct board_info __initcon #endif #ifdef CONFIG_BCM63XX_CPU_6368 @@ -60,7 +60,7 @@ &board_96368mvwg, &board_96368mvngr, &board_DGND3700v1_3800B, -@@ -2552,6 +2598,7 @@ static struct of_device_id const bcm963x +@@ -2562,6 +2608,7 @@ static struct of_device_id const bcm963x { .compatible = "sfr,neufbox-6-sercomm-r0", .data = &board_nb6, }, #endif #ifdef CONFIG_BCM63XX_CPU_6368 diff --git a/target/linux/bcm63xx/patches-5.4/558-board_VH4032N.patch b/target/linux/bcm63xx/patches-5.4/558-board_VH4032N.patch index baed99ccb8..b89ac7fd49 100644 --- a/target/linux/bcm63xx/patches-5.4/558-board_VH4032N.patch +++ b/target/linux/bcm63xx/patches-5.4/558-board_VH4032N.patch @@ -107,7 +107,7 @@ static struct sprom_fixup __initdata wap5813n_fixups[] = { { .offset = 97, .value = 0xfeed }, { .offset = 98, .value = 0x15d1 }, -@@ -2498,6 +2598,7 @@ static const struct board_info __initcon +@@ -2508,6 +2608,7 @@ static const struct board_info __initcon &board_HG622, &board_HG655b, &board_P870HW51A_V2, @@ -115,7 +115,7 @@ &board_VR3025u, &board_VR3025un, &board_VR3026e, -@@ -2609,6 +2710,7 @@ static struct of_device_id const bcm963x +@@ -2619,6 +2720,7 @@ static struct of_device_id const bcm963x { .compatible = "huawei,echolife-hg655b", .data = &board_HG655b, }, { .compatible = "netgear,dgnd3700-v1", .data = &board_DGND3700v1_3800B, }, { .compatible = "netgear,evg2000", .data = &board_EVG2000, }, diff --git a/target/linux/bcm63xx/patches-5.4/559-board_R1000H.patch b/target/linux/bcm63xx/patches-5.4/559-board_R1000H.patch index f2b2e1e0b4..9c42c6ea84 100644 --- a/target/linux/bcm63xx/patches-5.4/559-board_R1000H.patch +++ b/target/linux/bcm63xx/patches-5.4/559-board_R1000H.patch @@ -30,7 +30,7 @@ static struct board_info __initdata board_VR3025u = { .name = "96368M-1541N", .expected_cpu_id = 0x6368, -@@ -2598,6 +2621,7 @@ static const struct board_info __initcon +@@ -2608,6 +2631,7 @@ static const struct board_info __initcon &board_HG622, &board_HG655b, &board_P870HW51A_V2, @@ -38,7 +38,7 @@ &board_VH4032N, &board_VR3025u, &board_VR3025un, -@@ -2699,6 +2723,7 @@ static struct of_device_id const bcm963x +@@ -2709,6 +2733,7 @@ static struct of_device_id const bcm963x { .compatible = "sfr,neufbox-6-sercomm-r0", .data = &board_nb6, }, #endif #ifdef CONFIG_BCM63XX_CPU_6368 diff --git a/target/linux/bcm63xx/patches-5.4/560-board_AR-5315u.patch b/target/linux/bcm63xx/patches-5.4/560-board_AR-5315u.patch index 0393d46cd3..e7fe6f69ac 100644 --- a/target/linux/bcm63xx/patches-5.4/560-board_AR-5315u.patch +++ b/target/linux/bcm63xx/patches-5.4/560-board_AR-5315u.patch @@ -68,7 +68,7 @@ static struct sprom_fixup __initdata dsl2751b_e1_fixups[] = { { .offset = 96, .value = 0x2046 }, { .offset = 97, .value = 0xfe9d }, -@@ -2538,6 +2599,7 @@ static const struct board_info __initcon +@@ -2548,6 +2609,7 @@ static const struct board_info __initcon #ifdef CONFIG_BCM63XX_CPU_6318 &board_96318ref, &board_96318ref_p300, @@ -76,7 +76,7 @@ &board_dsl_2751b_d1, &board_FAST2704N, #endif -@@ -2643,6 +2705,7 @@ static struct of_device_id const bcm963x +@@ -2653,6 +2715,7 @@ static struct of_device_id const bcm963x #ifdef CONFIG_BCM63XX_CPU_6318 { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, }, { .compatible = "brcm,bcm96318ref-p300", .data = &board_96318ref_p300, }, diff --git a/target/linux/bcm63xx/patches-5.4/561-board_AD1018.patch b/target/linux/bcm63xx/patches-5.4/561-board_AD1018.patch index f0c450de38..b50954a156 100644 --- a/target/linux/bcm63xx/patches-5.4/561-board_AD1018.patch +++ b/target/linux/bcm63xx/patches-5.4/561-board_AD1018.patch @@ -74,7 +74,7 @@ static struct sprom_fixup __initdata ar5381u_fixups[] = { { .offset = 97, .value = 0xfee5 }, { .offset = 98, .value = 0x157c }, -@@ -2605,6 +2672,7 @@ static const struct board_info __initcon +@@ -2615,6 +2682,7 @@ static const struct board_info __initcon #endif #ifdef CONFIG_BCM63XX_CPU_6328 &board_96328avng, @@ -82,7 +82,7 @@ &board_AR5381u, &board_AR5387un, &board_963281TAN, -@@ -2719,6 +2787,8 @@ static struct of_device_id const bcm963x +@@ -2729,6 +2797,8 @@ static struct of_device_id const bcm963x { .compatible = "d-link,dsl-274xb-f1", .data = &board_dsl_274xb_f1, }, { .compatible = "nucom,r5010un-v2", .data = &board_R5010UNV2, }, { .compatible = "sagem,fast-2704-v2", .data = &board_FAST2704V2, }, diff --git a/target/linux/bcm63xx/patches-5.4/562-board_sr102.patch b/target/linux/bcm63xx/patches-5.4/562-board_sr102.patch index d6af1e56b6..8bae6c378b 100644 --- a/target/linux/bcm63xx/patches-5.4/562-board_sr102.patch +++ b/target/linux/bcm63xx/patches-5.4/562-board_sr102.patch @@ -1,6 +1,6 @@ --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -2654,6 +2654,49 @@ static struct board_info __initdata boar +@@ -2664,6 +2664,49 @@ static struct board_info __initdata boar }, }, }; @@ -50,7 +50,7 @@ #endif /* CONFIG_BCM63XX_CPU_63268 */ /* -@@ -2762,6 +2805,7 @@ static const struct board_info __initcon +@@ -2772,6 +2815,7 @@ static const struct board_info __initcon &board_963268bu_p300, &board_963269bhr, &board_vw6339gu, @@ -58,7 +58,7 @@ #endif }; -@@ -2875,6 +2919,7 @@ static struct of_device_id const bcm963x +@@ -2885,6 +2929,7 @@ static struct of_device_id const bcm963x { .compatible = "brcm,bcm963268bu-p300", .data = &board_963268bu_p300, }, { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, { .compatible = "inteno,vg50", .data = &board_vw6339gu, }, diff --git a/target/linux/bcm63xx/patches-5.4/563-board-VR-3032u.patch b/target/linux/bcm63xx/patches-5.4/563-board-VR-3032u.patch index a7e297d70e..925b150415 100644 --- a/target/linux/bcm63xx/patches-5.4/563-board-VR-3032u.patch +++ b/target/linux/bcm63xx/patches-5.4/563-board-VR-3032u.patch @@ -1,6 +1,6 @@ --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -2610,6 +2610,44 @@ static struct board_info __initdata boar +@@ -2618,6 +2618,44 @@ static struct board_info __initdata boar }, }; @@ -45,7 +45,7 @@ static struct board_info __initdata board_vw6339gu = { .name = "VW6339GU", .expected_cpu_id = 0x63268, -@@ -2804,6 +2842,7 @@ static const struct board_info __initcon +@@ -2814,6 +2852,7 @@ static const struct board_info __initcon #ifdef CONFIG_BCM63XX_CPU_63268 &board_963268bu_p300, &board_963269bhr, @@ -53,7 +53,7 @@ &board_vw6339gu, &board_BSKYB_63168, #endif -@@ -2918,6 +2957,7 @@ static struct of_device_id const bcm963x +@@ -2928,6 +2967,7 @@ static struct of_device_id const bcm963x #ifdef CONFIG_BCM63XX_CPU_63268 { .compatible = "brcm,bcm963268bu-p300", .data = &board_963268bu_p300, }, { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, diff --git a/target/linux/bcm63xx/patches-5.4/564-board-DGND3700v2.patch b/target/linux/bcm63xx/patches-5.4/564-board-DGND3700v2.patch index f17c7a843b..2a39c733eb 100644 --- a/target/linux/bcm63xx/patches-5.4/564-board-DGND3700v2.patch +++ b/target/linux/bcm63xx/patches-5.4/564-board-DGND3700v2.patch @@ -32,7 +32,7 @@ static struct board_info __initdata board_fast2504n = { .name = "F@ST2504n", .expected_cpu_id = 0x6362, -@@ -2820,6 +2845,7 @@ static const struct board_info __initcon +@@ -2830,6 +2855,7 @@ static const struct board_info __initcon #ifdef CONFIG_BCM63XX_CPU_6362 &board_nb6, @@ -40,7 +40,7 @@ &board_fast2504n, #endif -@@ -2935,6 +2961,7 @@ static struct of_device_id const bcm963x +@@ -2945,6 +2971,7 @@ static struct of_device_id const bcm963x { .compatible = "bt,home-hub-2-a", .data = &board_homehub2a, }, #endif #ifdef CONFIG_BCM63XX_CPU_6362 diff --git a/target/linux/bcm63xx/patches-5.4/565-board-VG-8050.patch b/target/linux/bcm63xx/patches-5.4/565-board-VG-8050.patch index ceca653ac6..7d39125cee 100644 --- a/target/linux/bcm63xx/patches-5.4/565-board-VG-8050.patch +++ b/target/linux/bcm63xx/patches-5.4/565-board-VG-8050.patch @@ -1,6 +1,6 @@ --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -2635,6 +2635,29 @@ static struct board_info __initdata boar +@@ -2643,6 +2643,31 @@ static struct board_info __initdata boar }, }; @@ -21,6 +21,8 @@ + .bypass_link = 1, + .force_speed = 1000, + .force_duplex_full = 1, ++ .mii_override = 1, ++ .timing_sel = 1, + .name = "RGMII", + }, + }, @@ -30,7 +32,7 @@ static struct board_info __initdata board_VR3032u = { .name = "963168M-1841N1", .expected_cpu_id = 0x63268, -@@ -2868,6 +2891,7 @@ static const struct board_info __initcon +@@ -2878,6 +2903,7 @@ static const struct board_info __initcon #ifdef CONFIG_BCM63XX_CPU_63268 &board_963268bu_p300, &board_963269bhr, @@ -38,7 +40,7 @@ &board_VR3032u, &board_vw6339gu, &board_BSKYB_63168, -@@ -2984,6 +3008,7 @@ static struct of_device_id const bcm963x +@@ -2994,6 +3020,7 @@ static struct of_device_id const bcm963x #ifdef CONFIG_BCM63XX_CPU_63268 { .compatible = "brcm,bcm963268bu-p300", .data = &board_963268bu_p300, }, { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, From d90828411ac774140892212852c07c16ea9e25d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 21 May 2020 15:01:05 +0200 Subject: [PATCH 15/21] scripts: add CFE Partition Tags support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some BCM63xx NAND devices require a specific JFFS2 partition tag to verify the JFFS2 partition validity: u32 part_id; u32 part_size; u16 flags; char part_name[33]; char part_version[21]; u32 part_crc32; Signed-off-by: Álvaro Fernández Rojas --- scripts/cfe-partition-tag.py | 191 +++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100755 scripts/cfe-partition-tag.py diff --git a/scripts/cfe-partition-tag.py b/scripts/cfe-partition-tag.py new file mode 100755 index 0000000000..a2605d5205 --- /dev/null +++ b/scripts/cfe-partition-tag.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python3 + +""" +CFE Partition Tag + +{ + u32 part_id; + u32 part_size; + u16 flags; + char part_name[33]; + char part_version[21]; + u32 part_crc32; +} + +""" + +import argparse +import os +import struct + +PART_NAME_SIZE = 33 +PART_VERSION_SIZE = 21 + +CRC32_INIT = 0xFFFFFFFF +CRC32_TABLE = [ + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +] + +def auto_int(x): + return int(x, 0) + +def crc32(bytes, size, crc): + i = 0 + while (i < size): + crc = (crc >> 8) ^ CRC32_TABLE[(crc ^ bytes[i]) & 0xff] + i += 1 + return crc + +def str_to_bytes_pad(string, size): + str_bytes = string.encode() + num_bytes = len(str_bytes) + if (num_bytes >= size): + str_bytes = str_bytes[:size - 1] + '\0'.encode() + else: + str_bytes += '\0'.encode() * (size - num_bytes) + return str_bytes + +def create_tag(args, in_bytes, size): + crc = crc32(in_bytes, size, CRC32_INIT) + + tag = bytearray() + tag += struct.pack('>I', args.part_id) + tag += struct.pack('>I', size) + tag += struct.pack('>H', args.part_flags) + tag += str_to_bytes_pad(args.part_name, PART_NAME_SIZE) + tag += str_to_bytes_pad(args.part_version, PART_VERSION_SIZE) + tag += struct.pack('>I', crc) + + return tag + +def create_output(args): + in_st = os.stat(args.input_file) + in_size = in_st.st_size + + in_f = open(args.input_file, 'r+b') + in_bytes = in_f.read(in_size) + in_f.close() + + tag = create_tag(args, in_bytes, in_size) + + out_f = open(args.output_file, 'w+b') + out_f.write(tag) + out_f.close() + +def main(): + global args + + parser = argparse.ArgumentParser(description='') + + parser.add_argument('--flags', + dest='part_flags', + action='store', + type=auto_int, + help='Partition Flags') + + parser.add_argument('--id', + dest='part_id', + action='store', + type=auto_int, + help='Partition ID') + + parser.add_argument('--input-file', + dest='input_file', + action='store', + type=str, + help='Input file') + + parser.add_argument('--output-file', + dest='output_file', + action='store', + type=str, + help='Output file') + + parser.add_argument('--name', + dest='part_name', + action='store', + type=str, + help='Partition Name') + + parser.add_argument('--version', + dest='part_version', + action='store', + type=str, + help='Partition Version') + + args = parser.parse_args() + + if ((not args.part_flags) or + (not args.part_id) or + (not args.input_file) or + (not args.output_file) or + (not args.part_name) or + (not args.part_version)): + parser.print_help() + else: + create_output(args) + +main() From 5998c8f059dbd64c5391e4caec2c07d434ffe146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 21 May 2020 15:04:23 +0200 Subject: [PATCH 16/21] bcm63xx: nand: support CFE partition tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce support for generating JFFS2 CFE partition tags. This is used in NAND devices in order to verify the integrity of the JFFS2 partition. Signed-off-by: Álvaro Fernández Rojas --- target/linux/bcm63xx/image/Makefile | 19 +++++++++++++++++++ target/linux/bcm63xx/image/bcm63xx_nand.mk | 3 +++ 2 files changed, 22 insertions(+) diff --git a/target/linux/bcm63xx/image/Makefile b/target/linux/bcm63xx/image/Makefile index 7c3091fb66..5fbe8ea470 100644 --- a/target/linux/bcm63xx/image/Makefile +++ b/target/linux/bcm63xx/image/Makefile @@ -168,6 +168,9 @@ define Build/cfe-jffs2-cferam # Some devices need padding between CFE RAM and kernel $(if $(CFE_RAM_JFFS2_PAD),$(call Build/pad-to,$(CFE_RAM_JFFS2_PAD))) + # Add CFE partition tag + $(if $(CFE_PART_ID),$(call Build/cfe-part-tag)) + # Append kernel dd if=$@.kernel >> $@ rm -f $@.kernel @@ -204,6 +207,22 @@ define Build/cfe-jffs2-kernel $(call Build/cfe-jffs2,$@-kernel) endef +define Build/cfe-part-tag + mv $@ $@.part + + $(TOPDIR)/scripts/cfe-partition-tag.py \ + --input-file $@.part \ + --output-file $@ \ + --flags $(CFE_PART_FLAGS) \ + --id $(CFE_PART_ID) \ + --name $(VERSION_CODE) \ + --version $(DEVICE_NAME) + + $(call Build/pad-to,$(BLOCKSIZE)) + + dd if=$@.part >> $@ +endef + define Build/cfe-old-bin $(TOPDIR)/scripts/brcmImage.pl -t -p \ -o $@ -b $(CFE_BOARD_ID) -c $(CHIP_ID) \ diff --git a/target/linux/bcm63xx/image/bcm63xx_nand.mk b/target/linux/bcm63xx/image/bcm63xx_nand.mk index aeaf6f2ae5..c70fdf8b2f 100644 --- a/target/linux/bcm63xx/image/bcm63xx_nand.mk +++ b/target/linux/bcm63xx/image/bcm63xx_nand.mk @@ -2,6 +2,7 @@ # BCM63XX NAND Profiles # +DEVICE_VARS += CFE_PART_FLAGS CFE_PART_ID DEVICE_VARS += CFE_RAM_FILE DEVICE_VARS += CFE_RAM_JFFS2_NAME CFE_RAM_JFFS2_PAD DEVICE_VARS += CFE_WFI_CHIP_ID CFE_WFI_FLASH_TYPE @@ -21,6 +22,8 @@ define Device/bcm63xx-nand IMAGE/cfe.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | cfe-jffs2-cferam | append-ubi | cfe-wfi-tag IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata KERNEL_SIZE := 5120k + CFE_PART_FLAGS := + CFE_PART_ID := CFE_RAM_FILE := CFE_RAM_JFFS2_NAME := CFE_RAM_JFFS2_PAD := From 78a0ae90234fbd04f4616f223b30d05dc54e5065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 20 May 2020 18:00:23 +0200 Subject: [PATCH 17/21] bcm63xx: WIP: add Huawei HG253s v2 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Fernández Rojas --- .../bcm63xx/base-files/etc/board.d/01_leds | 3 + .../bcm63xx/base-files/etc/board.d/02_network | 4 + .../base-files/lib/upgrade/platform.sh | 2 + .../bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts | 178 ++++++++++++++++++ target/linux/bcm63xx/image/bcm63xx_nand.mk | 22 +++ .../patches-5.4/566-board-HG253s-v2.patch | 56 ++++++ 6 files changed, 265 insertions(+) create mode 100644 target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts create mode 100644 target/linux/bcm63xx/patches-5.4/566-board-HG253s-v2.patch diff --git a/target/linux/bcm63xx/base-files/etc/board.d/01_leds b/target/linux/bcm63xx/base-files/etc/board.d/01_leds index 3b041be721..bfddcb69c4 100755 --- a/target/linux/bcm63xx/base-files/etc/board.d/01_leds +++ b/target/linux/bcm63xx/base-files/etc/board.d/01_leds @@ -50,6 +50,9 @@ huawei,echolife-hg622) huawei,echolife-hg655b) ucidef_set_led_usbdev "usb" "USB" "HW65x:green:usb" "1-2" ;; +huawei,hg253s-v2) + ucidef_set_led_usbdev "usb" "USB" "hg253s-v2:green:usb" "1-1" + ;; inventel,livebox-1) ucidef_set_led_netdev "lan" "LAN" "Livebox1:red:traffic" "eth0" ucidef_set_led_netdev "wan" "WAN" "Livebox1:red:adsl" "eth1" diff --git a/target/linux/bcm63xx/base-files/etc/board.d/02_network b/target/linux/bcm63xx/base-files/etc/board.d/02_network index 14eb1091f5..a3788adac2 100755 --- a/target/linux/bcm63xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm63xx/base-files/etc/board.d/02_network @@ -120,6 +120,10 @@ sfr,neufbox-4-sercomm-r0) ucidef_add_switch "switch0" \ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth1" ;; +huawei,hg253s-v2) + ucidef_add_switch "switch0" \ + "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "8t@eth0" + ;; inteno,vg50) ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8t@eth0" diff --git a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh index 093eba056e..7d416297dd 100644 --- a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh @@ -7,6 +7,7 @@ platform_check_image() { case "$(board_name)" in comtrend,vg-8050|\ comtrend,vr-3032u|\ + huawei,hg253s-v2|\ netgear,dgnd3700-v2|\ sercomm,ad1018) # NAND sysupgrade @@ -66,6 +67,7 @@ platform_do_upgrade() { case "$(board_name)" in comtrend,vg-8050|\ comtrend,vr-3032u|\ + huawei,hg253s-v2|\ netgear,dgnd3700-v2|\ sercomm,ad1018) REQUIRE_IMAGE_METADATA=1 diff --git a/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts b/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts new file mode 100644 index 0000000000..6b6cbe4170 --- /dev/null +++ b/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts @@ -0,0 +1,178 @@ +/dts-v1/; + +#include "bcm6362.dtsi" + +#include + +/ { + model = "Huawei HG253s v2"; + compatible = "huawei,hg253s-v2", "brcm,bcm6362"; + + aliases { + led-boot = &led_phone_green; + led-failsafe = &led_phone_green; + led-upgrade = &led_phone_green; + }; + + chosen { + bootargs = "rootfstype=squashfs,ubifs noinitrd console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&pinctrl 24 1>; + linux,code = ; + debounce-interval = <60>; + }; + + wlan { + label = "wlan"; + gpios = <&pinctrl 25 1>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&pinctrl 26 1>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_phone_green: led@28 { + label = "hg253s-v2:green:phone"; + gpios = <&pinctrl 28 1>; + }; + + led@30 { + label = "hg253s-v2:green:usb"; + gpios = <&pinctrl 30 1>; + }; + }; +}; + +&leds { + status = "ok"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds>; + + led@3 { + reg = <3>; + active-low; + label = "hg253s-v2:green:internet"; + }; + + led@5 { + reg = <5>; + active-low; + label = "hg253s-v2:green:wifi"; + }; +}; + +&lsspi { + switch@0 { + compatible = "brcm,bcm53125"; + reg = <0>; + spi-max-frequency = <781000>; + + lede,alias = "eth0"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + lan@1 { + reg = <1>; + label = "lan4"; + }; + + lan@2 { + reg = <2>; + label = "lan3"; + }; + + lan@3 { + reg = <3>; + label = "lan2"; + }; + + lan@4 { + reg = <4>; + label = "lan1"; + }; + + cpu@8 { + reg = <8>; + label = "cpu"; + + fixed-link { + speed = <1000>; + full-duplex; + asym-pause; + pause; + }; + }; + }; + }; +}; + +&nflash { + status = "ok"; + + nandcs@0 { + compatible = "brcm,nandcs"; + #size-cells = <1>; + #address-cells = <1>; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <15>; + nand-on-flash-bbt; + brcm,nand-oob-sector-size = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "cferom"; + reg = <0x0000000 0x0020000>; + read-only; + }; + + partition@20000 { + compatible = "brcm,wfi"; + label = "wfi"; + reg = <0x0020000 0x7d80000>; + }; + + partition@7da0000 { + label = "nvram"; + reg = <0x7da0000 0x160000>; + }; + }; + }; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio3", "gpio5"; + }; +}; + +&uart0 { + status = "ok"; +}; diff --git a/target/linux/bcm63xx/image/bcm63xx_nand.mk b/target/linux/bcm63xx/image/bcm63xx_nand.mk index c70fdf8b2f..5483c73077 100644 --- a/target/linux/bcm63xx/image/bcm63xx_nand.mk +++ b/target/linux/bcm63xx/image/bcm63xx_nand.mk @@ -71,6 +71,28 @@ define Device/comtrend_vg-8050 endef TARGET_DEVICES += comtrend_vg-8050 +### Huawei ### +define Device/huawei_hg253s-v2 + $(Device/bcm63xx-nand) + IMAGES := flash.bin sysupgrade.bin + IMAGE/flash.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | cfe-jffs2-cferam | append-ubi + DEVICE_VENDOR := Huawei + DEVICE_MODEL := HG253s + DEVICE_VARIANT := v2 + CHIP_ID := 6362 + CFE_PART_FLAGS := 1 + CFE_PART_ID := 0x0001EFEE + CFE_RAM_FILE := huawei,hg253s-v2/cferam.000 + CFE_RAM_JFFS2_NAME := cferam.000 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_PACKAGES += $(USB2_PACKAGES) + CFE_WFI_FLASH_TYPE := 3 +endef +TARGET_DEVICES += huawei_hg253s-v2 + ### Netgear ### define Device/netgear_dgnd3700-v2 $(Device/bcm63xx-nand) diff --git a/target/linux/bcm63xx/patches-5.4/566-board-HG253s-v2.patch b/target/linux/bcm63xx/patches-5.4/566-board-HG253s-v2.patch new file mode 100644 index 0000000000..cbcd2ade96 --- /dev/null +++ b/target/linux/bcm63xx/patches-5.4/566-board-HG253s-v2.patch @@ -0,0 +1,56 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -1879,6 +1879,37 @@ static struct board_info __initdata boar + }, + }, + }; ++ ++static struct board_info __initdata board_hg253s_v2 = { ++ .name = "hg253s", ++ .expected_cpu_id = 0x6362, ++ ++ .has_ehci0 = 1, ++ .has_ohci0 = 1, ++ .num_usbh_ports = 1, ++ ++ .has_enetsw = 1, ++ .enetsw = { ++ .used_ports = { ++ [4] = { ++ .used = 1, ++ .phy_id = 0xff, ++ .bypass_link = 1, ++ .force_speed = 1000, ++ .force_duplex_full = 1, ++ .timing_sel = 1, ++ .name = "RGMII", ++ }, ++ ++ [5] = { ++ .used = 1, ++ .phy_id = 24, ++ .timing_sel = 1, ++ .name = "WAN", ++ }, ++ }, ++ }, ++}; + #endif /* CONFIG_BCM63XX_CPU_6362 */ + + /* +@@ -2882,6 +2913,7 @@ static const struct board_info __initcon + &board_nb6, + &board_dgnd3700v2, + &board_fast2504n, ++ &board_hg253s_v2, + #endif + + #ifdef CONFIG_BCM63XX_CPU_6368 +@@ -2997,6 +3029,7 @@ static struct of_device_id const bcm963x + { .compatible = "bt,home-hub-2-a", .data = &board_homehub2a, }, + #endif + #ifdef CONFIG_BCM63XX_CPU_6362 ++ { .compatible = "huawei,hg253s-v2", .data = &board_hg253s_v2, }, + { .compatible = "netgear,dgnd3700-v2", .data = &board_dgnd3700v2, }, + { .compatible = "sagem,fast-2504n", .data = &board_fast2504n, }, + { .compatible = "sfr,neufbox-6-sercomm-r0", .data = &board_nb6, }, From bc552584640eba0bd428b70f724640a8fe9ceca2 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Thu, 21 May 2020 20:15:29 +0200 Subject: [PATCH 18/21] netifd: ingress/egress vlan qos mapping support 74e0222 vlandev: support setting ingress/egress QoS mappings Signed-off-by: Hans Dedecker --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index c914653c0e..9937cdf822 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2020-04-14 -PKG_SOURCE_VERSION:=cfccdc22ca6d8f28d70a2546a495c9ead4bbb765 -PKG_MIRROR_HASH:=4c680fa979f21b2a1280e8bffca9fa1412215a4058dfcde2569df9befea43999 +PKG_SOURCE_DATE:=2020-05-17 +PKG_SOURCE_VERSION:=74e0222eeb9e62f4d5073a5b3d9208678782a198 +PKG_MIRROR_HASH:=5caa2472ab569d5bd908850c4089366c53c3309ea43cc0ea81b7ec60f912b721 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From de8b88ce17c3e19cf1fe366be0de2e3c376762b0 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Mon, 27 Apr 2020 18:52:51 -0600 Subject: [PATCH 19/21] firewall: add rule for traceroute support Running your firewall's "wan" zone in REJECT zone (1) exposes the presence of the router, (2) depending on the sophistication of fingerprinting tools might identify the OS and release running on the firewall which then identifies known vulnerabilities with it and (3) perhaps most importantly of all, your firewall can be used in a DDoS reflection attack with spoofed traffic generating ICMP Unreachables or TCP RST's to overwhelm a victim or saturate his link. This rule, when enabled, allows traceroute to work even when the default input policy of the firewall for the wan zone has been set to DROP. Signed-off-by: Philip Prindeville --- .../network/config/firewall/files/firewall.config | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/package/network/config/firewall/files/firewall.config b/package/network/config/firewall/files/firewall.config index 8874e9882c..5e22f984ce 100644 --- a/package/network/config/firewall/files/firewall.config +++ b/package/network/config/firewall/files/firewall.config @@ -129,6 +129,19 @@ config rule option proto udp option target ACCEPT +# allow interoperability with traceroute classic +# note that traceroute uses a fixed port range, and depends on getting +# back ICMP Unreachables. if we're operating in DROP mode, it won't +# work so we explicitly REJECT packets on these ports. +config rule + option name Support-UDP-Traceroute + option src wan + option dest_port 33434:33689 + option proto udp + option family ipv4 + option target REJECT + option enabled false + # include a file with users custom iptables rules config include option path /etc/firewall.user From 04b1a11f5ca72a741493addca1b1ae093f37934f Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 21 May 2020 21:49:21 +0200 Subject: [PATCH 20/21] mac80211: Fix build on mpc85xx target This fixes the following compile error seen on the mpc85xx target: CC [M] /linux-mpc85xx_p2020/backports-5.7-rc3-1/drivers/net/wireless/intersil/orinoco/main.o In file included from /builder/shared-workdir/build/staging_dir/toolchain-powerpc_8540_gcc-8.4.0_musl/include/stddef.h:17, from /linux-mpc85xx_p2020/backports-5.7-rc3-1/include/uapi/linux/wireless.h:77, from /linux-mpc85xx_p2020/backports-5.7-rc3-1/include/linux/wireless.h:13, from /linux-mpc85xx_p2020/backports-5.7-rc3-1/drivers/net/wireless/intersil/orinoco/main.c:89: /builder/shared-workdir/build/staging_dir/toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/alltypes.h:106:15: error: conflicting types for 'ptrdiff_t' typedef _Addr ptrdiff_t; ^~~~~~~~~ In file included from /linux-mpc85xx_p2020/backports-5.7-rc3-1/backport-include/linux/types.h:4, from ./include/linux/list.h:5, from /linux-mpc85xx_p2020/backports-5.7-rc3-1/backport-include/linux/list.h:3, from ./include/linux/module.h:9, from /linux-mpc85xx_p2020/backports-5.7-rc3-1/backport-include/linux/module.h:3, from /linux-mpc85xx_p2020/backports-5.7-rc3-1/drivers/net/wireless/intersil/orinoco/main.c:79: ./include/linux/types.h:65:28: note: previous declaration of 'ptrdiff_t' was here typedef __kernel_ptrdiff_t ptrdiff_t; ^~~~~~~~~ scripts/Makefile.build:265: recipe for target '/linux-mpc85xx_p2020/backports-5.7-rc3-1/drivers/net/wireless/intersil/orinoco/main.o' failed Fixes: 289c6324259e ("mac80211: Update to version 5.7-rc3-1") Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 2 +- ...e-linux-stddef.h-instead-of-stddef.h.patch | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 package/kernel/mac80211/patches/subsys/090-wireless-Use-linux-stddef.h-instead-of-stddef.h.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index f2279180df..5745839d15 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=5.7-rc3-1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.7-rc3/ PKG_HASH:=7bc785c932f011c65adb75ffa746be2fa90b16ab61a6e1fd883acee403ffeed1 diff --git a/package/kernel/mac80211/patches/subsys/090-wireless-Use-linux-stddef.h-instead-of-stddef.h.patch b/package/kernel/mac80211/patches/subsys/090-wireless-Use-linux-stddef.h-instead-of-stddef.h.patch new file mode 100644 index 0000000000..c81cc063c6 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/090-wireless-Use-linux-stddef.h-instead-of-stddef.h.patch @@ -0,0 +1,31 @@ +From e1f04bf9d38633f0bf9d041089366fea0ad22623 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Thu, 21 May 2020 19:50:05 +0200 +Subject: [PATCH] wireless: Use linux/stddef.h instead of stddef.h + +When compiling inside the kernel include linux/stddef.h instead of +stddef.h. When I compile this header file in backports for power PC I +run into a conflict with ptrdiff_t. I was unable to reproduce this in +mainline kernel. I still would like to fix this problem in the kernel. + +Fixes: 6989310f5d43 ("wireless: Use offsetof instead of custom macro.") +Signed-off-by: Hauke Mehrtens +--- + include/uapi/linux/wireless.h | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/include/uapi/linux/wireless.h ++++ b/include/uapi/linux/wireless.h +@@ -74,7 +74,11 @@ + #include /* for "struct sockaddr" et al */ + #include /* for IFNAMSIZ and co... */ + +-#include /* for offsetof */ ++#ifdef __KERNEL__ ++# include /* for offsetof */ ++#else ++# include /* for offsetof */ ++#endif + + /***************************** VERSION *****************************/ + /* From 586661018e412faf9843ab04e3a295cdeaa6e709 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 21 May 2020 22:16:17 +0200 Subject: [PATCH 21/21] ath79: Do not build buffalo_whr-g301n by default The squashfs partition is getting too big. Signed-off-by: Hauke Mehrtens --- target/linux/ath79/image/tiny.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk index 41f1eb4305..9f4f89bd9a 100644 --- a/target/linux/ath79/image/tiny.mk +++ b/target/linux/ath79/image/tiny.mk @@ -12,6 +12,7 @@ define Device/buffalo_whr-g301n buffalo-tag WHR-G301N 3 IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header SUPPORTED_DEVICES += whr-g301n + DEFAULT := n endef TARGET_DEVICES += buffalo_whr-g301n