Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1079375lql; Tue, 12 Mar 2024 06:57:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUhv8cDLDS6/o4kCF3/nTneDr9kt2WXcP+cxjUeXIzKXMgMUaMCR/nfSQDXnXeXqwzcdks4+jg6wRMtHnON6RvGWsDwK2GZuSxn+DstNA== X-Google-Smtp-Source: AGHT+IHp46mGcEUDiQIBBqs3f/zAvxq6A5HL9jCDbm6a6/bC+q0vZxNoA6l3nx0LFKn7vps/U2V+ X-Received: by 2002:a50:d682:0:b0:567:a2d8:ca92 with SMTP id r2-20020a50d682000000b00567a2d8ca92mr1334729edi.23.1710251834939; Tue, 12 Mar 2024 06:57:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710251834; cv=pass; d=google.com; s=arc-20160816; b=xcqRGz/6SvHBc6ogUcQlOGTwyum7t8MTL7bL+jc7EhDTQefOc4gZuebGjlJuoAQVE+ dcQGNsTTrnUWrLLnn1H0hkHTvVg6CKvg0bfaNWgd9TZrIlfNFZM7r8vn/BV9EkZvsI+k OKivo3fckQ85aBo0fjclIEMKBx0IsLCHAGJ8u5Oq/FD5K1ExU1ko+m5+wWuOMz7PVlMS 7+jt6QS7UBYJ/IOUuopQki3fyLZT/3K1x3Ikx9SOUldXAthVCGtOPKo3qvOJyOJ1wVZa 5r5mrVjticShh/3PJEI8neaQbimrqDtpznVFGbDX5LBl0v+8Vht80l3xvRRFZpSMLF03 U07w== 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=CPa2TScCgs5oDfd3S4KDUXu4d0rFU4tr+muJsmpUL7ikB1yURmT62I+BZlvLK9FFwm cFklikayJQcivyganp1hkoq1BTFh8Bc2nlTk0akgH9Ht0VlcdSE05f5nRMbZ5wKiMGCX BwS4LDgteoy6c+vD0lvOYIqxy8xg5GCxK9hMephHsFTyoosjTZnyphHUGeGOijY1eynI AJQ9/qsaA1IXgcxZAWob4rv5D3NwPRyPHU7YrWJ37XdqH7GiwO33bVxs6vj4E7Fud2by B8MRGP//AjC9lKFXqwh8vCOa3hEjqPw8Xh9m/Ryd43NtUVfrusowLl7XyvWU1PlGVqn5 5E/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GeMY3Nvl; 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-4621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d22-20020a056402401600b005687dda4cf3si94168eda.95.2024.03.12.06.57.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 06:57:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GeMY3Nvl; 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-4621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4621-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 792871F21097 for ; Tue, 12 Mar 2024 13:57:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 517007AE48; Tue, 12 Mar 2024 13:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GeMY3Nvl" 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 B618F7A720 for ; Tue, 12 Mar 2024 13:56:40 +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=1710251802; cv=none; b=Z/YEJVxHPmXVXARnZcR4OOQ+m3Tb8yg4TbU8fqEOPwELb3nlILEtkhV75hMiY7ygbPCp81MIXz/viiT9R5akbyXGmjJwtbDJyI83VYV9t9emRlZLz0cvI5c5J000e/V9Y5x4c3vY6hgyILTOjiOHeZdQdYAbjB2CYdoekXxXoRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710251802; c=relaxed/simple; bh=iexHK45mipTfM8EeaOzrgUJWRqTfOJq5MJs99Bh0LN0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZcXj9bhc/AQfEJbs+JJB3MOXEbq1Pwa+ig2+iChSe3rQXPYxy9TAiIZdlNyNv/rjgofkz+bv3bKIlYzAeFgyDa9PdZKKXRHn2VX7Vhn78VDpL8pjnX6ODtgrm0HVwbnu02gWlMTRQNZ+0pBEtlE+0klGhxhI9VTH0pqB3QyPupA= 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=GeMY3Nvl; 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 (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42C9ZZkB024109; Tue, 12 Mar 2024 13:56:37 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=Ge MY3NvlCPSfQIbqK/hxm9L1HUSFIpGeczvar+S2nUh6ncdrQO85Q9lqTRdIx389pS 2q65sfaBuOjcaNaSqJx+Va1KAPNUlnppWasG9L32pRYqLxXE9fuaLMz8ZLNxv72m oSoX60W7EOsRtakwySTZo6eT3hKbhiBAGYrlileMwOQ8NIDBMP9pzai3a1qNKd01 TafDevVvX4ATnkVNyqMgG99MrZBQMap+7Xq0SaKXt0kjDx+LgGaC9FtpYVc1NYKa OudGzxcVQ6eS+A0BNL9peR7+IK02JpaLnDZ/wQW/GmVemDsS46ZQyBpwtUJgccfO kKuYFCeRTJJKXz9x8uGw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wtdy1h8js-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:56:36 +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 42CDuZtb006611 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:56:35 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 06:56:33 -0700 From: Rameshkumar Sundaram To: CC: , Sriram R , Rameshkumar Sundaram Subject: [PATCH v4 10/12] wifi: ath12k: Modify set and get antenna mac ops for single wiphy Date: Tue, 12 Mar 2024 19:25:55 +0530 Message-ID: <20240312135557.1778379-11-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240312135557.1778379-1-quic_ramess@quicinc.com> References: <20240312135557.1778379-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-GUID: xlNjLx0xejOG5ItVvctVtmX1KapJLT5u X-Proofpoint-ORIG-GUID: xlNjLx0xejOG5ItVvctVtmX1KapJLT5u 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-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403120107 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