From 74cd6b31e4300bd70dd67ecfeab07231fb3436d2 Mon Sep 17 00:00:00 2001 From: Muna Sinada Date: Wed, 8 Dec 2021 23:11:27 -0800 Subject: [PATCH 1/6] ru_puncturing: retrieve driver support Retrieve the driver support for RU puncturing which is advertised using the attribute NL80211_ATTR_RU_PUNCT_SUPP_BW. Value indicates the bandwidths in which puncturing is supported - 80 MHz, 160 MHz or 320 MHz. Absence of the attribute or the value 0 means the driver does not support this feature. Signed-off-by: Muna Sinada Signed-off-by: Aloka Dixit --- hostapd/main.c | 1 + src/ap/hostapd.h | 3 +++ src/drivers/driver.h | 3 +++ src/drivers/driver_nl80211_capa.c | 18 ++++++++++++++++++ src/drivers/nl80211_copy.h | 12 ++++++++++++ 5 files changed, 37 insertions(+) diff --git a/hostapd/main.c b/hostapd/main.c index 46aa151..b155a5f 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -309,6 +309,7 @@ setup_mld: iface->extended_capa_mask = capa.extended_capa_mask; iface->extended_capa_len = capa.extended_capa_len; iface->drv_max_acl_mac_addrs = capa.max_acl_mac_addrs; + iface->ru_punct_supp_bw = capa.ru_punct_supp_bw; /* * Override extended capa with per-interface type (AP), if diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index fc3fe6e..d3aaf40 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -682,6 +682,9 @@ struct hostapd_iface { /* Maximum profile periodicity for enhanced MBSSID advertisement */ unsigned int ema_max_periodicity; + /* Minimum bandwidth the driver supports RU puncturing */ + u8 ru_punct_supp_bw; + int (*enable_iface_cb)(struct hostapd_iface *iface); int (*disable_iface_cb)(struct hostapd_iface *iface); diff --git a/src/drivers/driver.h b/src/drivers/driver.h index a9c8e9c..aaf04ab 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2443,6 +2443,9 @@ struct wpa_driver_capa { unsigned int mbssid_max_interfaces; /* Maximum profile periodicity for enhanced MBSSID advertisement */ unsigned int ema_max_periodicity; + + /* Minimum bandwidth the driver supports RU Puncturing */ + u8 ru_punct_supp_bw; }; diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 8693d7f..b4f1f5e 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -1155,6 +1155,24 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg) if (tb[NL80211_ATTR_MBSSID_CONFIG]) wiphy_info_mbssid(capa, tb[NL80211_ATTR_MBSSID_CONFIG]); + if (tb[NL80211_ATTR_RU_PUNCT_SUPP_BW]) { + u8 supp_bw = nla_get_u8(tb[NL80211_ATTR_RU_PUNCT_SUPP_BW]); + + switch (supp_bw) { + case NL80211_RU_PUNCT_SUPP_BW_80: + capa->ru_punct_supp_bw = CONF_OPER_CHWIDTH_80MHZ; + break; + case NL80211_RU_PUNCT_SUPP_BW_160: + capa->ru_punct_supp_bw = CONF_OPER_CHWIDTH_160MHZ; + break; + case NL80211_RU_PUNCT_SUPP_BW_320: + capa->ru_punct_supp_bw = CONF_OPER_CHWIDTH_320MHZ; + break; + default: + break; + } + } + if (tb[NL80211_ATTR_MLO_SUPPORT]) capa->flags2 |= WPA_DRIVER_FLAGS2_MLO; diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h index 8bd1f69..ce325cf 100644 --- a/src/drivers/nl80211_copy.h +++ b/src/drivers/nl80211_copy.h @@ -3378,7 +3378,11 @@ enum nl80211_attrs { NL80211_ATTR_AWGN_INTERFERENCE_BITMAP, - /* add attributes here, update the policy in nl80211.c */ + NL80211_ATTR_RU_PUNCT_SUPP_BW, + NL80211_ATTR_RU_PUNCT_SUPP_HE, + NL80211_ATTR_RU_PUNCT_BITMAP, + +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST, @@ -7901,4 +7905,12 @@ enum nl80211_beacon_tx_mode { NL80211_BEACON_STAGGERED_MODE = 1, NL80211_BEACON_BURST_MODE = 2, }; + +enum nl80211_ru_punct_supp_bw { + NL80211_RU_PUNCT_NOT_SUPP, + NL80211_RU_PUNCT_SUPP_BW_80, + NL80211_RU_PUNCT_SUPP_BW_160, + NL80211_RU_PUNCT_SUPP_BW_320, +}; + #endif /* __LINUX_NL80211_H */