>From 37825730d6b61462211908e7bc287a153525aecf Mon Sep 17 00:00:00 2001 From: Arend van Spriel <arend@xxxxxxxxxxxx> Date: Sun, 14 Nov 2010 14:08:56 +0100 Subject: [PATCH 3/3] staging: brcm80211: replaced PKTSETLEN macro by native __skb_trim call - removed PKTSETLEN macro. - removed unused PKT... macros. Reviewed-by: Brett Rudley <brudley@xxxxxxxxxxxx> Reviewed-by: Henry Ptasinski <henryp@xxxxxxxxxxxx> Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx> --- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 8 ++++---- drivers/staging/brcm80211/include/linux_osl.h | 4 +--- drivers/staging/brcm80211/sys/wlc_mac80211.c | 2 +- drivers/staging/brcm80211/util/hnddma.c | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c index c822505..a7c02db 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c @@ -358,23 +358,23 @@ extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable); #error OOB_INTR_ONLY is NOT working with SDIO_ISR_THREAD #endif /* defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) */ #define PKTALIGN(osh, p, len, align) \ do { \ uint datalign; \ datalign = (unsigned long)PKTDATA((p)); \ datalign = roundup(datalign, (align)) - datalign; \ ASSERT(datalign < (align)); \ ASSERT(PKTLEN((p)) >= ((len) + datalign)); \ if (datalign) \ skb_pull((p), datalign); \ - PKTSETLEN((p), (len)); \ + __skb_trim((p), (len)); \ } while (0) /* Limit on rounding up frames */ static const uint max_roundup = 512; /* Try doing readahead */ static bool dhd_readahead; /* To check if there's window offered */ #define DATAOK(bus) \ (((u8)(bus->tx_max - bus->tx_seq) != 0) && \ @@ -3512,23 +3512,23 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) if (rxseq != seq) { DHD_GLOM(("%s: rx_seq %d, expected %d\n", __func__, seq, rxseq)); bus->rx_badseq++; rxseq = seq; } #ifdef DHD_DEBUG if (DHD_BYTES_ON() && DHD_DATA_ON()) prhex("Rx Subframe Data", dptr, dlen); #endif - PKTSETLEN(pfirst, sublen); + __skb_trim(pfirst, sublen); skb_pull(pfirst, doff); if (PKTLEN(pfirst) == 0) { PKTFREE(bus->dhd->osh, pfirst, false); if (plast) { PKTSETNEXT(plast, pnext); } else { ASSERT(save_pfirst == pfirst); save_pfirst = pnext; } continue; @@ -4142,36 +4142,36 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) deliver: /* Save superframe descriptor and allocate packet frame */ if (chan == SDPCM_GLOM_CHANNEL) { if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_FRAMETAG_LEN])) { DHD_GLOM(("%s: glom descriptor, %d bytes:\n", __func__, len)); #ifdef DHD_DEBUG if (DHD_GLOM_ON()) { prhex("Glom Data", PKTDATA(pkt), len); } #endif - PKTSETLEN(pkt, len); + __skb_trim(pkt, len); ASSERT(doff == SDPCM_HDRLEN); skb_pull(pkt, SDPCM_HDRLEN); bus->glomd = pkt; } else { DHD_ERROR(("%s: glom superframe w/o " "descriptor!\n", __func__)); dhdsdio_rxfail(bus, false, false); } continue; } /* Fill in packet len and prio, deliver upward */ - PKTSETLEN(pkt, len); + __skb_trim(pkt, len); skb_pull(pkt, doff); #ifdef SDTEST /* Test channel packets are processed separately */ if (chan == SDPCM_TEST_CHANNEL) { dhdsdio_testrcv(bus, pkt, seq); continue; } #endif /* SDTEST */ if (PKTLEN(pkt) == 0) { diff --git a/drivers/staging/brcm80211/include/linux_osl.h b/drivers/staging/brcm80211/include/linux_osl.h index 379c35a..377517e 100644 --- a/drivers/staging/brcm80211/include/linux_osl.h +++ b/drivers/staging/brcm80211/include/linux_osl.h @@ -273,26 +273,24 @@ extern void osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction); /* packet primitives */ #define PKTGET(osh, len, send) osl_pktget((osh), (len)) #define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send)) #define PKTDATA(skb) (((struct sk_buff *)(skb))->data) #define PKTLEN(skb) (((struct sk_buff *)(skb))->len) #define PKTHEADROOM(skb) (PKTDATA(skb)-(((struct sk_buff *)(skb))->head)) #define PKTTAILROOM(skb) ((((struct sk_buff *)(skb))->end)-(((struct sk_buff *)(skb))->tail)) #define PKTNEXT(skb) (((struct sk_buff *)(skb))->next) #define PKTSETNEXT(skb, x) \ (((struct sk_buff *)(skb))->next = (struct sk_buff *)(x)) -#define PKTSETLEN(skb, len) __skb_trim((struct sk_buff *)(skb), (len)) #define PKTALLOCED(osh) (((osl_pubinfo_t *)(osh))->pktalloced) -#define PKTSETPOOL(osh, skb, x, y) do {} while (0) -#define PKTPOOL(osh, skb) false + extern void *osl_pktget(osl_t *osh, uint len); extern void osl_pktfree(osl_t *osh, void *skb, bool send); #ifdef BRCM_FULLMAC extern void *osl_pktget_static(osl_t *osh, uint len); extern void osl_pktfree_static(osl_t *osh, void *skb, bool send); static inline void * osl_pkt_frmnative(osl_pubinfo_t *osh, struct sk_buff *skb) { struct sk_buff *nskb; diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c index e161ccb..16d9f9f 100644 --- a/drivers/staging/brcm80211/sys/wlc_mac80211.c +++ b/drivers/staging/brcm80211/sys/wlc_mac80211.c @@ -7155,23 +7155,23 @@ wlc_recvctl(wlc_info_t *wlc, osl_t *osh, d11rxhdr_t *rxh, void *p) * Cache plcp for first MPDU of AMPD and use chacched version for INTERMEDIATE. * Test for INTERMEDIATE like so: * if (!(plcp[0] | plcp[1] | plcp[2])) */ memset(&rx_status, 0, sizeof(rx_status)); prep_mac80211_status(wlc, rxh, p, &rx_status); /* mac header+body length, exclude CRC and plcp header */ len_mpdu = PKTLEN(p) - D11_PHY_HDR_LEN - DOT11_FCS_LEN; skb_pull(p, D11_PHY_HDR_LEN); - PKTSETLEN(p, len_mpdu); + __skb_trim(p, len_mpdu); ASSERT(!PKTNEXT(p)); ASSERT(!PKTLINK(p)); ASSERT(IS_ALIGNED((unsigned long)skb->data, 2)); memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); WLCNTINCR(wlc->pub->_cnt->ieee_rx); PKTUNALLOC(osh); diff --git a/drivers/staging/brcm80211/util/hnddma.c b/drivers/staging/brcm80211/util/hnddma.c index 38bc6d7..8fe476e 100644 --- a/drivers/staging/brcm80211/util/hnddma.c +++ b/drivers/staging/brcm80211/util/hnddma.c @@ -995,32 +995,32 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di) #if defined(__mips__) if (!len) { while (!(len = *(u16 *) OSL_UNCACHED(PKTDATA(head)))) udelay(1); *(u16 *) PKTDATA(head) = htol16((u16) len); } #endif /* defined(__mips__) */ /* set actual length */ pkt_len = min((di->rxoffset + len), di->rxbufsize); - PKTSETLEN(head, pkt_len); + __skb_trim(head, pkt_len); resid = len - (di->rxbufsize - di->rxoffset); /* check for single or multi-buffer rx */ if (resid > 0) { tail = head; while ((resid > 0) && (p = _dma_getnextrxp(di, false))) { PKTSETNEXT(tail, p); pkt_len = min(resid, (int)di->rxbufsize); - PKTSETLEN(p, pkt_len); + __skb_trim(p, pkt_len); tail = p; resid -= di->rxbufsize; } #ifdef BCMDBG if (resid > 0) { uint cur; ASSERT(p == NULL); cur = (DMA64_ENAB(di) && DMA64_MODE(di)) ? B2I(((R_REG(di->osh, &di->d64rxregs->status0) & -- 1.7.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel