From patchwork Wed Mar 1 09:02:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinyue Ling X-Patchwork-Id: 658440 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 D5E34C64ED6 for ; Wed, 1 Mar 2023 09:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229851AbjCAJDG (ORCPT ); Wed, 1 Mar 2023 04:03:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbjCAJDD (ORCPT ); Wed, 1 Mar 2023 04:03:03 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0062A5FE for ; Wed, 1 Mar 2023 01:03:02 -0800 (PST) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3215V2K0014914; Wed, 1 Mar 2023 09:02:59 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-transfer-encoding : content-type; s=qcppdkim1; bh=Mfp5IdVj8Zpc/ABjF/cpxUOl3mlW2v7VhyyntE4ax6k=; b=K39EEx5I+xQZGnwTSC8aMTpcbMef6ViKifIga3MKsEW7ffk3P++gOqNhQBtXlU2BWxoc Q71QIaZajQZ7B9X6aAw2hGKU+bW360ZO16gBdu1PCX66Kidbw+lnpSA92Ble95CmPWpT mXUrHylPgS7IcTynNyfTcgwUN2ejSDg/EJWHCMG15ZEItRPNStdPj4pAkdw/H9xX4Y1e DjW0RmholV2Fxps56fGYwJcPQKeyOx7jtVeOci70RDwwTdClzW94jLOOWTNlGbsuCPqd Bw9e9EAbXYycAjgf0dR56WbwqglD+bhshDHaVjRU14x7pbpU7W3qKN7mS8fNwUf2+LnZ Dg== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p20j2gr1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Mar 2023 09:02:59 +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 32192w3O012515 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 1 Mar 2023 09:02:58 GMT Received: from xinyling-gv.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.41; Wed, 1 Mar 2023 01:02:57 -0800 From: Xinyue Ling To: CC: Subject: [PATCH 1/4] nl80211: Add 4/8/16 MHz BSS control channel width definitions Date: Wed, 1 Mar 2023 17:02:39 +0800 Message-ID: <20230301090242.1613672-2-quic_xinyling@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230301090242.1613672-1-quic_xinyling@quicinc.com> References: <20230301090242.1613672-1-quic_xinyling@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: DSfqUBBxDiOUM_AkMou3XtZCdSq-l93I X-Proofpoint-GUID: DSfqUBBxDiOUM_AkMou3XtZCdSq-l93I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-01_04,2023-02-28_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 spamscore=0 mlxlogscore=518 priorityscore=1501 impostorscore=0 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303010074 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add definitions in enum nl80211_bss_scan_width to support 4/8/16 MHz BSS control channel width defined in IEEE Std 802.11ah-2016. Signed-off-by: Xinyue Ling --- include/uapi/linux/nl80211.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 8ecb0fbee721..3f15ac05f581 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4903,6 +4903,9 @@ enum nl80211_chan_width { * @NL80211_BSS_CHAN_WIDTH_5: control channel is 5 MHz wide * @NL80211_BSS_CHAN_WIDTH_1: control channel is 1 MHz wide * @NL80211_BSS_CHAN_WIDTH_2: control channel is 2 MHz wide + * @NL80211_BSS_CHAN_WIDTH_4: control channel is 4 MHz wide + * @NL80211_BSS_CHAN_WIDTH_8: control channel is 8 MHz wide + * @NL80211_BSS_CHAN_WIDTH_16: control channel is 16 MHz wide */ enum nl80211_bss_scan_width { NL80211_BSS_CHAN_WIDTH_20, @@ -4910,6 +4913,9 @@ enum nl80211_bss_scan_width { NL80211_BSS_CHAN_WIDTH_5, NL80211_BSS_CHAN_WIDTH_1, NL80211_BSS_CHAN_WIDTH_2, + NL80211_BSS_CHAN_WIDTH_4, + NL80211_BSS_CHAN_WIDTH_8, + NL80211_BSS_CHAN_WIDTH_16, }; /** From patchwork Wed Mar 1 09:02:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinyue Ling X-Patchwork-Id: 658110 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 78306C64ED6 for ; Wed, 1 Mar 2023 09:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbjCAJDL (ORCPT ); Wed, 1 Mar 2023 04:03:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbjCAJDF (ORCPT ); Wed, 1 Mar 2023 04:03:05 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C747287 for ; Wed, 1 Mar 2023 01:03:03 -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 32130nA8011786; Wed, 1 Mar 2023 09:03:01 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-transfer-encoding : content-type; s=qcppdkim1; bh=rh8U/n+GqKfNEzGtWoJRFqlsI+NmNbFEiya0KKIQDCo=; b=NS7f3GuFCobk49ChlN0xFI+I7mxqFQI+RQELrp+ZKyy1yLipIvXGhOLqn1T8asAA4Kut VgBcS47U9pds8tMpUSsZ2QEWQhpplca44ONq4OOcfNb3dmnTO0zgxT7FsOskwlNltNwc tXYr9OyCjU5YWPRD5FcRWt5b4s5qWUOT7H5bRP0S+1BHd/Qv44bu3gyIf5X+bQ5gUzIt LmNfH6RYECMJQ/qdfP7agm4tJq/i4gkdGEsI5HG2opKp0FAeP5jnEETjSWmgPhL5Sev5 P5WhTnqmaDsRCWpJrJ/JIWLgddiVsKVf73qw+9N+8DxAbSgPGKWBbUDLaeGGalLKTtpk 7w== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p155652qg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Mar 2023 09:03:01 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 321930Oo021666 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 1 Mar 2023 09:03:00 GMT Received: from xinyling-gv.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.41; Wed, 1 Mar 2023 01:02:58 -0800 From: Xinyue Ling To: CC: Subject: [PATCH 2/4] wifi: nl80211: Add support to specify channel width for scan (option 1) Date: Wed, 1 Mar 2023 17:02:40 +0800 Message-ID: <20230301090242.1613672-3-quic_xinyling@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230301090242.1613672-1-quic_xinyling@quicinc.com> References: <20230301090242.1613672-1-quic_xinyling@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: Glw8L6lD0dlmMog_ve9tAmqEP3egfQXC X-Proofpoint-GUID: Glw8L6lD0dlmMog_ve9tAmqEP3egfQXC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-01_04,2023-02-28_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 clxscore=1015 impostorscore=0 adultscore=0 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303010074 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add support to parse NL80211_ATTR_CHANNEL_WIDTH attribute and convert it from enum nl80211_chan_width semantics to enum nl80211_bss_scan_width semantics for nl80211_commands NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN. Also add a new scan_width_set flag in the scan request sent to the driver to indicate whether the scan channel width is passed from the userspace. If channel width lower than 20 MHz is specified, it will be converted from enum nl80211_chan_width value to the corresponding enum nl80211_bss_scan_width value and it is expected that only BSSs using this channel width can be found. If 20 MHz or higher channel width is specified, it is expected that all the BSSs using 20 MHz or higher channel width can be found as their management frames can be received on the primary 20 MHz channel. If this attribute is not passed from the userspace, the scan channel width will be decided by the driver. One example for such use case is connection between drone and drone controller, userspace may need to specify the scan channel width, which needs to be passed to the driver to trigger the scan on this specified channel width. Signed-off-by: Xinyue Ling --- include/net/cfg80211.h | 6 +++++ include/uapi/linux/nl80211.h | 19 ++++++++++++++- net/wireless/nl80211.c | 47 +++++++++++++++++++++++++++++++++++- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 54a77d906b2d..bbf566190a87 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2400,6 +2400,8 @@ struct cfg80211_scan_6ghz_params { * @channels: channels to scan on. * @n_channels: total number of channels to scan * @scan_width: channel width for scanning + * @scan_width_set: channel width for scanning is specified from the + * userspace * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets * @duration: how long to listen on each channel, in TUs. If @@ -2430,6 +2432,7 @@ struct cfg80211_scan_request { int n_ssids; u32 n_channels; enum nl80211_bss_scan_width scan_width; + bool scan_width_set; const u8 *ie; size_t ie_len; u16 duration; @@ -2525,6 +2528,8 @@ struct cfg80211_bss_select_adjust { * @n_ssids: number of SSIDs * @n_channels: total number of channels to scan * @scan_width: channel width for scanning + * @scan_width_set: channel width for scanning is specified from the + * userspace * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets * @flags: bit field of flags controlling operation @@ -2573,6 +2578,7 @@ struct cfg80211_sched_scan_request { int n_ssids; u32 n_channels; enum nl80211_bss_scan_width scan_width; + bool scan_width_set; const u8 *ie; size_t ie_len; u32 flags; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 3f15ac05f581..03b60d987a1b 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -501,7 +501,13 @@ * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the * probe requests at CCK rate or not. %NL80211_ATTR_BSSID can be used to * specify a BSSID to scan for; if not included, the wildcard BSSID will - * be used. + * be used. %NL80211_ATTR_CHANNEL_WIDTH can be passed from the userspace + * to specify the scan channel bandwidth; if channel bandwidth lower than + * 20 MHz is specified, it is expected that only BSSs using this channel + * bandwidth can be found; if 20 MHz or higher channel bandwidth is + * specified, it is expected that all the BSSs using 20 MHz or higher + * channel bandwidth can be found; if not included, the scan channel + * bandwidth will be decided by the driver. * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to * NL80211_CMD_GET_SCAN and on the "scan" multicast group) * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, @@ -530,6 +536,13 @@ * is supplied. If the device supports multiple concurrent scheduled * scans, it will allow such when the caller provides the flag attribute * %NL80211_ATTR_SCHED_SCAN_MULTI to indicate user-space support for it. + * %NL80211_ATTR_CHANNEL_WIDTH can be passed from the userspace to specify + * the scan channel width; if channel bandwidth lower than 20 MHz is + * specified, it is expected that only BSSs using this channel bandwidth + * can be found; if 20 MHz or higher channel bandwidth is specified, it is + * expected that all the BSSs using 20 MHz or higher channel bandwidth can + * be found; if not included, the scan channel bandwidth will be decided by + * the driver. * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if * scheduled scan is not running. The caller may assume that as soon * as the call returns, it is safe to start a new scheduled scan again. @@ -4875,6 +4888,8 @@ enum nl80211_key_mode { * @NL80211_CHAN_WIDTH_16: 16 MHz OFDM channel * @NL80211_CHAN_WIDTH_320: 320 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * attribute must be provided as well + * @NUM_NL80211_CHAN_WIDTH: number of values, avoid using this in userspace + * since newer kernel versions may support more channel widths */ enum nl80211_chan_width { NL80211_CHAN_WIDTH_20_NOHT, @@ -4891,6 +4906,8 @@ enum nl80211_chan_width { NL80211_CHAN_WIDTH_8, NL80211_CHAN_WIDTH_16, NL80211_CHAN_WIDTH_320, + + NUM_NL80211_CHAN_WIDTH }; /** diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 64cf6110ce9d..2048a98c3273 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -478,7 +478,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { NL80211_EDMG_BW_CONFIG_MIN, NL80211_EDMG_BW_CONFIG_MAX), - [NL80211_ATTR_CHANNEL_WIDTH] = { .type = NLA_U32 }, + [NL80211_ATTR_CHANNEL_WIDTH] = + NLA_POLICY_MAX(NLA_U32, NUM_NL80211_CHAN_WIDTH), [NL80211_ATTR_CENTER_FREQ1] = { .type = NLA_U32 }, [NL80211_ATTR_CENTER_FREQ1_OFFSET] = NLA_POLICY_RANGE(NLA_U32, 0, 999), [NL80211_ATTR_CENTER_FREQ2] = { .type = NLA_U32 }, @@ -8924,6 +8925,34 @@ nl80211_check_scan_flags(struct wiphy *wiphy, struct wireless_dev *wdev, return 0; } +static enum nl80211_bss_scan_width +chan_width_to_scan_width(enum nl80211_chan_width width) +{ + switch (width) { + case NL80211_CHAN_WIDTH_5: + return NL80211_BSS_CHAN_WIDTH_5; + case NL80211_CHAN_WIDTH_10: + return NL80211_BSS_CHAN_WIDTH_10; + case NL80211_CHAN_WIDTH_1: + return NL80211_BSS_CHAN_WIDTH_1; + case NL80211_CHAN_WIDTH_2: + return NL80211_BSS_CHAN_WIDTH_2; + case NL80211_CHAN_WIDTH_4: + return NL80211_BSS_CHAN_WIDTH_4; + case NL80211_CHAN_WIDTH_8: + return NL80211_BSS_CHAN_WIDTH_8; + case NL80211_CHAN_WIDTH_16: + return NL80211_BSS_CHAN_WIDTH_16; + default: + /* for the rest of channel bandwidth values (20 MHz or higher), + * scan channel bandwidth can be set to NL80211_BSS_CHAN_WIDTH_20 + * as management frames of BSSs using 20 MHz or higher channel + * can be received on the primary 20 MHz channel + */ + return NL80211_BSS_CHAN_WIDTH_20; + } +} + static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; @@ -9120,6 +9149,14 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) nla_get_flag(info->attrs[NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY]); } + if (info->attrs[NL80211_ATTR_CHANNEL_WIDTH]) { + enum nl80211_chan_width chan_width; + + chan_width = nla_get_u32(info->attrs[NL80211_ATTR_CHANNEL_WIDTH]); + request->scan_width = chan_width_to_scan_width(chan_width); + request->scan_width_set = true; + } + err = nl80211_check_scan_flags(wiphy, wdev, request, info->attrs, false); if (err) @@ -9611,6 +9648,14 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, request->ie_len); } + if (attrs[NL80211_ATTR_CHANNEL_WIDTH]) { + enum nl80211_chan_width chan_width; + + chan_width = nla_get_u32(attrs[NL80211_ATTR_CHANNEL_WIDTH]); + request->scan_width = chan_width_to_scan_width(chan_width); + request->scan_width_set = true; + } + err = nl80211_check_scan_flags(wiphy, wdev, request, attrs, true); if (err) goto out_free; From patchwork Wed Mar 1 09:02:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinyue Ling X-Patchwork-Id: 658109 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 3312DC7EE30 for ; Wed, 1 Mar 2023 09:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbjCAJDO (ORCPT ); Wed, 1 Mar 2023 04:03:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229888AbjCAJDI (ORCPT ); Wed, 1 Mar 2023 04:03:08 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38D1E1116E for ; Wed, 1 Mar 2023 01:03:05 -0800 (PST) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3216digh011946; Wed, 1 Mar 2023 09:03:02 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-transfer-encoding : content-type; s=qcppdkim1; bh=CmagkZxfxWP0JvogyCUmJDghC9cVRTC80UqNK/ZHT4U=; b=TzuuLaI5QC8MJeqxOdPv1F59OQ6+vW/87bUja06MhmDdKg7CeoicOcgefXw9NeTV1fdz D8G7QEvlXRfKwtAJQ6Byl+LNhyFtKh/rNamq+iJbhdBDNX8LiOmLOakzY/jUW3hauYgb Tn4P3ReEfV3dnB7jwVirxXveWKO0rbog126W461Qbb7SmaiRlKVbKPCQbGuHPaBcsT1O n9m6yysJKpyyA17l65Akj+3mQl8un32K/2JooOhQz93uZfTEAmOx++PB8YnxES0fsj6g 7JZ/QDSAl2mSPQ79GVZFVy+5DtKCpM8EeUu45Rtz4udxxApBEe2izv8bybNoCh/gs7L3 Sg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p1f7n3mm5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Mar 2023 09:03:01 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 321931bC019653 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 1 Mar 2023 09:03:01 GMT Received: from xinyling-gv.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.41; Wed, 1 Mar 2023 01:03:00 -0800 From: Xinyue Ling To: CC: Subject: [PATCH 3/4] Revert "wifi: nl80211: Add support to specify channel width for scan (option 1)" Date: Wed, 1 Mar 2023 17:02:41 +0800 Message-ID: <20230301090242.1613672-4-quic_xinyling@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230301090242.1613672-1-quic_xinyling@quicinc.com> References: <20230301090242.1613672-1-quic_xinyling@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: ccxcNQZ-QziuYwU382qFbMLDG8rIxJLQ X-Proofpoint-ORIG-GUID: ccxcNQZ-QziuYwU382qFbMLDG8rIxJLQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-01_04,2023-02-28_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303010074 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --- include/net/cfg80211.h | 6 ----- include/uapi/linux/nl80211.h | 19 +-------------- net/wireless/nl80211.c | 47 +----------------------------------- 3 files changed, 2 insertions(+), 70 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index bbf566190a87..54a77d906b2d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2400,8 +2400,6 @@ struct cfg80211_scan_6ghz_params { * @channels: channels to scan on. * @n_channels: total number of channels to scan * @scan_width: channel width for scanning - * @scan_width_set: channel width for scanning is specified from the - * userspace * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets * @duration: how long to listen on each channel, in TUs. If @@ -2432,7 +2430,6 @@ struct cfg80211_scan_request { int n_ssids; u32 n_channels; enum nl80211_bss_scan_width scan_width; - bool scan_width_set; const u8 *ie; size_t ie_len; u16 duration; @@ -2528,8 +2525,6 @@ struct cfg80211_bss_select_adjust { * @n_ssids: number of SSIDs * @n_channels: total number of channels to scan * @scan_width: channel width for scanning - * @scan_width_set: channel width for scanning is specified from the - * userspace * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets * @flags: bit field of flags controlling operation @@ -2578,7 +2573,6 @@ struct cfg80211_sched_scan_request { int n_ssids; u32 n_channels; enum nl80211_bss_scan_width scan_width; - bool scan_width_set; const u8 *ie; size_t ie_len; u32 flags; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 03b60d987a1b..3f15ac05f581 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -501,13 +501,7 @@ * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the * probe requests at CCK rate or not. %NL80211_ATTR_BSSID can be used to * specify a BSSID to scan for; if not included, the wildcard BSSID will - * be used. %NL80211_ATTR_CHANNEL_WIDTH can be passed from the userspace - * to specify the scan channel bandwidth; if channel bandwidth lower than - * 20 MHz is specified, it is expected that only BSSs using this channel - * bandwidth can be found; if 20 MHz or higher channel bandwidth is - * specified, it is expected that all the BSSs using 20 MHz or higher - * channel bandwidth can be found; if not included, the scan channel - * bandwidth will be decided by the driver. + * be used. * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to * NL80211_CMD_GET_SCAN and on the "scan" multicast group) * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, @@ -536,13 +530,6 @@ * is supplied. If the device supports multiple concurrent scheduled * scans, it will allow such when the caller provides the flag attribute * %NL80211_ATTR_SCHED_SCAN_MULTI to indicate user-space support for it. - * %NL80211_ATTR_CHANNEL_WIDTH can be passed from the userspace to specify - * the scan channel width; if channel bandwidth lower than 20 MHz is - * specified, it is expected that only BSSs using this channel bandwidth - * can be found; if 20 MHz or higher channel bandwidth is specified, it is - * expected that all the BSSs using 20 MHz or higher channel bandwidth can - * be found; if not included, the scan channel bandwidth will be decided by - * the driver. * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if * scheduled scan is not running. The caller may assume that as soon * as the call returns, it is safe to start a new scheduled scan again. @@ -4888,8 +4875,6 @@ enum nl80211_key_mode { * @NL80211_CHAN_WIDTH_16: 16 MHz OFDM channel * @NL80211_CHAN_WIDTH_320: 320 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * attribute must be provided as well - * @NUM_NL80211_CHAN_WIDTH: number of values, avoid using this in userspace - * since newer kernel versions may support more channel widths */ enum nl80211_chan_width { NL80211_CHAN_WIDTH_20_NOHT, @@ -4906,8 +4891,6 @@ enum nl80211_chan_width { NL80211_CHAN_WIDTH_8, NL80211_CHAN_WIDTH_16, NL80211_CHAN_WIDTH_320, - - NUM_NL80211_CHAN_WIDTH }; /** diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 2048a98c3273..64cf6110ce9d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -478,8 +478,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { NL80211_EDMG_BW_CONFIG_MIN, NL80211_EDMG_BW_CONFIG_MAX), - [NL80211_ATTR_CHANNEL_WIDTH] = - NLA_POLICY_MAX(NLA_U32, NUM_NL80211_CHAN_WIDTH), + [NL80211_ATTR_CHANNEL_WIDTH] = { .type = NLA_U32 }, [NL80211_ATTR_CENTER_FREQ1] = { .type = NLA_U32 }, [NL80211_ATTR_CENTER_FREQ1_OFFSET] = NLA_POLICY_RANGE(NLA_U32, 0, 999), [NL80211_ATTR_CENTER_FREQ2] = { .type = NLA_U32 }, @@ -8925,34 +8924,6 @@ nl80211_check_scan_flags(struct wiphy *wiphy, struct wireless_dev *wdev, return 0; } -static enum nl80211_bss_scan_width -chan_width_to_scan_width(enum nl80211_chan_width width) -{ - switch (width) { - case NL80211_CHAN_WIDTH_5: - return NL80211_BSS_CHAN_WIDTH_5; - case NL80211_CHAN_WIDTH_10: - return NL80211_BSS_CHAN_WIDTH_10; - case NL80211_CHAN_WIDTH_1: - return NL80211_BSS_CHAN_WIDTH_1; - case NL80211_CHAN_WIDTH_2: - return NL80211_BSS_CHAN_WIDTH_2; - case NL80211_CHAN_WIDTH_4: - return NL80211_BSS_CHAN_WIDTH_4; - case NL80211_CHAN_WIDTH_8: - return NL80211_BSS_CHAN_WIDTH_8; - case NL80211_CHAN_WIDTH_16: - return NL80211_BSS_CHAN_WIDTH_16; - default: - /* for the rest of channel bandwidth values (20 MHz or higher), - * scan channel bandwidth can be set to NL80211_BSS_CHAN_WIDTH_20 - * as management frames of BSSs using 20 MHz or higher channel - * can be received on the primary 20 MHz channel - */ - return NL80211_BSS_CHAN_WIDTH_20; - } -} - static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; @@ -9149,14 +9120,6 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) nla_get_flag(info->attrs[NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY]); } - if (info->attrs[NL80211_ATTR_CHANNEL_WIDTH]) { - enum nl80211_chan_width chan_width; - - chan_width = nla_get_u32(info->attrs[NL80211_ATTR_CHANNEL_WIDTH]); - request->scan_width = chan_width_to_scan_width(chan_width); - request->scan_width_set = true; - } - err = nl80211_check_scan_flags(wiphy, wdev, request, info->attrs, false); if (err) @@ -9648,14 +9611,6 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, request->ie_len); } - if (attrs[NL80211_ATTR_CHANNEL_WIDTH]) { - enum nl80211_chan_width chan_width; - - chan_width = nla_get_u32(attrs[NL80211_ATTR_CHANNEL_WIDTH]); - request->scan_width = chan_width_to_scan_width(chan_width); - request->scan_width_set = true; - } - err = nl80211_check_scan_flags(wiphy, wdev, request, attrs, true); if (err) goto out_free; From patchwork Wed Mar 1 09:02:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinyue Ling X-Patchwork-Id: 658439 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 E908EC64EC7 for ; Wed, 1 Mar 2023 09:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229898AbjCAJDN (ORCPT ); Wed, 1 Mar 2023 04:03:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbjCAJDI (ORCPT ); Wed, 1 Mar 2023 04:03:08 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E4918169 for ; Wed, 1 Mar 2023 01:03:06 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3215GCa1025277; Wed, 1 Mar 2023 09:03: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-transfer-encoding : content-type; s=qcppdkim1; bh=05IUkyatxDgyOHt20aKDwtsxSQ/lwu0l7Laau5u7w/M=; b=kIIXSTyBLZ0LHGZq/utTIgiqTBRXgttJ+MCDAk6IaHocvwqo3awjSPR5Sp/YxY2LlcqL Ef+6X7Qflass0ReukoQe3UTrBK79rHnC5rrGxhPw7dMbU+48MECqtjyfveem3JLAvsvG gk0gBFSu3YfTDZ+kdNuT+FEoKZ56dVkpKv/k5kYG5dyb60e00mgiDGpSd8TyjOmaHEWa K3wEvGCQez39CUcMM134n48c0an+pN9ZRJLiAIYm76fsyQ3ciehVICojc2bq5nB+X+YA xrxjo6YNLnxNGHezU1Dve8OtTuegysJeBfLcHnrgzlncZ50cpSbqLO/Aj0bZFF7qo4yl ww== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p1n0tjdt5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Mar 2023 09:03:03 +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 321932xF012570 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 1 Mar 2023 09:03:02 GMT Received: from xinyling-gv.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.41; Wed, 1 Mar 2023 01:03:01 -0800 From: Xinyue Ling To: CC: Subject: [PATCH 4/4] wifi: nl80211: Add support to specify channel width for scan (option 2) Date: Wed, 1 Mar 2023 17:02:42 +0800 Message-ID: <20230301090242.1613672-5-quic_xinyling@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230301090242.1613672-1-quic_xinyling@quicinc.com> References: <20230301090242.1613672-1-quic_xinyling@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: Rln5wfIcmDdph6YpMbafRRH7rEtMZb5v X-Proofpoint-GUID: Rln5wfIcmDdph6YpMbafRRH7rEtMZb5v X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-01_04,2023-02-28_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 malwarescore=0 adultscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303010074 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Introduce a new NL80211_ATTR_SCAN_CHANNEL_WIDTH attribute with enum nl80211_bss_scan_width semantics and add support to parse it for nl80211_commands NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN. Also add a new scan_width_set flag in the scan request sent to the driver to indicate whether the scan channel width is passed from the userspace. If channel width lower than 20 MHz is specified, it is expected that only BSSs using this channel width can be found. If 20 MHz or higher channel width is specified, it is expected that all the BSSs using 20 MHz or higher channel width can be found as their management frames can be received on the primary 20 MHz channel. If this attribute is not passed from the userspace, the scan channel width will be decided by the driver. One example for such use case is connection between drone and drone controller, userspace may need to specify the scan channel width, which needs to be passed to the driver to trigger the scan on this specified channel width. Signed-off-by: Xinyue Ling --- include/net/cfg80211.h | 6 ++++++ include/uapi/linux/nl80211.h | 28 ++++++++++++++++++++++++++-- net/wireless/nl80211.c | 14 ++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 54a77d906b2d..bbf566190a87 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2400,6 +2400,8 @@ struct cfg80211_scan_6ghz_params { * @channels: channels to scan on. * @n_channels: total number of channels to scan * @scan_width: channel width for scanning + * @scan_width_set: channel width for scanning is specified from the + * userspace * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets * @duration: how long to listen on each channel, in TUs. If @@ -2430,6 +2432,7 @@ struct cfg80211_scan_request { int n_ssids; u32 n_channels; enum nl80211_bss_scan_width scan_width; + bool scan_width_set; const u8 *ie; size_t ie_len; u16 duration; @@ -2525,6 +2528,8 @@ struct cfg80211_bss_select_adjust { * @n_ssids: number of SSIDs * @n_channels: total number of channels to scan * @scan_width: channel width for scanning + * @scan_width_set: channel width for scanning is specified from the + * userspace * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets * @flags: bit field of flags controlling operation @@ -2573,6 +2578,7 @@ struct cfg80211_sched_scan_request { int n_ssids; u32 n_channels; enum nl80211_bss_scan_width scan_width; + bool scan_width_set; const u8 *ie; size_t ie_len; u32 flags; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 3f15ac05f581..6d78185bb728 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -501,7 +501,13 @@ * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the * probe requests at CCK rate or not. %NL80211_ATTR_BSSID can be used to * specify a BSSID to scan for; if not included, the wildcard BSSID will - * be used. + * be used. %NL80211_ATTR_SCAN_CHANNEL_WIDTH can be passed from the + * userspace to specify the scan channel width; if channel bandwidth lower + * than 20 MHz is specified, it is expected that only BSSs using this channel + * bandwidth can be found; if 20 MHz or higher channel bandwidth channel + * bandwidth is specified, it is expected that all the BSSs using 20 MHz or + * higher channel bandwidth can be found; if not included, the scan channel + * bandwidth will be decided by the driver. * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to * NL80211_CMD_GET_SCAN and on the "scan" multicast group) * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, @@ -530,6 +536,13 @@ * is supplied. If the device supports multiple concurrent scheduled * scans, it will allow such when the caller provides the flag attribute * %NL80211_ATTR_SCHED_SCAN_MULTI to indicate user-space support for it. + * %NL80211_ATTR_SCAN_CHANNEL_WIDTH can be passed from the userspace to + * specify the scan channel width; if channel bandwidth lower than 20 MHz + * is specified, it is expected that only BSSs using this channel bandwidth + * can be found; if 20 MHz or higher channel bandwidth channel bandwidth is + * specified, it is expected that all the BSSs using 20 MHz or higher channel + * bandwidth can be found; if not included, the scan channel bandwidth will + * be decided by the driver. * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if * scheduled scan is not running. The caller may assume that as soon * as the call returns, it is safe to start a new scheduled scan again. @@ -2752,6 +2765,9 @@ enum nl80211_commands { * the incoming frame RX timestamp. * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent * (re)associations. + * @NL80211_ATTR_SCAN_CHANNEL_WIDTH: u32 attribute containing one of the + * values of &enum nl80211_bss_scan_width, describing the scan channel + * width. See the documentation of the enum for more information. * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -3281,6 +3297,8 @@ enum nl80211_attrs { NL80211_ATTR_RX_HW_TIMESTAMP, NL80211_ATTR_TD_BITMAP, + NL80211_ATTR_SCAN_CHANNEL_WIDTH, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -4896,7 +4914,8 @@ enum nl80211_chan_width { /** * enum nl80211_bss_scan_width - control channel width for a BSS * - * These values are used with the %NL80211_BSS_CHAN_WIDTH attribute. + * These values are used with the %NL80211_BSS_CHAN_WIDTH attribute + * and the %NL80211_ATTR_SCAN_CHANNEL_WIDTH attribute. * * @NL80211_BSS_CHAN_WIDTH_20: control channel is 20 MHz wide or compatible * @NL80211_BSS_CHAN_WIDTH_10: control channel is 10 MHz wide @@ -4906,6 +4925,9 @@ enum nl80211_chan_width { * @NL80211_BSS_CHAN_WIDTH_4: control channel is 4 MHz wide * @NL80211_BSS_CHAN_WIDTH_8: control channel is 8 MHz wide * @NL80211_BSS_CHAN_WIDTH_16: control channel is 16 MHz wide + * @NUM_NL80211_BSS_CHAN_WIDTH: number of values, avoid using this in + * userspace since newer kernel versions may support more channel + * widths */ enum nl80211_bss_scan_width { NL80211_BSS_CHAN_WIDTH_20, @@ -4916,6 +4938,8 @@ enum nl80211_bss_scan_width { NL80211_BSS_CHAN_WIDTH_4, NL80211_BSS_CHAN_WIDTH_8, NL80211_BSS_CHAN_WIDTH_16, + + NUM_NL80211_BSS_CHAN_WIDTH }; /** diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 64cf6110ce9d..bcafeb0691d0 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_SCAN_CHANNEL_WIDTH] = + NLA_POLICY_MAX(NLA_U32, NUM_NL80211_BSS_CHAN_WIDTH), }; /* policy for the key attributes */ @@ -9120,6 +9122,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) nla_get_flag(info->attrs[NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY]); } + if (info->attrs[NL80211_ATTR_SCAN_CHANNEL_WIDTH]) { + request->scan_width = + nla_get_u32(info->attrs[NL80211_ATTR_SCAN_CHANNEL_WIDTH]); + request->scan_width_set = true; + } + err = nl80211_check_scan_flags(wiphy, wdev, request, info->attrs, false); if (err) @@ -9611,6 +9619,12 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, request->ie_len); } + if (attrs[NL80211_ATTR_SCAN_CHANNEL_WIDTH]) { + request->scan_width = + nla_get_u32(attrs[NL80211_ATTR_SCAN_CHANNEL_WIDTH]); + request->scan_width_set = true; + } + err = nl80211_check_scan_flags(wiphy, wdev, request, attrs, true); if (err) goto out_free;