Author: bz
Date: Wed Oct  7 22:29:26 2020
New Revision: 366524
URL: https://svnweb.freebsd.org/changeset/base/366524

Log:
  80211: ifconfig replace MS() with _IEEE80211_MASKSHIFT()
  
  As we did in the kernel in r366112 replace the MS() macro with the version(s)
  added to the kernel: _IEEE80211_MASKSHIFT().  Also provide its counter part.
  This will later allow use to use other macros defined in net80211 headers
  here in ifconfig.
  
  MFC after:    1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==============================================================================
--- head/sbin/ifconfig/ifieee80211.c    Wed Oct  7 22:07:26 2020        
(r366523)
+++ head/sbin/ifconfig/ifieee80211.c    Wed Oct  7 22:29:26 2020        
(r366524)
@@ -138,6 +138,14 @@
 #define        IEEE80211_FVHT_USEVHT80P80 0x000000010  /* CONF: Use VHT 80+80 
*/
 #endif
 
+/* Helper macros unified. */
+#ifndef        _IEEE80211_MASKSHIFT
+#define        _IEEE80211_MASKSHIFT(_v, _f)    (((_v) & _f) >> _f##_S)
+#endif
+#ifndef        _IEEE80211_SHIFTMASK
+#define        _IEEE80211_SHIFTMASK(_v, _f)    (((_v) << _f##_S) & _f)
+#endif
+
 #define        MAXCHAN 1536            /* max 1.5K channels */
 
 #define        MAXCOL  78
@@ -2706,7 +2714,6 @@ printie(const char* tag, const uint8_t *ie, size_t iel
 static void
 printwmeparam(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 {
-#define        MS(_v, _f)      (((_v) & _f) >> _f##_S)
        static const char *acnames[] = { "BE", "BK", "VO", "VI" };
        const struct ieee80211_wme_param *wme =
            (const struct ieee80211_wme_param *) ie;
@@ -2721,17 +2728,17 @@ printwmeparam(const char *tag, const u_int8_t *ie, siz
                const struct ieee80211_wme_acparams *ac =
                    &wme->params_acParams[i];
 
-               printf(" %s[%saifsn %u cwmin %u cwmax %u txop %u]"
-                       , acnames[i]
-                       , MS(ac->acp_aci_aifsn, WME_PARAM_ACM) ? "acm " : ""
-                       , MS(ac->acp_aci_aifsn, WME_PARAM_AIFSN)
-                       , MS(ac->acp_logcwminmax, WME_PARAM_LOGCWMIN)
-                       , MS(ac->acp_logcwminmax, WME_PARAM_LOGCWMAX)
-                       , LE_READ_2(&ac->acp_txop)
-               );
+               printf(" %s[%saifsn %u cwmin %u cwmax %u txop %u]", acnames[i],
+                   _IEEE80211_MASKSHIFT(ac->acp_aci_aifsn, WME_PARAM_ACM) ?
+                       "acm " : "",
+                   _IEEE80211_MASKSHIFT(ac->acp_aci_aifsn, WME_PARAM_AIFSN),
+                   _IEEE80211_MASKSHIFT(ac->acp_logcwminmax,
+                       WME_PARAM_LOGCWMIN),
+                   _IEEE80211_MASKSHIFT(ac->acp_logcwminmax,
+                       WME_PARAM_LOGCWMAX),
+                   LE_READ_2(&ac->acp_txop));
        }
        printf(">");
-#undef MS
 }
 
 static void
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to