提交 54991ad6 编写于 作者: A Arend van Spriel 提交者: Greg Kroah-Hartman

staging: brcm80211: removed packet macros for accessing sk_buff fields

With the packet storage type changed from void pointer to struct sk_buff
pointer there is no need for macros for accessing these fields through
casting. These can now be accessed directly.
Reviewed-by: NBrett Rudley <brudley@broadcom.com>
Signed-off-by: NArend van Spriel <arend@broadcom.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 c26b1378
...@@ -944,8 +944,8 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, ...@@ -944,8 +944,8 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
/* Claim host controller */ /* Claim host controller */
sdio_claim_host(gInstance->func[func]); sdio_claim_host(gInstance->func[func]);
for (pnext = pkt; pnext; pnext = PKTNEXT(pnext)) { for (pnext = pkt; pnext; pnext = pnext->next) {
uint pkt_len = PKTLEN(pnext); uint pkt_len = pnext->len;
pkt_len += 3; pkt_len += 3;
pkt_len &= 0xFFFFFFFC; pkt_len &= 0xFFFFFFFC;
...@@ -962,23 +962,23 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, ...@@ -962,23 +962,23 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
* is supposed to give * is supposed to give
* us something we can work with. * us something we can work with.
*/ */
ASSERT(((u32) (PKTDATA(pkt)) & DMA_ALIGN_MASK) == 0); ASSERT(((u32) (pkt->data) & DMA_ALIGN_MASK) == 0);
if ((write) && (!fifo)) { if ((write) && (!fifo)) {
err_ret = sdio_memcpy_toio(gInstance->func[func], addr, err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
((u8 *) PKTDATA(pnext)), ((u8 *) (pnext->data)),
pkt_len); pkt_len);
} else if (write) { } else if (write) {
err_ret = sdio_memcpy_toio(gInstance->func[func], addr, err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
((u8 *) PKTDATA(pnext)), ((u8 *) (pnext->data)),
pkt_len); pkt_len);
} else if (fifo) { } else if (fifo) {
err_ret = sdio_readsb(gInstance->func[func], err_ret = sdio_readsb(gInstance->func[func],
((u8 *) PKTDATA(pnext)), ((u8 *) (pnext->data)),
addr, pkt_len); addr, pkt_len);
} else { } else {
err_ret = sdio_memcpy_fromio(gInstance->func[func], err_ret = sdio_memcpy_fromio(gInstance->func[func],
((u8 *) PKTDATA(pnext)), ((u8 *) (pnext->data)),
addr, pkt_len); addr, pkt_len);
} }
...@@ -1048,41 +1048,41 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, ...@@ -1048,41 +1048,41 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
/* For a write, copy the buffer data into the packet. */ /* For a write, copy the buffer data into the packet. */
if (write) if (write)
bcopy(buffer, PKTDATA(mypkt), buflen_u); bcopy(buffer, mypkt->data, buflen_u);
Status = Status =
sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt); sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
/* For a read, copy the packet data back to the buffer. */ /* For a read, copy the packet data back to the buffer. */
if (!write) if (!write)
bcopy(PKTDATA(mypkt), buffer, buflen_u); bcopy(mypkt->data, buffer, buflen_u);
PKTFREE(sd->osh, mypkt, write ? true : false); PKTFREE(sd->osh, mypkt, write ? true : false);
} else if (((u32) (PKTDATA(pkt)) & 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. */
/* In this case, we cannot have a chain. */ /* In this case, we cannot have a chain. */
ASSERT(PKTNEXT(pkt) == NULL); ASSERT(pkt->next == NULL);
sd_data(("%s: Creating aligned %s Packet, len=%d\n", sd_data(("%s: Creating aligned %s Packet, len=%d\n",
__func__, write ? "TX" : "RX", PKTLEN(pkt))); __func__, write ? "TX" : "RX", pkt->len));
mypkt = PKTGET(sd->osh, PKTLEN(pkt), write ? true : false); mypkt = PKTGET(sd->osh, pkt->len, write ? true : false);
if (!mypkt) { if (!mypkt) {
sd_err(("%s: PKTGET failed: len %d\n", sd_err(("%s: PKTGET failed: len %d\n",
__func__, PKTLEN(pkt))); __func__, pkt->len));
return SDIOH_API_RC_FAIL; return SDIOH_API_RC_FAIL;
} }
/* For a write, copy the buffer data into the packet. */ /* For a write, copy the buffer data into the packet. */
if (write) if (write)
bcopy(PKTDATA(pkt), PKTDATA(mypkt), PKTLEN(pkt)); bcopy(pkt->data, mypkt->data, pkt->len);
Status = Status =
sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt); sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
/* For a read, copy the packet data back to the buffer. */ /* For a read, copy the packet data back to the buffer. */
if (!write) if (!write)
bcopy(PKTDATA(mypkt), PKTDATA(pkt), PKTLEN(mypkt)); bcopy(mypkt->data, pkt->data, mypkt->len);
PKTFREE(sd->osh, mypkt, write ? true : false); PKTFREE(sd->osh, mypkt, write ? true : false);
} else { /* case 3: We have a packet and } else { /* case 3: We have a packet and
......
...@@ -323,13 +323,13 @@ void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf) ...@@ -323,13 +323,13 @@ void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf)
skb_push(pktbuf, BDC_HEADER_LEN); skb_push(pktbuf, BDC_HEADER_LEN);
h = (struct bdc_header *)PKTDATA(pktbuf); h = (struct bdc_header *)(pktbuf->data);
h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT); h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT);
if (PKTSUMNEEDED(pktbuf)) if (PKTSUMNEEDED(pktbuf))
h->flags |= BDC_FLAG_SUM_NEEDED; h->flags |= BDC_FLAG_SUM_NEEDED;
h->priority = (PKTPRIO(pktbuf) & BDC_PRIORITY_MASK); h->priority = (pktbuf->priority & BDC_PRIORITY_MASK);
h->flags2 = 0; h->flags2 = 0;
h->rssi = 0; h->rssi = 0;
#endif /* BDC */ #endif /* BDC */
...@@ -341,13 +341,13 @@ bool dhd_proto_fcinfo(dhd_pub_t *dhd, struct sk_buff *pktbuf, u8 * fcbits) ...@@ -341,13 +341,13 @@ bool dhd_proto_fcinfo(dhd_pub_t *dhd, struct sk_buff *pktbuf, u8 * fcbits)
#ifdef BDC #ifdef BDC
struct bdc_header *h; struct bdc_header *h;
if (PKTLEN(pktbuf) < BDC_HEADER_LEN) { if (pktbuf->len < BDC_HEADER_LEN) {
DHD_ERROR(("%s: rx data too short (%d < %d)\n", DHD_ERROR(("%s: rx data too short (%d < %d)\n",
__func__, PKTLEN(pktbuf), BDC_HEADER_LEN)); __func__, pktbuf->len, BDC_HEADER_LEN));
return BCME_ERROR; return BCME_ERROR;
} }
h = (struct bdc_header *)PKTDATA(pktbuf); h = (struct bdc_header *)(pktbuf->data);
*fcbits = h->priority >> BDC_PRIORITY_FC_SHIFT; *fcbits = h->priority >> BDC_PRIORITY_FC_SHIFT;
if ((h->flags2 & BDC_FLAG2_FC_FLAG) == BDC_FLAG2_FC_FLAG) if ((h->flags2 & BDC_FLAG2_FC_FLAG) == BDC_FLAG2_FC_FLAG)
...@@ -367,13 +367,13 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf) ...@@ -367,13 +367,13 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
#ifdef BDC #ifdef BDC
/* Pop BDC header used to convey priority for buses that don't */ /* Pop BDC header used to convey priority for buses that don't */
if (PKTLEN(pktbuf) < BDC_HEADER_LEN) { if (pktbuf->len < BDC_HEADER_LEN) {
DHD_ERROR(("%s: rx data too short (%d < %d)\n", __func__, DHD_ERROR(("%s: rx data too short (%d < %d)\n", __func__,
PKTLEN(pktbuf), BDC_HEADER_LEN)); pktbuf->len, BDC_HEADER_LEN));
return BCME_ERROR; return BCME_ERROR;
} }
h = (struct bdc_header *)PKTDATA(pktbuf); h = (struct bdc_header *)(pktbuf->data);
*ifidx = BDC_GET_IF_IDX(h); *ifidx = BDC_GET_IF_IDX(h);
if (*ifidx >= DHD_MAX_IFS) { if (*ifidx >= DHD_MAX_IFS) {
...@@ -396,7 +396,7 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf) ...@@ -396,7 +396,7 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
PKTSETSUMGOOD(pktbuf, true); PKTSETSUMGOOD(pktbuf, true);
} }
PKTSETPRIO(pktbuf, (h->priority & BDC_PRIORITY_MASK)); pktbuf->priority = h->priority & BDC_PRIORITY_MASK;
skb_pull(pktbuf, BDC_HEADER_LEN); skb_pull(pktbuf, BDC_HEADER_LEN);
#endif /* BDC */ #endif /* BDC */
......
...@@ -1028,8 +1028,8 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf) ...@@ -1028,8 +1028,8 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
return -ENODEV; return -ENODEV;
/* Update multicast statistic */ /* Update multicast statistic */
if (PKTLEN(pktbuf) >= ETHER_ADDR_LEN) { if (pktbuf->len >= ETHER_ADDR_LEN) {
u8 *pktdata = (u8 *) PKTDATA(pktbuf); u8 *pktdata = (u8 *) (pktbuf->data);
struct ether_header *eh = (struct ether_header *)pktdata; struct ether_header *eh = (struct ether_header *)pktdata;
if (ETHER_ISMULTI(eh->ether_dhost)) if (ETHER_ISMULTI(eh->ether_dhost))
...@@ -1151,8 +1151,8 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, ...@@ -1151,8 +1151,8 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf,
for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) { for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) {
pnext = PKTNEXT(pktbuf); pnext = pktbuf->next;
PKTSETNEXT(pktbuf, NULL); pktbuf->next = NULL;
skb = PKTTONATIVE(dhdp->osh, pktbuf); skb = PKTTONATIVE(dhdp->osh, pktbuf);
...@@ -1233,7 +1233,7 @@ void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success) ...@@ -1233,7 +1233,7 @@ void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success)
dhd_prot_hdrpull(dhdp, &ifidx, txp); dhd_prot_hdrpull(dhdp, &ifidx, txp);
eh = (struct ether_header *)PKTDATA(txp); eh = (struct ether_header *)(txp->data);
type = ntoh16(eh->ether_type); type = ntoh16(eh->ether_type);
if (type == ETHER_TYPE_802_1X) if (type == ETHER_TYPE_802_1X)
......
...@@ -357,16 +357,16 @@ extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable); ...@@ -357,16 +357,16 @@ extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable);
#if defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) #if defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD)
#error OOB_INTR_ONLY is NOT working with SDIO_ISR_THREAD #error OOB_INTR_ONLY is NOT working with SDIO_ISR_THREAD
#endif /* defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) */ #endif /* defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) */
#define PKTALIGN(osh, p, len, align) \ #define PKTALIGN(_osh, _p, _len, _align) \
do { \ do { \
uint datalign; \ uint datalign; \
datalign = (unsigned long)PKTDATA((p)); \ datalign = (unsigned long)((_p)->data); \
datalign = roundup(datalign, (align)) - datalign; \ datalign = roundup(datalign, (_align)) - datalign; \
ASSERT(datalign < (align)); \ ASSERT(datalign < (_align)); \
ASSERT(PKTLEN((p)) >= ((len) + datalign)); \ ASSERT((_p)->len >= ((_len) + datalign)); \
if (datalign) \ if (datalign) \
skb_pull((p), datalign); \ skb_pull((_p), datalign); \
__skb_trim((p), (len)); \ __skb_trim((_p), (_len)); \
} while (0) } while (0)
/* Limit on rounding up frames */ /* Limit on rounding up frames */
...@@ -927,7 +927,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -927,7 +927,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
goto done; goto done;
} }
frame = (u8 *) PKTDATA(pkt); frame = (u8 *) (pkt->data);
/* Add alignment padding, allocate new packet if needed */ /* Add alignment padding, allocate new packet if needed */
pad = ((unsigned long)frame % DHD_SDALIGN); pad = ((unsigned long)frame % DHD_SDALIGN);
...@@ -936,37 +936,37 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -936,37 +936,37 @@ 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__, (int)PKTHEADROOM(pkt), pad)); __func__, (int)PKTHEADROOM(pkt), pad));
bus->dhd->tx_realloc++; bus->dhd->tx_realloc++;
new = PKTGET(osh, (PKTLEN(pkt) + DHD_SDALIGN), true); new = PKTGET(osh, (pkt->len + DHD_SDALIGN), true);
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",
__func__, PKTLEN(pkt) + DHD_SDALIGN)); __func__, pkt->len + DHD_SDALIGN));
ret = BCME_NOMEM; ret = BCME_NOMEM;
goto done; goto done;
} }
PKTALIGN(osh, new, PKTLEN(pkt), DHD_SDALIGN); PKTALIGN(osh, new, pkt->len, DHD_SDALIGN);
bcopy(PKTDATA(pkt), PKTDATA(new), PKTLEN(pkt)); bcopy(pkt->data, new->data, pkt->len);
if (free_pkt) if (free_pkt)
PKTFREE(osh, pkt, true); PKTFREE(osh, pkt, true);
/* 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;
frame = (u8 *) PKTDATA(pkt); frame = (u8 *) (pkt->data);
ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0); ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0);
pad = 0; pad = 0;
} else { } else {
skb_push(pkt, pad); skb_push(pkt, pad);
frame = (u8 *) PKTDATA(pkt); frame = (u8 *) (pkt->data);
ASSERT((pad + SDPCM_HDRLEN) <= (int)PKTLEN(pkt)); ASSERT((pad + SDPCM_HDRLEN) <= (int)(pkt->len));
bzero(frame, pad + SDPCM_HDRLEN); bzero(frame, pad + SDPCM_HDRLEN);
} }
} }
ASSERT(pad < DHD_SDALIGN); ASSERT(pad < DHD_SDALIGN);
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
len = (u16) PKTLEN(pkt); len = (u16) (pkt->len);
*(u16 *) frame = htol16(len); *(u16 *) frame = htol16(len);
*(((u16 *) frame) + 1) = htol16(~len); *(((u16 *) frame) + 1) = htol16(~len);
...@@ -979,7 +979,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -979,7 +979,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader)); htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
#ifdef DHD_DEBUG #ifdef DHD_DEBUG
tx_packets[PKTPRIO(pkt)]++; tx_packets[pkt->priority]++;
if (DHD_BYTES_ON() && if (DHD_BYTES_ON() &&
(((DHD_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) || (((DHD_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) ||
(DHD_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) { (DHD_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) {
...@@ -1075,14 +1075,14 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) ...@@ -1075,14 +1075,14 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
osh = bus->dhd->osh; osh = bus->dhd->osh;
datalen = PKTLEN(pkt); datalen = pkt->len;
#ifdef SDTEST #ifdef SDTEST
/* Push the test header if doing loopback */ /* Push the test header if doing loopback */
if (bus->ext_loop) { if (bus->ext_loop) {
u8 *data; u8 *data;
skb_push(pkt, SDPCM_TEST_HDRLEN); skb_push(pkt, SDPCM_TEST_HDRLEN);
data = PKTDATA(pkt); data = pkt->data;
*data++ = SDPCM_TEST_ECHOREQ; *data++ = SDPCM_TEST_ECHOREQ;
*data++ = (u8) bus->loopid++; *data++ = (u8) bus->loopid++;
*data++ = (datalen >> 0); *data++ = (datalen >> 0);
...@@ -1093,9 +1093,9 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) ...@@ -1093,9 +1093,9 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
/* Add space for the header */ /* Add space for the header */
skb_push(pkt, SDPCM_HDRLEN); skb_push(pkt, SDPCM_HDRLEN);
ASSERT(IS_ALIGNED((unsigned long)PKTDATA(pkt), 2)); ASSERT(IS_ALIGNED((unsigned long)(pkt->data), 2));
prec = PRIO2PREC((PKTPRIO(pkt) & PRIOMASK)); prec = PRIO2PREC((pkt->priority & PRIOMASK));
/* Check for existing queue, current flow-control, /* Check for existing queue, current flow-control,
pending event, or pending clock */ pending event, or pending clock */
...@@ -1191,7 +1191,7 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) ...@@ -1191,7 +1191,7 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes)
break; break;
} }
dhd_os_sdunlock_txq(bus->dhd); dhd_os_sdunlock_txq(bus->dhd);
datalen = PKTLEN(pkt) - SDPCM_HDRLEN; datalen = pkt->len - SDPCM_HDRLEN;
#ifndef SDTEST #ifndef SDTEST
ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true); ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
...@@ -3204,8 +3204,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3204,8 +3204,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
pfirst = plast = pnext = NULL; pfirst = plast = pnext = NULL;
dlen = (u16) PKTLEN(bus->glomd); dlen = (u16) (bus->glomd->len);
dptr = PKTDATA(bus->glomd); dptr = bus->glomd->data;
if (!dlen || (dlen & 1)) { if (!dlen || (dlen & 1)) {
DHD_ERROR(("%s: bad glomd len(%d), ignore descriptor\n", DHD_ERROR(("%s: bad glomd len(%d), ignore descriptor\n",
__func__, dlen)); __func__, dlen));
...@@ -3246,13 +3246,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3246,13 +3246,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
__func__, num, sublen)); __func__, num, sublen));
break; break;
} }
ASSERT(!PKTLINK(pnext)); ASSERT(!(pnext->prev));
if (!pfirst) { if (!pfirst) {
ASSERT(!plast); ASSERT(!plast);
pfirst = plast = pnext; pfirst = plast = pnext;
} else { } else {
ASSERT(plast); ASSERT(plast);
PKTSETNEXT(plast, pnext); plast->next = pnext;
plast = pnext; plast = pnext;
} }
...@@ -3295,10 +3295,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3295,10 +3295,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
if (DHD_GLOM_ON()) { if (DHD_GLOM_ON()) {
DHD_GLOM(("%s: try superframe read, packet chain:\n", DHD_GLOM(("%s: try superframe read, packet chain:\n",
__func__)); __func__));
for (pnext = bus->glom; pnext; pnext = PKTNEXT(pnext)) { for (pnext = bus->glom; pnext; pnext = pnext->next) {
DHD_GLOM((" %p: %p len 0x%04x (%d)\n", DHD_GLOM((" %p: %p len 0x%04x (%d)\n",
pnext, (u8 *) PKTDATA(pnext), pnext, (u8 *) (pnext->data),
PKTLEN(pnext), PKTLEN(pnext))); pnext->len, pnext->len));
} }
} }
...@@ -3314,7 +3314,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3314,7 +3314,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
bcmsdh_cur_sbwad bcmsdh_cur_sbwad
(bus->sdh), SDIO_FUNC_2, (bus->sdh), SDIO_FUNC_2,
F2SYNC, F2SYNC,
(u8 *) PKTDATA(pfirst), (u8 *) pfirst->data,
dlen, pfirst, NULL, NULL); dlen, pfirst, NULL, NULL);
} else if (bus->dataptr) { } else if (bus->dataptr) {
errcode = dhd_bcmsdh_recv_buf(bus, errcode = dhd_bcmsdh_recv_buf(bus,
...@@ -3360,13 +3360,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3360,13 +3360,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
} }
#ifdef DHD_DEBUG #ifdef DHD_DEBUG
if (DHD_GLOM_ON()) { if (DHD_GLOM_ON()) {
prhex("SUPERFRAME", PKTDATA(pfirst), prhex("SUPERFRAME", pfirst->data,
min_t(int, PKTLEN(pfirst), 48)); min_t(int, pfirst->len, 48));
} }
#endif #endif
/* Validate the superframe header */ /* Validate the superframe header */
dptr = (u8 *) PKTDATA(pfirst); dptr = (u8 *) (pfirst->data);
sublen = ltoh16_ua(dptr); sublen = ltoh16_ua(dptr);
check = ltoh16_ua(dptr + sizeof(u16)); check = ltoh16_ua(dptr + sizeof(u16));
...@@ -3404,11 +3404,11 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3404,11 +3404,11 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
__func__)); __func__));
errcode = -1; errcode = -1;
} else if ((doff < SDPCM_HDRLEN) || } else if ((doff < SDPCM_HDRLEN) ||
(doff > (PKTLEN(pfirst) - SDPCM_HDRLEN))) { (doff > (pfirst->len - SDPCM_HDRLEN))) {
DHD_ERROR(("%s (superframe): Bad data offset %d: HW %d " DHD_ERROR(("%s (superframe): Bad data offset %d: HW %d "
"pkt %d min %d\n", "pkt %d min %d\n",
__func__, doff, sublen, __func__, doff, sublen,
PKTLEN(pfirst), SDPCM_HDRLEN)); pfirst->len, SDPCM_HDRLEN));
errcode = -1; errcode = -1;
} }
...@@ -3434,9 +3434,9 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3434,9 +3434,9 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
/* Validate all the subframe headers */ /* Validate all the subframe headers */
for (num = 0, pnext = pfirst; pnext && !errcode; for (num = 0, pnext = pfirst; pnext && !errcode;
num++, pnext = PKTNEXT(pnext)) { num++, pnext = pnext->next) {
dptr = (u8 *) PKTDATA(pnext); dptr = (u8 *) (pnext->data);
dlen = (u16) PKTLEN(pnext); dlen = (u16) (pnext->len);
sublen = ltoh16_ua(dptr); sublen = ltoh16_ua(dptr);
check = ltoh16_ua(dptr + sizeof(u16)); check = ltoh16_ua(dptr + sizeof(u16));
chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
...@@ -3496,10 +3496,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3496,10 +3496,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
for (num = 0; pfirst; rxseq++, pfirst = pnext) { for (num = 0; pfirst; rxseq++, pfirst = pnext) {
pnext = PKTNEXT(pfirst); pnext = pfirst->next;
PKTSETNEXT(pfirst, NULL); pfirst->next = NULL;
dptr = (u8 *) PKTDATA(pfirst); dptr = (u8 *) (pfirst->data);
sublen = ltoh16_ua(dptr); sublen = ltoh16_ua(dptr);
chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]); seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);
...@@ -3507,8 +3507,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3507,8 +3507,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
DHD_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d " DHD_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d "
"chan %d seq %d\n", "chan %d seq %d\n",
__func__, num, pfirst, PKTDATA(pfirst), __func__, num, pfirst, pfirst->data,
PKTLEN(pfirst), sublen, chan, seq)); pfirst->len, sublen, chan, seq));
ASSERT((chan == SDPCM_DATA_CHANNEL) ASSERT((chan == SDPCM_DATA_CHANNEL)
|| (chan == SDPCM_EVENT_CHANNEL)); || (chan == SDPCM_EVENT_CHANNEL));
...@@ -3527,10 +3527,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3527,10 +3527,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
__skb_trim(pfirst, sublen); __skb_trim(pfirst, sublen);
skb_pull(pfirst, doff); skb_pull(pfirst, doff);
if (PKTLEN(pfirst) == 0) { if (pfirst->len == 0) {
PKTFREE(bus->dhd->osh, pfirst, false); PKTFREE(bus->dhd->osh, pfirst, false);
if (plast) { if (plast) {
PKTSETNEXT(plast, pnext); plast->next = pnext;
} else { } else {
ASSERT(save_pfirst == pfirst); ASSERT(save_pfirst == pfirst);
save_pfirst = pnext; save_pfirst = pnext;
...@@ -3543,7 +3543,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3543,7 +3543,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
bus->dhd->rx_errors++; bus->dhd->rx_errors++;
PKTFREE(osh, pfirst, false); PKTFREE(osh, pfirst, false);
if (plast) { if (plast) {
PKTSETNEXT(plast, pnext); plast->next = pnext;
} else { } else {
ASSERT(save_pfirst == pfirst); ASSERT(save_pfirst == pfirst);
save_pfirst = pnext; save_pfirst = pnext;
...@@ -3553,7 +3553,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3553,7 +3553,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
/* this packet will go up, link back into /* this packet will go up, link back into
chain and count it */ chain and count it */
PKTSETNEXT(pfirst, pnext); pfirst->next = pnext;
plast = pfirst; plast = pfirst;
num++; num++;
...@@ -3561,11 +3561,11 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3561,11 +3561,11 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
if (DHD_GLOM_ON()) { if (DHD_GLOM_ON()) {
DHD_GLOM(("%s subframe %d to stack, %p(%p/%d) " DHD_GLOM(("%s subframe %d to stack, %p(%p/%d) "
"nxt/lnk %p/%p\n", "nxt/lnk %p/%p\n",
__func__, num, pfirst, PKTDATA(pfirst), __func__, num, pfirst, pfirst->data,
PKTLEN(pfirst), PKTNEXT(pfirst), pfirst->len, pfirst->next,
PKTLINK(pfirst))); pfirst->prev));
prhex("", (u8 *) PKTDATA(pfirst), prhex("", (u8 *) pfirst->data,
min_t(int, PKTLEN(pfirst), 32)); min_t(int, pfirst->len, 32));
} }
#endif /* DHD_DEBUG */ #endif /* DHD_DEBUG */
} }
...@@ -3737,9 +3737,9 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -3737,9 +3737,9 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
if (bus->bus == SPI_BUS) if (bus->bus == SPI_BUS)
bus->usebufpool = true; bus->usebufpool = true;
ASSERT(!PKTLINK(pkt)); ASSERT(!(pkt->prev));
PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN); PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN);
rxbuf = (u8 *) PKTDATA(pkt); rxbuf = (u8 *) (pkt->data);
/* Read the entire frame */ /* Read the entire frame */
sdret = sdret =
dhd_bcmsdh_recv_buf(bus, dhd_bcmsdh_recv_buf(bus,
...@@ -4103,17 +4103,17 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4103,17 +4103,17 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
} }
dhd_os_sdunlock_rxq(bus->dhd); dhd_os_sdunlock_rxq(bus->dhd);
ASSERT(!PKTLINK(pkt)); ASSERT(!(pkt->prev));
/* Leave room for what we already read, and align remainder */ /* Leave room for what we already read, and align remainder */
ASSERT(firstread < (PKTLEN(pkt))); ASSERT(firstread < pkt->len);
skb_pull(pkt, firstread); skb_pull(pkt, firstread);
PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN); PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN);
/* Read the remaining frame data */ /* Read the remaining frame data */
sdret = sdret =
dhd_bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, dhd_bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2,
F2SYNC, ((u8 *) PKTDATA(pkt)), rdlen, F2SYNC, ((u8 *) (pkt->data)), rdlen,
pkt, NULL, NULL); pkt, NULL, NULL);
bus->f2rxdata++; bus->f2rxdata++;
ASSERT(sdret != BCME_PENDING); ASSERT(sdret != BCME_PENDING);
...@@ -4136,11 +4136,11 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4136,11 +4136,11 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
/* Copy the already-read portion */ /* Copy the already-read portion */
skb_push(pkt, firstread); skb_push(pkt, firstread);
bcopy(bus->rxhdr, PKTDATA(pkt), firstread); bcopy(bus->rxhdr, pkt->data, firstread);
#ifdef DHD_DEBUG #ifdef DHD_DEBUG
if (DHD_BYTES_ON() && DHD_DATA_ON()) if (DHD_BYTES_ON() && DHD_DATA_ON())
prhex("Rx Data", PKTDATA(pkt), len); prhex("Rx Data", pkt->data, len);
#endif #endif
deliver: deliver:
...@@ -4151,7 +4151,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4151,7 +4151,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
__func__, len)); __func__, len));
#ifdef DHD_DEBUG #ifdef DHD_DEBUG
if (DHD_GLOM_ON()) { if (DHD_GLOM_ON()) {
prhex("Glom Data", PKTDATA(pkt), len); prhex("Glom Data", pkt->data, len);
} }
#endif #endif
__skb_trim(pkt, len); __skb_trim(pkt, len);
...@@ -4178,7 +4178,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4178,7 +4178,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
} }
#endif /* SDTEST */ #endif /* SDTEST */
if (PKTLEN(pkt) == 0) { if (pkt->len == 0) {
dhd_os_sdlock_rxq(bus->dhd); dhd_os_sdlock_rxq(bus->dhd);
PKTFREE(bus->dhd->osh, pkt, false); PKTFREE(bus->dhd->osh, pkt, false);
dhd_os_sdunlock_rxq(bus->dhd); dhd_os_sdunlock_rxq(bus->dhd);
...@@ -4672,7 +4672,7 @@ static void dhdsdio_pktgen(dhd_bus_t *bus) ...@@ -4672,7 +4672,7 @@ static void dhdsdio_pktgen(dhd_bus_t *bus)
} }
PKTALIGN(osh, pkt, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), PKTALIGN(osh, pkt, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN),
DHD_SDALIGN); DHD_SDALIGN);
data = (u8 *) PKTDATA(pkt) + SDPCM_HDRLEN; data = (u8 *) (pkt->data) + SDPCM_HDRLEN;
/* Write test header cmd and extra based on mode */ /* Write test header cmd and extra based on mode */
switch (bus->pktgen_mode) { switch (bus->pktgen_mode) {
...@@ -4711,9 +4711,9 @@ static void dhdsdio_pktgen(dhd_bus_t *bus) ...@@ -4711,9 +4711,9 @@ static void dhdsdio_pktgen(dhd_bus_t *bus)
#ifdef DHD_DEBUG #ifdef DHD_DEBUG
if (DHD_BYTES_ON() && DHD_DATA_ON()) { if (DHD_BYTES_ON() && DHD_DATA_ON()) {
data = (u8 *) PKTDATA(pkt) + SDPCM_HDRLEN; data = (u8 *) (pkt->data) + SDPCM_HDRLEN;
prhex("dhdsdio_pktgen: Tx Data", data, prhex("dhdsdio_pktgen: Tx Data", data,
PKTLEN(pkt) - SDPCM_HDRLEN); pkt->len - SDPCM_HDRLEN);
} }
#endif #endif
...@@ -4750,7 +4750,7 @@ static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start) ...@@ -4750,7 +4750,7 @@ static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start)
return; return;
} }
PKTALIGN(osh, pkt, (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), DHD_SDALIGN); PKTALIGN(osh, pkt, (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), DHD_SDALIGN);
data = (u8 *) PKTDATA(pkt) + SDPCM_HDRLEN; data = (u8 *) (pkt->data) + SDPCM_HDRLEN;
/* Fill in the test header */ /* Fill in the test header */
*data++ = SDPCM_TEST_SEND; *data++ = SDPCM_TEST_SEND;
...@@ -4775,7 +4775,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq) ...@@ -4775,7 +4775,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
u16 offset; u16 offset;
/* Check for min length */ /* Check for min length */
pktlen = PKTLEN(pkt); pktlen = pkt->len;
if (pktlen < SDPCM_TEST_HDRLEN) { if (pktlen < SDPCM_TEST_HDRLEN) {
DHD_ERROR(("dhdsdio_restrcv: toss runt frame, pktlen %d\n", DHD_ERROR(("dhdsdio_restrcv: toss runt frame, pktlen %d\n",
pktlen)); pktlen));
...@@ -4784,7 +4784,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq) ...@@ -4784,7 +4784,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
} }
/* Extract header fields */ /* Extract header fields */
data = PKTDATA(pkt); data = pkt->data;
cmd = *data++; cmd = *data++;
extra = *data++; extra = *data++;
len = *data++; len = *data++;
...@@ -4807,7 +4807,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq) ...@@ -4807,7 +4807,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
case SDPCM_TEST_ECHOREQ: case SDPCM_TEST_ECHOREQ:
/* Rx->Tx turnaround ok (even on NDIS w/current /* Rx->Tx turnaround ok (even on NDIS w/current
implementation) */ implementation) */
*(u8 *) (PKTDATA(pkt)) = SDPCM_TEST_ECHORSP; *(u8 *) (pkt->data) = SDPCM_TEST_ECHORSP;
if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, true) == 0) { if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, true) == 0) {
bus->pktgen_sent++; bus->pktgen_sent++;
} else { } else {
......
...@@ -248,13 +248,8 @@ extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size, ...@@ -248,13 +248,8 @@ extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size,
/* packet primitives */ /* packet primitives */
#define PKTGET(osh, len, send) osl_pktget((osh), (len)) #define PKTGET(osh, len, send) osl_pktget((osh), (len))
#define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send)) #define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send))
#define PKTDATA(skb) (((struct sk_buff *)(skb))->data) #define PKTHEADROOM(skb) ((skb)->data - (skb)->head)
#define PKTLEN(skb) (((struct sk_buff *)(skb))->len) #define PKTTAILROOM(skb) ((skb)->end - (skb)->tail)
#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 PKTALLOCED(osh) (((struct osl_pubinfo *)(osh))->pktalloced) #define PKTALLOCED(osh) (((struct osl_pubinfo *)(osh))->pktalloced)
extern void *osl_pktget(struct osl_info *osh, uint len); extern void *osl_pktget(struct osl_info *osh, uint len);
extern void osl_pktfree(struct osl_info *osh, void *skb, bool send); extern void osl_pktfree(struct osl_info *osh, void *skb, bool send);
...@@ -293,14 +288,9 @@ osl_pkt_tonative(struct osl_pubinfo *osh, void *pkt) ...@@ -293,14 +288,9 @@ osl_pkt_tonative(struct osl_pubinfo *osh, void *pkt)
#define PKTSKIPCT(osh, skb) #define PKTSKIPCT(osh, skb)
#endif /* BRCM_FULLMAC */ #endif /* BRCM_FULLMAC */
#define PKTLINK(skb) (((struct sk_buff *)(skb))->prev)
#define PKTSETLINK(skb, x) (((struct sk_buff *)(skb))->prev = (struct sk_buff*)(x))
#define PKTPRIO(skb) (((struct sk_buff *)(skb))->priority)
#define PKTSETPRIO(skb, x) (((struct sk_buff *)(skb))->priority = (x))
#define PKTSUMNEEDED(skb) (((struct sk_buff *)(skb))->ip_summed == CHECKSUM_PARTIAL) #define PKTSUMNEEDED(skb) (((struct sk_buff *)(skb))->ip_summed == CHECKSUM_PARTIAL)
#define PKTSETSUMGOOD(skb, x) (((struct sk_buff *)(skb))->ip_summed = \ #define PKTSETSUMGOOD(skb, x) (((struct sk_buff *)(skb))->ip_summed = \
((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE)) ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE))
/* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because skb->ip_summed is overloaded */ /* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because skb->ip_summed is overloaded */
#define PKTSHARED(skb) (((struct sk_buff *)(skb))->cloned)
#endif /* _linux_osl_h_ */ #endif /* _linux_osl_h_ */
...@@ -153,7 +153,7 @@ static inline u16 pkt_txh_seqnum(wlc_info_t *wlc, struct sk_buff *p) ...@@ -153,7 +153,7 @@ static inline u16 pkt_txh_seqnum(wlc_info_t *wlc, struct sk_buff *p)
{ {
d11txh_t *txh; d11txh_t *txh;
struct dot11_header *h; struct dot11_header *h;
txh = (d11txh_t *) PKTDATA(p); txh = (d11txh_t *) p->data;
h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
return ltoh16(h->seq) >> SEQNUM_SHIFT; return ltoh16(h->seq) >> SEQNUM_SHIFT;
} }
...@@ -475,7 +475,7 @@ wlc_ampdu_agg(ampdu_info_t *ampdu, struct scb *scb, struct sk_buff *p, ...@@ -475,7 +475,7 @@ wlc_ampdu_agg(ampdu_info_t *ampdu, struct scb *scb, struct sk_buff *p,
{ {
scb_ampdu_t *scb_ampdu; scb_ampdu_t *scb_ampdu;
scb_ampdu_tid_ini_t *ini; scb_ampdu_tid_ini_t *ini;
u8 tid = (u8) PKTPRIO(p); u8 tid = (u8) (p->priority);
scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb);
...@@ -529,7 +529,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu, ...@@ -529,7 +529,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu,
ASSERT(p); ASSERT(p);
tid = (u8) PKTPRIO(p); tid = (u8) (p->priority);
ASSERT(tid < AMPDU_MAX_SCB_TID); ASSERT(tid < AMPDU_MAX_SCB_TID);
f = ampdu->fifo_tb + prio2fifo[tid]; f = ampdu->fifo_tb + prio2fifo[tid];
...@@ -589,7 +589,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu, ...@@ -589,7 +589,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu,
/* pkt is good to be aggregated */ /* pkt is good to be aggregated */
ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU); ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
txh = (d11txh_t *) PKTDATA(p); txh = (d11txh_t *) p->data;
plcp = (u8 *) (txh + 1); plcp = (u8 *) (txh + 1);
h = (struct dot11_header *)(plcp + D11_PHY_HDR_LEN); h = (struct dot11_header *)(plcp + D11_PHY_HDR_LEN);
seq = ltoh16(h->seq) >> SEQNUM_SHIFT; seq = ltoh16(h->seq) >> SEQNUM_SHIFT;
...@@ -744,7 +744,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu, ...@@ -744,7 +744,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu,
if (p) { if (p) {
if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) &&
((u8) PKTPRIO(p) == tid)) { ((u8) (p->priority) == tid)) {
plen = plen =
pkttotlen(osh, p) + AMPDU_MAX_MPDU_OVERHEAD; pkttotlen(osh, p) + AMPDU_MAX_MPDU_OVERHEAD;
...@@ -778,7 +778,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu, ...@@ -778,7 +778,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu,
WLCNTADD(ampdu->cnt->txmpdu, count); WLCNTADD(ampdu->cnt->txmpdu, count);
/* patch up the last txh */ /* patch up the last txh */
txh = (d11txh_t *) PKTDATA(pkt[count - 1]); txh = (d11txh_t *) pkt[count - 1]->data;
mcl = ltoh16(txh->MacTxControlLow); mcl = ltoh16(txh->MacTxControlLow);
mcl &= ~TXC_AMPDU_MASK; mcl &= ~TXC_AMPDU_MASK;
mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT); mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT);
...@@ -796,7 +796,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu, ...@@ -796,7 +796,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu,
ampdu_len -= roundup(len, 4) - len; ampdu_len -= roundup(len, 4) - len;
/* patch up the first txh & plcp */ /* patch up the first txh & plcp */
txh = (d11txh_t *) PKTDATA(pkt[0]); txh = (d11txh_t *) pkt[0]->data;
plcp = (u8 *) (txh + 1); plcp = (u8 *) (txh + 1);
WLC_SET_MIMO_PLCP_LEN(plcp, ampdu_len); WLC_SET_MIMO_PLCP_LEN(plcp, ampdu_len);
...@@ -901,7 +901,7 @@ wlc_ampdu_dotxstatus(ampdu_info_t *ampdu, struct scb *scb, struct sk_buff *p, ...@@ -901,7 +901,7 @@ wlc_ampdu_dotxstatus(ampdu_info_t *ampdu, struct scb *scb, struct sk_buff *p,
ASSERT(txs->status & TX_STATUS_AMPDU); ASSERT(txs->status & TX_STATUS_AMPDU);
scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb);
ASSERT(scb_ampdu); ASSERT(scb_ampdu);
ini = SCB_AMPDU_INI(scb_ampdu, PKTPRIO(p)); ini = SCB_AMPDU_INI(scb_ampdu, p->priority);
ASSERT(ini->scb == scb); ASSERT(ini->scb == scb);
/* BMAC_NOTE: For the split driver, second level txstatus comes later /* BMAC_NOTE: For the split driver, second level txstatus comes later
...@@ -985,7 +985,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, ...@@ -985,7 +985,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb,
scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb);
ASSERT(scb_ampdu); ASSERT(scb_ampdu);
tid = (u8) PKTPRIO(p); tid = (u8) (p->priority);
ini = SCB_AMPDU_INI(scb_ampdu, tid); ini = SCB_AMPDU_INI(scb_ampdu, tid);
retry_limit = ampdu->retry_limit_tid[tid]; retry_limit = ampdu->retry_limit_tid[tid];
...@@ -1065,7 +1065,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, ...@@ -1065,7 +1065,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb,
#ifdef BCMDBG #ifdef BCMDBG
if (WL_ERROR_ON()) { if (WL_ERROR_ON()) {
prpkt("txpkt (AMPDU)", wlc->osh, p); prpkt("txpkt (AMPDU)", wlc->osh, p);
wlc_print_txdesc((d11txh_t *) PKTDATA(p)); wlc_print_txdesc((d11txh_t *) p->data);
wlc_print_txstatus(txs); wlc_print_txstatus(txs);
} }
#endif /* BCMDBG */ #endif /* BCMDBG */
...@@ -1076,7 +1076,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, ...@@ -1076,7 +1076,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb,
while (p) { while (p) {
tx_info = IEEE80211_SKB_CB(p); tx_info = IEEE80211_SKB_CB(p);
ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU); ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
txh = (d11txh_t *) PKTDATA(p); txh = (d11txh_t *) p->data;
mcl = ltoh16(txh->MacTxControlLow); mcl = ltoh16(txh->MacTxControlLow);
plcp = (u8 *) (txh + 1); plcp = (u8 *) (txh + 1);
h = (struct dot11_header *)(plcp + D11_PHY_HDR_LEN); h = (struct dot11_header *)(plcp + D11_PHY_HDR_LEN);
......
...@@ -285,7 +285,7 @@ wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound) ...@@ -285,7 +285,7 @@ wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound)
if (!tail) if (!tail)
head = tail = p; head = tail = p;
else { else {
PKTSETLINK(tail, p); tail->prev = p;
tail = p; tail = p;
} }
...@@ -302,11 +302,11 @@ wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound) ...@@ -302,11 +302,11 @@ wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound)
/* process each frame */ /* process each frame */
while ((p = head) != NULL) { while ((p = head) != NULL) {
head = PKTLINK(head); head = head->prev;
PKTSETLINK(p, NULL); p->prev = NULL;
/* record the tsf_l in wlc_rxd11hdr */ /* record the tsf_l in wlc_rxd11hdr */
wlc_rxhdr = (wlc_d11rxhdr_t *) PKTDATA(p); wlc_rxhdr = (wlc_d11rxhdr_t *) p->data;
wlc_rxhdr->tsf_l = htol32(tsf_l); wlc_rxhdr->tsf_l = htol32(tsf_l);
/* compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */ /* compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */
...@@ -3327,7 +3327,7 @@ static bool wlc_bmac_txstatus_corerev4(wlc_hw_info_t *wlc_hw) ...@@ -3327,7 +3327,7 @@ static bool wlc_bmac_txstatus_corerev4(wlc_hw_info_t *wlc_hw)
while (!fatal && (status_p = dma_rx(wlc_hw->di[RX_TXSTATUS_FIFO]))) { while (!fatal && (status_p = dma_rx(wlc_hw->di[RX_TXSTATUS_FIFO]))) {
txs = (tx_status_t *) PKTDATA(status_p); txs = (tx_status_t *) status_p->data;
/* MAC uses little endian only */ /* MAC uses little endian only */
ltoh16_buf((void *)txs, sizeof(tx_status_t)); ltoh16_buf((void *)txs, sizeof(tx_status_t));
......
...@@ -5042,9 +5042,9 @@ wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, struct sk_buff *pkt, ...@@ -5042,9 +5042,9 @@ wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, struct sk_buff *pkt,
/* Increment wme stats */ /* Increment wme stats */
if (WME_ENAB(wlc->pub)) { if (WME_ENAB(wlc->pub)) {
WLCNTINCR(wlc->pub->_wme_cnt-> WLCNTINCR(wlc->pub->_wme_cnt->
tx_failed[WME_PRIO2AC(PKTPRIO(p))].packets); tx_failed[WME_PRIO2AC(p->priority)].packets);
WLCNTADD(wlc->pub->_wme_cnt-> WLCNTADD(wlc->pub->_wme_cnt->
tx_failed[WME_PRIO2AC(PKTPRIO(p))].bytes, tx_failed[WME_PRIO2AC(p->priority)].bytes,
pkttotlen(wlc->osh, p)); pkttotlen(wlc->osh, p));
} }
...@@ -5071,7 +5071,7 @@ void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu, ...@@ -5071,7 +5071,7 @@ void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
struct pktq *q = &qi->q; struct pktq *q = &qi->q;
int prio; int prio;
prio = PKTPRIO(sdu); prio = sdu->priority;
ASSERT(pktq_max(q) >= wlc->pub->tunables->datahiwat); ASSERT(pktq_max(q) >= wlc->pub->tunables->datahiwat);
...@@ -5111,7 +5111,7 @@ wlc_sendpkt_mac80211(wlc_info_t *wlc, struct sk_buff *sdu, ...@@ -5111,7 +5111,7 @@ wlc_sendpkt_mac80211(wlc_info_t *wlc, struct sk_buff *sdu,
uint fifo; uint fifo;
void *pkt; void *pkt;
struct scb *scb = &global_scb; struct scb *scb = &global_scb;
struct dot11_header *d11_header = (struct dot11_header *)PKTDATA(sdu); struct dot11_header *d11_header = (struct dot11_header *)(sdu->data);
u16 type, fc; u16 type, fc;
ASSERT(sdu); ASSERT(sdu);
...@@ -5120,13 +5120,13 @@ wlc_sendpkt_mac80211(wlc_info_t *wlc, struct sk_buff *sdu, ...@@ -5120,13 +5120,13 @@ wlc_sendpkt_mac80211(wlc_info_t *wlc, struct sk_buff *sdu,
type = FC_TYPE(fc); type = FC_TYPE(fc);
/* 802.11 standard requires management traffic to go at highest priority */ /* 802.11 standard requires management traffic to go at highest priority */
prio = (type == FC_TYPE_DATA ? PKTPRIO(sdu) : MAXPRIO); prio = (type == FC_TYPE_DATA ? sdu->priority : MAXPRIO);
fifo = prio2fifo[prio]; fifo = prio2fifo[prio];
ASSERT((uint) PKTHEADROOM(sdu) >= TXOFF); ASSERT((uint) PKTHEADROOM(sdu) >= TXOFF);
ASSERT(!PKTSHARED(sdu)); ASSERT(!(sdu->cloned));
ASSERT(!PKTNEXT(sdu)); ASSERT(!(sdu->next));
ASSERT(!PKTLINK(sdu)); ASSERT(!(sdu->prev));
ASSERT(fifo < NFIFO); ASSERT(fifo < NFIFO);
pkt = sdu; pkt = sdu;
...@@ -5236,7 +5236,7 @@ wlc_txfifo(wlc_info_t *wlc, uint fifo, struct sk_buff *p, bool commit, ...@@ -5236,7 +5236,7 @@ wlc_txfifo(wlc_info_t *wlc, uint fifo, struct sk_buff *p, bool commit,
d11txh_t *txh; d11txh_t *txh;
ASSERT(fifo < NFIFO); ASSERT(fifo < NFIFO);
txh = (d11txh_t *) PKTDATA(p); txh = (d11txh_t *) (p->data);
/* When a BC/MC frame is being committed to the BCMC fifo via DMA (NOT PIO), update /* When a BC/MC frame is being committed to the BCMC fifo via DMA (NOT PIO), update
* ucode or BSS info as appropriate. * ucode or BSS info as appropriate.
...@@ -5690,7 +5690,7 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, ...@@ -5690,7 +5690,7 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw,
osh = wlc->osh; osh = wlc->osh;
/* locate 802.11 MAC header */ /* locate 802.11 MAC header */
h = (struct dot11_header *)PKTDATA(p); h = (struct dot11_header *)(p->data);
fc = ltoh16(h->fc); fc = ltoh16(h->fc);
type = FC_TYPE(fc); type = FC_TYPE(fc);
...@@ -5731,12 +5731,12 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, ...@@ -5731,12 +5731,12 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw,
} else { } else {
/* Increment the counter for first fragment */ /* Increment the counter for first fragment */
if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) { if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) {
SCB_SEQNUM(scb, PKTPRIO(p))++; SCB_SEQNUM(scb, p->priority)++;
} }
/* extract fragment number from frame first */ /* extract fragment number from frame first */
seq = ltoh16(seq) & FRAGNUM_MASK; seq = ltoh16(seq) & FRAGNUM_MASK;
seq |= (SCB_SEQNUM(scb, PKTPRIO(p)) << SEQNUM_SHIFT); seq |= (SCB_SEQNUM(scb, p->priority) << SEQNUM_SHIFT);
h->seq = htol16(seq); h->seq = htol16(seq);
frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) | frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
...@@ -6559,7 +6559,7 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2) ...@@ -6559,7 +6559,7 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2)
if (p == NULL) if (p == NULL)
goto fatal; goto fatal;
txh = (d11txh_t *) PKTDATA(p); txh = (d11txh_t *) (p->data);
mcl = ltoh16(txh->MacTxControlLow); mcl = ltoh16(txh->MacTxControlLow);
if (txs->phyerr) { if (txs->phyerr) {
...@@ -6649,8 +6649,8 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2) ...@@ -6649,8 +6649,8 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2)
wlc_txfifo_complete(wlc, queue, 1); wlc_txfifo_complete(wlc, queue, 1);
if (lastframe) { if (lastframe) {
PKTSETNEXT(p, NULL); p->next = NULL;
PKTSETLINK(p, NULL); p->prev = NULL;
wlc->txretried = 0; wlc->txretried = 0;
/* remove PLCP & Broadcom tx descriptor header */ /* remove PLCP & Broadcom tx descriptor header */
skb_pull(p, D11_PHY_HDR_LEN); skb_pull(p, D11_PHY_HDR_LEN);
...@@ -6825,7 +6825,7 @@ prep_mac80211_status(wlc_info_t *wlc, d11rxhdr_t *rxh, struct sk_buff *p, ...@@ -6825,7 +6825,7 @@ prep_mac80211_status(wlc_info_t *wlc, d11rxhdr_t *rxh, struct sk_buff *p,
/* qual */ /* qual */
rx_status->antenna = (rxh->PhyRxStatus_0 & PRXS0_RXANT_UPSUBBAND) ? 1 : 0; /* ant */ rx_status->antenna = (rxh->PhyRxStatus_0 & PRXS0_RXANT_UPSUBBAND) ? 1 : 0; /* ant */
plcp = PKTDATA(p); plcp = p->data;
rspec = wlc_compute_rspec(rxh, plcp); rspec = wlc_compute_rspec(rxh, plcp);
if (IS_MCS(rspec)) { if (IS_MCS(rspec)) {
...@@ -6920,12 +6920,12 @@ wlc_recvctl(wlc_info_t *wlc, struct osl_info *osh, d11rxhdr_t *rxh, ...@@ -6920,12 +6920,12 @@ wlc_recvctl(wlc_info_t *wlc, struct osl_info *osh, d11rxhdr_t *rxh,
prep_mac80211_status(wlc, rxh, p, &rx_status); prep_mac80211_status(wlc, rxh, p, &rx_status);
/* mac header+body length, exclude CRC and plcp header */ /* mac header+body length, exclude CRC and plcp header */
len_mpdu = PKTLEN(p) - D11_PHY_HDR_LEN - DOT11_FCS_LEN; len_mpdu = p->len - D11_PHY_HDR_LEN - DOT11_FCS_LEN;
skb_pull(p, D11_PHY_HDR_LEN); skb_pull(p, D11_PHY_HDR_LEN);
__skb_trim(p, len_mpdu); __skb_trim(p, len_mpdu);
ASSERT(!PKTNEXT(p)); ASSERT(!(p->next));
ASSERT(!PKTLINK(p)); ASSERT(!(p->prev));
ASSERT(IS_ALIGNED((unsigned long)skb->data, 2)); ASSERT(IS_ALIGNED((unsigned long)skb->data, 2));
...@@ -6980,7 +6980,7 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, struct sk_buff *p) ...@@ -6980,7 +6980,7 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, struct sk_buff *p)
osh = wlc->osh; osh = wlc->osh;
/* frame starts with rxhdr */ /* frame starts with rxhdr */
rxh = (d11rxhdr_t *) PKTDATA(p); rxh = (d11rxhdr_t *) (p->data);
/* strip off rxhdr */ /* strip off rxhdr */
skb_pull(p, wlc->hwrxoff); skb_pull(p, wlc->hwrxoff);
...@@ -6990,17 +6990,17 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, struct sk_buff *p) ...@@ -6990,17 +6990,17 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, struct sk_buff *p)
/* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */ /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */
if (rxh->RxStatus1 & RXS_PBPRES) { if (rxh->RxStatus1 & RXS_PBPRES) {
if (PKTLEN(p) < 2) { if (p->len < 2) {
WLCNTINCR(wlc->pub->_cnt->rxrunt); WLCNTINCR(wlc->pub->_cnt->rxrunt);
WL_ERROR(("wl%d: wlc_recv: rcvd runt of len %d\n", WL_ERROR(("wl%d: wlc_recv: rcvd runt of len %d\n",
wlc->pub->unit, PKTLEN(p))); wlc->pub->unit, p->len));
goto toss; goto toss;
} }
skb_pull(p, 2); skb_pull(p, 2);
} }
h = (struct dot11_header *)(PKTDATA(p) + D11_PHY_HDR_LEN); h = (struct dot11_header *)(p->data + D11_PHY_HDR_LEN);
len = PKTLEN(p); len = p->len;
if (rxh->RxStatus1 & RXS_FCSERR) { if (rxh->RxStatus1 & RXS_FCSERR) {
if (wlc->pub->mac80211_state & MAC80211_PROMISC_BCNS) { if (wlc->pub->mac80211_state & MAC80211_PROMISC_BCNS) {
...@@ -7804,7 +7804,7 @@ int wlc_prep_pdu(wlc_info_t *wlc, struct sk_buff *pdu, uint *fifop) ...@@ -7804,7 +7804,7 @@ int wlc_prep_pdu(wlc_info_t *wlc, struct sk_buff *pdu, uint *fifop)
osh = wlc->osh; osh = wlc->osh;
ASSERT(pdu); ASSERT(pdu);
txh = (d11txh_t *) PKTDATA(pdu); txh = (d11txh_t *) (pdu->data);
ASSERT(txh); ASSERT(txh);
h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
ASSERT(h); ASSERT(h);
......
...@@ -440,7 +440,7 @@ struct wlc_if; ...@@ -440,7 +440,7 @@ struct wlc_if;
#define WLC_PREC_COUNT 16 /* Max precedence level implemented */ #define WLC_PREC_COUNT 16 /* Max precedence level implemented */
/* pri is PKTPRIO encoded in the packet. This maps the Packet priority to /* pri is priority encoded in the packet. This maps the Packet priority to
* enqueue precedence as defined in wlc_prec_map * enqueue precedence as defined in wlc_prec_map
*/ */
extern const u8 wlc_prio2prec_map[]; extern const u8 wlc_prio2prec_map[];
......
...@@ -39,19 +39,19 @@ uint pktfrombuf(struct osl_info *osh, struct sk_buff *p, uint offset, int len, ...@@ -39,19 +39,19 @@ uint pktfrombuf(struct osl_info *osh, struct sk_buff *p, uint offset, int len,
uint n, ret = 0; uint n, ret = 0;
/* skip 'offset' bytes */ /* skip 'offset' bytes */
for (; p && offset; p = PKTNEXT(p)) { for (; p && offset; p = p->next) {
if (offset < (uint) PKTLEN(p)) if (offset < (uint) (p->len))
break; break;
offset -= PKTLEN(p); offset -= p->len;
} }
if (!p) if (!p)
return 0; return 0;
/* copy the data */ /* copy the data */
for (; p && len; p = PKTNEXT(p)) { for (; p && len; p = p->next) {
n = min((uint) PKTLEN(p) - offset, (uint) len); n = min((uint) (p->len) - offset, (uint) len);
bcopy(buf, PKTDATA(p) + offset, n); bcopy(buf, p->data + offset, n);
buf += n; buf += n;
len -= n; len -= n;
ret += n; ret += n;
...@@ -66,8 +66,8 @@ uint BCMFASTPATH pkttotlen(struct osl_info *osh, struct sk_buff *p) ...@@ -66,8 +66,8 @@ uint BCMFASTPATH pkttotlen(struct osl_info *osh, struct sk_buff *p)
uint total; uint total;
total = 0; total = 0;
for (; p; p = PKTNEXT(p)) for (; p; p = p->next)
total += PKTLEN(p); total += p->len;
return total; return total;
} }
...@@ -81,7 +81,7 @@ struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec, ...@@ -81,7 +81,7 @@ struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec,
struct pktq_prec *q; struct pktq_prec *q;
ASSERT(prec >= 0 && prec < pq->num_prec); ASSERT(prec >= 0 && prec < pq->num_prec);
ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */ ASSERT(p->prev == NULL); /* queueing chains not allowed */
ASSERT(!pktq_full(pq)); ASSERT(!pktq_full(pq));
ASSERT(!pktq_pfull(pq, prec)); ASSERT(!pktq_pfull(pq, prec));
...@@ -89,7 +89,7 @@ struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec, ...@@ -89,7 +89,7 @@ struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec,
q = &pq->q[prec]; q = &pq->q[prec];
if (q->head) if (q->head)
PKTSETLINK(q->tail, p); q->tail->prev = p;
else else
q->head = p; q->head = p;
...@@ -110,7 +110,7 @@ struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec, ...@@ -110,7 +110,7 @@ struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec,
struct pktq_prec *q; struct pktq_prec *q;
ASSERT(prec >= 0 && prec < pq->num_prec); ASSERT(prec >= 0 && prec < pq->num_prec);
ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */ ASSERT(p->prev == NULL); /* queueing chains not allowed */
ASSERT(!pktq_full(pq)); ASSERT(!pktq_full(pq));
ASSERT(!pktq_pfull(pq, prec)); ASSERT(!pktq_pfull(pq, prec));
...@@ -120,7 +120,7 @@ struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec, ...@@ -120,7 +120,7 @@ struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec,
if (q->head == NULL) if (q->head == NULL)
q->tail = p; q->tail = p;
PKTSETLINK(p, q->head); p->prev = q->head;
q->head = p; q->head = p;
q->len++; q->len++;
...@@ -145,7 +145,7 @@ struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec) ...@@ -145,7 +145,7 @@ struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec)
if (p == NULL) if (p == NULL)
return NULL; return NULL;
q->head = PKTLINK(p); q->head = p->prev;
if (q->head == NULL) if (q->head == NULL)
q->tail = NULL; q->tail = NULL;
...@@ -153,7 +153,7 @@ struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec) ...@@ -153,7 +153,7 @@ struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec)
pq->len--; pq->len--;
PKTSETLINK(p, NULL); p->prev = NULL;
return p; return p;
} }
...@@ -171,11 +171,11 @@ struct sk_buff *BCMFASTPATH pktq_pdeq_tail(struct pktq *pq, int prec) ...@@ -171,11 +171,11 @@ struct sk_buff *BCMFASTPATH pktq_pdeq_tail(struct pktq *pq, int prec)
if (p == NULL) if (p == NULL)
return NULL; return NULL;
for (prev = NULL; p != q->tail; p = PKTLINK(p)) for (prev = NULL; p != q->tail; p = p->prev)
prev = p; prev = p;
if (prev) if (prev)
PKTSETLINK(prev, NULL); prev->prev = NULL;
else else
q->head = NULL; q->head = NULL;
...@@ -196,8 +196,8 @@ void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir) ...@@ -196,8 +196,8 @@ void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir)
q = &pq->q[prec]; q = &pq->q[prec];
p = q->head; p = q->head;
while (p) { while (p) {
q->head = PKTLINK(p); q->head = p->prev;
PKTSETLINK(p, NULL); p->prev = NULL;
PKTFREE(osh, p, dir); PKTFREE(osh, p, dir);
q->len--; q->len--;
pq->len--; pq->len--;
...@@ -228,17 +228,17 @@ pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir, ...@@ -228,17 +228,17 @@ pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir,
if (fn == NULL || (*fn) (p, arg)) { if (fn == NULL || (*fn) (p, arg)) {
bool head = (p == q->head); bool head = (p == q->head);
if (head) if (head)
q->head = PKTLINK(p); q->head = p->prev;
else else
PKTSETLINK(prev, PKTLINK(p)); prev->prev = p->prev;
PKTSETLINK(p, NULL); p->prev = NULL;
PKTFREE(osh, p, dir); PKTFREE(osh, p, dir);
q->len--; q->len--;
pq->len--; pq->len--;
p = (head ? q->head : PKTLINK(prev)); p = (head ? q->head : prev->prev);
} else { } else {
prev = p; prev = p;
p = PKTLINK(p); p = p->prev;
} }
} }
...@@ -331,7 +331,7 @@ struct sk_buff *BCMFASTPATH pktq_mdeq(struct pktq *pq, uint prec_bmp, ...@@ -331,7 +331,7 @@ struct sk_buff *BCMFASTPATH pktq_mdeq(struct pktq *pq, uint prec_bmp,
if (p == NULL) if (p == NULL)
return NULL; return NULL;
q->head = PKTLINK(p); q->head = p->prev;
if (q->head == NULL) if (q->head == NULL)
q->tail = NULL; q->tail = NULL;
...@@ -342,7 +342,7 @@ struct sk_buff *BCMFASTPATH pktq_mdeq(struct pktq *pq, uint prec_bmp, ...@@ -342,7 +342,7 @@ struct sk_buff *BCMFASTPATH pktq_mdeq(struct pktq *pq, uint prec_bmp,
pq->len--; pq->len--;
PKTSETLINK(p, NULL); p->prev = NULL;
return p; return p;
} }
...@@ -417,8 +417,8 @@ void prpkt(const char *msg, struct osl_info *osh, struct sk_buff *p0) ...@@ -417,8 +417,8 @@ void prpkt(const char *msg, struct osl_info *osh, struct sk_buff *p0)
if (msg && (msg[0] != '\0')) if (msg && (msg[0] != '\0'))
printf("%s:\n", msg); printf("%s:\n", msg);
for (p = p0; p; p = PKTNEXT(p)) for (p = p0; p; p = p->next)
prhex(NULL, PKTDATA(p), PKTLEN(p)); prhex(NULL, p->data, p->len);
} }
#endif /* defined(BCMDBG) */ #endif /* defined(BCMDBG) */
......
...@@ -989,15 +989,15 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di) ...@@ -989,15 +989,15 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
if (head == NULL) if (head == NULL)
return NULL; return NULL;
len = ltoh16(*(u16 *) (PKTDATA(head))); len = ltoh16(*(u16 *) (head->data));
DMA_TRACE(("%s: dma_rx len %d\n", di->name, len)); DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
#if defined(__mips__) #if defined(__mips__)
if (!len) { if (!len) {
while (!(len = *(u16 *) OSL_UNCACHED(PKTDATA(head)))) while (!(len = *(u16 *) OSL_UNCACHED(head->data)))
udelay(1); udelay(1);
*(u16 *) PKTDATA(head) = htol16((u16) len); *(u16 *) (head->data) = htol16((u16) len);
} }
#endif /* defined(__mips__) */ #endif /* defined(__mips__) */
...@@ -1010,7 +1010,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di) ...@@ -1010,7 +1010,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
if (resid > 0) { if (resid > 0) {
tail = head; tail = head;
while ((resid > 0) && (p = _dma_getnextrxp(di, false))) { while ((resid > 0) && (p = _dma_getnextrxp(di, false))) {
PKTSETNEXT(tail, p); tail->next = p;
pkt_len = min(resid, (int)di->rxbufsize); pkt_len = min(resid, (int)di->rxbufsize);
__skb_trim(p, pkt_len); __skb_trim(p, pkt_len);
...@@ -1115,12 +1115,12 @@ static bool BCMFASTPATH _dma_rxfill(dma_info_t *di) ...@@ -1115,12 +1115,12 @@ static bool BCMFASTPATH _dma_rxfill(dma_info_t *di)
/* Do a cached write instead of uncached write since DMA_MAP /* Do a cached write instead of uncached write since DMA_MAP
* will flush the cache. * will flush the cache.
*/ */
*(u32 *) (PKTDATA(p)) = 0; *(u32 *) (p->data) = 0;
if (DMASGLIST_ENAB) if (DMASGLIST_ENAB)
bzero(&di->rxp_dmah[rxout], sizeof(hnddma_seg_map_t)); bzero(&di->rxp_dmah[rxout], sizeof(hnddma_seg_map_t));
pa = DMA_MAP(di->osh, PKTDATA(p), pa = DMA_MAP(di->osh, p->data,
di->rxbufsize, DMA_RX, p, &di->rxp_dmah[rxout]); di->rxbufsize, DMA_RX, p, &di->rxp_dmah[rxout]);
ASSERT(IS_ALIGNED(PHYSADDRLO(pa), 4)); ASSERT(IS_ALIGNED(PHYSADDRLO(pa), 4));
...@@ -1673,12 +1673,12 @@ static int dma32_txfast(dma_info_t *di, struct sk_buff *p0, bool commit) ...@@ -1673,12 +1673,12 @@ static int dma32_txfast(dma_info_t *di, struct sk_buff *p0, bool commit)
uint nsegs, j; uint nsegs, j;
hnddma_seg_map_t *map; hnddma_seg_map_t *map;
data = PKTDATA(p); data = p->data;
len = PKTLEN(p); len = p->len;
#ifdef BCM_DMAPAD #ifdef BCM_DMAPAD
len += PKTDMAPAD(di->osh, p); len += PKTDMAPAD(di->osh, p);
#endif #endif
next = PKTNEXT(p); next = p->next;
/* return nonzero if out of tx descriptors */ /* return nonzero if out of tx descriptors */
if (NEXTTXD(txout) == di->txin) if (NEXTTXD(txout) == di->txin)
...@@ -2323,12 +2323,12 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0, ...@@ -2323,12 +2323,12 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
uint nsegs, j; uint nsegs, j;
hnddma_seg_map_t *map; hnddma_seg_map_t *map;
data = PKTDATA(p); data = p->data;
len = PKTLEN(p); len = p->len;
#ifdef BCM_DMAPAD #ifdef BCM_DMAPAD
len += PKTDMAPAD(di->osh, p); len += PKTDMAPAD(di->osh, p);
#endif /* BCM_DMAPAD */ #endif /* BCM_DMAPAD */
next = PKTNEXT(p); next = p->next;
/* return nonzero if out of tx descriptors */ /* return nonzero if out of tx descriptors */
if (NEXTTXD(txout) == di->txin) if (NEXTTXD(txout) == di->txin)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册