325-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. From: Arend van Spriel <[email protected]>
  2. Date: Wed, 26 Aug 2015 22:14:59 +0200
  3. Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  4. brcmf_txfinalize()
  5. Most call sites of brcmf_txfinalize already have struct brcmf_if
  6. instance so pass that to brcmf_txfinalize() as the function
  7. needs it anyway.
  8. Reviewed-by: Hante Meuleman <[email protected]>
  9. Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
  10. Reviewed-by: Pieter-Paul Giesberts <[email protected]>
  11. Signed-off-by: Arend van Spriel <[email protected]>
  12. ---
  13. --- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  14. +++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  15. @@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  16. brcmf_netif_rx(ifp, skb);
  17. }
  18. -void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  19. - bool success)
  20. +void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  21. {
  22. - struct brcmf_if *ifp;
  23. struct ethhdr *eh;
  24. u16 type;
  25. - ifp = drvr->iflist[ifidx];
  26. - if (!ifp)
  27. - goto done;
  28. -
  29. eh = (struct ethhdr *)(txp->data);
  30. type = ntohs(eh->h_proto);
  31. @@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  32. if (!success)
  33. ifp->stats.tx_errors++;
  34. -done:
  35. +
  36. brcmu_pkt_buf_free_skb(txp);
  37. }
  38. @@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  39. if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  40. brcmu_pkt_buf_free_skb(txp);
  41. else
  42. - brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  43. + brcmf_txfinalize(ifp, txp, success);
  44. }
  45. }
  46. --- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  47. +++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  48. @@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  49. int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  50. void brcmf_txflowblock_if(struct brcmf_if *ifp,
  51. enum brcmf_netif_stop_reason reason, bool state);
  52. -void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  53. - bool success);
  54. +void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  55. void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  56. /* Sets dongle media info (drv_version, mac address). */
  57. --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  58. +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  59. @@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  60. ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  61. genbit, seq);
  62. if (remove_from_hanger || ret)
  63. - brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  64. + brcmf_txfinalize(ifp, skb, true);
  65. return 0;
  66. }
  67. @@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  68. if (fws->avoid_queueing) {
  69. rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  70. if (rc < 0)
  71. - brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  72. + brcmf_txfinalize(ifp, skb, false);
  73. return rc;
  74. }
  75. @@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  76. brcmf_fws_schedule_deq(fws);
  77. } else {
  78. brcmf_err("drop skb: no hanger slot\n");
  79. - brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  80. + brcmf_txfinalize(ifp, skb, false);
  81. rc = -ENOMEM;
  82. }
  83. brcmf_fws_unlock(fws);
  84. @@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  85. ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  86. brcmf_fws_lock(fws);
  87. if (ret < 0)
  88. - brcmf_txfinalize(drvr, skb, ifidx,
  89. - false);
  90. + brcmf_txfinalize(brcmf_get_ifp(drvr,
  91. + ifidx),
  92. + skb, false);
  93. if (fws->bus_flow_blocked)
  94. break;
  95. }
  96. --- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  97. +++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  98. @@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  99. commonring = msgbuf->flowrings[flowid];
  100. atomic_dec(&commonring->outstanding_tx);
  101. - brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  102. + /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  103. + * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  104. + */
  105. + brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  106. + skb, true);
  107. }