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 6e54e9d66fd6..aeef81146306 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -240,6 +240,7 @@ static int hostapd_driver_init(struct hostapd_iface *iface) 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 ccc1c8514878..6cdd2c4e77d5 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -617,6 +617,9 @@ struct hostapd_iface { /* Maximum profile periodicity for enhanced MBSSID advertisements */ u8 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 4a60239be32f..2252a651c6ab 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2275,6 +2275,9 @@ struct wpa_driver_capa { u8 mbssid_max_interfaces; /* Maximum profile periodicity for enhanced MBSSID advertisements */ u8 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 dc85e21290ae..593fa47fe854 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -1100,6 +1100,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 = CHANWIDTH_80MHZ; + break; + case NL80211_RU_PUNCT_SUPP_BW_160: + capa->ru_punct_supp_bw = CHANWIDTH_160MHZ; + break; + case NL80211_RU_PUNCT_SUPP_BW_320: + capa->ru_punct_supp_bw = CHANWIDTH_320MHZ; + break; + default: + break; + } + } + return NL_SKIP; } diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h index 7666f18f3e95..77c7a8445e97 100644 --- a/src/drivers/nl80211_copy.h +++ b/src/drivers/nl80211_copy.h @@ -3120,6 +3120,10 @@ enum nl80211_attrs { NL80211_ATTR_DISABLE_EHT, + 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, @@ -7487,4 +7491,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 */ -- 2.31.1