Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp639458lqd; Wed, 24 Apr 2024 12:14:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4fLReb+k5lzDmj1uWrht71fxmEmm5g3DyOsiSFz00RpLWjCSH+6GprLHlmYB7HlEW+borBi/b8ZMRZgG+8xTtHOYp4hQLxIf4K66r2Q== X-Google-Smtp-Source: AGHT+IHQ5OtLH7EU7GvBgn/MLmFuid9ZxrPau3/QAm1u8YxO+MhULBAhpc7tw5NyLNQ2SZRja2YH X-Received: by 2002:a17:902:f68c:b0:1e8:26e4:d084 with SMTP id l12-20020a170902f68c00b001e826e4d084mr4065987plg.60.1713986089145; Wed, 24 Apr 2024 12:14:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713986089; cv=pass; d=google.com; s=arc-20160816; b=zNfNMLJLD5LBSLh7gR/4Nq/MBGtg1tP6EVVhG5EYHYx5A1cXDo/xe8KxSAuCb1REZH LMDOhKdH2QTC2utO1Xl3ZBNjuBUsXNHbu4I77XOmOUZBkJ0mBS40PzOKzYucL5NchNMp D4HxSbM/vdU7yX+eX1rfRnA7y/eX+3Kb7rhidByE3bXmGJ6A5fllwZDfL14bP+jVDdLc hlJYdVLn9iJz52+1nFnHgicGXxWjANIRqggyDxHm51DerPcpD2pPsufaLQRJrMq3a9bJ 3QPwqa42GnqaG1WoOAMBTkxuFj1BKaH5J17j5+ilIOiV9ODMqj6xJA5aDXxYvJJBdYJv drBQ== 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=P1EqBmSFbdoMe3tHwmrA3zCTkkvZw5Ppb5miNaMYCAk=; fh=sG9jhBHEsNc76hLve58zfxxmeh0GUKp4yFB8ltJHOnE=; b=d1mavn0hi21kNV765QDX3ssquJChoXlwDCKTlhK+8jvFl4fmqsCQwVwLh2kQBTqFCP RR3y9W7IsAt3R8CJknyHowB/WF63weZURQ7KvciHPB+d+7IC1ZbwCsxdncHs8CkeqCIh 6yonGwS3lSst7Tkfiy2DF+3mctjag9skv1ep8/dPBJI/hkx4BR6D/zfve0Tr0ugefiEI INoOZjjWsxlKg/EOmdrn3a0dAsmfMoIXBqCtCO3dU21VJPI2S22Y3ywoczqWu4GN6TEQ HwzkLb5ouCLkfiB354fwOchCsWqVBwxVckrEhXsYS0XhldPsMV30YEH8rqTkoM98gAxE q2SA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=E8ifjS9a; 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-6781-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6781-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. [139.178.88.99]) by mx.google.com with ESMTPS id p7-20020a170902e74700b001e4919ed359si11727665plf.642.2024.04.24.12.14.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 12:14:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6781-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=E8ifjS9a; 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-6781-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6781-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 B720C286E8C for ; Wed, 24 Apr 2024 19:13:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF52F2D022; Wed, 24 Apr 2024 19:12:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="E8ifjS9a" 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 5643323773 for ; Wed, 24 Apr 2024 19:12:41 +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=1713985962; cv=none; b=HGO/ZN4UTiflAXTyU1xOWWbVb7K3yeiJesViGa5jO2fOqq2kPaUopipLtmVDT8vn7QC75aLiYWTcmbNsLWEl9F/A/qY9cElfDCfsHGQXf3YZ+1VW7I//gSwoxETTsTwDcwcf8lewPiIABAlgShPAfUGwHctbizJTXiVyunefhKs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713985962; c=relaxed/simple; bh=MTPN+01Y4+n0SZ4eGUNRm+Nsm2rdAqL0k6sIcGaVYa8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Gra7MJ9p5ZTkxg+EIUcNRC480BzbXB8zFL/FHPZuoSWV/L8B97if/uW+Jgg89/z2QSVcedvcLXoJ4M6Kf2mqxYRJbealZLuHU53+utH/SVgYtE+JlkBoymcke9dxphIIR1T2O/4mcAx70GnAXE7vJwnz4paX6HF0D/QVhKn73uo= 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=E8ifjS9a; 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 (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43OImTr5027552; Wed, 24 Apr 2024 19:11:54 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=P1EqBmSFbdoMe3tHwmrA 3zCTkkvZw5Ppb5miNaMYCAk=; b=E8ifjS9a3+EIbpQ9ixMSDt68z+hFKuyksRO8 rzuCwgz7tKKm97YKCbOGMT8TwheNWERJIvxEyb5qnV+k34RPaA9SYS9DiFQPurxN qVf5kDSeqapx4rlPUodDk5D7NpKVxZjh07jLqjRb0YIAXl9Qt35244cEt1YVNoTp 4EtjKBDAE2ea4CS3cnjbmwxbH4vYjPe5589F3z+LCOiAim1Y1IloeOxpeWkF9xBX 1PovRRDOxjjoGDWDtmq2aK6N0eh/HYZJPvPmu+8hkgF//G9trf1IvcXIt+QBHeBN Hv2kehWYYDXTLSZMM9R4caIxltnwHx7j2QOg0lbcPZdeIEUaFw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xpv9fj080-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 19:11:54 +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 43OJBrqe017566 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 19:11:53 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, 24 Apr 2024 12:11:53 -0700 From: Pradeep Kumar Chitrapu To: CC: , Pradeep Kumar Chitrapu Subject: [PATCH V3 5/6] wifi: ath12k: refactor smps configuration Date: Wed, 24 Apr 2024 12:11:40 -0700 Message-ID: <20240424191141.32549-6-quic_pradeepc@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240424191141.32549-1-quic_pradeepc@quicinc.com> References: <20240424191141.32549-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: jyiUNvMQSzVzMuesLeNHeHcsGzig74m6 X-Proofpoint-ORIG-GUID: jyiUNvMQSzVzMuesLeNHeHcsGzig74m6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-24_16,2024-04-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 bulkscore=0 spamscore=0 priorityscore=1501 adultscore=0 phishscore=0 mlxscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404240091 Move fetching smps value to a new function and use u16_get_bits to extract smps value 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 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 8836dc67f7e0..65688e55c285 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 inline 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