Date: Sun, 23 Aug 2020 21:42:23 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364553 - head/sys/net80211 Message-ID: <202008232142.07NLgNKi073018@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Sun Aug 23 21:42:23 2020 New Revision: 364553 URL: https://svnweb.freebsd.org/changeset/base/364553 Log: net80211: improve media information for VHT5GHZ Improve ieee80211_media_setup(), media2mode(), and ieee80211_rate2media() for VHT5GHZ at least. Reviewed by: adrian, gnn MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Differential Revision: https://reviews.freebsd.org/D26089 Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sun Aug 23 21:38:48 2020 (r364552) +++ head/sys/net80211/ieee80211.c Sun Aug 23 21:42:23 2020 (r364553) @@ -1920,12 +1920,18 @@ ieee80211_media_setup(struct ieee80211com *ic, /* * Add VHT media. + * XXX-BZ skip "VHT_2GHZ" for now. */ - for (; mode <= IEEE80211_MODE_VHT_5GHZ; mode++) { + for (mode = IEEE80211_MODE_VHT_5GHZ; 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); + } + if (isset(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ)) { + addmedia(media, caps, addsta, + IEEE80211_MODE_AUTO, IFM_IEEE80211_VHT); /* XXX TODO: VHT maxrate */ } @@ -2044,6 +2050,12 @@ media2mode(const struct ifmedia_entry *ime, uint32_t f case IFM_IEEE80211_11NG: *mode = IEEE80211_MODE_11NG; break; + case IFM_IEEE80211_VHT2G: + *mode = IEEE80211_MODE_VHT_2GHZ; + break; + case IFM_IEEE80211_VHT5G: + *mode = IEEE80211_MODE_VHT_5GHZ; + break; case IFM_AUTO: *mode = IEEE80211_MODE_AUTO; break; @@ -2387,12 +2399,36 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate { 75, IFM_IEEE80211_MCS }, { 76, IFM_IEEE80211_MCS }, }; + static const struct ratemedia vhtrates[] = { + { 0, IFM_IEEE80211_VHT }, + { 1, IFM_IEEE80211_VHT }, + { 2, IFM_IEEE80211_VHT }, + { 3, IFM_IEEE80211_VHT }, + { 4, IFM_IEEE80211_VHT }, + { 5, IFM_IEEE80211_VHT }, + { 6, IFM_IEEE80211_VHT }, + { 7, IFM_IEEE80211_VHT }, + { 8, IFM_IEEE80211_VHT }, /* Optional. */ + { 9, IFM_IEEE80211_VHT }, /* Optional. */ +#if 0 + /* Some QCA and BRCM seem to support this; offspec. */ + { 10, IFM_IEEE80211_VHT }, + { 11, IFM_IEEE80211_VHT }, +#endif + }; int m; /* - * Check 11n rates first for match as an MCS. + * Check 11ac/11n rates first for match as an MCS. */ - if (mode == IEEE80211_MODE_11NA) { + if (mode == IEEE80211_MODE_VHT_5GHZ) { + if (rate & IFM_IEEE80211_VHT) { + rate &= ~IFM_IEEE80211_VHT; + m = findmedia(vhtrates, nitems(vhtrates), rate); + if (m != IFM_AUTO) + return (m | IFM_IEEE80211_VHT); + } + } else if (mode == IEEE80211_MODE_11NA) { if (rate & IEEE80211_RATE_MCS) { rate &= ~IEEE80211_RATE_MCS; m = findmedia(htrates, nitems(htrates), rate);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008232142.07NLgNKi073018>