Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp657151lqo; Wed, 8 May 2024 10:37:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwFmFtSBFl2RqZH+vDh+zRC8dSMXvPnv3Sp3olHthd4ONClFtFuGMiSsQ/UkvzCsInnN1oTxDmrsVK268lIcg2g46XBT4TpqXFjSkG8Q== X-Google-Smtp-Source: AGHT+IEcSsEtfdhHGRd+OMwdMX1eyVRpUDg+ryRFEcZdOEx7CEQlhJH64/8TjwJWOh3xNnc3l9QA X-Received: by 2002:a17:903:2444:b0:1e2:307f:d283 with SMTP id d9443c01a7336-1eeaff8bd12mr39641285ad.1.1715189852486; Wed, 08 May 2024 10:37:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715189852; cv=pass; d=google.com; s=arc-20160816; b=spiiAMon+cN+ObZ9juonoqtvda1lfBNIl9l9L9DRM6z6x3iTtZIbsqn2WJYUaZa3S2 fm+Pk0Nfdvlv18USQwo7LNVNQdCyUX/cGWmC88WdoBmicF8P41v3qKJgcFQz3PnzLMu8 1IG0Nle9gGuce2rsTTydR4lmGH5mYsM5XUUUFnNPlLGiTjD7GbOdwN70hBrcq4Vc7ALd uvblSzzRp95WLL6u83v1F3W+e3KQijTiZVxW04dfe63+rzjYe9clsU2EMN8Xx9wldnJ5 Q/Vq/0eEStgF7UlnQyV41fGKcYmf0i8iuBNe+jWyvHby+h1uzuTZ44w9GAiabsNzZo2t rh+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c7u6BtstyP4eJno3ZL75X+Hcl+fC12lQ1kk4w4lGPFA=; fh=sG9jhBHEsNc76hLve58zfxxmeh0GUKp4yFB8ltJHOnE=; b=LKozajuDnbFnWbdrrSGh+gXiyYBNjLJZtfpnkTEwNe8bCdeTrBeTpNwYWdfNUl56Jv 6CdYIc0xC1Tyh4lf8OMLJaY8c0Hzto4uhk9LM5loNHOxYG8kUj5EtvZqayAqPk4ukKkU q07dEdW+2MUMU2QAltBO0sQjMaXLqJTTY92kVLu1WnN0zq2OMPOvExSSlE1u8DQSRm3k SrT/q7yV3g3u33TQVZBhQiLQJRiUkcukKXh7MOnaAxp12oF8kpj9WnNL3X+a0AfFbWAo DEhiszxsGjkgaCtkrlme4WnRLnw23GGMSmBF9Tx81YbHMNCeXRqVDwhiv0BxnFZ+J0xf hubg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=b6oskRBU; 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-7350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7350-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 k12-20020a170902ce0c00b001eb50fd78b6si12844855plg.620.2024.05.08.10.37.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 10:37:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7350-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=b6oskRBU; 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-7350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7350-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 4C9F6281D5F for ; Wed, 8 May 2024 17:37:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21B41E57F; Wed, 8 May 2024 17:37:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="b6oskRBU" 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 9198D12B142 for ; Wed, 8 May 2024 17:37:21 +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=1715189843; cv=none; b=oTgqhz42/nNLIC9Z7ae38jxT1MpZXf2Y9ymjE8Kdnc1HFudLR31FmYHWfzf8I12AerAAPkZULe2BPmQCSFGsLa4rw4UVjpb+yKEi0VFAj9UxDeCjUxPLmpQvSV2kMXrYwLkNcAFlAYNdItNQfXnK0smbW5nTvT4JYA3u/0BqyWE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715189843; c=relaxed/simple; bh=+xs7uXWlVaVvmqE4CilNrWqUUgNqQ9SSXJkGvHCC/VY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mmsGvL8CHmWlEfdwDCH15jGwi+gvvRsrdDDFmcMU4Vm4wR80f0CEkbtTFAOqM80/Ew2psCtEUAMcHA9GpKLdip0n0ukPRrf8GWgE2fjOdzD7MUIXga2dYBYm1urvXZCAqexi+j80mnGW9RrZ995L6YXu0cIXdR1DCQ3wpAK3Dd4= 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=b6oskRBU; 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 (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 448AeEOd005193; Wed, 8 May 2024 17:37:09 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-type; s=qcppdkim1; bh=c7u6BtstyP4eJno3ZL75 X+Hcl+fC12lQ1kk4w4lGPFA=; b=b6oskRBUTtDjJkwAEoCG1NUT6LAIRXiBEN24 W6QRPYxjYc4Nr0hptmUSuYGbGIMvYS+xFd8f1o1RQ3/hFIBHTyfUdXLV/A71fQ8H rfvtYox5z5nbKJz05fVbfQ9quVZBVP0zDnoT+SMjxUqlNhBtIewixv1g5YgiCcgG lxRd8mb5WJwR4lw1oJuSIjxxy55bJvn8My/Y36qQ8s+xG/qmOvmSxcsanrt8tjCb VMrjVwUWaH3Ii3/b+94U8d/PCvkWhXdkgQKHaA5qCmWWEtKH6jDckGIlyT3E2D0C 7Qf9aGvub5TmFwd65tYQNk+Fz/R7GbXjzPIzpzwdYm6CdcY+rA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y07u990xf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 May 2024 17:37:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 448Hb841009075 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 8 May 2024 17:37:08 GMT Received: from pradeepc2-linux.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; Wed, 8 May 2024 10:37:08 -0700 From: Pradeep Kumar Chitrapu To: CC: , Pradeep Kumar Chitrapu Subject: [PATCH V5 5/6] wifi: ath12k: refactor SMPS configuration Date: Wed, 8 May 2024 10:36:54 -0700 Message-ID: <20240508173655.22191-6-quic_pradeepc@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240508173655.22191-1-quic_pradeepc@quicinc.com> References: <20240508173655.22191-1-quic_pradeepc@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: v9-NDGATG0C8YYaBGMk0yNwEQZfbtEpe X-Proofpoint-ORIG-GUID: v9-NDGATG0C8YYaBGMk0yNwEQZfbtEpe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-08_09,2024-05-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405080128 Move fetching SMPS value to a new function and use u16_get_bits to extract it from capabilities. This will help in extending the functionality when SMPS support in 6 GHz band gets added in subsequent patches. 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: Pradeep Kumar Chitrapu --- drivers/net/wireless/ath/ath12k/mac.c | 32 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index b9b9f4d17b34..0e9b6b7b83d7 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -2086,18 +2086,29 @@ static void ath12k_peer_assoc_h_he_6ghz(struct ath12k *ar, ampdu_factor)) - 1; } +static int ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *ht_cap, + int *smps) +{ + if (!ht_cap->ht_supported) + return -EOPNOTSUPP; + + *smps = u16_get_bits(ht_cap->cap, IEEE80211_HT_CAP_SM_PS); + + if (*smps >= ARRAY_SIZE(ath12k_smps_map)) + return -EINVAL; + + return 0; +} + static void ath12k_peer_assoc_h_smps(struct ieee80211_sta *sta, struct ath12k_wmi_peer_assoc_arg *arg) { const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; int smps; - if (!ht_cap->ht_supported) + if (ath12k_get_smps_from_capa(ht_cap, &smps)) return; - smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; - smps >>= IEEE80211_HT_CAP_SM_PS_SHIFT; - switch (smps) { case WLAN_HT_CAP_SM_PS_STATIC: arg->static_mimops_flag = true; @@ -2571,16 +2582,11 @@ static int ath12k_setup_peer_smps(struct ath12k *ar, struct ath12k_vif *arvif, const u8 *addr, const struct ieee80211_sta_ht_cap *ht_cap) { - int smps; + int smps, ret = 0; - if (!ht_cap->ht_supported) - return 0; - - smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; - smps >>= IEEE80211_HT_CAP_SM_PS_SHIFT; - - if (smps >= ARRAY_SIZE(ath12k_smps_map)) - return -EINVAL; + ret = ath12k_get_smps_from_capa(ht_cap, &smps); + if (ret < 0) + return ret; return ath12k_wmi_set_peer_param(ar, addr, arvif->vdev_id, WMI_PEER_MIMO_PS_STATE, -- 2.17.1