Skip to contentSkip to conversation

mac80211: save he oper info in bss config for AP and mesh

PATCH In review Pradeep Kumar Chitrapu 3 participants 4 messages Jul 15, 2020 – Oct 12, 2020 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: save he oper info in bss config for AP and mesh

Currently he_support is set only for AP mode. Storing this information for mesh bss as well helps driver to determine he support. Also save he operation element params in bss conf so that drivers can access this for any configurations instead of having to parse the beacon to fetch that info.

---
 include/net/mac80211.h     | 3 ++-
 net/mac80211/cfg.c         | 4 ++++
 net/mac80211/ieee80211_i.h | 3 ++-
 net/mac80211/mesh.c        | 2 ++
 net/mac80211/util.c        | 4 +++-
 5 files changed, 13 insertions(+), 3 deletions(-)
include/net/mac80211.h +2 -1
index 11d5610d2ad5..ef8ec345a201 100644
@@ -604,7 +604,8 @@ struct ieee80211_ftm_responder_params {
  *	nontransmitted BSSIDs
  * @profile_periodicity: the least number of beacon frames need to be received
  *	in order to discover all the nontransmitted BSSIDs in the set.
- * @he_oper: HE operation information of the AP we are connected to
+ * @he_oper: HE operation information of the BSS (AP/Mesh) or of the AP we are
+ *	connected to (STA)
  * @he_obss_pd: OBSS Packet Detection parameters.
  * @he_bss_color: BSS coloring settings, if BSS supports HE
  */
net/mac80211/cfg.c +4 -0
index 9b360544ad6f..c80eb5bac86b 100644
@@ -1019,6 +1019,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 		sdata->vif.bss_conf.frame_time_rts_th =
 			le32_get_bits(params->he_oper->he_oper_params,
 			      IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK);
+		sdata->vif.bss_conf.he_oper.params =
+			__le32_to_cpu(params->he_oper->he_oper_params);
+		sdata->vif.bss_conf.he_oper.nss_set =
+			__le16_to_cpu(params->he_oper->he_mcs_nss_set);
 	}
 
 	mutex_lock(&local->mtx);
net/mac80211/ieee80211_i.h +2 -1
index ec1a71ac65f2..47d1fcf365cf 100644
@@ -2184,7 +2184,8 @@ u8 *ieee80211_ie_build_he_cap(u8 *pos,
 			      u8 *end);
 void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
 				    struct sk_buff *skb);
-u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef);
+u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef,
+			       struct ieee80211_sub_if_data *sdata);
 int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
 			     const struct ieee80211_supported_band *sband,
 			     const u8 *srates, int srates_len, u32 *rates);
net/mac80211/mesh.c +2 -0
index 5f1ca25b6c97..b84ddf6351db 100644
@@ -601,6 +601,8 @@ int mesh_add_he_oper_ie(struct ieee80211_sub_if_data *sdata,
 	    sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
 		return 0;
 
+	sdata->vif.bss_conf.he_support = true;
+
 	len = 2 + 1 + sizeof(struct ieee80211_he_operation);
 	if (sdata->vif.bss_conf.chandef.chan->band == NL80211_BAND_6GHZ)
 		len += sizeof(struct ieee80211_he_6ghz_oper);
net/mac80211/util.c +3 -1
index 21c94094a699..eb3be6b89b0b 100644
@@ -3028,7 +3028,8 @@ u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
 	return pos + sizeof(struct ieee80211_vht_operation);
 }
 
-u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef)
+u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef,
+			       struct ieee80211_sub_if_data *sdata)
 {
 	struct ieee80211_he_operation *he_oper;
 	struct ieee80211_he_6ghz_oper *he_6ghz_op;
@@ -3056,6 +3057,7 @@ u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef)
 	he_oper = (struct ieee80211_he_operation *)pos;
 	he_oper->he_oper_params = cpu_to_le32(he_oper_params);
 
+	sdata->vif.bss_conf.he_oper.params = he_oper_params;
 	/* don't require special HE peer rates */
 	he_oper->he_mcs_nss_set = cpu_to_le16(0xffff);
 	pos += sizeof(struct ieee80211_he_operation);
Signature · 1 line
2.17.1
#1 lore raw
Thank you for the patch! Yet something to improve:

Hi Pradeep,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mac80211-next/master]
[also build test ERROR on mac80211/master v5.8-rc5 next-20200714] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Pradeep-Kumar-Chitrapu/mac80211-save-he-oper-info-in-bss-config-for-AP-and-mesh/20200715-111048
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: mips-malta_kvm_guest_defconfig (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

net/mac80211/mesh.c: In function 'mesh_add_he_oper_ie':

>> net/mac80211/mesh.c:614:2: error: too few arguments to function 'ieee80211_ie_build_he_oper'
     614 |  ieee80211_ie_build_he_oper(pos, &sdata->vif.bss_conf.chandef);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from net/mac80211/mesh.c:11:
   net/mac80211/ieee80211_i.h:2187:5: note: declared here
    2187 | u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/ieee80211_ie_build_he_oper +614 net/mac80211/mesh.c

60ad72da55ac74 Sven Eckelmann         2019-07-24  584  
60ad72da55ac74 Sven Eckelmann         2019-07-24  585  int mesh_add_he_oper_ie(struct ieee80211_sub_if_data *sdata,
60ad72da55ac74 Sven Eckelmann         2019-07-24  586  			struct sk_buff *skb)
60ad72da55ac74 Sven Eckelmann         2019-07-24  587  {
60ad72da55ac74 Sven Eckelmann         2019-07-24  588  	const struct ieee80211_sta_he_cap *he_cap;
60ad72da55ac74 Sven Eckelmann         2019-07-24  589  	struct ieee80211_supported_band *sband;
d1b7524b3ea140 Rajkumar Manoharan     2020-05-28  590  	u32 len;
60ad72da55ac74 Sven Eckelmann         2019-07-24  591  	u8 *pos;
60ad72da55ac74 Sven Eckelmann         2019-07-24  592  
60ad72da55ac74 Sven Eckelmann         2019-07-24  593  	sband = ieee80211_get_sband(sdata);
60ad72da55ac74 Sven Eckelmann         2019-07-24  594  	if (!sband)
60ad72da55ac74 Sven Eckelmann         2019-07-24  595  		return -EINVAL;
60ad72da55ac74 Sven Eckelmann         2019-07-24  596  
60ad72da55ac74 Sven Eckelmann         2019-07-24  597  	he_cap = ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_MESH_POINT);
60ad72da55ac74 Sven Eckelmann         2019-07-24  598  	if (!he_cap ||
60ad72da55ac74 Sven Eckelmann         2019-07-24  599  	    sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
60ad72da55ac74 Sven Eckelmann         2019-07-24  600  	    sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
60ad72da55ac74 Sven Eckelmann         2019-07-24  601  	    sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
60ad72da55ac74 Sven Eckelmann         2019-07-24  602  		return 0;
60ad72da55ac74 Sven Eckelmann         2019-07-24  603  
ef32fba11e9097 Pradeep Kumar Chitrapu 2020-07-14  604  	sdata->vif.bss_conf.he_support = true;
ef32fba11e9097 Pradeep Kumar Chitrapu 2020-07-14  605  
d1b7524b3ea140 Rajkumar Manoharan     2020-05-28  606  	len = 2 + 1 + sizeof(struct ieee80211_he_operation);
d1b7524b3ea140 Rajkumar Manoharan     2020-05-28  607  	if (sdata->vif.bss_conf.chandef.chan->band == NL80211_BAND_6GHZ)
d1b7524b3ea140 Rajkumar Manoharan     2020-05-28  608  		len += sizeof(struct ieee80211_he_6ghz_oper);
d1b7524b3ea140 Rajkumar Manoharan     2020-05-28  609  
d1b7524b3ea140 Rajkumar Manoharan     2020-05-28  610  	if (skb_tailroom(skb) < len)
60ad72da55ac74 Sven Eckelmann         2019-07-24  611  		return -ENOMEM;
60ad72da55ac74 Sven Eckelmann         2019-07-24  612  
d1b7524b3ea140 Rajkumar Manoharan     2020-05-28  613  	pos = skb_put(skb, len);
d1b7524b3ea140 Rajkumar Manoharan     2020-05-28 @614  	ieee80211_ie_build_he_oper(pos, &sdata->vif.bss_conf.chandef);
60ad72da55ac74 Sven Eckelmann         2019-07-24  615  
60ad72da55ac74 Sven Eckelmann         2019-07-24  616  	return 0;
60ad72da55ac74 Sven Eckelmann         2019-07-24  617  }
60ad72da55ac74 Sven Eckelmann         2019-07-24  618  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#2 lore raw
In reply to Pradeep Kumar Chitrapu

Please always capitalize acronyms. I might let you get away with a lower-case "BSS" since that doesn't actually *mean* anything, but "he" is actually an English word...

Anyway, since you haven't paid attention to the robot, I'll drop this one way or the other.

Also,

net/mac80211/util.c u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef) · line 3060

Quoted 11 lines
net/mac80211/util.c +3 -1
-u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef)
+u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef,
+			       struct ieee80211_sub_if_data *sdata)
 {
 	struct ieee80211_he_operation *he_oper;
 	struct ieee80211_he_6ghz_oper *he_6ghz_op;
@@ -3056,6 +3057,7 @@ u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef)
 	he_oper = (struct ieee80211_he_operation *)pos;
 	he_oper->he_oper_params = cpu_to_le32(he_oper_params);
 
+	sdata->vif.bss_conf.he_oper.params = he_oper_params;

I think these changes are inappropriate. This is a helper function to build something, not to store the data. Please change the callers instead.

johannes

#3 lore raw
Quoted 14 lines
Quoted 14 lines

-u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef)
+u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef,

net/mac80211/util.c +1 -0
+			       struct ieee80211_sub_if_data *sdata)
 {
 	struct ieee80211_he_operation *he_oper;
 	struct ieee80211_he_6ghz_oper *he_6ghz_op;
@@ -3056,6 +3057,7 @@ u8 *ieee80211_ie_build_he_oper(u8 *pos, struct 
 cfg80211_chan_def *chandef)
 	he_oper = (struct ieee80211_he_operation *)pos;
 	he_oper->he_oper_params = cpu_to_le32(he_oper_params);
 
Quoted 7 lines

net/mac80211/util.c u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef) · line 3060

Quoted 1 line
net/mac80211/util.c +1 -0
+	sdata->vif.bss_conf.he_oper.params = he_oper_params;

I think these changes are inappropriate. This is a helper function to build something, not to store the data. Please change the callers instead.

johannes

Hi Johannes,

Sorry for late response..

Thanks for the review.. I have tried to address the review comments provided and created new series @ https://patchwork.kernel.org/cover/11824871/

Thanks
Pradeep