2020-12-22 02:29:42

by Wen Gong

[permalink] [raw]
Subject: [PATCH] mac80211: do intersection with he mcs and nss set of peer and own

For VHT capbility, it has intersection of mcs and nss for peer in
function ieee80211_vht_cap_ie_to_sta_vht_cap. For HE capbility,
it does not have intersection.

This patch is do intersection for HE capbility.

Signed-off-by: Wen Gong <[email protected]>
---
net/mac80211/he.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)

diff --git a/net/mac80211/he.c b/net/mac80211/he.c
index cc26f239838b..9a6562e324cb 100644
--- a/net/mac80211/he.c
+++ b/net/mac80211/he.c
@@ -52,6 +52,59 @@ ieee80211_update_from_he_6ghz_capa(const struct ieee80211_he_6ghz_capa *he_6ghz_
sta->sta.he_6ghz_capa = *he_6ghz_capa;
}

+void
+ieee80211_he_mcs_disable(u16 *he_mcs)
+{
+ u32 i;
+
+ for (i = 0; i < 8; i++)
+ *he_mcs |= cpu_to_le16(IEEE80211_HE_MCS_NOT_SUPPORTED << i * 2);
+}
+
+void
+ieee80211_he_mcs_intersection(u16 *he_own_rx, u16 *he_peer_rx,
+ u16 *he_own_tx, u16 *he_peer_tx)
+{
+ u32 i;
+ u16 own_rx, own_tx, peer_rx, peer_tx;
+
+ for (i = 0; i < 8; i++) {
+ own_rx = le16_to_cpu(*he_own_rx);
+ own_rx = (own_rx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
+
+ own_tx = le16_to_cpu(*he_own_tx);
+ own_tx = (own_tx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
+
+ peer_rx = le16_to_cpu(*he_peer_rx);
+ peer_rx = (peer_rx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
+
+ peer_tx = le16_to_cpu(*he_peer_tx);
+ peer_tx = (peer_tx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
+
+ if (peer_tx != IEEE80211_HE_MCS_NOT_SUPPORTED) {
+ if (own_rx == IEEE80211_HE_MCS_NOT_SUPPORTED)
+ peer_tx = IEEE80211_HE_MCS_NOT_SUPPORTED;
+ else if (own_rx < peer_tx)
+ peer_tx = own_rx;
+ }
+
+ if (peer_rx != IEEE80211_HE_MCS_NOT_SUPPORTED) {
+ if (own_tx == IEEE80211_HE_MCS_NOT_SUPPORTED)
+ peer_rx = IEEE80211_HE_MCS_NOT_SUPPORTED;
+ else if (own_tx < peer_rx)
+ peer_rx = own_tx;
+ }
+
+ *he_peer_rx &=
+ ~cpu_to_le16(IEEE80211_HE_MCS_NOT_SUPPORTED << i * 2);
+ *he_peer_rx |= cpu_to_le16(peer_rx << i * 2);
+
+ *he_peer_tx &=
+ ~cpu_to_le16(IEEE80211_HE_MCS_NOT_SUPPORTED << i * 2);
+ *he_peer_tx |= cpu_to_le16(peer_tx << i * 2);
+ }
+}
+
void
ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
struct ieee80211_supported_band *sband,
@@ -60,10 +113,12 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta)
{
struct ieee80211_sta_he_cap *he_cap = &sta->sta.he_cap;
+ struct ieee80211_sta_he_cap own_he_cap = sband->iftype_data->he_cap;
struct ieee80211_he_cap_elem *he_cap_ie_elem = (void *)he_cap_ie;
u8 he_ppe_size;
u8 mcs_nss_size;
u8 he_total_size;
+ bool own_160, peer_160, own_80p80, peer_80p80;

memset(he_cap, 0, sizeof(*he_cap));

@@ -101,6 +156,41 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,

if (sband->band == NL80211_BAND_6GHZ && he_6ghz_capa)
ieee80211_update_from_he_6ghz_capa(he_6ghz_capa, sta);
+
+ ieee80211_he_mcs_intersection(&own_he_cap.he_mcs_nss_supp.rx_mcs_80,
+ &he_cap->he_mcs_nss_supp.rx_mcs_80,
+ &own_he_cap.he_mcs_nss_supp.tx_mcs_80,
+ &he_cap->he_mcs_nss_supp.tx_mcs_80);
+
+ own_160 = !!(own_he_cap.he_cap_elem.phy_cap_info[0] &
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G);
+ peer_160 = !!(he_cap->he_cap_elem.phy_cap_info[0] &
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G);
+
+ if (peer_160 && own_160) {
+ ieee80211_he_mcs_intersection(&own_he_cap.he_mcs_nss_supp.rx_mcs_160,
+ &he_cap->he_mcs_nss_supp.rx_mcs_160,
+ &own_he_cap.he_mcs_nss_supp.tx_mcs_160,
+ &he_cap->he_mcs_nss_supp.tx_mcs_160);
+ } else if (peer_160 && !own_160) {
+ ieee80211_he_mcs_disable(&he_cap->he_mcs_nss_supp.rx_mcs_160);
+ ieee80211_he_mcs_disable(&he_cap->he_mcs_nss_supp.tx_mcs_160);
+ }
+
+ own_80p80 = !!(own_he_cap.he_cap_elem.phy_cap_info[0] &
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G);
+ peer_80p80 = !!(he_cap->he_cap_elem.phy_cap_info[0] &
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G);
+
+ if (peer_80p80 && own_80p80) {
+ ieee80211_he_mcs_intersection(&own_he_cap.he_mcs_nss_supp.rx_mcs_80p80,
+ &he_cap->he_mcs_nss_supp.rx_mcs_80p80,
+ &own_he_cap.he_mcs_nss_supp.tx_mcs_80p80,
+ &he_cap->he_mcs_nss_supp.tx_mcs_80p80);
+ } else if (peer_80p80 && !own_80p80) {
+ ieee80211_he_mcs_disable(&he_cap->he_mcs_nss_supp.rx_mcs_80p80);
+ ieee80211_he_mcs_disable(&he_cap->he_mcs_nss_supp.tx_mcs_80p80);
+ }
}

void
--
2.23.0


2020-12-23 20:26:27

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] mac80211: do intersection with he mcs and nss set of peer and own

Hi Wen,

Thank you for the patch! Perhaps something to improve:

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

url: https://github.com/0day-ci/linux/commits/Wen-Gong/mac80211-do-intersection-with-he-mcs-and-nss-set-of-peer-and-own/20201222-103106
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: nds32-randconfig-p002-20201222 (attached as .config)
compiler: nds32le-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
# https://github.com/0day-ci/linux/commit/68bea73c7cc3c3640743b1ea62940dd03fcee14f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wen-Gong/mac80211-do-intersection-with-he-mcs-and-nss-set-of-peer-and-own/20201222-103106
git checkout 68bea73c7cc3c3640743b1ea62940dd03fcee14f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> net/mac80211/he.c:56:1: warning: no previous prototype for 'ieee80211_he_mcs_disable' [-Wmissing-prototypes]
56 | ieee80211_he_mcs_disable(u16 *he_mcs)
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> net/mac80211/he.c:65:1: warning: no previous prototype for 'ieee80211_he_mcs_intersection' [-Wmissing-prototypes]
65 | ieee80211_he_mcs_intersection(u16 *he_own_rx, u16 *he_peer_rx,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/ieee80211_he_mcs_disable +56 net/mac80211/he.c

54
55 void
> 56 ieee80211_he_mcs_disable(u16 *he_mcs)
57 {
58 u32 i;
59
60 for (i = 0; i < 8; i++)
61 *he_mcs |= cpu_to_le16(IEEE80211_HE_MCS_NOT_SUPPORTED << i * 2);
62 }
63
64 void
> 65 ieee80211_he_mcs_intersection(u16 *he_own_rx, u16 *he_peer_rx,
66 u16 *he_own_tx, u16 *he_peer_tx)
67 {
68 u32 i;
69 u16 own_rx, own_tx, peer_rx, peer_tx;
70
71 for (i = 0; i < 8; i++) {
72 own_rx = le16_to_cpu(*he_own_rx);
73 own_rx = (own_rx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
74
75 own_tx = le16_to_cpu(*he_own_tx);
76 own_tx = (own_tx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
77
78 peer_rx = le16_to_cpu(*he_peer_rx);
79 peer_rx = (peer_rx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
80
81 peer_tx = le16_to_cpu(*he_peer_tx);
82 peer_tx = (peer_tx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
83
84 if (peer_tx != IEEE80211_HE_MCS_NOT_SUPPORTED) {
85 if (own_rx == IEEE80211_HE_MCS_NOT_SUPPORTED)
86 peer_tx = IEEE80211_HE_MCS_NOT_SUPPORTED;
87 else if (own_rx < peer_tx)
88 peer_tx = own_rx;
89 }
90
91 if (peer_rx != IEEE80211_HE_MCS_NOT_SUPPORTED) {
92 if (own_tx == IEEE80211_HE_MCS_NOT_SUPPORTED)
93 peer_rx = IEEE80211_HE_MCS_NOT_SUPPORTED;
94 else if (own_tx < peer_rx)
95 peer_rx = own_tx;
96 }
97
98 *he_peer_rx &=
99 ~cpu_to_le16(IEEE80211_HE_MCS_NOT_SUPPORTED << i * 2);
100 *he_peer_rx |= cpu_to_le16(peer_rx << i * 2);
101
102 *he_peer_tx &=
103 ~cpu_to_le16(IEEE80211_HE_MCS_NOT_SUPPORTED << i * 2);
104 *he_peer_tx |= cpu_to_le16(peer_tx << i * 2);
105 }
106 }
107

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (3.90 kB)
.config.gz (35.42 kB)
Download all attachments