From patchwork Tue Jan 7 18:25:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rameshkumar Sundaram X-Patchwork-Id: 13929495 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 5A9A81F1902 for ; Tue, 7 Jan 2025 18:27:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274425; cv=none; b=iiTDYuaEUfMP7okXytKQv5WmvYUkLwVVeO+rqGJrgaEwzBpQdb74kznqrPGeMtq7ndBdylWWzrWmGzKoEHoDG04az0jdKyN+kaJn/1QUmBBph3118L1Zv4aBsOw+OKhUCEMZs9L5K4xo51QukJ7DZOueQneSNi9CVeP5WdKmdII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274425; c=relaxed/simple; bh=K9oNRJKWVCOa++6KTn2KUjH+8Yqsikq1EUj4kIN9ipk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ncx37VRTKWgvaZwn3qKu7APnlLc0uNTrzjcVSyIJZnYraAkWyQqcgD44XSzbF7iXXg9stGV9MVMNcNBnm7DpvUxKUJbJ4F3ndcFdZn4bjlSUlDMfThYVe9Wwu39rq/0du9hiJpprrg4XKESH6EJgqmTBtDLt8cXQbdjLGxmP+Nk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=QFLRwZUF; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="QFLRwZUF" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 507Afnpr026038; Tue, 7 Jan 2025 18:26:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= rUR+j0wJ3GrR1mMcywhBMPT3H46RShAcG6GRcFeJPQY=; b=QFLRwZUFUzxGAVVu tsOz1oEWqWOMmX7cF1qKyu3OrZJ0dJU7cH+VtoySiW8n0+mjsBTvlpH2Py/5tzLM F11FN7/VADXzx2vhnx4MImTffa4f+8PSs9/kAv81aPjYPfE5DFTQb+EUHCR6Jdc5 HsF2AgqzSpyvnm+tVZy1K9BHeemecTNMUg/ojLVECsvFKSltMAXHeyu+4dCmEF2X CeeLUyNONGJ3R7l32VbBPavaa8Rd/Jj9wA++8/klgToA5vPk6aWCqRjNZJmtiS3U RqVwA4+Bg9D2hUeNFIx1fnPqw7k6Pg39IPBPvKjuH5sJ7EgWMqVlmHnjoOzztPNj sHdg/g== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4412r795xm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jan 2025 18:26:58 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 507IQvpC004468 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 Jan 2025 18:26:57 GMT Received: from hu-ramess-blr.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.1544.9; Tue, 7 Jan 2025 10:26:55 -0800 From: Rameshkumar Sundaram To: CC: , Roopni Devanathan , Rameshkumar Sundaram Subject: [PATCH RFC 1/5] wifi: cfg80211: Add Support to Set RTS Threshold for each Radio Date: Tue, 7 Jan 2025 23:55:02 +0530 Message-ID: <20250107182506.1838704-2-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250107182506.1838704-1-quic_ramess@quicinc.com> References: <20250107182506.1838704-1-quic_ramess@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: jZvMF5I1F1TtUPhnCwQwR_-MM2SSFzQ_ X-Proofpoint-ORIG-GUID: jZvMF5I1F1TtUPhnCwQwR_-MM2SSFzQ_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 clxscore=1015 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501070153 From: Roopni Devanathan Currently, setting RTS threshold is based on per-phy basis, i.e., all the radios present in a wiphy will take RTS threshold value to be the one sent from userspace. But each radio in a multi-radio wiphy can have different RTS threshold requirements. To extend support to set RTS threshold for each radio, get the radio for which RTS threshold needs to be changed from the user. Add a new attribute in NL - NL80211_ATTR_WIPHY_RADIO_INDEX, to identify the radio of interest. Create a new structure - wiphy_radio_cfg and add rts_threshold in it as a u32 value to store RTS threshold of each radio in a wiphy and allocate memory for it during wiphy register based on the wiphy.n_radio updated by drivers. Pass radio id received from the user to mac80211 drivers along with its corresponding RTS threshold. Note: The proposed design can be extended to all per-radio attributes, such as, frag_threshold, retry_short, retry_long, coverage_class, etc. This can be done by adding the corresponding datatype entry in wiphy_radio_cfg struct and modifying the handlers to use the added struct members. The added NL80211_ATTR_WIPHY_RADIO_INDEX attribute can be reused to identify the index of radio. Signed-off-by: Roopni Devanathan Signed-off-by: Rameshkumar Sundaram --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +- drivers/net/wireless/ath/wil6210/cfg80211.c | 2 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- .../net/wireless/marvell/mwifiex/cfg80211.c | 2 +- .../wireless/microchip/wilc1000/cfg80211.c | 2 +- .../net/wireless/quantenna/qtnfmac/cfg80211.c | 2 +- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +- include/net/cfg80211.h | 21 ++++++++++- include/uapi/linux/nl80211.h | 14 ++++++++ net/mac80211/cfg.c | 2 +- net/wireless/core.c | 18 ++++++++++ net/wireless/nl80211.c | 36 +++++++++++++++---- net/wireless/rdev-ops.h | 6 ++-- net/wireless/trace.h | 5 +-- net/wireless/wext-compat.c | 8 +++-- 15 files changed, 100 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 72ce321f2a77..120dbd66ea11 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -1376,7 +1376,7 @@ void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, GFP_KERNEL); } -static int ath6kl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) +static int ath6kl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed) { struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy); struct ath6kl_vif *vif; diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index a1a0a9223e74..fc6e33cb3d48 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -1408,7 +1408,7 @@ static int wil_cfg80211_disconnect(struct wiphy *wiphy, return rc; } -static int wil_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) +static int wil_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed) { struct wil6210_priv *wil = wiphy_to_wil(wiphy); int rc; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 902ac3108782..2df5e3d3cc84 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -1619,7 +1619,7 @@ static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l) return err; } -static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) +static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed) { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct net_device *ndev = cfg_to_ndev(cfg); diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index a099fdaafa45..8f1929ee2a92 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -737,7 +737,7 @@ mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr) * Fragmentation threshold of the driver. */ static int -mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) +mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed) { struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); struct mwifiex_private *priv; diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index e7aa0f991923..2de0834d76cd 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -800,7 +800,7 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev, return 0; } -static int set_wiphy_params(struct wiphy *wiphy, u32 changed) +static int set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed) { int ret = -EINVAL; struct cfg_param_attr cfg_param_val; diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 0b2282528342..e4ba386f6265 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -370,7 +370,7 @@ static int qtnf_stop_ap(struct wiphy *wiphy, struct net_device *dev, return ret; } -static int qtnf_set_wiphy_params(struct wiphy *wiphy, u32 changed) +static int qtnf_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed) { struct qtnf_wmac *mac = wiphy_priv(wiphy); struct qtnf_vif *vif; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 7fcc46a0bb48..c7458bf9a7f1 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -1298,7 +1298,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy return ret; } -static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed) +static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed) { return 0; } diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 7790af534b7f..101975509247 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -4728,7 +4728,7 @@ struct cfg80211_ops { int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, int rate[NUM_NL80211_BANDS]); - int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); + int (*set_wiphy_params)(struct wiphy *wiphy, u8 radio_id, u32 changed); int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, enum nl80211_tx_power_setting type, int mbm); @@ -5414,6 +5414,18 @@ struct wiphy_iftype_akm_suites { int n_akm_suites; }; +/** + * struct wiphy_radio_cfg - physical radio config of a wiphy + * This structure describes the configurations of a physical radio in a + * wiphy. It is used to denote per-radio attributes belonging to a wiphy. + * + * @rts_threshold: RTS threshold (dot11RTSThreshold); + * -1 (default) = RTS/CTS disabled + */ +struct wiphy_radio_cfg { + u32 rts_threshold; +}; + /** * struct wiphy_radio_freq_range - wiphy frequency range * @start_freq: start range edge frequency (kHz) @@ -5671,6 +5683,11 @@ struct wiphy_radio { * * @radio: radios belonging to this wiphy * @n_radio: number of radios + * + * @radio_cfg: configuration of radios belonging to a muli-radio wiphy. This struct + * contains a list of all radio specific attributes and should be used only for + * multi-radio wiphy. + * */ struct wiphy { struct mutex mtx; @@ -5758,6 +5775,8 @@ struct wiphy { void (*reg_notifier)(struct wiphy *wiphy, struct regulatory_request *request); + struct wiphy_radio_cfg *radio_cfg; + /* fields below are read-only, assigned by cfg80211 */ const struct ieee80211_regdomain __rcu *regd; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 6d11437596b9..fe9162d308a2 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2871,6 +2871,17 @@ enum nl80211_commands { * @NL80211_ATTR_VIF_RADIO_MASK: Bitmask of allowed radios (u32). * A value of 0 means all radios. * + * @NL80211_ATTR_WIPHY_RADIO_INDEX: Integer attribute denoting the index of + * the radio in interest. Internally a value of 0xff is used to indicate + * this attribute is not present, and hence any associated attributes are + * deemed to be applicable to all radios + * + * *RFC NOTE:* Rather than having a radio index we could have a radio mask like we + * do for vif. If having a mask is preferred then we can rename + * NL80211_ATTR_VIF_RADIO_MASK => NL80211_ATTR_RADIO_MASK and define + * NL80211_ATTR_VIF_RADIO_MASK to be equal to NL80211_ATTR_RADIO_MASK, + * either via a macro or as an additional enum. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -3421,6 +3432,8 @@ enum nl80211_attrs { NL80211_ATTR_VIF_RADIO_MASK, + NL80211_ATTR_WIPHY_RADIO_INDEX, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -3463,6 +3476,7 @@ enum nl80211_attrs { #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS #define NL80211_WIPHY_NAME_MAXLEN 64 +#define NL80211_WIPHY_RADIO_ID_MAX 0xff #define NL80211_MAX_SUPP_RATES 32 #define NL80211_MAX_SUPP_HT_RATES 77 diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index b8495d5f2297..33a325524997 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3004,7 +3004,7 @@ static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev, return 0; } -static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) +static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed) { struct ieee80211_local *local = wiphy_priv(wiphy); int err; diff --git a/net/wireless/core.c b/net/wireless/core.c index 70857018f020..3f4c9edc2bc8 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -1077,6 +1077,23 @@ int wiphy_register(struct wiphy *wiphy) return res; } + /* Allocate radio configuration space for multi-radio wiphy. + */ + if (wiphy->n_radio) { + int idx; + + wiphy->radio_cfg = kcalloc(wiphy->n_radio, sizeof(*wiphy->radio_cfg), + GFP_KERNEL); + if (!wiphy->radio_cfg) + return -ENOMEM; + /* + * Initialize wiphy radio parameters to IEEE 802.11 MIB default values. + * RTS threshold is disabled by default with the special -1 value. + */ + for (idx = 0; idx < wiphy->n_radio; idx++) + wiphy->radio_cfg[idx].rts_threshold = (u32)-1; + } + return 0; } EXPORT_SYMBOL(wiphy_register); @@ -1187,6 +1204,7 @@ void wiphy_unregister(struct wiphy *wiphy) cfg80211_rdev_free_wowlan(rdev); cfg80211_free_coalesce(rdev->coalesce); rdev->coalesce = NULL; + kfree(wiphy->radio_cfg); } EXPORT_SYMBOL(wiphy_unregister); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8789d8b73f0f..3b004b419a74 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -830,6 +830,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MLO_TTLM_ULINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8), [NL80211_ATTR_ASSOC_SPP_AMSDU] = { .type = NLA_FLAG }, [NL80211_ATTR_VIF_RADIO_MASK] = { .type = NLA_U32 }, + [NL80211_ATTR_WIPHY_RADIO_INDEX] = { .type = NLA_U8 }, }; /* policy for the key attributes */ @@ -3587,8 +3588,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) int result = 0, rem_txq_params = 0; struct nlattr *nl_txq_params; u32 changed; - u8 retry_short = 0, retry_long = 0; - u32 frag_threshold = 0, rts_threshold = 0; + u8 retry_short = 0, retry_long = 0, radio_id = NL80211_WIPHY_RADIO_ID_MAX; + u32 frag_threshold = 0, rts_threshold = 0, radio_mask = BIT(rdev->wiphy.n_radio) - 1; u8 coverage_class = 0; u32 txq_limit = 0, txq_memory_limit = 0, txq_quantum = 0; @@ -3641,6 +3642,17 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) if (result) return result; + if (info->attrs[NL80211_ATTR_WIPHY_RADIO_INDEX]) { + /* Radio idx is not expected for non-multi radio wiphy */ + if (!radio_mask) + return -EINVAL; + + radio_id = nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_RADIO_INDEX]); + + if (!(BIT(radio_id) & radio_mask)) + return -EINVAL; + } + if (info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS]) { struct ieee80211_txq_params txq_params; struct nlattr *tb[NL80211_TXQ_ATTR_MAX + 1]; @@ -3859,7 +3871,10 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) old_retry_short = rdev->wiphy.retry_short; old_retry_long = rdev->wiphy.retry_long; old_frag_threshold = rdev->wiphy.frag_threshold; - old_rts_threshold = rdev->wiphy.rts_threshold; + if (radio_id >= rdev->wiphy.n_radio) + old_rts_threshold = rdev->wiphy.rts_threshold; + else + old_rts_threshold = rdev->wiphy.radio_cfg[radio_id].rts_threshold; old_coverage_class = rdev->wiphy.coverage_class; old_txq_limit = rdev->wiphy.txq_limit; old_txq_memory_limit = rdev->wiphy.txq_memory_limit; @@ -3871,8 +3886,12 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) rdev->wiphy.retry_long = retry_long; if (changed & WIPHY_PARAM_FRAG_THRESHOLD) rdev->wiphy.frag_threshold = frag_threshold; - if (changed & WIPHY_PARAM_RTS_THRESHOLD) - rdev->wiphy.rts_threshold = rts_threshold; + if (changed & WIPHY_PARAM_RTS_THRESHOLD) { + if (radio_id >= rdev->wiphy.n_radio) + rdev->wiphy.rts_threshold = rts_threshold; + else + rdev->wiphy.radio_cfg[radio_id].rts_threshold = rts_threshold; + } if (changed & WIPHY_PARAM_COVERAGE_CLASS) rdev->wiphy.coverage_class = coverage_class; if (changed & WIPHY_PARAM_TXQ_LIMIT) @@ -3882,12 +3901,15 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) if (changed & WIPHY_PARAM_TXQ_QUANTUM) rdev->wiphy.txq_quantum = txq_quantum; - result = rdev_set_wiphy_params(rdev, changed); + result = rdev_set_wiphy_params(rdev, radio_id, changed); if (result) { rdev->wiphy.retry_short = old_retry_short; rdev->wiphy.retry_long = old_retry_long; rdev->wiphy.frag_threshold = old_frag_threshold; - rdev->wiphy.rts_threshold = old_rts_threshold; + if (radio_id >= rdev->wiphy.n_radio) + rdev->wiphy.rts_threshold = old_rts_threshold; + else + rdev->wiphy.radio_cfg[radio_id].rts_threshold = old_rts_threshold; rdev->wiphy.coverage_class = old_coverage_class; rdev->wiphy.txq_limit = old_txq_limit; rdev->wiphy.txq_memory_limit = old_txq_memory_limit; diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index 8f2aa7e76c0a..cc06db496e5d 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h @@ -577,13 +577,13 @@ static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev, } static inline int -rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed) +rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u8 radio_id, u32 changed) { int ret = -EOPNOTSUPP; - trace_rdev_set_wiphy_params(&rdev->wiphy, changed); + trace_rdev_set_wiphy_params(&rdev->wiphy, radio_id, changed); if (rdev->ops->set_wiphy_params) - ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); + ret = rdev->ops->set_wiphy_params(&rdev->wiphy, radio_id, changed); trace_rdev_return_int(&rdev->wiphy, ret); return ret; } diff --git a/net/wireless/trace.h b/net/wireless/trace.h index a57210c8087c..7bf91c6d3d81 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -1676,10 +1676,11 @@ TRACE_EVENT(rdev_join_ocb, ); TRACE_EVENT(rdev_set_wiphy_params, - TP_PROTO(struct wiphy *wiphy, u32 changed), - TP_ARGS(wiphy, changed), + TP_PROTO(struct wiphy *wiphy, u8 radio_id, u32 changed), + TP_ARGS(wiphy, radio_id, changed), TP_STRUCT__entry( WIPHY_ENTRY + __field(u8, radio_id) __field(u32, changed) ), TP_fast_assign( diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index a74b1afc594e..fd4a4112610e 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c @@ -263,7 +263,8 @@ int cfg80211_wext_siwrts(struct net_device *dev, else wdev->wiphy->rts_threshold = rts->value; - err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_RTS_THRESHOLD); + err = rdev_set_wiphy_params(rdev, NL80211_WIPHY_RADIO_ID_MAX, + WIPHY_PARAM_RTS_THRESHOLD); if (err) wdev->wiphy->rts_threshold = orts; return err; @@ -304,7 +305,8 @@ int cfg80211_wext_siwfrag(struct net_device *dev, wdev->wiphy->frag_threshold = frag->value & ~0x1; } - err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_FRAG_THRESHOLD); + err = rdev_set_wiphy_params(rdev, NL80211_WIPHY_RADIO_ID_MAX, + WIPHY_PARAM_FRAG_THRESHOLD); if (err) wdev->wiphy->frag_threshold = ofrag; return err; @@ -355,7 +357,7 @@ static int cfg80211_wext_siwretry(struct net_device *dev, changed |= WIPHY_PARAM_RETRY_SHORT; } - err = rdev_set_wiphy_params(rdev, changed); + err = rdev_set_wiphy_params(rdev, NL80211_WIPHY_RADIO_ID_MAX, changed); if (err) { wdev->wiphy->retry_short = oshort; wdev->wiphy->retry_long = olong; From patchwork Tue Jan 7 18:25:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rameshkumar Sundaram X-Patchwork-Id: 13929496 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 808D71F3D2B for ; Tue, 7 Jan 2025 18:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274429; cv=none; b=FOWuRzUVZVLalQI/aipE8/VKJgT85M53U1kdLUN9teAhZ7dUQ/cK9hODoyFYGmyiURsGhe32HP/6NKsB60rr/ecwucU9K+rGd555GuEHvKmtQtMoyS2/t+B1JUg92j0duVFBYuaQYqXJX/S8SrTzhOBoXS7ggR+8j82VZW4ghOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274429; c=relaxed/simple; bh=7Ml/MXeOsFD0gEHA+UM/OhjX8lrxN/EJ0leDg+B6/WM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uybAnFj1zWzapwEgY1HMt1FjMj9W9K3DfiPViLt3tMWgdJTikVJz0gpgeZMlSvX4WP4n5FqcPSG3cutBoyrcE0mhuTGnarQAMkwcqSNwYPf7WHCiF72be35B6jrIHmeEcwHz6MBrgeJpEccVKLFWJUwMQF+2YDsimjvrUwjue+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=gUUYEQCA; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="gUUYEQCA" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 507C0eO4018235; Tue, 7 Jan 2025 18:27:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= TP4cI7cwISXCny2fXj602pz+rk8S/7RFkQLLnsCGOa0=; b=gUUYEQCAswSa4AfX 20nh/TrLomOdQBOSfHsWZxGEFj5HTTJ0U+h96WNpJI6FaDZ3GU9DOvpnS3FWQXXY w7mogMJLKlXWGYj9RZ3K6gcFlihy8vIPvUafAR2AYyMWeZEdgU+BBoXFbfzgnisL TmRRH/MZtpkbVFGZBBzwYCFexujz3raqm28XVuarYw3aO5nghwAYAXHkOrEuPgCP 85YEYomMHe0jWjps8Zvivn3I2TzoWrgAtgvy65HUKLIkBhIlGHpJamtyLwd0u2yo gT30K8aviJZlRJ9E9o/qgNLAcp025/ck6ECQnDhMk/VBFMKh5YlqL7OC2MEymXZp a7ld8g== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4413w98ykx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jan 2025 18:27:00 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 507IQxgU032255 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 Jan 2025 18:26:59 GMT Received: from hu-ramess-blr.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.1544.9; Tue, 7 Jan 2025 10:26:57 -0800 From: Rameshkumar Sundaram To: CC: , Roopni Devanathan , Rameshkumar Sundaram Subject: [PATCH RFC 2/5] wifi: cfg80211: Report per-radio RTS threshold to userspace Date: Tue, 7 Jan 2025 23:55:03 +0530 Message-ID: <20250107182506.1838704-3-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250107182506.1838704-1-quic_ramess@quicinc.com> References: <20250107182506.1838704-1-quic_ramess@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: UdIyhfDl42QXqQTLel-KWzKVdi5Bzf4q X-Proofpoint-GUID: UdIyhfDl42QXqQTLel-KWzKVdi5Bzf4q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 spamscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501070153 From: Roopni Devanathan In case of multi-radio wiphys, with per-radio RTS threshold brought into use, RTS threshold for each radio in a wiphy can be recorded in wiphy parameter - wiphy_radio_cfg, as an array. When a request for getting RTS threshold for a particular radio is received, parse the radio id and get the required data. Add support to report this data to userspace. Note: The proposed design can be extended to all per-radio attributes, such as, frag_threshold, retry_short, retry_long, coverage_class, etc. The added NL80211_ATTR_WIPHY_RADIO_INDEX attribute can be used to identify the index of radio, which is passed from the userspace. Signed-off-by: Roopni Devanathan Signed-off-by: Rameshkumar Sundaram --- net/wireless/nl80211.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 3b004b419a74..7cf6597b4c18 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2505,7 +2505,8 @@ struct nl80211_dump_wiphy_state { static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, enum nl80211_commands cmd, struct sk_buff *msg, u32 portid, u32 seq, - int flags, struct nl80211_dump_wiphy_state *state) + int flags, u8 radio_id, + struct nl80211_dump_wiphy_state *state) { void *hdr; struct nlattr *nl_bands, *nl_band; @@ -2516,7 +2517,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, int i; const struct ieee80211_txrx_stypes *mgmt_stypes = rdev->wiphy.mgmt_stypes; - u32 features; + u32 features, rts_threshold; hdr = nl80211hdr_put(msg, portid, seq, flags, cmd); if (!hdr) @@ -2537,6 +2538,11 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, switch (state->split_start) { case 0: + if (radio_id >= rdev->wiphy.n_radio) + rts_threshold = rdev->wiphy.rts_threshold; + else + rts_threshold = rdev->wiphy.radio_cfg[radio_id].rts_threshold; + if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT, rdev->wiphy.retry_short) || nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_LONG, @@ -2544,7 +2550,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, nla_put_u32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, rdev->wiphy.frag_threshold) || nla_put_u32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, - rdev->wiphy.rts_threshold) || + rts_threshold) || nla_put_u8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, rdev->wiphy.coverage_class) || nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, @@ -3211,7 +3217,9 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, - NLM_F_MULTI, state); + NLM_F_MULTI, + NL80211_WIPHY_RADIO_ID_MAX, + state); if (ret < 0) { /* * If sending the wiphy data didn't fit (ENOBUFS @@ -3260,13 +3268,21 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info) struct sk_buff *msg; struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct nl80211_dump_wiphy_state state = {}; + u8 radio_id = NL80211_WIPHY_RADIO_ID_MAX; msg = nlmsg_new(4096, GFP_KERNEL); if (!msg) return -ENOMEM; + if (info->attrs[NL80211_ATTR_WIPHY_RADIO_INDEX]) { + radio_id = nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_RADIO_INDEX]); + + if (radio_id >= rdev->wiphy.n_radio) + return -EINVAL; + } + if (nl80211_send_wiphy(rdev, NL80211_CMD_NEW_WIPHY, msg, - info->snd_portid, info->snd_seq, 0, + info->snd_portid, info->snd_seq, 0, radio_id, &state) < 0) { nlmsg_free(msg); return -ENOBUFS; @@ -17693,7 +17709,8 @@ void nl80211_notify_wiphy(struct cfg80211_registered_device *rdev, if (!msg) return; - if (nl80211_send_wiphy(rdev, cmd, msg, 0, 0, 0, &state) < 0) { + if (nl80211_send_wiphy(rdev, cmd, msg, 0, 0, 0, NL80211_WIPHY_RADIO_ID_MAX, + &state) < 0) { nlmsg_free(msg); return; } From patchwork Tue Jan 7 18:25:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rameshkumar Sundaram X-Patchwork-Id: 13929497 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 9937F1F428B for ; Tue, 7 Jan 2025 18:27:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274433; cv=none; b=ShPA1v2C7TRH7UvH+50OxlRC8Tq4fH40B6rvVS3VWyGgwasdtFjRjwbFLFizmZpgQAMr5/UbeC15YjzEymCilxBTsaNoEPj5Jv1dgovtwHk/36R/JaIzrMn8xmHRGoyQ1D3nyIraje7guGTPAqFD3RJmlmGCOBrqBySlvaVfYDQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274433; c=relaxed/simple; bh=qhh5bYRWLtymXdupDySsN7/ZBkrIMgS76Cv2XK7mrHw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bO3id4NoFi5BSat181vmmaPcKA4JUBeQrhGhisFv/9Qe8QLNJVs69/u2HR2VdpH/xtJ6UbWew4oCB48X9FSaJbonPsCNnch5rcrkWCmBriVM7xIIiDMMOVb1FkRcoZinzEOftjlBYRK3/iUYV8ICufSykvNnns2HlxoKAYtJNao= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=SGJKikRy; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="SGJKikRy" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 507GriVu031829; Tue, 7 Jan 2025 18:27:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= rR52YQ32v4WgZd4ioB6B8gsYo4L2T/BVjM+UxvJ8WUA=; b=SGJKikRy2I5nA8WZ rxrWQDCo8jjVTaQNvhAduWM0dB7vUiyMsykE0pHDLhQ9MbHn65sBG/+Pd1w4/yej AqHKkmF9NMVI99R5ZJNscSzx3k3Nh8XkA4f/9lG+rymQeeo80R+qgyPdS1nh6iez Y/LXWpjGixOQ8VjIhoL3i6HrYqTTN48gnzmCU3WrfpPHgqk7RTf5+iTnU+NCQyU1 LEp8b5b0E3M641DZ5GRdSXSZy7EuTruzEVdxc8l5eJ415os3DwamJgznxi0u5X5R +j3UrEtxNfDbXi52te32oAFIoaU1Wgh/h8K4lpN+H1TPbDHY6wf3Pb+I+dFj2v1P dqNBGw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44186ng7ds-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jan 2025 18:27:02 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 507IR1wa032312 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 Jan 2025 18:27:01 GMT Received: from hu-ramess-blr.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.1544.9; Tue, 7 Jan 2025 10:26:59 -0800 From: Rameshkumar Sundaram To: CC: , Roopni Devanathan , Rameshkumar Sundaram Subject: [PATCH RFC 3/5] wifi: mac80211: Set RTS threshold on per-radio basis Date: Tue, 7 Jan 2025 23:55:04 +0530 Message-ID: <20250107182506.1838704-4-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250107182506.1838704-1-quic_ramess@quicinc.com> References: <20250107182506.1838704-1-quic_ramess@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: hQ8E8mdH1FR7OE1M4X3VP9TT7DSmlL6y X-Proofpoint-GUID: hQ8E8mdH1FR7OE1M4X3VP9TT7DSmlL6y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 adultscore=0 bulkscore=0 impostorscore=0 clxscore=1015 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501070153 From: Roopni Devanathan Add support to get the radio for which RTS threshold needs to be changed from userspace. Pass on this radio index to underlying drivers as an additional argument. A value of NL80211_WIPHY_RADIO_ID_MAX(255) indicates radio index is not mentioned and the configuration applies to all radio(s) of the wiphy. Note: The change in interface in mac80211_hwsim.c is a sample of how the changes in interface corresponding to setting RTS threshold would affect mac80211 drivers. All the affected drivers will be modified similarly when the design is concluded and the patch series moves from RFC state. Signed-off-by: Roopni Devanathan Signed-off-by: Rameshkumar Sundaram --- drivers/net/wireless/virtual/mac80211_hwsim.c | 3 ++- include/net/mac80211.h | 2 +- net/mac80211/cfg.c | 8 ++++++- net/mac80211/driver-ops.h | 6 ++--- net/mac80211/trace.h | 24 ++++++++++++++++--- net/mac80211/util.c | 7 +++++- 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c index cf6a331d4042..0c02e7f8a2e0 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c @@ -3330,7 +3330,8 @@ static int mac80211_hwsim_tx_last_beacon(struct ieee80211_hw *hw) return 1; } -static int mac80211_hwsim_set_rts_threshold(struct ieee80211_hw *hw, u32 value) +static int mac80211_hwsim_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, + u32 value) { return -EOPNOTSUPP; } diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 9320d4bc22ee..6675fd6be204 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4553,7 +4553,7 @@ struct ieee80211_ops { struct ieee80211_key_conf *key, struct ieee80211_key_seq *seq); int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); - int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); + int (*set_rts_threshold)(struct ieee80211_hw *hw, u8 radio_id, u32 value); int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta); int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 33a325524997..e2125ce42fb5 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3033,7 +3033,13 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 chan } if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - err = drv_set_rts_threshold(local, wiphy->rts_threshold); + u32 rts_threshold; + + if (radio_id >= wiphy->n_radio) + rts_threshold = wiphy->rts_threshold; + else + rts_threshold = wiphy->radio_cfg[radio_id].rts_threshold; + err = drv_set_rts_threshold(local, radio_id, rts_threshold); if (err) return err; diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index c64531e0a60e..e77962c5b23f 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -402,16 +402,16 @@ static inline int drv_set_frag_threshold(struct ieee80211_local *local, } static inline int drv_set_rts_threshold(struct ieee80211_local *local, - u32 value) + u8 radio_id, u32 value) { int ret = 0; might_sleep(); lockdep_assert_wiphy(local->hw.wiphy); - trace_drv_set_rts_threshold(local, value); + trace_drv_set_rts_threshold(local, radio_id, value); if (local->ops->set_rts_threshold) - ret = local->ops->set_rts_threshold(&local->hw, value); + ret = local->ops->set_rts_threshold(&local->hw, radio_id, value); trace_drv_return_int(local, ret); return ret; } diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index dc35fed7e9b0..8792f69365fb 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h @@ -823,9 +823,27 @@ DEFINE_EVENT(local_u32_evt, drv_set_frag_threshold, TP_ARGS(local, value) ); -DEFINE_EVENT(local_u32_evt, drv_set_rts_threshold, - TP_PROTO(struct ieee80211_local *local, u32 value), - TP_ARGS(local, value) +TRACE_EVENT(drv_set_rts_threshold, + TP_PROTO(struct ieee80211_local *local, u8 radio_id, u32 value), + + TP_ARGS(local, radio_id, value), + + TP_STRUCT__entry( + LOCAL_ENTRY + __field(u8, radio_id) + __field(u32, value) + ), + + TP_fast_assign( + LOCAL_ASSIGN; + __entry->radio_id = radio_id; + __entry->value = value; + ), + + TP_printk( + LOCAL_PR_FMT " value:%d", + LOCAL_PR_ARG, __entry->value + ) ); TRACE_EVENT(drv_set_coverage_class, diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 7b656326e68a..109ddfe47f13 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1837,7 +1837,12 @@ int ieee80211_reconfig(struct ieee80211_local *local) drv_set_frag_threshold(local, hw->wiphy->frag_threshold); /* setup RTS threshold */ - drv_set_rts_threshold(local, hw->wiphy->rts_threshold); + if (hw->wiphy->n_radio) + for (i = 0; i < hw->wiphy->n_radio; i++) + drv_set_rts_threshold(local, i, hw->wiphy->radio_cfg[i].rts_threshold); + + else + drv_set_rts_threshold(local, NL80211_WIPHY_RADIO_ID_MAX, hw->wiphy->rts_threshold); /* reset coverage class */ drv_set_coverage_class(local, hw->wiphy->coverage_class); From patchwork Tue Jan 7 18:25:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rameshkumar Sundaram X-Patchwork-Id: 13929499 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 9EDD81F37CF for ; Tue, 7 Jan 2025 18:27:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274434; cv=none; b=qq8UfMf3dKUYKy4B8haocmwPJtWN8G3dnFpDtGrWSTMPvwWNJiJnR23hnKYbLH0k0qLCSwTvd3jL8tgdUe9v4f5HPulICdXKk/RsE0U21kcJ0ioYf9iyRnYjMll/hTyDyckVFDxe6ka6Bu8KL0oP60Rke8CrLT2xqNgrXammDo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274434; c=relaxed/simple; bh=E3Ke9SdT4ePvcX2H1Xc540vLe/LlB5X1JSYh2wMjfrA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aye5tfx1mZT+1F1Gnd+O3BvSL19c4Xlghha0tMEMB31mrTl96VopheVvbssUS1LhnLGAHEn9mORJ3hAR8As+I+13pkmuYkUP0dtc0T3ptZsfgXZ/ZS2Hm4av67ZWSCBgR/eF8g9Gmzc1shuqS3d8kN0/l62fsMU1IF8SYWiddOw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=ORaCAtjk; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ORaCAtjk" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5079olE6003529; Tue, 7 Jan 2025 18:27:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= wRGXKl7kdq44S9Q3tcc5/EjyGasCoGVwHf45Xxc3guM=; b=ORaCAtjkAMs+KU8o P8bgCPWRx8emHW4wn5RkF4eMxCk9Zll9cCsDLhT3QY1FQR9Yq6V4t+Rb9Ud+M6B2 G2wHvWQJ33ZMwllvd1f+Bu/TUObeAbDIoyyuqOZlr83QIEu6TYaVgkYbNn2mgwQ3 1tSbkD9o35iAXEtv1nq4RbT6ul2UHwC+4QbsNV3Bf1xBXgRq6DxJK6u8M+ZA8LKQ Bodl1hbJH9Jotf20rNjahLx1H+X4eV/Dkm+khfzqnbnEoLcrtvcs5TWLSrJRTWHL 9oi+1OZuBYqqk2ZOUS9qv+QDsokWv28tw8mSDSbFUMJSC0d6XAF80UHT4R66tjsA h18Lhw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4412091a0h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jan 2025 18:27:04 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 507IR3mn022020 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 Jan 2025 18:27:03 GMT Received: from hu-ramess-blr.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.1544.9; Tue, 7 Jan 2025 10:27:01 -0800 From: Rameshkumar Sundaram To: CC: , Rameshkumar Sundaram Subject: [PATCH RFC 4/5] wifi: cfg80211: set tx power per radio in a wiphy Date: Tue, 7 Jan 2025 23:55:05 +0530 Message-ID: <20250107182506.1838704-5-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250107182506.1838704-1-quic_ramess@quicinc.com> References: <20250107182506.1838704-1-quic_ramess@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: pR441JO3krBt8tKvKVeCfOw8RvOGRY9v X-Proofpoint-ORIG-GUID: pR441JO3krBt8tKvKVeCfOw8RvOGRY9v X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 malwarescore=0 mlxscore=0 suspectscore=0 priorityscore=1501 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501070152 A wiphy can have multiple radios(wiphy.n_radio) combined in it and each radio is identified by radio index (radio_id). When set tx power is done without a valid wdev then it is a radio level configuration but currently it is being considered at wiphy level since radio identifier is not present in nl80211_set_wiphy(). Pass the radio id that is obtained via NL80211_ATTR_WIPHY_RADIO_INDEX as an argument to set_tx_power op to indicate the underlying drivers about the radio of the wiphy to which the configuration should be applied. When NL80211_ATTR_WIPHY_RADIO_INDEX is not passed or the wiphy is a non-multi radio wiphy, radio id value of NL80211_WIPHY_RADIO_ID_MAX(255) is passed in which case drivers should apply the configuration to all radios. Signed-off-by: Rameshkumar Sundaram --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 1 + .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 2 +- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 2 +- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +- include/net/cfg80211.h | 2 +- net/mac80211/cfg.c | 2 +- net/wireless/nl80211.c | 2 +- net/wireless/rdev-ops.h | 6 +++--- net/wireless/trace.h | 11 +++++++---- net/wireless/wext-compat.c | 3 ++- 12 files changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 120dbd66ea11..bf23daec8662 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -1405,6 +1405,7 @@ static int ath6kl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u3 static int ath6kl_cfg80211_set_txpower(struct wiphy *wiphy, struct wireless_dev *wdev, + u8 radio_id, enum nl80211_tx_power_setting type, int mbm) { diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 2df5e3d3cc84..0e4456563316 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -2624,7 +2624,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, } static s32 -brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, +brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u8 radio_id, enum nl80211_tx_power_setting type, s32 mbm) { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 8f1929ee2a92..a6ae8011f14b 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -374,7 +374,7 @@ mwifiex_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, */ static int mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy, - struct wireless_dev *wdev, + struct wireless_dev *wdev, u8 radio_id, enum nl80211_tx_power_setting type, int mbm) { diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index 2de0834d76cd..b8b5ec062c3a 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -1636,7 +1636,7 @@ static void wilc_set_wakeup(struct wiphy *wiphy, bool enabled) srcu_read_unlock(&wl->srcu, srcu_idx); } -static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, +static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u8 radio_id, enum nl80211_tx_power_setting type, int mbm) { int ret; diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index e4ba386f6265..7c1a378726fc 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -894,7 +894,7 @@ static int qtnf_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, } static int qtnf_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, - enum nl80211_tx_power_setting type, int mbm) + u8 radio_id, enum nl80211_tx_power_setting type, int mbm) { struct qtnf_vif *vif; int ret; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index c7458bf9a7f1..eddea77b9cec 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -1795,7 +1795,7 @@ static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev, } static int cfg80211_rtw_set_txpower(struct wiphy *wiphy, - struct wireless_dev *wdev, + struct wireless_dev *wdev, u8 radio_id, enum nl80211_tx_power_setting type, int mbm) { return 0; diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 101975509247..a3bf7bc91532 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -4731,7 +4731,7 @@ struct cfg80211_ops { int (*set_wiphy_params)(struct wiphy *wiphy, u8 radio_id, u32 changed); int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, - enum nl80211_tx_power_setting type, int mbm); + u8 radio_id, enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, unsigned int link_id, int *dbm); diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index e2125ce42fb5..da9ac9998926 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3068,7 +3068,7 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 chan } static int ieee80211_set_tx_power(struct wiphy *wiphy, - struct wireless_dev *wdev, + struct wireless_dev *wdev, u8 radio_id, enum nl80211_tx_power_setting type, int mbm) { struct ieee80211_local *local = wiphy_priv(wiphy); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7cf6597b4c18..f74ac312b0c9 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3758,7 +3758,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) mbm = nla_get_u32(info->attrs[idx]); } - result = rdev_set_tx_power(rdev, txp_wdev, type, mbm); + result = rdev_set_tx_power(rdev, txp_wdev, radio_id, type, mbm); if (result) return result; } diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index cc06db496e5d..2e3369d95bbf 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h @@ -589,12 +589,12 @@ rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u8 radio_id, u32 } static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev, + struct wireless_dev *wdev, u8 radio_id, enum nl80211_tx_power_setting type, int mbm) { int ret; - trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm); - ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, type, mbm); + trace_rdev_set_tx_power(&rdev->wiphy, wdev, radio_id, type, mbm); + ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, radio_id, type, mbm); trace_rdev_return_int(&rdev->wiphy, ret); return ret; } diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 7bf91c6d3d81..f260fcd96b9a 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -1716,23 +1716,26 @@ DEFINE_EVENT(wiphy_wdev_link_evt, rdev_get_tx_power, ); TRACE_EVENT(rdev_set_tx_power, - TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, + TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, u8 radio_id, enum nl80211_tx_power_setting type, int mbm), - TP_ARGS(wiphy, wdev, type, mbm), + TP_ARGS(wiphy, wdev, radio_id, type, mbm), TP_STRUCT__entry( WIPHY_ENTRY WDEV_ENTRY + __field(u8, radio_id) __field(enum nl80211_tx_power_setting, type) __field(int, mbm) ), TP_fast_assign( WIPHY_ASSIGN; WDEV_ASSIGN; + __entry->radio_id = radio_id; __entry->type = type; __entry->mbm = mbm; ), - TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", type: %u, mbm: %d", - WIPHY_PR_ARG, WDEV_PR_ARG,__entry->type, __entry->mbm) + TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", radio_id: %u, type: %u, mbm: %d", + WIPHY_PR_ARG, WDEV_PR_ARG, __entry->radio_id, __entry->type, + __entry->mbm) ); TRACE_EVENT(rdev_return_int_int, diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index fd4a4112610e..3f1112fa56e8 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c @@ -892,7 +892,8 @@ static int cfg80211_wext_siwtxpower(struct net_device *dev, guard(wiphy)(&rdev->wiphy); - return rdev_set_tx_power(rdev, wdev, type, DBM_TO_MBM(dbm)); + return rdev_set_tx_power(rdev, wdev, NL80211_WIPHY_RADIO_ID_MAX, type, + DBM_TO_MBM(dbm)); } static int cfg80211_wext_giwtxpower(struct net_device *dev, From patchwork Tue Jan 7 18:25:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rameshkumar Sundaram X-Patchwork-Id: 13929498 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 954E91B4F0E for ; Tue, 7 Jan 2025 18:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274433; cv=none; b=BtTTIfPkT6SneO3TXR8fRXxq5R+bVUNTULV2JNrlzLWVfu06pCYp8nw3tPbH2bGAs/N3uteGpcy5x11YoaYsOXkiPIAw+riTfQHVsM1QuAOV1u91rVt+xbKyl6AhKeWYavvY6qt9xMKAe7LK3SgkWSPfw5kLo6AM+YABEI7Fx6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736274433; c=relaxed/simple; bh=F9YPfY4SqUglHaD27Dwml5SnJVHdaTcNSCuUIAJqfe0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=omhdoVJPLkzmHBE65XQiPkEIUHM3g9B4XHaKhw2+ecjZNn0dQi/leLCtwWRqSCPlnlrTlyw0IUR3kPkSYa7z3N/qEifGM79gbSrVK8FIlBrplo5oKgZetiSgH6fZiSU86k4Zv492kyggD0sBrfMjlnsgNaLnneTfXHJ4zME2FXQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=fnnGzAjj; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="fnnGzAjj" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 507GruMu032086; Tue, 7 Jan 2025 18:27:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 1Nrcefgo2uEcd+at5OXejhtYe0/cE8mn0bvnUYDDPrU=; b=fnnGzAjjkJcodVr2 hRO/zCr3PuW2GJkbXgmPCn0xFRxeS5IBSWN7YiCumoLE4861g4ndp4iALFJePfq8 3KjEet1FJvQjhlHyy3zHyCkf2IjOn95mAcwwIa9NZ/fJwc9ZnGKm+5N6n9JIhNff dTFb7bKqf1pK/fhg0Ae0DjkW45KRze6kU7Qqe1rVQcnstJ3hK1t1dRwiet1osLJK YMpv0BpGMQuL7eMi4T6hQeR5WbSXR10U2HMVXl0J1hcP3Aup27APLywbRaaCEu7E 5WKt6qoc/r3Hqu8uF0iHLfzdNliq1rLoLh8LDJeSVvj6rjPpSOaRotMReFJLsM02 K/c7EQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44186ng7dw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jan 2025 18:27:06 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 507IR5FM022035 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 Jan 2025 18:27:05 GMT Received: from hu-ramess-blr.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.1544.9; Tue, 7 Jan 2025 10:27:03 -0800 From: Rameshkumar Sundaram To: CC: , Rameshkumar Sundaram Subject: [PATCH RFC 5/5] wifi: mac80211: set tx power per radio in a wiphy Date: Tue, 7 Jan 2025 23:55:06 +0530 Message-ID: <20250107182506.1838704-6-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250107182506.1838704-1-quic_ramess@quicinc.com> References: <20250107182506.1838704-1-quic_ramess@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: nwUtHxMloNacBdsihVMYOAQW9HWVnbCb X-Proofpoint-GUID: nwUtHxMloNacBdsihVMYOAQW9HWVnbCb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 adultscore=0 bulkscore=0 impostorscore=0 clxscore=1015 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501070153 If set tx power is being done without a valid wdev/sdata then the configuration applies to the radio but currently it is being done at wiphy level(i.e. to all radios of wiphy) since radio identifier is not available. Use the radio_id argument of ieee80211_set_tx_power() to identify to which radio of the wiphy the configuration should be applied. If the wiphy is a multi-radio wiphy(wiphy.n_radios > 0), validate the radio index of link's channel context against the radio id provided and apply the configuration. radio id value of NL80211_WIPHY_RADIO_ID_MAX(255) indicates that radio index is not mentioned and the configuration applies to all radio(s) of the wiphy. Signed-off-by: Rameshkumar Sundaram --- net/mac80211/cfg.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index da9ac9998926..44a31c219f59 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3074,6 +3074,7 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, struct ieee80211_local *local = wiphy_priv(wiphy); struct ieee80211_sub_if_data *sdata; enum nl80211_tx_power_setting txp_type = type; + struct ieee80211_chanctx_conf *conf; bool update_txp_type = false; bool has_monitor = false; int user_power_level; @@ -3149,6 +3150,12 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, if (!link) continue; + if (radio_id < wiphy->n_radio) { + conf = wiphy_dereference(wiphy, link->conf->chanctx_conf); + if (!conf || conf->radio_idx != radio_id) + continue; + } + link->user_power_level = local->user_power_level; if (txp_type != link->conf->txpower_type) update_txp_type = true; @@ -3169,6 +3176,12 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, if (!link) continue; + if (radio_id < wiphy->n_radio) { + conf = wiphy_dereference(wiphy, link->conf->chanctx_conf); + if (!conf || conf->radio_idx != radio_id) + continue; + } + ieee80211_recalc_txpower(link, update_txp_type); } }