brcmfmac: release transmit packet in brcmf_txcomplete()
authorArend van Spriel <arend@broadcom.com>
Sun, 3 Mar 2013 11:45:29 +0000 (12:45 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 6 Mar 2013 21:28:44 +0000 (16:28 -0500)
In the bus-specific driver code each call to brcmf_txcomplete() is
following by a free of that packet. This patch moves that free to
the brcmf_txcomplete() function.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
drivers/net/wireless/brcm80211/brcmfmac/usb.c

index ad25c3408b59abaf2315e89352fcf2fce7bc6f6a..883ef9063e8a7829b1a82a857d7dc9eaeeadbc61 100644 (file)
@@ -134,7 +134,7 @@ extern void brcmf_dev_reset(struct device *dev);
 /* Indication from bus module to change flow-control state */
 extern void brcmf_txflowblock(struct device *dev, bool state);
 
-/* Notify tx completion */
+/* Notify the bus has transferred the tx packet to firmware */
 extern void brcmf_txcomplete(struct device *dev, struct sk_buff *txp,
                             bool success);
 
index 172d39cdb4ea661f3050a466f916722a22c8df5f..faf2092369756e996d402eebb7f20404d0f73152 100644 (file)
@@ -364,7 +364,7 @@ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)
 
        ifp = drvr->iflist[ifidx];
        if (!ifp)
-               return;
+               goto done;
 
        if (res == 0) {
                eh = (struct ethhdr *)(txp->data);
@@ -378,6 +378,9 @@ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)
        }
        if (!success)
                ifp->stats.tx_errors++;
+
+done:
+       brcmu_pkt_buf_free_skb(txp);
 }
 
 static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev)
index bf6ab41b7b1ed9d694bc50253c95da1f84b0cdf9..9a2edd3f0a5c0cf425aff34efc9e30fa358d48ea 100644 (file)
@@ -1775,7 +1775,7 @@ brcmf_sdbrcm_wait_event_wakeup(struct brcmf_sdio *bus)
 /* Writes a HW/SW header into the packet and sends it. */
 /* Assumes: (a) header space already there, (b) caller holds lock */
 static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt,
-                             uint chan, bool free_pkt)
+                             uint chan)
 {
        int ret;
        u8 *frame;
@@ -1805,10 +1805,7 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt,
 
                        pkt_align(new, pkt->len, BRCMF_SDALIGN);
                        memcpy(new->data, pkt->data, pkt->len);
-                       if (free_pkt)
-                               brcmu_pkt_buf_free_skb(pkt);
-                       /* free the pkt if canned one is not used */
-                       free_pkt = true;
+                       brcmu_pkt_buf_free_skb(pkt);
                        pkt = new;
                        frame = (u8 *) (pkt->data);
                        /* precondition: (frame % BRCMF_SDALIGN) == 0) */
@@ -1901,10 +1898,6 @@ done:
        /* restore pkt buffer pointer before calling tx complete routine */
        skb_pull(pkt, SDPCM_HDRLEN + pad);
        brcmf_txcomplete(bus->sdiodev->dev, pkt, ret != 0);
-
-       if (free_pkt)
-               brcmu_pkt_buf_free_skb(pkt);
-
        return ret;
 }
 
@@ -1932,7 +1925,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes)
                spin_unlock_bh(&bus->txqlock);
                datalen = pkt->len - SDPCM_HDRLEN;
 
-               ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
+               ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL);
 
                /* In poll mode, need to check for other events */
                if (!bus->intr && cnt) {
@@ -2343,7 +2336,6 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt)
        if (!brcmf_c_prec_enq(bus->sdiodev->dev, &bus->txq, pkt, prec)) {
                skb_pull(pkt, SDPCM_HDRLEN);
                brcmf_txcomplete(bus->sdiodev->dev, pkt, false);
-               brcmu_pkt_buf_free_skb(pkt);
                brcmf_err("out of bus->txq !!!\n");
                ret = -ENOSR;
        } else {
index 156db2adcace5ef5169346daffc0178c4c9d6c7a..bf5bb8768e7ba479c509191bf920cbbee1403ca1 100644 (file)
@@ -417,8 +417,6 @@ static void brcmf_usb_tx_complete(struct urb *urb)
        brcmf_usb_del_fromq(devinfo, req);
 
        brcmf_txcomplete(devinfo->dev, req->skb, urb->status == 0);
-
-       brcmu_pkt_buf_free_skb(req->skb);
        req->skb = NULL;
        brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req, &devinfo->tx_freecount);
        if (devinfo->tx_freecount > devinfo->tx_high_watermark &&