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.

Checked with RTL8188EE, country US / JP / KR / UA.

MFC after:	2 weeks
This commit is contained in:
Andriy Voskoboinyk 2019-01-26 17:00:55 +00:00
parent 34fd9d7000
commit b84b36380e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343474
16 changed files with 28 additions and 60 deletions

View File

@ -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

View File

@ -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),

View File

@ -189,9 +189,6 @@ static const uint32_t rt2560_rf2525e_r2[] = RT2560_RF2525E_R2;
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);

View File

@ -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);

View File

@ -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 maxchans, int *nchans,
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);

View File

@ -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);

View File

@ -286,9 +286,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,
@ -784,9 +781,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

View File

@ -342,9 +342,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,
@ -3220,8 +3217,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);

View File

@ -4859,8 +4859,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 ||

View File

@ -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,

View File

@ -361,9 +361,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,
@ -1591,8 +1588,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);

View File

@ -215,9 +215,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 */
@ -1585,8 +1582,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

View File

@ -2889,8 +2889,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

View File

@ -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 \
{ \

View File

@ -1631,6 +1631,17 @@ ieee80211_add_channel_list_2ghz(struct ieee80211_channel chans[], int maxchans,
return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags));
}
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[],

View File

@ -734,6 +734,8 @@ uint32_t ieee80211_get_channel_center_freq1(const struct ieee80211_channel *);
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 *,