[PATCH 1/2] staging: brcm80211: remove some more packet related macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



macros PKTHEADROOM and PKTTAILROOM have been replaced by native
skbuff functions and macros PKTALLOCED and PKTUNALLOC have been
removed.

Reviewed-by: Roland Vossen <rvossen@xxxxxxxxxxxx>
Reviewed-by: Brett Rudley <brudley@xxxxxxxxxxxx>
Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx>
---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |    8 ++++----
 drivers/staging/brcm80211/include/linux_osl.h |    7 ++-----
 drivers/staging/brcm80211/sys/wlc_mac80211.c  |    8 ++++----
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 1d06fb2..9e96c7e 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -924,25 +924,25 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
 
 	if (bus->dhd->dongle_reset) {
 		ret = BCME_NOTREADY;
 		goto done;
 	}
 
 	frame = (u8 *) (pkt->data);
 
 	/* Add alignment padding, allocate new packet if needed */
 	pad = ((unsigned long)frame % DHD_SDALIGN);
 	if (pad) {
-		if (PKTHEADROOM(pkt) < pad) {
+		if (skb_headroom(pkt) < pad) {
 			DHD_INFO(("%s: insufficient headroom %d for %d pad\n",
-				  __func__, (int)PKTHEADROOM(pkt), pad));
+				  __func__, skb_headroom(pkt), pad));
 			bus->dhd->tx_realloc++;
 			new = PKTGET(osh, (pkt->len + DHD_SDALIGN), true);
 			if (!new) {
 				DHD_ERROR(("%s: couldn't allocate new %d-byte "
 					"packet\n",
 					__func__, pkt->len + DHD_SDALIGN));
 				ret = BCME_NOMEM;
 				goto done;
 			}
 
 			PKTALIGN(osh, new, pkt->len, DHD_SDALIGN);
@@ -986,33 +986,33 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
 		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)) {
 		u16 pad = bus->blocksize - (len % bus->blocksize);
 		if ((pad <= bus->roundup) && (pad < bus->blocksize))
 #ifdef NOTUSED
-			if (pad <= PKTTAILROOM(pkt))
+			if (pad <= skb_tailroom(pkt))
 #endif				/* NOTUSED */
 				len += pad;
 	} else if (len % DHD_SDALIGN) {
 		len += DHD_SDALIGN - (len % DHD_SDALIGN);
 	}
 
 	/* Some controllers have trouble with odd bytes -- round to even */
 	if (forcealign && (len & (ALIGNMENT - 1))) {
 #ifdef NOTUSED
-		if (PKTTAILROOM(pkt))
+		if (skb_tailroom(pkt))
 #endif
 			len = roundup(len, ALIGNMENT);
 #ifdef NOTUSED
 		else
 			DHD_ERROR(("%s: sending unrounded %d-byte packet\n",
 				   __func__, len));
 #endif
 	}
 
 	do {
 		ret =
diff --git a/drivers/staging/brcm80211/include/linux_osl.h b/drivers/staging/brcm80211/include/linux_osl.h
index 4e44660..b973f3f 100644
--- a/drivers/staging/brcm80211/include/linux_osl.h
+++ b/drivers/staging/brcm80211/include/linux_osl.h
@@ -9,22 +9,23 @@
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
 #ifndef _linux_osl_h_
 #define _linux_osl_h_
 
+#include <linux/skbuff.h>
 
 extern struct osl_info *osl_attach(void *pdev, uint bustype);
 extern void osl_detach(struct osl_info *osh);
 
 extern u32 g_assert_type;
 
 #if defined(BCMDBG_ASSERT)
 #define ASSERT(exp) \
 	  do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
 extern void osl_assert(char *exp, char *file, int line);
 #else
@@ -240,25 +241,23 @@ extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size,
 #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 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)
 		osh->pktalloced++;
@@ -273,24 +272,22 @@ osl_pkt_tonative(struct osl_pubinfo *osh, void *pkt)
 {
 	struct sk_buff *nskb;
 
 	for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next)
 		osh->pktalloced--;
 
 	return (struct sk_buff *)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 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 */
 
 #endif				/* _linux_osl_h_ */
diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c
index 52e4d95..e61aa5a 100644
--- a/drivers/staging/brcm80211/sys/wlc_mac80211.c
+++ b/drivers/staging/brcm80211/sys/wlc_mac80211.c
@@ -2724,25 +2724,25 @@ uint wlc_down(wlc_info_t *wlc)
 	 * Just delivers the events synchronously instead of waiting for a timer
 	 */
 	callbacks += wlc_eventq_down(wlc->eventq);
 
 	callbacks += wlc_bmac_down_finish(wlc->hw);
 
 	/* wlc_bmac_down_finish has done wlc_coredisable(). so clk is off */
 	wlc->clk = false;
 
 
 	/* Verify all packets are flushed from the driver */
-	if (PKTALLOCED(wlc->osh) != 0) {
+	if (wlc->osh->pub.pktalloced != 0) {
 		WL_ERROR(("%d packets not freed at wlc_down!!!!!!\n",
-			  PKTALLOCED(wlc->osh)));
+			  wlc->osh->pub.pktalloced));
 	}
 #ifdef BCMDBG
 	/* Since all the packets should have been freed,
 	 * all callbacks should have been called
 	 */
 	for (i = 1; i <= wlc->pub->tunables->maxpktcb; i++)
 		ASSERT(wlc->pkt_callback[i].fn == NULL);
 #endif
 	wlc->going_down = false;
 	return callbacks;
 }
@@ -5115,23 +5115,23 @@ wlc_sendpkt_mac80211(wlc_info_t *wlc, struct sk_buff *sdu,
 	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 ? sdu->priority : MAXPRIO);
 	fifo = prio2fifo[prio];
 
-	ASSERT((uint) PKTHEADROOM(sdu) >= TXOFF);
+	ASSERT((uint) skb_headroom(sdu) >= TXOFF);
 	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);
@@ -6925,23 +6925,23 @@ wlc_recvctl(wlc_info_t *wlc, struct osl_info *osh, d11rxhdr_t *rxh,
 	__skb_trim(p, len_mpdu);
 
 	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);
+	osh->pub.pktalloced--;
 	return;
 }
 
 void wlc_bss_list_free(wlc_info_t *wlc, wlc_bss_list_t *bss_list)
 {
 	uint index;
 	wlc_bss_info_t *bi;
 
 	if (!bss_list) {
 		WL_ERROR(("%s: Attempting to free NULL list\n", __func__));
 		return;
-- 
1.7.1


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux