svn commit: r299575 - head/sys/net80211

Andriy Voskoboinyk avos at freebsd.org
Fri May 13 10:02:22 UTC 2016


Fri, 13 May 2016 02:56:56 +0300 було написано Adrian Chadd  
<adrian.chadd at gmail.com>:

It works - but REFCNT_LOC macro is not used since r178354 (multi-vap  
support).

> Wait a sec, I thought the DEBUG_REFCNT stuff worked?
>
>
> -a
>
>
> On 12 May 2016 at 15:17, Andriy Voskoboinyk <avos at freebsd.org> wrote:
>> Author: avos
>> Date: Thu May 12 22:17:00 2016
>> New Revision: 299575
>> URL: https://svnweb.freebsd.org/changeset/base/299575
>>
>> Log:
>>   net80211: drop some unused variables / local macros
>>
>>   Most of them left after some commits (r178354, r191544, r287197 etc.);
>>   some were never used.
>>
>>   Found by:     Clang Static Analyzer
>>
>> Modified:
>>   head/sys/net80211/ieee80211_adhoc.c
>>   head/sys/net80211/ieee80211_hostap.c
>>   head/sys/net80211/ieee80211_hwmp.c
>>   head/sys/net80211/ieee80211_mesh.c
>>   head/sys/net80211/ieee80211_node.c
>>   head/sys/net80211/ieee80211_output.c
>>   head/sys/net80211/ieee80211_phy.c
>>   head/sys/net80211/ieee80211_scan_sw.c
>>   head/sys/net80211/ieee80211_sta.c
>>   head/sys/net80211/ieee80211_wds.c
>>
>> Modified: head/sys/net80211/ieee80211_adhoc.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_adhoc.c Thu May 12 22:13:12 2016         
>> (r299574)
>> +++ head/sys/net80211/ieee80211_adhoc.c Thu May 12 22:17:00 2016         
>> (r299575)
>> @@ -674,7 +674,7 @@ adhoc_recv_mgmt(struct ieee80211_node *n
>>         struct ieee80211com *ic = ni->ni_ic;
>>         struct ieee80211_channel *rxchan = ic->ic_curchan;
>>         struct ieee80211_frame *wh;
>> -       uint8_t *frm, *efrm, *sfrm;
>> +       uint8_t *frm, *efrm;
>>         uint8_t *ssid, *rates, *xrates;
>>  #if 0
>>         int ht_state_change = 0;
>> @@ -809,7 +809,6 @@ adhoc_recv_mgmt(struct ieee80211_node *n
>>                  *      [tlv] extended supported rates
>>                  */
>>                 ssid = rates = xrates = NULL;
>> -               sfrm = frm;
>>                 while (efrm - frm > 1) {
>>                         IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2,  
>> return);
>>                         switch (*frm) {
>>
>> Modified: head/sys/net80211/ieee80211_hostap.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_hostap.c        Thu May 12 22:13:12  
>> 2016        (r299574)
>> +++ head/sys/net80211/ieee80211_hostap.c        Thu May 12 22:17:00  
>> 2016        (r299575)
>> @@ -412,16 +412,8 @@ hostap_deliver_data(struct ieee80211vap
>>                                 ieee80211_free_node(sta);
>>                         }
>>                 }
>> -               if (mcopy != NULL) {
>> -                       int len, err;
>> -                       len = mcopy->m_pkthdr.len;
>> -                       err = ieee80211_vap_xmitpkt(vap, mcopy);
>> -                       if (err) {
>> -                               /* NB: IFQ_HANDOFF reclaims mcopy */
>> -                       } else {
>> -                               if_inc_counter(ifp, IFCOUNTER_OPACKETS,  
>> 1);
>> -                       }
>> -               }
>> +               if (mcopy != NULL && ieee80211_vap_xmitpkt(vap, mcopy)  
>> == 0)
>> +                       if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
>>         }
>>         if (m != NULL) {
>>                 /*
>> @@ -1798,7 +1790,6 @@ hostap_recv_mgmt(struct ieee80211_node *
>>                  *      [tlv] extended supported rates
>>                  */
>>                 ssid = rates = xrates = NULL;
>> -               sfrm = frm;
>>                 while (efrm - frm > 1) {
>>                         IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2,  
>> return);
>>                         switch (*frm) {
>>
>> Modified: head/sys/net80211/ieee80211_hwmp.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_hwmp.c  Thu May 12 22:13:12 2016         
>> (r299574)
>> +++ head/sys/net80211/ieee80211_hwmp.c  Thu May 12 22:17:00 2016         
>> (r299575)
>> @@ -128,7 +128,6 @@ typedef uint32_t ieee80211_hwmp_seq;
>>  #define        HWMP_SEQ_LEQ(a, b)      ((int32_t)((a)-(b)) <= 0)
>>  #define        HWMP_SEQ_EQ(a, b)       ((int32_t)((a)-(b)) == 0)
>>  #define        HWMP_SEQ_GT(a, b)       ((int32_t)((a)-(b)) > 0)
>> -#define        HWMP_SEQ_GEQ(a, b)      ((int32_t)((a)-(b)) >= 0)
>>
>>  #define HWMP_SEQ_MAX(a, b)     (a > b ? a : b)
>>
>> @@ -1526,7 +1525,6 @@ hwmp_peerdown(struct ieee80211_node *ni)
>>  #define        PERR_DADDR(n)           perr->perr_dests[n].dest_addr
>>  #define        PERR_DSEQ(n)            perr->perr_dests[n].dest_seq
>>  #define        PERR_DEXTADDR(n)         
>> perr->perr_dests[n].dest_ext_addr
>> -#define        PERR_DRCODE(n)          perr->perr_dests[n].dest_rcode
>>  static void
>>  hwmp_recv_perr(struct ieee80211vap *vap, struct ieee80211_node *ni,
>>      const struct ieee80211_frame *wh, const struct  
>> ieee80211_meshperr_ie *perr)
>> @@ -1628,7 +1626,6 @@ done:
>>  #undef PERR_DADDR
>>  #undef PERR_DSEQ
>>  #undef PERR_DEXTADDR
>> -#undef PERR_DRCODE
>>
>>  static int
>>  hwmp_send_perr(struct ieee80211vap *vap,
>> @@ -1737,7 +1734,6 @@ hwmp_recv_rann(struct ieee80211vap *vap,
>>         struct ieee80211_hwmp_route *hr;
>>         struct ieee80211_meshpreq_ie preq;
>>         struct ieee80211_meshrann_ie prann;
>> -       uint32_t metric = 0;
>>
>>         if (IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr))
>>                 return;
>> @@ -1766,7 +1762,6 @@ hwmp_recv_rann(struct ieee80211vap *vap,
>>         /* RANN ACCEPTED */
>>
>>         ieee80211_hwmp_rannint = rann->rann_interval; /* XXX: mtx lock?  
>> */
>> -       metric = rann->rann_metric + ms->ms_pmetric->mpm_metric(ni);
>>
>>         if (rt == NULL) {
>>                 rt = ieee80211_mesh_rt_add(vap, rann->rann_addr);
>>
>> Modified: head/sys/net80211/ieee80211_mesh.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_mesh.c  Thu May 12 22:13:12 2016         
>> (r299574)
>> +++ head/sys/net80211/ieee80211_mesh.c  Thu May 12 22:17:00 2016         
>> (r299575)
>> @@ -1526,7 +1526,6 @@ mesh_input(struct ieee80211_node *ni, st
>>  {
>>  #define        HAS_SEQ(type)   ((type & 0x4) == 0)
>>  #define        MC01(mc)        ((const struct ieee80211_meshcntl_ae01  
>> *)mc)
>> -#define        MC10(mc)        ((const struct ieee80211_meshcntl_ae10  
>> *)mc)
>>         struct ieee80211vap *vap = ni->ni_vap;
>>         struct ieee80211com *ic = ni->ni_ic;
>>         struct ifnet *ifp = vap->iv_ifp;
>> @@ -1826,7 +1825,6 @@ out:
>>         return type;
>>  #undef HAS_SEQ
>>  #undef MC01
>> -#undef MC10
>>  }
>>
>>  static void
>> @@ -1981,7 +1979,6 @@ mesh_recv_mgmt(struct ieee80211_node *ni
>>         case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
>>         {
>>                 uint8_t *ssid, *meshid, *rates, *xrates;
>> -               uint8_t *sfrm;
>>
>>                 if (vap->iv_state != IEEE80211_S_RUN) {
>>                         IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
>> @@ -2005,7 +2002,6 @@ mesh_recv_mgmt(struct ieee80211_node *ni
>>                  *      [tlv] mesh id
>>                  */
>>                 ssid = meshid = rates = xrates = NULL;
>> -               sfrm = frm;
>>                 while (efrm - frm > 1) {
>>                         IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2,  
>> return);
>>                         switch (*frm) {
>> @@ -2116,10 +2112,10 @@ mesh_parse_meshpeering_action(struct iee
>>         struct ieee80211vap *vap = ni->ni_vap;
>>         const struct ieee80211_meshpeer_ie *mpie;
>>         uint16_t args[3];
>> -       const uint8_t *meshid, *meshconf, *meshpeer;
>> +       const uint8_t *meshid, *meshconf;
>>         uint8_t sendclose = 0; /* 1 = MPM frame rejected, close will be  
>> sent */
>>
>> -       meshid = meshconf = meshpeer = NULL;
>> +       meshid = meshconf = NULL;
>>         while (efrm - frm > 1) {
>>                 IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return  
>> NULL);
>>                 switch (*frm) {
>> @@ -2130,7 +2126,6 @@ mesh_parse_meshpeering_action(struct iee
>>                         meshconf = frm;
>>                         break;
>>                 case IEEE80211_ELEMID_MESHPEER:
>> -                       meshpeer = frm;
>>                         mpie = (const struct ieee80211_meshpeer_ie *)  
>> frm;
>>                         memset(mp, 0, sizeof(*mp));
>>                         mp->peer_len = mpie->peer_len;
>> @@ -2660,7 +2655,6 @@ mesh_send_action(struct ieee80211_node *
>>         struct ieee80211vap *vap = ni->ni_vap;
>>         struct ieee80211com *ic = ni->ni_ic;
>>         struct ieee80211_bpf_params params;
>> -       struct ieee80211_frame *wh;
>>         int ret;
>>
>>         KASSERT(ni != NULL, ("null node"));
>> @@ -2681,7 +2675,6 @@ mesh_send_action(struct ieee80211_node *
>>         }
>>
>>         IEEE80211_TX_LOCK(ic);
>> -       wh = mtod(m, struct ieee80211_frame *);
>>         ieee80211_send_setup(ni, m,
>>              IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_ACTION,
>>              IEEE80211_NONQOS_TID, sa, da, sa);
>>
>> Modified: head/sys/net80211/ieee80211_node.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_node.c  Thu May 12 22:13:12 2016         
>> (r299574)
>> +++ head/sys/net80211/ieee80211_node.c  Thu May 12 22:17:00 2016         
>> (r299575)
>> @@ -73,12 +73,6 @@ CTASSERT((IEEE80211_NODE_HASHSIZE & (IEE
>>  #define        IEEE80211_AID_ISSET(_vap, b) \
>>         ((_vap)->iv_aid_bitmap[IEEE80211_AID(b) / 32] & (1 <<  
>> (IEEE80211_AID(b) % 32)))
>>
>> -#ifdef IEEE80211_DEBUG_REFCNT
>> -#define REFCNT_LOC "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func,  
>> line
>> -#else
>> -#define REFCNT_LOC "%s %p<%s> refcnt %d\n", __func__
>> -#endif
>> -
>>  static int ieee80211_sta_join1(struct ieee80211_node *);
>>
>>  static struct ieee80211_node *node_alloc(struct ieee80211vap *,
>>
>> Modified: head/sys/net80211/ieee80211_output.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_output.c        Thu May 12 22:13:12  
>> 2016        (r299574)
>> +++ head/sys/net80211/ieee80211_output.c        Thu May 12 22:17:00  
>> 2016        (r299575)
>> @@ -121,7 +121,6 @@ ieee80211_vap_pkt_send_dest(struct ieee8
>>  {
>>         struct ieee80211com *ic = vap->iv_ic;
>>         struct ifnet *ifp = vap->iv_ifp;
>> -       int len, mcast;
>>
>>         if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) &&
>>             (m->m_flags & M_PWR_SAV) == 0) {
>> @@ -161,8 +160,6 @@ ieee80211_vap_pkt_send_dest(struct ieee8
>>          * interface it (might have been) received on.
>>          */
>>         m->m_pkthdr.rcvif = (void *)ni;
>> -       mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1: 0;
>> -       len = m->m_pkthdr.len;
>>
>>         BPF_MTAP(ifp, m);               /* 802.3 tx */
>>
>> @@ -2082,7 +2079,6 @@ ieee80211_send_probereq(struct ieee80211
>>         struct ieee80211com *ic = ni->ni_ic;
>>         const struct ieee80211_txparam *tp;
>>         struct ieee80211_bpf_params params;
>> -       struct ieee80211_frame *wh;
>>         const struct ieee80211_rateset *rs;
>>         struct mbuf *m;
>>         uint8_t *frm;
>> @@ -2152,7 +2148,6 @@ ieee80211_send_probereq(struct ieee80211
>>         }
>>
>>         IEEE80211_TX_LOCK(ic);
>> -       wh = mtod(m, struct ieee80211_frame *);
>>         ieee80211_send_setup(ni, m,
>>              IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_REQ,
>>              IEEE80211_NONQOS_TID, sa, da, bssid);
>> @@ -2749,7 +2744,6 @@ ieee80211_send_proberesp(struct ieee8021
>>  {
>>         struct ieee80211_node *bss = vap->iv_bss;
>>         struct ieee80211com *ic = vap->iv_ic;
>> -       struct ieee80211_frame *wh;
>>         struct mbuf *m;
>>         int ret;
>>
>> @@ -2781,7 +2775,6 @@ ieee80211_send_proberesp(struct ieee8021
>>         KASSERT(m != NULL, ("no room for header"));
>>
>>         IEEE80211_TX_LOCK(ic);
>> -       wh = mtod(m, struct ieee80211_frame *);
>>         ieee80211_send_setup(bss, m,
>>              IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP,
>>              IEEE80211_NONQOS_TID, vap->iv_myaddr, da, bss->ni_bssid);
>>
>> Modified: head/sys/net80211/ieee80211_phy.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_phy.c   Thu May 12 22:13:12 2016         
>> (r299574)
>> +++ head/sys/net80211/ieee80211_phy.c   Thu May 12 22:17:00 2016         
>> (r299575)
>> @@ -590,10 +590,6 @@ static const uint16_t ht40_bps[32] = {
>>  #define        HT_STF          4
>>  #define        HT_LTF(n)       ((n) * 4)
>>
>> -#define        HT_RC_2_MCS(_rc)        ((_rc) & 0x1f)
>> -#define        HT_RC_2_STREAMS(_rc)    ((((_rc) & 0x78) >> 3) + 1)
>> -#define        IS_HT_RATE(_rc)         ( (_rc) & IEEE80211_RATE_MCS)
>> -
>>  /*
>>   * Calculate the transmit duration of an 11n frame.
>>   */
>> @@ -620,9 +616,6 @@ ieee80211_compute_duration_ht(uint32_t f
>>             HT_L_SIG + HT_SIG + HT_STF + HT_LTF(streams);
>>  }
>>
>> -#undef IS_HT_RATE
>> -#undef HT_RC_2_STREAMS
>> -#undef HT_RC_2_MCS
>>  #undef HT_LTF
>>  #undef HT_STF
>>  #undef HT_SIG
>>
>> Modified: head/sys/net80211/ieee80211_scan_sw.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_scan_sw.c       Thu May 12 22:13:12  
>> 2016        (r299574)
>> +++ head/sys/net80211/ieee80211_scan_sw.c       Thu May 12 22:17:00  
>> 2016        (r299575)
>> @@ -80,23 +80,6 @@ struct scan_state {
>>   */
>>  #define        IEEE80211_SCAN_OFFCHANNEL       msecs_to_ticks(150)
>>
>> -/*
>> - * Roaming-related defaults.  RSSI thresholds are as returned by the
>> - * driver (.5dBm).  Transmit rate thresholds are IEEE rate codes (i.e
>> - * .5M units) or MCS.
>> - */
>> -/* rssi thresholds */
>> -#define        ROAM_RSSI_11A_DEFAULT           14      /* 11a bss */
>> -#define        ROAM_RSSI_11B_DEFAULT           14      /* 11b bss */
>> -#define        ROAM_RSSI_11BONLY_DEFAULT       14      /* 11b-only bss  
>> */
>> -/* transmit rate thresholds */
>> -#define        ROAM_RATE_11A_DEFAULT           2*12    /* 11a bss */
>> -#define        ROAM_RATE_11B_DEFAULT           2*5     /* 11b bss */
>> -#define        ROAM_RATE_11BONLY_DEFAULT       2*1     /* 11b-only bss  
>> */
>> -#define        ROAM_RATE_HALF_DEFAULT          2*6     /* half-width  
>> 11a/g bss */
>> -#define        ROAM_RATE_QUARTER_DEFAULT       2*3     /*  
>> quarter-width 11a/g bss */
>> -#define        ROAM_MCS_11N_DEFAULT            (1 |  
>> IEEE80211_RATE_MCS) /* 11n bss */
>> -
>>  static void scan_curchan(struct ieee80211_scan_state *, unsigned long);
>>  static void scan_mindwell(struct ieee80211_scan_state *);
>>  static void scan_signal(struct ieee80211_scan_state *, int);
>>
>> Modified: head/sys/net80211/ieee80211_sta.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_sta.c   Thu May 12 22:13:12 2016         
>> (r299574)
>> +++ head/sys/net80211/ieee80211_sta.c   Thu May 12 22:17:00 2016         
>> (r299575)
>> @@ -976,7 +976,6 @@ sta_auth_shared(struct ieee80211_node *n
>>  {
>>         struct ieee80211vap *vap = ni->ni_vap;
>>         uint8_t *challenge;
>> -       int estatus;
>>
>>         /*
>>          * NB: this can happen as we allow pre-shared key
>> @@ -990,7 +989,6 @@ sta_auth_shared(struct ieee80211_node *n
>>                 IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH,
>>                     ni->ni_macaddr, "shared key auth",
>>                     "%s", " PRIVACY is disabled");
>> -               estatus = IEEE80211_STATUS_ALG;
>>                 goto bad;
>>         }
>>         /*
>> @@ -1004,7 +1002,6 @@ sta_auth_shared(struct ieee80211_node *n
>>                     ni->ni_macaddr, "shared key auth",
>>                     "bad sta auth mode %u", ni->ni_authmode);
>>                 vap->iv_stats.is_rx_bad_auth++; /* XXX maybe a unique  
>> error? */
>> -               estatus = IEEE80211_STATUS_ALG;
>>                 goto bad;
>>         }
>>
>> @@ -1016,7 +1013,6 @@ sta_auth_shared(struct ieee80211_node *n
>>                             "ie %d/%d too long",
>>                             frm[0], (frm[1] + 2) - (efrm - frm));
>>                         vap->iv_stats.is_rx_bad_auth++;
>> -                       estatus = IEEE80211_STATUS_CHALLENGE;
>>                         goto bad;
>>                 }
>>                 if (*frm == IEEE80211_ELEMID_CHALLENGE)
>> @@ -1031,7 +1027,6 @@ sta_auth_shared(struct ieee80211_node *n
>>                             ni->ni_macaddr, "shared key auth",
>>                             "%s", "no challenge");
>>                         vap->iv_stats.is_rx_bad_auth++;
>> -                       estatus = IEEE80211_STATUS_CHALLENGE;
>>                         goto bad;
>>                 }
>>                 if (challenge[1] != IEEE80211_CHALLENGE_LEN) {
>> @@ -1039,7 +1034,6 @@ sta_auth_shared(struct ieee80211_node *n
>>                             ni->ni_macaddr, "shared key auth",
>>                             "bad challenge len %d", challenge[1]);
>>                         vap->iv_stats.is_rx_bad_auth++;
>> -                       estatus = IEEE80211_STATUS_CHALLENGE;
>>                         goto bad;
>>                 }
>>         default:
>> @@ -1281,7 +1275,6 @@ sta_recv_mgmt(struct ieee80211_node *ni,
>>      const struct ieee80211_rx_stats *rxs,
>>      int rssi, int nf)
>>  {
>> -#define        ISPROBE(_st)    ((_st) ==  
>> IEEE80211_FC0_SUBTYPE_PROBE_RESP)
>>  #define        ISREASSOC(_st)  ((_st) ==  
>> IEEE80211_FC0_SUBTYPE_REASSOC_RESP)
>>         struct ieee80211vap *vap = ni->ni_vap;
>>         struct ieee80211com *ic = ni->ni_ic;
>> @@ -1861,7 +1854,6 @@ sta_recv_mgmt(struct ieee80211_node *ni,
>>                 break;
>>         }
>>  #undef ISREASSOC
>> -#undef ISPROBE
>>  }
>>
>>  static void
>>
>> Modified: head/sys/net80211/ieee80211_wds.c
>> ==============================================================================
>> --- head/sys/net80211/ieee80211_wds.c   Thu May 12 22:13:12 2016         
>> (r299574)
>> +++ head/sys/net80211/ieee80211_wds.c   Thu May 12 22:17:00 2016         
>> (r299575)
>> @@ -344,7 +344,6 @@ static int
>>  wds_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate,  
>> int arg)
>>  {
>>         struct ieee80211com *ic = vap->iv_ic;
>> -       struct ieee80211_node *ni;
>>         enum ieee80211_state ostate;
>>         int error;
>>
>> @@ -357,7 +356,6 @@ wds_newstate(struct ieee80211vap *vap, e
>>         callout_stop(&vap->iv_mgtsend);         /* XXX callout_drain */
>>         if (ostate != IEEE80211_S_SCAN)
>>                 ieee80211_cancel_scan(vap);     /* background scan */
>> -       ni = vap->iv_bss;                       /* NB: no reference  
>> held */
>>         error = 0;
>>         switch (nstate) {
>>         case IEEE80211_S_INIT:


More information about the svn-src-all mailing list