#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
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);
/* 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);
/* 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;
}
}
/* 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;
}
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;