From patchwork Mon Nov 13 10:28:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10055525 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 F12636029B for ; Mon, 13 Nov 2017 10:28:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEB5B29364 for ; Mon, 13 Nov 2017 10:28:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3A2329368; Mon, 13 Nov 2017 10:28:46 +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 0396429367 for ; Mon, 13 Nov 2017 10:28:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752334AbdKMK2o (ORCPT ); Mon, 13 Nov 2017 05:28:44 -0500 Received: from mail-sn1nam01on0085.outbound.protection.outlook.com ([104.47.32.85]:59533 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752117AbdKMK2e (ORCPT ); Mon, 13 Nov 2017 05:28:34 -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=bU9CEQXyXd0PQt1QSaVvsdqQ9FDjF1Iq02XnFfawe3U=; b=zPN/JPN/2ILEfMPUR01I51pF3mVprG3tY8WkftvpOsJ/9mXN8c9/WJIqd0NeFBdEOQIDsUX632Ml7vrYJ96qw8hVoCguw3HcOGfcFetoGj2BiUoDcOCeODgDGRahCygkZBlbisflA9HB5j5pEX2nyN7h/AMtZtgbDDug3DaCxs8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BLUPR05MB1924.namprd05.prod.outlook.com (10.162.224.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.239.4; Mon, 13 Nov 2017 10:28:30 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Vasily Ulyanov Subject: [PATCH 03/10] qtnfmac: add support for radar detection and CAC Date: Mon, 13 Nov 2017 13:28:08 +0300 Message-Id: <20171113102815.11254-4-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171113102815.11254-1-sergey.matyukevich.os@quantenna.com> References: <20171113102815.11254-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM5P190CA0007.EURP190.PROD.OUTLOOK.COM (10.161.47.148) To BLUPR05MB1924.namprd05.prod.outlook.com (10.162.224.14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff8f5676-1c78-4daf-e2de-08d52a814937 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:BLUPR05MB1924; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1924; 3:lxfOw52dd+I8xd1IA9WwTt5klgazxCmBeNkvXXUeovIBKpqv2u4l+sPXX9uwmrRozPn6WYPP6U9jjdrqWvgCdwL4OfPAZZXzyIDAAW7pbn+VmJ7C4mlHfankuwlY9BiVNzvOCyhm3ymZOcZCByMHRQLN5IubNkkO69cTy2oHhSBB6vtnjc4oLJ1TEFxjcY8ypfOvdSfZG+KsrehUITUuQ6FqnsnSZMOhCpv3N3Swo2bop2KxmXwJYJ1LK4gVYvwY; 25:GA/SOEqEny5G/g64Mm2WvWnxkydeGAdIh4icGLE71VMXQfgnX4ALfGs9SKi0cm7gbpaxIVF3zvWyh/x3zIzeptetGFCq9aMs5CLfglQqNasdsh52x5fNu4qhRg+IyxEUhsivAZLFTvirQ/AYXgl0wb6+OFxN0w3eTQVixjDwjjJcKfAnr0xAGX2eIhjMIdOSjPNP9xapJMn7dGoXTPLzqalKSAvT00Zy/vGRI06vmJWuMaYcxSDZQxyCLOGf9X9R6p12tX9PJWox5NCCRXaC1asHRf2LOVmPIKOPu7xP+aITq8KWvdPjSu0SC5Zqj5ir33iJh8wzFTK90nMUv9QYoBnK8xEiYo5+KyIMUJDtAqI=; 31:1+IAuPIZsZ7U9zwBEJYFxp4Tmm9e+smJKdlaoLQrV0iw3ysniEcpA1S24YPULlVQKz/VEGnL1of2YucvFCaQ6K1X5IswCF54J8/0RlJdwqn63Q5teiHB1azO05bNaVOoKUk9tUP9aMKH3AKJNQdg41SDhtZISfxTfxzyC6McXchhPehRsd438WIsi6wnfgV06/0VOc49Tkr2X8pMn8xjlmQah/iqK9MsCK1N6zuyiwk= X-MS-TrafficTypeDiagnostic: BLUPR05MB1924: X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1924; 20:rqe8JgLabZAYW2vRvQGhEHCHbDvtFU17vB+YnvML9eBSd6oFzYBBy1xYS+h57p5UgRmVlHv++KUEvwE4vbfokGzBHoVfpm/veAQfkDfWI3waq6jLvVzfUNZar69TtA9ShQGNUiTnfVwHIMi9CcHmdT1rLwalaRAJykrseIUDXw1+z0K7fOWtedBpiqvm2E/3baYvzPxK672/iPudZkItUHlCD0TiL8ki5/nSh7CpzZT3ub1Y2e6vXc/ldWyUJBJIb5mLjBYHPDbz0O08l6pO4QxUQl1QjEddJASKhRqYTu7MYBDumgM7cFO4/fag7x/La7T31Ca8ZjIUZZxv+RgI35sNfj5uuBkCbAEwGiKPsVvt1v/KQyQ6HTy9g7OG7M+ediXNehYczlvzwnCqYesPgXr9RHeuutAhSib0Lpu2pMazU0coE5giIBsYpeQBFLIlR1XQxHLL/n3xGR9w0z0SNGWwXnsC1aLnIYEY1HCrZjPmNNeMxcLdWx5MrLKb3+Lw; 4:rBnXFzGrYKKRuiRBlTekfimmGRryad8mX/v/iNCiiNw+F+Y+0cA8WYNJ2L2In8MRZY+nUwtyJkveL5/ByA7RLs63mIw55hI2HbaChBOhcc67qmvaiVpW+4XUjXdvIO8c1HYMv65m8mTRpDPgTkozBRWrBftn1XB+bSgQtbZOgW0Tb+ry4Al+dbKUPJbVCVheR6vOK0crUAMPACNjW10G32IswZfnvxwcjjYvqeGYqSTKD96wnGaBxiRf5KEszv4QvN09Bx+wu6SH26ciKYydyXJ+iTu+BifbpUitTMXosGTJgr1PT8uT+sYiEK29tOpB X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(3231022)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR05MB1924; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR05MB1924; X-Forefront-PRVS: 0490BBA1F0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39830400002)(346002)(199003)(189002)(5660300001)(107886003)(47776003)(105586002)(50226002)(54906003)(66066001)(53936002)(2361001)(76176999)(316002)(6486002)(6916009)(50986999)(97736004)(4326008)(33646002)(5003940100001)(106356001)(2906002)(6666003)(2950100002)(25786009)(101416001)(16526018)(189998001)(81166006)(81156014)(86362001)(575784001)(8676002)(6116002)(3846002)(478600001)(68736007)(53416004)(48376002)(7736002)(50466002)(2351001)(16586007)(103116003)(69596002)(36756003)(305945005)(1076002)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB1924; H:bars.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BLUPR05MB1924; 23:LzsJV1TvHPy2DxQYi8dfXg0fhMMnhiXLAcJh8inzO?= =?us-ascii?Q?HUttOP8wTn4sc9GYRcTvFag52obuKDz+kAWgleB2lu3q+xjhO/qv3Aeg8A53?= =?us-ascii?Q?1/vHR4H6ww11FKmN9wkPvLYl4v1tlEkEgrX5n0xFjPiY7u6AO0Z3xImyr+Sc?= =?us-ascii?Q?Tr1osDi8gjjuIJemfh8Zy37zlL141Ml+8aWsFI9X7yfbLY4qoJ6GeRZFG2PW?= =?us-ascii?Q?O0EHuG2VZRRBEo37exFKsq6lzcO7dZsbHFwqcluMTCfeFitVCdolDGq6MQwi?= =?us-ascii?Q?mJzD8o5v7sggmhkyrKCDmIdRMe14xe0LpLh9hYvi++wmINz28lfsZ3dZbpFT?= =?us-ascii?Q?r5O4tZYWqyvAA+bAOOdJ89hrQBjn0Biy8dBdrlS3cjNjlwQV2e5HoxR7Qkcw?= =?us-ascii?Q?jaO8XdppJ6dcU9oBJreMdMZgJqC7BOZTeaGlXPuTLtHZmZdK4um0BHJUna2B?= =?us-ascii?Q?x/2pOqKEgG/20YbEajXDK8PtZLJVxHt2zSjnpSupGuF0QSk9b2eqfq+r5gAu?= =?us-ascii?Q?eY2hGUaJZaHiIXfSmFeRFhKo0Oj+gyI3RCzsBGd+P/0GOLIn8OBRTrWxzvav?= =?us-ascii?Q?/dE6+eOQLyq71w54dO3kWhHnK70uUxaOs8uBXuoWi2VfXltVcU99uRrnxagK?= =?us-ascii?Q?oeibmsKXHylX75KPm1eqlc0xuszaBX7WyBcaHxElryLPLVSi9sisAM52JK94?= =?us-ascii?Q?UF9vt2c9T83Kz8xGcy1DrVyNKWOuscZ/b585qEdntJBrhrjpbpflDjpzKkxF?= =?us-ascii?Q?EDBMBWlNvAhl3VHDHPvxsa+lbwFPfO6Q85hx2J+D3D07X7j0JTA5OAPRVv1O?= =?us-ascii?Q?LYx8q8RCQr4mDF0rSTef4HjZde0bvZzpkzzbUCLj4p5EB2GNfaKJT2dzSl71?= =?us-ascii?Q?ybjFSjQbrieJcQtpon5SukrQy8dkdO/rv7X1Yi32vHU9mX0nT04wjG9mVeqp?= =?us-ascii?Q?fzKjJ+ikufY1QNWR7XPoDw6W/OW/5/YVitEzDtD7+gwB6LEid03wUyfkFYBK?= =?us-ascii?Q?hiSmloQok3EEeeSLFB/rZ6wwrl/XRFXZetgKXzIy/zd+L7m9ar39bajC206h?= =?us-ascii?Q?/2RtrxYlWcJupfiZWgZ+8D0S8POwcNtk+8eabQTFgpWpA4iB5uf7IVoeixhs?= =?us-ascii?Q?zFmJGlcWSFmqrmGql4WFgFSexe1qmwAlgGR3ApLg+6HsZ3z8EDYAPsRFbtxq?= =?us-ascii?Q?nyQGi3WwHUdqbrS9xkJ6yiCQbxahgtdGbwmt5c7GSS2maVdhF2zFwb+h2nOD?= =?us-ascii?Q?gZI587lhueO99LcXyE=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1924; 6:YhlUnGNtYWCigrkzZNvqd/GspqoFSVjejTP47C+QF4rC5+CTdhxvVPvy7KXl4Wf38BKLxfjN3pyl6FDwTemDbOWXmasxFQ3z+cucmGmjOKS4EDNcTh6W94As8pI14xS6gDZhb2bk1ifI3bweHkHXrsCXysv9ww8KwjJ+00Bvgl+jFVBEDvp4B+9Ocr1iB+DLWY4kNRdtJAzG0J8oF1P8p7sSuquXpcPrx+/j/ao/iAjc0qdU7b1OMpOeYZV4WMe+e77bLwstGxpl5q6XVkLaJ8cqoGNThXJiuy979J0rETfYJLQc/7ltRBOYq3vLm6l/0uaTAY3GuFGfooRzuC8VcPAj+M2AHHUJyfngmcbSTek=; 5:V5SQZZnt2PP5VYsXefLmfZ5iHLw6pqkiF592/WKQ5GpanK2pZaGqapVFcpecg59mVxiasCcc9T3fdcRU23Rp/X3G4SlI/mWD+bD7I6v0uL5qSidl1W1uMeoKRj1EeWhyB3JDba4ODsAwQ1LIME8fPqY+CRPZAJTRwJsueI7aPXA=; 24:Wlb6cAEB0Wb/dEGYb6GnG1f+HCXIbiMGsxiO1vTnOg5sBNyJgJ2GalwF32BJaWOH5YKcxpRj1A20ooMokJ7RaivXeu4AsLw+hUD1wYNY5Ak=; 7:2KNDzQRyIt5GP3lBXx0d1hIPL6Wso2I7eSB7HR/YG6wDXnIuWgybHtpcQcPakNloSWLYsVzDmCEv+hle+RqubtMMc2K7/7DUmCGhgo6BoMM+LNg4W86KhpYnG9IqA92czETN3IZ77t9+wxu24vE0uB8CD78fgulyrgVBdQ/2tw0afCU1ihtROudrqfrMJ64LxjTwCvkZzo0HC6uPcV8VR2bOHLdLDMS7qPk/iSf6Hr9mAcZkcuY2YeYHdkhDw6Cc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2017 10:28:30.2058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff8f5676-1c78-4daf-e2de-08d52a814937 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB1924 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 67a57c841c3f..64fc4119b3a6 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 */