Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp232044rwd; Wed, 31 May 2023 22:31:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5LIauE9fwfygKeqsY+ra2gvULaJeCmrJuceGBb/bwBxzQypWj6XC6Gcm/6NeVeRV/jM/Yi X-Received: by 2002:a05:6808:3405:b0:398:4d7f:6c7e with SMTP id by5-20020a056808340500b003984d7f6c7emr5950240oib.46.1685597492389; Wed, 31 May 2023 22:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685597492; cv=none; d=google.com; s=arc-20160816; b=aSvqWahXDPbpQAY2kZzis3pC9u8UwS9vQeK2ycN16fWaUngvLA5YcFiWW+gdWNrZ/o fDqKYh3XY7p+un0q30clKNQl6m2EfKQmyIksi7ijil9+iEgMWcaZVCejXot4LIL9X03Y FG2ZmJJooccT03BiDgjX2OOo2C/IhkugJcKn/Tbb8pkTzqqKzT7W40UtXX5IN7+sd1Oz I2m2u+L6QQ4LdgfKELUdArKSwqQyrguHColbAx0N0HBjTWLaKX2xCKdEg7Yz0zXquYN0 BkGzwVvAeymMjcBl2O0rLULKTANqyt5LS99A4f+4Jh3jnTSxNLx7YpM7Ki1XuURVyp0M jGgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=Yy3oREs4FT+zq89LduHz1C83zuAHJT623vPqz8MkuEU=; b=c2Sgz2LhPgrqC029ZBtKUnOoHuC5CqwzdAw7dB1vzAmDrtebs9mvQ4a/JDIjc2qiAA KSjFd/t76y0QGIJml4QLW86fAVDBsapaQ/W9YVrGwNWF9eXjaIG5zmXYuwxFovdKpz/R nHOh4DQSBF5Ep1XR3rT/A8r97qmRHSJKw0J8rpAvX0tlZ2o/UxPKSMurLyueA2plmg6x 33+DLv8HZl2qCfaIkO69CtUOvxvwrWQC7BG4WRvwsPKvLwbX+u5Z9AXU/jUjvk0Du/Rl Ejf6otIBhnH/mmlutcNOewpnubAP/uFdnl8QMg6JpsjUAD8QPvfSci3OMCgltkw/upLJ iXVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=EOH9VQZA; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v2-20020a1709028d8200b001a637201992si2005025plo.488.2023.05.31.22.31.21; Wed, 31 May 2023 22:31:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=EOH9VQZA; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231298AbjFAFTp (ORCPT + 64 others); Thu, 1 Jun 2023 01:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229851AbjFAFTn (ORCPT ); Thu, 1 Jun 2023 01:19:43 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AB12129 for ; Wed, 31 May 2023 22:19:41 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 351578ox031911; Thu, 1 Jun 2023 05:19:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=Yy3oREs4FT+zq89LduHz1C83zuAHJT623vPqz8MkuEU=; b=EOH9VQZAuEUxQfeBTuodKPMomatDtimG66vOo9fbfr10BmTFsSkCUWYkxy4sVIDCV+ha XnDK54sq6c8kqBBFYprp92owUoEI38W9MPa2ER/aAN0q4VZbloiUd1QG+oVl2xWDX4Yx tsD6EONkRaj9O/h/E7Wqp/6dVHcrepzZy3hTsR1CZK+vsb5vbd8PNUTR+tVa0htcm9VT ob0aIUEWBpGTlxmFyF68HIIxk/UM5KaRvVhQ1TFhldYl6tTqehuDS6+wTXVb3jT3IuIW i5C5rTV66CxC2193hkJV4eTnX9jNIYA2UQQ2OHZQjr7yroiG/AnpKiiXGYaD+VYdcFNE Zg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qxkbu05de-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Jun 2023 05:19:32 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3515JVd5011445 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 1 Jun 2023 05:19:31 GMT Received: from rajkbhag-linux.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 31 May 2023 22:19:28 -0700 From: Raj Kumar Bhagat To: CC: , Venkateswara Naralasetty , Raj Kumar Bhagat Subject: [PATCH v2] wifi: ath11k: update proper pdev/vdev id for testmode command Date: Thu, 1 Jun 2023 10:49:07 +0530 Message-ID: <20230601051907.13679-1-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: zcGklWjSgGuDuTXtOqyWU9ZXJc-AFfOk X-Proofpoint-GUID: zcGklWjSgGuDuTXtOqyWU9ZXJc-AFfOk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-01_02,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 phishscore=0 clxscore=1011 priorityscore=1501 suspectscore=0 impostorscore=0 mlxlogscore=999 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010045 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Venkateswara Naralasetty User can extend test mode command support to set vdev and pdev params for debug purpose at run time by sending vdev/pdev param set command through the testmode command interface. Fill the proper pdev/vdev id in driver since, pdev/vdev id details may not be available at user space. It will make sure that the proper vdev/pdev ids are sent to firmware. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Signed-off-by: Venkateswara Naralasetty Signed-off-by: Raj Kumar Bhagat --- Depends-On: [v4,3/4] wifi: ath11k: factory test mode support v2: - Rebased and validated on latest version (v4) of dependency patch. --- drivers/net/wireless/ath/ath11k/testmode.c | 37 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/testmode.c b/drivers/net/wireless/ath/ath11k/testmode.c index 9dbe88e0546b..c5caa3449751 100644 --- a/drivers/net/wireless/ath/ath11k/testmode.c +++ b/drivers/net/wireless/ath/ath11k/testmode.c @@ -290,13 +290,16 @@ static int ath11k_tm_cmd_testmode_start(struct ath11k *ar, struct nlattr *tb[]) return ret; } -static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[]) +static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[], + struct ieee80211_vif *vif) { struct ath11k_pdev_wmi *wmi = ar->wmi; struct sk_buff *skb; + struct ath11k_vif *arvif; u32 cmd_id, buf_len; - int ret; + int ret, tag; void *buf; + u32 *ptr; mutex_lock(&ar->conf_mutex); @@ -320,6 +323,34 @@ static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[]) cmd_id = nla_get_u32(tb[ATH11K_TM_ATTR_WMI_CMDID]); + /* Make sure that the buffer length is long enough to + * hold TLV and pdev/vdev id. + */ + if (buf_len < sizeof(struct wmi_tlv) + sizeof(u32)) { + ret = -EINVAL; + goto out; + } + + ptr = buf; + tag = FIELD_GET(WMI_TLV_TAG, *ptr); + + /* pdev/vdev id start after TLV header */ + ptr++; + + if (tag == WMI_TAG_PDEV_SET_PARAM_CMD) + *ptr = ar->pdev->pdev_id; + + if (ar->ab->fw_mode != ATH11K_FIRMWARE_MODE_FTM && + (tag == WMI_TAG_VDEV_SET_PARAM_CMD || tag == WMI_TAG_UNIT_TEST_CMD)) { + if (vif) { + arvif = (struct ath11k_vif *)vif->drv_priv; + *ptr = arvif->vdev_id; + } else { + ret = -EINVAL; + goto out; + } + } + ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, "testmode cmd wmi cmd_id %d buf length %d\n", cmd_id, buf_len); @@ -453,7 +484,7 @@ int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, case ATH11K_TM_CMD_GET_VERSION: return ath11k_tm_cmd_get_version(ar, tb); case ATH11K_TM_CMD_WMI: - return ath11k_tm_cmd_wmi(ar, tb); + return ath11k_tm_cmd_wmi(ar, tb, vif); case ATH11K_TM_CMD_TESTMODE_START: return ath11k_tm_cmd_testmode_start(ar, tb); case ATH11K_TM_CMD_WMI_FTM: -- 2.17.1