net80211: fix -Wunused-but-set-variable warnings

Put the offending variables under the appropriate #ifdefs
(mostly IEEE80211_DEBUG, in one case IEEE80211_SUPPORT_SUPERG, and
in two cases under __notyet__ to revisit why these had been left
there but not used).

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
This commit is contained in:
Bjoern A. Zeeb 2021-11-24 17:36:48 +00:00
parent e052f72691
commit 05ea7a3e5e
6 changed files with 52 additions and 11 deletions

View File

@ -1009,7 +1009,6 @@ ahdemo_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
{
struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211com *ic = ni->ni_ic;
struct ieee80211_frame *wh;
/*
* Process management frames when scanning; useful for doing
@ -1018,7 +1017,11 @@ ahdemo_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
if (ic->ic_flags & IEEE80211_F_SCAN)
adhoc_recv_mgmt(ni, m0, subtype, rxs, rssi, nf);
else {
#ifdef IEEE80211_DEBUG
struct ieee80211_frame *wh;
wh = mtod(m0, struct ieee80211_frame *);
#endif
switch (subtype) {
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:

View File

@ -241,11 +241,8 @@ wep_decap(struct ieee80211_key *k, struct mbuf *m, int hdrlen)
{
struct wep_ctx *ctx = k->wk_private;
struct ieee80211vap *vap = ctx->wc_vap;
struct ieee80211_frame *wh;
const struct ieee80211_rx_stats *rxs;
wh = mtod(m, struct ieee80211_frame *);
rxs = ieee80211_get_rx_params_ptr(m);
if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))
@ -258,6 +255,11 @@ wep_decap(struct ieee80211_key *k, struct mbuf *m, int hdrlen)
*/
if ((k->wk_flags & IEEE80211_KEY_SWDECRYPT) &&
!wep_decrypt(k, m, hdrlen)) {
#ifdef IEEE80211_DEBUG
struct ieee80211_frame *wh;
wh = mtod(m, struct ieee80211_frame *);
#endif
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO, wh->i_addr2,
"%s", "WEP ICV mismatch on decrypt");
vap->iv_stats.is_rx_wepfail++;

View File

@ -997,7 +997,7 @@ hostap_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh,
{
struct ieee80211vap *vap = ni->ni_vap;
uint8_t *challenge;
int allocbs, estatus;
int estatus;
KASSERT(vap->iv_state == IEEE80211_S_RUN, ("state %d", vap->iv_state));
@ -1070,17 +1070,26 @@ hostap_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh,
}
switch (seq) {
case IEEE80211_AUTH_SHARED_REQUEST:
{
#ifdef IEEE80211_DEBUG
bool allocbs;
#endif
if (ni == vap->iv_bss) {
ni = ieee80211_dup_bss(vap, wh->i_addr2);
if (ni == NULL) {
/* NB: no way to return an error */
return;
}
#ifdef IEEE80211_DEBUG
allocbs = 1;
#endif
} else {
if ((ni->ni_flags & IEEE80211_NODE_AREF) == 0)
(void) ieee80211_ref_node(ni);
#ifdef IEEE80211_DEBUG
allocbs = 0;
#endif
}
/*
* Mark the node as referenced to reflect that it's
@ -1120,6 +1129,7 @@ hostap_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh,
return;
}
break;
}
case IEEE80211_AUTH_SHARED_RESPONSE:
if (ni == vap->iv_bss) {
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH,
@ -2299,7 +2309,9 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
case IEEE80211_FC0_SUBTYPE_DEAUTH:
case IEEE80211_FC0_SUBTYPE_DISASSOC: {
#ifdef IEEE80211_DEBUG
uint16_t reason;
#endif
if (vap->iv_state != IEEE80211_S_RUN ||
/* NB: can happen when in promiscuous mode */
@ -2312,7 +2324,9 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
* [2] reason
*/
IEEE80211_VERIFY_LENGTH(efrm - frm, 2, return);
#ifdef IEEE80211_DEBUG
reason = le16toh(*(uint16_t *)frm);
#endif
if (subtype == IEEE80211_FC0_SUBTYPE_DEAUTH) {
vap->iv_stats.is_rx_deauth++;
IEEE80211_NODE_STAT(ni, rx_deauth);

View File

@ -2351,7 +2351,7 @@ ieee80211_addba_response(struct ieee80211_node *ni,
int status, int baparamset, int batimeout)
{
struct ieee80211vap *vap = ni->ni_vap;
int bufsiz, tid;
int bufsiz;
/* XXX locking */
addba_stop_timeout(tap);
@ -2360,7 +2360,9 @@ ieee80211_addba_response(struct ieee80211_node *ni,
/* XXX override our request? */
tap->txa_wnd = (bufsiz == 0) ?
IEEE80211_AGGR_BAWMAX : min(bufsiz, IEEE80211_AGGR_BAWMAX);
#ifdef __notyet__
tid = _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_TID);
#endif
tap->txa_flags |= IEEE80211_AGGR_RUNNING;
tap->txa_attempts = 0;
/* TODO: this should be a vap flag */
@ -2486,16 +2488,20 @@ ht_recv_action_ba_addba_response(struct ieee80211_node *ni,
struct ieee80211_tx_ampdu *tap;
uint8_t dialogtoken, policy;
uint16_t baparamset, batimeout, code;
int tid, bufsiz;
int amsdu;
int tid;
#ifdef IEEE80211_DEBUG
int amsdu, bufsiz;
#endif
dialogtoken = frm[2];
code = le16dec(frm+3);
baparamset = le16dec(frm+5);
tid = _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_TID);
#ifdef IEEE80211_DEBUG
bufsiz = _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_BUFSIZ);
policy = _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_POLICY);
amsdu = !! _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_AMSDU);
#endif
policy = _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_POLICY);
batimeout = le16dec(frm+7);
tap = &ni->ni_tx_ampdu[tid];
@ -2563,11 +2569,16 @@ ht_recv_action_ba_delba(struct ieee80211_node *ni,
struct ieee80211com *ic = ni->ni_ic;
struct ieee80211_rx_ampdu *rap;
struct ieee80211_tx_ampdu *tap;
uint16_t baparamset, code;
uint16_t baparamset;
#ifdef IEEE80211_DEBUG
uint16_t code;
#endif
int tid;
baparamset = le16dec(frm+2);
#ifdef IEEE80211_DEBUG
code = le16dec(frm+4);
#endif
tid = _IEEE80211_MASKSHIFT(baparamset, IEEE80211_DELBAPS_TID);

View File

@ -126,10 +126,12 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, struct mbuf *m,
struct ifnet *ifp = vap->iv_ifp;
int mcast;
int do_ampdu = 0;
#ifdef IEEE80211_SUPPORT_SUPERG
int do_amsdu = 0;
int do_ampdu_amsdu = 0;
int no_ampdu = 1; /* Will be set to 0 if ampdu is active */
int do_ff = 0;
#endif
if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) &&
(m->m_flags & M_PWR_SAV) == 0) {
@ -187,12 +189,14 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, struct mbuf *m,
*/
do_ampdu = ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) &&
(vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX));
#ifdef IEEE80211_SUPPORT_SUPERG
do_amsdu = ((ni->ni_flags & IEEE80211_NODE_AMSDU_TX) &&
(vap->iv_flags_ht & IEEE80211_FHT_AMSDU_TX));
do_ff =
((ni->ni_flags & IEEE80211_NODE_HT) == 0) &&
((ni->ni_flags & IEEE80211_NODE_VHT) == 0) &&
(IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF));
#endif
/*
* Check if A-MPDU tx aggregation is setup or if we
@ -246,9 +250,11 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, struct mbuf *m,
* have also set or cleared the amsdu-in-ampdu txa_flags
* combination so we can correctly do A-MPDU + A-MSDU.
*/
#ifdef IEEE80211_SUPPORT_SUPERG
no_ampdu = (! IEEE80211_AMPDU_RUNNING(tap)
|| (IEEE80211_AMPDU_NACKED(tap)));
do_ampdu_amsdu = IEEE80211_AMPDU_RUNNING_AMSDU(tap);
#endif
}
}

View File

@ -1569,7 +1569,10 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype,
int ix = aid / NBBY;
int min = tim->tim_bitctl &~ 1;
int max = tim->tim_len + min - 4;
int tim_ucast = 0, tim_mcast = 0;
int tim_ucast = 0;
#ifdef __notyet__
int tim_mcast = 0;
#endif
/*
* Only do this for unicast traffic in the TIM
@ -1582,6 +1585,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype,
tim_ucast = 1;
}
#ifdef __notyet__
/*
* Do a separate notification
* for the multicast bit being set.
@ -1589,6 +1593,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype,
if (tim->tim_bitctl & 1) {
tim_mcast = 1;
}
#endif
/*
* If the TIM indicates there's traffic for