[PATCH 08/10] staging: brcm80211: cleaned up macros in 802.11.h

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

 



Code cleanup. Cleaned up 802.11 type and subtype related macros by using
Linux defines instead of Broadcom defined ones.

Reviewed-by: Arend van Spriel <arend@xxxxxxxxxxxx>
Signed-off-by: Roland Vossen <rvossen@xxxxxxxxxxxx>
---
 drivers/staging/brcm80211/include/proto/802.11.h |   35 ++++-----------------
 drivers/staging/brcm80211/sys/wlc_mac80211.c     |   22 ++++++++-----
 2 files changed, 20 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/brcm80211/include/proto/802.11.h b/drivers/staging/brcm80211/include/proto/802.11.h
index e559b2a..08aed61 100644
--- a/drivers/staging/brcm80211/include/proto/802.11.h
+++ b/drivers/staging/brcm80211/include/proto/802.11.h
@@ -124,41 +124,20 @@ typedef struct wme_param_ie wme_param_ie_t;
 #define DOT11_OPEN_SYSTEM	0
 #define DOT11_SHARED_KEY	1
 
-#define FC_TYPE_MASK		0xC
-#define FC_TYPE_SHIFT		2
-#define FC_SUBTYPE_MASK		0xF0
-#define FC_SUBTYPE_SHIFT	4
-
 #define SEQNUM_SHIFT		4
 #define SEQNUM_MAX		0x1000
 #define FRAGNUM_MASK		0xF
 
-#define FC_TYPE_MNG		0
-#define FC_TYPE_CTL		1
-#define FC_TYPE_DATA		2
-
-#define FC_SUBTYPE_PROBE_REQ		4
-#define FC_SUBTYPE_PROBE_RESP		5
-#define FC_SUBTYPE_BEACON		8
-#define FC_SUBTYPE_PS_POLL		10
-#define FC_SUBTYPE_RTS			11
-#define FC_SUBTYPE_CTS			12
-
-#define FC_SUBTYPE_ANY_QOS(s)		(((s) & 8) != 0)
+#define FC_SUBTYPE_ANY_QOS(s)	((((fc) & IEEE80211_FCTL_STYPE & (1<<7))) != 0)
 
 #define FC_KIND_MASK		(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)
 
-#define FC_KIND(t, s)	(((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))
-
-#define FC_SUBTYPE(fc)	(((fc) & IEEE80211_FCTL_STYPE) >> FC_SUBTYPE_SHIFT)
-#define FC_TYPE(fc)	(((fc) & IEEE80211_FCTL_FTYPE) >> FC_TYPE_SHIFT)
-
-#define FC_PROBE_REQ	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
-#define FC_PROBE_RESP	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
-#define FC_BEACON	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)
-#define FC_PS_POLL	FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)
-#define FC_RTS		FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)
-#define FC_CTS		FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)
+#define FC_PROBE_REQ	(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ)
+#define FC_PROBE_RESP	(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP)
+#define FC_BEACON	(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON)
+#define FC_PS_POLL	(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL)
+#define FC_RTS		(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS)
+#define FC_CTS		(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS)
 
 #define TLV_LEN_OFF		1
 #define TLV_HDR_LEN		2
diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c
index 0cc7967..e454c2e 100644
--- a/drivers/staging/brcm80211/sys/wlc_mac80211.c
+++ b/drivers/staging/brcm80211/sys/wlc_mac80211.c
@@ -5128,10 +5128,10 @@ wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu,
 	ASSERT(sdu);
 
 	fc = ltoh16(d11_header->frame_control);
-	type = FC_TYPE(fc);
+	type = (fc & IEEE80211_FCTL_FTYPE);
 
 	/* 802.11 standard requires management traffic to go at highest priority */
-	prio = (type == FC_TYPE_DATA ? sdu->priority : MAXPRIO);
+	prio = (type == IEEE80211_FTYPE_DATA ? sdu->priority : MAXPRIO);
 	fifo = prio2fifo[prio];
 
 	ASSERT((uint) skb_headroom(sdu) >= TXOFF);
@@ -5705,9 +5705,10 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
 	/* locate 802.11 MAC header */
 	h = (struct ieee80211_hdr *)(p->data);
 	fc = ltoh16(h->frame_control);
-	type = FC_TYPE(fc);
+	type = (fc & IEEE80211_FCTL_FTYPE);
 
-	qos = (type == FC_TYPE_DATA && FC_SUBTYPE_ANY_QOS(FC_SUBTYPE(fc)));
+	qos = (type == IEEE80211_FTYPE_DATA &&
+	       FC_SUBTYPE_ANY_QOS(fc));
 
 	/* compute length of frame in bytes for use in PLCP computations */
 	len = pkttotlen(osh, p);
@@ -7053,11 +7054,13 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
 	/* explicitly test bad src address to avoid sending bad deauth */
 	if (!is_amsdu) {
 		/* CTS and ACK CTL frames are w/o a2 */
-		if (FC_TYPE(fc) == FC_TYPE_DATA || FC_TYPE(fc) == FC_TYPE_MNG) {
+		if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA ||
+		    (fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) {
 			if ((is_zero_ether_addr(h->addr2) ||
 			     is_multicast_ether_addr(h->addr2))) {
-				WL_ERROR("wl%d: %s: dropping a frame with invalid src mac address, a2: %pM\n",
-					 wlc->pub->unit, __func__, &h->addr2);
+				WL_ERROR("wl%d: %s: dropping a frame with "
+					 "invalid src mac address, a2: %pM\n",
+					 wlc->pub->unit, __func__, h->addr2);
 				WLCNTINCR(wlc->pub->_cnt->rxbadsrcmac);
 				goto toss;
 			}
@@ -7066,7 +7069,7 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
 	}
 
 	/* due to sheer numbers, toss out probe reqs for now */
-	if (FC_TYPE(fc) == FC_TYPE_MNG) {
+	if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) {
 		if ((fc & FC_KIND_MASK) == FC_PROBE_REQ)
 			goto toss;
 	}
@@ -7858,7 +7861,8 @@ int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifop)
 		return BCME_BUSY;
 	}
 
-	if (FC_TYPE(ltoh16(txh->MacFrameControl)) != FC_TYPE_DATA)
+	if ((ltoh16(txh->MacFrameControl) & IEEE80211_FCTL_FTYPE) !=
+	    IEEE80211_FTYPE_DATA)
 		WLCNTINCR(wlc->pub->_cnt->txctl);
 
 	return 0;
-- 
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