Commit a30825a3 authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: remove counting of allocated sk_buff packets

The function pkt_buf_get_skb and pkt_buf_free_skb were using struct
osl_info field pktalloced to maintain counter of buffers in use in
the driver. It was decided to remove this facility. The prototypes
of these functions have been modified and the calling code adapted.
Reviewed-by: default avatarBrett Rudley <brudley@broadcom.com>
Reviewed-by: default avatarHenry Ptasinski <henryp@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3c4d93d4
...@@ -1038,7 +1038,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, ...@@ -1038,7 +1038,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
if (pkt == NULL) { if (pkt == NULL) {
sd_data(("%s: Creating new %s Packet, len=%d\n", sd_data(("%s: Creating new %s Packet, len=%d\n",
__func__, write ? "TX" : "RX", buflen_u)); __func__, write ? "TX" : "RX", buflen_u));
mypkt = pkt_buf_get_skb(sd->osh, buflen_u); mypkt = pkt_buf_get_skb(buflen_u);
if (!mypkt) { if (!mypkt) {
sd_err(("%s: pkt_buf_get_skb failed: len %d\n", sd_err(("%s: pkt_buf_get_skb failed: len %d\n",
__func__, buflen_u)); __func__, buflen_u));
...@@ -1056,7 +1056,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, ...@@ -1056,7 +1056,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
if (!write) if (!write)
memcpy(buffer, mypkt->data, buflen_u); memcpy(buffer, mypkt->data, buflen_u);
pkt_buf_free_skb(sd->osh, mypkt, write ? true : false); pkt_buf_free_skb(mypkt);
} else if (((u32) (pkt->data) & DMA_ALIGN_MASK) != 0) { } else if (((u32) (pkt->data) & DMA_ALIGN_MASK) != 0) {
/* Case 2: We have a packet, but it is unaligned. */ /* Case 2: We have a packet, but it is unaligned. */
...@@ -1065,7 +1065,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, ...@@ -1065,7 +1065,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
sd_data(("%s: Creating aligned %s Packet, len=%d\n", sd_data(("%s: Creating aligned %s Packet, len=%d\n",
__func__, write ? "TX" : "RX", pkt->len)); __func__, write ? "TX" : "RX", pkt->len));
mypkt = pkt_buf_get_skb(sd->osh, pkt->len); mypkt = pkt_buf_get_skb(pkt->len);
if (!mypkt) { if (!mypkt) {
sd_err(("%s: pkt_buf_get_skb failed: len %d\n", sd_err(("%s: pkt_buf_get_skb failed: len %d\n",
__func__, pkt->len)); __func__, pkt->len));
...@@ -1083,7 +1083,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, ...@@ -1083,7 +1083,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
if (!write) if (!write)
memcpy(pkt->data, mypkt->data, mypkt->len); memcpy(pkt->data, mypkt->data, mypkt->len);
pkt_buf_free_skb(sd->osh, mypkt, write ? true : false); pkt_buf_free_skb(mypkt);
} else { /* case 3: We have a packet and } else { /* case 3: We have a packet and
it is aligned. */ it is aligned. */
sd_data(("%s: Aligned %s Packet, direct DMA\n", sd_data(("%s: Aligned %s Packet, direct DMA\n",
......
...@@ -347,7 +347,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, ...@@ -347,7 +347,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt,
ASSERT(p); ASSERT(p);
} }
pkt_buf_free_skb(dhdp->osh, p, true); pkt_buf_free_skb(p);
} }
/* Enqueue */ /* Enqueue */
......
...@@ -1049,11 +1049,6 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf) ...@@ -1049,11 +1049,6 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
static inline void * static inline void *
osl_pkt_frmnative(struct osl_info *osh, struct sk_buff *skb) osl_pkt_frmnative(struct osl_info *osh, struct sk_buff *skb)
{ {
struct sk_buff *nskb;
for (nskb = skb; nskb; nskb = nskb->next)
osh->pktalloced++;
return (void *)skb; return (void *)skb;
} }
#define PKTFRMNATIVE(osh, skb) \ #define PKTFRMNATIVE(osh, skb) \
...@@ -1062,11 +1057,6 @@ osl_pkt_frmnative(struct osl_info *osh, struct sk_buff *skb) ...@@ -1062,11 +1057,6 @@ osl_pkt_frmnative(struct osl_info *osh, struct sk_buff *skb)
static inline struct sk_buff * static inline struct sk_buff *
osl_pkt_tonative(struct osl_info *osh, void *pkt) osl_pkt_tonative(struct osl_info *osh, void *pkt)
{ {
struct sk_buff *nskb;
for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next)
osh->pktalloced--;
return (struct sk_buff *)pkt; return (struct sk_buff *)pkt;
} }
#define PKTTONATIVE(osh, pkt) \ #define PKTTONATIVE(osh, pkt) \
......
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
* bufpool was present for gspi bus. * bufpool was present for gspi bus.
*/ */
#define PKTFREE2() if ((bus->bus != SPI_BUS) || bus->usebufpool) \ #define PKTFREE2() if ((bus->bus != SPI_BUS) || bus->usebufpool) \
pkt_buf_free_skb(bus->dhd->osh, pkt, false); pkt_buf_free_skb(pkt);
/* /*
* Conversion of 802.1D priority to precedence level * Conversion of 802.1D priority to precedence level
...@@ -939,7 +939,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -939,7 +939,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
DHD_INFO(("%s: insufficient headroom %d for %d pad\n", DHD_INFO(("%s: insufficient headroom %d for %d pad\n",
__func__, skb_headroom(pkt), pad)); __func__, skb_headroom(pkt), pad));
bus->dhd->tx_realloc++; bus->dhd->tx_realloc++;
new = pkt_buf_get_skb(osh, (pkt->len + DHD_SDALIGN)); new = pkt_buf_get_skb(pkt->len + DHD_SDALIGN);
if (!new) { if (!new) {
DHD_ERROR(("%s: couldn't allocate new %d-byte " DHD_ERROR(("%s: couldn't allocate new %d-byte "
"packet\n", "packet\n",
...@@ -951,7 +951,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -951,7 +951,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
PKTALIGN(osh, new, pkt->len, DHD_SDALIGN); PKTALIGN(osh, new, pkt->len, DHD_SDALIGN);
memcpy(new->data, pkt->data, pkt->len); memcpy(new->data, pkt->data, pkt->len);
if (free_pkt) if (free_pkt)
pkt_buf_free_skb(osh, pkt, true); pkt_buf_free_skb(pkt);
/* free the pkt if canned one is not used */ /* free the pkt if canned one is not used */
free_pkt = true; free_pkt = true;
pkt = new; pkt = new;
...@@ -1065,7 +1065,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -1065,7 +1065,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
dhd_os_sdlock(bus->dhd); dhd_os_sdlock(bus->dhd);
if (free_pkt) if (free_pkt)
pkt_buf_free_skb(osh, pkt, true); pkt_buf_free_skb(pkt);
return ret; return ret;
} }
...@@ -1116,7 +1116,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) ...@@ -1116,7 +1116,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) { if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) {
skb_pull(pkt, SDPCM_HDRLEN); skb_pull(pkt, SDPCM_HDRLEN);
dhd_txcomplete(bus->dhd, pkt, false); dhd_txcomplete(bus->dhd, pkt, false);
pkt_buf_free_skb(osh, pkt, true); pkt_buf_free_skb(pkt);
DHD_ERROR(("%s: out of bus->txq !!!\n", __func__)); DHD_ERROR(("%s: out of bus->txq !!!\n", __func__));
ret = BCME_NORESOURCE; ret = BCME_NORESOURCE;
} else { } else {
...@@ -2886,10 +2886,10 @@ void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex) ...@@ -2886,10 +2886,10 @@ void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
/* Clear any held glomming stuff */ /* Clear any held glomming stuff */
if (bus->glomd) if (bus->glomd)
pkt_buf_free_skb(osh, bus->glomd, false); pkt_buf_free_skb(bus->glomd);
if (bus->glom) if (bus->glom)
pkt_buf_free_skb(osh, bus->glom, false); pkt_buf_free_skb(bus->glom);
bus->glom = bus->glomd = NULL; bus->glom = bus->glomd = NULL;
...@@ -3188,7 +3188,6 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3188,7 +3188,6 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
u16 sublen, check; u16 sublen, check;
struct sk_buff *pfirst, *plast, *pnext, *save_pfirst; struct sk_buff *pfirst, *plast, *pnext, *save_pfirst;
struct osl_info *osh = bus->dhd->osh;
int errcode; int errcode;
u8 chan, seq, doff, sfdoff; u8 chan, seq, doff, sfdoff;
...@@ -3244,7 +3243,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3244,7 +3243,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
} }
/* Allocate/chain packet for next subframe */ /* Allocate/chain packet for next subframe */
pnext = pkt_buf_get_skb(osh, sublen + DHD_SDALIGN); pnext = pkt_buf_get_skb(sublen + DHD_SDALIGN);
if (pnext == NULL) { if (pnext == NULL) {
DHD_ERROR(("%s: pkt_buf_get_skb failed, num %d len %d\n", DHD_ERROR(("%s: pkt_buf_get_skb failed, num %d len %d\n",
__func__, num, sublen)); __func__, num, sublen));
...@@ -3280,13 +3279,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3280,13 +3279,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
pfirst = pnext = NULL; pfirst = pnext = NULL;
} else { } else {
if (pfirst) if (pfirst)
pkt_buf_free_skb(osh, pfirst, false); pkt_buf_free_skb(pfirst);
bus->glom = NULL; bus->glom = NULL;
num = 0; num = 0;
} }
/* Done with descriptor packet */ /* Done with descriptor packet */
pkt_buf_free_skb(osh, bus->glomd, false); pkt_buf_free_skb(bus->glomd);
bus->glomd = NULL; bus->glomd = NULL;
bus->nextlen = 0; bus->nextlen = 0;
...@@ -3355,7 +3354,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3355,7 +3354,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
bus->glomerr = 0; bus->glomerr = 0;
dhdsdio_rxfail(bus, true, false); dhdsdio_rxfail(bus, true, false);
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
pkt_buf_free_skb(osh, bus->glom, false); pkt_buf_free_skb(bus->glom);
dhd_os_sdunlock_rxq(bus->dhd); dhd_os_sdunlock_rxq(bus->dhd);
bus->rxglomfail++; bus->rxglomfail++;
bus->glom = NULL; bus->glom = NULL;
...@@ -3484,7 +3483,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3484,7 +3483,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
bus->glomerr = 0; bus->glomerr = 0;
dhdsdio_rxfail(bus, true, false); dhdsdio_rxfail(bus, true, false);
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
pkt_buf_free_skb(osh, bus->glom, false); pkt_buf_free_skb(bus->glom);
dhd_os_sdunlock_rxq(bus->dhd); dhd_os_sdunlock_rxq(bus->dhd);
bus->rxglomfail++; bus->rxglomfail++;
bus->glom = NULL; bus->glom = NULL;
...@@ -3532,7 +3531,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3532,7 +3531,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
skb_pull(pfirst, doff); skb_pull(pfirst, doff);
if (pfirst->len == 0) { if (pfirst->len == 0) {
pkt_buf_free_skb(bus->dhd->osh, pfirst, false); pkt_buf_free_skb(pfirst);
if (plast) { if (plast) {
plast->next = pnext; plast->next = pnext;
} else { } else {
...@@ -3545,7 +3544,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3545,7 +3544,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
DHD_ERROR(("%s: rx protocol error\n", DHD_ERROR(("%s: rx protocol error\n",
__func__)); __func__));
bus->dhd->rx_errors++; bus->dhd->rx_errors++;
pkt_buf_free_skb(osh, pfirst, false); pkt_buf_free_skb(pfirst);
if (plast) { if (plast) {
plast->next = pnext; plast->next = pnext;
} else { } else {
...@@ -3589,7 +3588,6 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3589,7 +3588,6 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
/* Return true if there may be more frames to read */ /* Return true if there may be more frames to read */
static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
{ {
struct osl_info *osh = bus->dhd->osh;
bcmsdh_info_t *sdh = bus->sdh; bcmsdh_info_t *sdh = bus->sdh;
u16 len, check; /* Extracted hardware header fields */ u16 len, check; /* Extracted hardware header fields */
...@@ -3684,7 +3682,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -3684,7 +3682,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
*/ */
/* Allocate a packet buffer */ /* Allocate a packet buffer */
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
pkt = pkt_buf_get_skb(osh, rdlen + DHD_SDALIGN); pkt = pkt_buf_get_skb(rdlen + DHD_SDALIGN);
if (!pkt) { if (!pkt) {
if (bus->bus == SPI_BUS) { if (bus->bus == SPI_BUS) {
bus->usebufpool = false; bus->usebufpool = false;
...@@ -3757,7 +3755,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -3757,7 +3755,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
if (sdret < 0) { if (sdret < 0) {
DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n", DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n",
__func__, rdlen, sdret)); __func__, rdlen, sdret));
pkt_buf_free_skb(bus->dhd->osh, pkt, false); pkt_buf_free_skb(pkt);
bus->dhd->rx_errors++; bus->dhd->rx_errors++;
dhd_os_sdunlock_rxq(bus->dhd); dhd_os_sdunlock_rxq(bus->dhd);
/* Force retry w/normal header read. /* Force retry w/normal header read.
...@@ -3905,8 +3903,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -3905,8 +3903,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
doff); doff);
if (bus->usebufpool) { if (bus->usebufpool) {
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
pkt_buf_free_skb(bus->dhd->osh, pkt, pkt_buf_free_skb(pkt);
false);
dhd_os_sdunlock_rxq(bus->dhd); dhd_os_sdunlock_rxq(bus->dhd);
} }
continue; continue;
...@@ -4095,7 +4092,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4095,7 +4092,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
} }
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
pkt = pkt_buf_get_skb(osh, (rdlen + firstread + DHD_SDALIGN)); pkt = pkt_buf_get_skb(rdlen + firstread + DHD_SDALIGN);
if (!pkt) { if (!pkt) {
/* Give up on data, request rtx of events */ /* Give up on data, request rtx of events */
DHD_ERROR(("%s: pkt_buf_get_skb failed: rdlen %d chan %d\n", DHD_ERROR(("%s: pkt_buf_get_skb failed: rdlen %d chan %d\n",
...@@ -4131,7 +4128,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4131,7 +4128,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
? "data" : "test")), ? "data" : "test")),
sdret)); sdret));
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
pkt_buf_free_skb(bus->dhd->osh, pkt, false); pkt_buf_free_skb(pkt);
dhd_os_sdunlock_rxq(bus->dhd); dhd_os_sdunlock_rxq(bus->dhd);
bus->dhd->rx_errors++; bus->dhd->rx_errors++;
dhdsdio_rxfail(bus, true, RETRYCHAN(chan)); dhdsdio_rxfail(bus, true, RETRYCHAN(chan));
...@@ -4184,13 +4181,13 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4184,13 +4181,13 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
if (pkt->len == 0) { if (pkt->len == 0) {
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
pkt_buf_free_skb(bus->dhd->osh, pkt, false); pkt_buf_free_skb(pkt);
dhd_os_sdunlock_rxq(bus->dhd); dhd_os_sdunlock_rxq(bus->dhd);
continue; continue;
} else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pkt) != 0) { } else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pkt) != 0) {
DHD_ERROR(("%s: rx protocol error\n", __func__)); DHD_ERROR(("%s: rx protocol error\n", __func__));
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
pkt_buf_free_skb(bus->dhd->osh, pkt, false); pkt_buf_free_skb(pkt);
dhd_os_sdunlock_rxq(bus->dhd); dhd_os_sdunlock_rxq(bus->dhd);
bus->dhd->rx_errors++; bus->dhd->rx_errors++;
continue; continue;
...@@ -5012,7 +5009,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen) ...@@ -5012,7 +5009,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
/* Bump dongle by sending an empty event pkt. /* Bump dongle by sending an empty event pkt.
* sdpcm_sendup (RX) checks for virtual console input. * sdpcm_sendup (RX) checks for virtual console input.
*/ */
pkt = pkt_buf_get_skb(bus->dhd->osh, 4 + SDPCM_RESERVE); pkt = pkt_buf_get_skb(4 + SDPCM_RESERVE);
if ((pkt != NULL) && bus->clkstate == CLK_AVAIL) if ((pkt != NULL) && bus->clkstate == CLK_AVAIL)
dhdsdio_txpkt(bus, pkt, SDPCM_EVENT_CHANNEL, true); dhdsdio_txpkt(bus, pkt, SDPCM_EVENT_CHANNEL, true);
......
...@@ -2734,12 +2734,6 @@ uint wlc_down(struct wlc_info *wlc) ...@@ -2734,12 +2734,6 @@ uint wlc_down(struct wlc_info *wlc)
/* wlc_bmac_down_finish has done wlc_coredisable(). so clk is off */ /* wlc_bmac_down_finish has done wlc_coredisable(). so clk is off */
wlc->clk = false; wlc->clk = false;
/* Verify all packets are flushed from the driver */
if (wlc->osh->pktalloced != 0) {
WL_ERROR("%d packets not freed at wlc_down!!!!!!\n",
wlc->osh->pktalloced);
}
#ifdef BCMDBG #ifdef BCMDBG
/* Since all the packets should have been freed, /* Since all the packets should have been freed,
* all callbacks should have been called * all callbacks should have been called
...@@ -5122,7 +5116,7 @@ wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, struct sk_buff *pkt, ...@@ -5122,7 +5116,7 @@ wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, struct sk_buff *pkt,
tx_failed[WME_PRIO2AC(p->priority)].bytes, tx_failed[WME_PRIO2AC(p->priority)].bytes,
pkttotlen(p)); pkttotlen(p));
} }
pkt_buf_free_skb(wlc->osh, p, true); pkt_buf_free_skb(p);
wlc->pub->_cnt->txnobuf++; wlc->pub->_cnt->txnobuf++;
} }
...@@ -5154,8 +5148,11 @@ void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu, ...@@ -5154,8 +5148,11 @@ void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
WL_ERROR("wl%d: wlc_txq_enq: txq overflow\n", WL_ERROR("wl%d: wlc_txq_enq: txq overflow\n",
wlc->pub->unit); wlc->pub->unit);
/* ASSERT(9 == 8); *//* XXX we might hit this condtion in case packet flooding from mac80211 stack */ /*
pkt_buf_free_skb(wlc->osh, sdu, true); * XXX we might hit this condtion in case
* packet flooding from mac80211 stack
*/
pkt_buf_free_skb(sdu);
wlc->pub->_cnt->txnobuf++; wlc->pub->_cnt->txnobuf++;
} }
...@@ -6710,7 +6707,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2) ...@@ -6710,7 +6707,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
fatal: fatal:
ASSERT(0); ASSERT(0);
if (p) if (p)
pkt_buf_free_skb(wlc->osh, p, true); pkt_buf_free_skb(p);
return true; return true;
...@@ -6977,7 +6974,6 @@ wlc_recvctl(struct wlc_info *wlc, d11rxhdr_t *rxh, struct sk_buff *p) ...@@ -6977,7 +6974,6 @@ wlc_recvctl(struct wlc_info *wlc, d11rxhdr_t *rxh, struct sk_buff *p)
ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p);
wlc->pub->_cnt->ieee_rx++; wlc->pub->_cnt->ieee_rx++;
wlc->osh->pktalloced--;
return; return;
} }
...@@ -7094,7 +7090,7 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p) ...@@ -7094,7 +7090,7 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
return; return;
toss: toss:
pkt_buf_free_skb(wlc->osh, p, false); pkt_buf_free_skb(p);
} }
/* calculate frame duration for Mixed-mode L-SIG spoofing, return /* calculate frame duration for Mixed-mode L-SIG spoofing, return
......
...@@ -95,9 +95,8 @@ extern struct sk_buff *pktq_pdeq(struct pktq *pq, int prec); ...@@ -95,9 +95,8 @@ extern struct sk_buff *pktq_pdeq(struct pktq *pq, int prec);
extern struct sk_buff *pktq_pdeq_tail(struct pktq *pq, int prec); extern struct sk_buff *pktq_pdeq_tail(struct pktq *pq, int prec);
/* packet primitives */ /* packet primitives */
extern struct sk_buff *pkt_buf_get_skb(struct osl_info *osh, uint len); extern struct sk_buff *pkt_buf_get_skb(uint len);
extern void pkt_buf_free_skb(struct osl_info *osh, extern void pkt_buf_free_skb(struct sk_buff *skb);
struct sk_buff *skb, bool send);
/* Empty the queue at particular precedence level */ /* Empty the queue at particular precedence level */
#ifdef BRCM_FULLMAC #ifdef BRCM_FULLMAC
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
/* Global ASSERT type flag */ /* Global ASSERT type flag */
u32 g_assert_type; u32 g_assert_type;
struct sk_buff *BCMFASTPATH pkt_buf_get_skb(struct osl_info *osh, uint len) struct sk_buff *BCMFASTPATH pkt_buf_get_skb(uint len)
{ {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -41,16 +41,13 @@ struct sk_buff *BCMFASTPATH pkt_buf_get_skb(struct osl_info *osh, uint len) ...@@ -41,16 +41,13 @@ struct sk_buff *BCMFASTPATH pkt_buf_get_skb(struct osl_info *osh, uint len)
if (skb) { if (skb) {
skb_put(skb, len); skb_put(skb, len);
skb->priority = 0; skb->priority = 0;
osh->pktalloced++;
} }
return skb; return skb;
} }
/* Free the driver packet. Free the tag if present */ /* Free the driver packet. Free the tag if present */
void BCMFASTPATH pkt_buf_free_skb(struct osl_info *osh, void BCMFASTPATH pkt_buf_free_skb(struct sk_buff *skb)
struct sk_buff *skb, bool send)
{ {
struct sk_buff *nskb; struct sk_buff *nskb;
int nest = 0; int nest = 0;
...@@ -73,7 +70,6 @@ void BCMFASTPATH pkt_buf_free_skb(struct osl_info *osh, ...@@ -73,7 +70,6 @@ void BCMFASTPATH pkt_buf_free_skb(struct osl_info *osh,
*/ */
dev_kfree_skb(skb); dev_kfree_skb(skb);
osh->pktalloced--;
nest++; nest++;
skb = nskb; skb = nskb;
} }
...@@ -245,7 +241,7 @@ void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir) ...@@ -245,7 +241,7 @@ void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir)
while (p) { while (p) {
q->head = p->prev; q->head = p->prev;
p->prev = NULL; p->prev = NULL;
pkt_buf_free_skb(osh, p, dir); pkt_buf_free_skb(p);
q->len--; q->len--;
pq->len--; pq->len--;
p = q->head; p = q->head;
...@@ -279,7 +275,7 @@ pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir, ...@@ -279,7 +275,7 @@ pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir,
else else
prev->prev = p->prev; prev->prev = p->prev;
p->prev = NULL; p->prev = NULL;
pkt_buf_free_skb(osh, p, dir); pkt_buf_free_skb(p);
q->len--; q->len--;
pq->len--; pq->len--;
p = (head ? q->head : prev->prev); p = (head ? q->head : prev->prev);
......
...@@ -804,7 +804,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di) ...@@ -804,7 +804,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
if ((di->hnddma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) { if ((di->hnddma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) {
DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n", DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n",
di->name, len)); di->name, len));
pkt_buf_free_skb(di->osh, head, false); pkt_buf_free_skb(head);
di->hnddma.rxgiants++; di->hnddma.rxgiants++;
goto next_frame; goto next_frame;
} }
...@@ -852,7 +852,7 @@ static bool BCMFASTPATH _dma_rxfill(dma_info_t *di) ...@@ -852,7 +852,7 @@ static bool BCMFASTPATH _dma_rxfill(dma_info_t *di)
size to be allocated size to be allocated
*/ */
p = pkt_buf_get_skb(di->osh, di->rxbufsize + extra_offset); p = pkt_buf_get_skb(di->rxbufsize + extra_offset);
if (p == NULL) { if (p == NULL) {
DMA_ERROR(("%s: dma_rxfill: out of rxbufs\n", DMA_ERROR(("%s: dma_rxfill: out of rxbufs\n",
...@@ -953,7 +953,7 @@ static void _dma_rxreclaim(dma_info_t *di) ...@@ -953,7 +953,7 @@ static void _dma_rxreclaim(dma_info_t *di)
DMA_TRACE(("%s: dma_rxreclaim\n", di->name)); DMA_TRACE(("%s: dma_rxreclaim\n", di->name));
while ((p = _dma_getnextrxp(di, true))) while ((p = _dma_getnextrxp(di, true)))
pkt_buf_free_skb(di->osh, p, false); pkt_buf_free_skb(p);
} }
static void *BCMFASTPATH _dma_getnextrxp(dma_info_t *di, bool forceall) static void *BCMFASTPATH _dma_getnextrxp(dma_info_t *di, bool forceall)
...@@ -1194,7 +1194,7 @@ static void BCMFASTPATH dma64_txreclaim(dma_info_t *di, txd_range_t range) ...@@ -1194,7 +1194,7 @@ static void BCMFASTPATH dma64_txreclaim(dma_info_t *di, txd_range_t range)
while ((p = dma64_getnexttxp(di, range))) { while ((p = dma64_getnexttxp(di, range))) {
/* For unframed data, we don't have any packets to free */ /* For unframed data, we don't have any packets to free */
if (!(di->hnddma.dmactrlflags & DMA_CTRL_UNFRAMED)) if (!(di->hnddma.dmactrlflags & DMA_CTRL_UNFRAMED))
pkt_buf_free_skb(di->osh, p, true); pkt_buf_free_skb(p);
} }
} }
...@@ -1544,7 +1544,7 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0, ...@@ -1544,7 +1544,7 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
outoftxd: outoftxd:
DMA_ERROR(("%s: dma_txfast: out of txds !!!\n", di->name)); DMA_ERROR(("%s: dma_txfast: out of txds !!!\n", di->name));
pkt_buf_free_skb(di->osh, p0, true); pkt_buf_free_skb(p0);
di->hnddma.txavail = 0; di->hnddma.txavail = 0;
di->hnddma.txnobuf++; di->hnddma.txnobuf++;
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment