Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106155357
D47500.id146228.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
11 KB
Referenced Files
None
Subscribers
None
D47500.id146228.diff
View Options
diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c
--- a/sys/dev/ath/if_ath_tx.c
+++ b/sys/dev/ath/if_ath_tx.c
@@ -1133,8 +1133,7 @@
* Calculate duration. This logically belongs in the 802.11
* layer but it lacks sufficient information to calculate it.
*/
- if ((flags & HAL_TXDESC_NOACK) == 0 &&
- (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL) {
+ if ((flags & HAL_TXDESC_NOACK) == 0 && !IEEE80211_IS_CTL(wh)) {
u_int16_t dur;
if (shortPreamble)
dur = rt->info[rix].spAckDuration;
@@ -2577,25 +2576,6 @@
* It's a dirty hack, but someone's gotta do it.
*/
-/*
- * XXX doesn't belong here!
- */
-static int
-ieee80211_is_action(struct ieee80211_frame *wh)
-{
- /* Type: Management frame? */
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) !=
- IEEE80211_FC0_TYPE_MGT)
- return 0;
-
- /* Subtype: Action frame? */
- if ((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) !=
- IEEE80211_FC0_SUBTYPE_ACTION)
- return 0;
-
- return 1;
-}
-
/*
* Return an alternate TID for ADDBA request frames.
*
@@ -2612,7 +2592,7 @@
uint16_t baparamset;
/* Not action frame? Bail */
- if (! ieee80211_is_action(wh))
+ if (! IEEE80211_IS_MGMT_ACTION(wh))
return 0;
/* XXX Not needed for frames we send? */
diff --git a/sys/dev/ipw/if_ipw.c b/sys/dev/ipw/if_ipw.c
--- a/sys/dev/ipw/if_ipw.c
+++ b/sys/dev/ipw/if_ipw.c
@@ -1119,7 +1119,7 @@
wh = mtod(m, struct ieee80211_frame *);
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_MGT)
+ if (!IEEE80211_IS_MGMT(wh))
return;
subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -4624,9 +4624,7 @@
IEEE80211_QOS_ACKPOLICY_NOACK)
flags |= IWN_TX_NEED_ACK;
}
- if ((wh->i_fc[0] &
- (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
- (IEEE80211_FC0_TYPE_CTL | IEEE80211_FC0_SUBTYPE_BAR))
+ if (IEEE80211_IS_CTL_BAR(wh))
flags |= IWN_TX_IMM_BA; /* Cannot happen yet. */
if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG)
diff --git a/sys/dev/malo/if_malo.c b/sys/dev/malo/if_malo.c
--- a/sys/dev/malo/if_malo.c
+++ b/sys/dev/malo/if_malo.c
@@ -94,13 +94,9 @@
MALO_DEBUG_FW = 0x00008000, /* firmware */
MALO_DEBUG_ANY = 0xffffffff
};
-#define IS_BEACON(wh) \
- ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK | \
- IEEE80211_FC0_SUBTYPE_MASK)) == \
- (IEEE80211_FC0_TYPE_MGT|IEEE80211_FC0_SUBTYPE_BEACON))
#define IFF_DUMPPKTS_RECV(sc, wh) \
(((sc->malo_debug & MALO_DEBUG_RECV) && \
- ((sc->malo_debug & MALO_DEBUG_RECV_ALL) || !IS_BEACON(wh))))
+ ((sc->malo_debug & MALO_DEBUG_RECV_ALL) || !IEEE80211_IS_MGMT_BEACON(wh))))
#define IFF_DUMPPKTS_XMIT(sc) \
(sc->malo_debug & MALO_DEBUG_XMIT)
#define DPRINTF(sc, m, fmt, ...) do { \
@@ -1025,8 +1021,6 @@
malo_tx_start(struct malo_softc *sc, struct ieee80211_node *ni,
struct malo_txbuf *bf, struct mbuf *m0)
{
-#define IS_DATA_FRAME(wh) \
- ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK)) == IEEE80211_FC0_TYPE_DATA)
int error, iswep;
int hdrlen, pktlen;
struct ieee80211_frame *wh;
@@ -1150,7 +1144,7 @@
ds->pktptr = htole32(bf->bf_segs[0].ds_addr);
ds->pktlen = htole16(bf->bf_segs[0].ds_len);
/* NB: pPhysNext setup once, don't touch */
- ds->datarate = IS_DATA_FRAME(wh) ? 1 : 0;
+ ds->datarate = IEEE80211_IS_DATA(wh) ? 1 : 0;
ds->sap_pktinfo = 0;
ds->format = 0;
@@ -1183,7 +1177,7 @@
#endif
MALO_TXQ_LOCK(txq);
- if (!IS_DATA_FRAME(wh))
+ if (!IEEE80211_IS_DATA(wh))
ds->status |= htole32(1);
ds->status |= htole32(MALO_TXD_STATUS_FW_OWNED);
STAILQ_INSERT_TAIL(&txq->active, bf, bf_list);
diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c
--- a/sys/dev/mwl/if_mwl.c
+++ b/sys/dev/mwl/if_mwl.c
@@ -226,12 +226,9 @@
MWL_DEBUG_AMPDU = 0x00004000, /* BA stream handling */
MWL_DEBUG_ANY = 0xffffffff
};
-#define IS_BEACON(wh) \
- ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK|IEEE80211_FC0_SUBTYPE_MASK)) == \
- (IEEE80211_FC0_TYPE_MGT|IEEE80211_FC0_SUBTYPE_BEACON))
#define IFF_DUMPPKTS_RECV(sc, wh) \
((sc->sc_debug & MWL_DEBUG_RECV) && \
- ((sc->sc_debug & MWL_DEBUG_RECV_ALL) || !IS_BEACON(wh)))
+ ((sc->sc_debug & MWL_DEBUG_RECV_ALL) || !IEEE80211_IS_MGMT_BEACON(wh)))
#define IFF_DUMPPKTS_XMIT(sc) \
(sc->sc_debug & MWL_DEBUG_XMIT)
@@ -2553,7 +2550,7 @@
{
const struct ieee80211_frame *wh = data;
- if ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) {
+ if (IEEE80211_IS_CTL(wh)) {
switch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) {
case IEEE80211_FC0_SUBTYPE_CTS:
case IEEE80211_FC0_SUBTYPE_ACK:
diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c
--- a/sys/dev/otus/if_otus.c
+++ b/sys/dev/otus/if_otus.c
@@ -1686,8 +1686,7 @@
* with invalid frame control values here. Just toss them
* rather than letting net80211 get angry and log.
*/
- if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) !=
- IEEE80211_FC0_VERSION_0) {
+ if (!IEEE80211_IS_FC0_CHECK_VER(wh, IEEE80211_FC0_VERSION_0)) {
OTUS_DPRINTF(sc, OTUS_DEBUG_RXDONE,
"%s: invalid 802.11 fc version (firmware bug?)\n",
__func__);
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c
--- a/sys/dev/ral/rt2560.c
+++ b/sys/dev/ral/rt2560.c
@@ -1558,10 +1558,7 @@
*(uint16_t *)wh->i_dur = htole16(dur);
/* tell hardware to add timestamp for probe responses */
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
- IEEE80211_FC0_TYPE_MGT &&
- (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
- IEEE80211_FC0_SUBTYPE_PROBE_RESP)
+ if (IEEE80211_IS_MGMT_PROBE_RESP(wh))
flags |= RT2560_TX_TIMESTAMP;
}
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -1326,9 +1326,7 @@
*(uint16_t *)wh->i_dur = htole16(dur);
/* tell hardware to add timestamp in probe responses */
- if ((wh->i_fc[0] &
- (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
- (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
+ if (IEEE80211_IS_MGMT_PROBE_RESP(wh))
flags |= RT2661_TX_TIMESTAMP;
}
diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c
--- a/sys/dev/ral/rt2860.c
+++ b/sys/dev/ral/rt2860.c
@@ -1559,9 +1559,7 @@
*(uint16_t *)wh->i_dur = htole16(dur);
}
/* ask MAC to insert timestamp into probe responses */
- if ((wh->i_fc[0] &
- (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
- (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
+ if (IEEE80211_IS_MGMT_PROBE_RESP(wh))
/* NOTE: beacons do not pass through tx_data() */
txwi->flags |= RT2860_TX_TS;
@@ -1802,9 +1800,7 @@
*(uint16_t *)wh->i_dur = htole16(dur);
}
/* ask MAC to insert timestamp into probe responses */
- if ((wh->i_fc[0] &
- (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
- (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
+ if (IEEE80211_IS_MGMT_PROBE_RESP(wh))
/* NOTE: beacons do not pass through tx_data() */
txwi->flags |= RT2860_TX_TS;
diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c
--- a/sys/dev/usb/wlan/if_rum.c
+++ b/sys/dev/usb/wlan/if_rum.c
@@ -1526,9 +1526,7 @@
USETW(wh->i_dur, dur);
/* tell hardware to add timestamp for probe responses */
- if (type == IEEE80211_FC0_TYPE_MGT &&
- (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
- IEEE80211_FC0_SUBTYPE_PROBE_RESP)
+ if (IEEE80211_IS_MGMT_PROBE_RESP(wh))
flags |= RT2573_TX_TIMESTAMP;
}
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c
--- a/sys/dev/usb/wlan/if_run.c
+++ b/sys/dev/usb/wlan/if_run.c
@@ -3595,9 +3595,7 @@
wh = mtod(m, struct ieee80211_frame *);
/* tell hardware to add timestamp for probe responses */
- if ((wh->i_fc[0] &
- (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
- (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
+ if (IEEE80211_IS_MGMT_PROBE_RESP(wh))
wflags |= RT2860_TX_TS;
else if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
xflags |= RT2860_TX_ACK;
diff --git a/sys/dev/usb/wlan/if_upgt.c b/sys/dev/usb/wlan/if_upgt.c
--- a/sys/dev/usb/wlan/if_upgt.c
+++ b/sys/dev/usb/wlan/if_upgt.c
@@ -2139,8 +2139,7 @@
mem->addr = htole32(data->addr);
txdesc = (struct upgt_lmac_tx_desc *)(mem + 1);
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
- IEEE80211_FC0_TYPE_MGT) {
+ if (IEEE80211_IS_MGMT(wh)) {
/* mgmt frames */
txdesc->header1.flags = UPGT_H1_FLAGS_TX_MGMT;
/* always send mgmt frames at lowest rate (DS1) */
diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c
--- a/sys/dev/usb/wlan/if_ural.c
+++ b/sys/dev/usb/wlan/if_ural.c
@@ -1097,10 +1097,7 @@
USETW(wh->i_dur, dur);
/* tell hardware to add timestamp for probe responses */
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
- IEEE80211_FC0_TYPE_MGT &&
- (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
- IEEE80211_FC0_SUBTYPE_PROBE_RESP)
+ if (IEEE80211_IS_MGMT_PROBE_RESP(wh))
flags |= RAL_TX_TIMESTAMP;
}
diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c
--- a/sys/dev/usb/wlan/if_urtw.c
+++ b/sys/dev/usb/wlan/if_urtw.c
@@ -1724,8 +1724,7 @@
ieee80211_radiotap_tx(vap, m0);
}
- if (type == IEEE80211_FC0_TYPE_MGT ||
- type == IEEE80211_FC0_TYPE_CTL ||
+ if (IEEE80211_IS_MGMT(wh) || IEEE80211_IS_CTL(wh) ||
(m0->m_flags & M_EAPOL) != 0) {
rate = tp->mgmtrate;
} else {
@@ -1803,9 +1802,7 @@
}
tx->flag = htole32(flags);
tx->txdur = txdur;
- if (type == IEEE80211_FC0_TYPE_MGT &&
- (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
- IEEE80211_FC0_SUBTYPE_PROBE_RESP)
+ if (IEEE80211_IS_MGMT_PROBE_RESP(wh))
tx->retry = 1;
else
tx->retry = URTW_TX_MAXRETRY;
diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c
--- a/sys/dev/usb/wlan/if_zyd.c
+++ b/sys/dev/usb/wlan/if_zyd.c
@@ -2505,9 +2505,7 @@
}
} else
desc->flags |= ZYD_TX_FLAG_MULTICAST;
- if ((wh->i_fc[0] &
- (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
- (IEEE80211_FC0_TYPE_CTL | IEEE80211_FC0_SUBTYPE_PS_POLL))
+ if (IEEE80211_IS_CTL_PS_POLL(wh))
desc->flags |= ZYD_TX_FLAG_TYPE(ZYD_TX_TYPE_PS_POLL);
/* actual transmit length (XXX why +10?) */
diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h
--- a/sys/net80211/ieee80211.h
+++ b/sys/net80211/ieee80211.h
@@ -219,6 +219,42 @@
(IEEE80211_IS_FC0_CHECK_VER_TYPE(wh, IEEE80211_FC0_VERSION_0, \
IEEE80211_FC0_TYPE_EXT))
+/* Management frame types */
+
+#define IEEE80211_IS_MGMT_BEACON(wh) \
+ (IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh, \
+ IEEE80211_FC0_VERSION_0, \
+ IEEE80211_FC0_TYPE_MGT, \
+ IEEE80211_FC0_SUBTYPE_BEACON))
+
+#define IEEE80211_IS_MGMT_PROBE_RESP(wh) \
+ (IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh, \
+ IEEE80211_FC0_VERSION_0, \
+ IEEE80211_FC0_TYPE_MGT, \
+ IEEE80211_FC0_SUBTYPE_PROBE_RESP))
+
+#define IEEE80211_IS_MGMT_ACTION(wh) \
+ (IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh, \
+ IEEE80211_FC0_VERSION_0, \
+ IEEE80211_FC0_TYPE_MGT, \
+ IEEE80211_FC0_SUBTYPE_ACTION))
+
+/* Control frame types */
+
+#define IEEE80211_IS_CTL_PS_POLL(wh) \
+ (IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh, \
+ IEEE80211_FC0_VERSION_0, \
+ IEEE80211_FC0_TYPE_CTL, \
+ IEEE80211_FC0_SUBTYPE_PS_POLL))
+
+#define IEEE80211_IS_CTL_BAR(wh) \
+ (IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh, \
+ IEEE80211_FC0_VERSION_0, \
+ IEEE80211_FC0_TYPE_CTL, \
+ IEEE80211_FC0_SUBTYPE_BAR))
+
+/* Data frame types */
+
#define IEEE80211_FC0_QOSDATA \
(IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS_DATA|IEEE80211_FC0_VERSION_0)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 7:30 AM (4 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15602751
Default Alt Text
D47500.id146228.diff (11 KB)
Attached To
Mode
D47500: net80211: migrate FC0_TYPE_MASK / FC0_SUBTYPE_MASK frame type checks to macros
Attached
Detach File
Event Timeline
Log In to Comment