brcmfmac: pass struct brcmf_if instance in brcmf_txfinalize()
authorArend van Spriel <arend@broadcom.com>
Wed, 26 Aug 2015 20:14:59 +0000 (22:14 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 29 Sep 2015 07:28:41 +0000 (10:28 +0300)
Most call sites of brcmf_txfinalize already have struct brcmf_if
instance so pass that to brcmf_txfinalize() as the function
needs it anyway.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/brcm80211/brcmfmac/core.c
drivers/net/wireless/brcm80211/brcmfmac/core.h
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c

index b9ed0ed322043106204fb0148a71ffc691e45af9..cd0bffe282c67394c5a7322186549e7a302ec17d 100644 (file)
@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev, struct sk_buff *skb)
                brcmf_netif_rx(ifp, skb);
 }
 
-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
-                     bool success)
+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
 {
-       struct brcmf_if *ifp;
        struct ethhdr *eh;
        u16 type;
 
-       ifp = drvr->iflist[ifidx];
-       if (!ifp)
-               goto done;
-
        eh = (struct ethhdr *)(txp->data);
        type = ntohs(eh->h_proto);
 
@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
 
        if (!success)
                ifp->stats.tx_errors++;
-done:
+
        brcmu_pkt_buf_free_skb(txp);
 }
 
@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)
                if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
                        brcmu_pkt_buf_free_skb(txp);
                else
-                       brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
+                       brcmf_txfinalize(ifp, txp, success);
        }
 }
 
index 5fb9f4be7de0c1d1029863a6440fe738ed6883d2..576e7ac2d66884a35ad7d1d0b9204a9e7dd7ddea 100644 (file)
@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf_if *ifp);
 int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
 void brcmf_txflowblock_if(struct brcmf_if *ifp,
                          enum brcmf_netif_stop_reason reason, bool state);
-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
-                     bool success);
+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
 void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
 
 /* Sets dongle media info (drv_version, mac address). */
index 0c80c858462fae4fb752f9b725bd3c95ce10b819..dc4844c301ac1d016d375d3abed313392bbe8ea5 100644 (file)
@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot,
                ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
                                                    genbit, seq);
        if (remove_from_hanger || ret)
-               brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
+               brcmf_txfinalize(ifp, skb, true);
 
        return 0;
 }
@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
        if (fws->avoid_queueing) {
                rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
                if (rc < 0)
-                       brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
+                       brcmf_txfinalize(ifp, skb, false);
                return rc;
        }
 
@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
                brcmf_fws_schedule_deq(fws);
        } else {
                brcmf_err("drop skb: no hanger slot\n");
-               brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
+               brcmf_txfinalize(ifp, skb, false);
                rc = -ENOMEM;
        }
        brcmf_fws_unlock(fws);
@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(struct work_struct *worker)
                                ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
                                brcmf_fws_lock(fws);
                                if (ret < 0)
-                                       brcmf_txfinalize(drvr, skb, ifidx,
-                                                        false);
+                                       brcmf_txfinalize(brcmf_get_ifp(drvr,
+                                                                      ifidx),
+                                                        skb, false);
                                if (fws->bus_flow_blocked)
                                        break;
                        }
index d582f6993574c8cbc5d1bbfc23afc932d6094b57..7eff9de6885bb2be078686236fdc118222fe2e48 100644 (file)
@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brcmf_msgbuf *msgbuf, void *buf)
        commonring = msgbuf->flowrings[flowid];
        atomic_dec(&commonring->outstanding_tx);
 
-       brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
+       /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
+        * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
+        */
+       brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
+                        skb, true);
 }