Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Feb 2019 20:59:36 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@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: r343975 - in stable/12/sys: dev/bwi dev/iwi dev/ral dev/rtwn dev/usb/wlan net80211
Message-ID:  <201902102059.x1AKxaK9041310@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Sun Feb 10 20:59:35 2019
New Revision: 343975
URL: https://svnweb.freebsd.org/changeset/base/343975

Log:
  MFC r343474:
  Remove 2GHz channel list copies from wireless drivers.
  
  Wrap ieee80211_add_channel_list_2ghz into another function
  which supplies default (1-14) channel list to it and drop
  its copies from drivers.

Modified:
  stable/12/sys/dev/bwi/if_bwi.c
  stable/12/sys/dev/iwi/if_iwi.c
  stable/12/sys/dev/ral/rt2560.c
  stable/12/sys/dev/ral/rt2661.c
  stable/12/sys/dev/ral/rt2860.c
  stable/12/sys/dev/rtwn/if_rtwn.c
  stable/12/sys/dev/usb/wlan/if_rsu.c
  stable/12/sys/dev/usb/wlan/if_rum.c
  stable/12/sys/dev/usb/wlan/if_run.c
  stable/12/sys/dev/usb/wlan/if_runreg.h
  stable/12/sys/dev/usb/wlan/if_ural.c
  stable/12/sys/dev/usb/wlan/if_urtw.c
  stable/12/sys/dev/usb/wlan/if_zyd.c
  stable/12/sys/dev/usb/wlan/if_zydreg.h
  stable/12/sys/net80211/ieee80211.c
  stable/12/sys/net80211/ieee80211_var.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/bwi/if_bwi.c
==============================================================================
--- stable/12/sys/dev/bwi/if_bwi.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/bwi/if_bwi.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -307,9 +307,6 @@ static const struct {
 	[108]	= { 7, 3 }
 };
 
-static const uint8_t bwi_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 #ifdef BWI_DEBUG
 #ifdef BWI_DEBUG_VERBOSE
 static uint32_t bwi_debug = BWI_DBG_ATTACH | BWI_DBG_INIT | BWI_DBG_TXPOWER;
@@ -1715,8 +1712,7 @@ bwi_getradiocaps(struct ieee80211com *ic,
 		panic("unknown phymode %d\n", phy->phy_mode);
 	}
 
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    bwi_chan_2ghz, nitems(bwi_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 }
 
 static void

Modified: stable/12/sys/dev/iwi/if_iwi.c
==============================================================================
--- stable/12/sys/dev/iwi/if_iwi.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/iwi/if_iwi.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -132,8 +132,6 @@ static const struct iwi_ident iwi_ident_table[] = {
 	{ 0, 0, NULL }
 };
 
-static const uint8_t def_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
 static const uint8_t def_chan_5ghz_band1[] =
 	{ 36, 40, 44, 48, 52, 56, 60, 64 };
 static const uint8_t def_chan_5ghz_band2[] =
@@ -3604,8 +3602,8 @@ iwi_getradiocaps(struct ieee80211com *ic,
 	iwi_collect_bands(ic, bands, sizeof(bands));
 	*nchans = 0;
 	if (isset(bands, IEEE80211_MODE_11B) || isset(bands, IEEE80211_MODE_11G))
-		ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-		    def_chan_2ghz, nitems(def_chan_2ghz), bands, 0);
+		ieee80211_add_channels_default_2ghz(chans, maxchans, nchans,
+		    bands, 0);
 	if (isset(bands, IEEE80211_MODE_11A)) {
 		ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
 		    def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),

Modified: stable/12/sys/dev/ral/rt2560.c
==============================================================================
--- stable/12/sys/dev/ral/rt2560.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/ral/rt2560.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -189,9 +189,6 @@ static const uint32_t rt2560_rf2525e_r2[]   = RT2560_R
 static const uint32_t rt2560_rf2526_r2[]    = RT2560_RF2526_R2;
 static const uint32_t rt2560_rf2526_hi_r2[] = RT2560_RF2526_HI_R2;
 
-static const uint8_t rt2560_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 static const uint8_t rt2560_chan_5ghz[] =
 	{ 36, 40, 44, 48, 52, 56, 60, 64,
 	  100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
@@ -2137,8 +2134,7 @@ rt2560_getradiocaps(struct ieee80211com *ic,
 	memset(bands, 0, sizeof(bands));
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    rt2560_chan_2ghz, nitems(rt2560_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 
 	if (sc->rf_rev == RT2560_RF_5222) {
 		setbit(bands, IEEE80211_MODE_11A);

Modified: stable/12/sys/dev/ral/rt2661.c
==============================================================================
--- stable/12/sys/dev/ral/rt2661.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/ral/rt2661.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -195,8 +195,6 @@ static const struct rfprog {
 	RT2661_RF5225_2
 };
 
-static const uint8_t rt2661_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
 static const uint8_t rt2661_chan_5ghz[] =
 	{ 36, 40, 44, 48, 52, 56, 60, 64,
 	  100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
@@ -2757,8 +2755,7 @@ rt2661_getradiocaps(struct ieee80211com *ic,
 	memset(bands, 0, sizeof(bands));
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    rt2661_chan_2ghz, nitems(rt2661_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 
 	if (sc->rf_rev == RT2661_RF_5225 || sc->rf_rev == RT2661_RF_5325) {
 		setbit(bands, IEEE80211_MODE_11A);

Modified: stable/12/sys/dev/ral/rt2860.c
==============================================================================
--- stable/12/sys/dev/ral/rt2860.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/ral/rt2860.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -228,8 +228,6 @@ static const struct {
 	RT5392_DEF_RF
 };
 
-static const uint8_t rt2860_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
 static const uint8_t rt2860_chan_5ghz[] =
 	{ 36, 38, 40, 44, 46, 48, 52, 54, 56, 60, 62, 64, 100, 102, 104,
 	  108, 110, 112, 116, 118, 120, 124, 126, 128, 132, 134, 136, 140,
@@ -2310,8 +2308,7 @@ rt2860_getradiocaps(struct ieee80211com *ic, int maxch
 	memset(bands, 0, sizeof(bands));
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    rt2860_chan_2ghz, nitems(rt2860_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 
 	if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850) {
 		setbit(bands, IEEE80211_MODE_11A);

Modified: stable/12/sys/dev/rtwn/if_rtwn.c
==============================================================================
--- stable/12/sys/dev/rtwn/if_rtwn.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/rtwn/if_rtwn.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -153,9 +153,6 @@ static void		rtwn_stop(struct rtwn_softc *);
 
 MALLOC_DEFINE(M_RTWN_PRIV, "rtwn_priv", "rtwn driver private state");
 
-static const uint8_t rtwn_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 static const uint16_t wme2reg[] =
 	{ R92C_EDCA_BE_PARAM, R92C_EDCA_BK_PARAM,
 	  R92C_EDCA_VI_PARAM, R92C_EDCA_VO_PARAM };
@@ -1534,9 +1531,8 @@ rtwn_getradiocaps(struct ieee80211com *ic,
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
 	setbit(bands, IEEE80211_MODE_11NG);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    rtwn_chan_2ghz, nitems(rtwn_chan_2ghz), bands,
-	    !!(ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40));
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans,
+	    bands, !!(ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40));
 
 	/* XXX workaround add_channel_list() limitations */
 	setbit(bands, IEEE80211_MODE_11A);

Modified: stable/12/sys/dev/usb/wlan/if_rsu.c
==============================================================================
--- stable/12/sys/dev/usb/wlan/if_rsu.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/usb/wlan/if_rsu.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -282,9 +282,6 @@ MODULE_DEPEND(rsu, firmware, 1, 1, 1);
 MODULE_VERSION(rsu, 1);
 USB_PNP_HOST_INFO(rsu_devs);
 
-static const uint8_t rsu_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 static uint8_t rsu_wme_ac_xfer_map[4] = {
 	[WME_AC_BE] = RSU_BULK_TX_BE_BK,
 	[WME_AC_BK] = RSU_BULK_TX_BE_BK,
@@ -780,9 +777,8 @@ rsu_getradiocaps(struct ieee80211com *ic,
 	setbit(bands, IEEE80211_MODE_11G);
 	if (sc->sc_ht)
 		setbit(bands, IEEE80211_MODE_11NG);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    rsu_chan_2ghz, nitems(rsu_chan_2ghz), bands,
-	    (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) != 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans,
+	    bands, (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) != 0);
 }
 
 static void

Modified: stable/12/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- stable/12/sys/dev/usb/wlan/if_rum.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/usb/wlan/if_rum.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -338,9 +338,6 @@ static const struct {
 	{ 107, 0x04 }
 };
 
-static const uint8_t rum_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 static const uint8_t rum_chan_5ghz[] =
 	{ 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64,
 	  100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
@@ -3216,8 +3213,7 @@ rum_getradiocaps(struct ieee80211com *ic,
 	memset(bands, 0, sizeof(bands));
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    rum_chan_2ghz, nitems(rum_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 
 	if (sc->rf_rev == RT2573_RF_5225 || sc->rf_rev == RT2573_RF_5226) {
 		setbit(bands, IEEE80211_MODE_11A);

Modified: stable/12/sys/dev/usb/wlan/if_run.c
==============================================================================
--- stable/12/sys/dev/usb/wlan/if_run.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/usb/wlan/if_run.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -4856,8 +4856,7 @@ run_getradiocaps(struct ieee80211com *ic,
 	memset(bands, 0, sizeof(bands));
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    run_chan_2ghz, nitems(run_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 
 	if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 ||
 	    sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 ||

Modified: stable/12/sys/dev/usb/wlan/if_runreg.h
==============================================================================
--- stable/12/sys/dev/usb/wlan/if_runreg.h	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/usb/wlan/if_runreg.h	Sun Feb 10 20:59:35 2019	(r343975)
@@ -1086,9 +1086,6 @@ struct rt2860_rxwi {
 /*
  * Channel map for run(4) driver; taken from the table below.
  */
-static const uint8_t run_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 static const uint8_t run_chan_5ghz[] =
 	{ 36, 38, 40, 44, 46, 48, 52, 54, 56, 60, 62, 64, 100, 102, 104,
 	  108, 110, 112, 116, 118, 120, 124, 126, 128, 132, 134, 136, 140,

Modified: stable/12/sys/dev/usb/wlan/if_ural.c
==============================================================================
--- stable/12/sys/dev/usb/wlan/if_ural.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/usb/wlan/if_ural.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -357,9 +357,6 @@ static const struct {
 	{ 161, 0x08808, 0x0242f, 0x00281 }
 };
 
-static const uint8_t ural_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 static const uint8_t ural_chan_5ghz[] =
 	{ 36, 40, 44, 48, 52, 56, 60, 64,
 	  100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
@@ -1587,8 +1584,7 @@ ural_getradiocaps(struct ieee80211com *ic,
 	memset(bands, 0, sizeof(bands));
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    ural_chan_2ghz, nitems(ural_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 
 	if (sc->rf_rev == RAL_RF_5222) {
 		setbit(bands, IEEE80211_MODE_11A);

Modified: stable/12/sys/dev/usb/wlan/if_urtw.c
==============================================================================
--- stable/12/sys/dev/usb/wlan/if_urtw.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/usb/wlan/if_urtw.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -211,9 +211,6 @@ static uint8_t urtw_8225z2_agc[] = {
 	0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31
 };
 
-static const uint8_t urtw_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 static uint32_t urtw_8225_channel[] = {
 	0x0000,		/* dummy channel 0  */
 	0x085c,		/* 1  */
@@ -1581,8 +1578,7 @@ urtw_getradiocaps(struct ieee80211com *ic,
 	memset(bands, 0, sizeof(bands));
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    urtw_chan_2ghz, nitems(urtw_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 }
 
 static void

Modified: stable/12/sys/dev/usb/wlan/if_zyd.c
==============================================================================
--- stable/12/sys/dev/usb/wlan/if_zyd.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/usb/wlan/if_zyd.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -2885,8 +2885,7 @@ zyd_getradiocaps(struct ieee80211com *ic,
 	memset(bands, 0, sizeof(bands));
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    zyd_chan_2ghz, nitems(zyd_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 }
 
 static void

Modified: stable/12/sys/dev/usb/wlan/if_zydreg.h
==============================================================================
--- stable/12/sys/dev/usb/wlan/if_zydreg.h	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/dev/usb/wlan/if_zydreg.h	Sun Feb 10 20:59:35 2019	(r343975)
@@ -421,10 +421,6 @@
 #define ZYD_CR254		0x93f8
 #define ZYD_CR255		0x93fc
 
-/* nitems(ZYD_*_CHANTABLE) */
-static const uint8_t zyd_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 /* copied nearly verbatim from the Linux driver rewrite */
 #define	ZYD_DEF_PHY							\
 {									\

Modified: stable/12/sys/net80211/ieee80211.c
==============================================================================
--- stable/12/sys/net80211/ieee80211.c	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/net80211/ieee80211.c	Sun Feb 10 20:59:35 2019	(r343975)
@@ -1632,6 +1632,17 @@ ieee80211_add_channel_list_2ghz(struct ieee80211_chann
 }
 
 int
+ieee80211_add_channels_default_2ghz(struct ieee80211_channel chans[],
+    int maxchans, int *nchans, const uint8_t bands[], int ht40)
+{
+	const uint8_t default_chan_list[] =
+	    { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
+
+	return (ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
+	    default_chan_list, nitems(default_chan_list), bands, ht40));
+}
+
+int
 ieee80211_add_channel_list_5ghz(struct ieee80211_channel chans[], int maxchans,
     int *nchans, const uint8_t ieee[], int nieee, const uint8_t bands[],
     int ht40)

Modified: stable/12/sys/net80211/ieee80211_var.h
==============================================================================
--- stable/12/sys/net80211/ieee80211_var.h	Sun Feb 10 20:42:06 2019	(r343974)
+++ stable/12/sys/net80211/ieee80211_var.h	Sun Feb 10 20:59:35 2019	(r343975)
@@ -735,6 +735,8 @@ uint32_t ieee80211_get_channel_center_freq1(const stru
 uint32_t ieee80211_get_channel_center_freq2(const struct ieee80211_channel *);
 int	ieee80211_add_channel_list_2ghz(struct ieee80211_channel[], int, int *,
 	    const uint8_t[], int, const uint8_t[], int);
+int	ieee80211_add_channels_default_2ghz(struct ieee80211_channel[], int,
+	    int *, const uint8_t[], int);
 int	ieee80211_add_channel_list_5ghz(struct ieee80211_channel[], int, int *,
 	    const uint8_t[], int, const uint8_t[], int);
 struct ieee80211_channel *ieee80211_find_channel(struct ieee80211com *,



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