319-v4.12-0011-brcmfmac-move-brcmf_txcomplete-to-bcdc-layer.patch 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. From 7b584396b7a760bc77bbde4625f83ef173159d3e Mon Sep 17 00:00:00 2001
  2. From: Franky Lin <franky.lin@broadcom.com>
  3. Date: Fri, 10 Mar 2017 21:17:03 +0000
  4. Subject: [PATCH] brcmfmac: move brcmf_txcomplete to bcdc layer
  5. brcmf_txcomplete is invoked by sdio and usb bus module which are using
  6. bcdc protocol. So move it from core module into bcdc layer.
  7. Signed-off-by: Franky Lin <franky.lin@broadcom.com>
  8. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  9. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10. ---
  11. .../broadcom/brcm80211/brcmfmac/bcdc.c | 20 +++++++++++++++++++
  12. .../broadcom/brcm80211/brcmfmac/bcdc.h | 2 ++
  13. .../broadcom/brcm80211/brcmfmac/bus.h | 3 ---
  14. .../broadcom/brcm80211/brcmfmac/core.c | 18 -----------------
  15. .../broadcom/brcm80211/brcmfmac/sdio.c | 3 ++-
  16. .../broadcom/brcm80211/brcmfmac/usb.c | 2 +-
  17. 6 files changed, 25 insertions(+), 23 deletions(-)
  18. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  19. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  20. @@ -355,6 +355,26 @@ void brcmf_proto_bcdc_txflowblock(struct
  21. brcmf_fws_bus_blocked(drvr, state);
  22. }
  23. +void
  24. +brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp,
  25. + bool success)
  26. +{
  27. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  28. + struct brcmf_pub *drvr = bus_if->drvr;
  29. + struct brcmf_if *ifp;
  30. +
  31. + /* await txstatus signal for firmware if active */
  32. + if (brcmf_fws_fc_active(drvr->fws)) {
  33. + if (!success)
  34. + brcmf_fws_bustxfail(drvr->fws, txp);
  35. + } else {
  36. + if (brcmf_proto_bcdc_hdrpull(drvr, false, txp, &ifp))
  37. + brcmu_pkt_buf_free_skb(txp);
  38. + else
  39. + brcmf_txfinalize(ifp, txp, success);
  40. + }
  41. +}
  42. +
  43. static void
  44. brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
  45. enum proto_addr_mode addr_mode)
  46. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
  47. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
  48. @@ -20,6 +20,8 @@
  49. int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr);
  50. void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
  51. void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state);
  52. +void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp,
  53. + bool success);
  54. #else
  55. static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; }
  56. static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
  57. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  58. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  59. @@ -230,9 +230,6 @@ void brcmf_detach(struct device *dev);
  60. /* Indication from bus module that dongle should be reset */
  61. void brcmf_dev_reset(struct device *dev);
  62. -/* Notify the bus has transferred the tx packet to firmware */
  63. -void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
  64. -
  65. /* Configure the "global" bus state used by upper layers */
  66. void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state);
  67. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  68. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  69. @@ -383,24 +383,6 @@ void brcmf_txfinalize(struct brcmf_if *i
  70. brcmu_pkt_buf_free_skb(txp);
  71. }
  72. -void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)
  73. -{
  74. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  75. - struct brcmf_pub *drvr = bus_if->drvr;
  76. - struct brcmf_if *ifp;
  77. -
  78. - /* await txstatus signal for firmware if active */
  79. - if (brcmf_fws_fc_active(drvr->fws)) {
  80. - if (!success)
  81. - brcmf_fws_bustxfail(drvr->fws, txp);
  82. - } else {
  83. - if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  84. - brcmu_pkt_buf_free_skb(txp);
  85. - else
  86. - brcmf_txfinalize(ifp, txp, success);
  87. - }
  88. -}
  89. -
  90. static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev)
  91. {
  92. struct brcmf_if *ifp = netdev_priv(ndev);
  93. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  94. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  95. @@ -2266,7 +2266,8 @@ done:
  96. bus->tx_seq = (bus->tx_seq + pktq->qlen) % SDPCM_SEQ_WRAP;
  97. skb_queue_walk_safe(pktq, pkt_next, tmp) {
  98. __skb_unlink(pkt_next, pktq);
  99. - brcmf_txcomplete(bus->sdiodev->dev, pkt_next, ret == 0);
  100. + brcmf_proto_bcdc_txcomplete(bus->sdiodev->dev, pkt_next,
  101. + ret == 0);
  102. }
  103. return ret;
  104. }
  105. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  106. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  107. @@ -483,7 +483,7 @@ static void brcmf_usb_tx_complete(struct
  108. req->skb);
  109. brcmf_usb_del_fromq(devinfo, req);
  110. - brcmf_txcomplete(devinfo->dev, req->skb, urb->status == 0);
  111. + brcmf_proto_bcdc_txcomplete(devinfo->dev, req->skb, urb->status == 0);
  112. req->skb = NULL;
  113. brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req, &devinfo->tx_freecount);
  114. spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags);