From 8e71a4aa83f856a79c264b77f338b22763dbdcf1 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Sat, 7 Jan 2017 07:35:27 +0000 Subject: [PATCH] [net80211] add syncflags methods for the VHT flags configuration. I missed this in my last commit. Pointy hat to me. --- sys/net80211/ieee80211.c | 54 ++++++++++++++++++++++++++++++++++ sys/net80211/ieee80211_proto.h | 4 ++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index bb2a02471f54..e4990868f06c 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -90,6 +90,7 @@ const uint8_t ieee80211broadcastaddr[IEEE80211_ADDR_LEN] = static void ieee80211_syncflag_locked(struct ieee80211com *ic, int flag); static void ieee80211_syncflag_ht_locked(struct ieee80211com *ic, int flag); static void ieee80211_syncflag_ext_locked(struct ieee80211com *ic, int flag); +static void ieee80211_syncflag_vht_locked(struct ieee80211com *ic, int flag); static int ieee80211_media_setup(struct ieee80211com *ic, struct ifmedia *media, int caps, int addsta, ifm_change_cb_t media_change, ifm_stat_cb_t media_stat); @@ -652,6 +653,12 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ifm_change_cb_t media_change, ieee80211_syncflag_locked(ic, IEEE80211_F_BURST); ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT); ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40); + + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160); IEEE80211_UNLOCK(ic); return 1; @@ -699,6 +706,13 @@ ieee80211_vap_detach(struct ieee80211vap *vap) ieee80211_syncflag_locked(ic, IEEE80211_F_BURST); ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT); ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40); + + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160); + /* NB: this handles the bpfdetach done below */ ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF); if (vap->iv_ifflags & IFF_PROMISC) @@ -852,6 +866,46 @@ ieee80211_syncflag_ht(struct ieee80211vap *vap, int flag) IEEE80211_UNLOCK(ic); } +/* + * Synchronize flags_vht bit state in the com structure + * according to the state of all vap's. This is used, + * for example, to handle state changes via ioctls. + */ +static void +ieee80211_syncflag_vht_locked(struct ieee80211com *ic, int flag) +{ + struct ieee80211vap *vap; + int bit; + + IEEE80211_LOCK_ASSERT(ic); + + bit = 0; + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if (vap->iv_flags_vht & flag) { + bit = 1; + break; + } + if (bit) + ic->ic_flags_vht |= flag; + else + ic->ic_flags_vht &= ~flag; +} + +void +ieee80211_syncflag_vht(struct ieee80211vap *vap, int flag) +{ + struct ieee80211com *ic = vap->iv_ic; + + IEEE80211_LOCK(ic); + if (flag < 0) { + flag = -flag; + vap->iv_flags_vht &= ~flag; + } else + vap->iv_flags_vht |= flag; + ieee80211_syncflag_vht_locked(ic, flag); + IEEE80211_UNLOCK(ic); +} + /* * Synchronize flags_ext bit state in the com structure * according to the state of all vap's. This is used, diff --git a/sys/net80211/ieee80211_proto.h b/sys/net80211/ieee80211_proto.h index 0b3a8f748b34..c4d5e7b0ebd5 100644 --- a/sys/net80211/ieee80211_proto.h +++ b/sys/net80211/ieee80211_proto.h @@ -77,6 +77,7 @@ void ieee80211_promisc(struct ieee80211vap *, bool); void ieee80211_allmulti(struct ieee80211vap *, bool); void ieee80211_syncflag(struct ieee80211vap *, int flag); void ieee80211_syncflag_ht(struct ieee80211vap *, int flag); +void ieee80211_syncflag_vht(struct ieee80211vap *, int flag); void ieee80211_syncflag_ext(struct ieee80211vap *, int flag); #define ieee80211_input(ni, m, rssi, nf) \ @@ -361,7 +362,8 @@ struct ieee80211_beacon_offsets { uint8_t *bo_csa; /* start of CSA element */ uint8_t *bo_quiet; /* start of Quiet element */ uint8_t *bo_meshconf; /* start of MESHCONF element */ - uint8_t *bo_spare[3]; + uint8_t *bo_vhtinfo; /* start of VHT info element (XXX VHTCAP?) */ + uint8_t *bo_spare[2]; }; struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *);