From patchwork Tue Jun 3 16:10:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 894000 Received: from smtp9.infineon.com (smtp9.infineon.com [217.10.52.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A22F022D9F3 for ; Tue, 3 Jun 2025 16:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.52.204 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967090; cv=none; b=QixXS/NAE9vllbIcd40WcbmJAQ+xpw0PEZoDkAN8XH3IhQwgwKjJmAk/R2o07AFYB4wHdv7ySawPyP+XWbXL3DAD8fUnCdgFpZ7xYy30qXm72Kni9q8LFkfrThzoTcGwiUINFzLYbyeDiPJV4230XG5agkqCNTsGpwozf5yL+KA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967090; c=relaxed/simple; bh=hfQG8bONJBeIT9xUVOfIypYgzSzybSYfr20KUidkYMU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aZ7LLCk82yqjgE0yj6X7ny/hSim4ItwzpH0JFRKqYckJ2yDCvy7b94hFVofblub/YAgJTmCuxztR5ountPub890tVI9ppRmAqPaB+pKRukMjmMr1BZmprzvNih+wZv4B//ws/2Csw0dBsGQZPkOUa2uZHls08Cx7sukagg3J6SE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com; spf=pass smtp.mailfrom=infineon.com; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b=PN9CZlVB; arc=none smtp.client-ip=217.10.52.204 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infineon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b="PN9CZlVB" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1748967088; x=1780503088; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hfQG8bONJBeIT9xUVOfIypYgzSzybSYfr20KUidkYMU=; b=PN9CZlVBmHg7NvpVxkM3o5j7BWBM6ivEfhXtE2m0S9yK2g8p/MpdiGy/ iAYMvICZ/58QA0KDz1mksW5yHjYfwGZi+aMuPYL9aCzzAUITZ3lQ9hDvG jZOsjAIs60OYnbEjcsdh7OJjTCn6UUjBQpD3AHe8/EzOkqaq6cMPrwTMT Y=; X-CSE-ConnectionGUID: 59K9I6IxRgylc27o1xFtJA== X-CSE-MsgGUID: eMI5XRIbTj2Aeb9E7VF8GA== X-IronPort-AV: E=McAfee;i="6700,10204,11453"; a="53505905" X-IronPort-AV: E=Sophos;i="6.16,206,1744063200"; d="scan'208";a="53505905" Received: from unknown (HELO MUCSE803.infineon.com) ([172.23.29.29]) by smtp9.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2025 18:11:25 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE803.infineon.com (172.23.29.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Tue, 3 Jun 2025 18:11:25 +0200 Received: from ISCN5CG14747PP.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 3 Jun 2025 18:11:22 +0200 From: Gokul Sivakumar To: Johannes Berg , Arend van Spriel , Ajay Singh , Claudiu Beznea CC: , , , Subject: [PATCH wireless-next v3 1/5] wifi: cfg80211: Add support to indicate changed AP BSS parameters to driver Date: Tue, 3 Jun 2025 21:40:53 +0530 Message-ID: <20250603161057.19101-2-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> References: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: MUCSE817.infineon.com (172.23.29.43) To MUCSE827.infineon.com (172.23.29.20) With the userspace applications like hostapd, incase if the user explicitly enabled an AP BSS param related config file option, like "ap_isolate", or if the hostapd implicitly sets an AP BSS param like "cts_protection", then those params are sent to the cfg80211 as part of SET_BSS operation request. cfg80211 would then set the bits corresponding to the AP BSS parameters in the newly introduced "changed" bitmap. Drivers which have registered for the .change_bss() cfg80211_ops, on receiving this SET_BSS request, can now understand which specific subset of params are changed by the userspace using this bitmask. If the driver allows explicit configuration of changed AP BSS params and if the values of those params are different from default value in driver/firmware, then the driver can update it accordingly. This helps ensuring that the driver does not partially handle the AP BSS params and avoid misleading the userspace that the SET_BSS operation is fully successful. Signed-off-by: Gokul Sivakumar --- include/net/cfg80211.h | 30 ++++++++++++++++++++++++++++++ net/wireless/nl80211.c | 28 +++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d1848dc8ec99..1f069ccb411e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2326,12 +2326,41 @@ struct mpath_info { int generation; }; +/** + * enum cfg80211_bss_params_changed - BSS parameters that are being changed + * + * This enum provides information of all BSS parameters that + * have to be updated as part of change_bss() call. + * + * @CFG80211_BSS_PARAM_CHANGED_CTS_PROT: Indicates that CTS Protection changed. + * @CFG80211_BSS_PARAM_CHANGED_SHORT_PREAMBLE: Indicates that preamble changed. + * @CFG80211_BSS_PARAM_CHANGED_SHORT_SLOT_TIME: Indicates that slot timing changed. + * @CFG80211_BSS_PARAM_CHANGED_BASIC_RATES: Indicatesthat Basic Rateset changed. + * @CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE: Indicates that AP Isolation setting changed. + * @CFG80211_BSS_PARAM_CHANGED_HT_OPMODE: Indicates that HT mode to be changed. + * @CFG80211_BSS_PARAM_CHANGED_P2P_CTWINDOW: Indicates that P2P CTWindow changed. + * @CFG80211_BSS_PARAM_CHANGED_P2P_OPPPS: Indicates that P2P Opportunistic + * Power Save Mode changed. + */ +enum cfg80211_bss_params_changed { + CFG80211_BSS_PARAM_CHANGED_CTS_PROT = BIT(0), + CFG80211_BSS_PARAM_CHANGED_SHORT_PREAMBLE = BIT(1), + CFG80211_BSS_PARAM_CHANGED_SHORT_SLOT_TIME = BIT(2), + CFG80211_BSS_PARAM_CHANGED_BASIC_RATES = BIT(3), + CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE = BIT(4), + CFG80211_BSS_PARAM_CHANGED_HT_OPMODE = BIT(5), + CFG80211_BSS_PARAM_CHANGED_P2P_CTWINDOW = BIT(6), + CFG80211_BSS_PARAM_CHANGED_P2P_OPPPS = BIT(7), +}; + /** * struct bss_parameters - BSS parameters * * Used to change BSS parameters (mainly for AP mode). * * @link_id: link_id or -1 for non-MLD + * @changed: bitmask of BSS parameters being changed by the user, + * see &enum cfg80211_bss_params_changed. * @use_cts_prot: Whether to use CTS protection * (0 = no, 1 = yes, -1 = do not change) * @use_short_preamble: Whether the use of short preambles is allowed @@ -2350,6 +2379,7 @@ struct mpath_info { */ struct bss_parameters { int link_id; + u32 changed; int use_cts_prot; int use_short_preamble; int use_short_slot_time; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index fd5f79266471..719517f58110 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -8243,26 +8243,42 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) params.p2p_ctwindow = -1; params.p2p_opp_ps = -1; - if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) + if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) { params.use_cts_prot = nla_get_u8(info->attrs[NL80211_ATTR_BSS_CTS_PROT]); - if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]) + params.changed |= CFG80211_BSS_PARAM_CHANGED_CTS_PROT; + } + + if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]) { params.use_short_preamble = nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]); - if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) + params.changed |= CFG80211_BSS_PARAM_CHANGED_SHORT_PREAMBLE; + } + + if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) { params.use_short_slot_time = nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]); + params.changed |= CFG80211_BSS_PARAM_CHANGED_SHORT_SLOT_TIME; + } + if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { params.basic_rates = nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); params.basic_rates_len = nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); + params.changed |= CFG80211_BSS_PARAM_CHANGED_BASIC_RATES; } - if (info->attrs[NL80211_ATTR_AP_ISOLATE]) + + if (info->attrs[NL80211_ATTR_AP_ISOLATE]) { params.ap_isolate = !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]); - if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE]) + params.changed |= CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE; + } + + if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE]) { params.ht_opmode = nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]); + params.changed |= CFG80211_BSS_PARAM_CHANGED_HT_OPMODE; + } if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) { if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) @@ -8272,6 +8288,7 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) if (params.p2p_ctwindow != 0 && !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)) return -EINVAL; + params.changed |= CFG80211_BSS_PARAM_CHANGED_P2P_CTWINDOW; } if (info->attrs[NL80211_ATTR_P2P_OPPPS]) { @@ -8284,6 +8301,7 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) if (params.p2p_opp_ps && !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)) return -EINVAL; + params.changed |= CFG80211_BSS_PARAM_CHANGED_P2P_OPPPS; } if (!rdev->ops->change_bss) From patchwork Tue Jun 3 16:10:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 894425 Received: from smtp14.infineon.com (smtp14.infineon.com [217.10.52.160]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46A8D23D284 for ; Tue, 3 Jun 2025 16:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.52.160 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967092; cv=none; b=otqv5z1p7so+DEMD95btgbCndQS0QXZsOKnJ/W0+jbv3s2fDPfx0eqfGLH//GG2TkZ76eXigQDJyYnrOa6/PqSuJEgyeG4iN8VMjbelMZVLWIhMcuDFyIP239P4THEpbpJV/dqyhsVwVR1miilqNYLoPdaL1ZM9Lk9fS3LeajBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967092; c=relaxed/simple; bh=dPk+kEdfKAKBJnA3eb3KRCqH40i51jVmfJUSWu01TeI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b4zICHcwmYpRndmO3z4RBFUcmhQs6IA7uu/rqoVCZLk85i0mkp6Oc/PCAtMr+702WzfxzKqCTobUGPT95iFIdbScdBS2yfAORkwWNegE7axvxTxOAruEAGZycW/Rk/f/DA0Vv5fcUTf59jM73vrDZyOrPG4D7mk464XKphR0gvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com; spf=pass smtp.mailfrom=infineon.com; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b=kd1xxo07; arc=none smtp.client-ip=217.10.52.160 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infineon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b="kd1xxo07" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1748967091; x=1780503091; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dPk+kEdfKAKBJnA3eb3KRCqH40i51jVmfJUSWu01TeI=; b=kd1xxo07RI2lxDlnr+A46Kme58GWDlPC8l6/gvYtCZnSPgKDB69+7i56 5x6GMgFvzG/L07T8Jk/4br/jJEO6HNQoUQJTpOuIhI/p+/OVq4efMqQ/E QJlAeY4YI9/Epd5ZN8Ml5oGDKrbJQ0SobQr/JUhIwsm+bg0KR5oNfgTGu g=; X-CSE-ConnectionGUID: 2icU39etRPqwT1/xtlo5hw== X-CSE-MsgGUID: qbgaTObbSHCrmZX23lR5eQ== X-IronPort-AV: E=McAfee;i="6700,10204,11453"; a="87165286" X-IronPort-AV: E=Sophos;i="6.16,206,1744063200"; d="scan'208";a="87165286" Received: from unknown (HELO MUCSE822.infineon.com) ([172.23.29.53]) by smtp14.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2025 18:11:29 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE822.infineon.com (172.23.29.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 3 Jun 2025 18:11:27 +0200 Received: from ISCN5CG14747PP.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 3 Jun 2025 18:11:25 +0200 From: Gokul Sivakumar To: Johannes Berg , Arend van Spriel , Ajay Singh , Claudiu Beznea CC: , , , Subject: [PATCH wireless-next v3 2/5] wifi: brcmfmac: support AP isolation to restrict reachability between stations Date: Tue, 3 Jun 2025 21:40:54 +0530 Message-ID: <20250603161057.19101-3-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> References: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: MUCSE817.infineon.com (172.23.29.43) To MUCSE827.infineon.com (172.23.29.20) From: Wright Feng hostapd & wpa_supplicant userspace daemons exposes an AP mode specific config file parameter "ap_isolate" to the user, which is used to control low-level bridging of frames between the stations associated in the BSS. In driver, handle this user setting in the newly defined cfg80211_ops function brcmf_cfg80211_change_bss() by enabling "ap_isolate" IOVAR in the firmware. In AP mode, the "ap_isolate" value from the cfg80211 layer represents, 0 = allow low-level bridging of frames between associated stations 1 = restrict low-level bridging of frames to isolate associated stations The userspace can change more than one AP BSS Parameter in the SET_BSS operation. Incase if any BSS param other than the currently supported "ap_isolate" is passed by userspace, reject the entire SET_BSS operation instead of misleading the userspace that the operation is fully successful. Also add an individual check for the CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE flag, before handling "ap_isolate" value from the userspace. This addresses case where driver unnecessarily checks the value of ap_isolate, even if the userspace did not pass this param in the SET_BSS request. Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin Signed-off-by: Gokul Sivakumar --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index dc2383faddd1..276d08048cbb 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -5933,6 +5933,52 @@ static int brcmf_cfg80211_del_pmk(struct wiphy *wiphy, struct net_device *dev, return brcmf_set_pmk(ifp, NULL, 0); } +static int brcmf_set_ap_bssparam_isolate(struct brcmf_if *ifp, int param_ap_isolate) +{ + int ret = 0, cur_ap_isolate = 0; + + /* In cfg80211, for AP mode, the "param_ap_isolate" value represents + * 0 = allow low-level bridging of frames between associated stations + * 1 = restrict low-level bridging of frames to isolate associated stations + */ + ret = brcmf_fil_iovar_int_get(ifp, "ap_isolate", &cur_ap_isolate); + if (ret < 0) + return ret; + + if (cur_ap_isolate != param_ap_isolate) { + ret = brcmf_fil_iovar_int_set(ifp, "ap_isolate", param_ap_isolate); + if (ret < 0) { + brcmf_err("ap_isolate iovar failed: ret=%d\n", ret); + return ret; + } + } + + return ret; +} + +static int brcmf_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev, + struct bss_parameters *params) +{ + struct brcmf_if *ifp = netdev_priv(dev); + int ret = 0; + + /* Reject the operation if any of the AP BSS params that got changed are not + * supported by the driver for explicit configuration. + */ + if (params->changed & + ~(CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE)) + return -EOPNOTSUPP; + + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE) { + ret = brcmf_set_ap_bssparam_isolate(ifp, params->ap_isolate); + if (ret) + return ret; + } + + return ret; +} + static struct cfg80211_ops brcmf_cfg80211_ops = { .add_virtual_intf = brcmf_cfg80211_add_iface, .del_virtual_intf = brcmf_cfg80211_del_iface, @@ -5980,6 +6026,7 @@ static struct cfg80211_ops brcmf_cfg80211_ops = { .update_connect_params = brcmf_cfg80211_update_conn_params, .set_pmk = brcmf_cfg80211_set_pmk, .del_pmk = brcmf_cfg80211_del_pmk, + .change_bss = brcmf_cfg80211_change_bss, }; struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings) From patchwork Tue Jun 3 16:10:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 894423 Received: from smtp11.infineon.com (smtp11.infineon.com [217.10.52.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCFA323E338 for ; Tue, 3 Jun 2025 16:12:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.52.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967161; cv=none; b=NdBlXRYh9MxP/5LEGEv+7FHqZb9mY924KnNdEgammo2wU9pnPIh0YO7ftSxNuNzYTCEjKz/c76H6DbYIFAdmF3x9VPujU+Nf6FFot7d+8qRxNm2k+mq9cpZZVtCJOynllu0TGav0b5Zlj2Ybc5F7OLJ6e4UFmYeSil7Ae4r+PRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967161; c=relaxed/simple; bh=QpxyJW3KI6dSN48T8NAe3BtLqrT4OD7XzH5S94D9Nec=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qhRRbo6hdOgDIqsJKSXurdiGQa/zb0Q7INI+s+nasIwrux+cjuA+tcqb4Z82dUBNPqsu9YJICoHJhoE7fxj+6oFfMu+4lK5h4Yh5uIwihYy6+HJJdibH422+YPAaghtEWj/Q/ArxEqRjpMPcKGrq3HfdFpNNpM4Kb31Pr3FsaJQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com; spf=pass smtp.mailfrom=infineon.com; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b=IJgeIeNE; arc=none smtp.client-ip=217.10.52.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infineon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b="IJgeIeNE" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1748967160; x=1780503160; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QpxyJW3KI6dSN48T8NAe3BtLqrT4OD7XzH5S94D9Nec=; b=IJgeIeNE1oSikmJHzZYO0+L1Os17gzIeQrR+bpKui1KSpBq0tahDVf53 e9ejPwG9z4loPE9Upkqe/JpR8buHbC8s8MBQ5+gXp7ZFx81nR+F9UPTLt jSrJCivunqdZTy9lDd4eh9oExDMZn46SKffSR9OQheXvGlsSM3LqUzSpI A=; X-CSE-ConnectionGUID: QVlIz5A/SI+aAWu9I+8XvQ== X-CSE-MsgGUID: Q65vbM3GRvWZaAWi1a1YAQ== X-IronPort-AV: E=McAfee;i="6700,10204,11453"; a="97700338" X-IronPort-AV: E=Sophos;i="6.16,206,1744063200"; d="scan'208";a="97700338" Received: from unknown (HELO MUCSE819.infineon.com) ([172.23.29.45]) by smtp11.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2025 18:11:31 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE819.infineon.com (172.23.29.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 3 Jun 2025 18:11:30 +0200 Received: from ISCN5CG14747PP.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 3 Jun 2025 18:11:28 +0200 From: Gokul Sivakumar To: Johannes Berg , Arend van Spriel , Ajay Singh , Claudiu Beznea CC: , , , Subject: [PATCH wireless-next v3 3/5] wifi: wil6210: reject SET_BSS if any changed AP BSS param is not supported Date: Tue, 3 Jun 2025 21:40:55 +0530 Message-ID: <20250603161057.19101-4-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> References: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: MUCSE817.infineon.com (172.23.29.43) To MUCSE827.infineon.com (172.23.29.20) The userspace can change more than one AP BSS Parameter in the SET_BSS operation. Incase if any BSS param other than the currently supported "ap_isolate" is passed by userspace, reject the entire SET_BSS operation instead of misleading the userspace that the operation is fully successful. Also add an individual check for the CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE flag, before handling "ap_isolate" value from the userspace. This addresses case where driver unnecessarily checks the value of ap_isolate, even if the userspace did not pass this param in the SET_BSS request. Signed-off-by: Gokul Sivakumar --- drivers/net/wireless/ath/wil6210/cfg80211.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 5473c01cbe66..41df409f5fad 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -2416,7 +2416,15 @@ static int wil_cfg80211_change_bss(struct wiphy *wiphy, struct wil6210_priv *wil = wiphy_to_wil(wiphy); struct wil6210_vif *vif = ndev_to_vif(dev); - if (params->ap_isolate >= 0) { + /* Reject the operation if any of the AP BSS params that got changed are not + * supported by the driver for explicit configuration. + */ + if (params->changed & + ~(CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE)) + return -EOPNOTSUPP; + + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE) { wil_dbg_misc(wil, "change_bss: ap_isolate MID %d, %d => %d\n", vif->mid, vif->ap_isolate, params->ap_isolate); vif->ap_isolate = params->ap_isolate; From patchwork Tue Jun 3 16:10:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 893999 Received: from smtp11.infineon.com (smtp11.infineon.com [217.10.52.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B874C231833 for ; Tue, 3 Jun 2025 16:11:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.52.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967108; cv=none; b=jvK3szPjcnzrb4ROArucpoD7GB4bRsrZc7hauCEmdwY5WB3HqUoiP4JN8YjszlWaBuQIvIVaSf/r6ziLuRoD0PtbM8SBO/oSxvgqnUCAQmriA2x2UJtM534+mVu6WGRY7aSTP4foPfQ5ANyTAuVwUt1AXJecgK4aAvb0uuJS9TY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967108; c=relaxed/simple; bh=Uowr0sIP+wDxmN8p1DSg+tWmGaoaZ/UnJmKUP1z6qyc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lbFNb8qDnwoA1Fl4nuPikl1DI9QEuoub5bYIFfEmvhh+FL2+sGEFwgO+RFCwkeqooS6/ll6CsP/wTiFWBWAcBUR7DFOXfuTmxKjKS0eUPGeoPL7SrmXAfB0R45DD21tiJZWrVc6K7uZS89n+8Tbg3kuDZEM5e3FhpefMU4it7cE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com; spf=pass smtp.mailfrom=infineon.com; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b=bJCzms2h; arc=none smtp.client-ip=217.10.52.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infineon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b="bJCzms2h" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1748967107; x=1780503107; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Uowr0sIP+wDxmN8p1DSg+tWmGaoaZ/UnJmKUP1z6qyc=; b=bJCzms2hhB/6Ow6Kq/5BCb9afGLxIJHcsWBHtWE8rzkLQLdme9EwJZ6N nCiEeFP3h0uzQcNS2QMFKFDF1zGjGX5Mr+tJcuwBbpjCV8JLyf3C+FOED CUym9Lyv0BTntCGDOVv7YUpsyUgzmY0Y9TiGJYDl5EjT2fyTG8J3IS2qH w=; X-CSE-ConnectionGUID: 7ZZkmH2TSAWVwhlONpmB3A== X-CSE-MsgGUID: 7r/IemI7R7i2pb86uwmtRw== X-IronPort-AV: E=McAfee;i="6700,10204,11453"; a="97700373" X-IronPort-AV: E=Sophos;i="6.16,206,1744063200"; d="scan'208";a="97700373" Received: from unknown (HELO MUCSE814.infineon.com) ([172.23.29.40]) by smtp11.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2025 18:11:45 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE814.infineon.com (172.23.29.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Tue, 3 Jun 2025 18:11:44 +0200 Received: from ISCN5CG14747PP.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 3 Jun 2025 18:11:42 +0200 From: Gokul Sivakumar To: Johannes Berg , Arend van Spriel , Ajay Singh , Claudiu Beznea CC: , , , Subject: [PATCH wireless-next v3 4/5] wifi: wilc1000: reject SET_BSS if any changed AP BSS param is not supported Date: Tue, 3 Jun 2025 21:40:56 +0530 Message-ID: <20250603161057.19101-5-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> References: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: MUCSE803.infineon.com (172.23.29.29) To MUCSE827.infineon.com (172.23.29.20) Since the driver currently does not support setting any of the AP BSS parameters, reject the entire SET_BSS operation instead of misleading the userspace that the operation is fully successful. Signed-off-by: Gokul Sivakumar --- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index e7aa0f991923..98776ef9195b 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -797,6 +797,12 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, static int change_bss(struct wiphy *wiphy, struct net_device *dev, struct bss_parameters *params) { + /* Reject the operation if any of the AP BSS params that got changed are not + * supported by the driver for explicit configuration. + */ + if (params->changed) + return -EOPNOTSUPP; + return 0; } From patchwork Tue Jun 3 16:10:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 894424 Received: from smtp11.infineon.com (smtp11.infineon.com [217.10.52.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23C8F23D29C for ; Tue, 3 Jun 2025 16:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.52.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967111; cv=none; b=gyFxMjFEZctGF37BTi8IIQO/VKsPtbeFsByT362Hg1deeslLrfKe7j0oY/vq6fU0LN9A3RvKHMYGgf/RR1PhQaFY3/X8jI+yT6jku5euu1mChFgNE6muwdxulw+dSYDh6jF4rsWloZgsdJHMLfClqraOH0WNV5noKh8ObtOheLM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748967111; c=relaxed/simple; bh=7XqlJfRgRIX0pstX7WaOyPwSbl9XAeObAjT0ItKJ0zg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Gkb5B/RwJUSR7kFohq03kgkN4Qdc4sp5jAuvv/LfUvcVQrBmALXBq07L6MAcBg//rh9K9Yw1DjHXiQxarPt88I6gbomYcuN2XQenraoLYOJFO+zFLBojwkxooJUN2rO0zb/wC5T/trXmhAgjiGmI62+fbyQM+6h0aG4radLm5oo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com; spf=pass smtp.mailfrom=infineon.com; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b=AemH8r5i; arc=none smtp.client-ip=217.10.52.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infineon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b="AemH8r5i" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1748967110; x=1780503110; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7XqlJfRgRIX0pstX7WaOyPwSbl9XAeObAjT0ItKJ0zg=; b=AemH8r5iRWxiWo6VDFmyu4F2pBjNslgcblN2x8tZQl9ctvllHTnu+dWp 4Ilp/0/Kjj1tM0Zyv9lJV6Q4/ZPDp3Il3MBGnxL9AwJ9SY1AAN/zDBedv aznr8wgo8eyKus1c6YP5YQF6Uu3TrMChDOsxmbKiBPT9XVV10RjyZpfwf g=; X-CSE-ConnectionGUID: DZcDCEJIT7u064jNGEPUFA== X-CSE-MsgGUID: 7a1T5JUnRsS0VB7qGH/cvg== X-IronPort-AV: E=McAfee;i="6700,10204,11453"; a="97700377" X-IronPort-AV: E=Sophos;i="6.16,206,1744063200"; d="scan'208";a="97700377" Received: from unknown (HELO MUCSE812.infineon.com) ([172.23.29.38]) by smtp11.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2025 18:11:48 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE812.infineon.com (172.23.29.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Tue, 3 Jun 2025 18:11:47 +0200 Received: from ISCN5CG14747PP.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 3 Jun 2025 18:11:44 +0200 From: Gokul Sivakumar To: Johannes Berg , Arend van Spriel , Ajay Singh , Claudiu Beznea CC: , , , Subject: [PATCH wireless-next v3 5/5] wifi: mac80211: reject SET_BSS if any changed AP BSS param is not supported Date: Tue, 3 Jun 2025 21:40:57 +0530 Message-ID: <20250603161057.19101-6-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> References: <20250603161057.19101-1-gokulkumar.sivakumar@infineon.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: MUCSE803.infineon.com (172.23.29.29) To MUCSE827.infineon.com (172.23.29.20) The userspace can change more than one AP BSS Parameter in the SET_BSS operation. Incase if any BSS param other than the list of parameters currently supported for explicit configuration are passed by userspace, reject the entire SET_BSS operation. Also add an individual check for the CFG80211_BSS_PARAM_CHANGED_* flag before handling the corresponding AP BSS param value from the userspace. This addresses the case where driver unnecessarily checks the value of all the supported AP BSS params, even if the userspace did not pass some of those params in the SET_BSS request. Signed-off-by: Gokul Sivakumar --- net/mac80211/cfg.c | 54 +++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index d9d88f2f2831..8bbf9730dd0e 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2751,6 +2751,20 @@ static int ieee80211_change_bss(struct wiphy *wiphy, struct ieee80211_supported_band *sband; u64 changed = 0; + /* Reject the operation if any of the AP BSS params that got changed are not + * supported by the driver for explicit configuration. + */ + if (params->changed & + ~(CFG80211_BSS_PARAM_CHANGED_CTS_PROT | + CFG80211_BSS_PARAM_CHANGED_SHORT_PREAMBLE | + CFG80211_BSS_PARAM_CHANGED_SHORT_SLOT_TIME | + CFG80211_BSS_PARAM_CHANGED_BASIC_RATES | + CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE | + CFG80211_BSS_PARAM_CHANGED_HT_OPMODE | + CFG80211_BSS_PARAM_CHANGED_P2P_CTWINDOW | + CFG80211_BSS_PARAM_CHANGED_P2P_OPPPS)) + return -EOPNOTSUPP; + link = ieee80211_link_or_deflink(sdata, params->link_id, true); if (IS_ERR(link)) return PTR_ERR(link); @@ -2762,7 +2776,8 @@ static int ieee80211_change_bss(struct wiphy *wiphy, if (!sband) return -EINVAL; - if (params->basic_rates) { + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_BASIC_RATES) { if (!ieee80211_parse_bitrates(link->conf->chanreq.oper.width, wiphy->bands[sband->band], params->basic_rates, @@ -2773,11 +2788,13 @@ static int ieee80211_change_bss(struct wiphy *wiphy, ieee80211_check_rate_mask(link); } - if (params->use_cts_prot >= 0) { + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_CTS_PROT) { link->conf->use_cts_prot = params->use_cts_prot; changed |= BSS_CHANGED_ERP_CTS_PROT; } - if (params->use_short_preamble >= 0) { + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_SHORT_PREAMBLE) { link->conf->use_short_preamble = params->use_short_preamble; changed |= BSS_CHANGED_ERP_PREAMBLE; } @@ -2789,12 +2806,14 @@ static int ieee80211_change_bss(struct wiphy *wiphy, changed |= BSS_CHANGED_ERP_SLOT; } - if (params->use_short_slot_time >= 0) { + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_SHORT_SLOT_TIME) { link->conf->use_short_slot = params->use_short_slot_time; changed |= BSS_CHANGED_ERP_SLOT; } - if (params->ap_isolate >= 0) { + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_AP_ISOLATE) { if (params->ap_isolate) sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS; else @@ -2802,12 +2821,14 @@ static int ieee80211_change_bss(struct wiphy *wiphy, ieee80211_check_fast_rx_iface(sdata); } - if (params->ht_opmode >= 0) { + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_HT_OPMODE) { link->conf->ht_operation_mode = (u16)params->ht_opmode; changed |= BSS_CHANGED_HT; } - if (params->p2p_ctwindow >= 0) { + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_P2P_CTWINDOW) { link->conf->p2p_noa_attr.oppps_ctwindow &= ~IEEE80211_P2P_OPPPS_CTWINDOW_MASK; link->conf->p2p_noa_attr.oppps_ctwindow |= @@ -2815,14 +2836,17 @@ static int ieee80211_change_bss(struct wiphy *wiphy, changed |= BSS_CHANGED_P2P_PS; } - if (params->p2p_opp_ps > 0) { - link->conf->p2p_noa_attr.oppps_ctwindow |= - IEEE80211_P2P_OPPPS_ENABLE_BIT; - changed |= BSS_CHANGED_P2P_PS; - } else if (params->p2p_opp_ps == 0) { - link->conf->p2p_noa_attr.oppps_ctwindow &= - ~IEEE80211_P2P_OPPPS_ENABLE_BIT; - changed |= BSS_CHANGED_P2P_PS; + if (params->changed & + CFG80211_BSS_PARAM_CHANGED_P2P_OPPPS) { + if (params->p2p_opp_ps > 0) { + link->conf->p2p_noa_attr.oppps_ctwindow |= + IEEE80211_P2P_OPPPS_ENABLE_BIT; + changed |= BSS_CHANGED_P2P_PS; + } else if (params->p2p_opp_ps == 0) { + link->conf->p2p_noa_attr.oppps_ctwindow &= + ~IEEE80211_P2P_OPPPS_ENABLE_BIT; + changed |= BSS_CHANGED_P2P_PS; + } } ieee80211_link_info_change_notify(sdata, link, changed);