mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-17 21:41:22 +01:00
net80211: 11ac: add options to manage VHT STBC
Add IEEE80211_FVHT_STBC_(TX|RX) flags to allow userspace to manage if STBC will be allowed for VHT RX/TX. For RX this will only allow us to turn it off but no fine grained control of the number of supported spatial streams. Introduce IEEE80211_FVHT_CHANWIDTH_MASK as a helper to make the spelling out of the IEEE80211_FVHT_MASK more readable. Update ifconfig to allow setting of these flags. Sponsored by: The FreeBSD Foundation MFC atfer: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D47838
This commit is contained in:
parent
116102101a
commit
243f6925bf
@ -135,6 +135,8 @@
|
||||
#define IEEE80211_FVHT_USEVHT80 0x000000004 /* CONF: Use VHT80 */
|
||||
#define IEEE80211_FVHT_USEVHT160 0x000000008 /* CONF: Use VHT160 */
|
||||
#define IEEE80211_FVHT_USEVHT80P80 0x000000010 /* CONF: Use VHT 80+80 */
|
||||
#define IEEE80211_FVHT_STBC_TX 0x00000020 /* CONF: STBC tx enabled */
|
||||
#define IEEE80211_FVHT_STBC_RX 0x00000040 /* CONF: STBC rx enabled */
|
||||
#endif
|
||||
|
||||
/* Helper macros unified. */
|
||||
@ -6038,6 +6040,12 @@ static struct cmd ieee80211_cmds[] = {
|
||||
DEF_CMD("-vht160", -IEEE80211_FVHT_USEVHT160, set80211vhtconf),
|
||||
DEF_CMD("vht80p80", IEEE80211_FVHT_USEVHT80P80, set80211vhtconf),
|
||||
DEF_CMD("-vht80p80", -IEEE80211_FVHT_USEVHT80P80, set80211vhtconf),
|
||||
DEF_CMD("vhtstbctx", IEEE80211_FVHT_STBC_TX, set80211vhtconf),
|
||||
DEF_CMD("-vhtstbctx", -IEEE80211_FVHT_STBC_TX, set80211vhtconf),
|
||||
DEF_CMD("vhtstbcrx", IEEE80211_FVHT_STBC_RX, set80211vhtconf),
|
||||
DEF_CMD("-vhtstbcrx", -IEEE80211_FVHT_STBC_RX, set80211vhtconf),
|
||||
DEF_CMD("vhtstbc", (IEEE80211_FVHT_STBC_TX|IEEE80211_FVHT_STBC_RX), set80211vhtconf),
|
||||
DEF_CMD("-vhtstbc", -(IEEE80211_FVHT_STBC_TX|IEEE80211_FVHT_STBC_RX), set80211vhtconf),
|
||||
DEF_CMD("rifs", 1, set80211rifs),
|
||||
DEF_CMD("-rifs", 0, set80211rifs),
|
||||
DEF_CMD("smps", IEEE80211_HTCAP_SMPS_ENA, set80211smps),
|
||||
|
@ -744,6 +744,8 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ifm_change_cb_t media_change,
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_STBC_TX);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_STBC_RX);
|
||||
IEEE80211_UNLOCK(ic);
|
||||
|
||||
return 1;
|
||||
@ -801,6 +803,8 @@ ieee80211_vap_detach(struct ieee80211vap *vap)
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_STBC_TX);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_STBC_RX);
|
||||
|
||||
/* NB: this handles the bpfdetach done below */
|
||||
ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF);
|
||||
|
@ -3506,6 +3506,26 @@ ieee80211_ioctl_set80211(struct ieee80211vap *vap, u_long cmd, struct ieee80211r
|
||||
else
|
||||
ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_USEVHT80P80);
|
||||
|
||||
/* Check if we can do STBC TX/RX before changing the setting. */
|
||||
if ((ireq->i_val & IEEE80211_FVHT_STBC_TX) &&
|
||||
((vap->iv_vht_cap.vht_cap_info & IEEE80211_VHTCAP_TXSTBC) == 0))
|
||||
return EOPNOTSUPP;
|
||||
if ((ireq->i_val & IEEE80211_FVHT_STBC_RX) &&
|
||||
((vap->iv_vht_cap.vht_cap_info & IEEE80211_VHTCAP_RXSTBC_MASK) == 0))
|
||||
return EOPNOTSUPP;
|
||||
|
||||
/* TX */
|
||||
if (ireq->i_val & IEEE80211_FVHT_STBC_TX)
|
||||
ieee80211_syncflag_vht(vap, IEEE80211_FVHT_STBC_TX);
|
||||
else
|
||||
ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_STBC_TX);
|
||||
|
||||
/* RX */
|
||||
if (ireq->i_val & IEEE80211_FVHT_STBC_RX)
|
||||
ieee80211_syncflag_vht(vap, IEEE80211_FVHT_STBC_RX);
|
||||
else
|
||||
ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_STBC_RX);
|
||||
|
||||
error = ENETRESET;
|
||||
break;
|
||||
|
||||
|
@ -737,12 +737,20 @@ MALLOC_DECLARE(M_80211_VAP);
|
||||
#define IEEE80211_FVHT_USEVHT80 0x000000004 /* CONF: Use VHT80 */
|
||||
#define IEEE80211_FVHT_USEVHT160 0x000000008 /* CONF: Use VHT160 */
|
||||
#define IEEE80211_FVHT_USEVHT80P80 0x000000010 /* CONF: Use VHT 80+80 */
|
||||
#define IEEE80211_FVHT_MASK \
|
||||
#define IEEE80211_FVHT_STBC_TX 0x00000020 /* CONF: STBC tx enabled */
|
||||
#define IEEE80211_FVHT_STBC_RX 0x00000040 /* CONF: STBC rx enabled */
|
||||
|
||||
#define IEEE80211_FVHT_CHANWIDTH_MASK \
|
||||
(IEEE80211_FVHT_VHT | IEEE80211_FVHT_USEVHT40 | \
|
||||
IEEE80211_FVHT_USEVHT80 | IEEE80211_FVHT_USEVHT160 | \
|
||||
IEEE80211_FVHT_USEVHT80P80)
|
||||
|
||||
#define IEEE80211_FVHT_MASK \
|
||||
(IEEE80211_FVHT_CHANWIDTH_MASK | \
|
||||
IEEE80211_FVHT_STBC_TX | IEEE80211_FVHT_STBC_RX)
|
||||
|
||||
#define IEEE80211_VFHT_BITS \
|
||||
"\20\1VHT\2VHT40\3VHT80\4VHT160\5VHT80P80"
|
||||
"\20\1VHT\2VHT40\3VHT80\4VHT160\5VHT80P80\6STBC_TX\7STBC_RX"
|
||||
|
||||
#define IEEE80211_COM_DETACHED 0x00000001 /* ieee80211_ifdetach called */
|
||||
#define IEEE80211_COM_REF_ADD 0x00000002 /* add / remove reference */
|
||||
|
@ -439,8 +439,7 @@ ieee80211_vht_get_vhtcap_ie(struct ieee80211_node *ni,
|
||||
IEEE80211_VHTCAP_RXSTBC_MASK);
|
||||
}
|
||||
val = MIN(val1, val2);
|
||||
/* XXX For now, use the 11n config flag */
|
||||
if ((vap->iv_flags_ht & IEEE80211_FHT_STBC_TX) == 0)
|
||||
if ((vap->iv_vht_flags & IEEE80211_FVHT_STBC_TX) == 0)
|
||||
val = 0;
|
||||
new_vhtcap |= _IEEE80211_SHIFTMASK(val, IEEE80211_VHTCAP_TXSTBC);
|
||||
|
||||
@ -453,8 +452,7 @@ ieee80211_vht_get_vhtcap_ie(struct ieee80211_node *ni,
|
||||
IEEE80211_VHTCAP_TXSTBC);
|
||||
}
|
||||
val = MIN(val1, val2);
|
||||
/* XXX For now, use the 11n config flag */
|
||||
if ((vap->iv_flags_ht & IEEE80211_FHT_STBC_RX) == 0)
|
||||
if ((vap->iv_vht_flags & IEEE80211_FVHT_STBC_RX) == 0)
|
||||
val = 0;
|
||||
new_vhtcap |= _IEEE80211_SHIFTMASK(val, IEEE80211_VHTCAP_RXSTBC_MASK);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user