Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Nov 2020 12:12:27 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r367375 - stable/12/sbin/ifconfig
Message-ID:  <202011051212.0A5CCRqH031011@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Thu Nov  5 12:12:26 2020
New Revision: 367375
URL: https://svnweb.freebsd.org/changeset/base/367375

Log:
  MFC r366524:
  
    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.

Modified:
  stable/12/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ifconfig/ifieee80211.c
==============================================================================
--- stable/12/sbin/ifconfig/ifieee80211.c	Thu Nov  5 12:10:24 2020	(r367374)
+++ stable/12/sbin/ifconfig/ifieee80211.c	Thu Nov  5 12:12:26 2020	(r367375)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011051212.0A5CCRqH031011>