From patchwork Tue Dec 19 11:28:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10123083 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.web.codeaurora.org (Postfix) with ESMTP id 2904A6019C for ; Tue, 19 Dec 2017 11:29:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 279B229280 for ; Tue, 19 Dec 2017 11:29:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CB4D292A2; Tue, 19 Dec 2017 11:29:31 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 559DF29280 for ; Tue, 19 Dec 2017 11:29:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965310AbdLSL32 (ORCPT ); Tue, 19 Dec 2017 06:29:28 -0500 Received: from mail-by2nam03on0052.outbound.protection.outlook.com ([104.47.42.52]:40224 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965176AbdLSL3Y (ORCPT ); Tue, 19 Dec 2017 06:29:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PlVh2ofjNj9zcrrJ8Dt5ig61w/KUruoSU7rwKvMwUYg=; b=tlVidBKKIB5AlQBvaXBPK4CY5ICHaf9SZR4stX4ZSOzCerIOmAIdTv+WJW2ltxG57mn28pWsh+miFwelA4ypbS+Um5dNSfcPKD60V4QNHyUCSJ1KPc6sLD2Ao/y8EpBV8yekwCJq8cRt6/uKsrz0rzoyKTMWqZQbm0UicnBhQCQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BLUPR05MB1923.namprd05.prod.outlook.com (10.162.224.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.10; Tue, 19 Dec 2017 11:29:20 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil Subject: [PATCH v2 03/10] qtnfmac: add support for radar detection and CAC Date: Tue, 19 Dec 2017 14:28:49 +0300 Message-Id: <20171219112856.22463-4-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171219112856.22463-1-sergey.matyukevich.os@quantenna.com> References: <20171219112856.22463-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM6PR0502CA0022.eurprd05.prod.outlook.com (52.133.16.163) To BLUPR05MB1923.namprd05.prod.outlook.com (10.162.224.13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7727472-e050-4643-cedb-08d546d3bfe5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307); SRVR:BLUPR05MB1923; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1923; 3:BVe7FgjB9OgiV/bzjXVvVLgDVLstosUaL6+pMy1SYGo41YetyVF/vnMTS5tnSocDJnFUWwsjNIGXN7g/FSXxDPeHzoBo+V4cp96FsowfJcJDKiZpeY7KPIaaukWlN4WbdgQItq+trvAs3awGgw6HnWiSL1nTXyl3uylJyoBSiHuWnYQnk7u6AD1szt48yrOItxKi+pD4RcoUwAfImZ5v2YuWTR1o0hWWYlHXAKB4YEkFmBoPywrSdb9O5p052gtk; 25:v3Awh23mvX90VXBrZMeYuzqitZcDH8oTkfWsorgn4x5NWsz7Yu1y9m9CbmdoDvlU7ighAMweKVOKx2XNyGZgS+l/synwsZGOxqwRO91udzzXsdwsfxYGaf3w1ZHWP9hoTumnM6ZpOXIOxRMVWosFAvmu7zpoSpOiFdu85LzLleGy2IFuNvuTwHo6sn/VeLjFdLBBlkTim2y84U4MS4hlrvepiI07biiD3N557CjaL/GV1IOGbV5IrgoTzgdtNcfb+9D4nGEKQTBs2FCtOtVoXeRnulF2gSYtY73DE9gi6/mw3oxKZZrrZwWPgiPqwPfvsCVtTsAIYBfsJWvC7RqMIqeyCTsqtFZVSjArSCxUaNk=; 31:yhvib/WIvKrd+vbfUZaXI96CPUoo6LCsqx5dIF+M69OX9zFVWQBa39rDQLm8qM2uyb61m1Qgu67Ok+0P9+Y5KJSzlVXYyR9Abk6d/HuV2SCel00fzpVSQDGc/ptPJkKzKs+kOQiixo+1jkEFJ0/5N8topRUZlslNzeRkr0oQPvLrqG6X5/FWfAnmZaSIM/gHYQvGag35SXq0j5gBBF5VjisnlzjU6mkZPtWFTyaY7Ew= X-MS-TrafficTypeDiagnostic: BLUPR05MB1923: X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1923; 20:eWT+mUP2278pvfAnQYwrfwxyD0J7bjq4Fl0aZkJmLk9c7Mc0mvNQxgxcoRu/MERC31I9s8tl8H66VIQIc0tREo+5xJvAXxYs7qxSFVFt70hVY1H9Zrcbm47CreU73PkcvsMDUwYIBqIKPLRpSY4ymkh0oyRhBc7nnDJ/H3DzMM4azv0UjwYrTY79QJ+X3AjDsM9h5M4XFyKRcaSgZJN+BNLGf1RlHq0S2qdI1GN2fO8PnkMSZ5uFqpg2zOg7Dj2plEDnx5eL6vREEy+z5xsXn25drURmww2LiNHrb9RyF2CFIpKPCNOUhSllaSYNujGBHPm7Atqx0RsgKcr55bZ3ZhdoxgXIihQxkK1TTZTbYHY1NVd8/wZ92Sqveomvmt9pUb3wAkV/eWjK65MFybv2A8ftbSb14xoqZvrTDTCsvZkYHsi0o1AvuSXN5+1IFByBlH7FoUaC3tJcUD14ncpygh+DYXyUZg25Bg0QOMhUa4Kf/ozjh/8gpER3JQw3PEhF; 4:2B2Ien+w2l1sJH7lvEi1C4x1EtJHHApRaPVnnMvhpsb6cdGK6AtxRmtldhFMTLI/wKFWTLdQG259TW8vxGTWZoz6bMgmqGtJ+7sIMFFoNGoVqmIGMmwUI9D+5RxQb/ZN+hfzkd78Q6oZ/8OmiC9F5RohINRpREBWimXN9G9DKZayUjDrbFOdSSWcRrRgIk+fju937FWiqSRLyFVnGhwkB6gvjqYjfYoc87KPXEft1FNL0asqIHivLWsXln10lu/TlhXSTEtFzdw8T+7rJHnOAszS0AdokxgDC02f9tLPioS3C3u+2n9ai5WsgBADGF0Q X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(3231023)(10201501046)(93006095)(93001095)(6041248)(20161123560025)(20161123564025)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011); SRVR:BLUPR05MB1923; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR05MB1923; X-Forefront-PRVS: 052670E5A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39840400004)(346002)(396003)(189003)(199004)(48376002)(68736007)(50466002)(59450400001)(5660300001)(2950100002)(6666003)(6916009)(316002)(52116002)(76176011)(386003)(7696005)(97736004)(51416003)(16526018)(16586007)(107886003)(25786009)(575784001)(54906003)(4326008)(69596002)(86362001)(53936002)(2906002)(81156014)(103116003)(6486002)(2361001)(2351001)(478600001)(8676002)(50226002)(1076002)(8936002)(7736002)(81166006)(66066001)(47776003)(106356001)(105586002)(3846002)(36756003)(6116002)(305945005)(53416004); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB1923; H:bars.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB1923; 23:N2UBepIWrxOT1uFIVmxRpNaV6NKNRHpMKJ/kLPBtC?= =?us-ascii?Q?7QB4w+kLdKEQ7rrxH+ZoB6gVK8hrR/sPGyH3sFD3i/PGJdVkSFnxbcT6pnPu?= =?us-ascii?Q?IFvtkkVIuqg9fJR4LwtpHlr/lJoR9n2nJJWqy+7vkKG+Fpxc0avKPlX7vqJk?= =?us-ascii?Q?xbdpiZeJLd50xSUjn4wlySAyeuF35to0Zgbo78wiucag4sz7RFmTKAxEEKhe?= =?us-ascii?Q?Gtlf2jKfIacGKyl2ZIYXgM6xrSwU7S4d2Wj8Oq6o1mZApDu7KOwjrW8aSDuP?= =?us-ascii?Q?zhof6FSTXB0FVyiFQg0hEfVpODWcRhwrRzQ+mI+8oknUSOx2lWUEpvNuzE9E?= =?us-ascii?Q?rNT7IvaIvWlEsq6TguUaAzqhvh3ajyUJu7O9J5zxCBJfreUsprmy3MLgif3v?= =?us-ascii?Q?tKYT0s0n0TbpUTF1EHXT+EHt0gqAYr+tMMEhZDVjkKg68c7vYJGDZzoQKXL8?= =?us-ascii?Q?XP6yyyfv3wz1LV6/HgugxFEf1auRtGxjzKlRMpDwmeBDFL5Zg8BHH1VDVArT?= =?us-ascii?Q?XTf+Yqmd0GOMqKJydzsmvu0m1+lBIW7VY3siiN5TYZxbNF/bF+qQvXZPl35w?= =?us-ascii?Q?EAjJ0qMFxh+mc+MFSS6e11oEwOScIHWSWfT+QP9QlR/HaxRrtXnNxcbfIX3r?= =?us-ascii?Q?5w0qpEt1V7399o94Y+8Q/boBBaSCQegeH2KuiVkFlWzG0ath83VCWVo2lG0k?= =?us-ascii?Q?LRvNchWvQaY4+Fn3njevAUxqEokuB0iww/hPn0/itE/i7M4lLcoypfu1JTh3?= =?us-ascii?Q?cDAVCAvc6Y6Q35Um6ciMLn1rCWu86i504yLrdgI8hbRMp01h5ARfaPMwTGvC?= =?us-ascii?Q?XAMZVmv6yAPgxoQChIXpmoXCyb+0meQ7joazDcQKXulpCGO2Qbc8sDnoFpJk?= =?us-ascii?Q?HrFO4vsmAw3i9gHitrulUkTOyg54uJDUCsFm4MReacvljcYcapDFnhVg+CKz?= =?us-ascii?Q?VcuhEascwoieAP8uAetyQCixnCPEcDnekVzUuDS99G1fpRkb4t8x/YuxkOfq?= =?us-ascii?Q?dPnrtjppTeQ4lDy7Zv6z8YvW10IlBlq8ntBJPnOFBvznnehewze2HuR14Cst?= =?us-ascii?Q?HFmXIHCOikzOTZ7y2+XY2Jujpv6gaQiA4lp9S4Eo4VBp268NXkhRSm193CML?= =?us-ascii?Q?9dpvUfS9Dd6OoulFH0fyHxvtPnoApcXsqz5nnByUpjgGeAr62X1oofPNL4Yc?= =?us-ascii?Q?AcvDXRR6LZCaEPrc6SX5e5y5Ck1/Xwo2sjuVAl8TBx+R4RW8XvwFretSwwuQ?= =?us-ascii?Q?NtFrsYY9aaRfghoPyo=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1923; 6:DT4tFInAzUdBULMwPtAZRPvoFt5qXFyPF081C1V6JINcnZEYyBIHcfu30sfxjgYuQ80SJjfFBrSmxjx3bxJLfXl16NOHEuTSgXmwXaKbcxZqYvTy5ciNHTku9M1Zd0hYFWhyRlYG63AMRiG8Z5BiQzXVo0tngaRClAmjUm80LPbK2U7flc4sCz1CPgPdmLNfYYofmzJTphBNF2A1sIrtzqTHlsxskInlwZlqtanyhJT9pYYr5aZ4ZMrqApjehfipdaVoT4VC4DV2btLGYTvNwMJUkXIXketdmUVlogKAVq9xLAzb7Qpx9DYj/7InqeQwIZVtOM13UbBuivIYOdcrxBv/dwqAhu2fXsQ/2fkjUTg=; 5:r782pxISmUh44Gn+QEnf4tSPYDVdnk1LE3jlL/QhAXU7VvLQIecsQyg/IJk64JRp9MxDX+s/7Lrr/VWFemjuFvY4HssvsQAu3vaw2rJ/6ub1qlPozCf5owcN9yPNmRod8RPJhEPmkQLWg2iPHFJN+YPz+a66sWZtSo20/9U+keM=; 24:SuJKdfgHns+IJ5ZGFih+ycEMHCzkJMhTCh2Pv2ksiubdDQ3aj7ZZZa5wT6OaBBlm5TZsQ7xwLsY5HYKKEp5UpxZNrXOH3fXtGjB6OOfNN1Q=; 7:W5nAcrCcV+ediGMOEo/ISyo8fpEV15sHlTvjA3WypnW9jkWVdFJ4y4jEfJIr/BWKtEM32wFndEVp3Z8JS84QX7/l1V4zjo7oekuc446dFjg8VE3U0hl+bJre94rn2la5xxvdnby2DNZekEqWCA03JFhluIltOb5gbxtnMMhbn3XGyY6g+xo7uoE/qHvaYw/n+1UF9ziOOUcim8iSKrayk0tdjY2YOsi0RU2ZyUFToNpTz2wyNNsDF8dFNoC+t9Qn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2017 11:29:20.7470 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7727472-e050-4643-cedb-08d546d3bfe5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB1923 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Igor Mitsyanko Implement two parts of radar handling logic: - cfg80211 .start_radar_detect callback to allow nl80211 to initiate CAC - radar event to allow wlan device to advertize CAC and radar events Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 18 ++++++- drivers/net/wireless/quantenna/qtnfmac/commands.c | 38 ++++++++++++++ drivers/net/wireless/quantenna/qtnfmac/commands.h | 3 ++ drivers/net/wireless/quantenna/qtnfmac/event.c | 61 +++++++++++++++++++++++ drivers/net/wireless/quantenna/qtnfmac/qlink.h | 36 +++++++++++++ 5 files changed, 155 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index b8e5f32cebdf..d4a98d62ecbe 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -751,6 +751,21 @@ static int qtnf_channel_switch(struct wiphy *wiphy, struct net_device *dev, return ret; } +static int qtnf_start_radar_detection(struct wiphy *wiphy, + struct net_device *ndev, + struct cfg80211_chan_def *chandef, + u32 cac_time_ms) +{ + struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev); + int ret; + + ret = qtnf_cmd_start_cac(vif, chandef, cac_time_ms); + if (ret) + pr_err("%s: failed to start CAC ret=%d\n", ndev->name, ret); + + return ret; +} + static struct cfg80211_ops qtn_cfg80211_ops = { .add_virtual_intf = qtnf_add_virtual_intf, .change_virtual_intf = qtnf_change_virtual_intf, @@ -774,7 +789,8 @@ static struct cfg80211_ops qtn_cfg80211_ops = { .disconnect = qtnf_disconnect, .dump_survey = qtnf_dump_survey, .get_channel = qtnf_get_channel, - .channel_switch = qtnf_channel_switch + .channel_switch = qtnf_channel_switch, + .start_radar_detection = qtnf_start_radar_detection, }; static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy_in, diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index bed81f0cb1cd..7089f3eb7a87 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -2512,3 +2512,41 @@ int qtnf_cmd_get_channel(struct qtnf_vif *vif, struct cfg80211_chan_def *chdef) consume_skb(resp_skb); return ret; } + +int qtnf_cmd_start_cac(const struct qtnf_vif *vif, + const struct cfg80211_chan_def *chdef, + u32 cac_time_ms) +{ + struct qtnf_bus *bus = vif->mac->bus; + struct sk_buff *cmd_skb; + struct qlink_cmd_start_cac *cmd; + int ret; + u16 res_code; + + cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, + QLINK_CMD_START_CAC, + sizeof(*cmd)); + if (unlikely(!cmd_skb)) + return -ENOMEM; + + cmd = (struct qlink_cmd_start_cac *)cmd_skb->data; + cmd->cac_time_ms = cpu_to_le32(cac_time_ms); + qlink_chandef_cfg2q(chdef, &cmd->chan); + + qtnf_bus_lock(bus); + ret = qtnf_cmd_send(bus, cmd_skb, &res_code); + qtnf_bus_unlock(bus); + + if (ret) + return ret; + + switch (res_code) { + case QLINK_CMD_RESULT_OK: + break; + default: + ret = -EOPNOTSUPP; + break; + } + + return ret; +} diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.h b/drivers/net/wireless/quantenna/qtnfmac/commands.h index d981a76e5835..07a957af9a58 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.h +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.h @@ -76,5 +76,8 @@ int qtnf_cmd_get_chan_stats(struct qtnf_wmac *mac, u16 channel, int qtnf_cmd_send_chan_switch(struct qtnf_vif *vif, struct cfg80211_csa_settings *params); int qtnf_cmd_get_channel(struct qtnf_vif *vif, struct cfg80211_chan_def *chdef); +int qtnf_cmd_start_cac(const struct qtnf_vif *vif, + const struct cfg80211_chan_def *chdef, + u32 cac_time_ms); #endif /* QLINK_COMMANDS_H_ */ diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index a3a18d8469ae..9843ca36b74b 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -395,6 +395,63 @@ qtnf_event_handle_freq_change(struct qtnf_wmac *mac, return 0; } +static int qtnf_event_handle_radar(struct qtnf_vif *vif, + const struct qlink_event_radar *ev, + u16 len) +{ + struct wiphy *wiphy = priv_to_wiphy(vif->mac); + struct cfg80211_chan_def chandef; + + if (len < sizeof(*ev)) { + pr_err("MAC%u: payload is too short\n", vif->mac->macid); + return -EINVAL; + } + + if (!wiphy->registered || !vif->netdev) + return 0; + + qlink_chandef_q2cfg(wiphy, &ev->chan, &chandef); + + if (!cfg80211_chandef_valid(&chandef)) { + pr_err("MAC%u: bad channel f1=%u f2=%u bw=%u\n", + vif->mac->macid, + chandef.center_freq1, chandef.center_freq2, + chandef.width); + return -EINVAL; + } + + pr_info("%s: radar event=%u f1=%u f2=%u bw=%u\n", + vif->netdev->name, ev->event, + chandef.center_freq1, chandef.center_freq2, + chandef.width); + + switch (ev->event) { + case QLINK_RADAR_DETECTED: + cfg80211_radar_event(wiphy, &chandef, GFP_KERNEL); + break; + case QLINK_RADAR_CAC_FINISHED: + if (!vif->wdev.cac_started) + break; + + cfg80211_cac_event(vif->netdev, &chandef, + NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); + break; + case QLINK_RADAR_CAC_ABORTED: + if (!vif->wdev.cac_started) + break; + + cfg80211_cac_event(vif->netdev, &chandef, + NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); + break; + default: + pr_warn("%s: unhandled radar event %u\n", + vif->netdev->name, ev->event); + break; + } + + return 0; +} + static int qtnf_event_parse(struct qtnf_wmac *mac, const struct sk_buff *event_skb) { @@ -449,6 +506,10 @@ static int qtnf_event_parse(struct qtnf_wmac *mac, ret = qtnf_event_handle_freq_change(mac, (const void *)event, event_len); break; + case QLINK_EVENT_RADAR: + ret = qtnf_event_handle_radar(vif, (const void *)event, + event_len); + break; default: pr_warn("unknown event type: %x\n", event_id); break; diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 534d11e4175a..3e3de4629a53 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -205,6 +205,7 @@ struct qlink_auth_encr { * @QLINK_CMD_REG_NOTIFY: notify device about regulatory domain change. This * command is supported only if device reports QLINK_HW_SUPPORTS_REG_UPDATE * capability. + * @QLINK_CMD_START_CAC: start radar detection procedure on a specified channel. */ enum qlink_cmd_type { QLINK_CMD_FW_INIT = 0x0001, @@ -224,6 +225,7 @@ enum qlink_cmd_type { QLINK_CMD_BAND_INFO_GET = 0x001A, QLINK_CMD_CHAN_SWITCH = 0x001B, QLINK_CMD_CHAN_GET = 0x001C, + QLINK_CMD_START_CAC = 0x001D, QLINK_CMD_START_AP = 0x0021, QLINK_CMD_STOP_AP = 0x0022, QLINK_CMD_GET_STA_INFO = 0x0030, @@ -617,6 +619,18 @@ struct qlink_cmd_start_ap { u8 info[0]; } __packed; +/** + * struct qlink_cmd_start_cac - data for QLINK_CMD_START_CAC command + * + * @chan: a channel to start a radar detection procedure on. + * @cac_time_ms: CAC time. + */ +struct qlink_cmd_start_cac { + struct qlink_cmd chdr; + struct qlink_chandef chan; + __le32 cac_time_ms; +} __packed; + /* QLINK Command Responses messages related definitions */ @@ -814,6 +828,7 @@ enum qlink_event_type { QLINK_EVENT_BSS_JOIN = 0x0026, QLINK_EVENT_BSS_LEAVE = 0x0027, QLINK_EVENT_FREQ_CHANGE = 0x0028, + QLINK_EVENT_RADAR = 0x0029, }; /** @@ -963,6 +978,27 @@ struct qlink_event_scan_complete { __le32 flags; } __packed; +enum qlink_radar_event { + QLINK_RADAR_DETECTED, + QLINK_RADAR_CAC_FINISHED, + QLINK_RADAR_CAC_ABORTED, + QLINK_RADAR_NOP_FINISHED, + QLINK_RADAR_PRE_CAC_EXPIRED, +}; + +/** + * struct qlink_event_radar - data for QLINK_EVENT_RADAR event + * + * @chan: channel on which radar event happened. + * @event: radar event type, one of &enum qlink_radar_event. + */ +struct qlink_event_radar { + struct qlink_event ehdr; + struct qlink_chandef chan; + u8 event; + u8 rsvd[3]; +} __packed; + /* QLINK TLVs (Type-Length Values) definitions */