--- /dev/null
+From 20ec4f57498f8770c7a1a3e2a316fa752a424178 Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+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 <arend.vanspriel@broadcom.com>
+Signed-off-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 10 ++++++++++
+ .../net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h | 1 +
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 --
+ .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 10 ----------
+ .../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);
--- /dev/null
+From 7b584396b7a760bc77bbde4625f83ef173159d3e Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+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 <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../broadcom/brcm80211/brcmfmac/bcdc.c | 20 +++++++++++++++++++
+ .../broadcom/brcm80211/brcmfmac/bcdc.h | 2 ++
+ .../broadcom/brcm80211/brcmfmac/bus.h | 3 ---
+ .../broadcom/brcm80211/brcmfmac/core.c | 18 -----------------
+ .../broadcom/brcm80211/brcmfmac/sdio.c | 3 ++-
+ .../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 struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+--- 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);
--- /dev/null
+From 9fdc64bbdbe7bd546e0fbcedd2f1c03448c6df42 Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+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 <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ 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
+@@ -1000,7 +1000,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 */
--- /dev/null
+From c02a5eb82056f75615cb48aa540bfd245f489b99 Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+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 <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ 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
+@@ -716,7 +716,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);
+ }
+
+@@ -1045,7 +1045,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 */
--- /dev/null
+From 66ded1f8b33cdd9d6d3e20f5f8dd23615a110e70 Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+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 <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ 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 */
--- /dev/null
+From 62c50a34883c6b821d816b6a661e5d47c09d42b2 Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+Date: Tue, 28 Mar 2017 11:43:24 +0100
+Subject: [PATCH] brcmfmac: wrap brcmf_fws_init into bcdc layer
+
+Create a new protocol layer interface brcmf_proto_init_cb for protocol
+layer to finish initialzation after core module components(fweh and
+etc.) are initialized.
+
+Signed-off-by: Franky Lin <franky.lin@broadcom.com>
+Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 7 +++++++
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +-
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h | 9 +++++++++
+ 3 files changed, 17 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
+@@ -417,6 +417,12 @@ brcmf_proto_bcdc_reset_if(struct brcmf_i
+ brcmf_fws_reset_interface(ifp);
+ }
+
++static int
++brcmf_proto_bcdc_init_done(struct brcmf_pub *drvr)
++{
++ return brcmf_fws_init(drvr);
++}
++
+ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
+ {
+ struct brcmf_bcdc *bcdc;
+@@ -443,6 +449,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
+ 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->init_done = brcmf_proto_bcdc_init_done;
+ 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
+@@ -996,7 +996,7 @@ int brcmf_bus_started(struct device *dev
+ }
+ brcmf_feat_attach(drvr);
+
+- ret = brcmf_fws_init(drvr);
++ ret = brcmf_proto_init_done(drvr);
+ if (ret < 0)
+ goto fail;
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
+@@ -47,6 +47,7 @@ struct brcmf_proto {
+ void (*add_if)(struct brcmf_if *ifp);
+ void (*del_if)(struct brcmf_if *ifp);
+ void (*reset_if)(struct brcmf_if *ifp);
++ int (*init_done)(struct brcmf_pub *drvr);
+ void *pd;
+ };
+
+@@ -145,4 +146,12 @@ brcmf_proto_reset_if(struct brcmf_pub *d
+ drvr->proto->reset_if(ifp);
+ }
+
++static inline int
++brcmf_proto_init_done(struct brcmf_pub *drvr)
++{
++ if (!drvr->proto->init_done)
++ return 0;
++ return drvr->proto->init_done(drvr);
++}
++
+ #endif /* BRCMFMAC_PROTO_H */
--- /dev/null
+From 8f9dd1a974380ebe2d7bf82df4e6ba6bfb89c575 Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+Date: Tue, 28 Mar 2017 11:43:25 +0100
+Subject: [PATCH] brcmfmac: move brcmf_fws_deinit to bcdc layer
+
+Move brcmf_fws_deinit into brcmf_proto_bcdc_detach since it is a bcdc
+exclusive feature.
+
+Signed-off-by: Franky Lin <franky.lin@broadcom.com>
+Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 1 +
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 7 -------
+ 2 files changed, 1 insertion(+), 7 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
+@@ -464,6 +464,7 @@ fail:
+
+ void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr)
+ {
++ brcmf_fws_deinit(drvr);
+ kfree(drvr->proto->pd);
+ drvr->proto->pd = NULL;
+ }
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -32,7 +32,6 @@
+ #include "p2p.h"
+ #include "cfg80211.h"
+ #include "fwil.h"
+-#include "fwsignal.h"
+ #include "feature.h"
+ #include "proto.h"
+ #include "pcie.h"
+@@ -1044,10 +1043,6 @@ fail:
+ brcmf_cfg80211_detach(drvr->config);
+ drvr->config = NULL;
+ }
+- if (drvr->fws) {
+- brcmf_proto_del_if(ifp->drvr, ifp);
+- brcmf_fws_deinit(drvr);
+- }
+ brcmf_net_detach(ifp->ndev, false);
+ if (p2p_ifp)
+ brcmf_net_detach(p2p_ifp->ndev, false);
+@@ -1113,8 +1108,6 @@ void brcmf_detach(struct device *dev)
+
+ brcmf_cfg80211_detach(drvr->config);
+
+- brcmf_fws_deinit(drvr);
+-
+ brcmf_bus_stop(drvr->bus_if);
+
+ brcmf_proto_detach(drvr);
--- /dev/null
+From 0cc0236cf713a9ecfcf902e35bd098bc179265a8 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 28 Mar 2017 11:43:26 +0100
+Subject: [PATCH] brcmfmac: add support to move wiphy instance into network
+ namespace
+
+To support network namespace the driver must assure all created
+network interfaces are in the same namespace as the wiphy instance
+and flag the support using WIPHY_FLAG_NETNS_OK.
+
+Verified using two terminals:
+
+ Terminal 1 Terminal 2
+ -------------------------- ---------------------------------
+ # ip netns add brcm-wifi # iw dev
+ phy#0
+ Interface wlan3
+ ifindex 11
+ wdev 0x1
+ # ip netns exec brcm-wifi bash
+ # iw dev
+ # echo $$
+ 20337 # iw phy0 set netns 20337
+ # iw dev
+ phy#0
+ Interface wlan3
+ ifindex 11
+ wdev 0x2
+ # iw phy0 interface add wl3.ap type __ap
+ # iw dev
+ phy#0
+ Interface wl3.ap
+ ifindex 2
+ wdev 0x3
+ Interface wlan3
+ ifindex 11
+ wdev 0x2
+ # iw dev
+ # iw phy0 set netns 1
+ # iw dev
+ # iw dev
+ phy#0
+ Interface wl3.ap
+ ifindex 2
+ wdev 0x5
+ Interface wlan3
+ ifindex 11
+ wdev 0x4
+
+Note:
+ increasing wdev identifier above indicates issue in
+ cfg80211 which is addressed separately.
+
+Tested-by: Mark Asselstine <mark.asselstine@windriver.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 ++-
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+@@ -6453,7 +6453,8 @@ static int brcmf_setup_wiphy(struct wiph
+ BIT(NL80211_BSS_SELECT_ATTR_BAND_PREF) |
+ BIT(NL80211_BSS_SELECT_ATTR_RSSI_ADJUST);
+
+- wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT |
++ wiphy->flags |= WIPHY_FLAG_NETNS_OK |
++ WIPHY_FLAG_PS_ON_BY_DEFAULT |
+ WIPHY_FLAG_OFFCHAN_TX |
+ WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_TDLS))
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -485,8 +485,9 @@ int brcmf_net_attach(struct brcmf_if *if
+ ndev->needed_headroom += drvr->hdrlen;
+ ndev->ethtool_ops = &brcmf_ethtool_ops;
+
+- /* set the mac address */
++ /* set the mac address & netns */
+ memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
++ dev_net_set(ndev, wiphy_net(cfg_to_wiphy(drvr->config)));
+
+ INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list);
+ INIT_WORK(&ifp->ndoffload_work, _brcmf_update_ndtable);
--- /dev/null
+From 78b9ccb81377ba908b2c18daf6e1a7beddc281e3 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Tue, 28 Mar 2017 11:43:28 +0100
+Subject: [PATCH] brcmfmac: no need for d11inf instance in
+ brcmf_pno_start_sched_scan()
+
+In brcmf_pno_start_sched_scan() a local variable is declared and
+assigned for struct brcmu_d11inf. However, there is no other reference
+to it so it is unnecessary.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
+@@ -182,7 +182,6 @@ int brcmf_pno_clean(struct brcmf_if *ifp
+ int brcmf_pno_start_sched_scan(struct brcmf_if *ifp,
+ struct cfg80211_sched_scan_request *req)
+ {
+- struct brcmu_d11inf *d11inf;
+ struct brcmf_pno_config_le pno_cfg;
+ struct cfg80211_ssid *ssid;
+ u16 chan;
+@@ -209,7 +208,6 @@ int brcmf_pno_start_sched_scan(struct br
+ }
+
+ /* configure channels to use */
+- d11inf = &ifp->drvr->config->d11inf;
+ for (i = 0; i < req->n_channels; i++) {
+ chan = req->channels[i]->hw_value;
+ pno_cfg.channel_list[i] = cpu_to_le16(chan);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -539,7 +539,11 @@ static int qcount[NUMPRIO];
+@@ -540,7 +540,11 @@ static int qcount[NUMPRIO];
/* Limit on rounding up frames */
static const uint max_roundup = 512;
--- /dev/null
+From ffb9f18ad8f0e5e1d88c56478bf24e6464c96eee Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Thu, 6 Apr 2017 13:14:37 +0100
+Subject: [PATCH] brcmfmac: rename brcmf_fws_{de,}init to brcmf_fws{at,de}tach
+
+This is a non-functional change to align the fwsignal module to
+the naming pattern used throughout the driver.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 4 ++--
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 6 +++---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h | 4 ++--
+ 3 files changed, 7 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
+@@ -420,7 +420,7 @@ brcmf_proto_bcdc_reset_if(struct brcmf_i
+ static int
+ brcmf_proto_bcdc_init_done(struct brcmf_pub *drvr)
+ {
+- return brcmf_fws_init(drvr);
++ return brcmf_fws_attach(drvr);
+ }
+
+ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
+@@ -464,7 +464,7 @@ fail:
+
+ void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr)
+ {
+- brcmf_fws_deinit(drvr);
++ brcmf_fws_detach(drvr);
+ kfree(drvr->proto->pd);
+ drvr->proto->pd = NULL;
+ }
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
+@@ -2308,7 +2308,7 @@ static int brcmf_debugfs_fws_stats_read(
+ }
+ #endif
+
+-int brcmf_fws_init(struct brcmf_pub *drvr)
++int brcmf_fws_attach(struct brcmf_pub *drvr)
+ {
+ struct brcmf_fws_info *fws;
+ struct brcmf_if *ifp;
+@@ -2408,11 +2408,11 @@ int brcmf_fws_init(struct brcmf_pub *drv
+ return 0;
+
+ fail:
+- brcmf_fws_deinit(drvr);
++ brcmf_fws_detach(drvr);
+ return rc;
+ }
+
+-void brcmf_fws_deinit(struct brcmf_pub *drvr)
++void brcmf_fws_detach(struct brcmf_pub *drvr)
+ {
+ struct brcmf_fws_info *fws = drvr->fws;
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
+@@ -18,8 +18,8 @@
+ #ifndef FWSIGNAL_H_
+ #define FWSIGNAL_H_
+
+-int brcmf_fws_init(struct brcmf_pub *drvr);
+-void brcmf_fws_deinit(struct brcmf_pub *drvr);
++int brcmf_fws_attach(struct brcmf_pub *drvr);
++void brcmf_fws_detach(struct brcmf_pub *drvr);
+ bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws);
+ bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
+ void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
--- /dev/null
+From fc0471e3e884a13d293afae53917ef8ff33b8ae5 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Thu, 6 Apr 2017 13:14:38 +0100
+Subject: [PATCH] brcmfmac: ignore interfaces when fwsignal is disabled
+
+When brcmf_fws_add_interface() is called the struct brcmf_if::fws_desc
+field is initialized regardless the state of the fwsignal functionality,
+ie. the fcmode. This is not needed when fcmode is NONE, which is the
+default mode.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
+@@ -2145,7 +2145,7 @@ void brcmf_fws_add_interface(struct brcm
+ struct brcmf_fws_info *fws = ifp->drvr->fws;
+ struct brcmf_fws_mac_descriptor *entry;
+
+- if (!ifp->ndev)
++ if (!ifp->ndev || fws->fcmode == BRCMF_FWS_FCMODE_NONE)
+ return;
+
+ entry = &fws->desc.iface[ifp->ifidx];
--- /dev/null
+From acf8ac41dd733508b9e77483f96e53610c87fa64 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Thu, 6 Apr 2017 13:14:39 +0100
+Subject: [PATCH] brcmfmac: remove reference to fwsignal data from struct
+ brcmf_pub
+
+The fwsignal module is part of the bcdc protocol and as such does
+its instance data is not needed in core structure. Moving it into
+struct brcmf_bcdc instead.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../broadcom/brcm80211/brcmfmac/bcdc.c | 35 ++++++++++---
+ .../broadcom/brcm80211/brcmfmac/bcdc.h | 1 +
+ .../broadcom/brcm80211/brcmfmac/core.h | 2 -
+ .../broadcom/brcm80211/brcmfmac/fwsignal.c | 51 +++++++++----------
+ .../broadcom/brcm80211/brcmfmac/fwsignal.h | 4 +-
+ 5 files changed, 54 insertions(+), 39 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
+@@ -103,9 +103,17 @@ struct brcmf_bcdc {
+ u8 bus_header[BUS_HEADER_LEN];
+ struct brcmf_proto_bcdc_dcmd msg;
+ unsigned char buf[BRCMF_DCMD_MAXLEN];
++ struct brcmf_fws_info *fws;
+ };
+
+
++struct brcmf_fws_info *drvr_to_fws(struct brcmf_pub *drvr)
++{
++ struct brcmf_bcdc *bcdc = drvr->proto->pd;
++
++ return bcdc->fws;
++}
++
+ static int
+ brcmf_proto_bcdc_msg(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
+ uint len, bool set)
+@@ -330,8 +338,9 @@ static int brcmf_proto_bcdc_tx_queue_dat
+ struct sk_buff *skb)
+ {
+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, ifidx);
++ struct brcmf_bcdc *bcdc = drvr->proto->pd;
+
+- if (!brcmf_fws_queue_skbs(drvr->fws))
++ if (!brcmf_fws_queue_skbs(bcdc->fws))
+ return brcmf_proto_txdata(drvr, ifidx, 0, skb);
+
+ return brcmf_fws_process_skb(ifp, skb);
+@@ -360,15 +369,15 @@ brcmf_proto_bcdc_txcomplete(struct devic
+ bool success)
+ {
+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+- struct brcmf_pub *drvr = bus_if->drvr;
++ struct brcmf_bcdc *bcdc = bus_if->drvr->proto->pd;
+ struct brcmf_if *ifp;
+
+ /* await txstatus signal for firmware if active */
+- if (brcmf_fws_fc_active(drvr->fws)) {
++ if (brcmf_fws_fc_active(bcdc->fws)) {
+ if (!success)
+- brcmf_fws_bustxfail(drvr->fws, txp);
++ brcmf_fws_bustxfail(bcdc->fws, txp);
+ } else {
+- if (brcmf_proto_bcdc_hdrpull(drvr, false, txp, &ifp))
++ if (brcmf_proto_bcdc_hdrpull(bus_if->drvr, false, txp, &ifp))
+ brcmu_pkt_buf_free_skb(txp);
+ else
+ brcmf_txfinalize(ifp, txp, success);
+@@ -420,7 +429,15 @@ brcmf_proto_bcdc_reset_if(struct brcmf_i
+ static int
+ brcmf_proto_bcdc_init_done(struct brcmf_pub *drvr)
+ {
+- return brcmf_fws_attach(drvr);
++ struct brcmf_bcdc *bcdc = drvr->proto->pd;
++ struct brcmf_fws_info *fws;
++
++ fws = brcmf_fws_attach(drvr);
++ if (IS_ERR(fws))
++ return PTR_ERR(fws);
++
++ bcdc->fws = fws;
++ return 0;
+ }
+
+ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
+@@ -464,7 +481,9 @@ fail:
+
+ void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr)
+ {
+- brcmf_fws_detach(drvr);
+- kfree(drvr->proto->pd);
++ struct brcmf_bcdc *bcdc = drvr->proto->pd;
++
+ drvr->proto->pd = NULL;
++ brcmf_fws_detach(bcdc->fws);
++ kfree(bcdc);
+ }
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
+@@ -22,6 +22,7 @@ void brcmf_proto_bcdc_detach(struct brcm
+ void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state);
+ void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp,
+ bool success);
++struct brcmf_fws_info *drvr_to_fws(struct brcmf_pub *drvr);
+ #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/core.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
+@@ -127,8 +127,6 @@ struct brcmf_pub {
+
+ struct brcmf_fweh_info fweh;
+
+- struct brcmf_fws_info *fws;
+-
+ struct brcmf_ampdu_rx_reorder
+ *reorder_flows[BRCMF_AMPDU_RX_REORDER_MAXFLOWS];
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
+@@ -36,6 +36,7 @@
+ #include "p2p.h"
+ #include "cfg80211.h"
+ #include "proto.h"
++#include "bcdc.h"
+ #include "common.h"
+
+ /**
+@@ -1586,7 +1587,7 @@ static int brcmf_fws_notify_credit_map(s
+ const struct brcmf_event_msg *e,
+ void *data)
+ {
+- struct brcmf_fws_info *fws = ifp->drvr->fws;
++ struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
+ int i;
+ u8 *credits = data;
+
+@@ -1617,7 +1618,7 @@ static int brcmf_fws_notify_bcmc_credit_
+ const struct brcmf_event_msg *e,
+ void *data)
+ {
+- struct brcmf_fws_info *fws = ifp->drvr->fws;
++ struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
+
+ if (fws) {
+ brcmf_fws_lock(fws);
+@@ -1826,7 +1827,7 @@ netif_rx:
+ void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
+ {
+ struct brcmf_skb_reorder_data *rd;
+- struct brcmf_fws_info *fws = ifp->drvr->fws;
++ struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
+ u8 *signal_data;
+ s16 data_len;
+ u8 type;
+@@ -2091,8 +2092,7 @@ static int brcmf_fws_assign_htod(struct
+
+ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
+ {
+- struct brcmf_pub *drvr = ifp->drvr;
+- struct brcmf_fws_info *fws = drvr->fws;
++ struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
+ struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb);
+ struct ethhdr *eh = (struct ethhdr *)(skb->data);
+ int fifo = BRCMF_FWS_FIFO_BCMC;
+@@ -2142,7 +2142,7 @@ void brcmf_fws_reset_interface(struct br
+
+ void brcmf_fws_add_interface(struct brcmf_if *ifp)
+ {
+- struct brcmf_fws_info *fws = ifp->drvr->fws;
++ struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
+ struct brcmf_fws_mac_descriptor *entry;
+
+ if (!ifp->ndev || fws->fcmode == BRCMF_FWS_FCMODE_NONE)
+@@ -2160,16 +2160,17 @@ void brcmf_fws_add_interface(struct brcm
+ void brcmf_fws_del_interface(struct brcmf_if *ifp)
+ {
+ struct brcmf_fws_mac_descriptor *entry = ifp->fws_desc;
++ struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
+
+ if (!entry)
+ return;
+
+- brcmf_fws_lock(ifp->drvr->fws);
++ brcmf_fws_lock(fws);
+ ifp->fws_desc = NULL;
+ brcmf_dbg(TRACE, "deleting %s\n", entry->name);
+ brcmf_fws_macdesc_deinit(entry);
+- brcmf_fws_cleanup(ifp->drvr->fws, ifp->ifidx);
+- brcmf_fws_unlock(ifp->drvr->fws);
++ brcmf_fws_cleanup(fws, ifp->ifidx);
++ brcmf_fws_unlock(fws);
+ }
+
+ static void brcmf_fws_dequeue_worker(struct work_struct *worker)
+@@ -2243,7 +2244,7 @@ static void brcmf_fws_dequeue_worker(str
+ static int brcmf_debugfs_fws_stats_read(struct seq_file *seq, void *data)
+ {
+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
+- struct brcmf_fws_stats *fwstats = &bus_if->drvr->fws->stats;
++ struct brcmf_fws_stats *fwstats = &(drvr_to_fws(bus_if->drvr)->stats);
+
+ seq_printf(seq,
+ "header_pulls: %u\n"
+@@ -2308,7 +2309,7 @@ static int brcmf_debugfs_fws_stats_read(
+ }
+ #endif
+
+-int brcmf_fws_attach(struct brcmf_pub *drvr)
++struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr)
+ {
+ struct brcmf_fws_info *fws;
+ struct brcmf_if *ifp;
+@@ -2316,17 +2317,15 @@ int brcmf_fws_attach(struct brcmf_pub *d
+ int rc;
+ u32 mode;
+
+- drvr->fws = kzalloc(sizeof(*(drvr->fws)), GFP_KERNEL);
+- if (!drvr->fws) {
++ fws = kzalloc(sizeof(*fws), GFP_KERNEL);
++ if (!fws) {
+ rc = -ENOMEM;
+ goto fail;
+ }
+
+- fws = drvr->fws;
+-
+ spin_lock_init(&fws->spinlock);
+
+- /* set linkage back */
++ /* store drvr reference */
+ fws->drvr = drvr;
+ fws->fcmode = drvr->settings->fcmode;
+
+@@ -2334,7 +2333,7 @@ int brcmf_fws_attach(struct brcmf_pub *d
+ (fws->fcmode == BRCMF_FWS_FCMODE_NONE)) {
+ fws->avoid_queueing = true;
+ brcmf_dbg(INFO, "FWS queueing will be avoided\n");
+- return 0;
++ return fws;
+ }
+
+ fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq");
+@@ -2396,6 +2395,7 @@ int brcmf_fws_attach(struct brcmf_pub *d
+ brcmf_fws_hanger_init(&fws->hanger);
+ brcmf_fws_macdesc_init(&fws->desc.other, NULL, 0);
+ brcmf_fws_macdesc_set_name(fws, &fws->desc.other);
++ brcmf_dbg(INFO, "added %s\n", fws->desc.other.name);
+ brcmu_pktq_init(&fws->desc.other.psq, BRCMF_FWS_PSQ_PREC_COUNT,
+ BRCMF_FWS_PSQ_LEN);
+
+@@ -2405,27 +2405,24 @@ int brcmf_fws_attach(struct brcmf_pub *d
+
+ brcmf_dbg(INFO, "%s bdcv2 tlv signaling [%x]\n",
+ fws->fw_signals ? "enabled" : "disabled", tlv);
+- return 0;
++ return fws;
+
+ fail:
+- brcmf_fws_detach(drvr);
+- return rc;
++ brcmf_fws_detach(fws);
++ return ERR_PTR(rc);
+ }
+
+-void brcmf_fws_detach(struct brcmf_pub *drvr)
++void brcmf_fws_detach(struct brcmf_fws_info *fws)
+ {
+- struct brcmf_fws_info *fws = drvr->fws;
+-
+ if (!fws)
+ return;
+
+- if (drvr->fws->fws_wq)
+- destroy_workqueue(drvr->fws->fws_wq);
++ if (fws->fws_wq)
++ destroy_workqueue(fws->fws_wq);
+
+ /* cleanup */
+ brcmf_fws_lock(fws);
+ brcmf_fws_cleanup(fws, -1);
+- drvr->fws = NULL;
+ brcmf_fws_unlock(fws);
+
+ /* free top structure */
+@@ -2461,7 +2458,7 @@ void brcmf_fws_bustxfail(struct brcmf_fw
+
+ void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked)
+ {
+- struct brcmf_fws_info *fws = drvr->fws;
++ struct brcmf_fws_info *fws = drvr_to_fws(drvr);
+ struct brcmf_if *ifp;
+ int i;
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
+@@ -18,8 +18,8 @@
+ #ifndef FWSIGNAL_H_
+ #define FWSIGNAL_H_
+
+-int brcmf_fws_attach(struct brcmf_pub *drvr);
+-void brcmf_fws_detach(struct brcmf_pub *drvr);
++struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr);
++void brcmf_fws_detach(struct brcmf_fws_info *fws);
+ bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws);
+ bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
+ void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +++++++++++--
+ .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
- .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 20 ++++++++++++++++----
+ .../broadcom/brcm80211/brcmfmac/cfg80211.c | 20 +++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
--- /dev/null
+From 26ecfe01790381c4caa65ec9cce484c623f092c4 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Fri, 14 Apr 2017 22:27:37 +0100
+Subject: [PATCH] brcmfmac: only build fwsignal module for
+ CONFIG_BRCMFMAC_PROTO_BCDC
+
+The fwsignal module is only referenced by the bcdc module and part of the
+bcdc protocol. So only build it when CONFIG_BRCMFMAC_PROTO_BCDC is selected.
+
+Fixes: acf8ac41dd73 ("brcmfmac: remove reference to fwsignal data from struct brcmf_pub")
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
+@@ -25,7 +25,6 @@ brcmfmac-objs += \
+ chip.o \
+ fwil.o \
+ fweh.o \
+- fwsignal.o \
+ p2p.o \
+ proto.o \
+ common.o \
+@@ -36,7 +35,8 @@ brcmfmac-objs += \
+ vendor.o \
+ pno.o
+ brcmfmac-$(CPTCFG_BRCMFMAC_PROTO_BCDC) += \
+- bcdc.o
++ bcdc.o \
++ fwsignal.o
+ brcmfmac-$(CPTCFG_BRCMFMAC_PROTO_MSGBUF) += \
+ commonring.o \
+ flowring.o \
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -198,7 +198,7 @@ static netdev_tx_t brcmf_netdev_start_xm
+@@ -197,7 +197,7 @@ static netdev_tx_t brcmf_netdev_start_xm
int ret;
struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_pub *drvr = ifp->drvr;
brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
-@@ -236,6 +236,8 @@ static netdev_tx_t brcmf_netdev_start_xm
+@@ -235,6 +235,8 @@ static netdev_tx_t brcmf_netdev_start_xm
goto done;
}
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -211,22 +211,13 @@ static netdev_tx_t brcmf_netdev_start_xm
+@@ -210,22 +210,13 @@ static netdev_tx_t brcmf_netdev_start_xm
goto done;
}
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -3420,7 +3420,7 @@ static int brcmf_sdio_bus_preinit(struct
+@@ -3422,7 +3422,7 @@ static int brcmf_sdio_bus_preinit(struct
/* otherwise, set txglomalign */
value = sdiodev->settings->bus.sdio.sd_sgentry_align;
/* SDIO ADMA requires at least 32 bit alignment */
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -611,7 +611,9 @@ BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340
+@@ -612,7 +612,9 @@ BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340
BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt");
BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt");
BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt");
BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-sdio.bin", "brcmfmac4356-sdio.txt");
-@@ -629,7 +631,8 @@ static struct brcmf_firmware_mapping brc
+@@ -630,7 +632,8 @@ static struct brcmf_firmware_mapping brc
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -6842,7 +6842,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6843,7 +6843,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info));
if (!wiphy) {
brcmf_err("Could not allocate wiphy device\n");
}
memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
set_wiphy_dev(wiphy, busdev);
-@@ -6985,6 +6985,7 @@ priv_out:
+@@ -6986,6 +6986,7 @@ priv_out:
ifp->vif = NULL;
wiphy_out:
brcmf_free_wiphy(wiphy);
break;
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -617,6 +617,7 @@ BRCMF_FW_NVRAM_DEF(43430A1, "brcmfmac434
+@@ -618,6 +618,7 @@ BRCMF_FW_NVRAM_DEF(43430A1, "brcmfmac434
BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-sdio.bin", "brcmfmac4356-sdio.txt");
static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
-@@ -635,7 +636,8 @@ static struct brcmf_firmware_mapping brc
+@@ -636,7 +637,8 @@ static struct brcmf_firmware_mapping brc
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430A1),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354),
static void pkt_align(struct sk_buff *p, int len, int align)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-@@ -49,6 +49,7 @@ BRCMF_FW_DEF(43143, "brcmfmac43143.bin")
+@@ -50,6 +50,7 @@ BRCMF_FW_DEF(43143, "brcmfmac43143.bin")
BRCMF_FW_DEF(43236B, "brcmfmac43236b.bin");
BRCMF_FW_DEF(43242A, "brcmfmac43242a.bin");
BRCMF_FW_DEF(43569, "brcmfmac43569.bin");
static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = {
BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
-@@ -57,7 +58,8 @@ static struct brcmf_firmware_mapping brc
+@@ -58,7 +59,8 @@ static struct brcmf_firmware_mapping brc
BRCMF_FW_ENTRY(BRCM_CC_43238_CHIP_ID, 0x00000008, 43236B),
BRCMF_FW_ENTRY(BRCM_CC_43242_CHIP_ID, 0xFFFFFFFF, 43242A),
BRCMF_FW_ENTRY(BRCM_CC_43566_CHIP_ID, 0xFFFFFFFF, 43569),
};
#define TRX_MAGIC 0x30524448 /* "HDR0" */
-@@ -1461,15 +1463,20 @@ static int brcmf_usb_reset_resume(struct
+@@ -1462,15 +1464,20 @@ static int brcmf_usb_reset_resume(struct
#define LINKSYS_USB_DEVICE(dev_id) \
{ USB_DEVICE(BRCM_USB_VENDOR_ID_LINKSYS, dev_id) }
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -259,10 +259,11 @@ struct rte_console {
+@@ -260,10 +260,11 @@ struct rte_console {
#define I_HMB_HOST_INT I_HMB_SW3 /* Miscellaneous Interrupt */
/* tohostmailboxdata */
#define HMB_DATA_FCDATA_MASK 0xff000000
#define HMB_DATA_FCDATA_SHIFT 24
-@@ -1093,6 +1094,10 @@ static u32 brcmf_sdio_hostmail(struct br
+@@ -1094,6 +1095,10 @@ static u32 brcmf_sdio_hostmail(struct br
offsetof(struct sdpcmd_regs, tosbmailbox));
bus->sdcnt.f1regdata += 2;
/* Dongle recomposed rx frames, accept them again */
if (hmb_data & HMB_DATA_NAKHANDLED) {
brcmf_dbg(SDIO, "Dongle reports NAK handled, expect rtx of %d\n",
-@@ -1150,6 +1155,7 @@ static u32 brcmf_sdio_hostmail(struct br
+@@ -1151,6 +1156,7 @@ static u32 brcmf_sdio_hostmail(struct br
HMB_DATA_NAKHANDLED |
HMB_DATA_FC |
HMB_DATA_FWREADY |
union {
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -192,6 +192,37 @@ static void brcmf_netdev_set_multicast_l
+@@ -191,6 +191,37 @@ static void brcmf_netdev_set_multicast_l
schedule_work(&ifp->multicast_work);
}
static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
struct net_device *ndev)
{
-@@ -211,6 +242,23 @@ static netdev_tx_t brcmf_netdev_start_xm
+@@ -210,6 +241,23 @@ static netdev_tx_t brcmf_netdev_start_xm
goto done;
}
/* Make sure there's enough writable headroom*/
ret = skb_cow_head(skb, drvr->hdrlen);
if (ret < 0) {
-@@ -288,6 +336,15 @@ void brcmf_txflowblock(struct device *de
+@@ -277,6 +325,15 @@ void brcmf_txflowblock_if(struct brcmf_i
void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
{
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -6775,7 +6775,7 @@ static void brcmf_cfg80211_reg_notifier(
+@@ -6776,7 +6776,7 @@ static void brcmf_cfg80211_reg_notifier(
return;
/* ignore non-ISO3166 country codes */
}
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1058,6 +1058,11 @@ int brcmf_bus_started(struct device *dev
+@@ -1030,6 +1030,11 @@ int brcmf_bus_started(struct device *dev
/* signal bus ready */
brcmf_bus_change_state(bus_if, BRCMF_BUS_UP);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -961,55 +961,6 @@ static int brcmf_inet6addr_changed(struc
+@@ -933,55 +933,6 @@ static int brcmf_inet6addr_changed(struc
}
#endif
static int brcmf_revinfo_read(struct seq_file *s, void *data)
{
struct brcmf_bus *bus_if = dev_get_drvdata(s->private);
-@@ -1141,6 +1092,55 @@ fail:
+@@ -1109,6 +1060,55 @@ fail:
return ret;
}
u32 nmode = 0;
u32 vhtmode = 0;
u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
-@@ -6764,8 +6768,8 @@ static s32 brcmf_translate_country_code(
+@@ -6765,8 +6769,8 @@ static s32 brcmf_translate_country_code(
static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *req)
{
struct brcmf_fil_country_le ccreq;
s32 err;
int i;
-@@ -6800,7 +6804,7 @@ static void brcmf_cfg80211_reg_notifier(
+@@ -6801,7 +6805,7 @@ static void brcmf_cfg80211_reg_notifier(
brcmf_err("Firmware rejected country setting\n");
return;
}
}
static void brcmf_free_wiphy(struct wiphy *wiphy)
-@@ -6827,17 +6831,15 @@ static void brcmf_free_wiphy(struct wiph
+@@ -6828,17 +6832,15 @@ static void brcmf_free_wiphy(struct wiph
if (wiphy->wowlan != &brcmf_wowlan_support)
kfree(wiphy->wowlan);
#endif
struct brcmf_cfg80211_vif *vif;
struct brcmf_if *ifp;
s32 err = 0;
-@@ -6849,26 +6851,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6850,26 +6852,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
return NULL;
}
cfg->pub = drvr;
init_vif_event(&cfg->vif_event);
INIT_LIST_HEAD(&cfg->vif_list);
-@@ -6877,6 +6866,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6878,6 +6867,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
if (IS_ERR(vif))
goto wiphy_out;
vif->ifp = ifp;
vif->wdev.netdev = ndev;
ndev->ieee80211_ptr = &vif->wdev;
-@@ -6903,6 +6893,11 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6904,6 +6894,11 @@ struct brcmf_cfg80211_info *brcmf_cfg802
if (err < 0)
goto priv_out;
brcmf_dbg(INFO, "Registering custom regulatory\n");
wiphy->reg_notifier = brcmf_cfg80211_reg_notifier;
wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
-@@ -6916,13 +6911,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6917,13 +6912,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802
cap = &wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap;
*cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
}
if (err) {
brcmf_err("Setting wiphy bands failed (%d)\n", err);
goto wiphy_unreg_out;
-@@ -6939,12 +6938,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6940,12 +6939,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
else
*cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
}
err = brcmf_fweh_activate_events(ifp);
if (err) {
brcmf_err("FWEH activation failed (%d)\n", err);
-@@ -7004,8 +6998,7 @@ priv_out:
+@@ -7005,8 +6999,7 @@ priv_out:
ifp->vif = NULL;
wiphy_out:
brcmf_free_wiphy(wiphy);
return NULL;
}
-@@ -7016,7 +7009,8 @@ void brcmf_cfg80211_detach(struct brcmf_
+@@ -7017,7 +7010,8 @@ void brcmf_cfg80211_detach(struct brcmf_
brcmf_btcoex_detach(cfg);
wiphy_unregister(cfg->wiphy);
err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO,
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1036,7 +1036,7 @@ int brcmf_bus_started(struct device *dev
+@@ -1008,7 +1008,7 @@ int brcmf_bus_started(struct device *dev
- brcmf_fws_add_interface(ifp);
+ brcmf_proto_add_if(drvr, ifp);
- drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev,
+ drvr->config = brcmf_cfg80211_attach(drvr, drvr->cfg80211_ops,
drvr->settings->p2p_enable);
if (drvr->config == NULL) {
ret = -ENOMEM;
-@@ -1095,17 +1095,26 @@ fail:
+@@ -1063,17 +1063,26 @@ fail:
int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
{
for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++)
drvr->if2bss[i] = BRCMF_BSSIDX_INVALID;
-@@ -1134,10 +1143,12 @@ int brcmf_attach(struct device *dev, str
+@@ -1102,10 +1111,12 @@ int brcmf_attach(struct device *dev, str
/* attach firmware event handler */
brcmf_fweh_attach(drvr);
return ret;
}
-@@ -1195,6 +1206,7 @@ void brcmf_detach(struct device *dev)
+@@ -1163,6 +1174,7 @@ void brcmf_detach(struct device *dev)
brcmf_remove_interface(drvr->iflist[i], false);
brcmf_cfg80211_detach(drvr->config);
+ drvr->config = NULL;
- brcmf_fws_deinit(drvr);
+ brcmf_bus_stop(drvr->bus_if);
-@@ -1204,7 +1216,7 @@ void brcmf_detach(struct device *dev)
+@@ -1170,7 +1182,7 @@ void brcmf_detach(struct device *dev)
brcmf_debug_detach(drvr);
bus_if->drvr = NULL;
struct brcmf_cfg80211_info *config;
/* Internal brcmf items */
-@@ -143,6 +144,9 @@ struct brcmf_pub {
+@@ -141,6 +142,9 @@ struct brcmf_pub {
struct notifier_block inetaddr_notifier;
struct notifier_block inet6addr_notifier;
struct brcmf_mp_device *settings;
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -6489,6 +6489,7 @@ static int brcmf_setup_wiphy(struct wiph
- BIT(NL80211_BSS_SELECT_ATTR_RSSI_ADJUST);
+@@ -6490,6 +6490,7 @@ static int brcmf_setup_wiphy(struct wiph
- wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT |
+ wiphy->flags |= WIPHY_FLAG_NETNS_OK |
+ WIPHY_FLAG_PS_ON_BY_DEFAULT |
+ WIPHY_FLAG_HAVE_AP_SME |
WIPHY_FLAG_OFFCHAN_TX |
WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -231,6 +231,8 @@ void brcmf_detach(struct device *dev);
+@@ -229,6 +229,8 @@ 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);
+/* Request from bus module to initiate a coredump */
+void brcmf_dev_coredump(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
-@@ -1175,6 +1175,14 @@ void brcmf_dev_reset(struct device *dev)
+@@ -1143,6 +1143,14 @@ void brcmf_dev_reset(struct device *dev)
brcmf_fil_cmd_int_set(drvr->iflist[0], BRCMF_C_TERMINATED, 1);
}
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -1078,6 +1078,7 @@ static void brcmf_sdio_get_console_addr(
+@@ -1079,6 +1079,7 @@ static void brcmf_sdio_get_console_addr(
static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus)
{
u32 intstatus = 0;
u32 hmb_data;
u8 fcbits;
-@@ -1095,8 +1096,10 @@ static u32 brcmf_sdio_hostmail(struct br
+@@ -1096,8 +1097,10 @@ static u32 brcmf_sdio_hostmail(struct br
bus->sdcnt.f1regdata += 2;
/* dongle indicates the firmware has halted/crashed */
#include <net/ipv6.h>
#include <brcmu_utils.h>
#include <brcmu_wifi.h>
-@@ -367,6 +368,34 @@ void brcmf_netif_rx(struct brcmf_if *ifp
+@@ -356,6 +357,34 @@ void brcmf_netif_rx(struct brcmf_if *ifp
netif_rx_ni(skb);
}
struct mutex proto_block;
unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
-@@ -219,6 +220,7 @@ void brcmf_txflowblock_if(struct brcmf_i
+@@ -217,6 +218,7 @@ void brcmf_txflowblock_if(struct brcmf_i
enum brcmf_netif_stop_reason reason, bool state);
void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1132,7 +1132,7 @@ int brcmf_attach(struct device *dev, str
+@@ -1100,7 +1100,7 @@ int brcmf_attach(struct device *dev, str
brcmf_dbg(TRACE, "Enter\n");
wiphy->wowlan = &brcmf_wowlan_support;
return;
}
-@@ -6528,7 +6575,7 @@ static int brcmf_setup_wiphy(struct wiph
+@@ -6529,7 +6576,7 @@ static int brcmf_setup_wiphy(struct wiph
err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
sizeof(bandlist));
if (err) {
return err;
}
/* first entry in bandlist is number of bands */
-@@ -6800,8 +6847,8 @@ static void brcmf_cfg80211_reg_notifier(
+@@ -6801,8 +6848,8 @@ static void brcmf_cfg80211_reg_notifier(
/* ignore non-ISO3166 country codes */
for (i = 0; i < 2; i++)
if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
return;
}
-@@ -6810,7 +6857,7 @@ static void brcmf_cfg80211_reg_notifier(
+@@ -6811,7 +6858,7 @@ static void brcmf_cfg80211_reg_notifier(
err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
if (err) {
return;
}
-@@ -6820,7 +6867,7 @@ static void brcmf_cfg80211_reg_notifier(
+@@ -6821,7 +6868,7 @@ static void brcmf_cfg80211_reg_notifier(
err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
if (err) {
return;
}
brcmf_setup_wiphybands(cfg);
-@@ -6866,13 +6913,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6867,13 +6914,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
u16 *cap = NULL;
if (!ndev) {
return NULL;
}
-@@ -6893,7 +6940,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6894,7 +6941,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
err = wl_init_priv(cfg);
if (err) {
brcmf_free_vif(vif);
goto wiphy_out;
}
-@@ -6902,7 +6949,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6903,7 +6950,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
/* determine d11 io type before wiphy setup */
err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
if (err) {
goto priv_out;
}
cfg->d11inf.io_type = (u8)io_type;
-@@ -6936,13 +6983,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6937,13 +6984,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
#endif
err = wiphy_register(wiphy);
if (err < 0) {
goto wiphy_unreg_out;
}
-@@ -6960,18 +7007,18 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6961,18 +7008,18 @@ struct brcmf_cfg80211_info *brcmf_cfg802
err = brcmf_fweh_activate_events(ifp);
if (err) {
brcmf_p2p_detach(&cfg->p2p);
goto wiphy_unreg_out;
}
-@@ -6990,7 +7037,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6991,7 +7038,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
/* (re-) activate FWEH event handling */
err = brcmf_fweh_activate_events(ifp);
if (err) {
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -43,6 +43,36 @@
+@@ -42,6 +42,36 @@
#define BRCMF_BSSIDX_INVALID -1
char *brcmf_ifname(struct brcmf_if *ifp)
{
if (!ifp)
-@@ -372,6 +402,35 @@ void brcmf_netif_mon_rx(struct brcmf_if
+@@ -361,6 +391,35 @@ void brcmf_netif_mon_rx(struct brcmf_if
{
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_RADIOTAP)) {
/* Do nothing */
wiphy->wowlan = &brcmf_wowlan_support;
return;
}
-@@ -6585,7 +6634,7 @@ static int brcmf_setup_wiphy(struct wiph
+@@ -6586,7 +6635,7 @@ static int brcmf_setup_wiphy(struct wiph
err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
sizeof(bandlist));
if (err) {
return err;
}
/* first entry in bandlist is number of bands */
-@@ -6846,6 +6895,7 @@ static void brcmf_cfg80211_reg_notifier(
+@@ -6847,6 +6896,7 @@ static void brcmf_cfg80211_reg_notifier(
{
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
struct brcmf_fil_country_le ccreq;
s32 err;
int i;
-@@ -6857,7 +6907,7 @@ static void brcmf_cfg80211_reg_notifier(
+@@ -6858,7 +6908,7 @@ static void brcmf_cfg80211_reg_notifier(
/* ignore non-ISO3166 country codes */
for (i = 0; i < 2; i++)
if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
req->alpha2[0], req->alpha2[1]);
return;
}
-@@ -6867,7 +6917,7 @@ static void brcmf_cfg80211_reg_notifier(
+@@ -6868,7 +6918,7 @@ static void brcmf_cfg80211_reg_notifier(
err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
if (err) {
return;
}
-@@ -6877,7 +6927,7 @@ static void brcmf_cfg80211_reg_notifier(
+@@ -6878,7 +6928,7 @@ static void brcmf_cfg80211_reg_notifier(
err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
if (err) {
return;
}
brcmf_setup_wiphybands(cfg);
-@@ -6923,13 +6973,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6924,13 +6974,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
u16 *cap = NULL;
if (!ndev) {
return NULL;
}
-@@ -6950,7 +7000,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6951,7 +7001,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
err = wl_init_priv(cfg);
if (err) {
brcmf_free_vif(vif);
goto wiphy_out;
}
-@@ -6959,7 +7009,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6960,7 +7010,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
/* determine d11 io type before wiphy setup */
err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
if (err) {
goto priv_out;
}
cfg->d11inf.io_type = (u8)io_type;
-@@ -6993,13 +7043,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -6994,13 +7044,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
#endif
err = wiphy_register(wiphy);
if (err < 0) {
goto wiphy_unreg_out;
}
-@@ -7017,18 +7067,18 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -7018,18 +7068,18 @@ struct brcmf_cfg80211_info *brcmf_cfg802
err = brcmf_fweh_activate_events(ifp);
if (err) {
brcmf_p2p_detach(&cfg->p2p);
goto wiphy_unreg_out;
}
-@@ -7047,7 +7097,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+@@ -7048,7 +7098,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
/* (re-) activate FWEH event handling */
err = brcmf_fweh_activate_events(ifp);
if (err) {
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-@@ -169,8 +169,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf
+@@ -177,8 +177,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf
ret = brcmf_proto_bcdc_msg(drvr, ifidx, cmd, buf, len, false);
if (ret < 0) {
goto done;
}
-@@ -186,9 +186,9 @@ retry:
+@@ -194,9 +194,9 @@ retry:
if ((id < bcdc->reqid) && (++retries < RETRIES))
goto retry;
if (id != bcdc->reqid) {
ret = -EINVAL;
goto done;
}
-@@ -234,9 +234,9 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
+@@ -242,9 +242,9 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
id = (flags & BCDC_DCMD_ID_MASK) >> BCDC_DCMD_ID_SHIFT;
if (id != bcdc->reqid) {
ret = -EINVAL;
goto done;
}
-@@ -299,8 +299,8 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
+@@ -307,8 +307,8 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
}
if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
BCDC_PROTO_VER) {
return -EBADE;
}
-@@ -379,7 +379,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
+@@ -450,7 +450,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
/* ensure that the msg buf directly follows the cdc msg struct */
if ((unsigned long)(&bcdc->msg + 1) != (unsigned long)bcdc->buf) {
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -90,7 +90,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
+@@ -89,7 +89,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
s32 bsscfgidx;
if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
return NULL;
}
-@@ -104,7 +104,9 @@ struct brcmf_if *brcmf_get_ifp(struct br
+@@ -103,7 +103,9 @@ struct brcmf_if *brcmf_get_ifp(struct br
static void _brcmf_set_multicast_list(struct work_struct *work)
{
struct net_device *ndev;
struct netdev_hw_addr *ha;
u32 cmd_value, cnt;
-@@ -113,8 +115,6 @@ static void _brcmf_set_multicast_list(st
+@@ -112,8 +114,6 @@ static void _brcmf_set_multicast_list(st
u32 buflen;
s32 err;
brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
ndev = ifp->ndev;
-@@ -144,7 +144,7 @@ static void _brcmf_set_multicast_list(st
+@@ -143,7 +143,7 @@ static void _brcmf_set_multicast_list(st
err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen);
if (err < 0) {
cmd_value = cnt ? true : cmd_value;
}
-@@ -157,24 +157,24 @@ static void _brcmf_set_multicast_list(st
+@@ -156,24 +156,24 @@ static void _brcmf_set_multicast_list(st
*/
err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value);
if (err < 0)
/* clear the table in firmware */
ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0);
if (ret) {
-@@ -187,7 +187,7 @@ static void _brcmf_update_ndtable(struct
+@@ -186,7 +186,7 @@ static void _brcmf_update_ndtable(struct
&ifp->ipv6_addr_tbl[i],
sizeof(struct in6_addr));
if (ret)
}
}
#else
-@@ -200,6 +200,7 @@ static int brcmf_netdev_set_mac_address(
+@@ -199,6 +199,7 @@ static int brcmf_netdev_set_mac_address(
{
struct brcmf_if *ifp = netdev_priv(ndev);
struct sockaddr *sa = (struct sockaddr *)addr;
int err;
brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
-@@ -207,7 +208,7 @@ static int brcmf_netdev_set_mac_address(
+@@ -206,7 +207,7 @@ static int brcmf_netdev_set_mac_address(
err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data,
ETH_ALEN);
if (err < 0) {
} else {
brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN);
-@@ -266,7 +267,7 @@ static netdev_tx_t brcmf_netdev_start_xm
+@@ -265,7 +266,7 @@ static netdev_tx_t brcmf_netdev_start_xm
/* Can the device send data? */
if (drvr->bus_if->state != BRCMF_BUS_UP) {
netif_stop_queue(ndev);
dev_kfree_skb(skb);
ret = -ENODEV;
-@@ -604,7 +605,7 @@ static int brcmf_netdev_open(struct net_
+@@ -575,7 +576,7 @@ static int brcmf_netdev_open(struct net_
/* If bus is not ready, can't continue */
if (bus_if->state != BRCMF_BUS_UP) {
return -EAGAIN;
}
-@@ -618,7 +619,7 @@ static int brcmf_netdev_open(struct net_
+@@ -589,7 +590,7 @@ static int brcmf_netdev_open(struct net_
ndev->features &= ~NETIF_F_IP_CSUM;
if (brcmf_cfg80211_up(ndev)) {
return -EIO;
}
-@@ -663,7 +664,7 @@ int brcmf_net_attach(struct brcmf_if *if
+@@ -635,7 +636,7 @@ int brcmf_net_attach(struct brcmf_if *if
else
err = register_netdev(ndev);
if (err != 0) {
goto fail;
}
-@@ -739,6 +740,7 @@ static const struct net_device_ops brcmf
+@@ -711,6 +712,7 @@ static const struct net_device_ops brcmf
static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
{
struct net_device *ndev;
brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
-@@ -751,7 +753,7 @@ static int brcmf_net_p2p_attach(struct b
+@@ -723,7 +725,7 @@ static int brcmf_net_p2p_attach(struct b
memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
if (register_netdev(ndev) != 0) {
goto fail;
}
-@@ -781,8 +783,8 @@ struct brcmf_if *brcmf_add_if(struct brc
+@@ -753,8 +755,8 @@ struct brcmf_if *brcmf_add_if(struct brc
*/
if (ifp) {
if (ifidx) {
netif_stop_queue(ifp->ndev);
brcmf_net_detach(ifp->ndev, false);
drvr->iflist[bsscfgidx] = NULL;
-@@ -840,7 +842,7 @@ static void brcmf_del_if(struct brcmf_pu
+@@ -812,7 +814,7 @@ static void brcmf_del_if(struct brcmf_pu
ifp = drvr->iflist[bsscfgidx];
drvr->iflist[bsscfgidx] = NULL;
if (!ifp) {
return;
}
brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx,
-@@ -890,16 +892,17 @@ static int brcmf_psm_watchdog_notify(str
+@@ -862,16 +864,17 @@ static int brcmf_psm_watchdog_notify(str
const struct brcmf_event_msg *evtmsg,
void *data)
{
return err;
}
-@@ -943,7 +946,7 @@ static int brcmf_inetaddr_changed(struct
+@@ -915,7 +918,7 @@ static int brcmf_inetaddr_changed(struct
ret = brcmf_fil_iovar_data_get(ifp, "arp_hostip", addr_table,
sizeof(addr_table));
if (ret) {
return NOTIFY_OK;
}
-@@ -960,7 +963,7 @@ static int brcmf_inetaddr_changed(struct
+@@ -932,7 +935,7 @@ static int brcmf_inetaddr_changed(struct
ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
&ifa->ifa_address, sizeof(ifa->ifa_address));
if (ret)
}
break;
case NETDEV_DOWN:
-@@ -972,8 +975,8 @@ static int brcmf_inetaddr_changed(struct
+@@ -944,8 +947,8 @@ static int brcmf_inetaddr_changed(struct
ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear",
NULL, 0);
if (ret) {
return NOTIFY_OK;
}
for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
-@@ -983,8 +986,8 @@ static int brcmf_inetaddr_changed(struct
+@@ -955,8 +958,8 @@ static int brcmf_inetaddr_changed(struct
&addr_table[i],
sizeof(addr_table[i]));
if (ret)
}
}
break;
-@@ -1161,7 +1164,7 @@ int brcmf_bus_started(struct device *dev
+@@ -1133,7 +1136,7 @@ int brcmf_bus_started(struct device *dev
return 0;
fail:
if (drvr->config) {
brcmf_cfg80211_detach(drvr->config);
drvr->config = NULL;
-@@ -1220,7 +1223,7 @@ int brcmf_attach(struct device *dev, str
+@@ -1188,7 +1191,7 @@ int brcmf_attach(struct device *dev, str
/* Attach and link in the protocol */
ret = brcmf_proto_attach(drvr);
if (ret != 0) {
goto fail;
}
-@@ -1330,6 +1333,7 @@ static int brcmf_get_pend_8021x_cnt(stru
+@@ -1296,6 +1299,7 @@ static int brcmf_get_pend_8021x_cnt(stru
int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp)
{
int err;
err = wait_event_timeout(ifp->pend_8021x_wait,
-@@ -1337,7 +1341,7 @@ int brcmf_netdev_wait_pend8021x(struct b
+@@ -1303,7 +1307,7 @@ int brcmf_netdev_wait_pend8021x(struct b
MAX_WAIT_FOR_8021X_TX);
if (!err)
@@ -181,7 +182,8 @@ 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);
+ err = brcmf_fweh_call_event_handler(drvr, ifp, emsg->event_code, emsg,
ifp->bsscfgidx, name, len);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
-@@ -1250,6 +1250,7 @@ static int brcmf_fws_enq(struct brcmf_fw
+@@ -1251,6 +1251,7 @@ static int brcmf_fws_enq(struct brcmf_fw
enum brcmf_fws_skb_state state, int fifo,
struct sk_buff *p)
{
int prec = 2 * fifo;
u32 *qfull_stat = &fws->stats.delayq_full_error;
struct brcmf_fws_mac_descriptor *entry;
-@@ -1262,7 +1263,7 @@ static int brcmf_fws_enq(struct brcmf_fw
+@@ -1263,7 +1264,7 @@ static int brcmf_fws_enq(struct brcmf_fw
entry = brcmf_skbcb(p)->mac;
if (entry == NULL) {
return -ENOENT;
}
-@@ -1452,6 +1453,7 @@ static int
+@@ -1453,6 +1454,7 @@ static int
brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot,
u32 genbit, u16 seq)
{
u32 fifo;
int ret;
bool remove_from_hanger = true;
-@@ -1475,12 +1477,12 @@ brcmf_fws_txs_process(struct brcmf_fws_i
+@@ -1476,12 +1478,12 @@ brcmf_fws_txs_process(struct brcmf_fws_i
else if (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED)
fws->stats.txs_host_tossed++;
else
return ret;
}
-@@ -1586,12 +1588,13 @@ static int brcmf_fws_notify_credit_map(s
+@@ -1587,12 +1589,13 @@ static int brcmf_fws_notify_credit_map(s
const struct brcmf_event_msg *e,
void *data)
{
-- struct brcmf_fws_info *fws = ifp->drvr->fws;
+- struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
+ struct brcmf_pub *drvr = ifp->drvr;
-+ struct brcmf_fws_info *fws = drvr->fws;
++ struct brcmf_fws_info *fws = drvr_to_fws(drvr);
int i;
u8 *credits = data;
return -EINVAL;
}
if (fws->creditmap_received)
-@@ -1653,6 +1656,7 @@ static void brcmf_rxreorder_get_skb_list
+@@ -1654,6 +1657,7 @@ static void brcmf_rxreorder_get_skb_list
void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
{
u8 *reorder_data;
u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
struct brcmf_ampdu_rx_reorder *rfi;
-@@ -1667,7 +1671,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
+@@ -1668,7 +1672,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
/* validate flags and flow id */
if (flags == 0xFF) {
brcmf_netif_rx(ifp, pkt);
return;
}
-@@ -1704,7 +1708,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
+@@ -1705,7 +1709,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
flow_id, max_idx);
rfi = kzalloc(buf_size, GFP_ATOMIC);
if (rfi == NULL) {
brcmf_netif_rx(ifp, pkt);
return;
}
-@@ -1969,6 +1973,7 @@ static u8 brcmf_fws_precommit_skb(struct
+@@ -1970,6 +1974,7 @@ static u8 brcmf_fws_precommit_skb(struct
static void brcmf_fws_rollback_toq(struct brcmf_fws_info *fws,
struct sk_buff *skb, int fifo)
{
struct brcmf_fws_mac_descriptor *entry;
struct sk_buff *pktout;
int qidx, hslot;
-@@ -1982,11 +1987,11 @@ static void brcmf_fws_rollback_toq(struc
+@@ -1983,11 +1988,11 @@ static void brcmf_fws_rollback_toq(struc
pktout = brcmu_pktq_penq_head(&entry->psq, qidx, skb);
if (pktout == NULL) {
rc = -ENOENT;
}
-@@ -2120,7 +2125,7 @@ int brcmf_fws_process_skb(struct brcmf_i
+@@ -2092,7 +2097,8 @@ static int brcmf_fws_assign_htod(struct
+
+ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
+ {
+- struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
++ struct brcmf_pub *drvr = ifp->drvr;
++ struct brcmf_fws_info *fws = drvr_to_fws(drvr);
+ struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb);
+ struct ethhdr *eh = (struct ethhdr *)(skb->data);
+ int fifo = BRCMF_FWS_FIFO_BCMC;
+@@ -2120,7 +2126,7 @@ int brcmf_fws_process_skb(struct brcmf_i
brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb);
brcmf_fws_schedule_deq(fws);
} else {
brcmf_txfinalize(ifp, skb, false);
rc = -ENOMEM;
}
-@@ -2339,7 +2344,7 @@ int brcmf_fws_init(struct brcmf_pub *drv
+@@ -2338,7 +2344,7 @@ struct brcmf_fws_info *brcmf_fws_attach(
fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq");
if (fws->fws_wq == NULL) {
rc = -EBADF;
goto fail;
}
-@@ -2355,13 +2360,13 @@ int brcmf_fws_init(struct brcmf_pub *drv
+@@ -2354,13 +2360,13 @@ struct brcmf_fws_info *brcmf_fws_attach(
rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP,
brcmf_fws_notify_credit_map);
if (rc < 0) {
brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP);
goto fail;
}
-@@ -2373,7 +2378,7 @@ int brcmf_fws_init(struct brcmf_pub *drv
+@@ -2372,7 +2378,7 @@ struct brcmf_fws_info *brcmf_fws_attach(
fws->fw_signals = true;
ifp = brcmf_get_ifp(drvr, 0);
if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
struct cfg80211_sched_scan_request *req)
{
+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmu_d11inf *d11inf;
struct brcmf_pno_config_le pno_cfg;
struct cfg80211_ssid *ssid;
-@@ -191,7 +195,7 @@ int brcmf_pno_start_sched_scan(struct br
+ u16 chan;
+@@ -190,7 +194,7 @@ int brcmf_pno_start_sched_scan(struct br
/* clean up everything */
ret = brcmf_pno_clean(ifp);
if (ret < 0) {
/* Data struct for the MSGBUF_TYPE_RING_STATUS */
struct msgbuf_ring_status {
struct msgbuf_common_hdr msg;
-@@ -1194,6 +1202,18 @@ brcmf_msgbuf_process_rx_complete(struct
+@@ -1192,6 +1200,18 @@ brcmf_msgbuf_process_rx_complete(struct
brcmf_netif_rx(ifp, skb);
}
static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
void *buf)
{
-@@ -1273,6 +1293,10 @@ static void brcmf_msgbuf_process_msgtype
+@@ -1271,6 +1291,10 @@ static void brcmf_msgbuf_process_msgtype
msg = (struct msgbuf_common_hdr *)buf;
switch (msg->msgtype) {
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -233,6 +233,8 @@ void brcmf_dev_reset(struct device *dev)
- void brcmf_txflowblock(struct device *dev, bool state);
+@@ -231,6 +231,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);
- /* 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
-@@ -1274,6 +1274,16 @@ void brcmf_dev_coredump(struct device *d
+@@ -1242,6 +1242,16 @@ void brcmf_dev_coredump(struct device *d
brcmf_dbg(TRACE, "failed to create coredump\n");
}
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -1097,8 +1097,8 @@ static u32 brcmf_sdio_hostmail(struct br
+@@ -1098,8 +1098,8 @@ static u32 brcmf_sdio_hostmail(struct br
/* dongle indicates the firmware has halted/crashed */
if (hmb_data & HMB_DATA_FWHALT) {
*/
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1080,6 +1080,14 @@ static int brcmf_revinfo_read(struct seq
+@@ -1052,6 +1052,14 @@ static int brcmf_revinfo_read(struct seq
return 0;
}
int brcmf_bus_started(struct device *dev)
{
int ret = -1;
-@@ -1161,6 +1169,8 @@ int brcmf_bus_started(struct device *dev
+@@ -1133,6 +1141,8 @@ int brcmf_bus_started(struct device *dev
#endif
#endif /* CONFIG_INET */
return 0;
fail:
-@@ -1282,6 +1292,8 @@ void brcmf_fw_crashed(struct device *dev
+@@ -1250,6 +1260,8 @@ void brcmf_fw_crashed(struct device *dev
bphy_err(drvr, "Firmware has halted or crashed\n");
brcmf_dev_coredump(dev);
void brcmf_detach(struct device *dev)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
-@@ -146,6 +146,8 @@ struct brcmf_pub {
+@@ -144,6 +144,8 @@ struct brcmf_pub {
struct notifier_block inet6addr_notifier;
struct brcmf_mp_device *settings;
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -838,17 +838,17 @@ static void brcmf_del_if(struct brcmf_pu
+@@ -810,17 +810,17 @@ static void brcmf_del_if(struct brcmf_pu
bool rtnl_locked)
{
struct brcmf_if *ifp;
if (ifp->ndev) {
if (bsscfgidx == 0) {
if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
-@@ -876,6 +876,10 @@ static void brcmf_del_if(struct brcmf_pu
+@@ -848,6 +848,10 @@ static void brcmf_del_if(struct brcmf_pu
brcmf_p2p_ifp_removed(ifp, rtnl_locked);
kfree(ifp);
}
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -616,6 +616,7 @@ BRCMF_FW_NVRAM_DEF(43430A0, "brcmfmac434
+@@ -617,6 +617,7 @@ BRCMF_FW_NVRAM_DEF(43430A0, "brcmfmac434
/* Note the names are not postfixed with a1 for backward compatibility */
BRCMF_FW_NVRAM_DEF(43430A1, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt");
BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-sdio.bin", "brcmfmac4356-sdio.txt");
BRCMF_FW_NVRAM_DEF(4373, "brcmfmac4373-sdio.bin", "brcmfmac4373-sdio.txt");
-@@ -635,7 +636,8 @@ static struct brcmf_firmware_mapping brc
+@@ -636,7 +637,8 @@ static struct brcmf_firmware_mapping brc
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0x00000001, 43430A0),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430A1),
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1411,6 +1411,7 @@ int __init brcmf_core_init(void)
+@@ -1377,6 +1377,7 @@ int __init brcmf_core_init(void)
{
if (!schedule_work(&brcmf_driver_work))
return -EBUSY;