mac80211: enable easier manipulation of VHT beamforming caps
Subsystems (2)
PATCH 1/2 mac80211: enable easier manipulation of VHT beamforming caps
From: Eyal Shapira <[email protected]>
Introduce shift and mask defines for beamformee STS cap and number of sounding dimensions cap as these can take any 3 bit value. While at it also cleanup an unrequired parenthesis.
--- include/linux/ieee80211.h | 8 ++++++-- net/mac80211/vht.c | 7 +++---- 2 files changed, 9 insertions(+), 6 deletions(-)
include/linux/ieee80211.h +6 -2
@@ -1411,8 +1411,12 @@ struct ieee80211_vht_operation {#define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 -#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MAX 0x0000e000 -#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00070000 +#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 +#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK \ + (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT) +#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 +#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \ + (7 << IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT)#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000
net/mac80211/vht.c +3 -4
@@ -182,16 +182,15 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, IEEE80211_VHT_CAP_SHORT_GI_160);/* remaining ones */ -if (own_cap.cap &IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE ) { +if (own_cap.cap &IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE ) vht_cap->cap |= cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | -IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX ); - } +IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK );if (own_cap.cap &IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE ) vht_cap->cap |= cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | -IEEE80211_VHT_CAP_BEAMFORMEE_STS_MAX ); +IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK );if (own_cap.cap &IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE ) vht_cap->cap |= cap_info &
Signature · 1 line
1.7.9.5
PATCH 2/2 mac80211: add min required channel definition field
From: Eliad Peller <[email protected]>
Add a new field to ieee80211_chanctx_conf to indicate the min required channel configuration.
Tuning to a narrower channel might help reducing the noise level and saving some power.
The min required channel definition is the max of all min required channel definitions of the interfaces bound to this channel context.
In AP mode, use 20MHz when there are no connected station. When a new station is added/removed, calculate the new max bandwidth supported by any of the stations (e.g. 80MHz when 80MHz and 40MHz stations are connected).
In other cases, simply use bss_conf.chandef as the min required chandef.
Notify drivers about changes to this field by calling drv_change_chanctx with a new CHANGE_MIN_WIDTH notification.
--- include/net/mac80211.h | 4 ++ net/mac80211/chan.c | 139 ++++++++++++++++++++++++++++++++++++++++++++ net/mac80211/ieee80211_i.h | 3 + net/mac80211/sta_info.c | 2 + net/mac80211/trace.h | 21 ++++++- net/mac80211/util.c | 20 +++++++ 6 files changed, 187 insertions(+), 2 deletions(-)
include/net/mac80211.h +4 -0
@@ -154,12 +154,14 @@ struct ieee80211_low_level_stats {* @IEEE80211_CHANCTX_CHANGE_RADAR: radar detection flag changed * @IEEE80211_CHANCTX_CHANGE_CHANNEL: switched to another operating channel, * this is used only with channel switching with CSA +* @IEEE80211_CHANCTX_CHANGE_MIN_WIDTH: The min required channel width changed */ enum ieee80211_chanctx_change {IEEE80211_CHANCTX_CHANGE_WIDTH =BIT (0 ),IEEE80211_CHANCTX_CHANGE_RX_CHAINS =BIT (1 ),IEEE80211_CHANCTX_CHANGE_RADAR =BIT (2 ),IEEE80211_CHANCTX_CHANGE_CHANNEL =BIT (3 ), +IEEE80211_CHANCTX_CHANGE_MIN_WIDTH =BIT (4 ), };/**
@@ -169,6 +171,7 @@ enum ieee80211_chanctx_change {* that contains it is visible in mac80211 only. * * @def: the channel definition +* @min_def: the minimum channel definition currently required. * @rx_chains_static: The number of RX chains that must always be * active on the channel to receive MIMO transmissions * @rx_chains_dynamic: The number of RX chains that must be enabled
@@ -180,6 +183,7 @@ enum ieee80211_chanctx_change {*/ struct ieee80211_chanctx_conf {struct cfg80211_chan_def def; +struct cfg80211_chan_def min_def;u8 rx_chains_static, rx_chains_dynamic;
net/mac80211/chan.c +139 -0
175 lines not on this page · raw message
net/mac80211/ieee80211_i.h +3 -0
@@ -1692,6 +1692,7 @@ int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,int __ieee80211_request_smps_ap (struct ieee80211_sub_if_data *sdata,enum ieee80211_smps_mode smps_mode);void ieee80211_recalc_smps (struct ieee80211_sub_if_data *sdata); +void ieee80211_recalc_min_chandef (struct ieee80211_sub_if_data *sdata);size_t ieee80211_ie_split (const u8 *ies,size_t ielen,const u8 *ids,int n_ids,size_t offset);
@@ -1741,6 +1742,8 @@ void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, struct ieee80211_chanctx *chanctx);void ieee80211_recalc_radar_chanctx (struct ieee80211_local *local,struct ieee80211_chanctx *chanctx); +void ieee80211_recalc_chanctx_min_def (struct ieee80211_local *local, +struct ieee80211_chanctx *ctx);void ieee80211_dfs_cac_timer (unsigned long data);void ieee80211_dfs_cac_timer_work (struct work_struct *work);
net/mac80211/sta_info.c +2 -0
@@ -507,6 +507,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)set_sta_flag (sta,WLAN_STA_INSERTED ); +ieee80211_recalc_min_chandef (sdata);ieee80211_sta_debugfs_add (sta);rate_control_add_sta_debugfs (sta);
@@ -869,6 +870,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta)rate_control_remove_sta_debugfs (sta);ieee80211_sta_debugfs_remove (sta); +ieee80211_recalc_min_chandef (sdata);call_rcu (&sta->rcu_head, free_sta_rcu);
net/mac80211/trace.h +19 -2
@@ -41,14 +41,31 @@#define CHANDEF_PR_ARG __entry->control_freq, __entry->chan_width, \ __entry->center_freq1, __entry->center_freq2 +#define MIN_CHANDEF_ENTRY \ + __field(u32, min_control_freq) \ + __field(u32, min_chan_width) \ + __field(u32, min_center_freq1) \ + __field(u32, min_center_freq2) + +#define MIN_CHANDEF_ASSIGN (c) \ + __entry->min_control_freq = (c)->chan ? (c)->chan->center_freq : 0; \ + __entry->min_chan_width = (c)->width; \ + __entry->min_center_freq1 = (c)->center_freq1; \ + __entry->min_center_freq2 = (c)->center_freq2; +#define MIN_CHANDEF_PR_FMT " min_control:%d MHz min_width:%d min_center: %d/%d MHz" +#define MIN_CHANDEF_PR_ARG __entry->min_control_freq, __entry->min_chan_width, \ + __entry->min_center_freq1, __entry->min_center_freq2 +#define CHANCTX_ENTRY CHANDEF_ENTRY \ + MIN_CHANDEF_ENTRY \ __field(u8, rx_chains_static) \ __field(u8, rx_chains_dynamic)#define CHANCTX_ASSIGN CHANDEF_ASSIGN(&ctx->conf.def) \ + MIN_CHANDEF_ASSIGN(&ctx->conf.min_def) \ __entry->rx_chains_static = ctx->conf.rx_chains_static; \ __entry->rx_chains_dynamic = ctx->conf.rx_chains_dynamic -#define CHANCTX_PR_FMT CHANDEF_PR_FMT " chains:%d/%d" -#define CHANCTX_PR_ARG CHANDEF_PR_ARG, \ +#define CHANCTX_PR_FMT CHANDEF_PR_FMT MIN_CHANDEF_PR_FMT " chains:%d/%d" +#define CHANCTX_PR_ARG CHANDEF_PR_ARG, MIN_CHANDEF_PR_ARG, \ __entry->rx_chains_static, __entry->rx_chains_dynamic
net/mac80211/util.c +20 -0
@@ -1804,6 +1804,26 @@ void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata)mutex_unlock (&local->chanctx_mtx); } +void ieee80211_recalc_min_chandef (struct ieee80211_sub_if_data *sdata) +{ +struct ieee80211_local *local = sdata->local; +struct ieee80211_chanctx_conf *chanctx_conf; +struct ieee80211_chanctx *chanctx; + +mutex_lock (&local->chanctx_mtx); + + chanctx_conf =rcu_dereference_protected (sdata->vif.chanctx_conf, +lockdep_is_held (&local->chanctx_mtx)); + +if (WARN_ON_ONCE (!chanctx_conf)) + goto unlock; + + chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, conf); +ieee80211_recalc_chanctx_min_def (local, chanctx); + unlock: +mutex_unlock (&local->chanctx_mtx); +} +static bool ieee80211_id_in_list (const u8 *ids,int n_ids,u8 id) {int i;
Signature · 1 line
1.7.9.5
Quoted 9 lines · Emmanuel Grumbach
From: Eyal Shapira <[email protected]>
Introduce shift and mask defines for beamformee STS cap and number of sounding dimensions cap as these can take any 3 bit value. While at it also cleanup an unrequired parenthesis.
Signed-off-by Eyal Shapira <[email protected]>Reviewed-by Johannes Berg <[email protected]>Signed-off-by Emmanuel Grumbach <[email protected]>
I forgot to say that I need that in 3.13...
Quoted 7 lines · Emmanuel Grumbach
Quoted 6 lines · Emmanuel Grumbach
From: Eyal Shapira <[email protected]>
Introduce shift and mask defines for beamformee STS cap and number of sounding dimensions cap as these can take any 3 bit value. While at it also cleanup an unrequired parenthesis.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Eyal Shapira <[email protected]>Reviewed-by Johannes Berg <[email protected]>Signed-off-by Emmanuel Grumbach <[email protected]>I forgot to say that I need that in 3.13...
N/M - the patch that relies on it isn't *that* urgent - it can wait to 3.14
Johannes Berg
maintainerQuoted 5 lines · Emmanuel Grumbach
From: Eyal Shapira <[email protected]>
Introduce shift and mask defines for beamformee STS cap and number of sounding dimensions cap as these can take any 3 bit value. While at it also cleanup an unrequired parenthesis.
Applied both.
johannes