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); } }