[net80211] add VHT mediatype initialisation and update helper functions.

This commit is contained in:
adrian 2017-01-10 07:50:21 +00:00
parent 6c8840263a
commit d0eecfeead

View File

@ -70,6 +70,8 @@ const char *ieee80211_phymode_name[IEEE80211_MODE_MAX] = {
[IEEE80211_MODE_QUARTER] = "quarter",
[IEEE80211_MODE_11NA] = "11na",
[IEEE80211_MODE_11NG] = "11ng",
[IEEE80211_MODE_VHT_2GHZ] = "11acg",
[IEEE80211_MODE_VHT_5GHZ] = "11ac",
};
/* map ieee80211_opmode to the corresponding capability bit */
const int ieee80211_opcap[IEEE80211_OPMODE_MAX] = {
@ -181,6 +183,10 @@ ieee80211_chan_init(struct ieee80211com *ic)
setbit(ic->ic_modecaps, IEEE80211_MODE_11NA);
if (IEEE80211_IS_CHAN_HTG(c))
setbit(ic->ic_modecaps, IEEE80211_MODE_11NG);
if (IEEE80211_IS_CHAN_VHTA(c))
setbit(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ);
if (IEEE80211_IS_CHAN_VHTG(c))
setbit(ic->ic_modecaps, IEEE80211_MODE_VHT_2GHZ);
}
/* initialize candidate channels to all available */
memcpy(ic->ic_chan_active, ic->ic_chan_avail,
@ -208,6 +214,8 @@ ieee80211_chan_init(struct ieee80211com *ic)
DEFAULTRATES(IEEE80211_MODE_QUARTER, ieee80211_rateset_quarter);
DEFAULTRATES(IEEE80211_MODE_11NA, ieee80211_rateset_11a);
DEFAULTRATES(IEEE80211_MODE_11NG, ieee80211_rateset_11g);
DEFAULTRATES(IEEE80211_MODE_VHT_2GHZ, ieee80211_rateset_11g);
DEFAULTRATES(IEEE80211_MODE_VHT_5GHZ, ieee80211_rateset_11a);
/*
* Setup required information to fill the mcsset field, if driver did
@ -1492,6 +1500,8 @@ addmedia(struct ifmedia *media, int caps, int addsta, int mode, int mword)
[IEEE80211_MODE_QUARTER] = IFM_IEEE80211_11A, /* XXX */
[IEEE80211_MODE_11NA] = IFM_IEEE80211_11NA,
[IEEE80211_MODE_11NG] = IFM_IEEE80211_11NG,
[IEEE80211_MODE_VHT_2GHZ] = IFM_IEEE80211_VHT2G,
[IEEE80211_MODE_VHT_5GHZ] = IFM_IEEE80211_VHT5G,
};
u_int mopt;
@ -1604,6 +1614,19 @@ ieee80211_media_setup(struct ieee80211com *ic,
if (rate > maxrate)
maxrate = rate;
}
/*
* Add VHT media.
*/
for (; mode <= IEEE80211_MODE_VHT_5GHZ; mode++) {
if (isclr(ic->ic_modecaps, mode))
continue;
addmedia(media, caps, addsta, mode, IFM_AUTO);
addmedia(media, caps, addsta, mode, IFM_IEEE80211_VHT);
/* XXX TODO: VHT maxrate */
}
return maxrate;
}
@ -1883,7 +1906,11 @@ enum ieee80211_phymode
ieee80211_chan2mode(const struct ieee80211_channel *chan)
{
if (IEEE80211_IS_CHAN_HTA(chan))
if (IEEE80211_IS_CHAN_VHT_2GHZ(chan))
return IEEE80211_MODE_VHT_2GHZ;
else if (IEEE80211_IS_CHAN_VHT_5GHZ(chan))
return IEEE80211_MODE_VHT_5GHZ;
else if (IEEE80211_IS_CHAN_HTA(chan))
return IEEE80211_MODE_11NA;
else if (IEEE80211_IS_CHAN_HTG(chan))
return IEEE80211_MODE_11NG;