[PATCH 3/3] staging: brcm80211: removed packet macros for accessing sk_buff fields

Arend van Spriel arend at broadcom.com
Tue Nov 23 13:06:24 UTC 2010


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: Brett Rudley <brudley at broadcom.com>
Signed-off-by: Arend van Spriel <arend at broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   32 +++---
 drivers/staging/brcm80211/brcmfmac/dhd_cdc.c      |   18 ++--
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c    |   10 +-
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |  136 ++++++++++----------
 drivers/staging/brcm80211/include/linux_osl.h     |   18 +--
 drivers/staging/brcm80211/sys/wlc_ampdu.c         |   22 ++--
 drivers/staging/brcm80211/sys/wlc_bmac.c          |   10 +-
 drivers/staging/brcm80211/sys/wlc_mac80211.c      |   50 ++++----
 drivers/staging/brcm80211/sys/wlc_pub.h           |    2 +-
 drivers/staging/brcm80211/util/bcmutils.c         |   54 ++++----
 drivers/staging/brcm80211/util/hnddma.c           |   24 ++--
 11 files changed, 183 insertions(+), 193 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 3d3a428..aadfe69 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -936,57 +936,57 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
 
 	struct sk_buff *pnext;
 
 	sd_trace(("%s: Enter\n", __func__));
 
 	ASSERT(pkt);
 	DHD_PM_RESUME_WAIT(sdioh_request_packet_wait);
 	DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
 
 	/* 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;
 
 #ifdef CONFIG_MMC_MSM7X00A
 		if ((pkt_len % 64) == 32) {
 			sd_trace(("%s: Rounding up TX packet +=32\n",
 				  __func__));
 			pkt_len += 32;
 		}
 #endif				/* CONFIG_MMC_MSM7X00A */
 		/* Make sure the packet is aligned properly.
 		 * If it isn't, then this
 		 * is the fault of sdioh_request_buffer() which
 		 * 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);
 		}
 
 		if (err_ret) {
 			sd_err(("%s: %s FAILED %p[%d], addr=0x%05x, pkt_len=%d,"
 				 "ERR=0x%08x\n", __func__,
 				 (write) ? "TX" : "RX",
 				 pnext, SGCount, addr, pkt_len, err_ret));
 		} else {
 			sd_trace(("%s: %s xfr'd %p[%d], addr=0x%05x, len=%d\n",
 				  __func__,
@@ -1040,57 +1040,57 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
 		sd_data(("%s: Creating new %s Packet, len=%d\n",
 			 __func__, write ? "TX" : "RX", buflen_u));
 		mypkt = PKTGET(sd->osh, buflen_u, write ? true : false);
 		if (!mypkt) {
 			sd_err(("%s: PKTGET failed: len %d\n",
 				__func__, buflen_u));
 			return SDIOH_API_RC_FAIL;
 		}
 
 		/* 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
 				 it is aligned. */
 		sd_data(("%s: Aligned %s Packet, direct DMA\n",
 			 __func__, write ? "Tx" : "Rx"));
 		Status =
 		    sdioh_request_packet(sd, fix_inc, write, func, addr, pkt);
 	}
 
 	return Status;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
index c23d30b..2fa77cb 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
@@ -315,96 +315,96 @@ void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf)
 #ifdef BDC
 	struct bdc_header *h;
 #endif				/* BDC */
 
 	DHD_TRACE(("%s: Enter\n", __func__));
 
 #ifdef BDC
 	/* Push BDC header used to convey priority for buses that don't */
 
 	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 */
 	BDC_SET_IF_IDX(h, ifidx);
 }
 
 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)
 		return true;
 #endif
 	return false;
 }
 
 int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
 {
 #ifdef BDC
 	struct bdc_header *h;
 #endif
 
 	DHD_TRACE(("%s: Enter\n", __func__));
 
 #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) {
 		DHD_ERROR(("%s: rx data ifnum out of range (%d)\n",
 			   __func__, *ifidx));
 		return BCME_ERROR;
 	}
 
 	if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) !=
 	    BDC_PROTO_VER) {
 		DHD_ERROR(("%s: non-BDC packet received, flags 0x%x\n",
 			   dhd_ifname(dhd, *ifidx), h->flags));
 		return BCME_ERROR;
 	}
 
 	if (h->flags & BDC_FLAG_SUM_GOOD) {
 		DHD_INFO(("%s: BDC packet received with good rx-csum, "
 			"flags 0x%x\n",
 			dhd_ifname(dhd, *ifidx), h->flags));
 		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 */
 
 	return 0;
 }
 
 int dhd_prot_attach(dhd_pub_t *dhd)
 {
 	dhd_prot_t *cdc;
 
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index ec887fb..2a502f9 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -1020,24 +1020,24 @@ static void dhd_set_multicast_list(struct net_device *dev)
 
 int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
 {
 	int ret;
 	dhd_info_t *dhd = (dhd_info_t *) (dhdp->info);
 
 	/* Reject if down */
 	if (!dhdp->up || (dhdp->busstate == DHD_BUS_DOWN))
 		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))
 			dhdp->tx_multicast++;
 		if (ntoh16(eh->ether_type) == ETHER_TYPE_802_1X)
 			atomic_inc(&dhd->pend_8021x_cnt);
 	}
 
 	/* If the protocol uses a data header, apply it */
 	dhd_prot_hdrpush(dhdp, ifidx, pktbuf);
 
@@ -1143,24 +1143,24 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf,
 	struct sk_buff *pnext, *save_pktbuf;
 	int i;
 	dhd_if_t *ifp;
 	wl_event_msg_t event;
 
 	DHD_TRACE(("%s: Enter\n", __func__));
 
 	save_pktbuf = 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);
 
 		/* Get the protocol, maintain skb around eth_type_trans()
 		 * The main reason for this hack is for the limitation of
 		 * Linux 2.4 where 'eth_type_trans' uses the
 		 * 'net->hard_header_len'
 		 * to perform skb_pull inside vs ETH_HLEN. Since to avoid
 		 * coping of the packet coming from the network stack to add
 		 * BDC, Hardware header etc, during network interface
 		 * registration
@@ -1225,23 +1225,23 @@ void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx)
 }
 
 void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success)
 {
 	uint ifidx;
 	dhd_info_t *dhd = (dhd_info_t *) (dhdp->info);
 	struct ether_header *eh;
 	u16 type;
 
 	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)
 		atomic_dec(&dhd->pend_8021x_cnt);
 
 }
 
 static struct net_device_stats *dhd_get_stats(struct net_device *net)
 {
 	dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
 	dhd_if_t *ifp;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 12bb7c6..1d06fb2 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -349,32 +349,32 @@ static const uint retry_limit = 2;
 static bool forcealign;
 
 #define ALIGNMENT  4
 
 #if defined(OOB_INTR_ONLY) && defined(HW_OOB)
 extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable);
 #endif
 
 #if defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD)
 #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)					\
+#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));	\
+		datalign = (unsigned long)((_p)->data);			\
+		datalign = roundup(datalign, (_align)) - datalign;	\
+		ASSERT(datalign < (_align));				\
+		ASSERT((_p)->len >= ((_len) + datalign));		\
 		if (datalign)						\
-			skb_pull((p), datalign);			\
-		__skb_trim((p), (len));				\
+			skb_pull((_p), datalign);			\
+		__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) && \
@@ -919,75 +919,75 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
 
 	DHD_TRACE(("%s: Enter\n", __func__));
 
 	sdh = bus->sdh;
 	osh = bus->dhd->osh;
 
 	if (bus->dhd->dongle_reset) {
 		ret = BCME_NOTREADY;
 		goto done;
 	}
 
-	frame = (u8 *) PKTDATA(pkt);
+	frame = (u8 *) (pkt->data);
 
 	/* Add alignment padding, allocate new packet if needed */
 	pad = ((unsigned long)frame % DHD_SDALIGN);
 	if (pad) {
 		if (PKTHEADROOM(pkt) < pad) {
 			DHD_INFO(("%s: insufficient headroom %d for %d pad\n",
 				  __func__, (int)PKTHEADROOM(pkt), pad));
 			bus->dhd->tx_realloc++;
-			new = PKTGET(osh, (PKTLEN(pkt) + DHD_SDALIGN), true);
+			new = PKTGET(osh, (pkt->len + DHD_SDALIGN), true);
 			if (!new) {
 				DHD_ERROR(("%s: couldn't allocate new %d-byte "
 					"packet\n",
-					__func__, PKTLEN(pkt) + DHD_SDALIGN));
+					__func__, pkt->len + DHD_SDALIGN));
 				ret = BCME_NOMEM;
 				goto done;
 			}
 
-			PKTALIGN(osh, new, PKTLEN(pkt), DHD_SDALIGN);
-			bcopy(PKTDATA(pkt), PKTDATA(new), PKTLEN(pkt));
+			PKTALIGN(osh, new, pkt->len, DHD_SDALIGN);
+			bcopy(pkt->data, new->data, pkt->len);
 			if (free_pkt)
 				PKTFREE(osh, pkt, true);
 			/* free the pkt if canned one is not used */
 			free_pkt = true;
 			pkt = new;
-			frame = (u8 *) PKTDATA(pkt);
+			frame = (u8 *) (pkt->data);
 			ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0);
 			pad = 0;
 		} else {
 			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);
 		}
 	}
 	ASSERT(pad < DHD_SDALIGN);
 
 	/* 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) + 1) = htol16(~len);
 
 	/* Software tag: channel, sequence number, data offset */
 	swheader =
 	    ((chan << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK) | bus->tx_seq |
 	    (((pad +
 	       SDPCM_HDRLEN) << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK);
 	htol32_ua_store(swheader, frame + SDPCM_FRAMETAG_LEN);
 	htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
 
 #ifdef DHD_DEBUG
-	tx_packets[PKTPRIO(pkt)]++;
+	tx_packets[pkt->priority]++;
 	if (DHD_BYTES_ON() &&
 	    (((DHD_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) ||
 	      (DHD_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) {
 		prhex("Tx Frame", frame, len);
 	} else if (DHD_HDRS_ON()) {
 		prhex("TxHdr", frame, min_t(u16, len, 16));
 	}
 #endif
 
 	/* Raise len to next SDIO block to eliminate tail command */
 	if (bus->roundup && bus->blocksize && (len > bus->blocksize)) {
@@ -1067,43 +1067,43 @@ done:
 }
 
 int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
 {
 	int ret = BCME_ERROR;
 	struct osl_info *osh;
 	uint datalen, prec;
 
 	DHD_TRACE(("%s: Enter\n", __func__));
 
 	osh = bus->dhd->osh;
-	datalen = PKTLEN(pkt);
+	datalen = pkt->len;
 
 #ifdef SDTEST
 	/* Push the test header if doing loopback */
 	if (bus->ext_loop) {
 		u8 *data;
 		skb_push(pkt, SDPCM_TEST_HDRLEN);
-		data = PKTDATA(pkt);
+		data = pkt->data;
 		*data++ = SDPCM_TEST_ECHOREQ;
 		*data++ = (u8) bus->loopid++;
 		*data++ = (datalen >> 0);
 		*data++ = (datalen >> 8);
 		datalen += SDPCM_TEST_HDRLEN;
 	}
 #endif				/* SDTEST */
 
 	/* Add space for the header */
 	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,
 			 pending event, or pending clock */
 	if (dhd_deferred_tx || bus->fcstate || pktq_len(&bus->txq)
 	    || bus->dpc_sched || (!DATAOK(bus))
 	    || (bus->flowcontrol & NBITVAL(prec))
 	    || (bus->clkstate != CLK_AVAIL)) {
 		DHD_TRACE(("%s: deferring pktq len %d\n", __func__,
 			   pktq_len(&bus->txq)));
 		bus->fcqueued++;
 
@@ -1183,23 +1183,23 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes)
 	tx_prec_map = ~bus->flowcontrol;
 
 	/* Send frames until the limit or some other event */
 	for (cnt = 0; (cnt < maxframes) && DATAOK(bus); cnt++) {
 		dhd_os_sdlock_txq(bus->dhd);
 		pkt = pktq_mdeq(&bus->txq, tx_prec_map, &prec_out);
 		if (pkt == NULL) {
 			dhd_os_sdunlock_txq(bus->dhd);
 			break;
 		}
 		dhd_os_sdunlock_txq(bus->dhd);
-		datalen = PKTLEN(pkt) - SDPCM_HDRLEN;
+		datalen = pkt->len - SDPCM_HDRLEN;
 
 #ifndef SDTEST
 		ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
 #else
 		ret = dhdsdio_txpkt(bus, pkt,
 				    (bus->ext_loop ? SDPCM_TEST_CHANNEL :
 				     SDPCM_DATA_CHANNEL), true);
 #endif
 		if (ret)
 			bus->dhd->tx_errors++;
 		else
@@ -3196,24 +3196,24 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
 	/* If packets, issue read(s) and send up packet chain */
 	/* Return sequence numbers consumed? */
 
 	DHD_TRACE(("dhdsdio_rxglom: start: glomd %p glom %p\n", bus->glomd,
 		   bus->glom));
 
 	/* If there's a descriptor, generate the packet chain */
 	if (bus->glomd) {
 		dhd_os_sdlock_rxq(bus->dhd);
 
 		pfirst = plast = pnext = NULL;
-		dlen = (u16) PKTLEN(bus->glomd);
-		dptr = PKTDATA(bus->glomd);
+		dlen = (u16) (bus->glomd->len);
+		dptr = bus->glomd->data;
 		if (!dlen || (dlen & 1)) {
 			DHD_ERROR(("%s: bad glomd len(%d), ignore descriptor\n",
 			__func__, dlen));
 			dlen = 0;
 		}
 
 		for (totlen = num = 0; dlen; num++) {
 			/* Get (and move past) next length */
 			sublen = ltoh16_ua(dptr);
 			dlen -= sizeof(u16);
 			dptr += sizeof(u16);
@@ -3238,29 +3238,29 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
 				    (roundup(totlen, bus->blocksize) - totlen);
 				totlen = roundup(totlen, bus->blocksize);
 			}
 
 			/* Allocate/chain packet for next subframe */
 			pnext = PKTGET(osh, sublen + DHD_SDALIGN, false);
 			if (pnext == NULL) {
 				DHD_ERROR(("%s: PKTGET failed, num %d len %d\n",
 					   __func__, num, sublen));
 				break;
 			}
-			ASSERT(!PKTLINK(pnext));
+			ASSERT(!(pnext->prev));
 			if (!pfirst) {
 				ASSERT(!plast);
 				pfirst = plast = pnext;
 			} else {
 				ASSERT(plast);
-				PKTSETNEXT(plast, pnext);
+				plast->next = pnext;
 				plast = pnext;
 			}
 
 			/* Adhere to start alignment requirements */
 			PKTALIGN(osh, pnext, sublen, DHD_SDALIGN);
 		}
 
 		/* If all allocations succeeded, save packet chain
 			 in bus structure */
 		if (pnext) {
 			DHD_GLOM(("%s: allocated %d-byte packet chain for %d "
@@ -3287,42 +3287,42 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
 		bus->nextlen = 0;
 
 		dhd_os_sdunlock_rxq(bus->dhd);
 	}
 
 	/* Ok -- either we just generated a packet chain,
 		 or had one from before */
 	if (bus->glom) {
 		if (DHD_GLOM_ON()) {
 			DHD_GLOM(("%s: try superframe read, packet chain:\n",
 				__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",
-					  pnext, (u8 *) PKTDATA(pnext),
-					  PKTLEN(pnext), PKTLEN(pnext)));
+					  pnext, (u8 *) (pnext->data),
+					  pnext->len, pnext->len));
 			}
 		}
 
 		pfirst = bus->glom;
 		dlen = (u16) pkttotlen(osh, pfirst);
 
 		/* Do an SDIO read for the superframe.  Configurable iovar to
 		 * read directly into the chained packet, or allocate a large
 		 * packet and and copy into the chain.
 		 */
 		if (usechain) {
 			errcode = dhd_bcmsdh_recv_buf(bus,
 						      bcmsdh_cur_sbwad
 						      (bus->sdh), SDIO_FUNC_2,
 						      F2SYNC,
-						      (u8 *) PKTDATA(pfirst),
+						      (u8 *) pfirst->data,
 						      dlen, pfirst, NULL, NULL);
 		} else if (bus->dataptr) {
 			errcode = dhd_bcmsdh_recv_buf(bus,
 						      bcmsdh_cur_sbwad
 						      (bus->sdh), SDIO_FUNC_2,
 						      F2SYNC, bus->dataptr,
 						      dlen, NULL, NULL, NULL);
 			sublen =
 			    (u16) pktfrombuf(osh, pfirst, 0, dlen,
 						bus->dataptr);
 			if (sublen != dlen) {
@@ -3352,29 +3352,29 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
 				dhdsdio_rxfail(bus, true, false);
 				dhd_os_sdlock_rxq(bus->dhd);
 				PKTFREE(osh, bus->glom, false);
 				dhd_os_sdunlock_rxq(bus->dhd);
 				bus->rxglomfail++;
 				bus->glom = NULL;
 			}
 			return 0;
 		}
 #ifdef DHD_DEBUG
 		if (DHD_GLOM_ON()) {
-			prhex("SUPERFRAME", PKTDATA(pfirst),
-			      min_t(int, PKTLEN(pfirst), 48));
+			prhex("SUPERFRAME", pfirst->data,
+			      min_t(int, pfirst->len, 48));
 		}
 #endif
 
 		/* Validate the superframe header */
-		dptr = (u8 *) PKTDATA(pfirst);
+		dptr = (u8 *) (pfirst->data);
 		sublen = ltoh16_ua(dptr);
 		check = ltoh16_ua(dptr + sizeof(u16));
 
 		chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
 		seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);
 		bus->nextlen = dptr[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET];
 		if ((bus->nextlen << 4) > MAX_RX_DATASZ) {
 			DHD_INFO(("%s: nextlen too large (%d) seq %d\n",
 				__func__, bus->nextlen, seq));
 			bus->nextlen = 0;
 		}
@@ -3396,27 +3396,27 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
 			   SDPCM_GLOM_CHANNEL) {
 			DHD_ERROR(("%s (superframe): bad channel %d\n",
 				   __func__,
 				   SDPCM_PACKET_CHANNEL(&dptr
 							[SDPCM_FRAMETAG_LEN])));
 			errcode = -1;
 		} else if (SDPCM_GLOMDESC(&dptr[SDPCM_FRAMETAG_LEN])) {
 			DHD_ERROR(("%s (superframe): got second descriptor?\n",
 				   __func__));
 			errcode = -1;
 		} 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 "
 				"pkt %d min %d\n",
 				__func__, doff, sublen,
-				PKTLEN(pfirst), SDPCM_HDRLEN));
+				pfirst->len, SDPCM_HDRLEN));
 			errcode = -1;
 		}
 
 		/* Check sequence number of superframe SW header */
 		if (rxseq != seq) {
 			DHD_INFO(("%s: (superframe) rx_seq %d, expected %d\n",
 				  __func__, seq, rxseq));
 			bus->rx_badseq++;
 			rxseq = seq;
 		}
 
@@ -3426,25 +3426,25 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
 				__func__, txmax, bus->tx_seq));
 			txmax = bus->tx_seq + 2;
 		}
 		bus->tx_max = txmax;
 
 		/* Remove superframe header, remember offset */
 		skb_pull(pfirst, doff);
 		sfdoff = doff;
 
 		/* Validate all the subframe headers */
 		for (num = 0, pnext = pfirst; pnext && !errcode;
-		     num++, pnext = PKTNEXT(pnext)) {
-			dptr = (u8 *) PKTDATA(pnext);
-			dlen = (u16) PKTLEN(pnext);
+		     num++, pnext = pnext->next) {
+			dptr = (u8 *) (pnext->data);
+			dlen = (u16) (pnext->len);
 			sublen = ltoh16_ua(dptr);
 			check = ltoh16_ua(dptr + sizeof(u16));
 			chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
 			doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
 #ifdef DHD_DEBUG
 			if (DHD_GLOM_ON())
 				prhex("subframe", dptr, 32);
 #endif
 
 			if ((u16)~(sublen ^ check)) {
 				DHD_ERROR(("%s (subframe %d): HW hdr error: "
@@ -3488,92 +3488,92 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
 			bus->nextlen = 0;
 			return 0;
 		}
 
 		/* Basic SD framing looks ok - process each packet (header) */
 		save_pfirst = pfirst;
 		bus->glom = NULL;
 		plast = NULL;
 
 		dhd_os_sdlock_rxq(bus->dhd);
 		for (num = 0; pfirst; rxseq++, pfirst = pnext) {
-			pnext = PKTNEXT(pfirst);
-			PKTSETNEXT(pfirst, NULL);
+			pnext = pfirst->next;
+			pfirst->next = NULL;
 
-			dptr = (u8 *) PKTDATA(pfirst);
+			dptr = (u8 *) (pfirst->data);
 			sublen = ltoh16_ua(dptr);
 			chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
 			seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);
 			doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
 
 			DHD_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d "
 				"chan %d seq %d\n",
-				__func__, num, pfirst, PKTDATA(pfirst),
-				PKTLEN(pfirst), sublen, chan, seq));
+				__func__, num, pfirst, pfirst->data,
+				pfirst->len, sublen, chan, seq));
 
 			ASSERT((chan == SDPCM_DATA_CHANNEL)
 			       || (chan == SDPCM_EVENT_CHANNEL));
 
 			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
 
 			__skb_trim(pfirst, sublen);
 			skb_pull(pfirst, doff);
 
-			if (PKTLEN(pfirst) == 0) {
+			if (pfirst->len == 0) {
 				PKTFREE(bus->dhd->osh, pfirst, false);
 				if (plast) {
-					PKTSETNEXT(plast, pnext);
+					plast->next = pnext;
 				} else {
 					ASSERT(save_pfirst == pfirst);
 					save_pfirst = pnext;
 				}
 				continue;
 			} else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pfirst) !=
 				   0) {
 				DHD_ERROR(("%s: rx protocol error\n",
 					   __func__));
 				bus->dhd->rx_errors++;
 				PKTFREE(osh, pfirst, false);
 				if (plast) {
-					PKTSETNEXT(plast, pnext);
+					plast->next = pnext;
 				} else {
 					ASSERT(save_pfirst == pfirst);
 					save_pfirst = pnext;
 				}
 				continue;
 			}
 
 			/* this packet will go up, link back into
 				 chain and count it */
-			PKTSETNEXT(pfirst, pnext);
+			pfirst->next = pnext;
 			plast = pfirst;
 			num++;
 
 #ifdef DHD_DEBUG
 			if (DHD_GLOM_ON()) {
 				DHD_GLOM(("%s subframe %d to stack, %p(%p/%d) "
 				"nxt/lnk %p/%p\n",
-				__func__, num, pfirst, PKTDATA(pfirst),
-				PKTLEN(pfirst), PKTNEXT(pfirst),
-				PKTLINK(pfirst)));
-				prhex("", (u8 *) PKTDATA(pfirst),
-				      min_t(int, PKTLEN(pfirst), 32));
+				__func__, num, pfirst, pfirst->data,
+				pfirst->len, pfirst->next,
+				pfirst->prev));
+				prhex("", (u8 *) pfirst->data,
+				      min_t(int, pfirst->len, 32));
 			}
 #endif				/* DHD_DEBUG */
 		}
 		dhd_os_sdunlock_rxq(bus->dhd);
 		if (num) {
 			dhd_os_sdunlock(bus->dhd);
 			dhd_rx_frame(bus->dhd, ifidx, save_pfirst, num);
 			dhd_os_sdlock(bus->dhd);
 		}
 
 		bus->rxglomframes++;
@@ -3729,25 +3729,25 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
 					DHD_ERROR(("%s (nextlen): PKTGET failed: len %d rdlen %d " "expected rxseq %d\n",
 						__func__, len, rdlen, rxseq));
 					/* Just go try again w/normal
 					header read */
 					dhd_os_sdunlock_rxq(bus->dhd);
 					continue;
 				}
 			} else {
 				if (bus->bus == SPI_BUS)
 					bus->usebufpool = true;
 
-				ASSERT(!PKTLINK(pkt));
+				ASSERT(!(pkt->prev));
 				PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN);
-				rxbuf = (u8 *) PKTDATA(pkt);
+				rxbuf = (u8 *) (pkt->data);
 				/* Read the entire frame */
 				sdret =
 				    dhd_bcmsdh_recv_buf(bus,
 						bcmsdh_cur_sbwad(sdh),
 						SDIO_FUNC_2, F2SYNC,
 						rxbuf, rdlen, pkt, NULL,
 						NULL);
 				bus->f2rxdata++;
 				ASSERT(sdret != BCME_PENDING);
 
 				if (sdret < 0) {
@@ -4095,71 +4095,71 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
 		if (!pkt) {
 			/* Give up on data, request rtx of events */
 			DHD_ERROR(("%s: PKTGET failed: rdlen %d chan %d\n",
 				   __func__, rdlen, chan));
 			bus->dhd->rx_dropped++;
 			dhd_os_sdunlock_rxq(bus->dhd);
 			dhdsdio_rxfail(bus, false, RETRYCHAN(chan));
 			continue;
 		}
 		dhd_os_sdunlock_rxq(bus->dhd);
 
-		ASSERT(!PKTLINK(pkt));
+		ASSERT(!(pkt->prev));
 
 		/* Leave room for what we already read, and align remainder */
-		ASSERT(firstread < (PKTLEN(pkt)));
+		ASSERT(firstread < pkt->len);
 		skb_pull(pkt, firstread);
 		PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN);
 
 		/* Read the remaining frame data */
 		sdret =
 		    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);
 		bus->f2rxdata++;
 		ASSERT(sdret != BCME_PENDING);
 
 		if (sdret < 0) {
 			DHD_ERROR(("%s: read %d %s bytes failed: %d\n",
 				   __func__, rdlen,
 				   ((chan ==
 				     SDPCM_EVENT_CHANNEL) ? "event" : ((chan ==
 					SDPCM_DATA_CHANNEL)
 				       ? "data" : "test")),
 				   sdret));
 			dhd_os_sdlock_rxq(bus->dhd);
 			PKTFREE(bus->dhd->osh, pkt, false);
 			dhd_os_sdunlock_rxq(bus->dhd);
 			bus->dhd->rx_errors++;
 			dhdsdio_rxfail(bus, true, RETRYCHAN(chan));
 			continue;
 		}
 
 		/* Copy the already-read portion */
 		skb_push(pkt, firstread);
-		bcopy(bus->rxhdr, PKTDATA(pkt), firstread);
+		bcopy(bus->rxhdr, pkt->data, firstread);
 
 #ifdef DHD_DEBUG
 		if (DHD_BYTES_ON() && DHD_DATA_ON())
-			prhex("Rx Data", PKTDATA(pkt), len);
+			prhex("Rx Data", pkt->data, len);
 #endif
 
 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);
+					prhex("Glom Data", pkt->data, len);
 				}
 #endif
 				__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);
 			}
@@ -4170,23 +4170,23 @@ deliver:
 		__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) {
+		if (pkt->len == 0) {
 			dhd_os_sdlock_rxq(bus->dhd);
 			PKTFREE(bus->dhd->osh, pkt, false);
 			dhd_os_sdunlock_rxq(bus->dhd);
 			continue;
 		} else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pkt) != 0) {
 			DHD_ERROR(("%s: rx protocol error\n", __func__));
 			dhd_os_sdlock_rxq(bus->dhd);
 			PKTFREE(bus->dhd->osh, pkt, false);
 			dhd_os_sdunlock_rxq(bus->dhd);
 			bus->dhd->rx_errors++;
 			continue;
@@ -4664,23 +4664,23 @@ static void dhdsdio_pktgen(dhd_bus_t *bus)
 		/* Allocate an appropriate-sized packet */
 		len = bus->pktgen_len;
 		pkt = PKTGET(osh,
 			(len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN),
 			true);
 		if (!pkt) {
 			DHD_ERROR(("%s: PKTGET failed!\n", __func__));
 			break;
 		}
 		PKTALIGN(osh, pkt, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN),
 			 DHD_SDALIGN);
-		data = (u8 *) PKTDATA(pkt) + SDPCM_HDRLEN;
+		data = (u8 *) (pkt->data) + SDPCM_HDRLEN;
 
 		/* Write test header cmd and extra based on mode */
 		switch (bus->pktgen_mode) {
 		case DHD_PKTGEN_ECHO:
 			*data++ = SDPCM_TEST_ECHOREQ;
 			*data++ = (u8) bus->pktgen_sent;
 			break;
 
 		case DHD_PKTGEN_SEND:
 			*data++ = SDPCM_TEST_DISCARD;
 			*data++ = (u8) bus->pktgen_sent;
@@ -4703,25 +4703,25 @@ static void dhdsdio_pktgen(dhd_bus_t *bus)
 		*data++ = (len >> 0);
 		*data++ = (len >> 8);
 
 		/* Then fill in the remainder -- N/A for burst,
 			 but who cares... */
 		for (fillbyte = 0; fillbyte < len; fillbyte++)
 			*data++ =
 			    SDPCM_TEST_FILL(fillbyte, (u8) bus->pktgen_sent);
 
 #ifdef DHD_DEBUG
 		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,
-			      PKTLEN(pkt) - SDPCM_HDRLEN);
+			      pkt->len - SDPCM_HDRLEN);
 		}
 #endif
 
 		/* Send it */
 		if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, true)) {
 			bus->pktgen_fail++;
 			if (bus->pktgen_stop
 			    && bus->pktgen_stop == bus->pktgen_fail)
 				bus->pktgen_count = 0;
 		}
 		bus->pktgen_sent++;
@@ -4742,23 +4742,23 @@ static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start)
 	u8 *data;
 	struct osl_info *osh = bus->dhd->osh;
 
 	/* Allocate the packet */
 	pkt = PKTGET(osh, SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN,
 			true);
 	if (!pkt) {
 		DHD_ERROR(("%s: PKTGET failed!\n", __func__));
 		return;
 	}
 	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 */
 	*data++ = SDPCM_TEST_SEND;
 	*data++ = start;
 	*data++ = (bus->pktgen_maxlen >> 0);
 	*data++ = (bus->pktgen_maxlen >> 8);
 
 	/* Send it */
 	if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, true))
 		bus->pktgen_fail++;
 }
@@ -4767,55 +4767,55 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
 {
 	struct osl_info *osh = bus->dhd->osh;
 	u8 *data;
 	uint pktlen;
 
 	u8 cmd;
 	u8 extra;
 	u16 len;
 	u16 offset;
 
 	/* Check for min length */
-	pktlen = PKTLEN(pkt);
+	pktlen = pkt->len;
 	if (pktlen < SDPCM_TEST_HDRLEN) {
 		DHD_ERROR(("dhdsdio_restrcv: toss runt frame, pktlen %d\n",
 			   pktlen));
 		PKTFREE(osh, pkt, false);
 		return;
 	}
 
 	/* Extract header fields */
-	data = PKTDATA(pkt);
+	data = pkt->data;
 	cmd = *data++;
 	extra = *data++;
 	len = *data++;
 	len += *data++ << 8;
 
 	/* Check length for relevant commands */
 	if (cmd == SDPCM_TEST_DISCARD || cmd == SDPCM_TEST_ECHOREQ
 	    || cmd == SDPCM_TEST_ECHORSP) {
 		if (pktlen != len + SDPCM_TEST_HDRLEN) {
 			DHD_ERROR(("dhdsdio_testrcv: frame length mismatch, "
 				"pktlen %d seq %d" " cmd %d extra %d len %d\n",
 				pktlen, seq, cmd, extra, len));
 			PKTFREE(osh, pkt, false);
 			return;
 		}
 	}
 
 	/* Process as per command */
 	switch (cmd) {
 	case SDPCM_TEST_ECHOREQ:
 		/* Rx->Tx turnaround ok (even on NDIS w/current
 			 implementation) */
-		*(u8 *) (PKTDATA(pkt)) = SDPCM_TEST_ECHORSP;
+		*(u8 *) (pkt->data) = SDPCM_TEST_ECHORSP;
 		if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, true) == 0) {
 			bus->pktgen_sent++;
 		} else {
 			bus->pktgen_fail++;
 			PKTFREE(osh, pkt, false);
 		}
 		bus->pktgen_rcvd++;
 		break;
 
 	case SDPCM_TEST_ECHORSP:
 		if (bus->ext_loop) {
diff --git a/drivers/staging/brcm80211/include/linux_osl.h b/drivers/staging/brcm80211/include/linux_osl.h
index 010182f..4e44660 100644
--- a/drivers/staging/brcm80211/include/linux_osl.h
+++ b/drivers/staging/brcm80211/include/linux_osl.h
@@ -238,31 +238,26 @@ extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size,
 #define	REG_MAP(pa, size)	ioremap_nocache((unsigned long)(pa), (unsigned long)(size))
 #else
 #define REG_MAP(pa, size)       (void *)(0)
 #endif				/* !defined(CONFIG_MMC_MSM7X00A */
 #define	REG_UNMAP(va)		iounmap((va))
 
 #define	R_SM(r)			(*(r))
 #define	W_SM(r, v)		(*(r) = (v))
 #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);
 
 #ifdef BRCM_FULLMAC
 static inline void *
 osl_pkt_frmnative(struct osl_pubinfo *osh, struct sk_buff *skb)
 {
 	struct sk_buff *nskb;
 
 	for (nskb = skb; nskb; nskb = nskb->next)
@@ -285,22 +280,17 @@ osl_pkt_tonative(struct osl_pubinfo *osh, void *pkt)
 }
 #define PKTTONATIVE(osh, pkt)	\
 	osl_pkt_tonative((struct osl_pubinfo *)(osh), (pkt))
 #else /* !BRCM_FULLMAC */
 #define PKTUNALLOC(osh)		(((struct osl_pubinfo *)(osh))->pktalloced--)
 
 #define	PKTSETSKIPCT(osh, skb)
 #define	PKTCLRSKIPCT(osh, skb)
 #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_ */
diff --git a/drivers/staging/brcm80211/sys/wlc_ampdu.c b/drivers/staging/brcm80211/sys/wlc_ampdu.c
index f2acda7..c5ab4a4 100644
--- a/drivers/staging/brcm80211/sys/wlc_ampdu.c
+++ b/drivers/staging/brcm80211/sys/wlc_ampdu.c
@@ -145,23 +145,23 @@ static void scb_ampdu_update_config_all(ampdu_info_t *ampdu);
 
 #define wlc_ampdu_txflowcontrol(a, b, c)	do {} while (0)
 
 static void wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb,
 					  struct sk_buff *p, tx_status_t *txs,
 					  u32 frmtxstatus, u32 frmtxstatus2);
 
 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;
 }
 
 ampdu_info_t *wlc_ampdu_attach(wlc_info_t *wlc)
 {
 	ampdu_info_t *ampdu;
 	int i;
 
 	/* some code depends on packed structures */
 	ASSERT(DOT11_MAXNUMFRAGS == NBITS(u16));
@@ -467,23 +467,23 @@ static void wlc_ffpld_calc_mcs2ampdu_table(ampdu_info_t *ampdu, int f)
 			fifo->mcs2ampdu_table[i] = (u8) tmp;
 		}
 	}
 }
 
 static void BCMFASTPATH
 wlc_ampdu_agg(ampdu_info_t *ampdu, struct scb *scb, struct sk_buff *p,
 	      uint prec)
 {
 	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);
 
 	/* initialize initiator on first packet; sends addba req */
 	ini = SCB_AMPDU_INI(scb_ampdu, tid);
 	if (ini->magic != INI_MAGIC) {
 		ini = wlc_ampdu_init_tid_ini(ampdu, scb_ampdu, tid, false);
 	}
 	return;
 }
 
@@ -521,23 +521,23 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu,
 	wlc_fifo_info_t *f;
 	bool fbr_iscck;
 	struct ieee80211_tx_info *tx_info;
 	u16 qlen;
 
 	wlc = ampdu->wlc;
 	osh = wlc->osh;
 	p = *pdu;
 
 	ASSERT(p);
 
-	tid = (u8) PKTPRIO(p);
+	tid = (u8) (p->priority);
 	ASSERT(tid < AMPDU_MAX_SCB_TID);
 
 	f = ampdu->fifo_tb + prio2fifo[tid];
 
 	scb = wlc->pub->global_scb;
 	ASSERT(scb->magic == SCB_MAGIC);
 
 	scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb);
 	ASSERT(scb_ampdu);
 	ini = &scb_ampdu->ini[tid];
 
@@ -581,23 +581,23 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu,
 
 			/* error in the packet; reject it */
 			WL_AMPDU_ERR(("wl%d: wlc_sendampdu: prep_xdu rejected; seq 0x%x\n", wlc->pub->unit, seq));
 			WLCNTINCR(ampdu->cnt->sdurejected);
 
 			*pdu = NULL;
 			break;
 		}
 
 		/* 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;
 		index = TX_SEQ_TO_INDEX(seq);
 
 		/* check mcl fields and test whether it can be agg'd */
 		mcl = ltoh16(txh->MacTxControlLow);
 		mcl &= ~TXC_AMPDU_MASK;
 		fbr_iscck = !(ltoh16(txh->XtraFrameTypes) & 0x3);
 		ASSERT(!fbr_iscck);
 		txh->PreloadSize = 0;	/* always default to 0 */
@@ -736,23 +736,23 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu,
 			WL_NONE(("Stop taking from q, reached %d deep\n",
 				 scb_ampdu->max_pdu));
 			break;
 		}
 
 		/* check to see if the next pkt is a candidate for aggregation */
 		p = pktq_ppeek(&qi->q, prec);
 		tx_info = IEEE80211_SKB_CB(p);	/* tx_info must be checked with current p */
 
 		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;
 				plen = max(scb_ampdu->min_len, plen);
 
 				if ((plen + ampdu_len) > maxlen) {
 					p = NULL;
 					WL_ERROR(("%s: Bogus plen #1\n",
 						  __func__));
 					ASSERT(3 == 4);
 					continue;
@@ -770,41 +770,41 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, struct sk_buff **pdu,
 				p = NULL;
 			}
 		}
 	}			/* end while(p) */
 
 	ini->tx_in_transit += count;
 
 	if (count) {
 		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);
 		txh->MacTxControlLow = htol16(mcl);
 
 		/* remove the null delimiter after last mpdu */
 		ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM];
 		txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM] = 0;
 		ampdu_len -= ndelim * AMPDU_DELIMITER_LEN;
 
 		/* remove the pad len from last mpdu */
 		fbr_iscck = ((ltoh16(txh->XtraFrameTypes) & 0x3) == 0);
 		len = fbr_iscck ? WLC_GET_CCK_PLCP_LEN(txh->FragPLCPFallback)
 		    : WLC_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback);
 		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);
 		/* mark plcp to indicate ampdu */
 		WLC_SET_MIMO_PLCP_AMPDU(plcp);
 
 		/* reset the mixed mode header durations */
 		if (txh->MModeLen) {
 			u16 mmodelen =
 			    wlc_calc_lsig_len(wlc, rspec, ampdu_len);
 			txh->MModeLen = htol16(mmodelen);
@@ -893,23 +893,23 @@ wlc_ampdu_dotxstatus(ampdu_info_t *ampdu, struct scb *scb, struct sk_buff *p,
 	scb_ampdu_tid_ini_t *ini;
 	u32 s1 = 0, s2 = 0;
 	struct ieee80211_tx_info *tx_info;
 
 	tx_info = IEEE80211_SKB_CB(p);
 	ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
 	ASSERT(scb);
 	ASSERT(scb->magic == SCB_MAGIC);
 	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
 	 * So if the ACK was received then wait for the second level else just
 	 * call the first one
 	 */
 	if (txs->status & TX_STATUS_ACK_RCV) {
 		u8 status_delay = 0;
 
 		/* wait till the next 8 bytes of txstatus is available */
 		while (((s1 =
@@ -977,23 +977,23 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb,
 #ifdef BCMDBG
 	u8 hole[AMPDU_MAX_MPDU];
 	bzero(hole, sizeof(hole));
 #endif
 
 	ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
 	ASSERT(txs->status & TX_STATUS_AMPDU);
 
 	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];
 	rr_retry_limit = ampdu->rr_retry_limit_tid[tid];
 
 	ASSERT(ini->scb == scb);
 
 	bzero(bitmap, sizeof(bitmap));
 	queue = txs->frameid & TXFID_QUEUE_MASK;
 	ASSERT(queue < AC_COUNT);
 
@@ -1057,34 +1057,34 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb,
 					tx_error = true;
 				}
 			}
 		} else if (txs->phyerr) {
 			update_rate = false;
 			WLCNTINCR(wlc->pub->_cnt->txphyerr);
 			WL_ERROR(("wl%d: wlc_ampdu_dotxstatus: tx phy error (0x%x)\n", wlc->pub->unit, txs->phyerr));
 
 #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 */
 		}
 	}
 
 	/* loop through all pkts and retry if not acked */
 	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);
 		seq = ltoh16(h->seq) >> SEQNUM_SHIFT;
 
 		if (tot_mpdu == 0) {
 			mcs = plcp[0] & MIMO_PLCP_MCS_MASK;
 			mimoantsel = ltoh16(txh->ABI_MimoAntSel);
 		}
 
 		index = TX_SEQ_TO_INDEX(seq);
diff --git a/drivers/staging/brcm80211/sys/wlc_bmac.c b/drivers/staging/brcm80211/sys/wlc_bmac.c
index 2a2ad49..264389f 100644
--- a/drivers/staging/brcm80211/sys/wlc_bmac.c
+++ b/drivers/staging/brcm80211/sys/wlc_bmac.c
@@ -277,44 +277,44 @@ wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound)
 	uint bound_limit = bound ? wlc_hw->wlc->pub->tunables->rxbnd : -1;
 	u32 tsf_h, tsf_l;
 	wlc_d11rxhdr_t *wlc_rxhdr = NULL;
 
 	WL_TRACE(("wl%d: %s\n", wlc_hw->unit, __func__));
 	/* gather received frames */
 	while ((p = dma_rx(wlc_hw->di[fifo]))) {
 
 		if (!tail)
 			head = tail = p;
 		else {
-			PKTSETLINK(tail, p);
+			tail->prev = p;
 			tail = p;
 		}
 
 		/* !give others some time to run! */
 		if (++n >= bound_limit)
 			break;
 	}
 
 	/* get the TSF REG reading */
 	wlc_bmac_read_tsf(wlc_hw, &tsf_l, &tsf_h);
 
 	/* post more rbufs */
 	dma_rxfill(wlc_hw->di[fifo]);
 
 	/* 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 */
 		wlc_phy_rssi_compute(wlc_hw->band->pi, wlc_rxhdr);
 
 		wlc_recv(wlc_hw->wlc, p);
 	}
 
 	return n >= bound_limit;
 }
 
@@ -3319,23 +3319,23 @@ static bool wlc_bmac_txstatus_corerev4(wlc_hw_info_t *wlc_hw)
 	struct sk_buff *status_p;
 	tx_status_t *txs;
 	struct osl_info *osh;
 	bool fatal = false;
 
 	WL_TRACE(("wl%d: wlc_txstatusrecv\n", wlc_hw->unit));
 
 	osh = wlc_hw->osh;
 
 	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));
 
 		/* shift low bits for tx_status_t status compatibility */
 		txs->status = (txs->status & ~TXS_COMPAT_MASK)
 		    | (((txs->status & TXS_COMPAT_MASK) << TXS_COMPAT_SHIFT));
 
 		fatal = wlc_bmac_dotxstatus(wlc_hw, txs, 0);
 
 		PKTFREE(osh, status_p, false);
 	}
diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c
index d99fcb5..52e4d95 100644
--- a/drivers/staging/brcm80211/sys/wlc_mac80211.c
+++ b/drivers/staging/brcm80211/sys/wlc_mac80211.c
@@ -5034,25 +5034,25 @@ wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, struct sk_buff *pkt,
 			return false;
 		}
 
 		/* Evict packet according to discard policy */
 		p = discard_oldest ? pktq_pdeq(q, eprec) : pktq_pdeq_tail(q,
 									  eprec);
 		ASSERT(p != NULL);
 
 		/* 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));
 		}
 
 		ASSERT(0);
 		PKTFREE(wlc->osh, p, true);
 		WLCNTINCR(wlc->pub->_cnt->txnobuf);
 	}
 
 	/* Enqueue */
 	if (head)
 		p = pktq_penq_head(q, prec, pkt);
@@ -5063,23 +5063,23 @@ wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, struct sk_buff *pkt,
 	return true;
 }
 
 void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
 			     uint prec)
 {
 	wlc_info_t *wlc = (wlc_info_t *) ctx;
 	wlc_txq_info_t *qi = wlc->active_queue;	/* Check me */
 	struct pktq *q = &qi->q;
 	int prio;
 
-	prio = PKTPRIO(sdu);
+	prio = sdu->priority;
 
 	ASSERT(pktq_max(q) >= wlc->pub->tunables->datahiwat);
 
 	if (!wlc_prec_enq(wlc, q, sdu, prec)) {
 		if (!EDCF_ENAB(wlc->pub)
 		    || (wlc->pub->wlfeatureflag & WL_SWFL_FLOWCONTROL))
 			WL_ERROR(("wl%d: wlc_txq_enq: txq overflow\n",
 				  wlc->pub->unit));
 
 		/* ASSERT(9 == 8); *//* XXX we might hit this condtion in case packet flooding from mac80211 stack */
 		PKTFREE(wlc->osh, sdu, true);
@@ -5103,38 +5103,38 @@ void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
 	}
 }
 
 bool BCMFASTPATH
 wlc_sendpkt_mac80211(wlc_info_t *wlc, struct sk_buff *sdu,
 		     struct ieee80211_hw *hw)
 {
 	u8 prio;
 	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);
 
 	fc = ltoh16(d11_header->fc);
 	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;
 	if (unlikely
 	    (wlc_d11hdrs_mac80211(wlc, hw, pkt, scb, 0, 1, fifo, 0, NULL, 0)))
 		return -EINVAL;
 	wlc_txq_enq(wlc, scb, pkt, WLC_PRIO_TO_PREC(prio));
 	wlc_send_q(wlc, wlc->active_queue);
 
 	WLCNTINCR(wlc->pub->_cnt->ieee_tx);
 	return 0;
@@ -5228,23 +5228,23 @@ bcmc_fid_generate(wlc_info_t *wlc, wlc_bsscfg_t *bsscfg, d11txh_t *txh)
 	return frameid;
 }
 
 void BCMFASTPATH
 wlc_txfifo(wlc_info_t *wlc, uint fifo, struct sk_buff *p, bool commit,
 	   s8 txpktpend)
 {
 	u16 frameid = INVALIDFID;
 	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.
 	 */
 	if (fifo == TX_BCMC_FIFO) {
 		frameid = ltoh16(txh->TxFrameID);
 
 	}
 
 	if (WLC_WAR16165(wlc))
 		wlc_war16165(wlc, true);
@@ -5682,23 +5682,23 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw,
 	bool is_mcs[2];
 	u16 mimo_txbw;
 	u8 mimo_preamble_type;
 
 	frameid = 0;
 
 	ASSERT(queue < NFIFO);
 
 	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);
 
 	qos = (type == FC_TYPE_DATA && FC_SUBTYPE_ANY_QOS(FC_SUBTYPE(fc)));
 
 	/* compute length of frame in bytes for use in PLCP computations */
 	len = pkttotlen(osh, p);
 	phylen = len + DOT11_FCS_LEN;
 
 	/* If WEP enabled, add room in phylen for the additional bytes of
 	 * ICV which MAC generates.  We do NOT add the additional bytes to
@@ -5723,28 +5723,28 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw,
 	/* setup frameid */
 	if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
 		/* non-AP STA should never use BCMC queue */
 		ASSERT(queue != TX_BCMC_FIFO);
 		if (queue == TX_BCMC_FIFO) {
 			WL_ERROR(("wl%d: %s: ASSERT queue == TX_BCMC!\n",
 				  WLCWLUNIT(wlc), __func__));
 			frameid = bcmc_fid_generate(wlc, NULL, txh);
 		} 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) |
 			    (queue & TXFID_QUEUE_MASK);
 		}
 	}
 	frameid |= queue & TXFID_QUEUE_MASK;
 
 	/* set the ignpmq bit for all pkts tx'd in PS mode and for beacons */
 	if (SCB_PS(scb) || ((fc & FC_KIND_MASK) == FC_BEACON))
 		mcl |= TXC_IGNOREPMQ;
@@ -6551,23 +6551,23 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2)
 	}
 
 	p = GETNEXTTXP(wlc, queue);
 	if (WLC_WAR16165(wlc))
 		wlc_war16165(wlc, false);
 	if (p == NULL)
 		p = wlc_15420war(wlc, queue);
 	ASSERT(p != NULL);
 	if (p == NULL)
 		goto fatal;
 
-	txh = (d11txh_t *) PKTDATA(p);
+	txh = (d11txh_t *) (p->data);
 	mcl = ltoh16(txh->MacTxControlLow);
 
 	if (txs->phyerr) {
 		WL_ERROR(("phyerr 0x%x, rate 0x%x\n", txs->phyerr,
 			  txh->MainRates));
 		wlc_print_txdesc(txh);
 		wlc_print_txstatus(txs);
 	}
 
 	ASSERT(txs->frameid == htol16(txh->TxFrameID));
 	if (txs->frameid != htol16(txh->TxFrameID))
@@ -6641,24 +6641,24 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2)
 
 		if (txs->status & TX_STATUS_ACK_RCV)
 			tx_info->flags |= IEEE80211_TX_STAT_ACK;
 	}
 
 	totlen = pkttotlen(osh, p);
 	free_pdu = true;
 
 	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);
 		skb_pull(p, D11_TXH_LEN);
 		ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p);
 		WLCNTINCR(wlc->pub->_cnt->ieee_tx_status);
 	} else {
 		WL_ERROR(("%s: Not last frame => not calling tx_status\n",
 			  __func__));
 	}
 
@@ -6817,23 +6817,23 @@ prep_mac80211_status(wlc_info_t *wlc, d11rxhdr_t *rxh, struct sk_buff *p,
 	} else {
 		rx_status->band = IEEE80211_BAND_2GHZ;
 		rx_status->freq = wf_channel2mhz(channel, WF_CHAN_FACTOR_2_4_G);
 	}
 
 	rx_status->signal = wlc_rxh->rssi;	/* signal */
 
 	/* noise */
 	/* 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)) {
 		rx_status->rate_idx = rspec & RSPEC_RATE_MASK;
 		rx_status->flag |= RX_FLAG_HT;
 		if (RSPEC_IS40MHZ(rspec))
 			rx_status->flag |= RX_FLAG_40MHZ;
 	} else {
 		switch (RSPEC2RATE(rspec)) {
 		case WLC_RATE_1M:
 			rx_status->rate_idx = 0;
@@ -6912,28 +6912,28 @@ wlc_recvctl(wlc_info_t *wlc, struct osl_info *osh, d11rxhdr_t *rxh,
 #endif				/* BCMDBG */
 	/* Todo:
 	 * 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;
+	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));
 
 	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);
 	return;
 }
 
@@ -6972,43 +6972,43 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, struct sk_buff *p)
 	struct dot11_header *h;
 	struct osl_info *osh;
 	u16 fc;
 	uint len;
 	bool is_amsdu;
 
 	WL_TRACE(("wl%d: wlc_recv\n", wlc->pub->unit));
 
 	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);
 
 	/* fixup rx header endianness */
 	ltoh16_buf((void *)rxh, sizeof(d11rxhdr_t));
 
 	/* 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) {
 			WL_ERROR(("FCSERR while scanning******* - tossing\n"));
 			goto toss;
 		} else {
 			WL_ERROR(("RCSERR!!!\n"));
 			goto toss;
 		}
 	}
 
@@ -7796,23 +7796,23 @@ int wlc_prep_pdu(wlc_info_t *wlc, struct sk_buff *pdu, uint *fifop)
 {
 	struct osl_info *osh;
 	uint fifo;
 	d11txh_t *txh;
 	struct dot11_header *h;
 	struct scb *scb;
 	u16 fc;
 
 	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);
 	fc = ltoh16(h->fc);
 
 	/* get the pkt queue info. This was put at wlc_sendctl or wlc_send for PDU */
 	fifo = ltoh16(txh->TxFrameID) & TXFID_QUEUE_MASK;
 
 	scb = NULL;
 
 	*fifop = fifo;
diff --git a/drivers/staging/brcm80211/sys/wlc_pub.h b/drivers/staging/brcm80211/sys/wlc_pub.h
index b3ad4c0..ea796cb 100644
--- a/drivers/staging/brcm80211/sys/wlc_pub.h
+++ b/drivers/staging/brcm80211/sys/wlc_pub.h
@@ -432,23 +432,23 @@ struct wlc_if;
 #define AMPDU_ENAB(pub) ((pub)->_ampdu)
 
 #define EDCF_ENAB(pub) (WME_ENAB(pub))
 #define QOS_ENAB(pub) (WME_ENAB(pub) || N_ENAB(pub))
 
 #define MONITOR_ENAB(wlc)	((wlc)->monitor)
 
 #define PROMISC_ENAB(wlc)	((wlc)->promisc)
 
 #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[];
 #define WLC_PRIO_TO_PREC(pri)	wlc_prio2prec_map[(pri) & 7]
 
 /* This maps priority to one precedence higher - Used by PS-Poll response packets to
  * simulate enqueue-at-head operation, but still maintain the order on the queue
  */
 #define WLC_PRIO_TO_HI_PREC(pri)	min(WLC_PRIO_TO_PREC(pri) + 1, WLC_PREC_COUNT - 1)
 
 extern const u8 wme_fifo2ac[];
diff --git a/drivers/staging/brcm80211/util/bcmutils.c b/drivers/staging/brcm80211/util/bcmutils.c
index 701ea01..49c1f74 100644
--- a/drivers/staging/brcm80211/util/bcmutils.c
+++ b/drivers/staging/brcm80211/util/bcmutils.c
@@ -31,104 +31,104 @@
 #include <proto/ethernet.h>
 #include <proto/802.1d.h>
 #include <proto/802.11.h>
 
 /* copy a buffer into a pkt buffer chain */
 uint pktfrombuf(struct osl_info *osh, struct sk_buff *p, uint offset, int len,
 		unsigned char *buf)
 {
 	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;
 		offset = 0;
 	}
 
 	return ret;
 }
 /* return total length of buffer chain */
 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;
 }
 
 /*
  * osl multiple-precedence packet queue
  * hi_prec is always >= the number of the highest non-empty precedence
  */
 struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec,
 				      struct sk_buff *p)
 {
 	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));
 
 	q = &pq->q[prec];
 
 	if (q->head)
-		PKTSETLINK(q->tail, p);
+		q->tail->prev = p;
 	else
 		q->head = p;
 
 	q->tail = p;
 	q->len++;
 
 	pq->len++;
 
 	if (pq->hi_prec < prec)
 		pq->hi_prec = (u8) prec;
 
 	return p;
 }
 
 struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec,
 					   struct sk_buff *p)
 {
 	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));
 
 	q = &pq->q[prec];
 
 	if (q->head == NULL)
 		q->tail = p;
 
-	PKTSETLINK(p, q->head);
+	p->prev = q->head;
 	q->head = p;
 	q->len++;
 
 	pq->len++;
 
 	if (pq->hi_prec < prec)
 		pq->hi_prec = (u8) prec;
 
 	return p;
 }
 
@@ -137,75 +137,75 @@ struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec)
 	struct pktq_prec *q;
 	struct sk_buff *p;
 
 	ASSERT(prec >= 0 && prec < pq->num_prec);
 
 	q = &pq->q[prec];
 
 	p = q->head;
 	if (p == NULL)
 		return NULL;
 
-	q->head = PKTLINK(p);
+	q->head = p->prev;
 	if (q->head == NULL)
 		q->tail = NULL;
 
 	q->len--;
 
 	pq->len--;
 
-	PKTSETLINK(p, NULL);
+	p->prev = NULL;
 
 	return p;
 }
 
 struct sk_buff *BCMFASTPATH pktq_pdeq_tail(struct pktq *pq, int prec)
 {
 	struct pktq_prec *q;
 	struct sk_buff *p, *prev;
 
 	ASSERT(prec >= 0 && prec < pq->num_prec);
 
 	q = &pq->q[prec];
 
 	p = q->head;
 	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;
 
 	q->tail = prev;
 	q->len--;
 
 	pq->len--;
 
 	return p;
 }
 
 #ifdef BRCM_FULLMAC
 void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir)
 {
 	struct pktq_prec *q;
 	struct sk_buff *p;
 
 	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--;
 		p = q->head;
 	}
 	ASSERT(q->len == 0);
 	q->tail = NULL;
 }
 
 void pktq_flush(struct osl_info *osh, struct pktq *pq, bool dir)
 {
@@ -220,33 +220,33 @@ pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir,
 	    ifpkt_cb_t fn, int arg)
 {
 	struct pktq_prec *q;
 	struct sk_buff *p, *prev = NULL;
 
 	q = &pq->q[prec];
 	p = q->head;
 	while (p) {
 		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;
 		}
 	}
 
 	if (q->head == NULL) {
 		ASSERT(q->len == 0);
 		q->tail = NULL;
 	}
 }
 
 void pktq_flush(struct osl_info *osh, struct pktq *pq, bool dir,
 		ifpkt_cb_t fn, int arg)
@@ -323,34 +323,34 @@ struct sk_buff *BCMFASTPATH pktq_mdeq(struct pktq *pq, uint prec_bmp,
 
 	while ((prec_bmp & (1 << prec)) == 0 || pq->q[prec].head == NULL)
 		if (prec-- == 0)
 			return NULL;
 
 	q = &pq->q[prec];
 
 	p = q->head;
 	if (p == NULL)
 		return NULL;
 
-	q->head = PKTLINK(p);
+	q->head = p->prev;
 	if (q->head == NULL)
 		q->tail = NULL;
 
 	q->len--;
 
 	if (prec_out)
 		*prec_out = prec;
 
 	pq->len--;
 
-	PKTSETLINK(p, NULL);
+	p->prev = NULL;
 
 	return p;
 }
 
 /* parse a xx:xx:xx:xx:xx:xx format ethernet address */
 int bcm_ether_atoe(char *p, struct ether_addr *ea)
 {
 	int i = 0;
 
 	for (;;) {
 		ea->octet[i++] = (char)simple_strtoul(p, &p, 16);
@@ -409,24 +409,24 @@ int getintvar(char *vars, const char *name)
 }
 
 #if defined(BCMDBG)
 /* pretty hex print a pkt buffer chain */
 void prpkt(const char *msg, struct osl_info *osh, struct sk_buff *p0)
 {
 	struct sk_buff *p;
 
 	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) */
 
 static char bcm_undeferrstr[BCME_STRLEN];
 
 static const char *bcmerrorstrtable[] = BCMERRSTRINGTABLE;
 
 /* Convert the error codes into related error strings  */
 const char *bcmerrorstr(int bcmerror)
 {
 	/* check if someone added a bcmerror code but
diff --git a/drivers/staging/brcm80211/util/hnddma.c b/drivers/staging/brcm80211/util/hnddma.c
index 33d2c9a..c9dddcd 100644
--- a/drivers/staging/brcm80211/util/hnddma.c
+++ b/drivers/staging/brcm80211/util/hnddma.c
@@ -981,44 +981,44 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
 {
 	struct sk_buff *p, *head, *tail;
 	uint len;
 	uint pkt_len;
 	int resid = 0;
 
  next_frame:
 	head = _dma_getnextrxp(di, false);
 	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__) */
 
 	/* set actual length */
 	pkt_len = min((di->rxoffset + len), di->rxbufsize);
 	__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);
+			tail->next = p;
 			pkt_len = min(resid, (int)di->rxbufsize);
 			__skb_trim(p, pkt_len);
 
 			tail = p;
 			resid -= di->rxbufsize;
 		}
 
 #ifdef BCMDBG
 		if (resid > 0) {
 			uint cur;
 			ASSERT(p == NULL);
@@ -1107,28 +1107,28 @@ static bool BCMFASTPATH _dma_rxfill(dma_info_t *di)
 			}
 			di->hnddma.rxnobuf++;
 			break;
 		}
 		/* reserve an extra headroom, if applicable */
 		if (extra_offset)
 			skb_pull(p, extra_offset);
 
 		/* 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));
 
 		/* save the free packet pointer */
 		ASSERT(di->rxp[rxout] == NULL);
 		di->rxp[rxout] = p;
 
 		/* reset flags for each descriptor */
 		flags = 0;
 		if (DMA64_ENAB(di) && DMA64_MODE(di)) {
@@ -1665,28 +1665,28 @@ static int dma32_txfast(dma_info_t *di, struct sk_buff *p0, bool commit)
 
 	txout = di->txout;
 
 	/*
 	 * Walk the chain of packet buffers
 	 * allocating and initializing transmit descriptor entries.
 	 */
 	for (p = p0; p; p = next) {
 		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)
 			goto outoftxd;
 
 		if (len == 0)
 			continue;
 
 		if (DMASGLIST_ENAB)
 			bzero(&di->txp_dmah[txout], sizeof(hnddma_seg_map_t));
 
@@ -2315,28 +2315,28 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
 
 	txout = di->txout;
 
 	/*
 	 * Walk the chain of packet buffers
 	 * allocating and initializing transmit descriptor entries.
 	 */
 	for (p = p0; p; p = next) {
 		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)
 			goto outoftxd;
 
 		if (len == 0)
 			continue;
 
 		/* get physical address of buffer start */
 		if (DMASGLIST_ENAB)
 			bzero(&di->txp_dmah[txout], sizeof(hnddma_seg_map_t));
-- 
1.7.1





More information about the devel mailing list