Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Feb 2019 21:00:02 +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-11@freebsd.org
Subject:   svn commit: r343976 - in stable/11/sys: dev/bwi dev/iwi dev/ral dev/rtwn dev/urtwn dev/usb/wlan net80211
Message-ID:  <201902102100.x1AL02AS041445@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Sun Feb 10 21:00:02 2019
New Revision: 343976
URL: https://svnweb.freebsd.org/changeset/base/343976

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/11/sys/dev/bwi/if_bwi.c
  stable/11/sys/dev/iwi/if_iwi.c
  stable/11/sys/dev/ral/rt2560.c
  stable/11/sys/dev/ral/rt2661.c
  stable/11/sys/dev/ral/rt2860.c
  stable/11/sys/dev/rtwn/if_rtwn.c
  stable/11/sys/dev/urtwn/if_urtwn.c
  stable/11/sys/dev/usb/wlan/if_rsu.c
  stable/11/sys/dev/usb/wlan/if_rum.c
  stable/11/sys/dev/usb/wlan/if_run.c
  stable/11/sys/dev/usb/wlan/if_runreg.h
  stable/11/sys/dev/usb/wlan/if_ural.c
  stable/11/sys/dev/usb/wlan/if_urtw.c
  stable/11/sys/dev/usb/wlan/if_zyd.c
  stable/11/sys/dev/usb/wlan/if_zydreg.h
  stable/11/sys/net80211/ieee80211.c
  stable/11/sys/net80211/ieee80211_var.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/bwi/if_bwi.c
==============================================================================
--- stable/11/sys/dev/bwi/if_bwi.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/bwi/if_bwi.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -305,9 +305,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;
@@ -1713,8 +1710,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/11/sys/dev/iwi/if_iwi.c
==============================================================================
--- stable/11/sys/dev/iwi/if_iwi.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/iwi/if_iwi.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -130,8 +130,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[] =
@@ -3601,8 +3599,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/11/sys/dev/ral/rt2560.c
==============================================================================
--- stable/11/sys/dev/ral/rt2560.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/ral/rt2560.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -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,
@@ -2156,8 +2153,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/11/sys/dev/ral/rt2661.c
==============================================================================
--- stable/11/sys/dev/ral/rt2661.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/ral/rt2661.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -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,
@@ -2776,8 +2774,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/11/sys/dev/ral/rt2860.c
==============================================================================
--- stable/11/sys/dev/ral/rt2860.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/ral/rt2860.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -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,
@@ -2309,8 +2307,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/11/sys/dev/rtwn/if_rtwn.c
==============================================================================
--- stable/11/sys/dev/rtwn/if_rtwn.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/rtwn/if_rtwn.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -232,9 +232,6 @@ MODULE_DEPEND(rtwn, pci,  1, 1, 1);
 MODULE_DEPEND(rtwn, wlan, 1, 1, 1);
 MODULE_DEPEND(rtwn, firmware, 1, 1, 1);
 
-static const uint8_t rtwn_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 static int
 rtwn_probe(device_t dev)
 {
@@ -2748,8 +2745,7 @@ rtwn_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,
-	    rtwn_chan_2ghz, nitems(rtwn_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 }
 
 static void

Modified: stable/11/sys/dev/urtwn/if_urtwn.c
==============================================================================
--- stable/11/sys/dev/urtwn/if_urtwn.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/urtwn/if_urtwn.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -467,9 +467,6 @@ static const struct wme_to_queue {
 	{ R92C_EDCA_VO_PARAM, URTWN_BULK_TX_VO}
 };
 
-static const uint8_t urtwn_chan_2ghz[] =
-	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
 static int
 urtwn_match(device_t self)
 {
@@ -4821,8 +4818,7 @@ urtwn_getradiocaps(struct ieee80211com *ic,
 	setbit(bands, IEEE80211_MODE_11G);
 	if (urtwn_enable_11n)
 		setbit(bands, IEEE80211_MODE_11NG);
-	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
-	    urtwn_chan_2ghz, nitems(urtwn_chan_2ghz), bands, 0);
+	ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
 }
 
 static void

Modified: stable/11/sys/dev/usb/wlan/if_rsu.c
==============================================================================
--- stable/11/sys/dev/usb/wlan/if_rsu.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/usb/wlan/if_rsu.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -251,9 +251,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,
@@ -714,9 +711,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/11/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- stable/11/sys/dev/usb/wlan/if_rum.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/usb/wlan/if_rum.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -334,9 +334,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,
@@ -3177,8 +3174,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/11/sys/dev/usb/wlan/if_run.c
==============================================================================
--- stable/11/sys/dev/usb/wlan/if_run.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/usb/wlan/if_run.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -4810,8 +4810,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/11/sys/dev/usb/wlan/if_runreg.h
==============================================================================
--- stable/11/sys/dev/usb/wlan/if_runreg.h	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/usb/wlan/if_runreg.h	Sun Feb 10 21:00:02 2019	(r343976)
@@ -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/11/sys/dev/usb/wlan/if_ural.c
==============================================================================
--- stable/11/sys/dev/usb/wlan/if_ural.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/usb/wlan/if_ural.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -355,9 +355,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,
@@ -1599,8 +1596,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/11/sys/dev/usb/wlan/if_urtw.c
==============================================================================
--- stable/11/sys/dev/usb/wlan/if_urtw.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/usb/wlan/if_urtw.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -202,9 +202,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  */
@@ -1573,8 +1570,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/11/sys/dev/usb/wlan/if_zyd.c
==============================================================================
--- stable/11/sys/dev/usb/wlan/if_zyd.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/usb/wlan/if_zyd.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -2869,8 +2869,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/11/sys/dev/usb/wlan/if_zydreg.h
==============================================================================
--- stable/11/sys/dev/usb/wlan/if_zydreg.h	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/dev/usb/wlan/if_zydreg.h	Sun Feb 10 21:00:02 2019	(r343976)
@@ -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/11/sys/net80211/ieee80211.c
==============================================================================
--- stable/11/sys/net80211/ieee80211.c	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/net80211/ieee80211.c	Sun Feb 10 21:00:02 2019	(r343976)
@@ -1235,6 +1235,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/11/sys/net80211/ieee80211_var.h
==============================================================================
--- stable/11/sys/net80211/ieee80211_var.h	Sun Feb 10 20:59:35 2019	(r343975)
+++ stable/11/sys/net80211/ieee80211_var.h	Sun Feb 10 21:00:02 2019	(r343976)
@@ -742,6 +742,8 @@ int	ieee80211_add_channel_ht40(struct ieee80211_channe
 	    uint8_t, int8_t, uint32_t);
 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?201902102100.x1AL02AS041445>