net80211: hide subtype mask & shift in function call.

Hide subtype mask/shift (which is used for index calculation
in ieee80211_mgt_subtype_name[] array) in function call.

Tested with RTL8188CUS, STA mode.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D5369
This commit is contained in:
Andriy Voskoboinyk 2016-04-20 21:15:55 +00:00
parent a9a25801e8
commit 4357a5d1ef
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298376
12 changed files with 33 additions and 38 deletions

View File

@ -613,8 +613,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m,
if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
ieee80211_mgt_subtype_name[subtype >>
IEEE80211_FC0_SUBTYPE_SHIFT],
ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif

View File

@ -831,8 +831,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m,
if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
ieee80211_mgt_subtype_name[subtype >>
IEEE80211_FC0_SUBTYPE_SHIFT],
ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif
@ -2184,8 +2183,7 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
}
IEEE80211_NOTE(vap, IEEE80211_MSG_AUTH, ni,
"recv %s (reason: %d (%s))",
ieee80211_mgt_subtype_name[subtype >>
IEEE80211_FC0_SUBTYPE_SHIFT],
ieee80211_mgt_subtype_name(subtype),
reason, ieee80211_reason_to_string(reason));
if (ni != vap->iv_bss)
ieee80211_node_leave(ni);

View File

@ -930,12 +930,8 @@ ieee80211_discard_frame(const struct ieee80211vap *vap,
if_printf(vap->iv_ifp, "[%s] discard ",
ether_sprintf(ieee80211_getbssid(vap, wh)));
if (type == NULL) {
printf("%s frame, ", ieee80211_mgt_subtype_name[
(wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) >>
IEEE80211_FC0_SUBTYPE_SHIFT]);
} else
printf("%s frame, ", type);
printf("%s frame, ", type != NULL ? type :
ieee80211_mgt_subtype_name(wh->i_fc[0]));
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);

View File

@ -62,8 +62,7 @@ void ieee80211_ssid_mismatch(struct ieee80211vap *, const char *tag,
memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) { \
if (ieee80211_msg_input(vap)) \
ieee80211_ssid_mismatch(vap, \
ieee80211_mgt_subtype_name[subtype >> \
IEEE80211_FC0_SUBTYPE_SHIFT], \
ieee80211_mgt_subtype_name(subtype), \
wh->i_addr2, _ssid); \
vap->iv_stats.is_rx_ssidmismatch++; \
_action; \

View File

@ -1793,8 +1793,7 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m,
(vap->iv_ic->ic_flags & IEEE80211_F_SCAN)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
ieee80211_mgt_subtype_name[subtype >>
IEEE80211_FC0_SUBTYPE_SHIFT],
ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif

View File

@ -804,9 +804,7 @@ ieee80211_mgmt_output(struct ieee80211_node *ni, struct mbuf *m, int type,
if (vap->iv_state == IEEE80211_S_CAC) {
IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT | IEEE80211_MSG_DOTH,
ni, "block %s frame in CAC state",
ieee80211_mgt_subtype_name[
(type & IEEE80211_FC0_SUBTYPE_MASK) >>
IEEE80211_FC0_SUBTYPE_SHIFT]);
ieee80211_mgt_subtype_name(type));
vap->iv_stats.is_tx_badstate++;
ieee80211_free_node(ni);
m_freem(m);
@ -841,9 +839,7 @@ ieee80211_mgmt_output(struct ieee80211_node *ni, struct mbuf *m, int type,
ieee80211_msg_dumppkts(vap)) {
printf("[%s] send %s on channel %u\n",
ether_sprintf(wh->i_addr1),
ieee80211_mgt_subtype_name[
(type & IEEE80211_FC0_SUBTYPE_MASK) >>
IEEE80211_FC0_SUBTYPE_SHIFT],
ieee80211_mgt_subtype_name(type),
ieee80211_chan2ieee(ic, ic->ic_curchan));
}
#endif

View File

@ -63,13 +63,13 @@ __FBSDID("$FreeBSD$");
#define AGGRESSIVE_MODE_SWITCH_HYSTERESIS 3 /* pkts / 100ms */
#define HIGH_PRI_SWITCH_THRESH 10 /* pkts / 100ms */
const char *ieee80211_mgt_subtype_name[] = {
const char *mgt_subtype_name[] = {
"assoc_req", "assoc_resp", "reassoc_req", "reassoc_resp",
"probe_req", "probe_resp", "timing_adv", "reserved#7",
"beacon", "atim", "disassoc", "auth",
"deauth", "action", "action_noack", "reserved#15"
};
const char *ieee80211_ctl_subtype_name[] = {
const char *ctl_subtype_name[] = {
"reserved#0", "reserved#1", "reserved#2", "reserved#3",
"reserved#4", "reserved#5", "reserved#6", "control_wrap",
"bar", "ba", "ps_poll", "rts",
@ -574,9 +574,7 @@ ieee80211_dump_pkt(struct ieee80211com *ic,
printf(" data");
break;
case IEEE80211_FC0_TYPE_MGT:
printf(" %s", ieee80211_mgt_subtype_name[
(wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK)
>> IEEE80211_FC0_SUBTYPE_SHIFT]);
printf(" %s", ieee80211_mgt_subtype_name(wh->i_fc[0]));
break;
default:
printf(" type#%d", wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK);

View File

@ -47,10 +47,25 @@ enum ieee80211_state {
#define IEEE80211_SEND_MGMT(_ni,_type,_arg) \
((*(_ni)->ni_ic->ic_send_mgmt)(_ni, _type, _arg))
extern const char *ieee80211_mgt_subtype_name[];
extern const char *mgt_subtype_name[];
extern const char *ctl_subtype_name[];
extern const char *ieee80211_phymode_name[IEEE80211_MODE_MAX];
extern const int ieee80211_opcap[IEEE80211_OPMODE_MAX];
static __inline const char *
ieee80211_mgt_subtype_name(uint8_t subtype)
{
return mgt_subtype_name[(subtype & IEEE80211_FC0_SUBTYPE_MASK) >>
IEEE80211_FC0_SUBTYPE_SHIFT];
}
static __inline const char *
ieee80211_ctl_subtype_name(uint8_t subtype)
{
return ctl_subtype_name[(subtype & IEEE80211_FC0_SUBTYPE_MASK) >>
IEEE80211_FC0_SUBTYPE_SHIFT];
}
const char *ieee80211_reason_to_string(uint16_t);
void ieee80211_proto_attach(struct ieee80211com *);

View File

@ -539,8 +539,7 @@ ieee80211_scan_dump_probe_beacon(uint8_t subtype, int isnew,
printf("[%s] %s%s on chan %u (bss chan %u) ",
ether_sprintf(mac), isnew ? "new " : "",
ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT],
sp->chan, sp->bchan);
ieee80211_mgt_subtype_name(subtype), sp->chan, sp->bchan);
ieee80211_print_essid(sp->ssid + 2, sp->ssid[1]);
printf(" rssi %d\n", rssi);

View File

@ -880,8 +880,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m,
if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
ieee80211_mgt_subtype_name[subtype >>
IEEE80211_FC0_SUBTYPE_SHIFT],
ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif
@ -892,8 +891,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m,
* should be encrypted, discard all others.
*/
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
wh, ieee80211_mgt_subtype_name[subtype >>
IEEE80211_FC0_SUBTYPE_SHIFT],
wh, ieee80211_mgt_subtype_name(subtype),
"%s", "WEP set but not permitted");
vap->iv_stats.is_rx_mgtdiscard++; /* XXX */
goto out;

View File

@ -343,8 +343,7 @@ tdma_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
*/
IEEE80211_DISCARD(vap,
IEEE80211_MSG_ELEMID | IEEE80211_MSG_INPUT,
wh, ieee80211_mgt_subtype_name[subtype >>
IEEE80211_FC0_SUBTYPE_SHIFT],
wh, ieee80211_mgt_subtype_name(subtype),
"%s", "no TDMA ie");
vap->iv_stats.is_rx_mgtdiscard++;
return;

View File

@ -693,8 +693,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m,
#ifdef IEEE80211_DEBUG
if (ieee80211_msg_debug(vap) || ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
ieee80211_mgt_subtype_name[subtype >>
IEEE80211_FC0_SUBTYPE_SHIFT],
ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif