Commit 20ec4f57 authored by Franky Lin's avatar Franky Lin Committed by Kalle Valo

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: default avatarArend Van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarFranky Lin <franky.lin@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent b9472a2e
...@@ -345,6 +345,16 @@ brcmf_proto_bcdc_txdata(struct brcmf_pub *drvr, int ifidx, u8 offset, ...@@ -345,6 +345,16 @@ brcmf_proto_bcdc_txdata(struct brcmf_pub *drvr, int ifidx, u8 offset,
return brcmf_bus_txdata(drvr->bus_if, pktbuf); 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 static void
brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx, brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
enum proto_addr_mode addr_mode) enum proto_addr_mode addr_mode)
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#ifdef CONFIG_BRCMFMAC_PROTO_BCDC #ifdef CONFIG_BRCMFMAC_PROTO_BCDC
int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr);
void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state);
#else #else
static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; } static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; }
static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {} static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
......
...@@ -229,8 +229,6 @@ int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings); ...@@ -229,8 +229,6 @@ int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings);
void brcmf_detach(struct device *dev); void brcmf_detach(struct device *dev);
/* Indication from bus module that dongle should be reset */ /* Indication from bus module that dongle should be reset */
void brcmf_dev_reset(struct device *dev); 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 */ /* Notify the bus has transferred the tx packet to firmware */
void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success); void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
......
...@@ -283,16 +283,6 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp, ...@@ -283,16 +283,6 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp,
spin_unlock_irqrestore(&ifp->netif_stop_lock, flags); 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) void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
{ {
if (skb->pkt_type == PACKET_MULTICAST) if (skb->pkt_type == PACKET_MULTICAST)
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "firmware.h" #include "firmware.h"
#include "core.h" #include "core.h"
#include "common.h" #include "common.h"
#include "bcdc.h"
#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500) #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500) #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
...@@ -2328,7 +2329,7 @@ static uint brcmf_sdio_sendfromq(struct brcmf_sdio *bus, uint maxframes) ...@@ -2328,7 +2329,7 @@ static uint brcmf_sdio_sendfromq(struct brcmf_sdio *bus, uint maxframes)
if ((bus->sdiodev->state == BRCMF_SDIOD_DATA) && if ((bus->sdiodev->state == BRCMF_SDIOD_DATA) &&
bus->txoff && (pktq_len(&bus->txq) < TXLOW)) { bus->txoff && (pktq_len(&bus->txq) < TXLOW)) {
bus->txoff = false; bus->txoff = false;
brcmf_txflowblock(bus->sdiodev->dev, false); brcmf_proto_bcdc_txflowblock(bus->sdiodev->dev, false);
} }
return cnt; return cnt;
...@@ -2753,7 +2754,7 @@ static int brcmf_sdio_bus_txdata(struct device *dev, struct sk_buff *pkt) ...@@ -2753,7 +2754,7 @@ static int brcmf_sdio_bus_txdata(struct device *dev, struct sk_buff *pkt)
if (pktq_len(&bus->txq) >= TXHI) { if (pktq_len(&bus->txq) >= TXHI) {
bus->txoff = true; bus->txoff = true;
brcmf_txflowblock(dev, true); brcmf_proto_bcdc_txflowblock(dev, true);
} }
spin_unlock_bh(&bus->txq_lock); spin_unlock_bh(&bus->txq_lock);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "usb.h" #include "usb.h"
#include "core.h" #include "core.h"
#include "common.h" #include "common.h"
#include "bcdc.h"
#define IOCTL_RESP_TIMEOUT msecs_to_jiffies(2000) #define IOCTL_RESP_TIMEOUT msecs_to_jiffies(2000)
...@@ -488,7 +489,7 @@ static void brcmf_usb_tx_complete(struct urb *urb) ...@@ -488,7 +489,7 @@ static void brcmf_usb_tx_complete(struct urb *urb)
spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags); spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags);
if (devinfo->tx_freecount > devinfo->tx_high_watermark && if (devinfo->tx_freecount > devinfo->tx_high_watermark &&
devinfo->tx_flowblock) { devinfo->tx_flowblock) {
brcmf_txflowblock(devinfo->dev, false); brcmf_proto_bcdc_txflowblock(devinfo->dev, false);
devinfo->tx_flowblock = false; devinfo->tx_flowblock = false;
} }
spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags); spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags);
...@@ -635,7 +636,7 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb) ...@@ -635,7 +636,7 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb)
spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags); spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags);
if (devinfo->tx_freecount < devinfo->tx_low_watermark && if (devinfo->tx_freecount < devinfo->tx_low_watermark &&
!devinfo->tx_flowblock) { !devinfo->tx_flowblock) {
brcmf_txflowblock(dev, true); brcmf_proto_bcdc_txflowblock(dev, true);
devinfo->tx_flowblock = true; devinfo->tx_flowblock = true;
} }
spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags); spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment