* Update the nl80211.h file in iw to match backports version.
* Remove the two backports from kernel 4.9, they were needed for mt76,
but that can use the version from backports now, otherwise they
collide and cause compile errors.
* ACCESS_ONCE() was removed in kernel 4.15, use READ_ONCE() to fix
compile with kernel 4.19.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
PKG_NAME:=mac80211
-PKG_VERSION:=5.1.16-1
+PKG_VERSION:=5.2-rc7-1
PKG_RELEASE:=1
-PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.1.16/
-PKG_HASH:=b5adc5d458734b9231e81bcf03af2fb1bf2e289a87f1551a4f02bdf3ba053fb8
+PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.2-rc7/
+PKG_HASH:=3179a4ec398bd6366a4fd8a44b311a57f8da87ad10720baf7c17aef9c8ec2983
PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
--- a/drivers/net/wireless/ath/Kconfig
+++ b/drivers/net/wireless/ath/Kconfig
-@@ -1,5 +1,5 @@
+@@ -1,6 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0-only
config ATH_COMMON
- tristate
+ tristate "ath.ko"
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
-@@ -86,6 +86,12 @@ config ATH10K_TRACING
+@@ -87,6 +87,12 @@ config ATH10K_TRACING
---help---
Select this to ath10k use tracing infrastructure.
void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
--- a/local-symbols
+++ b/local-symbols
-@@ -138,6 +138,7 @@ ATH10K_SNOC=
+@@ -139,6 +139,7 @@ ATH10K_SNOC=
ATH10K_DEBUG=
ATH10K_DEBUGFS=
ATH10K_SPECTRAL=
--- a/drivers/net/wireless/ath/Kconfig
+++ b/drivers/net/wireless/ath/Kconfig
-@@ -23,6 +23,9 @@ config WLAN_VENDOR_ATH
+@@ -24,6 +24,9 @@ config WLAN_VENDOR_ATH
if WLAN_VENDOR_ATH
---help---
--- a/local-symbols
+++ b/local-symbols
-@@ -82,6 +82,7 @@ ADM8211=
+@@ -83,6 +83,7 @@ ADM8211=
ATH_COMMON=
WLAN_VENDOR_ATH=
ATH_DEBUG=
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
-@@ -3041,6 +3041,8 @@ void regulatory_hint_country_ie(struct w
+@@ -3032,6 +3032,8 @@ void regulatory_hint_country_ie(struct w
enum environment_cap env = ENVIRON_ANY;
struct regulatory_request *request = NULL, *lr;
/* IE len must be evenly divisible by 2 */
if (country_ie_len & 0x01)
return;
-@@ -3292,6 +3294,7 @@ static bool is_wiphy_all_set_reg_flag(en
+@@ -3283,6 +3285,7 @@ static bool is_wiphy_all_set_reg_flag(en
void regulatory_hint_disconnect(void)
{
goto end;
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
-@@ -1965,7 +1965,7 @@ ath5k_beacon_send(struct ath5k_hw *ah)
+@@ -1964,7 +1964,7 @@ ath5k_beacon_send(struct ath5k_hw *ah)
}
if ((ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs +
ah->opmode == NL80211_IFTYPE_MESH_POINT) {
u64 tsf = ath5k_hw_get_tsf64(ah);
u32 tsftu = TSF_TO_TU(tsf);
-@@ -2051,7 +2051,7 @@ ath5k_beacon_update_timers(struct ath5k_
+@@ -2050,7 +2050,7 @@ ath5k_beacon_update_timers(struct ath5k_
intval = ah->bintval & AR5K_BEACON_PERIOD;
if (ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs
intval /= ATH_BCBUF; /* staggered multi-bss beacons */
if (intval < 15)
ATH5K_WARN(ah, "intval %u is too low, min 15\n",
-@@ -2518,6 +2518,7 @@ static const struct ieee80211_iface_limi
+@@ -2516,6 +2516,7 @@ static const struct ieee80211_iface_limi
BIT(NL80211_IFTYPE_MESH_POINT) |
#endif
BIT(NL80211_IFTYPE_AP) },
#endif /* _LINUX_ATH9K_PLATFORM_H */
--- a/local-symbols
+++ b/local-symbols
-@@ -109,6 +109,7 @@ ATH9K_WOW=
+@@ -110,6 +110,7 @@ ATH9K_WOW=
ATH9K_RFKILL=
ATH9K_CHANNEL_CONTEXT=
ATH9K_PCOEM=
ATH9K_HWRNG=
--- a/drivers/net/wireless/ath/ath9k/Kconfig
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
-@@ -59,6 +59,19 @@ config ATH9K_AHB
+@@ -60,6 +60,19 @@ config ATH9K_AHB
Say Y, if you have a SoC with a compatible built-in
wireless MAC. Say N if unsure.
create mode 100644 drivers/net/wireless/ath/ath10k/leds.h
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
-@@ -70,6 +70,16 @@ config ATH10K_DEBUGFS
+@@ -71,6 +71,16 @@ config ATH10K_DEBUGFS
If unsure, say Y to make it easier to debug problems.
ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o
--- a/local-symbols
+++ b/local-symbols
-@@ -141,6 +141,7 @@ ATH10K_DEBUG=
+@@ -142,6 +142,7 @@ ATH10K_DEBUG=
ATH10K_DEBUGFS=
ATH10K_SPECTRAL=
ATH10K_THERMAL=
--- a/drivers/net/wireless/broadcom/brcm80211/Kconfig
+++ b/drivers/net/wireless/broadcom/brcm80211/Kconfig
-@@ -1,5 +1,5 @@
+@@ -1,6 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0-only
config BRCMUTIL
- tristate
+ tristate "Broadcom 802.11 driver utility functions"
+++ /dev/null
-From c9692820710f57c826b2e43a6fb1e4cd307508b0 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Tue, 26 Feb 2019 14:11:16 +0100
-Subject: [PATCH] brcmfmac: support repeated brcmf_fw_alloc_request() calls
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-During a normal brcmfmac lifetime brcmf_fw_alloc_request() is called
-once only during the probe. It's safe to assume provided array is clear.
-
-Further brcmfmac improvements may require calling it multiple times
-though. This patch allows it by fixing invalid firmware paths like:
-brcm/brcmfmac4366c-pcie.binbrcm/brcmfmac4366c-pcie.bin
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
-@@ -743,6 +743,7 @@ brcmf_fw_alloc_request(u32 chip, u32 chi
-
- for (j = 0; j < n_fwnames; j++) {
- fwreq->items[j].path = fwnames[j].path;
-+ fwnames[j].path[0] = '\0';
- /* check if firmware path is provided by module parameter */
- if (brcmf_mp_global.firmware_path[0] != '\0') {
- strlcpy(fwnames[j].path, mp_path,
+++ /dev/null
-From a2ec87ddbf1637f854ffcfff9d12d392fa30758b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Tue, 26 Feb 2019 14:11:18 +0100
-Subject: [PATCH] brcmfmac: add a function designated for handling firmware
- fails
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This improves handling PCIe firmware halts by printing a clear error
-message and replaces a similar code in the SDIO bus support.
-
-It will also allow further improvements like trying to recover from a
-firmware crash.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 ++
- .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 10 ++++++++++
- .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 +-
- .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 ++--
- 4 files changed, 15 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -263,6 +263,8 @@ void brcmf_detach(struct device *dev);
- void brcmf_dev_reset(struct device *dev);
- /* Request from bus module to initiate a coredump */
- void brcmf_dev_coredump(struct device *dev);
-+/* Indication that firmware has halted or crashed */
-+void brcmf_fw_crashed(struct device *dev);
-
- /* Configure the "global" bus state used by upper layers */
- void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state);
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1298,6 +1298,16 @@ void brcmf_dev_coredump(struct device *d
- brcmf_dbg(TRACE, "failed to create coredump\n");
- }
-
-+void brcmf_fw_crashed(struct device *dev)
-+{
-+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-+ struct brcmf_pub *drvr = bus_if->drvr;
-+
-+ bphy_err(drvr, "Firmware has halted or crashed\n");
-+
-+ brcmf_dev_coredump(dev);
-+}
-+
- void brcmf_detach(struct device *dev)
- {
- s32 i;
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -730,7 +730,7 @@ static void brcmf_pcie_handle_mb_data(st
- }
- if (dtoh_mb_data & BRCMF_D2H_DEV_FWHALT) {
- brcmf_dbg(PCIE, "D2H_MB_DATA: FW HALT\n");
-- brcmf_dev_coredump(&devinfo->pdev->dev);
-+ brcmf_fw_crashed(&devinfo->pdev->dev);
- }
- }
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -1101,8 +1101,8 @@ static u32 brcmf_sdio_hostmail(struct br
-
- /* dongle indicates the firmware has halted/crashed */
- if (hmb_data & HMB_DATA_FWHALT) {
-- brcmf_err("mailbox indicates firmware halted\n");
-- brcmf_dev_coredump(&sdiod->func1->dev);
-+ brcmf_dbg(SDIO, "mailbox indicates firmware halted\n");
-+ brcmf_fw_crashed(&sdiod->func1->dev);
- }
-
- /* Dongle recomposed rx frames, accept them again */
+++ /dev/null
-From 4684997d9eea29380000e062755aa6d368d789a3 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Tue, 26 Feb 2019 14:11:19 +0100
-Subject: [PATCH] brcmfmac: reset PCIe bus on a firmware crash
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This includes bus reset & reloading a firmware. It should be sufficient
-for a user space to (setup and) use a wireless device again.
-
-Support for reset on USB & SDIO can be added later.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/bus.h | 10 ++++++
- .../broadcom/brcm80211/brcmfmac/core.c | 12 +++++++
- .../broadcom/brcm80211/brcmfmac/core.h | 2 ++
- .../broadcom/brcm80211/brcmfmac/pcie.c | 35 +++++++++++++++++++
- 4 files changed, 59 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -92,6 +92,7 @@ struct brcmf_bus_ops {
- int (*get_fwname)(struct device *dev, const char *ext,
- unsigned char *fw_name);
- void (*debugfs_create)(struct device *dev);
-+ int (*reset)(struct device *dev);
- };
-
-
-@@ -246,6 +247,15 @@ void brcmf_bus_debugfs_create(struct brc
- return bus->ops->debugfs_create(bus->dev);
- }
-
-+static inline
-+int brcmf_bus_reset(struct brcmf_bus *bus)
-+{
-+ if (!bus->ops->reset)
-+ return -EOPNOTSUPP;
-+
-+ return bus->ops->reset(bus->dev);
-+}
-+
- /*
- * interface functions from common layer
- */
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1109,6 +1109,14 @@ static int brcmf_revinfo_read(struct seq
- return 0;
- }
-
-+static void brcmf_core_bus_reset(struct work_struct *work)
-+{
-+ struct brcmf_pub *drvr = container_of(work, struct brcmf_pub,
-+ bus_reset);
-+
-+ brcmf_bus_reset(drvr->bus_if);
-+}
-+
- static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops)
- {
- int ret = -1;
-@@ -1180,6 +1188,8 @@ static int brcmf_bus_started(struct brcm
- #endif
- #endif /* CONFIG_INET */
-
-+ INIT_WORK(&drvr->bus_reset, brcmf_core_bus_reset);
-+
- /* populate debugfs */
- brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read);
- brcmf_feat_debugfs_create(drvr);
-@@ -1306,6 +1316,8 @@ void brcmf_fw_crashed(struct device *dev
- bphy_err(drvr, "Firmware has halted or crashed\n");
-
- brcmf_dev_coredump(dev);
-+
-+ schedule_work(&drvr->bus_reset);
- }
-
- void brcmf_detach(struct device *dev)
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
-@@ -143,6 +143,8 @@ struct brcmf_pub {
- struct notifier_block inet6addr_notifier;
- struct brcmf_mp_device *settings;
-
-+ struct work_struct bus_reset;
-+
- u8 clmver[BRCMF_DCMD_SMLEN];
- };
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -345,6 +345,10 @@ static const u32 brcmf_ring_itemsize[BRC
- BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE
- };
-
-+static void brcmf_pcie_setup(struct device *dev, int ret,
-+ struct brcmf_fw_request *fwreq);
-+static struct brcmf_fw_request *
-+brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo);
-
- static u32
- brcmf_pcie_read_reg32(struct brcmf_pciedev_info *devinfo, u32 reg_offset)
-@@ -1409,6 +1413,36 @@ int brcmf_pcie_get_fwname(struct device
- return 0;
- }
-
-+static int brcmf_pcie_reset(struct device *dev)
-+{
-+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-+ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie;
-+ struct brcmf_pciedev_info *devinfo = buspub->devinfo;
-+ struct brcmf_fw_request *fwreq;
-+ int err;
-+
-+ brcmf_detach(dev);
-+
-+ brcmf_pcie_release_irq(devinfo);
-+ brcmf_pcie_release_scratchbuffers(devinfo);
-+ brcmf_pcie_release_ringbuffers(devinfo);
-+ brcmf_pcie_reset_device(devinfo);
-+
-+ fwreq = brcmf_pcie_prepare_fw_request(devinfo);
-+ if (!fwreq) {
-+ dev_err(dev, "Failed to prepare FW request\n");
-+ return -ENOMEM;
-+ }
-+
-+ err = brcmf_fw_get_firmwares(dev, fwreq, brcmf_pcie_setup);
-+ if (err) {
-+ dev_err(dev, "Failed to prepare FW request\n");
-+ kfree(fwreq);
-+ }
-+
-+ return err;
-+}
-+
- static const struct brcmf_bus_ops brcmf_pcie_bus_ops = {
- .txdata = brcmf_pcie_tx,
- .stop = brcmf_pcie_down,
-@@ -1418,6 +1452,7 @@ static const struct brcmf_bus_ops brcmf_
- .get_ramsize = brcmf_pcie_get_ramsize,
- .get_memdump = brcmf_pcie_get_memdump,
- .get_fwname = brcmf_pcie_get_fwname,
-+ .reset = brcmf_pcie_reset,
- };
-
-
+++ /dev/null
-From 2b78e5f5223666d403d4fdb30af4ad65c8da3cdb Mon Sep 17 00:00:00 2001
-From: Piotr Figiel <p.figiel@camlintechnologies.com>
-Date: Fri, 8 Mar 2019 15:25:06 +0000
-Subject: [PATCH] brcmfmac: remove pending parameter from brcmf_usb_free_q
-
-brcmf_usb_free_q is no longer called with pending=true thus this boolean
-parameter is no longer needed.
-
-Signed-off-by: Piotr Figiel <p.figiel@camlintechnologies.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../wireless/broadcom/brcm80211/brcmfmac/usb.c | 15 ++++++---------
- 1 file changed, 6 insertions(+), 9 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-@@ -445,9 +445,10 @@ fail:
-
- }
-
--static void brcmf_usb_free_q(struct list_head *q, bool pending)
-+static void brcmf_usb_free_q(struct list_head *q)
- {
- struct brcmf_usbreq *req, *next;
-+
- int i = 0;
- list_for_each_entry_safe(req, next, q, list) {
- if (!req->urb) {
-@@ -455,12 +456,8 @@ static void brcmf_usb_free_q(struct list
- break;
- }
- i++;
-- if (pending) {
-- usb_kill_urb(req->urb);
-- } else {
-- usb_free_urb(req->urb);
-- list_del_init(&req->list);
-- }
-+ usb_free_urb(req->urb);
-+ list_del_init(&req->list);
- }
- }
-
-@@ -1029,8 +1026,8 @@ static void brcmf_usb_detach(struct brcm
- brcmf_dbg(USB, "Enter, devinfo %p\n", devinfo);
-
- /* free the URBS */
-- brcmf_usb_free_q(&devinfo->rx_freeq, false);
-- brcmf_usb_free_q(&devinfo->tx_freeq, false);
-+ brcmf_usb_free_q(&devinfo->rx_freeq);
-+ brcmf_usb_free_q(&devinfo->tx_freeq);
-
- usb_free_urb(devinfo->ctl_urb);
- usb_free_urb(devinfo->bulk_urb);
+++ /dev/null
-From 504f06725d015954a0fcafdf1d90a6795ca8f769 Mon Sep 17 00:00:00 2001
-From: Piotr Figiel <p.figiel@camlintechnologies.com>
-Date: Fri, 8 Mar 2019 15:25:09 +0000
-Subject: [PATCH] brcmfmac: remove unused variable i from brcmf_usb_free_q
-
-Variable i is not used so remove it.
-
-Signed-off-by: Piotr Figiel <p.figiel@camlintechnologies.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 --
- 1 file changed, 2 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-@@ -449,13 +449,11 @@ static void brcmf_usb_free_q(struct list
- {
- struct brcmf_usbreq *req, *next;
-
-- int i = 0;
- list_for_each_entry_safe(req, next, q, list) {
- if (!req->urb) {
- brcmf_err("bad req\n");
- break;
- }
-- i++;
- usb_free_urb(req->urb);
- list_del_init(&req->list);
- }
+++ /dev/null
-From 0cf83903aad03dc7f444a47990def48c4a9d3276 Mon Sep 17 00:00:00 2001
-From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
-Date: Wed, 3 Apr 2019 11:46:11 -0500
-Subject: [PATCH] brcmfmac: Use struct_size() in kzalloc()
-
-One of the more common cases of allocation size calculations is finding
-the size of a structure that has a zero-sized array at the end, along
-with memory for some number of elements for that array. For example:
-
-struct foo {
- int stuff;
- struct boo entry[];
-};
-
-size = sizeof(struct foo) + count * sizeof(struct boo);
-instance = kzalloc(size, GFP_KERNEL)
-
-Instead of leaving these open-coded and prone to type mistakes, we can
-now use the new struct_size() helper:
-
-instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL)
-
-Notice that, in this case, variable reqsz is not necessary,
-hence it is removed.
-
-This code was detected with the help of Coccinelle.
-
-Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
-@@ -711,7 +711,6 @@ brcmf_fw_alloc_request(u32 chip, u32 chi
- size_t mp_path_len;
- u32 i, j;
- char end = '\0';
-- size_t reqsz;
-
- for (i = 0; i < table_size; i++) {
- if (mapping_table[i].chipid == chip &&
-@@ -726,8 +725,7 @@ brcmf_fw_alloc_request(u32 chip, u32 chi
- return NULL;
- }
-
-- reqsz = sizeof(*fwreq) + n_fwnames * sizeof(struct brcmf_fw_item);
-- fwreq = kzalloc(reqsz, GFP_KERNEL);
-+ fwreq = kzalloc(struct_size(fwreq, items, n_fwnames), GFP_KERNEL);
- if (!fwreq)
- return NULL;
-
+++ /dev/null
-From e3062e05e1cfe378bb9b3fa0bef46711372bcf13 Mon Sep 17 00:00:00 2001
-From: Ondrej Jirman <megous@megous.com>
-Date: Sat, 6 Apr 2019 01:45:13 +0200
-Subject: [PATCH] brcmfmac: Loading the correct firmware for brcm43456
-
-SDIO based brcm43456 is currently misdetected as brcm43455 and the wrong
-firmware name is used. Correct the detection and load the correct
-firmware file. Chiprev for brcm43456 is "9".
-
-Signed-off-by: Ondrej Jirman <megous@megous.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -622,6 +622,7 @@ BRCMF_FW_DEF(43430A0, "brcmfmac43430a0-s
- /* Note the names are not postfixed with a1 for backward compatibility */
- BRCMF_FW_DEF(43430A1, "brcmfmac43430-sdio");
- 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(4373, "brcmfmac4373-sdio");
-@@ -642,7 +643,8 @@ static const struct brcmf_firmware_mappi
- BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
- BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0x00000001, 43430A0),
- BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430A1),
-- BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455),
-+ BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0x00000200, 43456),
-+ 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(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373),
+++ /dev/null
-From a927e8d8ab57e696800e20cf09a72b7dfe3bbebb Mon Sep 17 00:00:00 2001
-From: Colin Ian King <colin.king@canonical.com>
-Date: Tue, 9 Apr 2019 12:43:33 +0100
-Subject: [PATCH] brcmfmac: fix leak of mypkt on error return path
-
-Currently if the call to brcmf_sdiod_set_backplane_window fails then
-error return path leaks mypkt. Fix this by returning by a new
-error path labelled 'out' that calls brcmu_pkt_buf_free_skb to free
-mypkt. Also remove redundant check on err before calling
-brcmf_sdiod_skbuff_write.
-
-Addresses-Coverity: ("Resource Leak")
-Fixes: a7c3aa1509e2 ("brcmfmac: Remove brcmf_sdiod_addrprep()")
-Signed-off-by: Colin Ian King <colin.king@canonical.com>
-Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 +++-----
- 1 file changed, 3 insertions(+), 5 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
-@@ -628,15 +628,13 @@ int brcmf_sdiod_send_buf(struct brcmf_sd
-
- err = brcmf_sdiod_set_backplane_window(sdiodev, addr);
- if (err)
-- return err;
-+ goto out;
-
- addr &= SBSDIO_SB_OFT_ADDR_MASK;
- addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
-
-- if (!err)
-- err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr,
-- mypkt);
--
-+ err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr, mypkt);
-+out:
- brcmu_pkt_buf_free_skb(mypkt);
-
- return err;
+++ /dev/null
-From b1a0ba8f772d7a6dcb5aa3e856f5bd8274989ebe Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Mon, 22 Apr 2019 22:41:23 +0200
-Subject: [PATCH] brcmfmac: Add DMI nvram filename quirk for ACEPC T8 and T11
- mini PCs
-
-The ACEPC T8 and T11 mini PCs contain quite generic names in the sys_vendor
-and product_name DMI strings, without this patch brcmfmac will try to load:
-"brcmfmac43455-sdio.Default string-Default string.txt" as nvram file which
-is way too generic.
-
-The DMI strings on which we are matching are somewhat generic too, but
-"To be filled by O.E.M." is less common then "Default string" and the
-system-sku and bios-version strings are pretty unique. Beside the DMI
-strings we also check the wifi-module chip-id and revision. I'm confident
-that the combination of all this is unique.
-
-Both the T8 and T11 use the same wifi-module, this commit adds DMI
-quirks for both mini PCs pointing to brcmfmac43455-sdio.acepc-t8.txt .
-
-BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1690852
-Cc: stable@vger.kernel.org
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/dmi.c | 26 +++++++++++++++++++
- 1 file changed, 26 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
-@@ -35,6 +35,10 @@ static const struct brcmf_dmi_data acepc
- BRCM_CC_4345_CHIP_ID, 6, "acepc-t8"
- };
-
-+static const struct brcmf_dmi_data acepc_t8_data = {
-+ BRCM_CC_4345_CHIP_ID, 6, "acepc-t8"
-+};
-+
- static const struct brcmf_dmi_data gpd_win_pocket_data = {
- BRCM_CC_4356_CHIP_ID, 2, "gpd-win-pocket"
- };
-@@ -76,6 +80,28 @@ static const struct dmi_system_id dmi_pl
- /* also match on somewhat unique bios-version */
- DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
- },
-+ .driver_data = (void *)&acepc_t8_data,
-+ },
-+ {
-+ /* ACEPC T8 Cherry Trail Z8350 mini PC */
-+ .matches = {
-+ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
-+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"),
-+ /* also match on somewhat unique bios-version */
-+ DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
-+ },
-+ .driver_data = (void *)&acepc_t8_data,
-+ },
-+ {
-+ /* ACEPC T11 Cherry Trail Z8350 mini PC, same wifi as the T8 */
-+ .matches = {
-+ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
-+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"),
-+ /* also match on somewhat unique bios-version */
-+ DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
-+ },
- .driver_data = (void *)&acepc_t8_data,
- },
- {
+++ /dev/null
-From 99d94ef367af67f630b38c93ff46c5819b7d06b6 Mon Sep 17 00:00:00 2001
-From: Wright Feng <Wright.Feng@cypress.com>
-Date: Thu, 25 Apr 2019 07:05:46 +0000
-Subject: [PATCH] brcmfmac: send mailbox interrupt twice for specific hardware
- device
-
-For PCIE wireless device with core revision less than 14, device may miss
-PCIE to System Backplane Interrupt via PCIEtoSBMailbox. So add sending
-mail box interrupt twice as a hardware workaround.
-
-Signed-off-by: Wright Feng <wright.feng@cypress.com>
-Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -698,7 +698,11 @@ brcmf_pcie_send_mb_data(struct brcmf_pci
-
- brcmf_pcie_write_tcm32(devinfo, addr, htod_mb_data);
- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1);
-- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1);
-+
-+ /* Send mailbox interrupt twice as a hardware workaround */
-+ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
-+ if (core->rev <= 13)
-+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1);
-
- return 0;
- }
+++ /dev/null
-From 324f1feb960c79a07df3acde89a119a5aa80cb10 Mon Sep 17 00:00:00 2001
-From: Kalle Valo <kvalo@codeaurora.org>
-Date: Thu, 25 Apr 2019 20:08:31 +0300
-Subject: [PATCH] Revert "brcmfmac: send mailbox interrupt twice for specific
- hardware device"
-
-This reverts commit 99d94ef367af67f630b38c93ff46c5819b7d06b6. I accidentally
-applied this broken (failed to compile) patch due to a bug in my patchwork
-script.
-
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 +-----
- 1 file changed, 1 insertion(+), 5 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -698,11 +698,7 @@ brcmf_pcie_send_mb_data(struct brcmf_pci
-
- brcmf_pcie_write_tcm32(devinfo, addr, htod_mb_data);
- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1);
--
-- /* Send mailbox interrupt twice as a hardware workaround */
-- core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
-- if (core->rev <= 13)
-- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1);
-+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1);
-
- return 0;
- }
+++ /dev/null
-From 9ef77fbedad9ea8895cd5d7fb7aee16071f527dc Mon Sep 17 00:00:00 2001
-From: Wright Feng <Wright.Feng@cypress.com>
-Date: Fri, 26 Apr 2019 03:12:32 +0000
-Subject: [PATCH] brcmfmac: send mailbox interrupt twice for specific hardware
- device
-
-For PCIE wireless device with core revision less than 14, device may miss
-PCIE to System Backplane Interrupt via PCIEtoSBMailbox. So add sending
-mail box interrupt twice as a hardware workaround.
-
-Signed-off-by: Wright Feng <wright.feng@cypress.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -675,6 +675,7 @@ static int
- brcmf_pcie_send_mb_data(struct brcmf_pciedev_info *devinfo, u32 htod_mb_data)
- {
- struct brcmf_pcie_shared_info *shared;
-+ struct brcmf_core *core;
- u32 addr;
- u32 cur_htod_mb_data;
- u32 i;
-@@ -698,7 +699,11 @@ brcmf_pcie_send_mb_data(struct brcmf_pci
-
- brcmf_pcie_write_tcm32(devinfo, addr, htod_mb_data);
- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1);
-- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1);
-+
-+ /* Send mailbox interrupt twice as a hardware workaround */
-+ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
-+ if (core->rev <= 13)
-+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1);
-
- return 0;
- }
+++ /dev/null
-From 2d91c8ad068a5cad4d9e7ece8dc811a697c7176a Mon Sep 17 00:00:00 2001
-From: Wright Feng <Wright.Feng@cypress.com>
-Date: Fri, 26 Apr 2019 03:41:46 +0000
-Subject: [PATCH] brcmfmac: set txflow request id from 1 to pktids array size
-
-Some PCIE firmwares drop txstatus if pktid is 0 and make packet held in
-host side and never be released. If that packet type is 802.1x, the
-pend_8021x_cnt value will be always greater than 0 and show "Timed out
-waiting for no pending 802.1x packets" error message when sending key to
-dongle every time.
-
-To be compatible with all firmwares, host should set txflow request id
-from 1 instead of from 0.
-
-Signed-off-by: Wright Feng <wright.feng@cypress.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-@@ -375,7 +375,7 @@ brcmf_msgbuf_get_pktid(struct device *de
- struct brcmf_msgbuf_pktid *pktid;
- struct sk_buff *skb;
-
-- if (idx >= pktids->array_size) {
-+ if (idx < 0 || idx >= pktids->array_size) {
- brcmf_err("Invalid packet id %d (max %d)\n", idx,
- pktids->array_size);
- return NULL;
-@@ -747,7 +747,7 @@ static void brcmf_msgbuf_txflow(struct b
- tx_msghdr = (struct msgbuf_tx_msghdr *)ret_ptr;
-
- tx_msghdr->msg.msgtype = MSGBUF_TYPE_TX_POST;
-- tx_msghdr->msg.request_id = cpu_to_le32(pktid);
-+ tx_msghdr->msg.request_id = cpu_to_le32(pktid + 1);
- tx_msghdr->msg.ifidx = brcmf_flowring_ifidx_get(flow, flowid);
- tx_msghdr->flags = BRCMF_MSGBUF_PKT_FLAGS_FRAME_802_3;
- tx_msghdr->flags |= (skb->priority & 0x07) <<
-@@ -884,7 +884,7 @@ brcmf_msgbuf_process_txstatus(struct brc
- u16 flowid;
-
- tx_status = (struct msgbuf_tx_status *)buf;
-- idx = le32_to_cpu(tx_status->msg.request_id);
-+ idx = le32_to_cpu(tx_status->msg.request_id) - 1;
- flowid = le16_to_cpu(tx_status->compl_hdr.flow_ring_id);
- flowid -= BRCMF_H2D_MSGRING_FLOWRING_IDSTART;
- skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
+++ /dev/null
-From 47dd82e3d25e85a7c7c4e4b0eac9d297d1e5e2d4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Sun, 28 Apr 2019 23:38:26 +0200
-Subject: [PATCH] brcmfmac: print firmware messages after a firmware crash
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Normally firmware messages are printed with debugging enabled only. It's
-a good idea as firmware may print a lot of messages that normal users
-don't need to care about.
-
-However, on firmware crash, it may be very helpful to log all recent
-messages. There is almost always a backtrace available as well as rought
-info on the latest actions/state.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/pcie.c | 24 ++++++++++++++-----
- 1 file changed, 18 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -764,15 +764,22 @@ static void brcmf_pcie_bus_console_init(
- console->base_addr, console->buf_addr, console->bufsize);
- }
-
--
--static void brcmf_pcie_bus_console_read(struct brcmf_pciedev_info *devinfo)
-+/**
-+ * brcmf_pcie_bus_console_read - reads firmware messages
-+ *
-+ * @error: specifies if error has occurred (prints messages unconditionally)
-+ */
-+static void brcmf_pcie_bus_console_read(struct brcmf_pciedev_info *devinfo,
-+ bool error)
- {
-+ struct pci_dev *pdev = devinfo->pdev;
-+ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
- struct brcmf_pcie_console *console;
- u32 addr;
- u8 ch;
- u32 newidx;
-
-- if (!BRCMF_FWCON_ON())
-+ if (!error && !BRCMF_FWCON_ON())
- return;
-
- console = &devinfo->shared.console;
-@@ -796,7 +803,10 @@ static void brcmf_pcie_bus_console_read(
- }
- if (ch == '\n') {
- console->log_str[console->log_idx] = 0;
-- pr_debug("CONSOLE: %s", console->log_str);
-+ if (error)
-+ brcmf_err(bus, "CONSOLE: %s", console->log_str);
-+ else
-+ pr_debug("CONSOLE: %s", console->log_str);
- console->log_idx = 0;
- }
- }
-@@ -857,7 +867,7 @@ static irqreturn_t brcmf_pcie_isr_thread
- &devinfo->pdev->dev);
- }
- }
-- brcmf_pcie_bus_console_read(devinfo);
-+ brcmf_pcie_bus_console_read(devinfo, false);
- if (devinfo->state == BRCMFMAC_PCIE_STATE_UP)
- brcmf_pcie_intr_enable(devinfo);
- devinfo->in_irq = false;
-@@ -1426,6 +1436,8 @@ static int brcmf_pcie_reset(struct devic
- struct brcmf_fw_request *fwreq;
- int err;
-
-+ brcmf_pcie_bus_console_read(devinfo, true);
-+
- brcmf_detach(dev);
-
- brcmf_pcie_release_irq(devinfo);
-@@ -1818,7 +1830,7 @@ static void brcmf_pcie_setup(struct devi
- if (brcmf_attach(&devinfo->pdev->dev, devinfo->settings) == 0)
- return;
-
-- brcmf_pcie_bus_console_read(devinfo);
-+ brcmf_pcie_bus_console_read(devinfo, false);
-
- fail:
- device_release_driver(dev);
struct b43_phy phy;
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -85,6 +85,11 @@ MODULE_FIRMWARE("b43/ucode40.fw");
+@@ -72,6 +72,11 @@ MODULE_FIRMWARE("b43/ucode40.fw");
MODULE_FIRMWARE("b43/ucode42.fw");
MODULE_FIRMWARE("b43/ucode9.fw");
static int modparam_bad_frames_preempt;
module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444);
MODULE_PARM_DESC(bad_frames_preempt,
-@@ -2892,10 +2897,10 @@ static int b43_gpio_init(struct b43_wlde
+@@ -2872,10 +2877,10 @@ static int b43_gpio_init(struct b43_wlde
u32 mask, set;
b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0);
b43-$(CPTCFG_B43_LEDS) += leds.o
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -2018,10 +2018,12 @@ static void b43_do_interrupt_thread(stru
+@@ -2000,10 +2000,12 @@ static void b43_do_interrupt_thread(stru
dma_reason[0], dma_reason[1],
dma_reason[2], dma_reason[3],
dma_reason[4], dma_reason[5]);
#endif /* B43_PIO_H_ */
--- a/drivers/net/wireless/broadcom/b43/Kconfig
+++ b/drivers/net/wireless/broadcom/b43/Kconfig
-@@ -99,7 +99,7 @@ config B43_BCMA_PIO
+@@ -100,7 +100,7 @@ config B43_BCMA_PIO
default y
config B43_PIO
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -1658,7 +1658,7 @@ static void b43_write_beacon_template(st
+@@ -1642,7 +1642,7 @@ static void b43_write_beacon_template(st
len, ram_offset, shm_size_offset, rate);
/* Write the PHY TX control parameters. */
antenna = b43_antenna_to_phyctl(antenna);
ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
/* We can't send beacons with short preamble. Would get PHY errors. */
-@@ -3307,8 +3307,8 @@ static int b43_chip_init(struct b43_wlde
+@@ -3287,8 +3287,8 @@ static int b43_chip_init(struct b43_wlde
/* Select the antennae */
if (phy->ops->set_rx_antenna)
if (phy->type == B43_PHYTYPE_B) {
value16 = b43_read16(dev, 0x005E);
-@@ -4008,7 +4008,6 @@ static int b43_op_config(struct ieee8021
+@@ -3988,7 +3988,6 @@ static int b43_op_config(struct ieee8021
struct b43_wldev *dev = wl->current_dev;
struct b43_phy *phy = &dev->phy;
struct ieee80211_conf *conf = &hw->conf;
int err = 0;
mutex_lock(&wl->mutex);
-@@ -4051,11 +4050,9 @@ static int b43_op_config(struct ieee8021
+@@ -4031,11 +4030,9 @@ static int b43_op_config(struct ieee8021
}
/* Antennas for RX and management frame TX. */
if (wl->radio_enabled != phy->radio_on) {
if (wl->radio_enabled) {
-@@ -5199,6 +5196,47 @@ static int b43_op_get_survey(struct ieee
+@@ -5179,6 +5176,47 @@ static int b43_op_get_survey(struct ieee
return 0;
}
static const struct ieee80211_ops b43_hw_ops = {
.tx = b43_op_tx,
.conf_tx = b43_op_conf_tx,
-@@ -5220,6 +5258,8 @@ static const struct ieee80211_ops b43_hw
+@@ -5200,6 +5238,8 @@ static const struct ieee80211_ops b43_hw
.sw_scan_complete = b43_op_sw_scan_complete_notifier,
.get_survey = b43_op_get_survey,
.rfkill_poll = b43_rfkill_poll,
};
/* Hard-reset the chip. Do not call this directly.
-@@ -5521,6 +5561,8 @@ static int b43_one_core_attach(struct b4
+@@ -5501,6 +5541,8 @@ static int b43_one_core_attach(struct b4
if (!wldev)
goto out;
wldev->use_pio = b43_modparam_pio;
wldev->dev = dev;
wldev->wl = wl;
-@@ -5615,6 +5657,9 @@ static struct b43_wl *b43_wireless_init(
+@@ -5595,6 +5637,9 @@ static struct b43_wl *b43_wireless_init(
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -2909,6 +2909,14 @@ static int b43_gpio_init(struct b43_wlde
+@@ -2889,6 +2889,14 @@ static int b43_gpio_init(struct b43_wlde
} else if (dev->dev->chip_id == 0x5354) {
/* Don't allow overtaking buttons GPIOs */
set &= 0x2; /* 0x2 is LED GPIO on BCM5354 */
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -127,7 +127,7 @@ static int b43_modparam_pio = 0;
+@@ -114,7 +114,7 @@ static int b43_modparam_pio = 0;
module_param_named(pio, b43_modparam_pio, int, 0644);
MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
-@@ -11495,6 +11495,15 @@ static const struct attribute_group ipw_
+@@ -11481,6 +11481,15 @@ static const struct attribute_group ipw_
.attrs = ipw_sysfs_entries,
};
#ifdef CPTCFG_IPW2200_PROMISCUOUS
static int ipw_prom_open(struct net_device *dev)
{
-@@ -11543,15 +11552,6 @@ static netdev_tx_t ipw_prom_hard_start_x
+@@ -11529,15 +11538,6 @@ static netdev_tx_t ipw_prom_hard_start_x
return NETDEV_TX_OK;
}
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
-@@ -185,7 +185,7 @@ config CFG80211_WEXT_EXPORT
+@@ -186,7 +186,7 @@ config CFG80211_WEXT_EXPORT
endif # CFG80211
config LIB80211
depends on m
default n
help
-@@ -195,15 +195,15 @@ config LIB80211
+@@ -196,15 +196,15 @@ config LIB80211
Drivers should select this themselves if needed.
config LIB80211_CRYPT_WEP
--- a/local-symbols
+++ b/local-symbols
-@@ -401,43 +401,6 @@ USB_SIERRA_NET=
+@@ -410,43 +410,6 @@ USB_SIERRA_NET=
USB_VL600=
USB_NET_CH9200=
USB_NET_AQC111=
USB_WDM=
--- a/drivers/net/wireless/broadcom/b43/Kconfig
+++ b/drivers/net/wireless/broadcom/b43/Kconfig
-@@ -62,21 +62,21 @@ endchoice
+@@ -63,21 +63,21 @@ endchoice
config B43_PCI_AUTOSELECT
bool
depends on B43 && SSB_PCIHOST_POSSIBLE
---help---
Broadcom 43xx device support for Soft-MAC SDIO devices.
-@@ -95,13 +95,13 @@ config B43_SDIO
+@@ -96,13 +96,13 @@ config B43_SDIO
config B43_BCMA_PIO
bool
depends on B43 && B43_BCMA
config B43_PHY_G
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -2876,7 +2876,7 @@ static struct ssb_device *b43_ssb_gpio_d
+@@ -2856,7 +2856,7 @@ static struct ssb_device *b43_ssb_gpio_d
{
struct ssb_bus *bus = dev->dev->sdev->bus;
return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
#else
return bus->chipco.dev;
-@@ -4893,7 +4893,7 @@ static int b43_wireless_core_init(struct
+@@ -4873,7 +4873,7 @@ static int b43_wireless_core_init(struct
}
if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
dev->dev->sdev->bus->pcicore.dev->id.revision <= 10)
--- a/drivers/net/wireless/broadcom/b43legacy/Kconfig
+++ b/drivers/net/wireless/broadcom/b43legacy/Kconfig
-@@ -2,7 +2,7 @@ config B43LEGACY
+@@ -3,7 +3,7 @@ config B43LEGACY
tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)"
depends on m
depends on SSB_POSSIBLE && MAC80211 && HAS_DMA
depends on FW_LOADER
---help---
b43legacy is a driver for 802.11b devices from Broadcom (BCM4301 and
-@@ -24,15 +24,15 @@ config B43LEGACY
+@@ -25,15 +25,15 @@ config B43LEGACY
config B43LEGACY_PCI_AUTOSELECT
bool
depends on B43LEGACY && SSB_PCIHOST_POSSIBLE
# LED support
--- a/drivers/net/wireless/broadcom/b43legacy/main.c
+++ b/drivers/net/wireless/broadcom/b43legacy/main.c
-@@ -1937,7 +1937,7 @@ static int b43legacy_gpio_init(struct b4
+@@ -1905,7 +1905,7 @@ static int b43legacy_gpio_init(struct b4
if (dev->dev->id.revision >= 2)
mask |= 0x0010; /* FIXME: This is redundant. */
pcidev = bus->pcicore.dev;
#endif
gpiodev = bus->chipco.dev ? : pcidev;
-@@ -1956,7 +1956,7 @@ static void b43legacy_gpio_cleanup(struc
+@@ -1924,7 +1924,7 @@ static void b43legacy_gpio_cleanup(struc
struct ssb_bus *bus = dev->dev->bus;
struct ssb_device *gpiodev, *pcidev = NULL;
obj-$(CPTCFG_BRCMSMAC) += brcmsmac.o
--- a/drivers/net/wireless/broadcom/brcm80211/Kconfig
+++ b/drivers/net/wireless/broadcom/brcm80211/Kconfig
-@@ -7,7 +7,7 @@ config BRCMSMAC
+@@ -8,7 +8,7 @@ config BRCMSMAC
depends on m
depends on MAC80211
depends on BCMA_POSSIBLE
select BRCMUTIL
--- a/Kconfig.local
+++ b/Kconfig.local
-@@ -1207,117 +1207,6 @@ config BACKPORTED_USB_NET_CH9200
+@@ -1234,117 +1234,6 @@ config BACKPORTED_USB_NET_CH9200
config BACKPORTED_USB_NET_AQC111
tristate
default USB_NET_AQC111
--- a/drivers/net/wireless/marvell/mwl8k.c
+++ b/drivers/net/wireless/marvell/mwl8k.c
-@@ -5691,6 +5691,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
+@@ -5694,6 +5694,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API));
static const struct pci_device_id mwl8k_pci_id_table[] = {
err_wiphy_new:
--- a/drivers/net/wireless/marvell/libertas/main.c
+++ b/drivers/net/wireless/marvell/libertas/main.c
-@@ -934,6 +934,7 @@ struct lbs_private *lbs_add_card(void *c
+@@ -935,6 +935,7 @@ struct lbs_private *lbs_add_card(void *c
goto err_adapter;
}
--- a/drivers/net/wireless/marvell/mwl8k.c
+++ b/drivers/net/wireless/marvell/mwl8k.c
-@@ -6276,6 +6276,8 @@ static int mwl8k_probe(struct pci_dev *p
+@@ -6279,6 +6279,8 @@ static int mwl8k_probe(struct pci_dev *p
priv->running_bsses = 0;
return rc;
err_stop_firmware:
-@@ -6309,8 +6311,6 @@ static void mwl8k_remove(struct pci_dev
+@@ -6312,8 +6314,6 @@ static void mwl8k_remove(struct pci_dev
return;
priv = hw->priv;
+++ /dev/null
-From patchwork Tue Mar 12 09:51:40 2019
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10848957
-X-Patchwork-Delegate: johannes@sipsolutions.net
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-To: linux-wireless@vger.kernel.org
-Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= <pozega.tomislav@gmail.com>,
- Daniel Golle <daniel@makrotopia.org>, Felix Fietkau <nbd@nbd.name>,
- Mathias Kresin <dev@kresin.me>
-Subject: [PATCH v3 1/4] cfg80211: add ratelimited variants of err and warn
-Date: Tue, 12 Mar 2019 10:51:40 +0100
-Message-Id: <1552384303-29529-2-git-send-email-sgruszka@redhat.com>
-In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com>
-References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com>
-
-wiphy_{err,warn}_ratelimited will be used by rt2x00
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- include/net/cfg80211.h | 5 +++++
- 1 file changed, 5 insertions(+)
-
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -7194,6 +7194,11 @@ void cfg80211_pmsr_complete(struct wirel
- #define wiphy_warn_ratelimited(wiphy, format, args...) \
- dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
-
-+#define wiphy_err_ratelimited(wiphy, format, args...) \
-+ dev_err_ratelimited(&(wiphy)->dev, format, ##args)
-+#define wiphy_warn_ratelimited(wiphy, format, args...) \
-+ dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
-+
- #define wiphy_debug(wiphy, format, args...) \
- wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
-
+++ /dev/null
-From patchwork Tue Mar 12 09:51:41 2019
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10848959
-X-Patchwork-Delegate: kvalo@adurom.com
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-To: linux-wireless@vger.kernel.org
-Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= <pozega.tomislav@gmail.com>,
- Daniel Golle <daniel@makrotopia.org>, Felix Fietkau <nbd@nbd.name>,
- Mathias Kresin <dev@kresin.me>
-Subject: [PATCH v3 2/4] rt2x00: use ratelimited variants dev_warn/dev_err
-Date: Tue, 12 Mar 2019 10:51:41 +0100
-Message-Id: <1552384303-29529-3-git-send-email-sgruszka@redhat.com>
-In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com>
-References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com>
-
-As reported by Randy we can overwhelm logs on some USB error conditions.
-To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd().
-
-Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com>
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -69,10 +69,10 @@
- printk(KERN_ERR KBUILD_MODNAME ": %s: Error - " fmt, \
- __func__, ##__VA_ARGS__)
- #define rt2x00_err(dev, fmt, ...) \
-- wiphy_err((dev)->hw->wiphy, "%s: Error - " fmt, \
-+ wiphy_err_ratelimited((dev)->hw->wiphy, "%s: Error - " fmt, \
- __func__, ##__VA_ARGS__)
- #define rt2x00_warn(dev, fmt, ...) \
-- wiphy_warn((dev)->hw->wiphy, "%s: Warning - " fmt, \
-+ wiphy_warn_ratelimited((dev)->hw->wiphy, "%s: Warning - " fmt, \
- __func__, ##__VA_ARGS__)
- #define rt2x00_info(dev, fmt, ...) \
- wiphy_info((dev)->hw->wiphy, "%s: Info - " fmt, \
+++ /dev/null
-From patchwork Tue Mar 12 09:51:42 2019
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10848961
-X-Patchwork-Delegate: kvalo@adurom.com
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-To: linux-wireless@vger.kernel.org
-Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= <pozega.tomislav@gmail.com>,
- Daniel Golle <daniel@makrotopia.org>, Felix Fietkau <nbd@nbd.name>,
- Mathias Kresin <dev@kresin.me>
-Subject: [PATCH v3 3/4] rt2x00: check number of EPROTO errors
-Date: Tue, 12 Mar 2019 10:51:42 +0100
-Message-Id: <1552384303-29529-4-git-send-email-sgruszka@redhat.com>
-In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com>
-References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com>
-
-Some USB host devices/drivers on some conditions can always return
-EPROTO error on submitted URBs. That can cause infinity loop in the
-rt2x00 driver.
-
-Since we can have single EPROTO errors we can not mark as device as
-removed to avoid infinity loop. However we can count consecutive
-EPROTO errors and mark device as removed if get lot of it.
-I choose number 10 as threshold.
-
-Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com>
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 +
- drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 22 +++++++++++++++++++---
- 2 files changed, 20 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -1016,6 +1016,7 @@ struct rt2x00_dev {
- unsigned int extra_tx_headroom;
-
- struct usb_anchor *anchor;
-+ unsigned int num_proto_errs;
-
- /* Clock for System On Chip devices. */
- struct clk *clk;
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
-@@ -31,6 +31,22 @@
- #include "rt2x00.h"
- #include "rt2x00usb.h"
-
-+static bool rt2x00usb_check_usb_error(struct rt2x00_dev *rt2x00dev, int status)
-+{
-+ if (status == -ENODEV || status == -ENOENT)
-+ return true;
-+
-+ if (status == -EPROTO || status == -ETIMEDOUT)
-+ rt2x00dev->num_proto_errs++;
-+ else
-+ rt2x00dev->num_proto_errs = 0;
-+
-+ if (rt2x00dev->num_proto_errs > 3)
-+ return true;
-+
-+ return false;
-+}
-+
- /*
- * Interfacing with the HW.
- */
-@@ -57,7 +73,7 @@ int rt2x00usb_vendor_request(struct rt2x
- if (status >= 0)
- return 0;
-
-- if (status == -ENODEV || status == -ENOENT) {
-+ if (rt2x00usb_check_usb_error(rt2x00dev, status)) {
- /* Device has disappeared. */
- clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
- break;
-@@ -321,7 +337,7 @@ static bool rt2x00usb_kick_tx_entry(stru
-
- status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
- if (status) {
-- if (status == -ENODEV || status == -ENOENT)
-+ if (rt2x00usb_check_usb_error(rt2x00dev, status))
- clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
- set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
- rt2x00lib_dmadone(entry);
-@@ -410,7 +426,7 @@ static bool rt2x00usb_kick_rx_entry(stru
-
- status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
- if (status) {
-- if (status == -ENODEV || status == -ENOENT)
-+ if (rt2x00usb_check_usb_error(rt2x00dev, status))
- clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
- set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
- rt2x00lib_dmadone(entry);
+++ /dev/null
-From patchwork Tue Mar 12 09:51:43 2019
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10848963
-X-Patchwork-Delegate: kvalo@adurom.com
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-To: linux-wireless@vger.kernel.org
-Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= <pozega.tomislav@gmail.com>,
- Daniel Golle <daniel@makrotopia.org>, Felix Fietkau <nbd@nbd.name>,
- Mathias Kresin <dev@kresin.me>
-Subject: [PATCH v3 4/4] rt2x00: do not print error when queue is full
-Date: Tue, 12 Mar 2019 10:51:43 +0100
-Message-Id: <1552384303-29529-5-git-send-email-sgruszka@redhat.com>
-In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com>
-References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com>
-
-For unknown reasons printk() on some context can cause CPU hung on
-embedded MT7620 AP/router MIPS platforms. What can result on wifi
-disconnects.
-
-This patch move queue full messages to debug level what is consistent
-with other mac80211 drivers which drop packet silently if tx queue is
-full. This make MT7620 OpenWRT routers more stable, what was reported
-by various users.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-@@ -674,7 +674,7 @@ int rt2x00queue_write_tx_frame(struct da
- spin_lock(&queue->tx_lock);
-
- if (unlikely(rt2x00queue_full(queue))) {
-- rt2x00_err(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n",
-+ rt2x00_dbg(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n",
- queue->qid);
- ret = -ENOBUFS;
- goto out;
+++ /dev/null
-From 91a5340db0526b7263bc8da14b120ea3129b5f28 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Sat, 9 Feb 2019 12:08:31 +0100
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10804437
-X-Patchwork-Delegate: kvalo@adurom.com
-Subject: [PATCH 21/28] rt2800: partially restore old mmio txstatus behaviour
-
-Do not disable txstatus interrupt and add quota of processed tx statuses in
-one tasklet. Quota is needed to allow to fed device with new frames during
-processing of tx statuses.
-
-Patch fixes about 15% performance degradation on some scenarios coused by
-0b0d556e0ebb ("rt2800mmio: use txdone/txstatus routines from lib").
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- .../net/wireless/ralink/rt2x00/rt2800lib.c | 4 +--
- .../net/wireless/ralink/rt2x00/rt2800lib.h | 2 +-
- .../net/wireless/ralink/rt2x00/rt2800mmio.c | 30 +++++--------------
- .../net/wireless/ralink/rt2x00/rt2800usb.c | 2 +-
- 4 files changed, 12 insertions(+), 26 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -1100,7 +1100,7 @@ void rt2800_txdone_entry(struct queue_en
- }
- EXPORT_SYMBOL_GPL(rt2800_txdone_entry);
-
--void rt2800_txdone(struct rt2x00_dev *rt2x00dev)
-+void rt2800_txdone(struct rt2x00_dev *rt2x00dev, unsigned int quota)
- {
- struct data_queue *queue;
- struct queue_entry *entry;
-@@ -1108,7 +1108,7 @@ void rt2800_txdone(struct rt2x00_dev *rt
- u8 qid;
- bool match;
-
-- while (kfifo_get(&rt2x00dev->txstatus_fifo, ®)) {
-+ while (quota-- > 0 && kfifo_get(&rt2x00dev->txstatus_fifo, ®)) {
- /*
- * TX_STA_FIFO_PID_QUEUE is a 2-bit field, thus qid is
- * guaranteed to be one of the TX QIDs .
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -195,7 +195,7 @@ void rt2800_process_rxwi(struct queue_en
-
- void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi,
- bool match);
--void rt2800_txdone(struct rt2x00_dev *rt2x00dev);
-+void rt2800_txdone(struct rt2x00_dev *rt2x00dev, unsigned int quota);
- void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev);
- bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev);
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
-@@ -255,20 +255,6 @@ void rt2800mmio_autowake_tasklet(unsigne
- }
- EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet);
-
--static void rt2800mmio_txdone(struct rt2x00_dev *rt2x00dev)
--{
-- bool timeout = false;
--
-- while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) ||
-- (timeout = rt2800_txstatus_timeout(rt2x00dev))) {
--
-- rt2800_txdone(rt2x00dev);
--
-- if (timeout)
-- rt2800_txdone_nostatus(rt2x00dev);
-- }
--}
--
- static bool rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev)
- {
- u32 status;
-@@ -305,14 +291,11 @@ void rt2800mmio_txstatus_tasklet(unsigne
- {
- struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
-
-- do {
-- rt2800mmio_txdone(rt2x00dev);
-+ rt2800_txdone(rt2x00dev, 16);
-
-- } while (rt2800mmio_fetch_txstatus(rt2x00dev));
-+ if (!kfifo_is_empty(&rt2x00dev->txstatus_fifo))
-+ tasklet_schedule(&rt2x00dev->txstatus_tasklet);
-
-- if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
-- rt2800mmio_enable_interrupt(rt2x00dev,
-- INT_SOURCE_CSR_TX_FIFO_STATUS);
- }
- EXPORT_SYMBOL_GPL(rt2800mmio_txstatus_tasklet);
-
-@@ -339,8 +322,10 @@ irqreturn_t rt2800mmio_interrupt(int irq
- mask = ~reg;
-
- if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) {
-+ rt2x00_set_field32(&mask, INT_MASK_CSR_TX_FIFO_STATUS, 1);
- rt2800mmio_fetch_txstatus(rt2x00dev);
-- tasklet_schedule(&rt2x00dev->txstatus_tasklet);
-+ if (!kfifo_is_empty(&rt2x00dev->txstatus_fifo))
-+ tasklet_schedule(&rt2x00dev->txstatus_tasklet);
- }
-
- if (rt2x00_get_field32(reg, INT_SOURCE_CSR_PRE_TBTT))
-@@ -500,7 +485,8 @@ void rt2800mmio_flush_queue(struct data_
- */
- if (tx_queue) {
- tasklet_disable(&rt2x00dev->txstatus_tasklet);
-- rt2800mmio_txdone(rt2x00dev);
-+ rt2800_txdone(rt2x00dev, UINT_MAX);
-+ rt2800_txdone_nostatus(rt2x00dev);
- tasklet_enable(&rt2x00dev->txstatus_tasklet);
- }
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-@@ -480,7 +480,7 @@ static void rt2800usb_work_txdone(struct
- while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) ||
- rt2800_txstatus_timeout(rt2x00dev)) {
-
-- rt2800_txdone(rt2x00dev);
-+ rt2800_txdone(rt2x00dev, UINT_MAX);
-
- rt2800_txdone_nostatus(rt2x00dev);
-
+++ /dev/null
-From 11f8ad1656035176bad9d89de7ea0e7fe6d82c32 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Sat, 9 Feb 2019 12:08:32 +0100
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10804439
-X-Patchwork-Delegate: kvalo@adurom.com
-Subject: [PATCH 22/28] rt2800: new flush implementation for SoC devices
-
-Use new flush_queue() calback for SoC devices, what was already done for
-PCIe devices.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-@@ -203,7 +203,7 @@ static const struct rt2x00lib_ops rt2800
- .start_queue = rt2800mmio_start_queue,
- .kick_queue = rt2800mmio_kick_queue,
- .stop_queue = rt2800mmio_stop_queue,
-- .flush_queue = rt2x00mmio_flush_queue,
-+ .flush_queue = rt2800mmio_flush_queue,
- .write_tx_desc = rt2800mmio_write_tx_desc,
- .write_tx_data = rt2800_write_tx_data,
- .write_beacon = rt2800_write_beacon,
+++ /dev/null
-From 2bbea7645c3d095014a080db170941818650e141 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Sat, 9 Feb 2019 12:08:33 +0100
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10804441
-X-Patchwork-Delegate: kvalo@adurom.com
-Subject: [PATCH 23/28] rt2800: move txstatus pending routine
-
-Move rt2800usb_txstatus_pending routine to rt2800lib. It will be reused
-by rt2800mmio code.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- .../net/wireless/ralink/rt2x00/rt2800lib.c | 17 ++++++++++++++
- .../net/wireless/ralink/rt2x00/rt2800lib.h | 1 +
- .../net/wireless/ralink/rt2x00/rt2800usb.c | 22 +++----------------
- 3 files changed, 21 insertions(+), 19 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -1183,6 +1183,23 @@ bool rt2800_txstatus_timeout(struct rt2x
- }
- EXPORT_SYMBOL_GPL(rt2800_txstatus_timeout);
-
-+/*
-+ * test if there is an entry in any TX queue for which DMA is done
-+ * but the TX status has not been returned yet
-+ */
-+bool rt2800_txstatus_pending(struct rt2x00_dev *rt2x00dev)
-+{
-+ struct data_queue *queue;
-+
-+ tx_queue_for_each(rt2x00dev, queue) {
-+ if (rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE) !=
-+ rt2x00queue_get_entry(queue, Q_INDEX_DONE))
-+ return true;
-+ }
-+ return false;
-+}
-+EXPORT_SYMBOL_GPL(rt2800_txstatus_pending);
-+
- void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev)
- {
- struct data_queue *queue;
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -198,6 +198,7 @@ void rt2800_txdone_entry(struct queue_en
- void rt2800_txdone(struct rt2x00_dev *rt2x00dev, unsigned int quota);
- void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev);
- bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev);
-+bool rt2800_txstatus_pending(struct rt2x00_dev *rt2x00dev);
-
- void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc);
- void rt2800_clear_beacon(struct queue_entry *entry);
---- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-@@ -100,22 +100,6 @@ static void rt2800usb_stop_queue(struct
- }
- }
-
--/*
-- * test if there is an entry in any TX queue for which DMA is done
-- * but the TX status has not been returned yet
-- */
--static bool rt2800usb_txstatus_pending(struct rt2x00_dev *rt2x00dev)
--{
-- struct data_queue *queue;
--
-- tx_queue_for_each(rt2x00dev, queue) {
-- if (rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE) !=
-- rt2x00queue_get_entry(queue, Q_INDEX_DONE))
-- return true;
-- }
-- return false;
--}
--
- #define TXSTATUS_READ_INTERVAL 1000000
-
- static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
-@@ -145,7 +129,7 @@ static bool rt2800usb_tx_sta_fifo_read_c
- if (rt2800_txstatus_timeout(rt2x00dev))
- queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
-
-- if (rt2800usb_txstatus_pending(rt2x00dev)) {
-+ if (rt2800_txstatus_pending(rt2x00dev)) {
- /* Read register after 1 ms */
- hrtimer_start(&rt2x00dev->txstatus_timer,
- TXSTATUS_READ_INTERVAL,
-@@ -160,7 +144,7 @@ stop_reading:
- * clear_bit someone could do rt2x00usb_interrupt_txdone, so recheck
- * here again if status reading is needed.
- */
-- if (rt2800usb_txstatus_pending(rt2x00dev) &&
-+ if (rt2800_txstatus_pending(rt2x00dev) &&
- !test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))
- return true;
- else
-@@ -489,7 +473,7 @@ static void rt2800usb_work_txdone(struct
- * if the medium is busy, thus the TX_STA_FIFO entry is
- * also delayed -> use a timer to retrieve it.
- */
-- if (rt2800usb_txstatus_pending(rt2x00dev))
-+ if (rt2800_txstatus_pending(rt2x00dev))
- rt2800usb_async_read_tx_status(rt2x00dev);
- }
- }
+++ /dev/null
-From f6a9618198e190a2ba09ce3f0aa8e9ee1763bd38 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Sat, 9 Feb 2019 12:08:34 +0100
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10804443
-X-Patchwork-Delegate: kvalo@adurom.com
-Subject: [PATCH 24/28] rt2800mmio: fetch tx status changes
-
-Prepare to use rt2800mmio_fetch_txstatus() in concurrent manner and drop
-return value since is not longer needed.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 17 +++++++++--------
- 1 file changed, 9 insertions(+), 8 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
-@@ -255,12 +255,12 @@ void rt2800mmio_autowake_tasklet(unsigne
- }
- EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet);
-
--static bool rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev)
-+static void rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev)
- {
- u32 status;
-- bool more = false;
-+ unsigned long flags;
-
-- /* FIXEME: rewrite this comment
-+ /*
- * The TX_FIFO_STATUS interrupt needs special care. We should
- * read TX_STA_FIFO but we should do it immediately as otherwise
- * the register can overflow and we would lose status reports.
-@@ -271,20 +271,21 @@ static bool rt2800mmio_fetch_txstatus(st
- * because we can schedule the tasklet multiple times (when the
- * interrupt fires again during tx status processing).
- *
-- * txstatus tasklet is called with INT_SOURCE_CSR_TX_FIFO_STATUS
-- * disabled so have only one producer and one consumer - we don't
-- * need to lock the kfifo.
-+ * We also read statuses from tx status timeout timer, use
-+ * lock to prevent concurent writes to fifo.
- */
-+
-+ spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags);
-+
- while (!kfifo_is_full(&rt2x00dev->txstatus_fifo)) {
- status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO);
- if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID))
- break;
-
- kfifo_put(&rt2x00dev->txstatus_fifo, status);
-- more = true;
- }
-
-- return more;
-+ spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags);
- }
-
- void rt2800mmio_txstatus_tasklet(unsigned long data)
+++ /dev/null
-From 175c2548332b45b144af673e70fdbb1a947d7aba Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Sat, 9 Feb 2019 12:08:35 +0100
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10804445
-X-Patchwork-Delegate: kvalo@adurom.com
-Subject: [PATCH 25/28] rt2800mmio: use timer and work for handling tx statuses
- timeouts
-
-Sometimes we can get into situation when there are pending statuses,
-but we do not get INT_SOURCE_CSR_TX_FIFO_STATUS. Handle this situation
-by arming timeout timer and read statuses (it will fix case when
-we just do not have irq) and queue work to handle case we missed
-statues from hardware FIFO.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- .../net/wireless/ralink/rt2x00/rt2800mmio.c | 81 +++++++++++++++++--
- .../net/wireless/ralink/rt2x00/rt2800mmio.h | 1 +
- .../net/wireless/ralink/rt2x00/rt2800pci.c | 2 +-
- .../net/wireless/ralink/rt2x00/rt2800soc.c | 2 +-
- .../net/wireless/ralink/rt2x00/rt2x00dev.c | 4 +
- 5 files changed, 82 insertions(+), 8 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
-@@ -426,6 +426,9 @@ void rt2800mmio_start_queue(struct data_
- }
- EXPORT_SYMBOL_GPL(rt2800mmio_start_queue);
-
-+/* 200 ms */
-+#define TXSTATUS_TIMEOUT 200000000
-+
- void rt2800mmio_kick_queue(struct data_queue *queue)
- {
- struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
-@@ -440,6 +443,8 @@ void rt2800mmio_kick_queue(struct data_q
- entry = rt2x00queue_get_entry(queue, Q_INDEX);
- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(queue->qid),
- entry->entry_idx);
-+ hrtimer_start(&rt2x00dev->txstatus_timer,
-+ TXSTATUS_TIMEOUT, HRTIMER_MODE_REL);
- break;
- case QID_MGMT:
- entry = rt2x00queue_get_entry(queue, Q_INDEX);
-@@ -484,12 +489,8 @@ void rt2800mmio_flush_queue(struct data_
- * For TX queues schedule completion tasklet to catch
- * tx status timeouts, othewise just wait.
- */
-- if (tx_queue) {
-- tasklet_disable(&rt2x00dev->txstatus_tasklet);
-- rt2800_txdone(rt2x00dev, UINT_MAX);
-- rt2800_txdone_nostatus(rt2x00dev);
-- tasklet_enable(&rt2x00dev->txstatus_tasklet);
-- }
-+ if (tx_queue)
-+ queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
-
- /*
- * Wait for a little while to give the driver
-@@ -627,6 +628,10 @@ void rt2800mmio_clear_entry(struct queue
- word = rt2x00_desc_read(entry_priv->desc, 1);
- rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 1);
- rt2x00_desc_write(entry_priv->desc, 1, word);
-+
-+ /* If last entry stop txstatus timer */
-+ if (entry->queue->length == 1)
-+ hrtimer_cancel(&rt2x00dev->txstatus_timer);
- }
- }
- EXPORT_SYMBOL_GPL(rt2800mmio_clear_entry);
-@@ -759,6 +764,70 @@ int rt2800mmio_enable_radio(struct rt2x0
- }
- EXPORT_SYMBOL_GPL(rt2800mmio_enable_radio);
-
-+static void rt2800mmio_work_txdone(struct work_struct *work)
-+{
-+ struct rt2x00_dev *rt2x00dev =
-+ container_of(work, struct rt2x00_dev, txdone_work);
-+
-+ if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
-+ return;
-+
-+ while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) ||
-+ rt2800_txstatus_timeout(rt2x00dev)) {
-+
-+ tasklet_disable(&rt2x00dev->txstatus_tasklet);
-+ rt2800_txdone(rt2x00dev, UINT_MAX);
-+ rt2800_txdone_nostatus(rt2x00dev);
-+ tasklet_enable(&rt2x00dev->txstatus_tasklet);
-+ }
-+
-+ if (rt2800_txstatus_pending(rt2x00dev))
-+ hrtimer_start(&rt2x00dev->txstatus_timer,
-+ TXSTATUS_TIMEOUT, HRTIMER_MODE_REL);
-+}
-+
-+static enum hrtimer_restart rt2800mmio_tx_sta_fifo_timeout(struct hrtimer *timer)
-+{
-+ struct rt2x00_dev *rt2x00dev =
-+ container_of(timer, struct rt2x00_dev, txstatus_timer);
-+
-+ if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
-+ goto out;
-+
-+ if (!rt2800_txstatus_pending(rt2x00dev))
-+ goto out;
-+
-+ rt2800mmio_fetch_txstatus(rt2x00dev);
-+ if (!kfifo_is_empty(&rt2x00dev->txstatus_fifo))
-+ tasklet_schedule(&rt2x00dev->txstatus_tasklet);
-+ else
-+ queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
-+out:
-+ return HRTIMER_NORESTART;
-+}
-+
-+int rt2800mmio_probe_hw(struct rt2x00_dev *rt2x00dev)
-+{
-+ int retval;
-+
-+ retval = rt2800_probe_hw(rt2x00dev);
-+ if (retval)
-+ return retval;
-+
-+ /*
-+ * Set txstatus timer function.
-+ */
-+ rt2x00dev->txstatus_timer.function = rt2800mmio_tx_sta_fifo_timeout;
-+
-+ /*
-+ * Overwrite TX done handler
-+ */
-+ INIT_WORK(&rt2x00dev->txdone_work, rt2800mmio_work_txdone);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(rt2800mmio_probe_hw);
-+
- MODULE_AUTHOR(DRV_PROJECT);
- MODULE_VERSION(DRV_VERSION);
- MODULE_DESCRIPTION("rt2800 MMIO library");
---- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h
-@@ -153,6 +153,7 @@ void rt2800mmio_stop_queue(struct data_q
- void rt2800mmio_queue_init(struct data_queue *queue);
-
- /* Initialization functions */
-+int rt2800mmio_probe_hw(struct rt2x00_dev *rt2x00dev);
- bool rt2800mmio_get_entry_state(struct queue_entry *entry);
- void rt2800mmio_clear_entry(struct queue_entry *entry);
- int rt2800mmio_init_queues(struct rt2x00_dev *rt2x00dev);
---- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
-@@ -346,7 +346,7 @@ static const struct rt2x00lib_ops rt2800
- .tbtt_tasklet = rt2800mmio_tbtt_tasklet,
- .rxdone_tasklet = rt2800mmio_rxdone_tasklet,
- .autowake_tasklet = rt2800mmio_autowake_tasklet,
-- .probe_hw = rt2800_probe_hw,
-+ .probe_hw = rt2800mmio_probe_hw,
- .get_firmware_name = rt2800pci_get_firmware_name,
- .check_firmware = rt2800_check_firmware,
- .load_firmware = rt2800_load_firmware,
---- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-@@ -185,7 +185,7 @@ static const struct rt2x00lib_ops rt2800
- .tbtt_tasklet = rt2800mmio_tbtt_tasklet,
- .rxdone_tasklet = rt2800mmio_rxdone_tasklet,
- .autowake_tasklet = rt2800mmio_autowake_tasklet,
-- .probe_hw = rt2800_probe_hw,
-+ .probe_hw = rt2800mmio_probe_hw,
- .get_firmware_name = rt2800soc_get_firmware_name,
- .check_firmware = rt2800soc_check_firmware,
- .load_firmware = rt2800soc_load_firmware,
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1391,6 +1391,8 @@ int rt2x00lib_probe_dev(struct rt2x00_de
- mutex_init(&rt2x00dev->conf_mutex);
- INIT_LIST_HEAD(&rt2x00dev->bar_list);
- spin_lock_init(&rt2x00dev->bar_list_lock);
-+ hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC,
-+ HRTIMER_MODE_REL);
-
- set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
-
-@@ -1515,6 +1517,8 @@ void rt2x00lib_remove_dev(struct rt2x00_
- cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
- cancel_work_sync(&rt2x00dev->sleep_work);
-
-+ hrtimer_cancel(&rt2x00dev->txstatus_timer);
-+
- /*
- * Kill the tx status tasklet.
- */
+++ /dev/null
-From 6013a91f15c9dabd668d5736652b9bcfb0ef0378 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Sat, 9 Feb 2019 12:08:36 +0100
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10804447
-X-Patchwork-Delegate: kvalo@adurom.com
-Subject: [PATCH 26/28] rt2x00: remove last_nostatus_check
-
-We do not any longer check txstatus timeout from tasklet, so do not need
-this optimization.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 ---------
- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 2 --
- drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 1 -
- 3 files changed, 12 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -1164,15 +1164,6 @@ bool rt2800_txstatus_timeout(struct rt2x
- struct data_queue *queue;
- struct queue_entry *entry;
-
-- if (!test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) {
-- unsigned long tout = msecs_to_jiffies(1000);
--
-- if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout))
-- return false;
-- }
--
-- rt2x00dev->last_nostatus_check = jiffies;
--
- tx_queue_for_each(rt2x00dev, queue) {
- entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
- if (rt2800_entry_txstatus_timeout(rt2x00dev, entry))
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -980,8 +980,6 @@ struct rt2x00_dev {
- */
- DECLARE_KFIFO_PTR(txstatus_fifo, u32);
-
-- unsigned long last_nostatus_check;
--
- /*
- * Timer to ensure tx status reports are read (rt2800usb).
- */
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-@@ -1042,7 +1042,6 @@ void rt2x00queue_start_queues(struct rt2
- */
- tx_queue_for_each(rt2x00dev, queue)
- rt2x00queue_start_queue(queue);
-- rt2x00dev->last_nostatus_check = jiffies;
-
- rt2x00queue_start_queue(rt2x00dev->rx);
- }
+++ /dev/null
-From 2758f09b22bc08e89e0391486b2d707ad2479599 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Sat, 9 Feb 2019 12:08:37 +0100
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10804449
-X-Patchwork-Delegate: kvalo@adurom.com
-Subject: [PATCH 27/28] rt2x00: remove not used entry field
-
-Remove not used any longer queue_entry field and flag.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00queue.h | 3 ---
- 1 file changed, 3 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
-@@ -361,7 +361,6 @@ enum queue_entry_flags {
- ENTRY_DATA_PENDING,
- ENTRY_DATA_IO_FAILED,
- ENTRY_DATA_STATUS_PENDING,
-- ENTRY_DATA_STATUS_SET,
- };
-
- /**
-@@ -387,8 +386,6 @@ struct queue_entry {
-
- unsigned int entry_idx;
-
-- u32 status;
--
- void *priv_data;
- };
-
+++ /dev/null
-From f44e145869bb517460648e4ed71b7e9001964d06 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Sat, 9 Feb 2019 12:08:38 +0100
-X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
-X-Patchwork-Id: 10804451
-X-Patchwork-Delegate: kvalo@adurom.com
-Subject: [PATCH 28/28] rt2x00mmio: remove legacy comment
-
-Remove comment about fields that ware removed.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00mmio.h | 2 --
- 1 file changed, 2 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.h
-@@ -80,8 +80,6 @@ int rt2x00mmio_regbusy_read(struct rt2x0
- *
- * @desc: Pointer to device descriptor
- * @desc_dma: DMA pointer to &desc.
-- * @data: Pointer to device's entry memory.
-- * @data_dma: DMA pointer to &data.
- */
- struct queue_entry_priv_mmio {
- __le32 *desc;
+++ /dev/null
-From d0e61a0f7cca51ce340a5a73595189972122ff25 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Wed, 24 Apr 2019 09:49:24 +0200
-Subject: [PATCH] rt2x00: add RT3883 support
-
-Patch add support for RT3883 chip. Code was taken direclty
-from openwrt project and merge into one patch.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800.h | 19 +-
- .../net/wireless/ralink/rt2x00/rt2800lib.c | 598 +++++++++++++++++-
- .../net/wireless/ralink/rt2x00/rt2800soc.c | 9 +-
- 3 files changed, 607 insertions(+), 19 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
-@@ -48,7 +48,8 @@
- * RF2853 2.4G/5G 3T3R
- * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390)
- * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392)
-- * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662)
-+ * RF3053 2.4G/5G 3T3R(RT3563/RT3573/RT3593)
-+ * RF3853 2.4G/5G 3T3R(RT3883/RT3662)
- * RF5592 2.4G/5G 2T2R
- * RF3070 2.4G 1T1R
- * RF5360 2.4G 1T1R
-@@ -72,6 +73,7 @@
- #define RF5592 0x000f
- #define RF3070 0x3070
- #define RF3290 0x3290
-+#define RF3853 0x3853
- #define RF5350 0x5350
- #define RF5360 0x5360
- #define RF5362 0x5362
-@@ -1726,6 +1728,20 @@
- #define TX_PWR_CFG_9B_STBC_MCS7 FIELD32(0x000000ff)
-
- /*
-+ * TX_TXBF_CFG:
-+ */
-+#define TX_TXBF_CFG_0 0x138c
-+#define TX_TXBF_CFG_1 0x13a4
-+#define TX_TXBF_CFG_2 0x13a8
-+#define TX_TXBF_CFG_3 0x13ac
-+
-+/*
-+ * TX_FBK_CFG_3S:
-+ */
-+#define TX_FBK_CFG_3S_0 0x13c4
-+#define TX_FBK_CFG_3S_1 0x13c8
-+
-+/*
- * RX_FILTER_CFG: RX configuration register.
- */
- #define RX_FILTER_CFG 0x1400
-@@ -2296,6 +2312,7 @@ struct mac_iveiv_entry {
- /*
- * RFCSR 2:
- */
-+#define RFCSR2_RESCAL_BP FIELD8(0x40)
- #define RFCSR2_RESCAL_EN FIELD8(0x80)
- #define RFCSR2_RX2_EN_MT7620 FIELD8(0x02)
- #define RFCSR2_TX2_EN_MT7620 FIELD8(0x20)
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -381,7 +381,8 @@ static unsigned int rt2800_eeprom_word_i
- wiphy_name(rt2x00dev->hw->wiphy), word))
- return 0;
-
-- if (rt2x00_rt(rt2x00dev, RT3593))
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- map = rt2800_eeprom_map_ext;
- else
- map = rt2800_eeprom_map;
-@@ -590,6 +591,7 @@ void rt2800_get_txwi_rxwi_size(struct rt
- {
- switch (rt2x00dev->chip.rt) {
- case RT3593:
-+ case RT3883:
- *txwi_size = TXWI_DESC_SIZE_4WORDS;
- *rxwi_size = RXWI_DESC_SIZE_5WORDS;
- break;
-@@ -2180,7 +2182,8 @@ void rt2800_config_ant(struct rt2x00_dev
- rt2800_bbp_write(rt2x00dev, 3, r3);
- rt2800_bbp_write(rt2x00dev, 1, r1);
-
-- if (rt2x00_rt(rt2x00dev, RT3593)) {
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883)) {
- if (ant->rx_chain_num == 1)
- rt2800_bbp_write(rt2x00dev, 86, 0x00);
- else
-@@ -2202,7 +2205,8 @@ static void rt2800_config_lna_gain(struc
- eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_LNA);
- lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
- } else if (libconf->rf.channel <= 128) {
-- if (rt2x00_rt(rt2x00dev, RT3593)) {
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883)) {
- eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2);
- lna_gain = rt2x00_get_field16(eeprom,
- EEPROM_EXT_LNA2_A1);
-@@ -2212,7 +2216,8 @@ static void rt2800_config_lna_gain(struc
- EEPROM_RSSI_BG2_LNA_A1);
- }
- } else {
-- if (rt2x00_rt(rt2x00dev, RT3593)) {
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883)) {
- eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2);
- lna_gain = rt2x00_get_field16(eeprom,
- EEPROM_EXT_LNA2_A2);
-@@ -2880,6 +2885,211 @@ static void rt2800_config_channel_rf3053
- }
- }
-
-+static void rt2800_config_channel_rf3853(struct rt2x00_dev *rt2x00dev,
-+ struct ieee80211_conf *conf,
-+ struct rf_channel *rf,
-+ struct channel_info *info)
-+{
-+ u8 rfcsr;
-+ u8 bbp;
-+ u8 pwr1, pwr2, pwr3;
-+
-+ const bool txbf_enabled = false; /* TODO */
-+
-+ /* TODO: add band selection */
-+
-+ if (rf->channel <= 14)
-+ rt2800_rfcsr_write(rt2x00dev, 6, 0x40);
-+ else if (rf->channel < 132)
-+ rt2800_rfcsr_write(rt2x00dev, 6, 0x80);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 6, 0x40);
-+
-+ rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1);
-+ rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3);
-+
-+ if (rf->channel <= 14)
-+ rt2800_rfcsr_write(rt2x00dev, 11, 0x46);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 11, 0x48);
-+
-+ if (rf->channel <= 14)
-+ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 12, 0x52);
-+
-+ rt2800_rfcsr_write(rt2x00dev, 13, 0x12);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1);
-+ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0);
-+ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0);
-+ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0);
-+ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0);
-+ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0);
-+ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0);
-+ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1);
-+ rt2x00_set_field8(&rfcsr, RFCSR1_PLL_PD, 1);
-+
-+ switch (rt2x00dev->default_ant.tx_chain_num) {
-+ case 3:
-+ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1);
-+ /* fallthrough */
-+ case 2:
-+ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1);
-+ /* fallthrough */
-+ case 1:
-+ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 1);
-+ break;
-+ }
-+
-+ switch (rt2x00dev->default_ant.rx_chain_num) {
-+ case 3:
-+ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1);
-+ /* fallthrough */
-+ case 2:
-+ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1);
-+ /* fallthrough */
-+ case 1:
-+ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1);
-+ break;
-+ }
-+ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
-+
-+ rt2800_freq_cal_mode1(rt2x00dev);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 30);
-+ if (!conf_is_ht40(conf))
-+ rfcsr &= ~(0x06);
-+ else
-+ rfcsr |= 0x06;
-+ rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
-+
-+ if (rf->channel <= 14)
-+ rt2800_rfcsr_write(rt2x00dev, 31, 0xa0);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
-+
-+ if (conf_is_ht40(conf))
-+ rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8);
-+
-+ if (rf->channel <= 14)
-+ rt2800_rfcsr_write(rt2x00dev, 34, 0x3c);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 34, 0x20);
-+
-+ /* loopback RF_BS */
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 36);
-+ if (rf->channel <= 14)
-+ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 1);
-+ else
-+ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 0);
-+ rt2800_rfcsr_write(rt2x00dev, 36, rfcsr);
-+
-+ if (rf->channel <= 14)
-+ rfcsr = 0x23;
-+ else if (rf->channel < 100)
-+ rfcsr = 0x36;
-+ else if (rf->channel < 132)
-+ rfcsr = 0x32;
-+ else
-+ rfcsr = 0x30;
-+
-+ if (txbf_enabled)
-+ rfcsr |= 0x40;
-+
-+ rt2800_rfcsr_write(rt2x00dev, 39, rfcsr);
-+
-+ if (rf->channel <= 14)
-+ rt2800_rfcsr_write(rt2x00dev, 44, 0x93);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 44, 0x9b);
-+
-+ if (rf->channel <= 14)
-+ rfcsr = 0xbb;
-+ else if (rf->channel < 100)
-+ rfcsr = 0xeb;
-+ else if (rf->channel < 132)
-+ rfcsr = 0xb3;
-+ else
-+ rfcsr = 0x9b;
-+ rt2800_rfcsr_write(rt2x00dev, 45, rfcsr);
-+
-+ if (rf->channel <= 14)
-+ rfcsr = 0x8e;
-+ else
-+ rfcsr = 0x8a;
-+
-+ if (txbf_enabled)
-+ rfcsr |= 0x20;
-+
-+ rt2800_rfcsr_write(rt2x00dev, 49, rfcsr);
-+
-+ rt2800_rfcsr_write(rt2x00dev, 50, 0x86);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 51);
-+ if (rf->channel <= 14)
-+ rt2800_rfcsr_write(rt2x00dev, 51, 0x75);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 51, 0x51);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 52);
-+ if (rf->channel <= 14)
-+ rt2800_rfcsr_write(rt2x00dev, 52, 0x45);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 52, 0x05);
-+
-+ if (rf->channel <= 14) {
-+ pwr1 = info->default_power1 & 0x1f;
-+ pwr2 = info->default_power2 & 0x1f;
-+ pwr3 = info->default_power3 & 0x1f;
-+ } else {
-+ pwr1 = 0x48 | ((info->default_power1 & 0x18) << 1) |
-+ (info->default_power1 & 0x7);
-+ pwr2 = 0x48 | ((info->default_power2 & 0x18) << 1) |
-+ (info->default_power2 & 0x7);
-+ pwr3 = 0x48 | ((info->default_power3 & 0x18) << 1) |
-+ (info->default_power3 & 0x7);
-+ }
-+
-+ rt2800_rfcsr_write(rt2x00dev, 53, pwr1);
-+ rt2800_rfcsr_write(rt2x00dev, 54, pwr2);
-+ rt2800_rfcsr_write(rt2x00dev, 55, pwr3);
-+
-+ rt2x00_dbg(rt2x00dev, "Channel:%d, pwr1:%02x, pwr2:%02x, pwr3:%02x\n",
-+ rf->channel, pwr1, pwr2, pwr3);
-+
-+ bbp = (info->default_power1 >> 5) |
-+ ((info->default_power2 & 0xe0) >> 1);
-+ rt2800_bbp_write(rt2x00dev, 109, bbp);
-+
-+ bbp = rt2800_bbp_read(rt2x00dev, 110);
-+ bbp &= 0x0f;
-+ bbp |= (info->default_power3 & 0xe0) >> 1;
-+ rt2800_bbp_write(rt2x00dev, 110, bbp);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 57);
-+ if (rf->channel <= 14)
-+ rt2800_rfcsr_write(rt2x00dev, 57, 0x6e);
-+ else
-+ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e);
-+
-+ /* Enable RF tuning */
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 3);
-+ rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
-+ rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
-+
-+ udelay(2000);
-+
-+ bbp = rt2800_bbp_read(rt2x00dev, 49);
-+ /* clear update flag */
-+ rt2800_bbp_write(rt2x00dev, 49, bbp & 0xfe);
-+ rt2800_bbp_write(rt2x00dev, 49, bbp);
-+
-+ /* TODO: add calibration for TxBF */
-+}
-+
- #define POWER_BOUND 0x27
- #define POWER_BOUND_5G 0x2b
-
-@@ -3683,19 +3893,51 @@ static char rt2800_txpower_to_dev(struct
- unsigned int channel,
- char txpower)
- {
-- if (rt2x00_rt(rt2x00dev, RT3593))
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- txpower = rt2x00_get_field8(txpower, EEPROM_TXPOWER_ALC);
-
- if (channel <= 14)
- return clamp_t(char, txpower, MIN_G_TXPOWER, MAX_G_TXPOWER);
-
-- if (rt2x00_rt(rt2x00dev, RT3593))
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- return clamp_t(char, txpower, MIN_A_TXPOWER_3593,
- MAX_A_TXPOWER_3593);
- else
- return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
- }
-
-+static void rt3883_bbp_adjust(struct rt2x00_dev *rt2x00dev,
-+ struct rf_channel *rf)
-+{
-+ u8 bbp;
-+
-+ bbp = (rf->channel > 14) ? 0x48 : 0x38;
-+ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp);
-+
-+ rt2800_bbp_write(rt2x00dev, 69, 0x12);
-+
-+ if (rf->channel <= 14) {
-+ rt2800_bbp_write(rt2x00dev, 70, 0x0a);
-+ } else {
-+ /* Disable CCK packet detection */
-+ rt2800_bbp_write(rt2x00dev, 70, 0x00);
-+ }
-+
-+ rt2800_bbp_write(rt2x00dev, 73, 0x10);
-+
-+ if (rf->channel > 14) {
-+ rt2800_bbp_write(rt2x00dev, 62, 0x1d);
-+ rt2800_bbp_write(rt2x00dev, 63, 0x1d);
-+ rt2800_bbp_write(rt2x00dev, 64, 0x1d);
-+ } else {
-+ rt2800_bbp_write(rt2x00dev, 62, 0x2d);
-+ rt2800_bbp_write(rt2x00dev, 63, 0x2d);
-+ rt2800_bbp_write(rt2x00dev, 64, 0x2d);
-+ }
-+}
-+
- static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
- struct ieee80211_conf *conf,
- struct rf_channel *rf,
-@@ -3714,6 +3956,12 @@ static void rt2800_config_channel(struct
- rt2800_txpower_to_dev(rt2x00dev, rf->channel,
- info->default_power3);
-
-+ switch (rt2x00dev->chip.rt) {
-+ case RT3883:
-+ rt3883_bbp_adjust(rt2x00dev, rf);
-+ break;
-+ }
-+
- switch (rt2x00dev->chip.rf) {
- case RF2020:
- case RF3020:
-@@ -3734,6 +3982,9 @@ static void rt2800_config_channel(struct
- case RF3322:
- rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
- break;
-+ case RF3853:
-+ rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info);
-+ break;
- case RF3070:
- case RF5350:
- case RF5360:
-@@ -3815,6 +4066,15 @@ static void rt2800_config_channel(struct
- rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
- rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
- rt2800_bbp_write(rt2x00dev, 77, 0x98);
-+ } else if (rt2x00_rt(rt2x00dev, RT3883)) {
-+ rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
-+ rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
-+ rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
-+
-+ if (rt2x00dev->default_ant.rx_chain_num > 1)
-+ rt2800_bbp_write(rt2x00dev, 86, 0x46);
-+ else
-+ rt2800_bbp_write(rt2x00dev, 86, 0);
- } else {
- rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
- rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
-@@ -3828,6 +4088,7 @@ static void rt2800_config_channel(struct
- !rt2x00_rt(rt2x00dev, RT6352)) {
- if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
- rt2800_bbp_write(rt2x00dev, 82, 0x62);
-+ rt2800_bbp_write(rt2x00dev, 82, 0x62);
- rt2800_bbp_write(rt2x00dev, 75, 0x46);
- } else {
- if (rt2x00_rt(rt2x00dev, RT3593))
-@@ -3836,19 +4097,22 @@ static void rt2800_config_channel(struct
- rt2800_bbp_write(rt2x00dev, 82, 0x84);
- rt2800_bbp_write(rt2x00dev, 75, 0x50);
- }
-- if (rt2x00_rt(rt2x00dev, RT3593))
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- rt2800_bbp_write(rt2x00dev, 83, 0x8a);
- }
-
- } else {
- if (rt2x00_rt(rt2x00dev, RT3572))
- rt2800_bbp_write(rt2x00dev, 82, 0x94);
-- else if (rt2x00_rt(rt2x00dev, RT3593))
-+ else if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- rt2800_bbp_write(rt2x00dev, 82, 0x82);
- else if (!rt2x00_rt(rt2x00dev, RT6352))
- rt2800_bbp_write(rt2x00dev, 82, 0xf2);
-
-- if (rt2x00_rt(rt2x00dev, RT3593))
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- rt2800_bbp_write(rt2x00dev, 83, 0x9a);
-
- if (rt2x00_has_cap_external_lna_a(rt2x00dev))
-@@ -3984,6 +4248,23 @@ static void rt2800_config_channel(struct
- usleep_range(1000, 1500);
- }
-
-+ if (rt2x00_rt(rt2x00dev, RT3883)) {
-+ if (!conf_is_ht40(conf))
-+ rt2800_bbp_write(rt2x00dev, 105, 0x34);
-+ else
-+ rt2800_bbp_write(rt2x00dev, 105, 0x04);
-+
-+ /* AGC init */
-+ if (rf->channel <= 14)
-+ reg = 0x2e + rt2x00dev->lna_gain;
-+ else
-+ reg = 0x20 + ((rt2x00dev->lna_gain * 5) / 3);
-+
-+ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
-+
-+ usleep_range(1000, 1500);
-+ }
-+
- if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) {
- reg = 0x10;
- if (!conf_is_ht40(conf)) {
-@@ -4243,6 +4524,9 @@ static u8 rt2800_compensate_txpower(stru
- if (rt2x00_rt(rt2x00dev, RT3593))
- return min_t(u8, txpower, 0xc);
-
-+ if (rt2x00_rt(rt2x00dev, RT3883))
-+ return min_t(u8, txpower, 0xf);
-+
- if (rt2x00_has_cap_power_limit(rt2x00dev)) {
- /*
- * Check if eirp txpower exceed txpower_limit.
-@@ -5004,7 +5288,8 @@ static void rt2800_config_txpower(struct
- struct ieee80211_channel *chan,
- int power_level)
- {
-- if (rt2x00_rt(rt2x00dev, RT3593))
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- rt2800_config_txpower_rt3593(rt2x00dev, chan, power_level);
- else if (rt2x00_rt(rt2x00dev, RT6352))
- rt2800_config_txpower_rt6352(rt2x00dev, chan, power_level);
-@@ -5051,6 +5336,7 @@ void rt2800_vco_calibration(struct rt2x0
- case RF3053:
- case RF3070:
- case RF3290:
-+ case RF3853:
- case RF5350:
- case RF5360:
- case RF5362:
-@@ -5251,7 +5537,8 @@ static u8 rt2800_get_default_vgc(struct
- else
- vgc = 0x2e + rt2x00dev->lna_gain;
- } else { /* 5GHZ band */
-- if (rt2x00_rt(rt2x00dev, RT3593))
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3;
- else if (rt2x00_rt(rt2x00dev, RT5592))
- vgc = 0x24 + (2 * rt2x00dev->lna_gain);
-@@ -5271,7 +5558,8 @@ static inline void rt2800_set_vgc(struct
- {
- if (qual->vgc_level != vgc_level) {
- if (rt2x00_rt(rt2x00dev, RT3572) ||
-- rt2x00_rt(rt2x00dev, RT3593)) {
-+ rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883)) {
- rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
- vgc_level);
- } else if (rt2x00_rt(rt2x00dev, RT5592)) {
-@@ -5318,6 +5606,11 @@ void rt2800_link_tuner(struct rt2x00_dev
- }
- break;
-
-+ case RT3883:
-+ if (qual->rssi > -65)
-+ vgc += 0x10;
-+ break;
-+
- case RT5592:
- if (qual->rssi > -65)
- vgc += 0x20;
-@@ -5470,6 +5763,12 @@ static int rt2800_init_registers(struct
- rt2800_register_write(rt2x00dev, TX_SW_CFG2,
- 0x00000000);
- }
-+ } else if (rt2x00_rt(rt2x00dev, RT3883)) {
-+ rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000402);
-+ rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
-+ rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00040000);
-+ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21);
-+ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40);
- } else if (rt2x00_rt(rt2x00dev, RT5390) ||
- rt2x00_rt(rt2x00dev, RT5392) ||
- rt2x00_rt(rt2x00dev, RT6352)) {
-@@ -5683,6 +5982,11 @@ static int rt2800_init_registers(struct
- reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002;
- rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
-
-+ if (rt2x00_rt(rt2x00dev, RT3883)) {
-+ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_0, 0x12111008);
-+ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_1, 0x16151413);
-+ }
-+
- reg = rt2800_register_read(rt2x00dev, TX_RTS_CFG);
- rt2x00_set_field32(®, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 7);
- rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES,
-@@ -6299,6 +6603,47 @@ static void rt2800_init_bbp_3593(struct
- rt2800_bbp_write(rt2x00dev, 103, 0xc0);
- }
-
-+static void rt2800_init_bbp_3883(struct rt2x00_dev *rt2x00dev)
-+{
-+ rt2800_init_bbp_early(rt2x00dev);
-+
-+ rt2800_bbp_write(rt2x00dev, 4, 0x50);
-+ rt2800_bbp_write(rt2x00dev, 47, 0x48);
-+
-+ rt2800_bbp_write(rt2x00dev, 86, 0x46);
-+ rt2800_bbp_write(rt2x00dev, 88, 0x90);
-+
-+ rt2800_bbp_write(rt2x00dev, 92, 0x02);
-+
-+ rt2800_bbp_write(rt2x00dev, 103, 0xc0);
-+ rt2800_bbp_write(rt2x00dev, 104, 0x92);
-+ rt2800_bbp_write(rt2x00dev, 105, 0x34);
-+ rt2800_bbp_write(rt2x00dev, 106, 0x12);
-+ rt2800_bbp_write(rt2x00dev, 120, 0x50);
-+ rt2800_bbp_write(rt2x00dev, 137, 0x0f);
-+ rt2800_bbp_write(rt2x00dev, 163, 0x9d);
-+
-+ /* Set ITxBF timeout to 0x9C40=1000msec */
-+ rt2800_bbp_write(rt2x00dev, 179, 0x02);
-+ rt2800_bbp_write(rt2x00dev, 180, 0x00);
-+ rt2800_bbp_write(rt2x00dev, 182, 0x40);
-+ rt2800_bbp_write(rt2x00dev, 180, 0x01);
-+ rt2800_bbp_write(rt2x00dev, 182, 0x9c);
-+
-+ rt2800_bbp_write(rt2x00dev, 179, 0x00);
-+
-+ /* Reprogram the inband interface to put right values in RXWI */
-+ rt2800_bbp_write(rt2x00dev, 142, 0x04);
-+ rt2800_bbp_write(rt2x00dev, 143, 0x3b);
-+ rt2800_bbp_write(rt2x00dev, 142, 0x06);
-+ rt2800_bbp_write(rt2x00dev, 143, 0xa0);
-+ rt2800_bbp_write(rt2x00dev, 142, 0x07);
-+ rt2800_bbp_write(rt2x00dev, 143, 0xa1);
-+ rt2800_bbp_write(rt2x00dev, 142, 0x08);
-+ rt2800_bbp_write(rt2x00dev, 143, 0xa2);
-+ rt2800_bbp_write(rt2x00dev, 148, 0xc8);
-+}
-+
- static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev)
- {
- int ant, div_mode;
-@@ -6743,6 +7088,9 @@ static void rt2800_init_bbp(struct rt2x0
- case RT3593:
- rt2800_init_bbp_3593(rt2x00dev);
- return;
-+ case RT3883:
-+ rt2800_init_bbp_3883(rt2x00dev);
-+ return;
- case RT5390:
- case RT5392:
- rt2800_init_bbp_53xx(rt2x00dev);
-@@ -7614,6 +7962,144 @@ static void rt2800_init_rfcsr_5350(struc
- rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
- }
-
-+static void rt2800_init_rfcsr_3883(struct rt2x00_dev *rt2x00dev)
-+{
-+ u8 rfcsr;
-+
-+ /* TODO: get the actual ECO value from the SoC */
-+ const unsigned int eco = 5;
-+
-+ rt2800_rf_init_calibration(rt2x00dev, 2);
-+
-+ rt2800_rfcsr_write(rt2x00dev, 0, 0xe0);
-+ rt2800_rfcsr_write(rt2x00dev, 1, 0x03);
-+ rt2800_rfcsr_write(rt2x00dev, 2, 0x50);
-+ rt2800_rfcsr_write(rt2x00dev, 3, 0x20);
-+ rt2800_rfcsr_write(rt2x00dev, 4, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 5, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 6, 0x40);
-+ rt2800_rfcsr_write(rt2x00dev, 7, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 8, 0x5b);
-+ rt2800_rfcsr_write(rt2x00dev, 9, 0x08);
-+ rt2800_rfcsr_write(rt2x00dev, 10, 0xd3);
-+ rt2800_rfcsr_write(rt2x00dev, 11, 0x48);
-+ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a);
-+ rt2800_rfcsr_write(rt2x00dev, 13, 0x12);
-+ rt2800_rfcsr_write(rt2x00dev, 14, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 15, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 16, 0x00);
-+
-+ /* RFCSR 17 will be initialized later based on the
-+ * frequency offset stored in the EEPROM
-+ */
-+
-+ rt2800_rfcsr_write(rt2x00dev, 18, 0x40);
-+ rt2800_rfcsr_write(rt2x00dev, 19, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 20, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 21, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 22, 0x20);
-+ rt2800_rfcsr_write(rt2x00dev, 23, 0xc0);
-+ rt2800_rfcsr_write(rt2x00dev, 24, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 25, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 26, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 27, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 28, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 29, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 30, 0x10);
-+ rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
-+ rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
-+ rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 34, 0x20);
-+ rt2800_rfcsr_write(rt2x00dev, 35, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 36, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 37, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 38, 0x86);
-+ rt2800_rfcsr_write(rt2x00dev, 39, 0x23);
-+ rt2800_rfcsr_write(rt2x00dev, 40, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 41, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 42, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 44, 0x93);
-+ rt2800_rfcsr_write(rt2x00dev, 45, 0xbb);
-+ rt2800_rfcsr_write(rt2x00dev, 46, 0x60);
-+ rt2800_rfcsr_write(rt2x00dev, 47, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 48, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 49, 0x8e);
-+ rt2800_rfcsr_write(rt2x00dev, 50, 0x86);
-+ rt2800_rfcsr_write(rt2x00dev, 51, 0x51);
-+ rt2800_rfcsr_write(rt2x00dev, 52, 0x05);
-+ rt2800_rfcsr_write(rt2x00dev, 53, 0x76);
-+ rt2800_rfcsr_write(rt2x00dev, 54, 0x76);
-+ rt2800_rfcsr_write(rt2x00dev, 55, 0x76);
-+ rt2800_rfcsr_write(rt2x00dev, 56, 0xdb);
-+ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e);
-+ rt2800_rfcsr_write(rt2x00dev, 58, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
-+ rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
-+
-+ /* TODO: rx filter calibration? */
-+
-+ rt2800_bbp_write(rt2x00dev, 137, 0x0f);
-+
-+ rt2800_bbp_write(rt2x00dev, 163, 0x9d);
-+
-+ rt2800_bbp_write(rt2x00dev, 105, 0x05);
-+
-+ rt2800_bbp_write(rt2x00dev, 179, 0x02);
-+ rt2800_bbp_write(rt2x00dev, 180, 0x00);
-+ rt2800_bbp_write(rt2x00dev, 182, 0x40);
-+ rt2800_bbp_write(rt2x00dev, 180, 0x01);
-+ rt2800_bbp_write(rt2x00dev, 182, 0x9c);
-+
-+ rt2800_bbp_write(rt2x00dev, 179, 0x00);
-+
-+ rt2800_bbp_write(rt2x00dev, 142, 0x04);
-+ rt2800_bbp_write(rt2x00dev, 143, 0x3b);
-+ rt2800_bbp_write(rt2x00dev, 142, 0x06);
-+ rt2800_bbp_write(rt2x00dev, 143, 0xa0);
-+ rt2800_bbp_write(rt2x00dev, 142, 0x07);
-+ rt2800_bbp_write(rt2x00dev, 143, 0xa1);
-+ rt2800_bbp_write(rt2x00dev, 142, 0x08);
-+ rt2800_bbp_write(rt2x00dev, 143, 0xa2);
-+ rt2800_bbp_write(rt2x00dev, 148, 0xc8);
-+
-+ if (eco == 5) {
-+ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8);
-+ rt2800_rfcsr_write(rt2x00dev, 33, 0x32);
-+ }
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 2);
-+ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_BP, 0);
-+ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1);
-+ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr);
-+ msleep(1);
-+ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 0);
-+ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1);
-+ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1);
-+ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 6);
-+ rfcsr |= 0xc0;
-+ rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 22);
-+ rfcsr |= 0x20;
-+ rt2800_rfcsr_write(rt2x00dev, 22, rfcsr);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 46);
-+ rfcsr |= 0x20;
-+ rt2800_rfcsr_write(rt2x00dev, 46, rfcsr);
-+
-+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 20);
-+ rfcsr &= ~0xee;
-+ rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
-+}
-+
- static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
- {
- rt2800_rf_init_calibration(rt2x00dev, 2);
-@@ -8456,6 +8942,9 @@ static void rt2800_init_rfcsr(struct rt2
- case RT3390:
- rt2800_init_rfcsr_3390(rt2x00dev);
- break;
-+ case RT3883:
-+ rt2800_init_rfcsr_3883(rt2x00dev);
-+ break;
- case RT3572:
- rt2800_init_rfcsr_3572(rt2x00dev);
- break;
-@@ -8661,7 +9150,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
- {
- u16 word;
-
-- if (rt2x00_rt(rt2x00dev, RT3593))
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- return 0;
-
- word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG);
-@@ -8675,7 +9165,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
- {
- u16 word;
-
-- if (rt2x00_rt(rt2x00dev, RT3593))
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883))
- return 0;
-
- word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A);
-@@ -8781,7 +9272,8 @@ static int rt2800_validate_eeprom(struct
- word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
-- if (!rt2x00_rt(rt2x00dev, RT3593)) {
-+ if (!rt2x00_rt(rt2x00dev, RT3593) &&
-+ !rt2x00_rt(rt2x00dev, RT3883)) {
- if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
- rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
- rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
-@@ -8801,7 +9293,8 @@ static int rt2800_validate_eeprom(struct
- word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2);
- if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
- rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
-- if (!rt2x00_rt(rt2x00dev, RT3593)) {
-+ if (!rt2x00_rt(rt2x00dev, RT3593) &&
-+ !rt2x00_rt(rt2x00dev, RT3883)) {
- if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
- rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
- rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
-@@ -8809,7 +9302,8 @@ static int rt2800_validate_eeprom(struct
- }
- rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
-
-- if (rt2x00_rt(rt2x00dev, RT3593)) {
-+ if (rt2x00_rt(rt2x00dev, RT3593) ||
-+ rt2x00_rt(rt2x00dev, RT3883)) {
- word = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2);
- if (rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0x00 ||
- rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0xff)
-@@ -8848,6 +9342,8 @@ static int rt2800_init_eeprom(struct rt2
- rf = rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID);
- else if (rt2x00_rt(rt2x00dev, RT3352))
- rf = RF3322;
-+ else if (rt2x00_rt(rt2x00dev, RT3883))
-+ rf = RF3853;
- else if (rt2x00_rt(rt2x00dev, RT5350))
- rf = RF5350;
- else
-@@ -8868,6 +9364,7 @@ static int rt2800_init_eeprom(struct rt2
- case RF3290:
- case RF3320:
- case RF3322:
-+ case RF3853:
- case RF5350:
- case RF5360:
- case RF5362:
-@@ -9154,6 +9651,66 @@ static const struct rf_channel rf_vals_3
- {14, 0xF0, 2, 0x18},
- };
-
-+static const struct rf_channel rf_vals_3853[] = {
-+ {1, 241, 6, 2},
-+ {2, 241, 6, 7},
-+ {3, 242, 6, 2},
-+ {4, 242, 6, 7},
-+ {5, 243, 6, 2},
-+ {6, 243, 6, 7},
-+ {7, 244, 6, 2},
-+ {8, 244, 6, 7},
-+ {9, 245, 6, 2},
-+ {10, 245, 6, 7},
-+ {11, 246, 6, 2},
-+ {12, 246, 6, 7},
-+ {13, 247, 6, 2},
-+ {14, 248, 6, 4},
-+
-+ {36, 0x56, 8, 4},
-+ {38, 0x56, 8, 6},
-+ {40, 0x56, 8, 8},
-+ {44, 0x57, 8, 0},
-+ {46, 0x57, 8, 2},
-+ {48, 0x57, 8, 4},
-+ {52, 0x57, 8, 8},
-+ {54, 0x57, 8, 10},
-+ {56, 0x58, 8, 0},
-+ {60, 0x58, 8, 4},
-+ {62, 0x58, 8, 6},
-+ {64, 0x58, 8, 8},
-+
-+ {100, 0x5b, 8, 8},
-+ {102, 0x5b, 8, 10},
-+ {104, 0x5c, 8, 0},
-+ {108, 0x5c, 8, 4},
-+ {110, 0x5c, 8, 6},
-+ {112, 0x5c, 8, 8},
-+ {114, 0x5c, 8, 10},
-+ {116, 0x5d, 8, 0},
-+ {118, 0x5d, 8, 2},
-+ {120, 0x5d, 8, 4},
-+ {124, 0x5d, 8, 8},
-+ {126, 0x5d, 8, 10},
-+ {128, 0x5e, 8, 0},
-+ {132, 0x5e, 8, 4},
-+ {134, 0x5e, 8, 6},
-+ {136, 0x5e, 8, 8},
-+ {140, 0x5f, 8, 0},
-+
-+ {149, 0x5f, 8, 9},
-+ {151, 0x5f, 8, 11},
-+ {153, 0x60, 8, 1},
-+ {157, 0x60, 8, 5},
-+ {159, 0x60, 8, 7},
-+ {161, 0x60, 8, 9},
-+ {165, 0x61, 8, 1},
-+ {167, 0x61, 8, 3},
-+ {169, 0x61, 8, 5},
-+ {171, 0x61, 8, 7},
-+ {173, 0x61, 8, 9},
-+};
-+
- static const struct rf_channel rf_vals_5592_xtal20[] = {
- /* Channel, N, K, mod, R */
- {1, 482, 4, 10, 3},
-@@ -9417,6 +9974,11 @@ static int rt2800_probe_hw_mode(struct r
- spec->channels = rf_vals_3x;
- break;
-
-+ case RF3853:
-+ spec->num_channels = ARRAY_SIZE(rf_vals_3853);
-+ spec->channels = rf_vals_3853;
-+ break;
-+
- case RF5592:
- reg = rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX);
- if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) {
-@@ -9536,6 +10098,7 @@ static int rt2800_probe_hw_mode(struct r
- case RF3053:
- case RF3070:
- case RF3290:
-+ case RF3853:
- case RF5350:
- case RF5360:
- case RF5362:
-@@ -9578,6 +10141,7 @@ static int rt2800_probe_rt(struct rt2x00
- case RT3390:
- case RT3572:
- case RT3593:
-+ case RT3883:
- case RT5350:
- case RT5390:
- case RT5392:
---- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-@@ -51,9 +51,16 @@ static bool rt2800soc_hwcrypt_disabled(s
-
- static void rt2800soc_disable_radio(struct rt2x00_dev *rt2x00dev)
- {
-+ u32 reg;
-+
- rt2800_disable_radio(rt2x00dev);
- rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0);
-- rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, 0);
-+
-+ reg = 0;
-+ if (rt2x00_rt(rt2x00dev, RT3883))
-+ rt2x00_set_field32(®, TX_PIN_CFG_RFTR_EN, 1);
-+
-+ rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, reg);
- }
-
- static int rt2800soc_set_device_state(struct rt2x00_dev *rt2x00dev,
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
-@@ -225,36 +225,37 @@ config RT2800SOC
+@@ -226,36 +226,37 @@ config RT2800SOC
config RT2800_LIB
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
-@@ -210,7 +210,7 @@ endif
+@@ -211,7 +211,7 @@ endif
config RT2800SOC
tristate "Ralink WiSoC support"
depends on m
select RT2X00_LIB_SOC
select RT2X00_LIB_MMIO
select RT2X00_LIB_CRYPTO
-@@ -245,7 +245,7 @@ config RT2X00_LIB_PCI
+@@ -246,7 +246,7 @@ config RT2X00_LIB_PCI
config RT2X00_LIB_SOC
tristate "RT2x00 SoC support"
+#endif /* _RT2X00_PLATFORM_H */
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -40,6 +40,7 @@
+@@ -29,6 +29,7 @@
#include <linux/average.h>
#include <linux/usb.h>
#include <linux/clk.h>
--- a/local-symbols
+++ b/local-symbols
-@@ -309,6 +309,7 @@ RT2X00_LIB_FIRMWARE=
+@@ -311,6 +311,7 @@ RT2X00_LIB_FIRMWARE=
RT2X00_LIB_CRYPTO=
RT2X00_LIB_LEDS=
RT2X00_LIB_DEBUGFS=
RTL8180=
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
-@@ -69,6 +69,7 @@ config RT2800PCI
+@@ -70,6 +70,7 @@ config RT2800PCI
select RT2X00_LIB_MMIO
select RT2X00_LIB_PCI
select RT2X00_LIB_FIRMWARE
select RT2X00_LIB_CRYPTO
depends on CRC_CCITT
depends on EEPROM_93CX6
-@@ -215,6 +216,7 @@ config RT2800SOC
+@@ -216,6 +217,7 @@ config RT2800SOC
select RT2X00_LIB_MMIO
select RT2X00_LIB_CRYPTO
select RT2X00_LIB_FIRMWARE
select RT2800_LIB
select RT2800_LIB_MMIO
---help---
-@@ -265,6 +267,9 @@ config RT2X00_LIB_FIRMWARE
+@@ -266,6 +268,9 @@ config RT2X00_LIB_FIRMWARE
config RT2X00_LIB_CRYPTO
bool
obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -48,6 +48,8 @@ struct rt2800_drv_data {
+@@ -37,6 +37,8 @@ struct rt2800_drv_data {
struct ieee80211_sta *wcid_to_sta[STA_IDS_SIZE];
};
struct rt2800_ops {
u32 (*register_read)(struct rt2x00_dev *rt2x00dev,
const unsigned int offset);
-@@ -145,6 +147,15 @@ static inline int rt2800_read_eeprom(str
+@@ -134,6 +136,15 @@ static inline int rt2800_read_eeprom(str
{
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-@@ -102,19 +102,6 @@ static int rt2800soc_set_device_state(st
+@@ -90,19 +90,6 @@ static int rt2800soc_set_device_state(st
return retval;
}
/* Firmware functions */
static char *rt2800soc_get_firmware_name(struct rt2x00_dev *rt2x00dev)
{
-@@ -178,7 +165,6 @@ static const struct rt2800_ops rt2800soc
+@@ -166,7 +153,6 @@ static const struct rt2800_ops rt2800soc
.register_multiread = rt2x00mmio_register_multiread,
.register_multiwrite = rt2x00mmio_register_multiwrite,
.regbusy_read = rt2x00mmio_regbusy_read,
.drv_init_registers = rt2800mmio_init_registers,
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -702,6 +702,7 @@ enum rt2x00_capability_flags {
+@@ -691,6 +691,7 @@ enum rt2x00_capability_flags {
REQUIRE_HT_TX_DESC,
REQUIRE_PS_AUTOWAKE,
REQUIRE_DELAYED_RFKILL,
/*
* Capabilities
-@@ -977,6 +978,11 @@ struct rt2x00_dev {
+@@ -966,6 +967,11 @@ struct rt2x00_dev {
const struct firmware *fw;
/*
DECLARE_KFIFO_PTR(txstatus_fifo, u32);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1423,6 +1423,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
+@@ -1412,6 +1412,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
/*
* Let the driver probe the device to detect the capabilities.
*/
-@@ -1566,6 +1570,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
+@@ -1555,6 +1559,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
* Free the driver data.
*/
kfree(rt2x00dev->drv_data);
+}
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h
-@@ -297,6 +297,22 @@ static inline void rt2x00lib_free_firmwa
+@@ -286,6 +286,22 @@ static inline void rt2x00lib_free_firmwa
#endif /* CPTCFG_RT2X00_LIB_FIRMWARE */
/*
#ifdef CPTCFG_RT2X00_LIB_DEBUGFS
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
-@@ -97,6 +97,7 @@ int rt2x00soc_probe(struct platform_devi
+@@ -86,6 +86,7 @@ int rt2x00soc_probe(struct platform_devi
if (IS_ERR(rt2x00dev->clk))
rt2x00dev->clk = NULL;
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
-@@ -219,6 +219,7 @@ config RT2800SOC
+@@ -220,6 +220,7 @@ config RT2800SOC
select RT2X00_LIB_EEPROM
select RT2800_LIB
select RT2800_LIB_MMIO
#endif /* _RT2X00_PLATFORM_H */
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1026,6 +1026,22 @@ static int rt2x00lib_probe_hw_modes(stru
+@@ -1015,6 +1015,22 @@ static int rt2x00lib_probe_hw_modes(stru
unsigned int num_rates;
unsigned int i;
num_rates += 4;
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -409,6 +409,7 @@ struct hw_mode_spec {
+@@ -398,6 +398,7 @@ struct hw_mode_spec {
unsigned int supported_bands;
#define SUPPORT_BAND_2GHZ 0x00000001
#define SUPPORT_BAND_5GHZ 0x00000002
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1004,8 +1004,13 @@ static void rt2x00lib_rate(struct ieee80
+@@ -993,8 +993,13 @@ static void rt2x00lib_rate(struct ieee80
void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr)
{
+ ether_addr_copy(eeprom_mac_addr, pdata->mac_address);
+
mac_addr = of_get_mac_address(rt2x00dev->dev->of_node);
- if (mac_addr)
+ if (!IS_ERR(mac_addr))
ether_addr_copy(eeprom_mac_addr, mac_addr);
--- a/include/linux/rt2x00_platform.h
+++ b/include/linux/rt2x00_platform.h
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1030,6 +1030,16 @@ static int rt2x00lib_probe_hw_modes(stru
+@@ -1019,6 +1019,16 @@ static int rt2x00lib_probe_hw_modes(stru
struct ieee80211_rate *rates;
unsigned int num_rates;
unsigned int i;
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-@@ -232,10 +232,17 @@ static int rt2800soc_probe(struct platfo
+@@ -220,10 +220,17 @@ static int rt2800soc_probe(struct platfo
return rt2x00soc_probe(pdev, &rt2800soc_ops);
}
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -36,6 +36,7 @@
+@@ -25,6 +25,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include "rt2x00.h"
#include "rt2800lib.h"
-@@ -9458,6 +9459,17 @@ static int rt2800_init_eeprom(struct rt2
+@@ -9447,6 +9448,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);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
-@@ -109,6 +109,9 @@ static int rt2x00leds_register_led(struc
+@@ -98,6 +98,9 @@ static int rt2x00leds_register_led(struc
led->led_dev.name = name;
led->led_dev.brightness = LED_OFF;
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1361,7 +1361,7 @@ static inline void rt2x00lib_set_if_comb
+@@ -1350,7 +1350,7 @@ static inline void rt2x00lib_set_if_comb
*/
if_limit = &rt2x00dev->if_limits_ap;
if_limit->max = rt2x00dev->ops->max_ap_intf;
--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
-@@ -2750,6 +2750,7 @@ enum rt2800_eeprom_word {
+@@ -2739,6 +2739,7 @@ enum rt2800_eeprom_word {
#define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f)
#define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0)
#define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600)
* EEPROM LNA
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -4290,6 +4290,45 @@ static void rt2800_config_channel(struct
+@@ -4279,6 +4279,45 @@ static void rt2800_config_channel(struct
rt2800_iq_calibrate(rt2x00dev, rf->channel);
}
bbp = rt2800_bbp_read(rt2x00dev, 4);
rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
rt2800_bbp_write(rt2x00dev, 4, bbp);
-@@ -9487,7 +9526,8 @@ static int rt2800_init_eeprom(struct rt2
+@@ -9476,7 +9515,8 @@ static int rt2800_init_eeprom(struct rt2
*/
eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1);
if (rt2x00_get_field16(eeprom,
EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
__set_bit(CAPABILITY_EXTERNAL_PA_TX0,
-@@ -9498,6 +9538,18 @@ static int rt2800_init_eeprom(struct rt2
+@@ -9487,6 +9527,18 @@ static int rt2800_init_eeprom(struct rt2
&rt2x00dev->cap_flags);
}
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -8349,6 +8349,58 @@ static void rt2800_init_rfcsr_5592(struc
+@@ -8338,6 +8338,58 @@ static void rt2800_init_rfcsr_5592(struc
rt2800_led_open_drain_enable(rt2x00dev);
}
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
bool set_bw, bool is_ht40)
{
-@@ -8956,6 +9008,7 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -8945,6 +8997,7 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
}
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -243,6 +243,7 @@ void rt2800_link_tuner(struct rt2x00_dev
+@@ -232,6 +232,7 @@ void rt2800_link_tuner(struct rt2x00_dev
const u32 count);
void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -572,6 +572,7 @@ struct rt2x00lib_ops {
+@@ -561,6 +561,7 @@ struct rt2x00lib_ops {
struct link_qual *qual, const u32 count);
void (*gain_calibration) (struct rt2x00_dev *rt2x00dev);
void (*vco_calibration) (struct rt2x00_dev *rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -8401,6 +8401,160 @@ void rt2800_rf_self_txdc_cal(struct rt2x
+@@ -8390,6 +8390,160 @@ void rt2800_rf_self_txdc_cal(struct rt2x
}
EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal);
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
bool set_bw, bool is_ht40)
{
-@@ -9008,6 +9162,7 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -8997,6 +9151,7 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
rt2800_bw_filter_calibration(rt2x00dev, false);
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -244,6 +244,8 @@ void rt2800_link_tuner(struct rt2x00_dev
+@@ -233,6 +233,8 @@ void rt2800_link_tuner(struct rt2x00_dev
void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev);
void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -573,6 +573,8 @@ struct rt2x00lib_ops {
+@@ -562,6 +562,8 @@ struct rt2x00lib_ops {
void (*gain_calibration) (struct rt2x00_dev *rt2x00dev);
void (*vco_calibration) (struct rt2x00_dev *rt2x00dev);
void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -8555,6 +8555,71 @@ void rt2800_r_calibration(struct rt2x00_
+@@ -8544,6 +8544,71 @@ void rt2800_r_calibration(struct rt2x00_
}
EXPORT_SYMBOL_GPL(rt2800_r_calibration);
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
bool set_bw, bool is_ht40)
{
-@@ -9164,6 +9229,7 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -9153,6 +9218,7 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_r_calibration(rt2x00dev);
rt2800_rf_self_txdc_cal(rt2x00dev);
}
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -246,6 +246,7 @@ void rt2800_vco_calibration(struct rt2x0
+@@ -235,6 +235,7 @@ void rt2800_vco_calibration(struct rt2x0
void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev);
int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2);
void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -575,6 +575,7 @@ struct rt2x00lib_ops {
+@@ -564,6 +564,7 @@ struct rt2x00lib_ops {
void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev);
int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2);
void (*r_calibration) (struct rt2x00_dev *rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -8620,6 +8620,386 @@ void rt2800_rxdcoc_calibration(struct rt
+@@ -8609,6 +8609,386 @@ void rt2800_rxdcoc_calibration(struct rt
}
EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration);
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
bool set_bw, bool is_ht40)
{
-@@ -9232,6 +9612,7 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -9221,6 +9601,7 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rxdcoc_calibration(rt2x00dev);
rt2800_bw_filter_calibration(rt2x00dev, true);
rt2800_bw_filter_calibration(rt2x00dev, false);
static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -247,6 +247,7 @@ void rt2800_rf_self_txdc_cal(struct rt2x
+@@ -236,6 +236,7 @@ void rt2800_rf_self_txdc_cal(struct rt2x
int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2);
void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -576,6 +576,7 @@ struct rt2x00lib_ops {
+@@ -565,6 +565,7 @@ struct rt2x00lib_ops {
int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2);
void (*r_calibration) (struct rt2x00_dev *rt2x00dev);
void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -9000,6 +9000,954 @@ restore_value:
+@@ -8989,6 +8989,954 @@ restore_value:
}
EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration);
static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
bool set_bw, bool is_ht40)
{
-@@ -9612,6 +10560,7 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -9601,6 +10549,7 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rxdcoc_calibration(rt2x00dev);
rt2800_bw_filter_calibration(rt2x00dev, true);
rt2800_bw_filter_calibration(rt2x00dev, false);
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -28,6 +28,16 @@
+@@ -17,6 +17,16 @@
#define WCID_START 33
#define WCID_END 222
#define STA_IDS_SIZE (WCID_END - WCID_START + 2)
/* RT2800 driver data structure */
struct rt2800_drv_data {
-@@ -248,6 +258,7 @@ int rt2800_calcrcalibrationcode(struct r
+@@ -237,6 +247,7 @@ int rt2800_calcrcalibrationcode(struct r
void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev);
void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -577,6 +577,7 @@ struct rt2x00lib_ops {
+@@ -566,6 +566,7 @@ struct rt2x00lib_ops {
void (*r_calibration) (struct rt2x00_dev *rt2x00dev);
void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev);
void (*rxiq_calibration) (struct rt2x00_dev *rt2x00dev);
ethtool.o \
--- a/net/mac80211/aead_api.c
+++ /dev/null
-@@ -1,115 +0,0 @@
+@@ -1,112 +0,0 @@
+-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright 2003-2004, Instant802 Networks, Inc.
- * Copyright 2005-2006, Devicescape Software, Inc.
- * Copyright 2014-2015, Qualcomm Atheros, Inc.
- *
- * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License version 2 as
-- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-}
--- a/net/mac80211/aead_api.h
+++ /dev/null
-@@ -1,27 +0,0 @@
--/*
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License version 2 as
-- * published by the Free Software Foundation.
-- */
+@@ -1,23 +0,0 @@
+-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef _AEAD_API_H
-#define _AEAD_API_H
-#endif /* _AEAD_API_H */
--- a/net/mac80211/aes_ccm.h
+++ b/net/mac80211/aes_ccm.h
-@@ -10,39 +10,17 @@
+@@ -7,39 +7,17 @@
#ifndef AES_CCM_H
#define AES_CCM_H
+}
--- a/net/mac80211/aes_gcm.h
+++ b/net/mac80211/aes_gcm.h
-@@ -9,38 +9,30 @@
+@@ -6,38 +6,30 @@
#ifndef AES_GCM_H
#define AES_GCM_H
#endif /* AES_GCM_H */
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
-@@ -314,7 +314,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
+@@ -311,7 +311,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
}
{
__le16 mask_fc;
int a4_included, mgmt;
-@@ -344,14 +345,8 @@ static void ccmp_special_blocks(struct s
+@@ -341,14 +342,8 @@ static void ccmp_special_blocks(struct s
else
qos_tid = 0;
/* Nonce: Nonce Flags | A2 | PN
* Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
-@@ -359,6 +354,8 @@ static void ccmp_special_blocks(struct s
+@@ -356,6 +351,8 @@ static void ccmp_special_blocks(struct s
b_0[1] = qos_tid | (mgmt << 4);
memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
/* AAD (extra authenticate-only data) / masked 802.11 header
* FC | A1 | A2 | A3 | SC | [A4] | [QC] */
-@@ -415,7 +412,7 @@ static int ccmp_encrypt_skb(struct ieee8
+@@ -412,7 +409,7 @@ static int ccmp_encrypt_skb(struct ieee8
u8 *pos;
u8 pn[6];
u64 pn64;
u8 b_0[AES_BLOCK_SIZE];
if (info->control.hw_key &&
-@@ -470,9 +467,11 @@ static int ccmp_encrypt_skb(struct ieee8
+@@ -467,9 +464,11 @@ static int ccmp_encrypt_skb(struct ieee8
return 0;
pos += IEEE80211_CCMP_HDR_LEN;
}
-@@ -545,13 +544,13 @@ ieee80211_crypto_ccmp_decrypt(struct iee
+@@ -542,13 +541,13 @@ ieee80211_crypto_ccmp_decrypt(struct iee
u8 aad[2 * AES_BLOCK_SIZE];
u8 b_0[AES_BLOCK_SIZE];
/* hardware didn't decrypt/verify MIC */
return RX_DROP_UNUSABLE;
}
-@@ -646,7 +645,7 @@ static int gcmp_encrypt_skb(struct ieee8
+@@ -643,7 +642,7 @@ static int gcmp_encrypt_skb(struct ieee8
u8 *pos;
u8 pn[6];
u64 pn64;
u8 j_0[AES_BLOCK_SIZE];
if (info->control.hw_key &&
-@@ -703,8 +702,10 @@ static int gcmp_encrypt_skb(struct ieee8
+@@ -700,8 +699,10 @@ static int gcmp_encrypt_skb(struct ieee8
pos += IEEE80211_GCMP_HDR_LEN;
gcmp_special_blocks(skb, pn, j_0, aad);
}
ieee80211_tx_result
-@@ -1127,9 +1128,9 @@ ieee80211_crypto_aes_gmac_encrypt(struct
+@@ -1124,9 +1125,9 @@ ieee80211_crypto_aes_gmac_encrypt(struct
struct ieee80211_key *key = tx->key;
struct ieee80211_mmie_16 *mmie;
struct ieee80211_hdr *hdr;
if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
return TX_DROP;
-@@ -1175,7 +1176,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct
+@@ -1172,7 +1173,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct ieee80211_key *key = rx->key;
struct ieee80211_mmie_16 *mmie;
+}
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
-@@ -5,8 +5,6 @@ config MAC80211
+@@ -6,8 +6,6 @@ config MAC80211
depends on CRYPTO
depends on CRYPTO_ARC4
depends on CRYPTO_AES
---help---
--- a/net/mac80211/aes_gmac.h
+++ b/net/mac80211/aes_gmac.h
-@@ -15,10 +15,22 @@
+@@ -12,10 +12,22 @@
#define GMAC_MIC_LEN 16
#define GMAC_NONCE_LEN 12
#endif /* AES_GMAC_H */
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
-@@ -88,7 +88,7 @@ struct ieee80211_key {
+@@ -86,7 +86,7 @@ struct ieee80211_key {
* Management frames.
*/
u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
-@@ -1127,7 +1127,6 @@ static int ieee80211_stop_ap(struct wiph
+@@ -1162,7 +1162,6 @@ static int ieee80211_stop_ap(struct wiph
sdata->vif.bss_conf.ftmr_params = NULL;
__sta_info_flush(sdata, true);
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
-@@ -24,18 +24,35 @@ static inline struct cfg80211_registered
+@@ -23,18 +23,35 @@ static inline struct cfg80211_registered
return container_of(dev, struct cfg80211_registered_device, wiphy.dev);
}
--- a/net/mac80211/fils_aead.h
+++ b/net/mac80211/fils_aead.h
-@@ -10,7 +10,7 @@
+@@ -7,7 +7,7 @@
#ifndef FILS_AEAD_H
#define FILS_AEAD_H
@@ -1,4 +1,4 @@
-#if LINUX_VERSION_IS_GEQ(4,3,0)
+#if 0 /* LINUX_VERSION_IS_GEQ(4,3,0) */
+ // SPDX-License-Identifier: GPL-2.0-only
/*
* FILS AEAD for (Re)Association Request/Response frames
- * Copyright 2016, Qualcomm Atheros, Inc.
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
-@@ -573,7 +573,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
+@@ -570,7 +570,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
NL80211_FEATURE_MAC_ON_CREATE |
NL80211_FEATURE_USERSPACE_MPM |
NL80211_FEATURE_FULL_AP_CLIENT_STATE;
--- a/net/mac80211/aes_cmac.c
+++ b/net/mac80211/aes_cmac.c
-@@ -22,50 +22,126 @@
+@@ -19,50 +19,126 @@
#define CMAC_TLEN_256 16 /* CMAC TLen = 128 bits (16 octets) */
#define AAD_LEN 20
}
--- a/net/mac80211/aes_cmac.h
+++ b/net/mac80211/aes_cmac.h
-@@ -10,14 +10,13 @@
+@@ -7,14 +7,13 @@
#define AES_CMAC_H
#include <linux/crypto.h>
#endif /* AES_CMAC_H */
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
-@@ -93,7 +93,7 @@ struct ieee80211_key {
+@@ -91,7 +91,7 @@ struct ieee80211_key {
} ccmp;
struct {
u8 rx_pn[IEEE80211_CMAC_PN_LEN];
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
-@@ -5,7 +5,6 @@ config MAC80211
+@@ -6,7 +6,6 @@ config MAC80211
depends on CRYPTO
depends on CRYPTO_ARC4
depends on CRYPTO_AES
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
-@@ -3982,6 +3982,12 @@ out:
+@@ -4012,6 +4012,12 @@ out:
netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
struct net_device *dev)
{
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
-@@ -316,7 +316,7 @@ void ieee80211_restart_hw(struct ieee802
+@@ -313,7 +313,7 @@ void ieee80211_restart_hw(struct ieee802
}
EXPORT_SYMBOL(ieee80211_restart_hw);
static int ieee80211_ifa_changed(struct notifier_block *nb,
unsigned long data, void *arg)
{
-@@ -375,7 +375,7 @@ static int ieee80211_ifa_changed(struct
+@@ -372,7 +372,7 @@ static int ieee80211_ifa_changed(struct
}
#endif
static int ieee80211_ifa6_changed(struct notifier_block *nb,
unsigned long data, void *arg)
{
-@@ -1256,14 +1256,14 @@ int ieee80211_register_hw(struct ieee802
+@@ -1269,14 +1269,14 @@ int ieee80211_register_hw(struct ieee802
rtnl_unlock();
local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
result = register_inet6addr_notifier(&local->ifa6_notifier);
if (result)
-@@ -1272,13 +1272,13 @@ int ieee80211_register_hw(struct ieee802
+@@ -1285,13 +1285,13 @@ int ieee80211_register_hw(struct ieee802
return 0;
fail_ifa:
#endif
rtnl_lock();
-@@ -1307,10 +1307,10 @@ void ieee80211_unregister_hw(struct ieee
+@@ -1320,10 +1320,10 @@ void ieee80211_unregister_hw(struct ieee
tasklet_kill(&local->tx_pending_tasklet);
tasklet_kill(&local->tasklet);
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
-@@ -2268,7 +2268,7 @@ static int ieee80211_scan(struct wiphy *
+@@ -2312,7 +2312,7 @@ static int ieee80211_scan(struct wiphy *
* the frames sent while scanning on other channel will be
* lost)
*/
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
-@@ -179,6 +179,7 @@ struct ieee80211_tx_data {
+@@ -176,6 +176,7 @@ struct ieee80211_tx_data {
struct ieee80211_tx_rate rate;
unsigned int flags;
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
-@@ -925,7 +925,7 @@ ieee80211_tx_h_fragment(struct ieee80211
+@@ -921,7 +921,7 @@ ieee80211_tx_h_fragment(struct ieee80211
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *hdr = (void *)skb->data;
int frag_threshold = tx->local->hw.wiphy->frag_threshold;
int fragnum;
/* no matter what happens, tx->skb moves to tx->skbs */
-@@ -946,8 +946,6 @@ ieee80211_tx_h_fragment(struct ieee80211
+@@ -942,8 +942,6 @@ ieee80211_tx_h_fragment(struct ieee80211
if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
return TX_DROP;
/* internal error, why isn't DONTFRAG set? */
if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
return TX_DROP;
-@@ -1178,6 +1176,8 @@ ieee80211_tx_prepare(struct ieee80211_su
+@@ -1174,6 +1172,8 @@ ieee80211_tx_prepare(struct ieee80211_su
hdr = (struct ieee80211_hdr *) skb->data;
if (likely(sta)) {
if (!IS_ERR(sta))
tx->sta = sta;
-@@ -3562,6 +3562,7 @@ begin:
+@@ -3577,6 +3577,7 @@ begin:
tx.local = local;
tx.skb = skb;
tx.sdata = vif_to_sdata(info->control.vif);
if (txq->sta)
tx.sta = container_of(txq->sta, struct sta_info, sta);
-@@ -3588,7 +3589,7 @@ begin:
+@@ -3603,7 +3604,7 @@ begin:
if (tx.key &&
(tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV))
ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs,
tx.key, skb);
-@@ -4028,6 +4029,7 @@ ieee80211_build_data_template(struct iee
+@@ -4058,6 +4059,7 @@ ieee80211_build_data_template(struct iee
hdr = (void *)skb->data;
tx.sta = sta_info_get(sdata, hdr->addr1);
tx.skb = skb;
rcu_read_unlock();
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
-@@ -1503,6 +1503,7 @@ void ieee80211_send_auth(struct ieee8021
+@@ -1538,6 +1538,7 @@ void ieee80211_send_auth(struct ieee8021
struct ieee80211_local *local = sdata->local;
struct sk_buff *skb;
struct ieee80211_mgmt *mgmt;
int err;
/* 24 + 6 = header + auth_algo + auth_transaction + status_code */
-@@ -1526,8 +1527,10 @@ void ieee80211_send_auth(struct ieee8021
+@@ -1561,8 +1562,10 @@ void ieee80211_send_auth(struct ieee8021
skb_put_data(skb, extra, extra_len);
if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
-@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct
+@@ -86,11 +86,11 @@ static void ieee80211_wep_get_iv(struct
static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
struct sk_buff *skb,
u8 *newhdr;
hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
-@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i
+@@ -98,7 +98,6 @@ static u8 *ieee80211_wep_add_iv(struct i
if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
return NULL;
newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN);
memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen);
-@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr
+@@ -157,6 +156,7 @@ int ieee80211_wep_encrypt_data(struct cr
*/
int ieee80211_wep_encrypt(struct ieee80211_local *local,
struct sk_buff *skb,
const u8 *key, int keylen, int keyidx)
{
u8 *iv;
-@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802
+@@ -166,7 +166,7 @@ int ieee80211_wep_encrypt(struct ieee802
if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
return -1;
if (!iv)
return -1;
-@@ -307,13 +307,14 @@ static int wep_encrypt_skb(struct ieee80
+@@ -304,13 +304,14 @@ static int wep_encrypt_skb(struct ieee80
struct ieee80211_key_conf *hw_key = info->control.hw_key;
if (!hw_key) {
return -1;
--- a/net/mac80211/wep.h
+++ b/net/mac80211/wep.h
-@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr
+@@ -19,6 +19,7 @@ int ieee80211_wep_encrypt_data(struct cr
size_t klen, u8 *data, size_t data_len);
int ieee80211_wep_encrypt(struct ieee80211_local *local,
struct sk_buff *skb,
size_t klen, u8 *data, size_t data_len);
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
-@@ -44,7 +44,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
+@@ -41,7 +41,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
return TX_CONTINUE;
if (skb->len < hdrlen)
return TX_DROP;
-@@ -195,7 +195,6 @@ mic_fail_no_key:
+@@ -192,7 +192,6 @@ mic_fail_no_key:
static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
{
struct ieee80211_key *key = tx->key;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
unsigned int hdrlen;
-@@ -210,7 +209,7 @@ static int tkip_encrypt_skb(struct ieee8
+@@ -207,7 +206,7 @@ static int tkip_encrypt_skb(struct ieee8
return 0;
}
len = skb->len - hdrlen;
if (info->control.hw_key)
-@@ -428,7 +427,7 @@ static int ccmp_encrypt_skb(struct ieee8
+@@ -425,7 +424,7 @@ static int ccmp_encrypt_skb(struct ieee8
return 0;
}
len = skb->len - hdrlen;
if (info->control.hw_key)
-@@ -660,7 +659,7 @@ static int gcmp_encrypt_skb(struct ieee8
+@@ -657,7 +656,7 @@ static int gcmp_encrypt_skb(struct ieee8
return 0;
}
len = skb->len - hdrlen;
if (info->control.hw_key)
-@@ -800,7 +799,6 @@ static ieee80211_tx_result
+@@ -797,7 +796,6 @@ static ieee80211_tx_result
ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
struct sk_buff *skb)
{
struct ieee80211_key *key = tx->key;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
int hdrlen;
-@@ -816,8 +814,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
+@@ -813,8 +811,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
return TX_DROP;
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
-@@ -2243,6 +2243,9 @@ struct ieee80211_txq {
- * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID
- * only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set.
+@@ -2266,6 +2266,9 @@ struct ieee80211_txq {
+ * @IEEE80211_HW_EXT_KEY_ID_NATIVE: Driver and hardware are supporting Extended
+ * Key ID and can handle two unicast keys per station for Rx and Tx.
*
+ * @IEEE80211_HW_TX_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
+ * Padding will be added after ieee80211_hdr, before IV/LLC.
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
*/
enum ieee80211_hw_flags {
-@@ -2294,6 +2297,7 @@ enum ieee80211_hw_flags {
- IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
+@@ -2318,6 +2321,7 @@ enum ieee80211_hw_flags {
IEEE80211_HW_SUPPORTS_MULTI_BSSID,
IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
+ IEEE80211_HW_EXT_KEY_ID_NATIVE,
+ IEEE80211_HW_TX_NEEDS_ALIGNED4_SKBS,
/* keep last, obviously */
NUM_IEEE80211_HW_FLAGS
-@@ -2587,6 +2591,40 @@ ieee80211_get_alt_retry_rate(const struc
+@@ -2611,6 +2615,40 @@ ieee80211_get_alt_retry_rate(const struc
void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
/**
* mac80211 is capable of taking advantage of many hardware
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
-@@ -1871,6 +1871,10 @@ int ieee80211_if_add(struct ieee80211_lo
+@@ -1877,6 +1877,10 @@ int ieee80211_if_add(struct ieee80211_lo
+ 8 /* rfc1042/bridge tunnel */
- ETH_HLEN /* ethernet hard_header_len */
+ IEEE80211_ENCRYPT_HEADROOM;
ret = dev_alloc_name(ndev, ndev->name);
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
-@@ -105,13 +105,15 @@ void mesh_path_assign_nexthop(struct mes
+@@ -102,13 +102,15 @@ void mesh_path_assign_nexthop(struct mes
static void prepare_for_gate(struct sk_buff *skb, char *dst_addr,
struct mesh_path *gate_mpath)
{
if (!(mshdr->flags & MESH_FLAGS_AE)) {
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
-@@ -2668,7 +2668,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
+@@ -2673,7 +2673,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
struct ieee80211_local *local = rx->local;
struct ieee80211_sub_if_data *sdata = rx->sdata;
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
int tailroom = 0;
hdr = (struct ieee80211_hdr *) skb->data;
-@@ -2761,7 +2761,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
+@@ -2766,7 +2766,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
if (sdata->crypto_tx_tailroom_needed_cnt)
tailroom = IEEE80211_ENCRYPT_TAILROOM;
sdata->encrypt_headroom,
tailroom, GFP_ATOMIC);
if (!fwd_skb)
-@@ -2793,6 +2795,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
+@@ -2798,6 +2800,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
return RX_DROP_MONITOR;
}
out:
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
-@@ -311,7 +311,7 @@ struct ieee80211_fast_tx {
+@@ -308,7 +308,7 @@ struct ieee80211_fast_tx {
u8 hdr_len;
u8 sa_offs, da_offs, pn_offs;
u8 band;
struct rcu_head rcu_head;
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
-@@ -515,6 +515,7 @@ static void ieee80211_report_used_skb(st
+@@ -512,6 +512,7 @@ static void ieee80211_report_used_skb(st
{
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *hdr = (void *)skb->data;
bool acked = info->flags & IEEE80211_TX_STAT_ACK;
if (dropped)
-@@ -531,7 +532,7 @@ static void ieee80211_report_used_skb(st
+@@ -528,7 +529,7 @@ static void ieee80211_report_used_skb(st
skb->dev = NULL;
} else {
unsigned int hdr_size =
/* Check to see if packet is a TDLS teardown packet */
if (ieee80211_is_data(hdr->frame_control) &&
-@@ -655,9 +656,22 @@ void ieee80211_tx_monitor(struct ieee802
+@@ -652,9 +653,22 @@ void ieee80211_tx_monitor(struct ieee802
struct sk_buff *skb2;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_sub_if_data *sdata;
if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
-@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8
+@@ -198,10 +198,12 @@ void ieee80211_get_tkip_p2k(struct ieee8
{
struct ieee80211_key *key = (struct ieee80211_key *)
container_of(keyconf, struct ieee80211_key, conf);
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
-@@ -1175,8 +1175,7 @@ ieee80211_tx_prepare(struct ieee80211_su
+@@ -1171,8 +1171,7 @@ ieee80211_tx_prepare(struct ieee80211_su
info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
hdr = (struct ieee80211_hdr *) skb->data;
if (likely(sta)) {
if (!IS_ERR(sta))
-@@ -2247,7 +2246,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
+@@ -2244,7 +2243,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
goto fail;
hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
if (skb->len < len_rthdr + hdrlen)
goto fail;
-@@ -2465,7 +2464,7 @@ static struct sk_buff *ieee80211_build_h
+@@ -2463,7 +2462,7 @@ static struct sk_buff *ieee80211_build_h
struct ieee80211_chanctx_conf *chanctx_conf;
struct ieee80211_sub_if_data *ap_sdata;
enum nl80211_band band;
if (IS_ERR(sta))
sta = NULL;
-@@ -2764,7 +2763,9 @@ static struct sk_buff *ieee80211_build_h
+@@ -2774,7 +2773,9 @@ static struct sk_buff *ieee80211_build_h
}
skb_pull(skb, skip_header_bytes);
/*
* So we need to modify the skb header and hence need a copy of
-@@ -2797,6 +2798,9 @@ static struct sk_buff *ieee80211_build_h
+@@ -2807,6 +2808,9 @@ static struct sk_buff *ieee80211_build_h
memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen);
#endif
if (ieee80211_is_data_qos(fc)) {
__le16 *qos_control;
-@@ -2972,6 +2976,8 @@ void ieee80211_check_fast_xmit(struct st
+@@ -2983,6 +2987,8 @@ void ieee80211_check_fast_xmit(struct st
fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
}
/* We store the key here so there's no point in using rcu_dereference()
* but that's fine because the code that changes the pointers will call
* this function after doing so. For a single CPU that would be enough,
-@@ -3562,7 +3568,7 @@ begin:
+@@ -3577,7 +3583,7 @@ begin:
tx.local = local;
tx.skb = skb;
tx.sdata = vif_to_sdata(info->control.vif);
if (txq->sta)
tx.sta = container_of(txq->sta, struct sta_info, sta);
-@@ -4029,7 +4035,7 @@ ieee80211_build_data_template(struct iee
+@@ -4059,7 +4065,7 @@ ieee80211_build_data_template(struct iee
hdr = (void *)skb->data;
tx.sta = sta_info_get(sdata, hdr->addr1);
tx.skb = skb;
rcu_read_unlock();
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
-@@ -221,6 +221,7 @@ static const char *hw_flag_names[] = {
- FLAG(TX_STATUS_NO_AMPDU_LEN),
+@@ -272,6 +272,7 @@ static const char *hw_flag_names[] = {
FLAG(SUPPORTS_MULTI_BSSID),
FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID),
+ FLAG(EXT_KEY_ID_NATIVE),
+ FLAG(TX_NEEDS_ALIGNED4_SKBS),
#undef FLAG
};
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sat, 16 Mar 2019 17:43:58 +0100
-Subject: [PATCH] mac80211: mesh: drop redundant rcu_read_lock/unlock calls
-
-The callers of these functions are all within RCU locked sections
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/mesh_hwmp.c
-+++ b/net/mac80211/mesh_hwmp.c
-@@ -1130,16 +1130,13 @@ int mesh_nexthop_resolve(struct ieee8021
- struct mesh_path *mpath;
- struct sk_buff *skb_to_free = NULL;
- u8 *target_addr = hdr->addr3;
-- int err = 0;
-
- /* Nulls are only sent to peers for PS and should be pre-addressed */
- if (ieee80211_is_qos_nullfunc(hdr->frame_control))
- return 0;
-
-- rcu_read_lock();
-- err = mesh_nexthop_lookup(sdata, skb);
-- if (!err)
-- goto endlookup;
-+ if (!mesh_nexthop_lookup(sdata, skb))
-+ return 0;
-
- /* no nexthop found, start resolving */
- mpath = mesh_path_lookup(sdata, target_addr);
-@@ -1147,8 +1144,7 @@ int mesh_nexthop_resolve(struct ieee8021
- mpath = mesh_path_add(sdata, target_addr);
- if (IS_ERR(mpath)) {
- mesh_path_discard_frame(sdata, skb);
-- err = PTR_ERR(mpath);
-- goto endlookup;
-+ return PTR_ERR(mpath);
- }
- }
-
-@@ -1161,13 +1157,10 @@ int mesh_nexthop_resolve(struct ieee8021
- info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
- ieee80211_set_qos_hdr(sdata, skb);
- skb_queue_tail(&mpath->frame_queue, skb);
-- err = -ENOENT;
- if (skb_to_free)
- mesh_path_discard_frame(sdata, skb_to_free);
-
--endlookup:
-- rcu_read_unlock();
-- return err;
-+ return -ENOENT;
- }
-
- /**
-@@ -1187,13 +1180,10 @@ int mesh_nexthop_lookup(struct ieee80211
- struct sta_info *next_hop;
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
- u8 *target_addr = hdr->addr3;
-- int err = -ENOENT;
-
-- rcu_read_lock();
- mpath = mesh_path_lookup(sdata, target_addr);
--
- if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE))
-- goto endlookup;
-+ return -ENOENT;
-
- if (time_after(jiffies,
- mpath->exp_time -
-@@ -1208,12 +1198,10 @@ int mesh_nexthop_lookup(struct ieee80211
- memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN);
- memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
- ieee80211_mps_set_frame_flags(sdata, next_hop, hdr);
-- err = 0;
-+ return 0;
- }
-
--endlookup:
-- rcu_read_unlock();
-- return err;
-+ return -ENOENT;
- }
-
- void mesh_path_timer(struct timer_list *t)
---- a/net/mac80211/mesh_pathtbl.c
-+++ b/net/mac80211/mesh_pathtbl.c
-@@ -219,7 +219,7 @@ static struct mesh_path *mpath_lookup(st
- {
- struct mesh_path *mpath;
-
-- mpath = rhashtable_lookup_fast(&tbl->rhead, dst, mesh_rht_params);
-+ mpath = rhashtable_lookup(&tbl->rhead, dst, mesh_rht_params);
-
- if (mpath && mpath_expired(mpath)) {
- spin_lock_bh(&mpath->state_lock);
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sat, 16 Mar 2019 17:57:38 +0100
-Subject: [PATCH] mac80211: calculate hash for fq without holding fq->lock
- in itxq enqueue
-
-Reduces lock contention on enqueue/dequeue of iTXQ packets
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/include/net/fq_impl.h
-+++ b/include/net/fq_impl.h
-@@ -107,21 +107,23 @@ begin:
- return skb;
- }
-
-+static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)
-+{
-+ u32 hash = skb_get_hash_perturb(skb, fq->perturbation);
-+
-+ return reciprocal_scale(hash, fq->flows_cnt);
-+}
-+
- static struct fq_flow *fq_flow_classify(struct fq *fq,
-- struct fq_tin *tin,
-+ struct fq_tin *tin, u32 idx,
- struct sk_buff *skb,
- fq_flow_get_default_t get_default_func)
- {
- struct fq_flow *flow;
-- u32 hash;
-- u32 idx;
-
- lockdep_assert_held(&fq->lock);
-
-- hash = skb_get_hash_perturb(skb, fq->perturbation);
-- idx = reciprocal_scale(hash, fq->flows_cnt);
- flow = &fq->flows[idx];
--
- if (flow->tin && flow->tin != tin) {
- flow = get_default_func(fq, tin, idx, skb);
- tin->collisions++;
-@@ -153,7 +155,7 @@ static void fq_recalc_backlog(struct fq
- }
-
- static void fq_tin_enqueue(struct fq *fq,
-- struct fq_tin *tin,
-+ struct fq_tin *tin, u32 idx,
- struct sk_buff *skb,
- fq_skb_free_t free_func,
- fq_flow_get_default_t get_default_func)
-@@ -163,7 +165,7 @@ static void fq_tin_enqueue(struct fq *fq
-
- lockdep_assert_held(&fq->lock);
-
-- flow = fq_flow_classify(fq, tin, skb, get_default_func);
-+ flow = fq_flow_classify(fq, tin, idx, skb, get_default_func);
-
- flow->tin = tin;
- flow->backlog += skb->len;
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -1398,11 +1398,15 @@ static void ieee80211_txq_enqueue(struct
- {
- struct fq *fq = &local->fq;
- struct fq_tin *tin = &txqi->tin;
-+ u32 flow_idx = fq_flow_idx(fq, skb);
-
- ieee80211_set_skb_enqueue_time(skb);
-- fq_tin_enqueue(fq, tin, skb,
-+
-+ spin_lock_bh(&fq->lock);
-+ fq_tin_enqueue(fq, tin, flow_idx, skb,
- fq_skb_free_func,
- fq_flow_get_default_func);
-+ spin_unlock_bh(&fq->lock);
- }
-
- static bool fq_vlan_filter_func(struct fq *fq, struct fq_tin *tin,
-@@ -1589,7 +1593,6 @@ static bool ieee80211_queue_skb(struct i
- struct sta_info *sta,
- struct sk_buff *skb)
- {
-- struct fq *fq = &local->fq;
- struct ieee80211_vif *vif;
- struct txq_info *txqi;
-
-@@ -1607,9 +1610,7 @@ static bool ieee80211_queue_skb(struct i
- if (!txqi)
- return false;
-
-- spin_lock_bh(&fq->lock);
- ieee80211_txq_enqueue(local, txqi, skb);
-- spin_unlock_bh(&fq->lock);
-
- schedule_and_wake_txq(local, txqi);
-
-@@ -3227,6 +3228,7 @@ static bool ieee80211_amsdu_aggregate(st
- u8 max_subframes = sta->sta.max_amsdu_subframes;
- int max_frags = local->hw.max_tx_fragments;
- int max_amsdu_len = sta->sta.max_amsdu_len;
-+ u32 flow_idx;
- int orig_truesize;
- __be16 len;
- void *data;
-@@ -3256,6 +3258,8 @@ static bool ieee80211_amsdu_aggregate(st
- max_amsdu_len = min_t(int, max_amsdu_len,
- sta->sta.max_tid_amsdu_len[tid]);
-
-+ flow_idx = fq_flow_idx(fq, skb);
-+
- spin_lock_bh(&fq->lock);
-
- /* TODO: Ideally aggregation should be done on dequeue to remain
-@@ -3263,7 +3267,8 @@ static bool ieee80211_amsdu_aggregate(st
- */
-
- tin = &txqi->tin;
-- flow = fq_flow_classify(fq, tin, skb, fq_flow_get_default_func);
-+ flow = fq_flow_classify(fq, tin, flow_idx, skb,
-+ fq_flow_get_default_func);
- head = skb_peek_tail(&flow->queue);
- if (!head || skb_is_gso(head))
- goto out;
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sat, 16 Mar 2019 18:00:12 +0100
-Subject: [PATCH] mac80211: run late dequeue late tx handlers without
- holding fq->lock
-
-Reduces lock contention on enqueue/dequeue of iTXQ packets
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -3544,6 +3544,7 @@ struct sk_buff *ieee80211_tx_dequeue(str
- ieee80211_tx_result r;
- struct ieee80211_vif *vif = txq->vif;
-
-+begin:
- spin_lock_bh(&fq->lock);
-
- if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ||
-@@ -3560,11 +3561,12 @@ struct sk_buff *ieee80211_tx_dequeue(str
- if (skb)
- goto out;
-
--begin:
- skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func);
- if (!skb)
- goto out;
-
-+ spin_unlock_bh(&fq->lock);
-+
- hdr = (struct ieee80211_hdr *)skb->data;
- info = IEEE80211_SKB_CB(skb);
-
-@@ -3610,8 +3612,11 @@ begin:
-
- skb = __skb_dequeue(&tx.skbs);
-
-- if (!skb_queue_empty(&tx.skbs))
-+ if (!skb_queue_empty(&tx.skbs)) {
-+ spin_lock_bh(&fq->lock);
- skb_queue_splice_tail(&tx.skbs, &txqi->frags);
-+ spin_unlock_bh(&fq->lock);
-+ }
- }
-
- if (skb_has_frag_list(skb) &&
-@@ -3650,6 +3655,7 @@ begin:
- }
-
- IEEE80211_SKB_CB(skb)->control.vif = vif;
-+ return skb;
-
- out:
- spin_unlock_bh(&fq->lock);
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sat, 16 Mar 2019 18:01:53 +0100
-Subject: [PATCH] mac80211: set NETIF_F_LLTX when using intermediate tx
- queues
-
-When using iTXQ, tx sequence number allocation and statistics are run at
-dequeue time. Because of that, it is safe to enable NETIF_F_LLTX, which
-allows tx handlers to run on multiple CPUs in parallel.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -1301,6 +1301,7 @@ static void ieee80211_if_setup(struct ne
- static void ieee80211_if_setup_no_queue(struct net_device *dev)
- {
- ieee80211_if_setup(dev);
-+ dev->features |= NETIF_F_LLTX;
- #if LINUX_VERSION_IS_GEQ(4,3,0)
- dev->priv_flags |= IFF_NO_QUEUE;
- #else
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
-@@ -1780,6 +1780,9 @@ void ieee80211_clear_fast_xmit(struct st
- int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
- const u8 *buf, size_t len,
+@@ -1780,6 +1780,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);
+int ieee80211_skb_resize(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb, int hdrlen, int hdr_add);
void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
-@@ -672,6 +672,11 @@ void ieee80211_tx_monitor(struct ieee802
+@@ -669,6 +669,11 @@ void ieee80211_tx_monitor(struct ieee802
}
}
if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
-@@ -1939,37 +1939,53 @@ static bool ieee80211_tx(struct ieee8021
+@@ -1935,37 +1935,53 @@ static bool ieee80211_tx(struct ieee8021
}
/* device xmit handlers */
wiphy_debug(local->hw.wiphy,
"failed to reallocate TX buffer\n");
return -ENOMEM;
-@@ -1985,18 +2001,8 @@ void ieee80211_xmit(struct ieee80211_sub
+@@ -1981,18 +1997,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;
ieee80211_free_txskb(&local->hw, skb);
return;
}
-@@ -2765,30 +2771,14 @@ static struct sk_buff *ieee80211_build_h
+@@ -2774,30 +2780,14 @@ static struct sk_buff *ieee80211_build_h
skb_pull(skb, skip_header_bytes);
padsize = ieee80211_hdr_padsize(&local->hw, hdrlen);
}
if (encaps_data)
-@@ -3414,7 +3404,6 @@ static bool ieee80211_xmit_fast(struct i
+@@ -3417,7 +3407,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);
struct ethhdr eth;
struct ieee80211_tx_info *info;
struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
-@@ -3466,10 +3455,7 @@ static bool ieee80211_xmit_fast(struct i
+@@ -3469,10 +3458,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'
*/
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Fri, 22 Mar 2019 18:06:03 +0100
-Subject: [PATCH] mac80211: when using iTXQ, select the queue in
- ieee80211_subif_start_xmit
-
-When using iTXQ, the network stack does not need the real queue number, since
-mac80211 is using its internal queues anyway. In that case we can defer
-selecting the queue and remove a redundant station lookup in the tx path to save
-some CPU cycles.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -3790,6 +3790,7 @@ void __ieee80211_subif_start_xmit(struct
- u32 info_flags)
- {
- struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-+ struct ieee80211_local *local = sdata->local;
- struct sta_info *sta;
- struct sk_buff *next;
-
-@@ -3803,7 +3804,15 @@ void __ieee80211_subif_start_xmit(struct
- if (ieee80211_lookup_ra_sta(sdata, skb, &sta))
- goto out_free;
-
-- if (!IS_ERR_OR_NULL(sta)) {
-+ if (IS_ERR(sta))
-+ sta = NULL;
-+
-+ if (local->ops->wake_tx_queue) {
-+ u16 queue = __ieee80211_select_queue(sdata, sta, skb);
-+ skb_set_queue_mapping(skb, queue);
-+ }
-+
-+ if (sta) {
- struct ieee80211_fast_tx *fast_tx;
-
- sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
---- a/net/mac80211/wme.c
-+++ b/net/mac80211/wme.c
-@@ -141,6 +141,42 @@ u16 ieee80211_select_queue_80211(struct
- return ieee80211_downgrade_queue(sdata, NULL, skb);
- }
-
-+u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta, struct sk_buff *skb)
-+{
-+ struct mac80211_qos_map *qos_map;
-+ bool qos;
-+
-+ /* all mesh/ocb stations are required to support WME */
-+ if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
-+ sdata->vif.type == NL80211_IFTYPE_OCB)
-+ qos = true;
-+ else if (sta)
-+ qos = sta->sta.wme;
-+ else
-+ qos = false;
-+
-+ if (!qos) {
-+ skb->priority = 0; /* required for correct WPA/11i MIC */
-+ return IEEE80211_AC_BE;
-+ }
-+
-+ if (skb->protocol == sdata->control_port_protocol) {
-+ skb->priority = 7;
-+ goto downgrade;
-+ }
-+
-+ /* use the data classifier to determine what 802.1d tag the
-+ * data frame has */
-+ qos_map = rcu_dereference(sdata->qos_map);
-+ skb->priority = cfg80211_classify8021d(skb, qos_map ?
-+ &qos_map->qos_map : NULL);
-+
-+ downgrade:
-+ return ieee80211_downgrade_queue(sdata, sta, skb);
-+}
-+
-+
- /* Indicate which queue to use. */
- u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
- struct sk_buff *skb)
-@@ -148,10 +184,12 @@ u16 ieee80211_select_queue(struct ieee80
- struct ieee80211_local *local = sdata->local;
- struct sta_info *sta = NULL;
- const u8 *ra = NULL;
-- bool qos = false;
-- struct mac80211_qos_map *qos_map;
- u16 ret;
-
-+ /* when using iTXQ, we can do this later */
-+ if (local->ops->wake_tx_queue)
-+ return 0;
-+
- if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) {
- skb->priority = 0; /* required for correct WPA/11i MIC */
- return 0;
-@@ -161,10 +199,8 @@ u16 ieee80211_select_queue(struct ieee80
- switch (sdata->vif.type) {
- case NL80211_IFTYPE_AP_VLAN:
- sta = rcu_dereference(sdata->u.vlan.sta);
-- if (sta) {
-- qos = sta->sta.wme;
-+ if (sta)
- break;
-- }
- /* fall through */
- case NL80211_IFTYPE_AP:
- ra = skb->data;
-@@ -172,56 +208,26 @@ u16 ieee80211_select_queue(struct ieee80
- case NL80211_IFTYPE_WDS:
- ra = sdata->u.wds.remote_addr;
- break;
--#ifdef CPTCFG_MAC80211_MESH
-- case NL80211_IFTYPE_MESH_POINT:
-- qos = true;
-- break;
--#endif
- case NL80211_IFTYPE_STATION:
- /* might be a TDLS station */
- sta = sta_info_get(sdata, skb->data);
- if (sta)
-- qos = sta->sta.wme;
-+ break;
-
- ra = sdata->u.mgd.bssid;
- break;
- case NL80211_IFTYPE_ADHOC:
- ra = skb->data;
- break;
-- case NL80211_IFTYPE_OCB:
-- /* all stations are required to support WME */
-- qos = true;
-- break;
- default:
- break;
- }
-
-- if (!sta && ra && !is_multicast_ether_addr(ra)) {
-+ if (!sta && ra && !is_multicast_ether_addr(ra))
- sta = sta_info_get(sdata, ra);
-- if (sta)
-- qos = sta->sta.wme;
-- }
-
-- if (!qos) {
-- skb->priority = 0; /* required for correct WPA/11i MIC */
-- ret = IEEE80211_AC_BE;
-- goto out;
-- }
-+ ret = __ieee80211_select_queue(sdata, sta, skb);
-
-- if (skb->protocol == sdata->control_port_protocol) {
-- skb->priority = 7;
-- goto downgrade;
-- }
--
-- /* use the data classifier to determine what 802.1d tag the
-- * data frame has */
-- qos_map = rcu_dereference(sdata->qos_map);
-- skb->priority = cfg80211_classify8021d(skb, qos_map ?
-- &qos_map->qos_map : NULL);
--
-- downgrade:
-- ret = ieee80211_downgrade_queue(sdata, sta, skb);
-- out:
- rcu_read_unlock();
- return ret;
- }
---- a/net/mac80211/wme.h
-+++ b/net/mac80211/wme.h
-@@ -16,6 +16,8 @@
- u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata,
- struct sk_buff *skb,
- struct ieee80211_hdr *hdr);
-+u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta, struct sk_buff *skb);
- u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
- struct sk_buff *skb);
- void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Mon, 25 Mar 2019 09:02:13 +0100
-Subject: [PATCH] mac80211: minstrel_ht: add support for rates with 4
- spatial streams
-
-This is needed for the upcoming driver for MT7615 4x4 802.11ac chipsets
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/rc80211_minstrel_ht.c
-+++ b/net/mac80211/rc80211_minstrel_ht.c
-@@ -157,44 +157,54 @@ const struct mcs_group minstrel_mcs_grou
- MCS_GROUP(1, 0, BW_20, 5),
- MCS_GROUP(2, 0, BW_20, 4),
- MCS_GROUP(3, 0, BW_20, 4),
-+ MCS_GROUP(4, 0, BW_20, 4),
-
- MCS_GROUP(1, 1, BW_20, 5),
- MCS_GROUP(2, 1, BW_20, 4),
- MCS_GROUP(3, 1, BW_20, 4),
-+ MCS_GROUP(4, 1, BW_20, 4),
-
- MCS_GROUP(1, 0, BW_40, 4),
- MCS_GROUP(2, 0, BW_40, 4),
- MCS_GROUP(3, 0, BW_40, 4),
-+ MCS_GROUP(4, 0, BW_40, 4),
-
- MCS_GROUP(1, 1, BW_40, 4),
- MCS_GROUP(2, 1, BW_40, 4),
- MCS_GROUP(3, 1, BW_40, 4),
-+ MCS_GROUP(4, 1, BW_40, 4),
-
- CCK_GROUP(8),
-
- VHT_GROUP(1, 0, BW_20, 5),
- VHT_GROUP(2, 0, BW_20, 4),
- VHT_GROUP(3, 0, BW_20, 4),
-+ VHT_GROUP(4, 0, BW_20, 4),
-
- VHT_GROUP(1, 1, BW_20, 5),
- VHT_GROUP(2, 1, BW_20, 4),
- VHT_GROUP(3, 1, BW_20, 4),
-+ VHT_GROUP(4, 1, BW_20, 4),
-
- VHT_GROUP(1, 0, BW_40, 4),
- VHT_GROUP(2, 0, BW_40, 4),
- VHT_GROUP(3, 0, BW_40, 4),
-+ VHT_GROUP(4, 0, BW_40, 3),
-
- VHT_GROUP(1, 1, BW_40, 4),
- VHT_GROUP(2, 1, BW_40, 4),
- VHT_GROUP(3, 1, BW_40, 4),
-+ VHT_GROUP(4, 1, BW_40, 3),
-
- VHT_GROUP(1, 0, BW_80, 4),
- VHT_GROUP(2, 0, BW_80, 4),
- VHT_GROUP(3, 0, BW_80, 4),
-+ VHT_GROUP(4, 0, BW_80, 2),
-
- VHT_GROUP(1, 1, BW_80, 4),
- VHT_GROUP(2, 1, BW_80, 4),
- VHT_GROUP(3, 1, BW_80, 4),
-+ VHT_GROUP(4, 1, BW_80, 2),
- };
-
- static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly;
---- a/net/mac80211/rc80211_minstrel_ht.h
-+++ b/net/mac80211/rc80211_minstrel_ht.h
-@@ -13,7 +13,7 @@
- * The number of streams can be changed to 2 to reduce code
- * size and memory footprint.
- */
--#define MINSTREL_MAX_STREAMS 3
-+#define MINSTREL_MAX_STREAMS 4
- #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */
- #define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */
-
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Mon, 25 Mar 2019 09:02:52 +0100
-Subject: [PATCH] mac80211: minstrel_ht: automatically calculate rate
- duration shift
-
-A per-group shift was added to reduce the size of the per-rate transmit
-duration field to u16 without sacrificing a lot of precision
-This patch changes the macros to automatically calculate the best value for
-this shift based on the lowest rate within the group.
-This simplifies adding more groups and slightly improves accuracy for some of
-the existing groups.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/rc80211_minstrel_ht.c
-+++ b/net/mac80211/rc80211_minstrel_ht.c
-@@ -51,8 +51,11 @@
- MINSTREL_MAX_STREAMS * _sgi + \
- _streams - 1
-
-+#define GROUP_SHIFT(duration) \
-+ (16 - __builtin_clz(duration))
-+
- /* MCS rate information for an MCS group */
--#define MCS_GROUP(_streams, _sgi, _ht40, _s) \
-+#define __MCS_GROUP(_streams, _sgi, _ht40, _s) \
- [GROUP_IDX(_streams, _sgi, _ht40)] = { \
- .streams = _streams, \
- .shift = _s, \
-@@ -72,6 +75,13 @@
- } \
- }
-
-+#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) \
- (MINSTREL_VHT_GROUP_0 + \
- MINSTREL_MAX_STREAMS * 2 * (_bw) + \
-@@ -81,7 +91,7 @@
- #define BW2VBPS(_bw, r3, r2, r1) \
- (_bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1)
-
--#define VHT_GROUP(_streams, _sgi, _bw, _s) \
-+#define __VHT_GROUP(_streams, _sgi, _bw, _s) \
- [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \
- .streams = _streams, \
- .shift = _s, \
-@@ -114,6 +124,14 @@
- } \
- }
-
-+#define VHT_GROUP_SHIFT(_streams, _sgi, _bw) \
-+ GROUP_SHIFT(MCS_DURATION(_streams, _sgi, \
-+ BW2VBPS(_bw, 117, 54, 26)))
-+
-+#define VHT_GROUP(_streams, _sgi, _bw) \
-+ __VHT_GROUP(_streams, _sgi, _bw, \
-+ VHT_GROUP_SHIFT(_streams, _sgi, _bw))
-+
- #define CCK_DURATION(_bitrate, _short, _len) \
- (1000 * (10 /* SIFS */ + \
- (_short ? 72 + 24 : 144 + 48) + \
-@@ -129,7 +147,7 @@
- CCK_ACK_DURATION(55, _short) >> _s, \
- CCK_ACK_DURATION(110, _short) >> _s
-
--#define CCK_GROUP(_s) \
-+#define __CCK_GROUP(_s) \
- [MINSTREL_CCK_GROUP] = { \
- .streams = 1, \
- .flags = 0, \
-@@ -140,6 +158,12 @@
- } \
- }
-
-+#define CCK_GROUP_SHIFT \
-+ GROUP_SHIFT(CCK_ACK_DURATION(10, false))
-+
-+#define CCK_GROUP __CCK_GROUP(CCK_GROUP_SHIFT)
-+
-+
- static bool minstrel_vht_only = true;
- module_param(minstrel_vht_only, bool, 0644);
- MODULE_PARM_DESC(minstrel_vht_only,
-@@ -154,57 +178,57 @@ MODULE_PARM_DESC(minstrel_vht_only,
- * BW -> SGI -> #streams
- */
- const struct mcs_group minstrel_mcs_groups[] = {
-- MCS_GROUP(1, 0, BW_20, 5),
-- MCS_GROUP(2, 0, BW_20, 4),
-- MCS_GROUP(3, 0, BW_20, 4),
-- MCS_GROUP(4, 0, BW_20, 4),
--
-- MCS_GROUP(1, 1, BW_20, 5),
-- MCS_GROUP(2, 1, BW_20, 4),
-- MCS_GROUP(3, 1, BW_20, 4),
-- MCS_GROUP(4, 1, BW_20, 4),
--
-- MCS_GROUP(1, 0, BW_40, 4),
-- MCS_GROUP(2, 0, BW_40, 4),
-- MCS_GROUP(3, 0, BW_40, 4),
-- MCS_GROUP(4, 0, BW_40, 4),
--
-- MCS_GROUP(1, 1, BW_40, 4),
-- MCS_GROUP(2, 1, BW_40, 4),
-- MCS_GROUP(3, 1, BW_40, 4),
-- MCS_GROUP(4, 1, BW_40, 4),
--
-- CCK_GROUP(8),
--
-- VHT_GROUP(1, 0, BW_20, 5),
-- VHT_GROUP(2, 0, BW_20, 4),
-- VHT_GROUP(3, 0, BW_20, 4),
-- VHT_GROUP(4, 0, BW_20, 4),
--
-- VHT_GROUP(1, 1, BW_20, 5),
-- VHT_GROUP(2, 1, BW_20, 4),
-- VHT_GROUP(3, 1, BW_20, 4),
-- VHT_GROUP(4, 1, BW_20, 4),
--
-- VHT_GROUP(1, 0, BW_40, 4),
-- VHT_GROUP(2, 0, BW_40, 4),
-- VHT_GROUP(3, 0, BW_40, 4),
-- VHT_GROUP(4, 0, BW_40, 3),
--
-- VHT_GROUP(1, 1, BW_40, 4),
-- VHT_GROUP(2, 1, BW_40, 4),
-- VHT_GROUP(3, 1, BW_40, 4),
-- VHT_GROUP(4, 1, BW_40, 3),
--
-- VHT_GROUP(1, 0, BW_80, 4),
-- VHT_GROUP(2, 0, BW_80, 4),
-- VHT_GROUP(3, 0, BW_80, 4),
-- VHT_GROUP(4, 0, BW_80, 2),
--
-- VHT_GROUP(1, 1, BW_80, 4),
-- VHT_GROUP(2, 1, BW_80, 4),
-- VHT_GROUP(3, 1, BW_80, 4),
-- VHT_GROUP(4, 1, BW_80, 2),
-+ 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),
-+
-+ CCK_GROUP,
-+
-+ 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),
- };
-
- static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly;
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
-@@ -3264,6 +3264,7 @@ struct cfg80211_pmsr_request {
+@@ -3322,6 +3322,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
*
* @set_wds_peer: set the WDS peer for a WDS interface
*
-@@ -3569,6 +3570,7 @@ struct cfg80211_ops {
+@@ -3634,6 +3635,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);
const u8 *addr);
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
-@@ -1472,6 +1472,7 @@ enum ieee80211_smps_mode {
+@@ -1471,6 +1471,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
*
* @chandef: the channel definition to tune to
* @radar_enabled: whether radar detection is enabled
-@@ -1492,6 +1493,7 @@ enum ieee80211_smps_mode {
+@@ -1491,6 +1492,7 @@ enum ieee80211_smps_mode {
struct ieee80211_conf {
u32 flags;
int power_level, dynamic_ps_timeout;
u8 ps_dtim_period;
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
-@@ -2308,6 +2308,9 @@ enum nl80211_commands {
- * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
- * scheduler.
+@@ -2341,6 +2341,9 @@ enum nl80211_commands {
+ * should be picking up the lowest tx power, either tx power per-interface
+ * or per-station.
*
+ * @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
-@@ -2759,6 +2762,8 @@ enum nl80211_attrs {
-
- NL80211_ATTR_AIRTIME_WEIGHT,
+@@ -2794,6 +2797,8 @@ enum nl80211_attrs {
+ NL80211_ATTR_STA_TX_POWER_SETTING,
+ NL80211_ATTR_STA_TX_POWER,
+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
+
__NL80211_ATTR_AFTER_LAST,
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
-@@ -2533,6 +2533,19 @@ static int ieee80211_get_tx_power(struct
+@@ -2577,6 +2577,19 @@ static int ieee80211_get_tx_power(struct
return 0;
}
static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
const u8 *addr)
{
-@@ -3946,6 +3959,7 @@ const struct cfg80211_ops mac80211_confi
+@@ -3990,6 +4003,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,
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 {
+@@ -1373,6 +1373,7 @@ struct ieee80211_local {
int dynamic_ps_forced_timeout;
int user_power_level; /* in dBm, for all interfaces */
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
-@@ -95,7 +95,7 @@ static u32 ieee80211_hw_conf_chan(struct
+@@ -92,7 +92,7 @@ static u32 ieee80211_hw_conf_chan(struct
struct ieee80211_sub_if_data *sdata;
struct cfg80211_chan_def chandef = {};
u32 changed = 0;
u32 offchannel_flag;
offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
-@@ -152,6 +152,12 @@ static u32 ieee80211_hw_conf_chan(struct
+@@ -149,6 +149,12 @@ static u32 ieee80211_hw_conf_chan(struct
}
rcu_read_unlock();
if (local->hw.conf.power_level != power) {
changed |= IEEE80211_CONF_CHANGE_POWER;
local->hw.conf.power_level = power;
-@@ -641,6 +647,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
+@@ -638,6 +644,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;
local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
-@@ -541,6 +541,7 @@ const struct nla_policy nl80211_policy[N
+@@ -571,6 +571,7 @@ const struct nla_policy nl80211_policy[N
[NL80211_ATTR_PEER_MEASUREMENTS] =
NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
[NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
};
/* policy for the key attributes */
-@@ -2788,6 +2789,20 @@ static int nl80211_set_wiphy(struct sk_b
+@@ -2866,6 +2867,20 @@ static int nl80211_set_wiphy(struct sk_b
if (result)
return result;
}
+diff --git a/nl80211.h b/nl80211.h
+index 31ae5c7..9fb7370 100644
--- a/nl80211.h
+++ b/nl80211.h
-@@ -2299,6 +2299,12 @@ enum nl80211_commands {
+@@ -11,7 +11,7 @@
+ * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
+ * Copyright 2008 Colin McCabe <colin@cozybit.com>
+ * Copyright 2015-2017 Intel Deutschland GmbH
+- * Copyright (C) 2018 Intel Corporation
++ * Copyright (C) 2018-2019 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
+@@ -1065,6 +1065,26 @@
+ * indicated by %NL80211_ATTR_WIPHY_FREQ and other attributes
+ * determining the width and type.
+ *
++ * @NL80211_CMD_UPDATE_OWE_INFO: This interface allows the host driver to
++ * offload OWE processing to user space. This intends to support
++ * OWE AKM by the host drivers that implement SME but rely
++ * on the user space for the cryptographic/DH IE processing in AP mode.
++ *
++ * @NL80211_CMD_PROBE_MESH_LINK: The requirement for mesh link metric
++ * refreshing, is that from one mesh point we be able to send some data
++ * frames to other mesh points which are not currently selected as a
++ * primary traffic path, but which are only 1 hop away. The absence of
++ * the primary path to the chosen node makes it necessary to apply some
++ * form of marking on a chosen packet stream so that the packets can be
++ * properly steered to the selected node for testing, and not by the
++ * regular mesh path lookup. Further, the packets must be of type data
++ * so that the rate control (often embedded in firmware) is used for
++ * rate selection.
++ *
++ * Here attribute %NL80211_ATTR_MAC is used to specify connected mesh
++ * peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame
++ * content. The frame is ethernet data.
++ *
+ * @NL80211_CMD_MAX: highest used command number
+ * @__NL80211_CMD_AFTER_LAST: internal use
+ */
+@@ -1285,6 +1305,10 @@ enum nl80211_commands {
+
+ NL80211_CMD_NOTIFY_RADAR,
+
++ NL80211_CMD_UPDATE_OWE_INFO,
++
++ NL80211_CMD_PROBE_MESH_LINK,
++
+ /* add new commands above here */
+
+ /* used to define NL80211_CMD_MAX below */
+@@ -1565,6 +1589,12 @@ enum nl80211_commands {
+ * (a u32 with flags from &enum nl80211_wpa_versions).
+ * @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
+ * indicate which key management algorithm(s) to use (an array of u32).
++ * This attribute is also sent in response to @NL80211_CMD_GET_WIPHY,
++ * indicating the supported AKM suites, intended for specific drivers which
++ * implement SME and have constraints on which AKMs are supported and also
++ * the cases where an AKM support is offloaded to the driver/firmware.
++ * If there is no such notification from the driver, user space should
++ * assume the driver supports all the AKM suites.
+ *
+ * @NL80211_ATTR_REQ_IE: (Re)association request information elements as
+ * sent out by the card, for ROAM and successful CONNECT events.
+@@ -2260,10 +2290,10 @@ enum nl80211_commands {
+ * &enum nl80211_external_auth_action value). This is used with the
+ * %NL80211_CMD_EXTERNAL_AUTH request event.
+ * @NL80211_ATTR_EXTERNAL_AUTH_SUPPORT: Flag attribute indicating that the user
+- * space supports external authentication. This attribute shall be used
+- * only with %NL80211_CMD_CONNECT request. The driver may offload
+- * authentication processing to user space if this capability is indicated
+- * in NL80211_CMD_CONNECT requests from the user space.
++ * space supports external authentication. This attribute shall be used
++ * with %NL80211_CMD_CONNECT and %NL80211_CMD_START_AP request. The driver
++ * may offload authentication processing to user space if this capability
++ * is indicated in the respective requests from the user space.
+ *
+ * @NL80211_ATTR_NSS: Station's New/updated RX_NSS value notified using this
+ * u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED.
+@@ -2299,6 +2329,21 @@ enum nl80211_commands {
* This is also used for capability advertisement in the wiphy information,
* with the appropriate sub-attributes.
*
+ * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
+ * scheduler.
+ *
++ * @NL80211_ATTR_STA_TX_POWER_SETTING: Transmit power setting type (u8) for
++ * station associated with the AP. See &enum nl80211_tx_power_setting for
++ * possible values.
++ * @NL80211_ATTR_STA_TX_POWER: Transmit power level (s16) in dBm units. This
++ * allows to set Tx power for a station. If this attribute is not included,
++ * the default per-interface tx power setting will be overriding. Driver
++ * should be picking up the lowest tx power, either tx power per-interface
++ * or per-station.
++ *
+ * @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
-@@ -2748,6 +2754,10 @@ enum nl80211_attrs {
+@@ -2748,6 +2793,12 @@ enum nl80211_attrs {
NL80211_ATTR_PEER_MEASUREMENTS,
+ NL80211_ATTR_AIRTIME_WEIGHT,
++ NL80211_ATTR_STA_TX_POWER_SETTING,
++ NL80211_ATTR_STA_TX_POWER,
+
+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
-@@ -3125,6 +3135,9 @@ enum nl80211_sta_bss_param {
+@@ -2791,7 +2842,7 @@ enum nl80211_attrs {
+
+ #define NL80211_MAX_SUPP_RATES 32
+ #define NL80211_MAX_SUPP_HT_RATES 77
+-#define NL80211_MAX_SUPP_REG_RULES 64
++#define NL80211_MAX_SUPP_REG_RULES 128
+ #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0
+ #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16
+ #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
+@@ -3125,6 +3176,10 @@ enum nl80211_sta_bss_param {
* might not be fully accurate.
* @NL80211_STA_INFO_CONNECTED_TO_GATE: set to true if STA has a path to a
* mesh gate (u8, 0 or 1)
+ * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames
+ * sent to the station (u64, usec)
+ * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16)
++ * @NL80211_STA_INFO_AIRTIME_LINK_METRIC: airtime link metric for mesh station
* @__NL80211_STA_INFO_AFTER_LAST: internal
* @NL80211_STA_INFO_MAX: highest possible station info attribute
*/
-@@ -3168,6 +3181,8 @@ enum nl80211_sta_info {
+@@ -3168,6 +3223,9 @@ enum nl80211_sta_info {
NL80211_STA_INFO_RX_MPDUS,
NL80211_STA_INFO_FCS_ERROR_COUNT,
NL80211_STA_INFO_CONNECTED_TO_GATE,
+ NL80211_STA_INFO_TX_DURATION,
+ NL80211_STA_INFO_AIRTIME_WEIGHT,
++ NL80211_STA_INFO_AIRTIME_LINK_METRIC,
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
+@@ -3277,8 +3335,10 @@ enum nl80211_mpath_flags {
+ * &enum nl80211_mpath_flags;
+ * @NL80211_MPATH_INFO_DISCOVERY_TIMEOUT: total path discovery timeout, in msec
+ * @NL80211_MPATH_INFO_DISCOVERY_RETRIES: mesh path discovery retries
++ * @NL80211_MPATH_INFO_HOP_COUNT: hop count to destination
++ * @NL80211_MPATH_INFO_PATH_CHANGE: total number of path changes to destination
+ * @NL80211_MPATH_INFO_MAX: highest mesh path information attribute number
+- * currently defind
++ * currently defined
+ * @__NL80211_MPATH_INFO_AFTER_LAST: internal use
+ */
+ enum nl80211_mpath_info {
+@@ -3290,6 +3350,8 @@ enum nl80211_mpath_info {
+ NL80211_MPATH_INFO_FLAGS,
+ NL80211_MPATH_INFO_DISCOVERY_TIMEOUT,
+ NL80211_MPATH_INFO_DISCOVERY_RETRIES,
++ NL80211_MPATH_INFO_HOP_COUNT,
++ NL80211_MPATH_INFO_PATH_CHANGE,
+
+ /* keep last */
+ __NL80211_MPATH_INFO_AFTER_LAST,
+@@ -3618,6 +3680,14 @@ enum nl80211_reg_rule_attr {
+ * value as specified by &struct nl80211_bss_select_rssi_adjust.
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_BSSID: BSSID to be used for matching
+ * (this cannot be used together with SSID).
++ * @NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI: Nested attribute that carries the
++ * band specific minimum rssi thresholds for the bands defined in
++ * enum nl80211_band. The minimum rssi threshold value(s32) specific to a
++ * band shall be encapsulated in attribute with type value equals to one
++ * of the NL80211_BAND_* defined in enum nl80211_band. For example, the
++ * minimum rssi threshold value for 2.4GHZ band shall be encapsulated
++ * within an attribute of type NL80211_BAND_2GHZ. And one or more of such
++ * attributes will be nested within this attribute.
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter
+ * attribute number currently defined
+ * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use
+@@ -3630,6 +3700,7 @@ enum nl80211_sched_scan_match_attr {
+ NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI,
+ NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST,
+ NL80211_SCHED_SCAN_MATCH_ATTR_BSSID,
++ NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI,
+
+ /* keep last */
+ __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST,
+@@ -4114,6 +4185,27 @@ enum nl80211_channel_type {
+ NL80211_CHAN_HT40PLUS
+ };
+
++/**
++ * enum nl80211_key_mode - Key mode
++ *
++ * @NL80211_KEY_RX_TX: (Default)
++ * Key can be used for Rx and Tx immediately
++ *
++ * The following modes can only be selected for unicast keys and when the
++ * driver supports @NL80211_EXT_FEATURE_EXT_KEY_ID:
++ *
++ * @NL80211_KEY_NO_TX: Only allowed in combination with @NL80211_CMD_NEW_KEY:
++ * Unicast key can only be used for Rx, Tx not allowed, yet
++ * @NL80211_KEY_SET_TX: Only allowed in combination with @NL80211_CMD_SET_KEY:
++ * The unicast key identified by idx and mac is cleared for Tx and becomes
++ * the preferred Tx key for the station.
++ */
++enum nl80211_key_mode {
++ NL80211_KEY_RX_TX,
++ NL80211_KEY_NO_TX,
++ NL80211_KEY_SET_TX
++};
++
+ /**
+ * enum nl80211_chan_width - channel width definitions
+ *
+@@ -4357,6 +4449,9 @@ enum nl80211_key_default_types {
+ * @NL80211_KEY_DEFAULT_TYPES: A nested attribute containing flags
+ * attributes, specifying what a key should be set as default as.
+ * See &enum nl80211_key_default_types.
++ * @NL80211_KEY_MODE: the mode from enum nl80211_key_mode.
++ * Defaults to @NL80211_KEY_RX_TX.
++ *
+ * @__NL80211_KEY_AFTER_LAST: internal
+ * @NL80211_KEY_MAX: highest key attribute
+ */
+@@ -4370,6 +4465,7 @@ enum nl80211_key_attributes {
+ NL80211_KEY_DEFAULT_MGMT,
+ NL80211_KEY_TYPE,
+ NL80211_KEY_DEFAULT_TYPES,
++ NL80211_KEY_MODE,
+
+ /* keep last */
+ __NL80211_KEY_AFTER_LAST,
+@@ -5315,6 +5411,21 @@ enum nl80211_feature_flags {
+ * able to rekey an in-use key correctly. Userspace must not rekey PTK keys
+ * if this flag is not set. Ignoring this can leak clear text packets and/or
+ * freeze the connection.
++ * @NL80211_EXT_FEATURE_EXT_KEY_ID: Driver supports "Extended Key ID for
++ * Individually Addressed Frames" from IEEE802.11-2016.
++ *
++ * @NL80211_EXT_FEATURE_AIRTIME_FAIRNESS: Driver supports getting airtime
++ * fairness for transmitted packets and has enabled airtime fairness
++ * scheduling.
++ *
++ * @NL80211_EXT_FEATURE_AP_PMKSA_CACHING: Driver/device supports PMKSA caching
++ * (set/del PMKSA operations) in AP mode.
++ *
++ * @NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD: Driver supports
++ * filtering of sched scan results using band specific RSSI thresholds.
++ *
++ * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power
++ * to a station.
+ *
+ * @NUM_NL80211_EXT_FEATURES: number of extended features.
+ * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
+@@ -5355,6 +5466,11 @@ enum nl80211_ext_feature_index {
+ NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
+ NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
+ NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
++ NL80211_EXT_FEATURE_AP_PMKSA_CACHING,
++ NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD,
++ NL80211_EXT_FEATURE_EXT_KEY_ID,
++ NL80211_EXT_FEATURE_STA_TX_PWR,
+
+ /* add new features before the definition below */
+ NUM_NL80211_EXT_FEATURES,
+@@ -5606,9 +5722,14 @@ enum nl80211_crit_proto_id {
+ * Used by cfg80211_rx_mgmt()
+ *
+ * @NL80211_RXMGMT_FLAG_ANSWERED: frame was answered by device/driver.
++ * @NL80211_RXMGMT_FLAG_EXTERNAL_AUTH: Host driver intends to offload
++ * the authentication. Exclusively defined for host drivers that
++ * advertises the SME functionality but would like the userspace
++ * to handle certain authentication algorithms (e.g. SAE).
+ */
+ enum nl80211_rxmgmt_flags {
+ NL80211_RXMGMT_FLAG_ANSWERED = 1 << 0,
++ NL80211_RXMGMT_FLAG_EXTERNAL_AUTH = 1 << 1,
+ };
+
+ /*
+++ /dev/null
-From: Alexander Duyck <alexander.h.duyck@intel.com>
-Date: Tue, 10 Jan 2017 16:58:06 -0800
-Subject: [PATCH] mm: rename __alloc_page_frag to page_frag_alloc and
- __free_page_frag to page_frag_free
-
-Patch series "Page fragment updates", v4.
-
-This patch series takes care of a few cleanups for the page fragments
-API.
-
-First we do some renames so that things are much more consistent. First
-we move the page_frag_ portion of the name to the front of the functions
-names. Secondly we split out the cache specific functions from the
-other page fragment functions by adding the word "cache" to the name.
-
-Finally I added a bit of documentation that will hopefully help to
-explain some of this. I plan to revisit this later as we get things
-more ironed out in the near future with the changes planned for the DMA
-setup to support eXpress Data Path.
-
-This patch (of 3):
-
-This patch renames the page frag functions to be more consistent with
-other APIs. Specifically we place the name page_frag first in the name
-and then have either an alloc or free call name that we append as the
-suffix. This makes it a bit clearer in terms of naming.
-
-In addition we drop the leading double underscores since we are
-technically no longer a backing interface and instead the front end that
-is called from the networking APIs.
-
-Link: http://lkml.kernel.org/r/20170104023854.13451.67390.stgit@localhost.localdomain
-Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
----
-
---- a/include/linux/gfp.h
-+++ b/include/linux/gfp.h
-@@ -508,9 +508,9 @@ extern void free_hot_cold_page_list(stru
- struct page_frag_cache;
- extern void __page_frag_drain(struct page *page, unsigned int order,
- unsigned int count);
--extern void *__alloc_page_frag(struct page_frag_cache *nc,
-- unsigned int fragsz, gfp_t gfp_mask);
--extern void __free_page_frag(void *addr);
-+extern void *page_frag_alloc(struct page_frag_cache *nc,
-+ unsigned int fragsz, gfp_t gfp_mask);
-+extern void page_frag_free(void *addr);
-
- #define __free_page(page) __free_pages((page), 0)
- #define free_page(addr) free_pages((addr), 0)
---- a/include/linux/skbuff.h
-+++ b/include/linux/skbuff.h
-@@ -2476,7 +2476,7 @@ static inline struct sk_buff *netdev_all
-
- static inline void skb_free_frag(void *addr)
- {
-- __free_page_frag(addr);
-+ page_frag_free(addr);
- }
-
- void *napi_alloc_frag(unsigned int fragsz);
---- a/mm/page_alloc.c
-+++ b/mm/page_alloc.c
-@@ -3949,8 +3949,8 @@ void __page_frag_drain(struct page *page
- }
- EXPORT_SYMBOL(__page_frag_drain);
-
--void *__alloc_page_frag(struct page_frag_cache *nc,
-- unsigned int fragsz, gfp_t gfp_mask)
-+void *page_frag_alloc(struct page_frag_cache *nc,
-+ unsigned int fragsz, gfp_t gfp_mask)
- {
- unsigned int size = PAGE_SIZE;
- struct page *page;
-@@ -4001,19 +4001,19 @@ refill:
-
- return nc->va + offset;
- }
--EXPORT_SYMBOL(__alloc_page_frag);
-+EXPORT_SYMBOL(page_frag_alloc);
-
- /*
- * Frees a page fragment allocated out of either a compound or order 0 page.
- */
--void __free_page_frag(void *addr)
-+void page_frag_free(void *addr)
- {
- struct page *page = virt_to_head_page(addr);
-
- if (unlikely(put_page_testzero(page)))
- __free_pages_ok(page, compound_order(page));
- }
--EXPORT_SYMBOL(__free_page_frag);
-+EXPORT_SYMBOL(page_frag_free);
-
- static void *make_alloc_exact(unsigned long addr, unsigned int order,
- size_t size)
---- a/net/core/skbuff.c
-+++ b/net/core/skbuff.c
-@@ -369,7 +369,7 @@ static void *__netdev_alloc_frag(unsigne
-
- local_irq_save(flags);
- nc = this_cpu_ptr(&netdev_alloc_cache);
-- data = __alloc_page_frag(nc, fragsz, gfp_mask);
-+ data = page_frag_alloc(nc, fragsz, gfp_mask);
- local_irq_restore(flags);
- return data;
- }
-@@ -393,7 +393,7 @@ static void *__napi_alloc_frag(unsigned
- {
- struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache);
-
-- return __alloc_page_frag(&nc->page, fragsz, gfp_mask);
-+ return page_frag_alloc(&nc->page, fragsz, gfp_mask);
- }
-
- void *napi_alloc_frag(unsigned int fragsz)
-@@ -445,7 +445,7 @@ struct sk_buff *__netdev_alloc_skb(struc
- local_irq_save(flags);
-
- nc = this_cpu_ptr(&netdev_alloc_cache);
-- data = __alloc_page_frag(nc, len, gfp_mask);
-+ data = page_frag_alloc(nc, len, gfp_mask);
- pfmemalloc = nc->pfmemalloc;
-
- local_irq_restore(flags);
-@@ -509,7 +509,7 @@ struct sk_buff *__napi_alloc_skb(struct
- if (sk_memalloc_socks())
- gfp_mask |= __GFP_MEMALLOC;
-
-- data = __alloc_page_frag(&nc->page, len, gfp_mask);
-+ data = page_frag_alloc(&nc->page, len, gfp_mask);
- if (unlikely(!data))
- return NULL;
-
+++ /dev/null
-From: Alexander Duyck <alexander.h.duyck@intel.com>
-Date: Tue, 10 Jan 2017 16:58:09 -0800
-Subject: [PATCH] mm: rename __page_frag functions to __page_frag_cache, drop
- order from drain
-
-This patch does two things.
-
-First it goes through and renames the __page_frag prefixed functions to
-__page_frag_cache so that we can be clear that we are draining or
-refilling the cache, not the frags themselves.
-
-Second we drop the order parameter from __page_frag_cache_drain since we
-don't actually need to pass it since all fragments are either order 0 or
-must be a compound page.
-
-Link: http://lkml.kernel.org/r/20170104023954.13451.5678.stgit@localhost.localdomain
-Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
----
-
---- a/include/linux/gfp.h
-+++ b/include/linux/gfp.h
-@@ -506,8 +506,7 @@ extern void free_hot_cold_page(struct pa
- extern void free_hot_cold_page_list(struct list_head *list, bool cold);
-
- struct page_frag_cache;
--extern void __page_frag_drain(struct page *page, unsigned int order,
-- unsigned int count);
-+extern void __page_frag_cache_drain(struct page *page, unsigned int count);
- extern void *page_frag_alloc(struct page_frag_cache *nc,
- unsigned int fragsz, gfp_t gfp_mask);
- extern void page_frag_free(void *addr);
---- a/mm/page_alloc.c
-+++ b/mm/page_alloc.c
-@@ -3914,8 +3914,8 @@ EXPORT_SYMBOL(free_pages);
- * drivers to provide a backing region of memory for use as either an
- * sk_buff->head, or to be used in the "frags" portion of skb_shared_info.
- */
--static struct page *__page_frag_refill(struct page_frag_cache *nc,
-- gfp_t gfp_mask)
-+static struct page *__page_frag_cache_refill(struct page_frag_cache *nc,
-+ gfp_t gfp_mask)
- {
- struct page *page = NULL;
- gfp_t gfp = gfp_mask;
-@@ -3935,19 +3935,20 @@ static struct page *__page_frag_refill(s
- return page;
- }
-
--void __page_frag_drain(struct page *page, unsigned int order,
-- unsigned int count)
-+void __page_frag_cache_drain(struct page *page, unsigned int count)
- {
- VM_BUG_ON_PAGE(page_ref_count(page) == 0, page);
-
- if (page_ref_sub_and_test(page, count)) {
-+ unsigned int order = compound_order(page);
-+
- if (order == 0)
- free_hot_cold_page(page, false);
- else
- __free_pages_ok(page, order);
- }
- }
--EXPORT_SYMBOL(__page_frag_drain);
-+EXPORT_SYMBOL(__page_frag_cache_drain);
-
- void *page_frag_alloc(struct page_frag_cache *nc,
- unsigned int fragsz, gfp_t gfp_mask)
-@@ -3958,7 +3959,7 @@ void *page_frag_alloc(struct page_frag_c
-
- if (unlikely(!nc->va)) {
- refill:
-- page = __page_frag_refill(nc, gfp_mask);
-+ page = __page_frag_cache_refill(nc, gfp_mask);
- if (!page)
- return NULL;
-
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
-@@ -5924,7 +5924,7 @@ static void __ref alloc_node_mem_map(str
+@@ -5923,7 +5923,7 @@ static void __ref alloc_node_mem_map(str
mem_map = NODE_DATA(0)->node_mem_map;
#if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM)
if (page_to_pfn(mem_map) != pgdat->node_start_pfn)