Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp928718lql; Tue, 12 Mar 2024 02:12:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrnqHpaQx/Te4y3GWEeOYQ9EFeAf6pVEA5znbQ/LCfR1aCWx1EwK+odEAuWfjth50pLIz2VdsIwz1NODFr9VMFUZxUqyCdTOrfNOu9mQ== X-Google-Smtp-Source: AGHT+IGoTPHmelYD7HkDFkO1LthjjJVqtvh1jrzglKzFSXVzLwJID11En+CWUDhsByoYBkY7d278 X-Received: by 2002:a17:902:ce90:b0:1dd:8df3:1727 with SMTP id f16-20020a170902ce9000b001dd8df31727mr9577470plg.44.1710234754656; Tue, 12 Mar 2024 02:12:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710234754; cv=pass; d=google.com; s=arc-20160816; b=TxlrHQIWA08EZoQnWrQaN7jw1p+3bD0doMiT5XPuQfo26GnEwLJWZueTQVxAvhZ122 8fJVdCQqpRMP37IJDjccRMRH9xUfUmk2WL8gWXW/D6EXkG6+xiHhdG0PTcv/KJnL62f/ 5GzbxE/YFNqZrQ1+H7tJwJ5x/W5RFbMiCbuVh9DIdzBugpT+brQqgq0k2i98b0EGE35c SHOE59vnAMbgEn1OUMkNT9uF3qF1r/SOPCitpq7lpWJXFskEAy5OSoAVefNqRC5gf9bP g4yaas/8auHzYIaL4SK9ryByJ5NVe7LmVmt60M4zW6wbhkVNwzIFZv2hHmur1lYSWJ0l Xkfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=iZJ4VRgr4LISkh8MwG1GKEXxFUCVqzmdo1GFxR1yobc=; fh=woZAKccQQLpsH+ifgAFl/ubgLBC7CdNtwbjjrWqWXi0=; b=wZgqmp2J6m24sHFQuS2N+Z0MN2p2sT2GD1WsbfBKELGWw+sAqpawALWOoA4fikSeic 4wSzGt09/6wDWqLX6wn2TC2Mvm7LhXbs5vk90UsKEj54EDUimZPp8FxBfCqhzo11OA/F HtnaROnHrvNXP6CyonsQ760RGY+PT1nX+L3J5eiSp+e4AOqu88ES0Mkq1moZIX+h990e UFjkyjXSKTCTkwMQPFZA0Q5+ch3CC25/S1lz8hKmt9eNNOvzfTz4MUDfrQ3bKtebjLll CouDyMEPqiMy+5cSIpvsa8PedDw+UH0d56gWuEaqT0LJ0c+vkTPhczZhSUHjETBifhHF E+bw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Hi655STS; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d15-20020a170903230f00b001dba67e1d81si6362018plh.647.2024.03.12.02.12.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Hi655STS; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 38F29284617 for ; Tue, 12 Mar 2024 09:05:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7DE0777F34; Tue, 12 Mar 2024 09:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Hi655STS" X-Original-To: linux-wireless@vger.kernel.org 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 EB2EE77F22 for ; Tue, 12 Mar 2024 09:04:45 +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=1710234287; cv=none; b=ZXeS7U0OiaGBS2rxDTU1lh7oiO99fcKcsCnaVKPFRRteNhI8T46nePkh8l9HexicqNXrUcqROMm0KmyugIQeZ/tu1gfZzPZdyTaa973LBLnpllWNceDT5WZCu3PwTiIAjFqlaYZdeON9cliAOv27hyL9Gex7ERjjIJRls2e5Cvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710234287; c=relaxed/simple; bh=iexHK45mipTfM8EeaOzrgUJWRqTfOJq5MJs99Bh0LN0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T96rU4f956+5veOQQIe7pYtW0YFaDSWsshBb4Hf1iXNkG5PVpV5njMkD/Ixwesd1EdGHgb2E2vaGJe9YZK/YaXU+pw9vS3/hGzbMejwNgi8HumQsaDwvbbI4bTD3hOE1nLD69Ux9v/5G1ukUV1OTUbYZ6WhqvKfhIi6+qOpmsTU= 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=Hi655STS; 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 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42C5o3oR016031; Tue, 12 Mar 2024 09:04:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=iZJ4VRgr4LISkh8MwG1GKEXxFUCVqzmdo1GFxR1yobc=; b=Hi 655STShu1Azld6+j1OI++4zaoz98aFMKBQ8isxHfJoOFkXNCpa63E+GqJ+eyW8JW 5VpR+1vEpU7cLm3Cym6Z0CQceUSYQJvjPqEGzm61xviEZ0ckZcEiXrammFo63bYu 8HjoaezLTUl/u3Lp/mz9uH8+gQIl4I9vt4OHMZjmVTNER/0q9oySgDF/aLVYuvDt JTLxx99J3GODV0LvrPphkth8DUSp+0bSl8pqpsiUTpQOoO6PBJK+tSW6KyOQ44Si /MNO0IXYulGPkAX9rjsX+tqg9/MHPLKldnzB68y0/rC888ZXK4I1MunzaqwgX4OD OiOKlUOFiLSdFqxftfXQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wth7rrbh9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 09:04:40 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42C94dCK011198 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 09:04:39 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.1118.40; Tue, 12 Mar 2024 02:04:37 -0700 From: Rameshkumar Sundaram To: CC: , Sriram R , Rameshkumar Sundaram Subject: [PATCH v3 10/12] wifi: ath12k: Modify set and get antenna mac ops for single wiphy Date: Tue, 12 Mar 2024 14:33:49 +0530 Message-ID: <20240312090351.1620218-11-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240312090351.1620218-1-quic_ramess@quicinc.com> References: <20240312090351.1620218-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: WMyRqi_L58058kzdV4_H49EbgXz_Tt1p X-Proofpoint-ORIG-GUID: WMyRqi_L58058kzdV4_H49EbgXz_Tt1p X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-12_08,2024-03-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 phishscore=0 spamscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403120069 From: Sriram R As multiple radios are combined into a single wiphy, and the current infrastructure supports only set/get antenna for the wiphy, the max Tx/Rx antenna capability is advertised during wiphy register. Hence, When antenna set/get is received we adjust the set/get based on max radio capability and set/get antenna accordingly. Multi radio capability needs to introduced with interface combination changes to support single wiphy model in cfg80211 which would help extend the wiphy specific get/set configs similar to this to per hw level. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Sriram R Signed-off-by: Rameshkumar Sundaram --- drivers/net/wireless/ath/ath12k/mac.c | 39 ++++++++++++++++++--------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 29c68aa2d30a..0934abc7995f 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -5183,6 +5183,13 @@ static int __ath12k_set_antenna(struct ath12k *ar, u32 tx_ant, u32 rx_ant) if (ath12k_check_chain_mask(ar, rx_ant, false)) return -EINVAL; + /* Since we advertised the max cap of all radios combined during wiphy + * registration, ensure we don't set the antenna config higher than the + * limits + */ + tx_ant = min_t(u32, tx_ant, ar->pdev->cap.tx_chain_mask); + rx_ant = min_t(u32, rx_ant, ar->pdev->cap.rx_chain_mask); + ar->cfg_tx_chainmask = tx_ant; ar->cfg_rx_chainmask = rx_ant; @@ -6489,16 +6496,19 @@ static void ath12k_mac_op_configure_filter(struct ieee80211_hw *hw, static int ath12k_mac_op_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) { struct ath12k_hw *ah = ath12k_hw_to_ah(hw); + int antennas_rx = 0, antennas_tx = 0; struct ath12k *ar; + int i; - ar = ath12k_ah_to_ar(ah, 0); - - mutex_lock(&ar->conf_mutex); - - *tx_ant = ar->cfg_tx_chainmask; - *rx_ant = ar->cfg_rx_chainmask; + for_each_ar(i, ah, ar) { + mutex_lock(&ar->conf_mutex); + antennas_rx = max_t(u32, antennas_rx, ar->cfg_rx_chainmask); + antennas_tx = max_t(u32, antennas_tx, ar->cfg_tx_chainmask); + mutex_unlock(&ar->conf_mutex); + } - mutex_unlock(&ar->conf_mutex); + *tx_ant = antennas_tx; + *rx_ant = antennas_rx; return 0; } @@ -6507,13 +6517,16 @@ static int ath12k_mac_op_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx { struct ath12k_hw *ah = ath12k_hw_to_ah(hw); struct ath12k *ar; - int ret; - - ar = ath12k_ah_to_ar(ah, 0); + int ret = 0; + int i; - mutex_lock(&ar->conf_mutex); - ret = __ath12k_set_antenna(ar, tx_ant, rx_ant); - mutex_unlock(&ar->conf_mutex); + for_each_ar(i, ah, ar) { + mutex_lock(&ar->conf_mutex); + ret = __ath12k_set_antenna(ar, tx_ant, rx_ant); + mutex_unlock(&ar->conf_mutex); + if (ret) + break; + } return ret; } -- 2.25.1