diff --git a/package/kernel/mac80211/patches/323-0001-brcmfmac-Use-net_device_stats-from-struct-net_device.patch b/package/kernel/mac80211/patches/323-0001-brcmfmac-Use-net_device_stats-from-struct-net_device.patch new file mode 100644 index 0000000000..81567d8757 --- /dev/null +++ b/package/kernel/mac80211/patches/323-0001-brcmfmac-Use-net_device_stats-from-struct-net_device.patch @@ -0,0 +1,112 @@ +From 91b632803ee4e47c5a5c4dc3d8bf5abf9c16107a Mon Sep 17 00:00:00 2001 +From: Tobias Klauser +Date: Mon, 13 Feb 2017 11:14:09 +0100 +Subject: [PATCH] brcmfmac: Use net_device_stats from struct net_device + +Instead of using a private copy of struct net_device_stats in struct +brcm_if, use stats from struct net_device. Also remove the now +unnecessary .ndo_get_stats function. + +Signed-off-by: Tobias Klauser +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 26 +++++++--------------- + .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 -- + 2 files changed, 8 insertions(+), 20 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -249,10 +249,10 @@ static netdev_tx_t brcmf_netdev_start_xm + + done: + if (ret) { +- ifp->stats.tx_dropped++; ++ ndev->stats.tx_dropped++; + } else { +- ifp->stats.tx_packets++; +- ifp->stats.tx_bytes += skb->len; ++ ndev->stats.tx_packets++; ++ ndev->stats.tx_bytes += skb->len; + } + + /* Return ok: we always eat the packet */ +@@ -296,15 +296,15 @@ void brcmf_txflowblock(struct device *de + void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb) + { + if (skb->pkt_type == PACKET_MULTICAST) +- ifp->stats.multicast++; ++ ifp->ndev->stats.multicast++; + + if (!(ifp->ndev->flags & IFF_UP)) { + brcmu_pkt_buf_free_skb(skb); + return; + } + +- ifp->stats.rx_bytes += skb->len; +- ifp->stats.rx_packets++; ++ ifp->ndev->stats.rx_bytes += skb->len; ++ ifp->ndev->stats.rx_packets++; + + brcmf_dbg(DATA, "rx proto=0x%X\n", ntohs(skb->protocol)); + if (in_interrupt()) +@@ -327,7 +327,7 @@ static int brcmf_rx_hdrpull(struct brcmf + + if (ret || !(*ifp) || !(*ifp)->ndev) { + if (ret != -ENODATA && *ifp) +- (*ifp)->stats.rx_errors++; ++ (*ifp)->ndev->stats.rx_errors++; + brcmu_pkt_buf_free_skb(skb); + return -ENODATA; + } +@@ -388,7 +388,7 @@ void brcmf_txfinalize(struct brcmf_if *i + } + + if (!success) +- ifp->stats.tx_errors++; ++ ifp->ndev->stats.tx_errors++; + + brcmu_pkt_buf_free_skb(txp); + } +@@ -411,15 +411,6 @@ void brcmf_txcomplete(struct device *dev + } + } + +-static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev) +-{ +- struct brcmf_if *ifp = netdev_priv(ndev); +- +- brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); +- +- return &ifp->stats; +-} +- + static void brcmf_ethtool_get_drvinfo(struct net_device *ndev, + struct ethtool_drvinfo *info) + { +@@ -492,7 +483,6 @@ static int brcmf_netdev_open(struct net_ + static const struct net_device_ops brcmf_netdev_ops_pri = { + .ndo_open = brcmf_netdev_open, + .ndo_stop = brcmf_netdev_stop, +- .ndo_get_stats = brcmf_netdev_get_stats, + .ndo_start_xmit = brcmf_netdev_start_xmit, + .ndo_set_mac_address = brcmf_netdev_set_mac_address, + .ndo_set_rx_mode = brcmf_netdev_set_multicast_list +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -171,7 +171,6 @@ enum brcmf_netif_stop_reason { + * @drvr: points to device related information. + * @vif: points to cfg80211 specific interface information. + * @ndev: associated network device. +- * @stats: interface specific network statistics. + * @multicast_work: worker object for multicast provisioning. + * @ndoffload_work: worker object for neighbor discovery offload configuration. + * @fws_desc: interface specific firmware-signalling descriptor. +@@ -187,7 +186,6 @@ struct brcmf_if { + struct brcmf_pub *drvr; + struct brcmf_cfg80211_vif *vif; + struct net_device *ndev; +- struct net_device_stats stats; + struct work_struct multicast_work; + struct work_struct ndoffload_work; + struct brcmf_fws_mac_descriptor *fws_desc; diff --git a/package/kernel/mac80211/patches/855-brcmfmac-always-print-error-when-PSM-s-watchdog-fire.patch b/package/kernel/mac80211/patches/323-0002-brcmfmac-always-print-error-when-PSM-s-watchdog-fire.patch similarity index 94% rename from package/kernel/mac80211/patches/855-brcmfmac-always-print-error-when-PSM-s-watchdog-fire.patch rename to package/kernel/mac80211/patches/323-0002-brcmfmac-always-print-error-when-PSM-s-watchdog-fire.patch index 51448e93c7..7272b889c0 100644 --- a/package/kernel/mac80211/patches/855-brcmfmac-always-print-error-when-PSM-s-watchdog-fire.patch +++ b/package/kernel/mac80211/patches/323-0002-brcmfmac-always-print-error-when-PSM-s-watchdog-fire.patch @@ -1,6 +1,6 @@ -From e374cb32e98fb49e17594424b0445d8438825413 Mon Sep 17 00:00:00 2001 +From f1ac3aa212af6dd0a36dc07a63f95f91be6f4935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 24 Feb 2017 17:18:47 +0100 +Date: Fri, 24 Feb 2017 17:32:46 +0100 Subject: [PATCH] brcmfmac: always print error when PSM's watchdog fires MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -20,6 +20,7 @@ In the future we may also try to extend this listener by trying to recover from the error or at least signal it to the cfg80211. Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo --- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 22 ++++++++++++++++++ .../wireless/broadcom/brcm80211/brcmfmac/debug.c | 26 +++------------------- @@ -28,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -748,6 +748,24 @@ void brcmf_remove_interface(struct brcmf +@@ -738,6 +738,24 @@ void brcmf_remove_interface(struct brcmf brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked); } @@ -53,7 +54,7 @@ Signed-off-by: Rafał Miłecki #ifdef CONFIG_INET #define ARPOL_MAX_ENTRIES 8 static int brcmf_inetaddr_changed(struct notifier_block *nb, -@@ -927,6 +945,10 @@ int brcmf_attach(struct device *dev, str +@@ -917,6 +935,10 @@ int brcmf_attach(struct device *dev, str goto fail; } diff --git a/package/kernel/mac80211/patches/323-0003-brcmfmac-Do-not-print-the-firmware-version-as-an-err.patch b/package/kernel/mac80211/patches/323-0003-brcmfmac-Do-not-print-the-firmware-version-as-an-err.patch new file mode 100644 index 0000000000..3ab9b66e08 --- /dev/null +++ b/package/kernel/mac80211/patches/323-0003-brcmfmac-Do-not-print-the-firmware-version-as-an-err.patch @@ -0,0 +1,56 @@ +From d79fe4cb70d8deab7b8dc1de547ed4b915574414 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 8 Mar 2017 14:50:15 +0100 +Subject: [PATCH] brcmfmac: Do not print the firmware version as an error + +Using pr_err for things which are not errors is a bad idea. E.g. it +will cause the plymouth bootsplash screen to drop back to the text +console so that the user can see the error, which is not what we +normally want to happen. + +Instead add a new brcmf_info macro and use that. + +Signed-off-by: Hans de Goede +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 9 +++++++++ + 2 files changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -161,7 +161,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + strsep(&ptr, "\n"); + + /* Print fw version info */ +- brcmf_err("Firmware version = %s\n", buf); ++ brcmf_info("Firmware version = %s\n", buf); + + /* locate firmware version number for ethtool */ + ptr = strrchr(buf, ' ') + 1; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -59,6 +59,10 @@ void __brcmf_err(const char *func, const + } while (0) + + #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) ++ ++/* For debug/tracing purposes treat info messages as errors */ ++#define brcmf_info brcmf_err ++ + __printf(3, 4) + void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...); + #define brcmf_dbg(level, fmt, ...) \ +@@ -77,6 +81,11 @@ do { \ + + #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */ + ++#define brcmf_info(fmt, ...) \ ++ do { \ ++ pr_info("%s: " fmt, __func__, ##__VA_ARGS__); \ ++ } while (0) ++ + #define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__) + + #define BRCMF_DATA_ON() 0 diff --git a/package/kernel/mac80211/patches/323-0004-brcmfmac-Do-not-complain-about-country-code-00.patch b/package/kernel/mac80211/patches/323-0004-brcmfmac-Do-not-complain-about-country-code-00.patch new file mode 100644 index 0000000000..f4570e71b1 --- /dev/null +++ b/package/kernel/mac80211/patches/323-0004-brcmfmac-Do-not-complain-about-country-code-00.patch @@ -0,0 +1,28 @@ +From 26e537884a8ef451f5c60f6949b1615069931ffa Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 8 Mar 2017 14:50:16 +0100 +Subject: [PATCH] brcmfmac: Do not complain about country code "00" + +The country code gets set to "00" by default at boot, ignore this +rather then logging an error about it. + +Signed-off-by: Hans de Goede +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6736,6 +6736,10 @@ static void brcmf_cfg80211_reg_notifier( + s32 err; + int i; + ++ /* The country code gets set to "00" by default at boot, ignore */ ++ if (req->alpha2[0] == '0' && req->alpha2[1] == '0') ++ return; ++ + /* ignore non-ISO3166 country codes */ + for (i = 0; i < sizeof(req->alpha2); i++) + if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { diff --git a/package/kernel/mac80211/patches/323-0005-brcmfmac-Handle-status-BRCMF_E_STATUS_ABORT-in-cfg80.patch b/package/kernel/mac80211/patches/323-0005-brcmfmac-Handle-status-BRCMF_E_STATUS_ABORT-in-cfg80.patch new file mode 100644 index 0000000000..0f2d54e1dd --- /dev/null +++ b/package/kernel/mac80211/patches/323-0005-brcmfmac-Handle-status-BRCMF_E_STATUS_ABORT-in-cfg80.patch @@ -0,0 +1,35 @@ +From b9472a2e3e452c414634b3ccb1ef6c4098878686 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 8 Mar 2017 14:50:17 +0100 +Subject: [PATCH] brcmfmac: Handle status == BRCMF_E_STATUS_ABORT in + cfg80211_escan_handler + +If a scan gets aborted BRCMF_SCAN_STATUS_BUSY gets cleared in +cfg->scan_status and when we receive an abort event from the firmware +the BRCMF_SCAN_STATUS_BUSY check in the cfg80211_escan_handler will +trigger resulting in multiple errors getting logged. + +Check for a status of BRCMF_E_STATUS_ABORT and in this case simply +cleanly exit the cfg80211_escan_handler. This also avoids a +BRCMF_E_STATUS_ABORT event arriving after a new scan has been started +causing the new scan to complete prematurely without any data. + +Signed-off-by: Hans de Goede +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -3097,6 +3097,9 @@ brcmf_cfg80211_escan_handler(struct brcm + + status = e->status; + ++ if (status == BRCMF_E_STATUS_ABORT) ++ goto exit; ++ + if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { + brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx); + return -EPERM; diff --git a/package/kernel/mac80211/patches/323-0006-brcmfmac-move-brcmf_txflowblock-to-bcdc-layer.patch b/package/kernel/mac80211/patches/323-0006-brcmfmac-move-brcmf_txflowblock-to-bcdc-layer.patch new file mode 100644 index 0000000000..b947cd1de9 --- /dev/null +++ b/package/kernel/mac80211/patches/323-0006-brcmfmac-move-brcmf_txflowblock-to-bcdc-layer.patch @@ -0,0 +1,137 @@ +From 20ec4f57498f8770c7a1a3e2a316fa752a424178 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Fri, 10 Mar 2017 21:17:02 +0000 +Subject: [PATCH] brcmfmac: move brcmf_txflowblock to bcdc layer + +brcmf_txflowblock is invoked by sdio and usb bus module which are using +bcdc protocol. This patch makes it a bcdc API instead of a core module +function. + +Reviewed-by: Arend Van Spriel +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 10 ++++++++++ + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 -- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 10 ---------- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++-- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 5 +++-- + 6 files changed, 17 insertions(+), 16 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +@@ -345,6 +345,16 @@ brcmf_proto_bcdc_txdata(struct brcmf_pub + return brcmf_bus_txdata(drvr->bus_if, pktbuf); + } + ++void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pub *drvr = bus_if->drvr; ++ ++ brcmf_dbg(TRACE, "Enter\n"); ++ ++ brcmf_fws_bus_blocked(drvr, state); ++} ++ + static void + brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx, + enum proto_addr_mode addr_mode) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h +@@ -19,6 +19,7 @@ + #ifdef CPTCFG_BRCMFMAC_PROTO_BCDC + int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); + void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); ++void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state); + #else + static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; } + static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {} +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -229,8 +229,6 @@ int brcmf_attach(struct device *dev, str + void brcmf_detach(struct device *dev); + /* Indication from bus module that dongle should be reset */ + void brcmf_dev_reset(struct device *dev); +-/* Indication from bus module to change flow-control state */ +-void brcmf_txflowblock(struct device *dev, bool state); + + /* Notify the bus has transferred the tx packet to firmware */ + void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -283,16 +283,6 @@ void brcmf_txflowblock_if(struct brcmf_i + spin_unlock_irqrestore(&ifp->netif_stop_lock, flags); + } + +-void brcmf_txflowblock(struct device *dev, bool state) +-{ +- struct brcmf_bus *bus_if = dev_get_drvdata(dev); +- struct brcmf_pub *drvr = bus_if->drvr; +- +- brcmf_dbg(TRACE, "Enter\n"); +- +- brcmf_fws_bus_blocked(drvr, state); +-} +- + void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb) + { + if (skb->pkt_type == PACKET_MULTICAST) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -44,6 +44,7 @@ + #include "firmware.h" + #include "core.h" + #include "common.h" ++#include "bcdc.h" + + #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500) + #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500) +@@ -2328,7 +2329,7 @@ static uint brcmf_sdio_sendfromq(struct + if ((bus->sdiodev->state == BRCMF_SDIOD_DATA) && + bus->txoff && (pktq_len(&bus->txq) < TXLOW)) { + bus->txoff = false; +- brcmf_txflowblock(bus->sdiodev->dev, false); ++ brcmf_proto_bcdc_txflowblock(bus->sdiodev->dev, false); + } + + return cnt; +@@ -2753,7 +2754,7 @@ static int brcmf_sdio_bus_txdata(struct + + if (pktq_len(&bus->txq) >= TXHI) { + bus->txoff = true; +- brcmf_txflowblock(dev, true); ++ brcmf_proto_bcdc_txflowblock(dev, true); + } + spin_unlock_bh(&bus->txq_lock); + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -29,6 +29,7 @@ + #include "usb.h" + #include "core.h" + #include "common.h" ++#include "bcdc.h" + + + #define IOCTL_RESP_TIMEOUT msecs_to_jiffies(2000) +@@ -488,7 +489,7 @@ static void brcmf_usb_tx_complete(struct + spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags); + if (devinfo->tx_freecount > devinfo->tx_high_watermark && + devinfo->tx_flowblock) { +- brcmf_txflowblock(devinfo->dev, false); ++ brcmf_proto_bcdc_txflowblock(devinfo->dev, false); + devinfo->tx_flowblock = false; + } + spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags); +@@ -635,7 +636,7 @@ static int brcmf_usb_tx(struct device *d + spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags); + if (devinfo->tx_freecount < devinfo->tx_low_watermark && + !devinfo->tx_flowblock) { +- brcmf_txflowblock(dev, true); ++ brcmf_proto_bcdc_txflowblock(dev, true); + devinfo->tx_flowblock = true; + } + spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags); diff --git a/package/kernel/mac80211/patches/323-0007-brcmfmac-move-brcmf_txcomplete-to-bcdc-layer.patch b/package/kernel/mac80211/patches/323-0007-brcmfmac-move-brcmf_txcomplete-to-bcdc-layer.patch new file mode 100644 index 0000000000..9614e53e51 --- /dev/null +++ b/package/kernel/mac80211/patches/323-0007-brcmfmac-move-brcmf_txcomplete-to-bcdc-layer.patch @@ -0,0 +1,122 @@ +From 7b584396b7a760bc77bbde4625f83ef173159d3e Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Fri, 10 Mar 2017 21:17:03 +0000 +Subject: [PATCH] brcmfmac: move brcmf_txcomplete to bcdc layer + +brcmf_txcomplete is invoked by sdio and usb bus module which are using +bcdc protocol. So move it from core module into bcdc layer. + +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 20 ++++++++++++++++++++ + .../net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h | 2 ++ + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 3 --- + .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 18 ------------------ + .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 ++- + .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 +- + 6 files changed, 25 insertions(+), 23 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +@@ -355,6 +355,26 @@ void brcmf_proto_bcdc_txflowblock(struct + brcmf_fws_bus_blocked(drvr, state); + } + ++void ++brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp, ++ bool success) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pub *drvr = bus_if->drvr; ++ struct brcmf_if *ifp; ++ ++ /* await txstatus signal for firmware if active */ ++ if (brcmf_fws_fc_active(drvr->fws)) { ++ if (!success) ++ brcmf_fws_bustxfail(drvr->fws, txp); ++ } else { ++ if (brcmf_proto_bcdc_hdrpull(drvr, false, txp, &ifp)) ++ brcmu_pkt_buf_free_skb(txp); ++ else ++ brcmf_txfinalize(ifp, txp, success); ++ } ++} ++ + static void + brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx, + enum proto_addr_mode addr_mode) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h +@@ -20,6 +20,8 @@ + int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); + void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); + void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state); ++void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp, ++ bool success); + #else + static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; } + static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {} +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -230,9 +230,6 @@ void brcmf_detach(struct device *dev); + /* Indication from bus module that dongle should be reset */ + void brcmf_dev_reset(struct device *dev); + +-/* Notify the bus has transferred the tx packet to firmware */ +-void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success); +- + /* 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 +@@ -383,24 +383,6 @@ void brcmf_txfinalize(struct brcmf_if *i + brcmu_pkt_buf_free_skb(txp); + } + +-void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success) +-{ +- struct brcmf_bus *bus_if = dev_get_drvdata(dev); +- struct brcmf_pub *drvr = bus_if->drvr; +- struct brcmf_if *ifp; +- +- /* await txstatus signal for firmware if active */ +- if (brcmf_fws_fc_active(drvr->fws)) { +- if (!success) +- brcmf_fws_bustxfail(drvr->fws, txp); +- } else { +- if (brcmf_proto_hdrpull(drvr, false, txp, &ifp)) +- brcmu_pkt_buf_free_skb(txp); +- else +- brcmf_txfinalize(ifp, txp, success); +- } +-} +- + static void brcmf_ethtool_get_drvinfo(struct net_device *ndev, + struct ethtool_drvinfo *info) + { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -2266,7 +2266,8 @@ done: + bus->tx_seq = (bus->tx_seq + pktq->qlen) % SDPCM_SEQ_WRAP; + skb_queue_walk_safe(pktq, pkt_next, tmp) { + __skb_unlink(pkt_next, pktq); +- brcmf_txcomplete(bus->sdiodev->dev, pkt_next, ret == 0); ++ brcmf_proto_bcdc_txcomplete(bus->sdiodev->dev, pkt_next, ++ ret == 0); + } + return ret; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -483,7 +483,7 @@ static void brcmf_usb_tx_complete(struct + req->skb); + brcmf_usb_del_fromq(devinfo, req); + +- brcmf_txcomplete(devinfo->dev, req->skb, urb->status == 0); ++ brcmf_proto_bcdc_txcomplete(devinfo->dev, req->skb, urb->status == 0); + req->skb = NULL; + brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req, &devinfo->tx_freecount); + spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags); diff --git a/package/kernel/mac80211/patches/323-0008-brcmfmac-wrap-brcmf_fws_add_interface-into-bcdc-laye.patch b/package/kernel/mac80211/patches/323-0008-brcmfmac-wrap-brcmf_fws_add_interface-into-bcdc-laye.patch new file mode 100644 index 0000000000..a68c6ab0c3 --- /dev/null +++ b/package/kernel/mac80211/patches/323-0008-brcmfmac-wrap-brcmf_fws_add_interface-into-bcdc-laye.patch @@ -0,0 +1,95 @@ +From 9fdc64bbdbe7bd546e0fbcedd2f1c03448c6df42 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Fri, 10 Mar 2017 21:17:04 +0000 +Subject: [PATCH] brcmfmac: wrap brcmf_fws_add_interface into bcdc layer + +fwsignal is only used by bcdc. Create a new protocol interface function +brcmf_proto_add_if for core module to notify protocol layer upon a new +interface is created. + +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 7 +++++++ + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 3 ++- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h | 9 +++++++++ + 4 files changed, 19 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +@@ -399,6 +399,12 @@ static void brcmf_proto_bcdc_rxreorder(s + brcmf_fws_rxreorder(ifp, skb); + } + ++static void ++brcmf_proto_bcdc_add_if(struct brcmf_if *ifp) ++{ ++ brcmf_fws_add_interface(ifp); ++} ++ + int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) + { + struct brcmf_bcdc *bcdc; +@@ -422,6 +428,7 @@ int brcmf_proto_bcdc_attach(struct brcmf + drvr->proto->delete_peer = brcmf_proto_bcdc_delete_peer; + drvr->proto->add_tdls_peer = brcmf_proto_bcdc_add_tdls_peer; + drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder; ++ drvr->proto->add_if = brcmf_proto_bcdc_add_if; + drvr->proto->pd = bcdc; + + drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -990,7 +990,7 @@ int brcmf_bus_started(struct device *dev + if (ret < 0) + goto fail; + +- brcmf_fws_add_interface(ifp); ++ brcmf_proto_add_if(drvr, ifp); + + drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev, + drvr->settings->p2p_enable); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +@@ -25,6 +25,7 @@ + #include "fwsignal.h" + #include "fweh.h" + #include "fwil.h" ++#include "proto.h" + + /** + * struct brcmf_fweh_queue_item - event item on event queue. +@@ -172,7 +173,7 @@ static void brcmf_fweh_handle_if_event(s + if (IS_ERR(ifp)) + return; + if (!is_p2pdev) +- brcmf_fws_add_interface(ifp); ++ brcmf_proto_add_if(drvr, ifp); + if (!drvr->fweh.evt_handler[BRCMF_E_IF]) + if (brcmf_net_attach(ifp, false) < 0) + return; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h +@@ -44,6 +44,7 @@ struct brcmf_proto { + void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx, + u8 peer[ETH_ALEN]); + void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb); ++ void (*add_if)(struct brcmf_if *ifp); + void *pd; + }; + +@@ -118,4 +119,12 @@ brcmf_proto_rxreorder(struct brcmf_if *i + ifp->drvr->proto->rxreorder(ifp, skb); + } + ++static inline void ++brcmf_proto_add_if(struct brcmf_pub *drvr, struct brcmf_if *ifp) ++{ ++ if (!drvr->proto->add_if) ++ return; ++ drvr->proto->add_if(ifp); ++} ++ + #endif /* BRCMFMAC_PROTO_H */ diff --git a/package/kernel/mac80211/patches/323-0009-brcmfmac-wrap-brcmf_fws_del_interface-into-bcdc-laye.patch b/package/kernel/mac80211/patches/323-0009-brcmfmac-wrap-brcmf_fws_del_interface-into-bcdc-laye.patch new file mode 100644 index 0000000000..ded8d7b944 --- /dev/null +++ b/package/kernel/mac80211/patches/323-0009-brcmfmac-wrap-brcmf_fws_del_interface-into-bcdc-laye.patch @@ -0,0 +1,83 @@ +From c02a5eb82056f75615cb48aa540bfd245f489b99 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Fri, 10 Mar 2017 21:17:05 +0000 +Subject: [PATCH] brcmfmac: wrap brcmf_fws_del_interface into bcdc layer + +Create a new protocol interface function brcmf_proto_del_if for core +module to notify protocol layer upon interface deletion. + +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 7 +++++++ + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 4 ++-- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h | 9 +++++++++ + 3 files changed, 18 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +@@ -405,6 +405,12 @@ brcmf_proto_bcdc_add_if(struct brcmf_if + brcmf_fws_add_interface(ifp); + } + ++static void ++brcmf_proto_bcdc_del_if(struct brcmf_if *ifp) ++{ ++ brcmf_fws_del_interface(ifp); ++} ++ + int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) + { + struct brcmf_bcdc *bcdc; +@@ -429,6 +435,7 @@ int brcmf_proto_bcdc_attach(struct brcmf + drvr->proto->add_tdls_peer = brcmf_proto_bcdc_add_tdls_peer; + drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder; + drvr->proto->add_if = brcmf_proto_bcdc_add_if; ++ drvr->proto->del_if = brcmf_proto_bcdc_del_if; + drvr->proto->pd = bcdc; + + drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -706,7 +706,7 @@ void brcmf_remove_interface(struct brcmf + return; + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx, + ifp->ifidx); +- brcmf_fws_del_interface(ifp); ++ brcmf_proto_del_if(ifp->drvr, ifp); + brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked); + } + +@@ -1035,7 +1035,7 @@ fail: + drvr->config = NULL; + } + if (drvr->fws) { +- brcmf_fws_del_interface(ifp); ++ brcmf_proto_del_if(ifp->drvr, ifp); + brcmf_fws_deinit(drvr); + } + brcmf_net_detach(ifp->ndev, false); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h +@@ -45,6 +45,7 @@ struct brcmf_proto { + u8 peer[ETH_ALEN]); + void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb); + void (*add_if)(struct brcmf_if *ifp); ++ void (*del_if)(struct brcmf_if *ifp); + void *pd; + }; + +@@ -127,4 +128,12 @@ brcmf_proto_add_if(struct brcmf_pub *drv + drvr->proto->add_if(ifp); + } + ++static inline void ++brcmf_proto_del_if(struct brcmf_pub *drvr, struct brcmf_if *ifp) ++{ ++ if (!drvr->proto->del_if) ++ return; ++ drvr->proto->del_if(ifp); ++} ++ + #endif /* BRCMFMAC_PROTO_H */ diff --git a/package/kernel/mac80211/patches/323-0010-brcmfmac-wrap-brcmf_fws_reset_interface-into-bcdc-la.patch b/package/kernel/mac80211/patches/323-0010-brcmfmac-wrap-brcmf_fws_reset_interface-into-bcdc-la.patch new file mode 100644 index 0000000000..34e71d8f5c --- /dev/null +++ b/package/kernel/mac80211/patches/323-0010-brcmfmac-wrap-brcmf_fws_reset_interface-into-bcdc-la.patch @@ -0,0 +1,82 @@ +From 66ded1f8b33cdd9d6d3e20f5f8dd23615a110e70 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Fri, 10 Mar 2017 21:17:06 +0000 +Subject: [PATCH] brcmfmac: wrap brcmf_fws_reset_interface into bcdc layer + +Create a new protocol interface function brcmf_proto_reset_if for core +module to notify protocol layer when interface role changes. + +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 7 +++++++ + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 3 +-- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h | 9 +++++++++ + 3 files changed, 17 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +@@ -411,6 +411,12 @@ brcmf_proto_bcdc_del_if(struct brcmf_if + brcmf_fws_del_interface(ifp); + } + ++static void ++brcmf_proto_bcdc_reset_if(struct brcmf_if *ifp) ++{ ++ brcmf_fws_reset_interface(ifp); ++} ++ + int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) + { + struct brcmf_bcdc *bcdc; +@@ -436,6 +442,7 @@ int brcmf_proto_bcdc_attach(struct brcmf + drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder; + drvr->proto->add_if = brcmf_proto_bcdc_add_if; + drvr->proto->del_if = brcmf_proto_bcdc_del_if; ++ drvr->proto->reset_if = brcmf_proto_bcdc_reset_if; + drvr->proto->pd = bcdc; + + drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +@@ -22,7 +22,6 @@ + #include "core.h" + #include "debug.h" + #include "tracepoint.h" +-#include "fwsignal.h" + #include "fweh.h" + #include "fwil.h" + #include "proto.h" +@@ -180,7 +179,7 @@ static void brcmf_fweh_handle_if_event(s + } + + if (ifp && ifevent->action == BRCMF_E_IF_CHANGE) +- brcmf_fws_reset_interface(ifp); ++ brcmf_proto_reset_if(drvr, ifp); + + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h +@@ -46,6 +46,7 @@ struct brcmf_proto { + void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb); + void (*add_if)(struct brcmf_if *ifp); + void (*del_if)(struct brcmf_if *ifp); ++ void (*reset_if)(struct brcmf_if *ifp); + void *pd; + }; + +@@ -136,4 +137,12 @@ brcmf_proto_del_if(struct brcmf_pub *drv + drvr->proto->del_if(ifp); + } + ++static inline void ++brcmf_proto_reset_if(struct brcmf_pub *drvr, struct brcmf_if *ifp) ++{ ++ if (!drvr->proto->reset_if) ++ return; ++ drvr->proto->reset_if(ifp); ++} ++ + #endif /* BRCMFMAC_PROTO_H */ diff --git a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch index 51de76e51f..91831188ac 100644 --- a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1218,6 +1218,7 @@ int __init brcmf_core_init(void) +@@ -1180,6 +1180,7 @@ int __init brcmf_core_init(void) { if (!schedule_work(&brcmf_driver_work)) return -EBUSY;