Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c303ecbd authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman
Browse files

staging: brcm80211: replace PKTPUSH and PKTPULL macros with native skbuff calls



Replacing PKTPUSH by skb_push() call and PKTPULL by skb_pull() call to make
it obvious what the operation is doing with the packet.

Reviewed-by: default avatarHenry Ptasinski <henryp@broadcom.com>
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 26361116
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -321,7 +321,7 @@ void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, void *pktbuf)
#ifdef BDC
#ifdef BDC
	/* Push BDC header used to convey priority for buses that don't */
	/* Push BDC header used to convey priority for buses that don't */


	PKTPUSH(pktbuf, BDC_HEADER_LEN);
	skb_push(pktbuf, BDC_HEADER_LEN);


	h = (struct bdc_header *)PKTDATA(pktbuf);
	h = (struct bdc_header *)PKTDATA(pktbuf);


@@ -398,7 +398,7 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf)


	PKTSETPRIO(pktbuf, (h->priority & BDC_PRIORITY_MASK));
	PKTSETPRIO(pktbuf, (h->priority & BDC_PRIORITY_MASK));


	PKTPULL(pktbuf, BDC_HEADER_LEN);
	skb_pull(pktbuf, BDC_HEADER_LEN);
#endif				/* BDC */
#endif				/* BDC */


	return 0;
	return 0;
+13 −13
Original line number Original line Diff line number Diff line
@@ -365,7 +365,7 @@ extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable);
		ASSERT(datalign < (align));				\
		ASSERT(datalign < (align));				\
		ASSERT(PKTLEN((p)) >= ((len) + datalign));	\
		ASSERT(PKTLEN((p)) >= ((len) + datalign));	\
		if (datalign)						\
		if (datalign)						\
			PKTPULL((p), datalign);			\
			skb_pull((p), datalign);			\
		PKTSETLEN((p), (len));				\
		PKTSETLEN((p), (len));				\
	} while (0)
	} while (0)


@@ -953,7 +953,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
			ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0);
			ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0);
			pad = 0;
			pad = 0;
		} else {
		} else {
			PKTPUSH(pkt, pad);
			skb_push(pkt, pad);
			frame = (u8 *) PKTDATA(pkt);
			frame = (u8 *) PKTDATA(pkt);


			ASSERT((pad + SDPCM_HDRLEN) <= (int)PKTLEN(pkt));
			ASSERT((pad + SDPCM_HDRLEN) <= (int)PKTLEN(pkt));
@@ -1052,7 +1052,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)


done:
done:
	/* restore pkt buffer pointer before calling tx complete routine */
	/* restore pkt buffer pointer before calling tx complete routine */
	PKTPULL(pkt, SDPCM_HDRLEN + pad);
	skb_pull(pkt, SDPCM_HDRLEN + pad);
	dhd_os_sdunlock(bus->dhd);
	dhd_os_sdunlock(bus->dhd);
	dhd_txcomplete(bus->dhd, pkt, ret != 0);
	dhd_txcomplete(bus->dhd, pkt, ret != 0);
	dhd_os_sdlock(bus->dhd);
	dhd_os_sdlock(bus->dhd);
@@ -1078,7 +1078,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, void *pkt)
	/* Push the test header if doing loopback */
	/* Push the test header if doing loopback */
	if (bus->ext_loop) {
	if (bus->ext_loop) {
		u8 *data;
		u8 *data;
		PKTPUSH(pkt, SDPCM_TEST_HDRLEN);
		skb_push(pkt, SDPCM_TEST_HDRLEN);
		data = PKTDATA(pkt);
		data = PKTDATA(pkt);
		*data++ = SDPCM_TEST_ECHOREQ;
		*data++ = SDPCM_TEST_ECHOREQ;
		*data++ = (u8) bus->loopid++;
		*data++ = (u8) bus->loopid++;
@@ -1089,7 +1089,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, void *pkt)
#endif				/* SDTEST */
#endif				/* SDTEST */


	/* Add space for the header */
	/* Add space for the header */
	PKTPUSH(pkt, SDPCM_HDRLEN);
	skb_push(pkt, SDPCM_HDRLEN);
	ASSERT(IS_ALIGNED((unsigned long)PKTDATA(pkt), 2));
	ASSERT(IS_ALIGNED((unsigned long)PKTDATA(pkt), 2));


	prec = PRIO2PREC((PKTPRIO(pkt) & PRIOMASK));
	prec = PRIO2PREC((PKTPRIO(pkt) & PRIOMASK));
@@ -1107,7 +1107,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, void *pkt)
		/* Priority based enq */
		/* Priority based enq */
		dhd_os_sdlock_txq(bus->dhd);
		dhd_os_sdlock_txq(bus->dhd);
		if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) {
		if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) {
			PKTPULL(pkt, SDPCM_HDRLEN);
			skb_pull(pkt, SDPCM_HDRLEN);
			dhd_txcomplete(bus->dhd, pkt, false);
			dhd_txcomplete(bus->dhd, pkt, false);
			PKTFREE(osh, pkt, true);
			PKTFREE(osh, pkt, true);
			DHD_ERROR(("%s: out of bus->txq !!!\n", __func__));
			DHD_ERROR(("%s: out of bus->txq !!!\n", __func__));
@@ -3426,7 +3426,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
		bus->tx_max = txmax;
		bus->tx_max = txmax;


		/* Remove superframe header, remember offset */
		/* Remove superframe header, remember offset */
		PKTPULL(pfirst, doff);
		skb_pull(pfirst, doff);
		sfdoff = doff;
		sfdoff = doff;


		/* Validate all the subframe headers */
		/* Validate all the subframe headers */
@@ -3471,7 +3471,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
				 a couple retries */
				 a couple retries */
			if (bus->glomerr++ < 3) {
			if (bus->glomerr++ < 3) {
				/* Restore superframe header space */
				/* Restore superframe header space */
				PKTPUSH(pfirst, sfdoff);
				skb_push(pfirst, sfdoff);
				dhdsdio_rxfail(bus, true, true);
				dhdsdio_rxfail(bus, true, true);
			} else {
			} else {
				bus->glomerr = 0;
				bus->glomerr = 0;
@@ -3522,7 +3522,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
#endif
#endif


			PKTSETLEN(pfirst, sublen);
			PKTSETLEN(pfirst, sublen);
			PKTPULL(pfirst, doff);
			skb_pull(pfirst, doff);


			if (PKTLEN(pfirst) == 0) {
			if (PKTLEN(pfirst) == 0) {
				PKTFREE(bus->dhd->osh, pfirst, false);
				PKTFREE(bus->dhd->osh, pfirst, false);
@@ -4104,7 +4104,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)


		/* Leave room for what we already read, and align remainder */
		/* Leave room for what we already read, and align remainder */
		ASSERT(firstread < (PKTLEN(pkt)));
		ASSERT(firstread < (PKTLEN(pkt)));
		PKTPULL(pkt, firstread);
		skb_pull(pkt, firstread);
		PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN);
		PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN);


		/* Read the remaining frame data */
		/* Read the remaining frame data */
@@ -4132,7 +4132,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
		}
		}


		/* Copy the already-read portion */
		/* Copy the already-read portion */
		PKTPUSH(pkt, firstread);
		skb_push(pkt, firstread);
		bcopy(bus->rxhdr, PKTDATA(pkt), firstread);
		bcopy(bus->rxhdr, PKTDATA(pkt), firstread);


#ifdef DHD_DEBUG
#ifdef DHD_DEBUG
@@ -4153,7 +4153,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
#endif
#endif
				PKTSETLEN(pkt, len);
				PKTSETLEN(pkt, len);
				ASSERT(doff == SDPCM_HDRLEN);
				ASSERT(doff == SDPCM_HDRLEN);
				PKTPULL(pkt, SDPCM_HDRLEN);
				skb_pull(pkt, SDPCM_HDRLEN);
				bus->glomd = pkt;
				bus->glomd = pkt;
			} else {
			} else {
				DHD_ERROR(("%s: glom superframe w/o "
				DHD_ERROR(("%s: glom superframe w/o "
@@ -4165,7 +4165,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)


		/* Fill in packet len and prio, deliver upward */
		/* Fill in packet len and prio, deliver upward */
		PKTSETLEN(pkt, len);
		PKTSETLEN(pkt, len);
		PKTPULL(pkt, doff);
		skb_pull(pkt, doff);


#ifdef SDTEST
#ifdef SDTEST
		/* Test channel packets are processed separately */
		/* Test channel packets are processed separately */
+0 −2
Original line number Original line Diff line number Diff line
@@ -274,8 +274,6 @@ extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size,
#define	PKTSETNEXT(skb, x)	\
#define	PKTSETNEXT(skb, x)	\
	(((struct sk_buff *)(skb))->next = (struct sk_buff *)(x))
	(((struct sk_buff *)(skb))->next = (struct sk_buff *)(x))
#define	PKTSETLEN(skb, len)	__skb_trim((struct sk_buff *)(skb), (len))
#define	PKTSETLEN(skb, len)	__skb_trim((struct sk_buff *)(skb), (len))
#define	PKTPUSH(skb, bytes)	skb_push((struct sk_buff *)(skb), (bytes))
#define	PKTPULL(skb, bytes)	skb_pull((struct sk_buff *)(skb), (bytes))
#define PKTALLOCED(osh)		(((struct osl_pubinfo *)(osh))->pktalloced)
#define PKTALLOCED(osh)		(((struct osl_pubinfo *)(osh))->pktalloced)
#define PKTSETPOOL(osh, skb, x, y)	do {} while (0)
#define PKTSETPOOL(osh, skb, x, y)	do {} while (0)
#define PKTPOOL(osh, skb)		false
#define PKTPOOL(osh, skb)		false
+4 −4
Original line number Original line Diff line number Diff line
@@ -1187,8 +1187,8 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p,
				     status & TX_STATUS_FRM_RTX_MASK) >>
				     status & TX_STATUS_FRM_RTX_MASK) >>
				    TX_STATUS_FRM_RTX_SHIFT;
				    TX_STATUS_FRM_RTX_SHIFT;


				PKTPULL(p, D11_PHY_HDR_LEN);
				skb_pull(p, D11_PHY_HDR_LEN);
				PKTPULL(p, D11_TXH_LEN);
				skb_pull(p, D11_TXH_LEN);


				ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw,
				ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw,
							    p);
							    p);
@@ -1213,8 +1213,8 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p,
				ieee80211_tx_info_clear_status(tx_info);
				ieee80211_tx_info_clear_status(tx_info);
				tx_info->flags |=
				tx_info->flags |=
				    IEEE80211_TX_STAT_AMPDU_NO_BACK;
				    IEEE80211_TX_STAT_AMPDU_NO_BACK;
				PKTPULL(p, D11_PHY_HDR_LEN);
				skb_pull(p, D11_PHY_HDR_LEN);
				PKTPULL(p, D11_TXH_LEN);
				skb_pull(p, D11_TXH_LEN);
				WL_ERROR(("%s: BA Timeout, seq %d, in_transit %d\n", SHORTNAME, seq, ini->tx_in_transit));
				WL_ERROR(("%s: BA Timeout, seq %d, in_transit %d\n", SHORTNAME, seq, ini->tx_in_transit));
				ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw,
				ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw,
							    p);
							    p);
+7 −7
Original line number Original line Diff line number Diff line
@@ -5942,10 +5942,10 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw,
	ASSERT(tx_info);
	ASSERT(tx_info);


	/* add PLCP */
	/* add PLCP */
	plcp = PKTPUSH(p, D11_PHY_HDR_LEN);
	plcp = skb_push(p, D11_PHY_HDR_LEN);


	/* add Broadcom tx descriptor header */
	/* add Broadcom tx descriptor header */
	txh = (d11txh_t *) PKTPUSH(p, D11_TXH_LEN);
	txh = (d11txh_t *) skb_push(p, D11_TXH_LEN);
	bzero((char *)txh, D11_TXH_LEN);
	bzero((char *)txh, D11_TXH_LEN);


	/* setup frameid */
	/* setup frameid */
@@ -6890,8 +6890,8 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2)
		PKTSETLINK(p, NULL);
		PKTSETLINK(p, NULL);
		wlc->txretried = 0;
		wlc->txretried = 0;
		/* remove PLCP & Broadcom tx descriptor header */
		/* remove PLCP & Broadcom tx descriptor header */
		PKTPULL(p, D11_PHY_HDR_LEN);
		skb_pull(p, D11_PHY_HDR_LEN);
		PKTPULL(p, D11_TXH_LEN);
		skb_pull(p, D11_TXH_LEN);
		ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p);
		ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p);
		WLCNTINCR(wlc->pub->_cnt->ieee_tx_status);
		WLCNTINCR(wlc->pub->_cnt->ieee_tx_status);
	} else {
	} else {
@@ -7163,7 +7163,7 @@ wlc_recvctl(wlc_info_t *wlc, struct osl_info *osh, d11rxhdr_t *rxh, void *p)


	/* mac header+body length, exclude CRC and plcp header */
	/* mac header+body length, exclude CRC and plcp header */
	len_mpdu = PKTLEN(p) - D11_PHY_HDR_LEN - DOT11_FCS_LEN;
	len_mpdu = PKTLEN(p) - D11_PHY_HDR_LEN - DOT11_FCS_LEN;
	PKTPULL(p, D11_PHY_HDR_LEN);
	skb_pull(p, D11_PHY_HDR_LEN);
	PKTSETLEN(p, len_mpdu);
	PKTSETLEN(p, len_mpdu);


	ASSERT(!PKTNEXT(p));
	ASSERT(!PKTNEXT(p));
@@ -7225,7 +7225,7 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, void *p)
	rxh = (d11rxhdr_t *) PKTDATA(p);
	rxh = (d11rxhdr_t *) PKTDATA(p);


	/* strip off rxhdr */
	/* strip off rxhdr */
	PKTPULL(p, wlc->hwrxoff);
	skb_pull(p, wlc->hwrxoff);


	/* fixup rx header endianness */
	/* fixup rx header endianness */
	ltoh16_buf((void *)rxh, sizeof(d11rxhdr_t));
	ltoh16_buf((void *)rxh, sizeof(d11rxhdr_t));
@@ -7238,7 +7238,7 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, void *p)
				  wlc->pub->unit, PKTLEN(p)));
				  wlc->pub->unit, PKTLEN(p)));
			goto toss;
			goto toss;
		}
		}
		PKTPULL(p, 2);
		skb_pull(p, 2);
	}
	}


	h = (struct dot11_header *)(PKTDATA(p) + D11_PHY_HDR_LEN);
	h = (struct dot11_header *)(PKTDATA(p) + D11_PHY_HDR_LEN);
Loading