319-v4.12-0010-brcmfmac-move-brcmf_txflowblock-to-bcdc-layer.patch 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. From 20ec4f57498f8770c7a1a3e2a316fa752a424178 Mon Sep 17 00:00:00 2001
  2. From: Franky Lin <franky.lin@broadcom.com>
  3. Date: Fri, 10 Mar 2017 21:17:02 +0000
  4. Subject: [PATCH] brcmfmac: move brcmf_txflowblock to bcdc layer
  5. brcmf_txflowblock is invoked by sdio and usb bus module which are using
  6. bcdc protocol. This patch makes it a bcdc API instead of a core module
  7. function.
  8. Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  9. Signed-off-by: Franky Lin <franky.lin@broadcom.com>
  10. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  11. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12. ---
  13. .../net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 10 ++++++++++
  14. .../net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h | 1 +
  15. drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 --
  16. .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 10 ----------
  17. .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++--
  18. drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 5 +++--
  19. 6 files changed, 17 insertions(+), 16 deletions(-)
  20. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  21. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  22. @@ -345,6 +345,16 @@ brcmf_proto_bcdc_txdata(struct brcmf_pub
  23. return brcmf_bus_txdata(drvr->bus_if, pktbuf);
  24. }
  25. +void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state)
  26. +{
  27. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  28. + struct brcmf_pub *drvr = bus_if->drvr;
  29. +
  30. + brcmf_dbg(TRACE, "Enter\n");
  31. +
  32. + brcmf_fws_bus_blocked(drvr, state);
  33. +}
  34. +
  35. static void
  36. brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
  37. enum proto_addr_mode addr_mode)
  38. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
  39. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
  40. @@ -19,6 +19,7 @@
  41. #ifdef CPTCFG_BRCMFMAC_PROTO_BCDC
  42. int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr);
  43. void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
  44. +void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state);
  45. #else
  46. static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; }
  47. static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
  48. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  49. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  50. @@ -229,8 +229,6 @@ int brcmf_attach(struct device *dev, str
  51. void brcmf_detach(struct device *dev);
  52. /* Indication from bus module that dongle should be reset */
  53. void brcmf_dev_reset(struct device *dev);
  54. -/* Indication from bus module to change flow-control state */
  55. -void brcmf_txflowblock(struct device *dev, bool state);
  56. /* Notify the bus has transferred the tx packet to firmware */
  57. void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
  58. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  59. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  60. @@ -283,16 +283,6 @@ void brcmf_txflowblock_if(struct brcmf_i
  61. spin_unlock_irqrestore(&ifp->netif_stop_lock, flags);
  62. }
  63. -void brcmf_txflowblock(struct device *dev, bool state)
  64. -{
  65. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  66. - struct brcmf_pub *drvr = bus_if->drvr;
  67. -
  68. - brcmf_dbg(TRACE, "Enter\n");
  69. -
  70. - brcmf_fws_bus_blocked(drvr, state);
  71. -}
  72. -
  73. void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
  74. {
  75. if (skb->pkt_type == PACKET_MULTICAST)
  76. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  77. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  78. @@ -44,6 +44,7 @@
  79. #include "firmware.h"
  80. #include "core.h"
  81. #include "common.h"
  82. +#include "bcdc.h"
  83. #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  84. #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  85. @@ -2328,7 +2329,7 @@ static uint brcmf_sdio_sendfromq(struct
  86. if ((bus->sdiodev->state == BRCMF_SDIOD_DATA) &&
  87. bus->txoff && (pktq_len(&bus->txq) < TXLOW)) {
  88. bus->txoff = false;
  89. - brcmf_txflowblock(bus->sdiodev->dev, false);
  90. + brcmf_proto_bcdc_txflowblock(bus->sdiodev->dev, false);
  91. }
  92. return cnt;
  93. @@ -2753,7 +2754,7 @@ static int brcmf_sdio_bus_txdata(struct
  94. if (pktq_len(&bus->txq) >= TXHI) {
  95. bus->txoff = true;
  96. - brcmf_txflowblock(dev, true);
  97. + brcmf_proto_bcdc_txflowblock(dev, true);
  98. }
  99. spin_unlock_bh(&bus->txq_lock);
  100. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  101. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  102. @@ -29,6 +29,7 @@
  103. #include "usb.h"
  104. #include "core.h"
  105. #include "common.h"
  106. +#include "bcdc.h"
  107. #define IOCTL_RESP_TIMEOUT msecs_to_jiffies(2000)
  108. @@ -488,7 +489,7 @@ static void brcmf_usb_tx_complete(struct
  109. spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags);
  110. if (devinfo->tx_freecount > devinfo->tx_high_watermark &&
  111. devinfo->tx_flowblock) {
  112. - brcmf_txflowblock(devinfo->dev, false);
  113. + brcmf_proto_bcdc_txflowblock(devinfo->dev, false);
  114. devinfo->tx_flowblock = false;
  115. }
  116. spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags);
  117. @@ -635,7 +636,7 @@ static int brcmf_usb_tx(struct device *d
  118. spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags);
  119. if (devinfo->tx_freecount < devinfo->tx_low_watermark &&
  120. !devinfo->tx_flowblock) {
  121. - brcmf_txflowblock(dev, true);
  122. + brcmf_proto_bcdc_txflowblock(dev, true);
  123. devinfo->tx_flowblock = true;
  124. }
  125. spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags);