Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1633710lqz; Mon, 1 Apr 2024 12:05:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUvI6WgnogJyG5jm0WN2cghxKsyqlhPDU9PxPZyA+Z0VDt7MtilreJbkdHQWxKKkBuecZ9DZRxVEHIV1rnC8D8uQUTTPxk5R9h3zSQu9Q== X-Google-Smtp-Source: AGHT+IHtVmnRo9ATUUqCkGboNEKJrptqqHMP6rGknKvws1WndBxMbILauc3jz3/Al1dWUDe8Uj8L X-Received: by 2002:a05:620a:3bd6:b0:78b:be73:9d4b with SMTP id yf22-20020a05620a3bd600b0078bbe739d4bmr10414577qkn.56.1711998356383; Mon, 01 Apr 2024 12:05:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711998356; cv=pass; d=google.com; s=arc-20160816; b=GgmtzEoMUfHy1jslzhPiGM0/CmwYodlCILjDOACE3a4eNjqMUY/n4kCoRCf+CTG8pq Vq1LQnqLH/BWAB2dR+UvXCrx6BhQu4OtorGpFkFSpJzPLJggWhlMN/ICCxgXGXGj+90r 0EbctOqjJbO3yrpaGLBA9RP+npCe9aJon9o0CVC4dPUhjcHp0V/WeKkDa3ITnG0vDLRP uTqdkdf860FPx4pT9NZdOwEXWRFINM5RAnPVw5Z+W9LVpHgCvGc1fPOuzSPMspoxEgmO jTY8kEbvaIjj79eajTXKFzOaNHihAMc0DPJGqmkARovmbQbyvlUQ46SaSrQ3829pQGZN Jv1A== 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=uv+KUaFsp5pM+Yo3l9rLqyxAwkqrXID3ggb2fa2Odj0=; fh=hXmvBwTcrACbulhadJq4aGomw93PvN9px3WarQqqC4o=; b=OKE3DAe6t+Bq3OQ53+AkCenrrrE0EDBFtgbGFBnmUU1qb3x99XJ2WahmJK/gmcOCao MMFxyDJx2hsYUlMGhfRz8G0T3dMagjVYtRYfE4ksn+Vb2bKAJM54LzYJalhdqNOXIo30 4C/FUWmAUsnTmdQ7upLeSapV9zAEbIHxJejegxOlRaaymkYWo74ygijrHXmOiP93WfHc zcCGjk1d+j/DTsIyI5bN7+WyFzHgvx561CHlW2QVj3GnkRg8HJLlhcRjn6j7bprsawje FQEnFDmQV3kue2M8PGEEUbrFOGcURwWknCrq8pXGAOzaFeDhdF/y1NPjCCSTKlpl/2BV 1bgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CUxY4REm; 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-5731-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5731-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b15-20020a05620a126f00b0078a695a0553si10148195qkl.48.2024.04.01.12.05.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 12:05:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5731-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CUxY4REm; 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-5731-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5731-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B26D71C218BF for ; Mon, 1 Apr 2024 19:05:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54D1342056; Mon, 1 Apr 2024 19:05:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="CUxY4REm" X-Original-To: linux-wireless@vger.kernel.org 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 B957654780 for ; Mon, 1 Apr 2024 19:05:24 +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=1711998326; cv=none; b=Rt0OnTbTO4lJv3+2ccyAJtdFG4YR01SxsrXEVbNmmWIVRxs3boQK3w21BRTKTT63+zW18JjjfRokxHkQ0+a5H0DB98tsvjZ5BBo9GuQAHhAIYCBwG9vvz9SCeLyrcrYp6WxipzYMOpgib8Iywh6p/DXqAoJjoAJo7WGinyoY+no= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711998326; c=relaxed/simple; bh=MGpVOy/iwno5SqvWRgCDFWGFHTdXZ62RWUaYIK4UX4U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DnRiVOHNCuEc/hfCUtrQZ7HluybdRwrvXUdGnq09ff4/RT5W2W+8GU9TRqAHNsiDszq8M0v1H1J6FushAph20dovHt6BTO4V+NRd6XGo7fAY9irT78TFRpTfHd8WgrS2XFHJoi4wpI5Y8XelPb6aLWSLdmDoe3Vm/+o8t8Lfhm0= 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=CUxY4REm; 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 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431IwIe9017578; Mon, 1 Apr 2024 19:05:21 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=uv+KUaFsp5pM+Yo3l9rLqyxAwkqrXID3ggb2fa2Odj0=; b=CU xY4REm3LnpM7/Z+SZAVyxXQEgY6bo9czdyLkWMEmbPLBNwGSAdOd4a9vDDn3xBSG R06wUfkCDzJudToh7P/I6bMp8Vcf7vt2aHV3cAPAFYWB+BScJi1nOvBSetnhyVjn OtPMWjDJHeSoS9rF/fQkqWNwmhkF6IrtxbLVm8dcKGoy89ZonsnSFTS6uHq3LZzf I08CdmoweyWrNSOqfgi8oJN+IA15VcQuqDMyqf5ByUp7a06Qv1IBeb2yht2mYrjn Tvut+mK16fz9lxXwStgzIXabAfEr2fMGFmaCvDOUGV1zCX4w968Lk3wSGWfp+q3N h+lALbS0/CDyaPyBa2WQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x7nbq1tay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:05:20 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 431J5KI3000709 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 1 Apr 2024 19:05:20 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; Mon, 1 Apr 2024 12:05:18 -0700 From: Rameshkumar Sundaram To: CC: , Sriram R , Rameshkumar Sundaram , Jeff Johnson Subject: [PATCH v6 10/12] wifi: ath12k: Modify set and get antenna mac ops for single wiphy Date: Tue, 2 Apr 2024 00:34:07 +0530 Message-ID: <20240401190409.2461819-11-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240401190409.2461819-1-quic_ramess@quicinc.com> References: <20240401190409.2461819-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: 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: ED3aJudLTnEXvyDCNbjj92HnuDf4Zlz_ X-Proofpoint-GUID: ED3aJudLTnEXvyDCNbjj92HnuDf4Zlz_ 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-04-01_13,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 clxscore=1015 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404010134 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 Acked-by: Jeff Johnson --- 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 706e770e0eb9..76c3cd6f0bcc 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -5204,6 +5204,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; @@ -6516,16 +6523,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(ah, ar, i) { + 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; } @@ -6534,13 +6544,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(ah, ar, i) { + 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