Commit 54991ad6 authored by Arend van Spriel's avatar Arend van Spriel Committed by 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: default avatarBrett Rudley <brudley@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c26b1378
......@@ -944,8 +944,8 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
/* Claim host controller */
sdio_claim_host(gInstance->func[func]);
for (pnext = pkt; pnext; pnext = PKTNEXT(pnext)) {
uint pkt_len = PKTLEN(pnext);
for (pnext = pkt; pnext; pnext = pnext->next) {
uint pkt_len = pnext->len;
pkt_len += 3;
pkt_len &= 0xFFFFFFFC;
......@@ -962,23 +962,23 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
* is supposed to give
* 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)) {
err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
((u8 *) PKTDATA(pnext)),
((u8 *) (pnext->data)),
pkt_len);
} else if (write) {
err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
((u8 *) PKTDATA(pnext)),
((u8 *) (pnext->data)),
pkt_len);
} else if (fifo) {
err_ret = sdio_readsb(gInstance->func[func],
((u8 *) PKTDATA(pnext)),
((u8 *) (pnext->data)),
addr, pkt_len);
} else {
err_ret = sdio_memcpy_fromio(gInstance->func[func],
((u8 *) PKTDATA(pnext)),
((u8 *) (pnext->data)),
addr, pkt_len);
}
......@@ -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. */
if (write)
bcopy(buffer, PKTDATA(mypkt), buflen_u);
bcopy(buffer, mypkt->data, buflen_u);
Status =
sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
/* For a read, copy the packet data back to the buffer. */
if (!write)
bcopy(PKTDATA(mypkt), buffer, buflen_u);
bcopy(mypkt->data, buffer, buflen_u);
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. */
/* 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",
__func__, write ? "TX" : "RX", PKTLEN(pkt)));
mypkt = PKTGET(sd->osh, PKTLEN(pkt), write ? true : false);
__func__, write ? "TX" : "RX", pkt->len));
mypkt = PKTGET(sd->osh, pkt->len, write ? true : false);
if (!mypkt) {
sd_err(("%s: PKTGET failed: len %d\n",
__func__, PKTLEN(pkt)));
__func__, pkt->len));
return SDIOH_API_RC_FAIL;
}
/* For a write, copy the buffer data into the packet. */
if (write)
bcopy(PKTDATA(pkt), PKTDATA(mypkt), PKTLEN(pkt));
bcopy(pkt->data, mypkt->data, pkt->len);
Status =
sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
/* For a read, copy the packet data back to the buffer. */
if (!write)
bcopy(PKTDATA(mypkt), PKTDATA(pkt), PKTLEN(mypkt));
bcopy(mypkt->data, pkt->data, mypkt->len);
PKTFREE(sd->osh, mypkt, write ? true : false);
} 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)
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);
if (PKTSUMNEEDED(pktbuf))
h->flags |= BDC_FLAG_SUM_NEEDED;
h->priority = (PKTPRIO(pktbuf) & BDC_PRIORITY_MASK);
h->priority = (pktbuf->priority & BDC_PRIORITY_MASK);
h->flags2 = 0;
h->rssi = 0;
#endif /* BDC */
......@@ -341,13 +341,13 @@ bool dhd_proto_fcinfo(dhd_pub_t *dhd, struct sk_buff *pktbuf, u8 * fcbits)
#ifdef BDC
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",
__func__, PKTLEN(pktbuf), BDC_HEADER_LEN));
__func__, pktbuf->len, BDC_HEADER_LEN));
return BCME_ERROR;
}
h = (struct bdc_header *)PKTDATA(pktbuf);
h = (struct bdc_header *)(pktbuf->data);
*fcbits = h->priority >> BDC_PRIORITY_FC_SHIFT;
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)
#ifdef BDC
/* 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__,
PKTLEN(pktbuf), BDC_HEADER_LEN));
pktbuf->len, BDC_HEADER_LEN));
return BCME_ERROR;
}
h = (struct bdc_header *)PKTDATA(pktbuf);
h = (struct bdc_header *)(pktbuf->data);
*ifidx = BDC_GET_IF_IDX(h);
if (*ifidx >= DHD_MAX_IFS) {
......@@ -396,7 +396,7 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
PKTSETSUMGOOD(pktbuf, true);
}
PKTSETPRIO(pktbuf, (h->priority & BDC_PRIORITY_MASK));
pktbuf->priority = h->priority & BDC_PRIORITY_MASK;
skb_pull(pktbuf, BDC_HEADER_LEN);
#endif /* BDC */
......
......@@ -1028,8 +1028,8 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
return -ENODEV;
/* Update multicast statistic */
if (PKTLEN(pktbuf) >= ETHER_ADDR_LEN) {
u8 *pktdata = (u8 *) PKTDATA(pktbuf);
if (pktbuf->len >= ETHER_ADDR_LEN) {
u8 *pktdata = (u8 *) (pktbuf->data);
struct ether_header *eh = (struct ether_header *)pktdata;
if (ETHER_ISMULTI(eh->ether_dhost))
......@@ -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) {
pnext = PKTNEXT(pktbuf);
PKTSETNEXT(pktbuf, NULL);
pnext = pktbuf->next;
pktbuf->next = NULL;
skb = PKTTONATIVE(dhdp->osh, pktbuf);
......@@ -1233,7 +1233,7 @@ void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success)
dhd_prot_hdrpull(dhdp, &ifidx, txp);
eh = (struct ether_header *)PKTDATA(txp);
eh = (struct ether_header *)(txp->data);
type = ntoh16(eh->ether_type);
if (type == ETHER_TYPE_802_1X)
......
......@@ -246,15 +246,10 @@ extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size,
#define BZERO_SM(r, len) memset((r), '\0', (len))
/* 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 PKTGET(osh, len, send) osl_pktget((osh), (len))
#define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send))
#define PKTHEADROOM(skb) ((skb)->data - (skb)->head)
#define PKTTAILROOM(skb) ((skb)->end - (skb)->tail)
#define PKTALLOCED(osh) (((struct osl_pubinfo *)(osh))->pktalloced)
extern void *osl_pktget(struct osl_info *osh, uint len);
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)
#define PKTSKIPCT(osh, skb)
#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 PKTSETSUMGOOD(skb, x) (((struct sk_buff *)(skb))->ip_summed = \
((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE))
/* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because skb->ip_summed is overloaded */
#define PKTSHARED(skb) (((struct sk_buff *)(skb))->cloned)
#endif /* _linux_osl_h_ */
......@@ -153,7 +153,7 @@ static inline u16 pkt_txh_seqnum(wlc_info_t *wlc, struct sk_buff *p)
{
d11txh_t *txh;
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);
return ltoh16(h->seq) >> SEQNUM_SHIFT;
}
......@@ -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_tid_ini_t *ini;
u8 tid = (u8) PKTPRIO(p);
u8 tid = (u8) (p->priority);
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,
ASSERT(p);
tid = (u8) PKTPRIO(p);
tid = (u8) (p->priority);
ASSERT(tid < AMPDU_MAX_SCB_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,
/* pkt is good to be aggregated */
ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
txh = (d11txh_t *) PKTDATA(p);
txh = (d11txh_t *) p->data;
plcp = (u8 *) (txh + 1);
h = (struct dot11_header *)(plcp + D11_PHY_HDR_LEN);
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,
if (p) {
if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) &&
((u8) PKTPRIO(p) == tid)) {
((u8) (p->priority) == tid)) {
plen =
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,
WLCNTADD(ampdu->cnt->txmpdu, count);
/* patch up the last txh */
txh = (d11txh_t *) PKTDATA(pkt[count - 1]);
txh = (d11txh_t *) pkt[count - 1]->data;
mcl = ltoh16(txh->MacTxControlLow);
mcl &= ~TXC_AMPDU_MASK;
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,
ampdu_len -= roundup(len, 4) - len;
/* patch up the first txh & plcp */
txh = (d11txh_t *) PKTDATA(pkt[0]);
txh = (d11txh_t *) pkt[0]->data;
plcp = (u8 *) (txh + 1);
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,
ASSERT(txs->status & TX_STATUS_AMPDU);
scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb);
ASSERT(scb_ampdu);
ini = SCB_AMPDU_INI(scb_ampdu, PKTPRIO(p));
ini = SCB_AMPDU_INI(scb_ampdu, p->priority);
ASSERT(ini->scb == scb);
/* 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,
scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb);
ASSERT(scb_ampdu);
tid = (u8) PKTPRIO(p);
tid = (u8) (p->priority);
ini = SCB_AMPDU_INI(scb_ampdu, tid);
retry_limit = ampdu->retry_limit_tid[tid];
......@@ -1065,7 +1065,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb,
#ifdef BCMDBG
if (WL_ERROR_ON()) {
prpkt("txpkt (AMPDU)", wlc->osh, p);
wlc_print_txdesc((d11txh_t *) PKTDATA(p));
wlc_print_txdesc((d11txh_t *) p->data);
wlc_print_txstatus(txs);
}
#endif /* BCMDBG */
......@@ -1076,7 +1076,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb,
while (p) {
tx_info = IEEE80211_SKB_CB(p);
ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
txh = (d11txh_t *) PKTDATA(p);
txh = (d11txh_t *) p->data;
mcl = ltoh16(txh->MacTxControlLow);
plcp = (u8 *) (txh + 1);
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)
if (!tail)
head = tail = p;
else {
PKTSETLINK(tail, p);
tail->prev = p;
tail = p;
}
......@@ -302,11 +302,11 @@ wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound)
/* process each frame */
while ((p = head) != NULL) {
head = PKTLINK(head);
PKTSETLINK(p, NULL);
head = head->prev;
p->prev = NULL;
/* 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);
/* 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)
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 */
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,
/* Increment wme stats */
if (WME_ENAB(wlc->pub)) {
WLCNTINCR(wlc->pub->_wme_cnt->
tx_failed[WME_PRIO2AC(PKTPRIO(p))].packets);
tx_failed[WME_PRIO2AC(p->priority)].packets);
WLCNTADD(wlc->pub->_wme_cnt->
tx_failed[WME_PRIO2AC(PKTPRIO(p))].bytes,
tx_failed[WME_PRIO2AC(p->priority)].bytes,
pkttotlen(wlc->osh, p));
}
......@@ -5071,7 +5071,7 @@ void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
struct pktq *q = &qi->q;
int prio;
prio = PKTPRIO(sdu);
prio = sdu->priority;
ASSERT(pktq_max(q) >= wlc->pub->tunables->datahiwat);
......@@ -5111,7 +5111,7 @@ wlc_sendpkt_mac80211(wlc_info_t *wlc, struct sk_buff *sdu,
uint fifo;
void *pkt;
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;
ASSERT(sdu);
......@@ -5120,13 +5120,13 @@ wlc_sendpkt_mac80211(wlc_info_t *wlc, struct sk_buff *sdu,
type = FC_TYPE(fc);
/* 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];
ASSERT((uint) PKTHEADROOM(sdu) >= TXOFF);
ASSERT(!PKTSHARED(sdu));
ASSERT(!PKTNEXT(sdu));
ASSERT(!PKTLINK(sdu));
ASSERT(!(sdu->cloned));
ASSERT(!(sdu->next));
ASSERT(!(sdu->prev));
ASSERT(fifo < NFIFO);
pkt = sdu;
......@@ -5236,7 +5236,7 @@ wlc_txfifo(wlc_info_t *wlc, uint fifo, struct sk_buff *p, bool commit,
d11txh_t *txh;
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
* ucode or BSS info as appropriate.
......@@ -5690,7 +5690,7 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw,
osh = wlc->osh;
/* locate 802.11 MAC header */
h = (struct dot11_header *)PKTDATA(p);
h = (struct dot11_header *)(p->data);
fc = ltoh16(h->fc);
type = FC_TYPE(fc);
......@@ -5731,12 +5731,12 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw,
} else {
/* Increment the counter for 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 */
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);
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)
if (p == NULL)
goto fatal;
txh = (d11txh_t *) PKTDATA(p);
txh = (d11txh_t *) (p->data);
mcl = ltoh16(txh->MacTxControlLow);
if (txs->phyerr) {
......@@ -6649,8 +6649,8 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2)
wlc_txfifo_complete(wlc, queue, 1);
if (lastframe) {
PKTSETNEXT(p, NULL);
PKTSETLINK(p, NULL);
p->next = NULL;
p->prev = NULL;
wlc->txretried = 0;
/* remove PLCP & Broadcom tx descriptor header */
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,
/* qual */
rx_status->antenna = (rxh->PhyRxStatus_0 & PRXS0_RXANT_UPSUBBAND) ? 1 : 0; /* ant */
plcp = PKTDATA(p);
plcp = p->data;
rspec = wlc_compute_rspec(rxh, plcp);
if (IS_MCS(rspec)) {
......@@ -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);
/* 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_trim(p, len_mpdu);
ASSERT(!PKTNEXT(p));
ASSERT(!PKTLINK(p));
ASSERT(!(p->next));
ASSERT(!(p->prev));
ASSERT(IS_ALIGNED((unsigned long)skb->data, 2));
......@@ -6980,7 +6980,7 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, struct sk_buff *p)
osh = wlc->osh;
/* frame starts with rxhdr */
rxh = (d11rxhdr_t *) PKTDATA(p);
rxh = (d11rxhdr_t *) (p->data);
/* strip off rxhdr */
skb_pull(p, wlc->hwrxoff);
......@@ -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 */
if (rxh->RxStatus1 & RXS_PBPRES) {
if (PKTLEN(p) < 2) {
if (p->len < 2) {
WLCNTINCR(wlc->pub->_cnt->rxrunt);
WL_ERROR(("wl%d: wlc_recv: rcvd runt of len %d\n",
wlc->pub->unit, PKTLEN(p)));
wlc->pub->unit, p->len));
goto toss;
}
skb_pull(p, 2);
}
h = (struct dot11_header *)(PKTDATA(p) + D11_PHY_HDR_LEN);
len = PKTLEN(p);
h = (struct dot11_header *)(p->data + D11_PHY_HDR_LEN);
len = p->len;
if (rxh->RxStatus1 & RXS_FCSERR) {
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)
osh = wlc->osh;
ASSERT(pdu);
txh = (d11txh_t *) PKTDATA(pdu);
txh = (d11txh_t *) (pdu->data);
ASSERT(txh);
h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
ASSERT(h);
......
......@@ -440,7 +440,7 @@ struct wlc_if;
#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
*/
extern const u8 wlc_prio2prec_map[];
......
......@@ -39,19 +39,19 @@ uint pktfrombuf(struct osl_info *osh, struct sk_buff *p, uint offset, int len,
uint n, ret = 0;
/* skip 'offset' bytes */
for (; p && offset; p = PKTNEXT(p)) {
if (offset < (uint) PKTLEN(p))
for (; p && offset; p = p->next) {
if (offset < (uint) (p->len))
break;
offset -= PKTLEN(p);
offset -= p->len;
}
if (!p)
return 0;
/* copy the data */
for (; p && len; p = PKTNEXT(p)) {
n = min((uint) PKTLEN(p) - offset, (uint) len);
bcopy(buf, PKTDATA(p) + offset, n);
for (; p && len; p = p->next) {
n = min((uint) (p->len) - offset, (uint) len);
bcopy(buf, p->data + offset, n);
buf += n;
len -= n;
ret += n;
......@@ -66,8 +66,8 @@ uint BCMFASTPATH pkttotlen(struct osl_info *osh, struct sk_buff *p)
uint total;
total = 0;
for (; p; p = PKTNEXT(p))
total += PKTLEN(p);
for (; p; p = p->next)
total += p->len;
return total;
}
......@@ -81,7 +81,7 @@ struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec,
struct pktq_prec *q;
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_pfull(pq, prec));
......@@ -89,7 +89,7 @@ struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec,
q = &pq->q[prec];
if (q->head)
PKTSETLINK(q->tail, p);
q->tail->prev = p;
else
q->head = p;
......@@ -110,7 +110,7 @@ struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec,
struct pktq_prec *q;
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_pfull(pq, prec));
......@@ -120,7 +120,7 @@ struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec,
if (q->head == NULL)
q->tail = p;
PKTSETLINK(p, q->head);
p->prev = q->head;
q->head = p;
q->len++;
......@@ -145,7 +145,7 @@ struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec)
if (p == NULL)
return NULL;
q->head = PKTLINK(p);
q->head = p->prev;
if (q->head == NULL)
q->tail = NULL;
......@@ -153,7 +153,7 @@ struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec)
pq->len--;
PKTSETLINK(p, NULL);
p->prev = NULL;
return p;
}
......@@ -171,11 +171,11 @@ struct sk_buff *BCMFASTPATH pktq_pdeq_tail(struct pktq *pq, int prec)
if (p == NULL)
return NULL;
for (prev = NULL; p != q->tail; p = PKTLINK(p))
for (prev = NULL; p != q->tail; p = p->prev)
prev = p;
if (prev)
PKTSETLINK(prev, NULL);
prev->prev = NULL;
else
q->head = NULL;
......@@ -196,8 +196,8 @@ void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir)
q = &pq->q[prec];
p = q->head;
while (p) {
q->head = PKTLINK(p);
PKTSETLINK(p, NULL);
q->head = p->prev;
p->prev = NULL;
PKTFREE(osh, p, dir);
q->len--;
pq->len--;
......@@ -228,17 +228,17 @@ pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir,
if (fn == NULL || (*fn) (p, arg)) {
bool head = (p == q->head);
if (head)
q->head = PKTLINK(p);
q->head = p->prev;
else
PKTSETLINK(prev, PKTLINK(p));
PKTSETLINK(p, NULL);
prev->prev = p->prev;
p->prev = NULL;
PKTFREE(osh, p, dir);
q->len--;
pq->len--;
p = (head ? q->head : PKTLINK(prev));
p = (head ? q->head : prev->prev);
} else {
prev = p;
p = PKTLINK(p);
p = p->prev;
}
}
......@@ -331,7 +331,7 @@ struct sk_buff *BCMFASTPATH pktq_mdeq(struct pktq *pq, uint prec_bmp,
if (p == NULL)
return NULL;
q->head = PKTLINK(p);
q->head = p->prev;
if (q->head == NULL)
q->tail = NULL;
......@@ -342,7 +342,7 @@ struct sk_buff *BCMFASTPATH pktq_mdeq(struct pktq *pq, uint prec_bmp,
pq->len--;
PKTSETLINK(p, NULL);
p->prev = NULL;
return p;
}
......@@ -417,8 +417,8 @@ void prpkt(const char *msg, struct osl_info *osh, struct sk_buff *p0)
if (msg && (msg[0] != '\0'))
printf("%s:\n", msg);
for (p = p0; p; p = PKTNEXT(p))
prhex(NULL, PKTDATA(p), PKTLEN(p));
for (p = p0; p; p = p->next)
prhex(NULL, p->data, p->len);
}
#endif /* defined(BCMDBG) */
......
......@@ -989,15 +989,15 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
if (head == NULL)
return NULL;
len = ltoh16(*(u16 *) (PKTDATA(head)));
len = ltoh16(*(u16 *) (head->data));
DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
#if defined(__mips__)
if (!len) {
while (!(len = *(u16 *) OSL_UNCACHED(PKTDATA(head))))
while (!(len = *(u16 *) OSL_UNCACHED(head->data)))
udelay(1);
*(u16 *) PKTDATA(head) = htol16((u16) len);
*(u16 *) (head->data) = htol16((u16) len);
}
#endif /* defined(__mips__) */
......@@ -1010,7 +1010,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
if (resid > 0) {
tail = head;
while ((resid > 0) && (p = _dma_getnextrxp(di, false))) {
PKTSETNEXT(tail, p);
tail->next = p;
pkt_len = min(resid, (int)di->rxbufsize);
__skb_trim(p, pkt_len);
......@@ -1115,12 +1115,12 @@ static bool BCMFASTPATH _dma_rxfill(dma_info_t *di)
/* Do a cached write instead of uncached write since DMA_MAP
* will flush the cache.
*/
*(u32 *) (PKTDATA(p)) = 0;
*(u32 *) (p->data) = 0;
if (DMASGLIST_ENAB)
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]);
ASSERT(IS_ALIGNED(PHYSADDRLO(pa), 4));
......@@ -1673,12 +1673,12 @@ static int dma32_txfast(dma_info_t *di, struct sk_buff *p0, bool commit)
uint nsegs, j;
hnddma_seg_map_t *map;
data = PKTDATA(p);
len = PKTLEN(p);
data = p->data;
len = p->len;
#ifdef BCM_DMAPAD
len += PKTDMAPAD(di->osh, p);
#endif
next = PKTNEXT(p);
next = p->next;
/* return nonzero if out of tx descriptors */
if (NEXTTXD(txout) == di->txin)
......@@ -2323,12 +2323,12 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
uint nsegs, j;
hnddma_seg_map_t *map;
data = PKTDATA(p);
len = PKTLEN(p);
data = p->data;
len = p->len;
#ifdef BCM_DMAPAD
len += PKTDMAPAD(di->osh, p);
#endif /* BCM_DMAPAD */
next = PKTNEXT(p);
next = p->next;
/* return nonzero if out of tx descriptors */
if (NEXTTXD(txout) == di->txin)
......
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