From patchwork Tue May 14 04:41:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram R X-Patchwork-Id: 10942013 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CFE9912 for ; Tue, 14 May 2019 04:41:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AF69285D6 for ; Tue, 14 May 2019 04:41:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F926285DA; Tue, 14 May 2019 04:41:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C90BE285DB for ; Tue, 14 May 2019 04:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=H0DPnj1QIo67wOv5lejZMBTCbSVZYCaQtfizEgvqVZY=; b=bY2QUb8cezLClOYObifWefOOFE 1L07zB7NrU3OFIYlST+3M8tOSlLspV9/7f5rwp/w8tEl20f7llNDS5761zgC12jrVSL5RumS/ogaM Ixcryrd9eDp+9wXNpHzSG7HilwTmvZF5i+46knqMZyQdNvwAlRxlsLLH216vK9+0T7rPn6VlZm8qK o0We/A4/TqpiRiP1ZQsuFFPNe7gi6aAYoGb9PnrdGVdGQeT5EdMCIVALLruQ21iygyNGlKrQMlMnh aNqr37qB0trx8olAINECqvYBUSPEvO/K8Kgon7LMxBqU3FLUeFkpZSXXis1pd398jdGn8gOmgIa5l k19y1/Sw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hQPGH-0001Df-3M; Tue, 14 May 2019 04:41:57 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hQPGE-0001Cy-FH for ath11k@lists.infradead.org; Tue, 14 May 2019 04:41:56 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3921A60303; Tue, 14 May 2019 04:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557808914; bh=KupPV6g6dq+Viv3cHVeoy9I9ZqOGtxBK8Kpgj27hgws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rd02nKjiiJbzXC5fv0AqU4zcNQAKF49jrd6BBX/jKdbnGPPBz/0guw/M5muGWvYVU vxrJ1u516CpWP2xutclJDStBnenh/ekD+Em6y2EWdXkjhdw/gMvG2Sx9iGcikUxm2I 9bpOpcHZ6GOVEJQYyPyeB72JyLYxgLR6NwrUnKKs= Received: from checstp253621-lin.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: srirrama@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 97DBE60112; Tue, 14 May 2019 04:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557808913; bh=KupPV6g6dq+Viv3cHVeoy9I9ZqOGtxBK8Kpgj27hgws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZJfKcs3+AQ5rIj8NjC2Xh/eQFSx1ovcfq3hg9tIlyItq8cylQ2+LN8/qdBQlFgzd3 jCdc2rPtTI5Z1sLhLzWdO6hZzpR5qjRd17brQ6yNsGH4bOMBVPvGdTeHbmE95BhOAU a9Y8whVZpwid0/9E20f4XeCTNuH0x0n63O2MZrSY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 97DBE60112 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=srirrama@codeaurora.org From: Sriram R To: ath11k@lists.infradead.org Subject: [PATCH 3/3] ath11k: Add dfs debug and test interface Date: Tue, 14 May 2019 10:11:19 +0530 Message-Id: <1557808879-26933-4-git-send-email-srirrama@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557808879-26933-1-git-send-email-srirrama@codeaurora.org> References: <1557808879-26933-1-git-send-email-srirrama@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190513_214154_542267_97ADCE07 X-CRM114-Status: GOOD ( 15.47 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sriram R MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support to simulate radar to validate DFS implementation of NOL, NOP in firmware, host and CSA offload. This is done with the help of FW Unit test commands. Also block_radar_events is used to validate the firmware/host DFS implementation and behavior when the detected radar is not indicated to mac80211. Signed-off-by: Sriram R --- drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/debug.c | 28 +++++++++ drivers/net/wireless/ath/ath11k/wmi.c | 104 +++++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath11k/wmi.h | 28 +++++++++ 4 files changed, 159 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 7b98649..148c9a4 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -515,6 +515,7 @@ struct ath11k { #ifdef CONFIG_ATH11K_DEBUGFS struct ath11k_debug debug; #endif + bool dfs_block_radar_events; }; struct ath11k_band_cap { diff --git a/drivers/net/wireless/ath/ath11k/debug.c b/drivers/net/wireless/ath/ath11k/debug.c index b6e1893..4580c15 100644 --- a/drivers/net/wireless/ath/ath11k/debug.c +++ b/drivers/net/wireless/ath/ath11k/debug.c @@ -1099,12 +1099,31 @@ static ssize_t ath11k_read_pktlog_filter(struct file *file, return simple_read_from_buffer(ubuf, count, ppos, buf, len); } +static ssize_t ath11k_write_simulate_radar(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct ath11k *ar = file->private_data; + int ret; + + ret = ath11k_wmi_simulate_radar(ar); + if (ret) + return ret; + + return count; +} + static const struct file_operations fops_pktlog_filter = { .read = ath11k_read_pktlog_filter, .write = ath11k_write_pktlog_filter, .open = simple_open }; +static const struct file_operations fops_simulate_radar = { + .write = ath11k_write_simulate_radar, + .open = simple_open +}; + int ath11k_debug_register(struct ath11k *ar) { struct ath11k_base *ab = ar->ab; @@ -1140,6 +1159,15 @@ int ath11k_debug_register(struct ath11k *ar) ar->debug.debugfs_pdev, ar, &fops_pktlog_filter); + if (ar->hw->wiphy->bands[NL80211_BAND_5GHZ]) { + debugfs_create_file("dfs_simulate_radar", 0200, + ar->debug.debugfs_pdev, ar, + &fops_simulate_radar); + debugfs_create_bool("dfs_block_radar_events", 0200, + ar->debug.debugfs_pdev, + &ar->dfs_block_radar_events); + } + return 0; } diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 8364e44..4f2ac21 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -5815,10 +5815,13 @@ ath11k_wmi_pdev_dfs_radar_detected_event(struct ath11k_base *ab, goto exit; } - ath11k_dbg(ar->ab, ATH11K_DBG_REG, "Radar Detected in pdev %d\n", + ath11k_dbg(ar->ab, ATH11K_DBG_REG, "DFS Radar Detected in pdev %d\n", ev->pdev_id); - ieee80211_radar_detected(ar->hw); + if (ar->dfs_block_radar_events) + ath11k_info(ab, "DFS Radar detected, but ignored as requested\n"); + else + ieee80211_radar_detected(ar->hw); exit: kfree(tb); @@ -5960,6 +5963,103 @@ static int ath11k_connect_pdev_htc_service(struct ath11k_base *sc, return 0; } +static int +ath11k_wmi_send_unit_test_cmd(struct ath11k *ar, + struct wmi_unit_test_cmd ut_cmd, + u32 *test_args) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct wmi_unit_test_cmd *cmd; + struct sk_buff *skb; + struct wmi_tlv *tlv; + void *ptr; + u32 *ut_cmd_args; + int buf_len, arg_len; + int ret; + int i; + + arg_len = (sizeof(u32) * ut_cmd.num_args); + buf_len = sizeof(ut_cmd) + arg_len + TLV_HDR_SIZE; + + skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, buf_len); + if (!skb) + return -ENOMEM; + + cmd = (struct wmi_unit_test_cmd *)skb->data; + cmd->tlv_header = + FIELD_PREP(WMI_TLV_TAG, + WMI_TAG_UNIT_TEST_CMD) | + FIELD_PREP(WMI_TLV_LEN, sizeof(ut_cmd) - TLV_HDR_SIZE); + + cmd->vdev_id = ut_cmd.vdev_id; + cmd->module_id = ut_cmd.module_id; + cmd->num_args = ut_cmd.num_args; + cmd->diag_token = ut_cmd.diag_token; + + ptr = skb->data + sizeof(ut_cmd); + + tlv = ptr; + tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_UINT32) | + FIELD_PREP(WMI_TLV_LEN, arg_len); + + ptr += TLV_HDR_SIZE; + + ut_cmd_args = ptr; + for (i = 0; i < ut_cmd.num_args; i++) + ut_cmd_args[i] = test_args[i]; + + ret = ath11k_wmi_cmd_send(wmi, skb, + WMI_UNIT_TEST_CMDID); + + if (ret) { + ath11k_warn(ar->ab, + "failed to send WMI_UNIT_TEST CMD :%d\n", + ret); + dev_kfree_skb(skb); + } + ath11k_dbg(ar->ab, ATH11K_DBG_WMI, + "WMI unit test : module %d vdev %d n_args %d token %d\n", + cmd->module_id, cmd->vdev_id, cmd->num_args, + cmd->diag_token); + + return ret; +} + +int ath11k_wmi_simulate_radar(struct ath11k *ar) +{ + struct ath11k_vif *arvif; + u32 dfs_args[DFS_MAX_TEST_ARGS]; + struct wmi_unit_test_cmd wmi_ut; + bool arvif_found = false; + + list_for_each_entry(arvif, &ar->arvifs, list) { + if (arvif->is_started && arvif->vdev_type == WMI_VDEV_TYPE_AP) { + arvif_found = true; + break; + } + } + + if (!arvif_found) + return -EINVAL; + + dfs_args[DFS_TEST_CMDID] = 0; + dfs_args[DFS_TEST_PDEV_ID] = ar->pdev->pdev_id; + /* Currently we could pass segment_id(b0 - b1), chirp(b2) + * freq offset (b3 - b10) to unit test. For simulation + * purpose this can be set to 0 which is valid. + */ + dfs_args[DFS_TEST_RADAR_PARAM] = 0; + + wmi_ut.vdev_id = arvif->vdev_id; + wmi_ut.module_id = DFS_UNIT_TEST_MODULE; + wmi_ut.num_args = DFS_MAX_TEST_ARGS; + wmi_ut.diag_token = DFS_UNIT_TEST_TOKEN; + + ath11k_dbg(ar->ab, ATH11K_DBG_REG, "Triggering Radar Simulation\n"); + + return ath11k_wmi_send_unit_test_cmd(ar, wmi_ut, dfs_args); +} + int ath11k_wmi_connect(struct ath11k_base *sc) { u32 i; diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index bd7e88a..e972154 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -4113,6 +4113,32 @@ struct wmi_pktlog_disable_cmd { u32 pdev_id; } __packed; +#define DFS_PHYERR_UNIT_TEST_CMD 0 +#define DFS_UNIT_TEST_MODULE 0x2b +#define DFS_UNIT_TEST_TOKEN 0xAA + +enum dfs_test_args_idx { + DFS_TEST_CMDID = 0, + DFS_TEST_PDEV_ID, + DFS_TEST_RADAR_PARAM, + DFS_MAX_TEST_ARGS, +}; + +struct wmi_dfs_unit_test_arg { + u32 cmd_id; + u32 pdev_id; + u32 radar_param; +}; + +struct wmi_unit_test_cmd { + u32 tlv_header; + u32 vdev_id; + u32 module_id; + u32 num_args; + u32 diag_token; + /* Followed by test args*/ +} __packed; + #define MAX_SUPPORTED_RATES 128 #define WMI_PEER_AUTH 0x00000001 @@ -4199,6 +4225,7 @@ enum wmi_vdev_start_resp_status_code { WMI_VDEV_START_RESPONSE_DFS_VIOLATION = 3, }; +; enum cc_setting_code { REG_SET_CC_STATUS_PASS = 0, REG_CURRENT_ALPHA2_NOT_FOUND = 1, @@ -5204,4 +5231,5 @@ size_t ath11k_wmi_fw_stats_num_vdevs(struct list_head *head); void ath11k_wmi_fw_stats_fill(struct ath11k *ar, struct ath11k_fw_stats *fw_stats, u32 stats_id, char *buf); +int ath11k_wmi_simulate_radar(struct ath11k *ar); #endif