From patchwork Fri Dec 2 18:35:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muna Sinada X-Patchwork-Id: 13063091 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB6D5C47088 for ; Fri, 2 Dec 2022 18:36:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234280AbiLBSgK (ORCPT ); Fri, 2 Dec 2022 13:36:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234232AbiLBSgI (ORCPT ); Fri, 2 Dec 2022 13:36:08 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92075ECE72 for ; Fri, 2 Dec 2022 10:36:07 -0800 (PST) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B2DULpP007950; Fri, 2 Dec 2022 18:36:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=JO5lF53ifOR7kQZOMCpR4WSj3EYLSlzC+vnRmirp/As=; b=MkQgtmr4bWhJ6EBGVoQh9wrn1J8BPKSV0b0mj6hIK423byWIDkalBLPcodlZaLnh4RDZ KtpgiE5uEIbUp4B2BkvDmcJJkNNQHsHDjTSRZ7GMP2pkqRRqciDpJnGuuI6ZaOaAYedk ET6yYFP5Sn1LGee16tDQQWsraKewC2Iv4yuW7HjfMlKj49o+WzIddlpxNNH9XKy7CwGQ op495Yx2M9o/JA6LuDQcDfjSmkcbXgrybxHITj1ntDCqcoqOpLCU0xE5DmN6EFl0Qfvg OSngV9R7QtErlPlgKVK2esHnt95q55XEucozzoXtJIjGYKdiMiFcWWKQ34O8IfsujDzB Vw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m7b82thrf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Dec 2022 18:36:04 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B2Ia34p014016 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 2 Dec 2022 18:36:03 GMT Received: from msinada-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 2 Dec 2022 10:36:02 -0800 From: Muna Sinada To: CC: , Aloka Dixit Subject: [RFC 1/4] wifi: nl80211: advertise RU puncturing support to userspace Date: Fri, 2 Dec 2022 10:35:51 -0800 Message-ID: <1670006154-6092-2-git-send-email-quic_msinada@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1670006154-6092-1-git-send-email-quic_msinada@quicinc.com> References: <1670006154-6092-1-git-send-email-quic_msinada@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 3VuLrXHqOz7Rr9H2GayTViSlf-pwN9_y X-Proofpoint-GUID: 3VuLrXHqOz7Rr9H2GayTViSlf-pwN9_y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-02_11,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 adultscore=2 mlxscore=0 clxscore=1015 malwarescore=0 impostorscore=0 spamscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212020148 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Aloka Dixit RU preamble puncturing is allowed for bandwidths more than 80 MHz except 80+80. Drivers may not support puncturing at all or have restrictions for a minimum bandwidth. Add new attribute NL80211_ATTR_RU_PUNCT_SUPP_BW to advertise the driver support to the userspace. Default value (0) will indicate that RU puncturing is not supported. Signed-off-by: Aloka Dixit --- include/net/cfg80211.h | 6 ++++++ include/uapi/linux/nl80211.h | 25 +++++++++++++++++++++++++ net/wireless/core.c | 4 ++++ net/wireless/nl80211.c | 19 +++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 11a370e64143..cb856b06a3ac 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5299,6 +5299,10 @@ struct wiphy_iftype_akm_suites { * NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with * legacy userspace and maximum allowed value is * CFG80211_MAX_NUM_AKM_SUITES. + * + * @ru_punct_supp_bw: Whether the driver supports RU puncturing, and if so, + * for which bandwidths. See &enum nl80211_ru_punct_supp_bw for the + * possible values for this field. */ struct wiphy { struct mutex mtx; @@ -5447,6 +5451,8 @@ struct wiphy { u8 ema_max_profile_periodicity; u16 max_num_akm_suites; + enum nl80211_ru_punct_supp_bw ru_punct_supp_bw; + char priv[] __aligned(NETDEV_ALIGN); }; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index c14a91bbca7c..e5218fd7b37b 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2751,7 +2751,13 @@ enum nl80211_commands { * the incoming frame RX timestamp. * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent * (re)associations. + * + * @NL80211_ATTR_RU_PUNCT_SUPP_BW: (u8) Minimum bandwidth for which + * the driver supports preamble puncturing, value should be of type + * &enum nl80211_ru_punct_supp_bw + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available + * * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */ @@ -3280,6 +3286,8 @@ enum nl80211_attrs { NL80211_ATTR_RX_HW_TIMESTAMP, NL80211_ATTR_TD_BITMAP, + NL80211_ATTR_RU_PUNCT_SUPP_BW, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -7723,4 +7731,21 @@ enum nl80211_ap_settings_flags { NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1, }; +/** + * enum nl80211_ru_punct_supp_bw - Bandwidths supporting preamble puncturing + * + * @NL80211_RU_PUNCT_NOT_SUPP: preamble puncturing is not supported + * @NL80211_RU_PUNCT_SUPP_BW_80: puncturing supported within channels of at + * least 80 MHz bandwidth + * @NL80211_RU_PUNCT_SUPP_BW_160: puncturing supported within channels of at + * least 160 MHz bandwidth + * @NL80211_RU_PUNCT_SUPP_BW_320: puncturing supported within 320 MHz. + */ +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 */ diff --git a/net/wireless/core.c b/net/wireless/core.c index 5b0c4d5b80cf..aa2a49a8ccbe 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -908,6 +908,10 @@ int wiphy_register(struct wiphy *wiphy) return -EINVAL; } + if (WARN_ON(rdev->wiphy.ru_punct_supp_bw > + NL80211_RU_PUNCT_SUPP_BW_320)) + return -EINVAL; + for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) { /* * Validate we have a policy (can be explicitly set to diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 148f66edb015..4b4cb3c64f62 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -805,6 +805,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN), [NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG }, [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT }, + [NL80211_ATTR_RU_PUNCT_SUPP_BW] = + NLA_POLICY_MAX(NLA_U8, NL80211_RU_PUNCT_SUPP_BW_320), }; /* policy for the key attributes */ @@ -2355,6 +2357,20 @@ static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg) return -ENOBUFS; } +static int +nl80211_put_ru_punct_supp_bw(struct cfg80211_registered_device *rdev, + struct sk_buff *msg) +{ + if (rdev->wiphy.ru_punct_supp_bw == NL80211_RU_PUNCT_NOT_SUPP) + return 0; + + if (nla_put_u8(msg, NL80211_ATTR_RU_PUNCT_SUPP_BW, + rdev->wiphy.ru_punct_supp_bw)) + return -ENOBUFS; + + return 0; +} + struct nl80211_dump_wiphy_state { s64 filter_wiphy; long start; @@ -2959,6 +2975,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO) nla_put_flag(msg, NL80211_ATTR_MLO_SUPPORT); + if (nl80211_put_ru_punct_supp_bw(rdev, msg)) + goto nla_put_failure; + /* done */ state->split_start = 0; break; From patchwork Fri Dec 2 18:35:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muna Sinada X-Patchwork-Id: 13063092 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88B5BC4708D for ; Fri, 2 Dec 2022 18:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234454AbiLBSgK (ORCPT ); Fri, 2 Dec 2022 13:36:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234270AbiLBSgJ (ORCPT ); Fri, 2 Dec 2022 13:36:09 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE36EC81F for ; Fri, 2 Dec 2022 10:36:08 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B2GsqFw029689; Fri, 2 Dec 2022 18:36:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=I6thWytUWxoVEXeh6j1HDPbKmXSNxM2Yhe7vM/QMu1A=; b=aYKA+3jllnXinMzCyAcE410/kjFhtTatXzo/a+Nj7HhDlRVaB9aybv/gXTZSk3r/56Vx WYMteULVqJ8Ujum17bPX1tm9e0uCiRS9i/rsLsYVrx6s5WPkLCP5vgWqaLMyZo1VvTA+ a4FuYN/yvVuF87isMyURwools21eT+6xvSCIK4sWUTiQQrrg4eEOagk097yWlaQy+ejG OfaoT3V7W23i8GjMeMX+tGcFz4ATcD6IWejMSTkWBeCEjBXpmpcsvLWGDnC7eff4M4/j x0JJY3JiRgWg7BMf4G19Vg6V5QFtsdPSEoD+L1wbWHNEfrav64FKbv5Tuj/HEqr5+Dz8 VQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m7f2dsbxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Dec 2022 18:36:06 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B2Ia5Cs022466 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 2 Dec 2022 18:36:05 GMT Received: from msinada-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 2 Dec 2022 10:36:04 -0800 From: Muna Sinada To: CC: , Aloka Dixit , Muna Sinada Subject: [RFC 2/4] wifi: cfg80211: RU puncturing bitmap Date: Fri, 2 Dec 2022 10:35:52 -0800 Message-ID: <1670006154-6092-3-git-send-email-quic_msinada@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1670006154-6092-1-git-send-email-quic_msinada@quicinc.com> References: <1670006154-6092-1-git-send-email-quic_msinada@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 8l-x8AdCHT1jcV4nOUeYoI97mzLfxA0a X-Proofpoint-ORIG-GUID: 8l-x8AdCHT1jcV4nOUeYoI97mzLfxA0a X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-02_10,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 suspectscore=0 impostorscore=0 mlxlogscore=617 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212020147 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Aloka Dixit RU puncturing bitmap consists of 16 bits, each bit corresponding to a 20 MHz channel in the operating bandwidth. Lowest bit corresponds to the lowest frequency. Bit set to 1 indicates that the channel is punctured otherwise it is active. Signed-off-by: Aloka Dixit Co-developed-by: Muna Sinada Signed-off-by: Muna Sinada --- include/net/cfg80211.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index cb856b06a3ac..b4ca8c2118ff 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -698,6 +698,11 @@ static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy) * belonging to that MU-MIMO groupID; %NULL if not changed * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring * MU-MIMO packets going to the specified station; %NULL if not changed + * @ru_punct_bitmap: RU puncturing bitmap. Each bit represents a 20 MHz channel + * with lowest bit corresponding to the lowest frequency. Bit set to 1 + * indicates that the channel is punctured, otherwise the channel is active + * @ru_punct_bitmap_supp_he: Indicates whether RU puncturing bitmap validation + * should include OFDMA bitmaps. */ struct vif_params { u32 flags; @@ -705,6 +710,8 @@ struct vif_params { u8 macaddr[ETH_ALEN]; const u8 *vht_mumimo_groups; const u8 *vht_mumimo_follow_addr; + u16 ru_punct_bitmap; + bool ru_punct_bitmap_supp_he; }; /** @@ -5732,6 +5739,12 @@ static inline void wiphy_unlock(struct wiphy *wiphy) * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr * @ap and @client for each link * @valid_links: bitmap describing what elements of @links are valid + * @ru_punct_bitmap: (private) RU puncturing bitmap. Each bit represents a + * 20 MHz channel with lowest bit corresponding to the lowest frequency. + * Bit set to 1 indicates that the channel is punctured, otherwise the + * channel is active + * @ru_punct_bitmap_supp_he: (private) Indicates whether RU puncturing bitmap + * validation should include OFDMA bitmaps. */ struct wireless_dev { struct wiphy *wiphy; @@ -5846,6 +5859,9 @@ struct wireless_dev { }; } links[IEEE80211_MLD_MAX_NUM_LINKS]; u16 valid_links; + + u16 ru_punct_bitmap; + bool ru_punct_bitmap_supp_he; }; static inline const u8 *wdev_address(struct wireless_dev *wdev) From patchwork Fri Dec 2 18:35:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muna Sinada X-Patchwork-Id: 13063093 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94DFCC4321E for ; Fri, 2 Dec 2022 18:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234463AbiLBSgL (ORCPT ); Fri, 2 Dec 2022 13:36:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234398AbiLBSgK (ORCPT ); Fri, 2 Dec 2022 13:36:10 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF030ECE72 for ; Fri, 2 Dec 2022 10:36:09 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B2EdBWf012095; Fri, 2 Dec 2022 18:36:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=5tV1fNoPXtkd0Jd2DT4ed4HOcknCcfKgPdFxxQIG6I4=; b=pIVNf5GCoxUgD1L+padQt73WjZu5DyGZ8Yn3WcHzaTqnyD4yTqeqlzxy80lvOV7kIq2w JkeQ6ETA2oxXq7rcEoghok4iqdN4ak8wE8zXiUt4CuGPYJRvRGK2YTk5vPKCGQR5lwEY yhLmhvjqQO4z59Q0unrjT5a41Vh3x2a0bu0NMYa8h811EBv6/BDCL2T2G/1gchnXvtFJ EUaQw0GLtYL99pQWUt/INS0ICgSyfff97/txGmOCCOGW79RYCOg5jp3R1agCzjutFyIU xM7xlcf2O1RVgIeBvFddg0UbkuXMPTraeBMuDX9TBl8loOXwpNynqETgikNZodYwDZtI kg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m7j3yrwfp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Dec 2022 18:36:07 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B2Ia6iQ014068 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 2 Dec 2022 18:36:06 GMT Received: from msinada-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 2 Dec 2022 10:36:06 -0800 From: Muna Sinada To: CC: , Aloka Dixit , Muna Sinada Subject: [RFC 3/4] wifi: nl80211: validate RU puncturing bitmap Date: Fri, 2 Dec 2022 10:35:53 -0800 Message-ID: <1670006154-6092-4-git-send-email-quic_msinada@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1670006154-6092-1-git-send-email-quic_msinada@quicinc.com> References: <1670006154-6092-1-git-send-email-quic_msinada@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: L0Mw7G6Iso3ajg_mUQUj2xW2OO8yI9Tv X-Proofpoint-ORIG-GUID: L0Mw7G6Iso3ajg_mUQUj2xW2OO8yI9Tv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-02_11,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 mlxlogscore=929 clxscore=1015 adultscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212020148 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Aloka Dixit Add new attributes NL80211_ATTR_RU_PUNCT_BITMAP and NL80211_ATTR_RU_PUNCT_SUPP_HE to receive RU puncturing information from the userspace. - Bitmap consists of 16 bits, each bit corresponding to a 20 MHz channel in the operating bandwidth. Lowest bit corresponds to the lowest frequency. Validate the bitmap against the minimum bandwidth support advertised by the driver. - HE support flag indicates whether OFDMA puncturing patterns should be considered during validation. Signed-off-by: Aloka Dixit Co-developed-by: Muna Sinada Signed-off-by: Muna Sinada --- include/uapi/linux/nl80211.h | 10 ++++++++++ net/wireless/nl80211.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index e5218fd7b37b..286579d56809 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2756,6 +2756,14 @@ enum nl80211_commands { * the driver supports preamble puncturing, value should be of type * &enum nl80211_ru_punct_supp_bw * + * @NL80211_ATTR_RU_PUNCT_SUPP_HE: flag attribute, used to indicate that RU + * puncturing bitmap validation should include OFDMA bitmaps. + * + * @NL80211_ATTR_RU_PUNCT_BITMAP: (u16) RU puncturing bitmap where the lowest + * bit corresponds to the lowest 20 MHz channel. Each bit set to 1 + * indicates that the sub-channel is punctured, set 0 indicates that the + * channel is active. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * * @NL80211_ATTR_MAX: highest attribute number currently defined @@ -3287,6 +3295,8 @@ enum nl80211_attrs { NL80211_ATTR_TD_BITMAP, 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 */ diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4b4cb3c64f62..fd7d83c533a8 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -807,6 +807,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT }, [NL80211_ATTR_RU_PUNCT_SUPP_BW] = NLA_POLICY_MAX(NLA_U8, NL80211_RU_PUNCT_SUPP_BW_320), + [NL80211_ATTR_RU_PUNCT_SUPP_HE] = { .type = NLA_FLAG }, + [NL80211_ATTR_RU_PUNCT_BITMAP] = { .type = NLA_U16 }, }; /* policy for the key attributes */ @@ -3192,6 +3194,38 @@ static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev) wdev->iftype == NL80211_IFTYPE_P2P_GO; } +static int nl80211_parse_ru_punct_bitmap(struct cfg80211_registered_device *rdev, + struct net_device *dev, + struct genl_info *info, + struct vif_params *params) +{ + struct wireless_dev *wdev = dev->ieee80211_ptr; + bool change = false; + + if (info->attrs[NL80211_ATTR_RU_PUNCT_BITMAP]) { + params->ru_punct_bitmap = + nla_get_u16(info->attrs[NL80211_ATTR_RU_PUNCT_BITMAP]); + + if (!params->ru_punct_bitmap) + return change; + + params->ru_punct_bitmap_supp_he = + nla_get_flag(info->attrs[NL80211_ATTR_RU_PUNCT_SUPP_HE]); + + if (!rdev->wiphy.ru_punct_supp_bw && + (params->ru_punct_bitmap || params->ru_punct_bitmap_supp_he)) + return -EOPNOTSUPP; + + changed = true; + + wdev_lock(wdev); + wdev->ru_punct_bitmap_supp_he = params->ru_punct_bitmap_supp_he; + wdev->ru_punct_bitmap = params->ru_punct_bitmap; + wdev_unlock(wdev); + + return change ? 1 : 0; +} + int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, struct genl_info *info, struct cfg80211_chan_def *chandef) @@ -4175,6 +4209,12 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) params.use_4addr = -1; } + err = nl80211_parse_ru_punct_bitmap(rdev, dev, info, ¶ms); + if (err < 0) + return err; + else if (err > 0) + change = true; + err = nl80211_parse_mon_options(rdev, ntype, info, ¶ms); if (err < 0) return err; From patchwork Fri Dec 2 18:35:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muna Sinada X-Patchwork-Id: 13063094 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 468BEC4332F for ; Fri, 2 Dec 2022 18:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234204AbiLBSgP (ORCPT ); Fri, 2 Dec 2022 13:36:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234398AbiLBSgM (ORCPT ); Fri, 2 Dec 2022 13:36:12 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB4D7ECE72 for ; Fri, 2 Dec 2022 10:36:11 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B2FjjZc012919; Fri, 2 Dec 2022 18:36:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=PhSFr3fIHFf/Bv/iCYFZyFk7T1iHwFRdGBGffgNAH0o=; b=FmBooLxr79KvC8+5jBIkoQ4jJm1v+2pNdDlpcjAAzbraYIGVT82wdcg72gFwdnOxwZWM YS5ZUXNWmAyTvC7hL7+zyDAp3D4kIV0JCaGaGhclbmP1iNovwnVaArgboCSFBuSFJGB2 x+A/zO3HYnWEBPbtBkayuHkSmUbSwg0zxmTb3cOs2mnbZ3Z4kYzOZEz9Kd5Z9moCSODI 2RebQRWwwODr0KugBy2BAS0ZEFobTB7SQ89qt2XHMXMlsXgyULn6YO2qbV4WBFcK+5yp lWDFQxGZLfQ8+f09kzdOB5lfPvlzz1gJcbxJpPr8mtz6sutUzlI/LXA6m7nS7iCT3B3Z Yw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m7f2dsby3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Dec 2022 18:36:09 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B2Ia8nn022504 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 2 Dec 2022 18:36:08 GMT Received: from msinada-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 2 Dec 2022 10:36:07 -0800 From: Muna Sinada To: CC: , Muna Sinada Subject: [RFC 4/4] wifi: mac80211: Handle RU Puncturing information Date: Fri, 2 Dec 2022 10:35:54 -0800 Message-ID: <1670006154-6092-5-git-send-email-quic_msinada@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1670006154-6092-1-git-send-email-quic_msinada@quicinc.com> References: <1670006154-6092-1-git-send-email-quic_msinada@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: E75943Ip1VuEHzExDZTv6YXC3wqoOYPj X-Proofpoint-ORIG-GUID: E75943Ip1VuEHzExDZTv6YXC3wqoOYPj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-02_10,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 suspectscore=0 impostorscore=0 mlxlogscore=733 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212020147 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Handle RU Puncturing information received from user space. RU Puncturing bitmap is initially received during ieee80211_change_iface() and stored. During AP chanwidth setting, the bitmap is validated. In addition driver is notified of new bitmap value. Signed-off-by: Muna Sinada --- net/mac80211/cfg.c | 8 ++++++++ net/mac80211/chan.c | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index c848fe04dd44..d82060d8fd4e 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -213,6 +213,12 @@ static int ieee80211_change_iface(struct wiphy *wiphy, struct sta_info *sta; int ret; + sdata->vif.bss_conf.ru_punct_bitmap = params->ru_punct_bitmap; + sdata->vif.bss_conf.ru_punct_bitmap_supp_he = params->ru_punct_bitmap_supp_he; + + if (!sdata->vif.bss_conf.ru_punct_bitmap) + sdata_dbg(sdata, "RU Puncturing Bitmap was not set by user\n"); + ret = ieee80211_if_change_type(sdata, type); if (ret) return ret; @@ -1251,6 +1257,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, prev_beacon_int = link_conf->beacon_int; link_conf->beacon_int = params->beacon_interval; + sdata->vif.bss_conf.ru_punct_bitmap = dev->ieee80211_ptr->ru_punct_bitmap; + if (params->he_cap && params->he_oper) { link_conf->he_support = true; link_conf->htc_trig_based_pkt_ext = diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index e72cf0749d49..55a1f8bb309c 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -838,6 +838,7 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, struct ieee80211_local *local = sdata->local; struct ieee80211_chanctx_conf *conf; struct ieee80211_chanctx *curr_ctx = NULL; + u64 changed; int ret = 0; if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_NAN)) @@ -882,8 +883,10 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, } if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && - sdata->vif.type != NL80211_IFTYPE_MONITOR) - ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE); + sdata->vif.type != NL80211_IFTYPE_MONITOR) { + changed |= BSS_CHANGED_IDLE | BSS_CHANGED_EHT_PUNCTURING; + ieee80211_vif_cfg_change_notify(sdata, changed); + } ieee80211_check_fast_xmit_iface(sdata); @@ -1942,6 +1945,13 @@ int ieee80211_link_change_bandwidth(struct ieee80211_link_data *link, goto out; } + if (!ieee80211_valid_disable_subchannel_bitmap( + &sdata->vif.bss_conf.ru_punct_bitmap, + chandef->width)) { + ret = -EINVAL; + goto out; + } + conf = rcu_dereference_protected(link_conf->chanctx_conf, lockdep_is_held(&local->chanctx_mtx)); if (!conf) {