Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2916551rdb; Tue, 6 Feb 2024 01:23:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvzUO/9RRa0FzqTIflqBuSQ1DxL2GkIJdGU0EovXIKKnZwY57+HIgc11/z8AepBafVk7DC X-Received: by 2002:a05:6a00:17a0:b0:6e0:4e69:6ec4 with SMTP id s32-20020a056a0017a000b006e04e696ec4mr2611421pfg.5.1707211388713; Tue, 06 Feb 2024 01:23:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707211388; cv=pass; d=google.com; s=arc-20160816; b=Rp5y0EpSxH0uWEWJFR14HGpxDMsI9QB1pKgzWAeQR+mQAowOwkVaL9SV0wqA1bcaOU HuAZ2qKOTe85XEjS0wt7lPo8jpo/4ofz78hXY/6UjpXN5jkenlwmOx3SPmL73/VYMZbi 12y2V6y4+k9toyIPmCsJo2pxIiOEwB6b+gzgYtH/hLQIJGCRTNiwbHSoolkumTd1szQY tHDT1YctTQ4gnvv8OtqubgPIxyW6/sCeV+dQLogecapbqNG3Yf239AAPrBRFcxAZ3gcy 4cZleBqGublP5B9+jRiFDf29KKS2hzfuQ1IBVFHiXR1t44JCmeNxtNTGR5/BU2lpgL72 TPuA== 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=I7Z9pXR7xPBaVbNOxOy5BU1VZo2W/r1+Ueh2QiJPn94=; fh=KLG+8JuApYYdiS8ajrqXYyM0vjYKP26qlXHsxsTKfEI=; b=sMe1zApgQItLhlPeafYvkkbjh79SVmTxzcEd7S3u4X5P8VNWndMGnNokZe25sF9lWX qph50aB0whVddAlEPi3f++5csmYHhouufxw3uviw/HBVt8DfW6/QlLNJNdg9dZT+DohR 7xlUpRsxbbKwwFYMwCKNnqiijcjC1ONLCWZPDwCe02oFWxKogHqQSyN3xTmDjt88VTlh kebRfqhmXXf/l7hIXtSe+F146F7WTuozdt4YiiN/yt+9Dm7aOtnYPzM71F5D33UaxYcq VS5WadQR/ZlKCKxnt7kjBdUX8ITKpFjg5ikDmIXDbhhEXWoHTMJMEOKnW+y61dxPRkSL 3H5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ndi8iZdv; 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-3203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCW+EpI+ejVsepARYkHR63Bu6uQ7+plB+JpkHYi7FOE4VeHcbFmy7Ky9E0r2GWzoAUQRAQyMfvtRXbTB0ypjvqJdSGTj66dGDdgXME5Lbg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cw6-20020a056a00450600b006ddc21cb473si1329785pfb.379.2024.02.06.01.23.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:23:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3203-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=Ndi8iZdv; 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-3203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3203-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 4AB87286377 for ; Tue, 6 Feb 2024 09:23:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6671F12E1F0; Tue, 6 Feb 2024 09:22:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Ndi8iZdv" 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 B7AB712E1D8 for ; Tue, 6 Feb 2024 09:21:59 +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=1707211321; cv=none; b=L2sVJNFmMsrdrdKh1sPwzi503MBQhjd3MaSB7q3R8Yb8NWWWSNLtBlHTOXzefTyc8FmMqoLy5dDZN30jamwnOCFRwkBsgrKK6td4TkYJHysa8eydpyU3BZqqk0LsWJ7oAk/v/GxwUmMi6Lsm+fnBmdqpZJivdapMsKng4mqEgcY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707211321; c=relaxed/simple; bh=HcVhyZSjlPRANYYSUP+7H1rf0aJwZzAh0bR02JNX+Fk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oWsYq/9eRe5xzS5Rij1YkqKdVNecKcA3DH7zy9iHjzC7m6ZUOvGn3zPZYYpwVGCrvoRvDFdxWZaVFJfGlfdsmiEVvbSL5WkPMGLamd5WSKwbtbDmkX5Bk70I3WTt2p6NMGrqoXwXSv+HuhMZX3OWV/MemZfKbL7lYH6Vl1x+nnI= 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=Ndi8iZdv; 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 416502bH001092; Tue, 6 Feb 2024 09:21:51 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=I7Z9pXR7xPBaVbNOxOy5BU1VZo2W/r1+Ueh2QiJPn94=; b=Nd i8iZdvN01Xhx1V6qCdax+8oUJW4EsSuROjiDmbkDj/pZXSv1oEE29wup+MSAzj8L b8v9dT/Z+fiOyt6hc6IuGqUj9zqoRVNEb0Ck6khKG5SpWbypTd2CPLmRkLvFBzsC OOgocPeSgwKKNqeFX4tERM9xrvheKS0xsBg7P9V5yEyQF8/OTzSg1aFP9XV+IuCU r+2u+jO8u6hSar/URDpGLicSd7VaUmXv8VVpnG3Q0EluyCYYvgh/aReTtMor+cT/ q6HFlHIJKmyAPs1Zs3tOPqLtPjPZGsXZIJdDDD30Y3Pi7Bp9BV9snElKZuEkmQoC nAToU98ENWbJ3JFwjpSg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w3e7g0ggr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Feb 2024 09:21:51 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4169LoLT020541 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 6 Feb 2024 09:21:50 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, 6 Feb 2024 01:21:48 -0800 From: Rameshkumar Sundaram To: CC: , Sriram R , Rameshkumar Sundaram Subject: [PATCH v2 07/12] wifi: ath12k: Cache vdev configs before vdev create Date: Tue, 6 Feb 2024 14:49:49 +0530 Message-ID: <20240206091954.4144454-8-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206091954.4144454-1-quic_ramess@quicinc.com> References: <20240206091954.4144454-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: KOd7uRS3NvHjMdn2aKDqTippNCpAEzRA X-Proofpoint-ORIG-GUID: KOd7uRS3NvHjMdn2aKDqTippNCpAEzRA 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-02-06_02,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 adultscore=0 mlxscore=0 mlxlogscore=716 lowpriorityscore=0 bulkscore=0 spamscore=0 clxscore=1015 priorityscore=1501 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402060065 From: Sriram R Since the vdev create for a corresponding vif is deferred until a channel is assigned, cache the information which are received through mac80211 ops between add_interface() and assign_vif_chanctx() and set them once the vdev is created on one of the ath12k radios as the channel gets assigned via assign_vif_chanctx(). 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/core.h | 19 ++++ drivers/net/wireless/ath/ath12k/mac.c | 116 +++++++++++++++++++------ 2 files changed, 107 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 8088b797419d..009d7b50b5a0 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -214,6 +214,24 @@ enum ath12k_monitor_flags { ATH12K_FLAG_MONITOR_ENABLED, }; +struct ath12k_tx_conf { + bool changed; + u16 ac; + struct ieee80211_tx_queue_params tx_queue_params; +}; + +struct ath12k_key_conf { + bool changed; + enum set_key_cmd cmd; + struct ieee80211_key_conf *key; +}; + +struct ath12k_vif_cache { + struct ath12k_tx_conf tx_conf; + struct ath12k_key_conf key_conf; + u32 bss_conf_changed; +}; + struct ath12k_vif { u32 vdev_id; enum wmi_vdev_type vdev_type; @@ -267,6 +285,7 @@ struct ath12k_vif { u8 tx_encap_type; u8 vdev_stats_id; u32 punct_bitmap; + struct ath12k_vif_cache cache; }; struct ath12k_vif_iter { diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index f8e6ac1c4a68..618c75d50547 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -2851,12 +2851,14 @@ static void ath12k_mac_op_bss_info_changed(struct ieee80211_hw *hw, ar = ath12k_get_ar_by_vif(hw, vif); - /* TODO if the vdev is not created on a certain radio, + /* if the vdev is not created on a certain radio, * cache the info to be updated later on vdev creation */ - if (!ar) + if (!ar) { + arvif->cache.bss_conf_changed |= changed; return; + } mutex_lock(&ar->conf_mutex); @@ -3350,12 +3352,11 @@ static int ath12k_clear_peer_keys(struct ath12k_vif *arvif, return first_errno; } -static int ath12k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) +static int ath12k_mac_set_key(struct ath12k *ar, enum set_key_cmd cmd, + struct ieee80211_vif *vif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) { - struct ath12k *ar; - struct ath12k_base *ab; + struct ath12k_base *ab = ar->ab; struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); struct ath12k_peer *peer; struct ath12k_sta *arsta; @@ -3363,28 +3364,11 @@ static int ath12k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, int ret = 0; u32 flags = 0; - /* BIP needs to be done in software */ - if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || - key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || - key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || - key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) - return 1; - - ar = ath12k_get_ar_by_vif(hw, vif); - if (!ar) { - WARN_ON_ONCE(1); - return -EINVAL; - } - ab = ar->ab; + lockdep_assert_held(&ar->conf_mutex); - if (test_bit(ATH12K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) + if (test_bit(ATH12K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags)) return 1; - if (key->keyidx > WMI_MAX_KEY_INDEX) - return -ENOSPC; - - mutex_lock(&ar->conf_mutex); - if (sta) peer_addr = sta->addr; else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) @@ -3476,6 +3460,43 @@ static int ath12k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, spin_unlock_bh(&ab->base_lock); exit: + return ret; +} + + +static int ath12k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + struct ieee80211_vif *vif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) +{ + struct ath12k *ar; + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); + int ret; + + /* BIP needs to be done in software */ + if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || + key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || + key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || + key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) + return 1; + + if (key->keyidx > WMI_MAX_KEY_INDEX) + return -ENOSPC; + + ar = ath12k_get_ar_by_vif(hw, vif); + if (!ar) { + /* ar is expected to be valid when sta ptr is available */ + if (sta) { + WARN_ON_ONCE(1); + return -EINVAL; + } + arvif->cache.key_conf.cmd = cmd; + arvif->cache.key_conf.key = key; + arvif->cache.key_conf.changed = true; + return 0; + } + + mutex_lock(&ar->conf_mutex); + ret = ath12k_mac_set_key(ar, cmd, vif, sta, key); mutex_unlock(&ar->conf_mutex); return ret; } @@ -4303,7 +4324,10 @@ static int ath12k_mac_op_conf_tx(struct ieee80211_hw *hw, ar = ath12k_get_ar_by_vif(hw, vif); if (!ar) { - /* TODO cache the info and apply after vdev is created */ + /* cache the info and apply after vdev is created */ + arvif->cache.tx_conf.changed = true; + arvif->cache.tx_conf.ac = ac; + arvif->cache.tx_conf.tx_queue_params = *params; return -EINVAL; } @@ -5941,6 +5965,41 @@ static int ath12k_mac_vdev_create(struct ath12k *ar, struct ieee80211_vif *vif) return ret; } +static void ath12k_mac_vif_cache_flush(struct ath12k *ar, struct ieee80211_vif *vif) +{ + struct ath12k_base *ab = ar->ab; + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); + int ret; + + lockdep_assert_held(&ar->conf_mutex); + + if (arvif->cache.tx_conf.changed) { + ret = ath12k_mac_conf_tx(arvif, 0, arvif->cache.tx_conf.ac, + &arvif->cache.tx_conf.tx_queue_params); + if (ret) + ath12k_warn(ab, + "unable to apply tx config parameters to vdev %d\n", + ret); + } + + if (arvif->cache.bss_conf_changed) + ath12k_mac_bss_info_changed(ar, arvif, &vif->bss_conf, + arvif->cache.bss_conf_changed); + + if (arvif->cache.key_conf.changed) { + ret = ath12k_mac_set_key(ar, arvif->cache.key_conf.cmd, + vif, NULL, + arvif->cache.key_conf.key); + if (ret) { + WARN_ON_ONCE(1); + ath12k_warn(ab, "unable to apply set key param to vdev %d ret %d\n", + arvif->vdev_id, ret); + } + } + + memset(&arvif->cache, 0, sizeof(struct ath12k_vif_cache)); +} + static struct ath12k *ath12k_mac_assign_vif_to_vdev(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_chanctx_conf *ctx) @@ -6023,10 +6082,11 @@ static struct ath12k *ath12k_mac_assign_vif_to_vdev(struct ieee80211_hw *hw, goto unlock; } - /* TODO If the vdev is created during channel assign and not during + /* If the vdev is created during channel assign and not during * add_interface(), Apply any parameters for the vdev which were received * after add_interface, corresponding to this vif. */ + ath12k_mac_vif_cache_flush(ar, vif); unlock: mutex_unlock(&ar->conf_mutex); out: -- 2.25.1