349-0007-brcmfmac-revise-handling-events-in-receive-path.patch 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. From: Arend van Spriel <arend@broadcom.com>
  2. Date: Mon, 11 Apr 2016 11:35:27 +0200
  3. Subject: [PATCH] brcmfmac: revise handling events in receive path
  4. Move event handling out of brcmf_netif_rx() avoiding the need
  5. to pass a flag. This flag is only ever true for USB hosts as
  6. other interface use separate brcmf_rx_event() function.
  7. Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  8. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  9. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  10. Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12. ---
  13. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  14. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  15. @@ -216,7 +216,7 @@ bool brcmf_c_prec_enq(struct device *dev
  16. int prec);
  17. /* Receive frame for delivery to OS. Callee disposes of rxp. */
  18. -void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_evnt);
  19. +void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_event);
  20. /* Receive async event packet from firmware. Callee disposes of rxp. */
  21. void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
  22. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  23. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  24. @@ -298,18 +298,11 @@ void brcmf_txflowblock(struct device *de
  25. brcmf_fws_bus_blocked(drvr, state);
  26. }
  27. -void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  28. - bool handle_event)
  29. +void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
  30. {
  31. - skb->protocol = eth_type_trans(skb, ifp->ndev);
  32. -
  33. if (skb->pkt_type == PACKET_MULTICAST)
  34. ifp->stats.multicast++;
  35. - /* Process special event packets */
  36. - if (handle_event)
  37. - brcmf_fweh_process_skb(ifp->drvr, skb);
  38. -
  39. if (!(ifp->ndev->flags & IFF_UP)) {
  40. brcmu_pkt_buf_free_skb(skb);
  41. return;
  42. @@ -329,7 +322,7 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  43. netif_rx_ni(skb);
  44. }
  45. -void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  46. +void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  47. {
  48. struct brcmf_if *ifp;
  49. struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  50. @@ -348,10 +341,17 @@ void brcmf_rx_frame(struct device *dev,
  51. return;
  52. }
  53. - if (brcmf_proto_is_reorder_skb(skb))
  54. + skb->protocol = eth_type_trans(skb, ifp->ndev);
  55. +
  56. + if (brcmf_proto_is_reorder_skb(skb)) {
  57. brcmf_proto_rxreorder(ifp, skb);
  58. - else
  59. - brcmf_netif_rx(ifp, skb, handle_evnt);
  60. + } else {
  61. + /* Process special event packets */
  62. + if (handle_event)
  63. + brcmf_fweh_process_skb(ifp->drvr, skb);
  64. +
  65. + brcmf_netif_rx(ifp, skb);
  66. + }
  67. }
  68. void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
  69. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  70. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  71. @@ -221,8 +221,7 @@ int brcmf_get_next_free_bsscfgidx(struct
  72. void brcmf_txflowblock_if(struct brcmf_if *ifp,
  73. enum brcmf_netif_stop_reason reason, bool state);
  74. void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  75. -void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  76. - bool handle_event);
  77. +void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  78. void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  79. int __init brcmf_core_init(void);
  80. void __exit brcmf_core_exit(void);
  81. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  82. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  83. @@ -1668,7 +1668,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  84. /* validate flags and flow id */
  85. if (flags == 0xFF) {
  86. brcmf_err("invalid flags...so ignore this packet\n");
  87. - brcmf_netif_rx(ifp, pkt, false);
  88. + brcmf_netif_rx(ifp, pkt);
  89. return;
  90. }
  91. @@ -1680,7 +1680,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  92. if (rfi == NULL) {
  93. brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  94. flow_id);
  95. - brcmf_netif_rx(ifp, pkt, false);
  96. + brcmf_netif_rx(ifp, pkt);
  97. return;
  98. }
  99. @@ -1705,7 +1705,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  100. rfi = kzalloc(buf_size, GFP_ATOMIC);
  101. if (rfi == NULL) {
  102. brcmf_err("failed to alloc buffer\n");
  103. - brcmf_netif_rx(ifp, pkt, false);
  104. + brcmf_netif_rx(ifp, pkt);
  105. return;
  106. }
  107. @@ -1819,7 +1819,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  108. netif_rx:
  109. skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  110. __skb_unlink(pkt, &reorder_list);
  111. - brcmf_netif_rx(ifp, pkt, false);
  112. + brcmf_netif_rx(ifp, pkt);
  113. }
  114. }
  115. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  116. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  117. @@ -1157,7 +1157,7 @@ brcmf_msgbuf_process_rx_complete(struct
  118. brcmu_pkt_buf_free_skb(skb);
  119. return;
  120. }
  121. - brcmf_netif_rx(ifp, skb, false);
  122. + brcmf_netif_rx(ifp, skb);
  123. }