From patchwork Tue May 14 04:41:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram R X-Patchwork-Id: 10942009 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 1EC3B1398 for ; Tue, 14 May 2019 04:41:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09926285D6 for ; Tue, 14 May 2019 04:41:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFA18285DA; Tue, 14 May 2019 04:41:50 +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 8FAB7285DB for ; Tue, 14 May 2019 04:41:50 +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=7r85bosDu64Sby11rTt7qa/oHvqkRvY9bsYhmmS2iws=; b=c1djRx1ScJY8rOAo9gJZUECWPn dEcC/PjNTE8Bfm3hx8y5kX6AxEsaIDK7rT+fJPLH2U7icRs2nnONzyqu2T9Q8JZBupwSjMTn2Ao0I PxI7WbC14Q6UVl9J4Xu3LDAK227rMWMpT+G2zFPx0bdtXqOhnIfwmJLIbVdCWoEkA2s1eRRv10bWG 6Yaz3r78PrlQDDFu+U49cB7sM68c1H1jYFrxC4Fnquo7HM1vUVkpVDT0vaqa9V4JLEbpJaQo0eqtB WCiiZLgq11csQh2f/jg5UPl1/EvBlUCvzmFzl402XYY1IvelLs6q9ky0B0cVUJq5Dde2m+ABqg2OF tVgQ1g7Q==; 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 1hQPG9-0001Bi-QJ; Tue, 14 May 2019 04:41:49 +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 1hQPG7-0001BN-Af for ath11k@lists.infradead.org; Tue, 14 May 2019 04:41:48 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 108AB60A05; Tue, 14 May 2019 04:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557808907; bh=w9TEf2OmEBwxT/VoGpryTV9gzH6Yxc2Fz3BkDMNDXE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PF4vGc4Cb3XhAM8MnCyJ/TET8ides/gCkUOJ/cl5SzNcsr18mYj4jtebsd+qvcY9k aM0/ECez6BI8hBQYNyuoNo8EXr1Xm1JmBZQXmMAlRmATkMjzbJw7e+dUUTIDlZNOn6 oxlyD9mlXNuzhgtipKnKzGjmApvfgIzHYGChahgw= 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 AD57B6076A; Tue, 14 May 2019 04:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557808906; bh=w9TEf2OmEBwxT/VoGpryTV9gzH6Yxc2Fz3BkDMNDXE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FMd2wAqeVB6RuqNPePGcktwkMePODXfmH8rv3s/dpZwNr0EvnxsCxm6AmVIFcd6m9 FoHvtpzchNHIJ17HHTtcr9zju8zvBilUMCBSc9+Rv8MV7kDZbh6RrvL/XGw/JEy1Jx +8l4NCJXxYpVKhbfgVZfEQ4FRjEu+/l3ieJJBq1o= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AD57B6076A 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 1/3] ath11k: Process radar detected event Date: Tue, 14 May 2019 10:11:17 +0530 Message-Id: <1557808879-26933-2-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_214147_403374_6DC13C17 X-CRM114-Status: GOOD ( 10.70 ) 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 for processing radar detected event coming from the firmware. The detected radar is indicated to mac80211 after checking the validity of detection. Signed-off-by: Sriram R --- drivers/net/wireless/ath/ath11k/wmi.c | 56 +++++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/wmi.h | 13 ++++++++ 2 files changed, 69 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 5712ac0..434508f 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -5770,6 +5770,59 @@ ath11k_wmi_pdev_csa_switch_count_status_event(struct ath11k_base *ab, kfree(tb); } +static void +ath11k_wmi_pdev_dfs_radar_detected_event(struct ath11k_base *ab, + u8 *evt_buf, + u32 len) +{ + const void **tb; + const struct wmi_pdev_radar_ev *ev; + struct ath11k *ar; + int ret; + + tb = ath11k_wmi_tlv_parse_alloc(ab, evt_buf, len, GFP_ATOMIC); + if (IS_ERR(tb)) { + ret = PTR_ERR(tb); + ath11k_warn(ab, "failed to parse tlv: %d\n", ret); + return; + } + + ev = tb[WMI_TAG_PDEV_DFS_RADAR_DETECTION_EVENT]; + + if (!ev) { + ath11k_warn(ab, "failed to fetch pdev dfs radar detected ev"); + kfree(tb); + return; + } + + ath11k_dbg(ab, ATH11K_DBG_WMI, + "pdev dfs radar detected on pdev %d, detection mode %d, chan freq %d, chan_width %d, detector id %d, seg id %d, timestamp %d, chirp %d, freq offset %d, sidx %d", + ev->pdev_id, ev->detection_mode, ev->chan_freq, ev->chan_width, + ev->detector_id, ev->segment_id, ev->timestamp, ev->is_chirp, + ev->freq_offset, ev->sidx); + + ar = ath11k_get_ar_by_pdev_id(ab, ev->pdev_id); + + if (!ar) { + ath11k_warn(ab, "radar detected in invalid pdev %d\n", + ev->pdev_id); + goto exit; + } + + if (ar->rx_channel && ar->rx_channel->center_freq != (ev->chan_freq + - ev->freq_offset)) { + ath11k_warn(ab, "Radar detected in non-operating channel"); + goto exit; + } + + ath11k_dbg(ar->ab, ATH11K_DBG_REG, "Radar Detected in pdev %d\n", + ev->pdev_id); + + ieee80211_radar_detected(ar->hw); + +exit: + kfree(tb); +} static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb) { struct wmi_cmd_hdr *cmd_hdr; @@ -5858,6 +5911,9 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb) ath11k_dbg(ab, ATH11K_DBG_WMI, "ignoring unsupported event 0x%x\n", id); break; + case WMI_PDEV_DFS_RADAR_DETECTION_EVENTID: + ath11k_wmi_pdev_dfs_radar_detected_event(ab, data, len); + break; /* TODO: Add remaining events */ default: ath11k_warn(ab, "Unknown eventid: 0x%x\n", id); diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index 5d20f57..d640cdf 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -4557,6 +4557,19 @@ struct wmi_pdev_csa_switch_ev { u32 num_vdevs; } __packed; +struct wmi_pdev_radar_ev { + u32 pdev_id; + u32 detection_mode; + u32 chan_freq; + u32 chan_width; + u32 detector_id; + u32 segment_id; + u32 timestamp; + u32 is_chirp; + s32 freq_offset; + s32 sidx; +} __packed; + enum wlan_phymode { WLAN_PHYMODE_AUTO = 0, WLAN_PHYMODE_11A = 1,