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