From patchwork Thu Feb 22 09:15:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10234907 X-Patchwork-Delegate: johannes@sipsolutions.net 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 CC60D60349 for ; Thu, 22 Feb 2018 09:15:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4C922879E for ; Thu, 22 Feb 2018 09:15:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6DD128AA2; Thu, 22 Feb 2018 09:15:37 +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 849222879E for ; Thu, 22 Feb 2018 09:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752888AbeBVJPe (ORCPT ); Thu, 22 Feb 2018 04:15:34 -0500 Received: from mail-by2nam03on0089.outbound.protection.outlook.com ([104.47.42.89]:20992 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752786AbeBVJPd (ORCPT ); Thu, 22 Feb 2018 04:15:33 -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=sMG6lVL4p53aLPFeVn0aHOD1ICWaxj79nMsDMkcry0Q=; b=QRNB5ZUSQSb/vpQ0rc3fZGaYSu4xwhlsBilsIsKTIfIPG75iXMi0/POTRTeviyzFiHAfexHMy3AVCsorSmdQCwtELmj2CAxlG9LC6GU8kUDqeIUtIZ1Sdf8tfn9uKrzGxIf+nuAjKEni9DObR+CH5LFYm6hOZGBysTkEGUe9rNQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by SN1PR05MB1934.namprd05.prod.outlook.com (2a01:111:e400:523b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.527.6; Thu, 22 Feb 2018 09:15:28 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Igor Mitsyanko , Avinash Patil , Dmitry Lebed , Dmitry Lebed Subject: [PATCH v2] cfg80211/nl80211: add DFS offload flag Date: Thu, 22 Feb 2018 12:15:13 +0300 Message-Id: <20180222091513.25456-1-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: VI1PR08CA0123.eurprd08.prod.outlook.com (2603:10a6:800:d4::25) To SN1PR05MB1934.namprd05.prod.outlook.com (2a01:111:e400:523b::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c6f3fc3-3555-450d-a611-08d579d4d1cd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:SN1PR05MB1934; X-Microsoft-Exchange-Diagnostics: 1; SN1PR05MB1934; 3:dZ+OxHDpO5kSXk1Lxio0zIKnPslHl1CIylmRTp1mkFFgkAc6hd0jMWtMYkltxiMsvW/mj39bpofnbAJr939FMtjuom36s+SW9Rs09CjBF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N8mwExanoW146goY7fusR1g658yjp+AzBFU4asVN7H75eZyGlSH1wiKRINqbGj8IikYrOlrrueNFbb0v/1AvUhTgl4YHuYV44uSKvVw+HuDwvOGUnLuj+W0p9u9Dd0Q6cdDUFR1BfudBoRSef2C+xmJMVjaXrwI+j9FmJYpWJaOm39DDdLBPDjppBWQvpG7zull10FTahaaSV5h8WOwqBArBA6usY/Misq3rKVxiR/w8c6Q94tFZPX3P0kt; 4:qOBtiU2ogmyTZw26xHRjJS+u8EfQ/PyPlKIWdb/1EimRAXz+6HPLX4uumCeH3r8Am80eDcd9p8lXX/qODSBYBopDOWewvM3LbbZHzKu1IgGALk9aTBjCn24Fmhc87oBh5qnEBIWUr9+OhA2i5cNA5tSNXCPtaU4fB6qIABHDuql/m6IEXGD2h2KSf/+Fl7bGctc6yBO60UOddxsNuucoqCCPEd5lNvf1UVnCPMGFeyzA76k7bSQ+avN4SaownTAwOD9NGG3ZxwXdCJHi5TpUDA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231101)(944501161)(93006095)(93001095)(10201501046)(3002001)(6041288)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN1PR05MB1934; BCL:0; PCL:0; RULEID:; SRVR:SN1PR05MB1934; X-Forefront-PRVS: 059185FE08 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(346002)(376002)(39850400004)(39380400002)(189003)(199004)(7696005)(51416003)(26005)(50226002)(52116002)(478600001)(53936002)(69596002)(6916009)(4326008)(6666003)(16526019)(54906003)(16586007)(39060400002)(25786009)(186003)(6116002)(103116003)(5660300001)(2906002)(305945005)(8676002)(50466002)(7736002)(48376002)(8936002)(316002)(81166006)(97736004)(386003)(1076002)(6486002)(47776003)(2351001)(2361001)(106356001)(3846002)(53416004)(59450400001)(68736007)(66066001)(36756003)(105586002)(86362001)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR05MB1934; 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; SN1PR05MB1934; 23:ZBlWXyM4PEf7VpVtWR/IJeUloFdlZxSlqK/TV01sX?= =?us-ascii?Q?31Hod4/rEDg1GVBJjghCZ91zBjLL5pkj4ELJuHBM9sWI3s32fUWM6D6QQFeE?= =?us-ascii?Q?121AKNJA9lR755UtDuo8iyuK/eX4bNxcUD+zciXxsQV49pY4XTa0ft+za9Ri?= =?us-ascii?Q?/0MlvUgs+4VSLzQy+YdrADY9Mi8NZTB62IUk/t7fsdv+ZKVDMQsWiCClmFdB?= =?us-ascii?Q?8TUPm0rtY/n1dWBpPDo0s9QteIBMO9rk8ZyKIr4CVZb84OTmp3nHhf7B+wC4?= =?us-ascii?Q?hiGLvkLjKc1EXUsnJf1TMefDV8mQLYeWnn/sxSNF73Tiboldf4bp2Jw0S4Ek?= =?us-ascii?Q?gu58viG3NIgUUxuUlAk70D19hlevJRayDRVt8l1efk3THGVzJaw/zHy3ZXkH?= =?us-ascii?Q?QT7tPvMnKEzYqGr0KiykbFIP3hHpnqKtq3Gbp8N5Zwe5c2ADM+xTSaIFeGyj?= =?us-ascii?Q?5riEwPyiZ4q9VxkQTSLMWPDFNxVyVU6SHzF63/izxfu+Pp57Nr3W7qAwWWYh?= =?us-ascii?Q?k5ScjGslJm/6n4uUOFdgELQCg4fRfUOOb1AxvyfL6KsLxb0prHvm8O1ZP2HK?= =?us-ascii?Q?jOeAOScsemnjevBhDRGrDKyyVaTPTkwgbZweOM/IfjVMXZIunPn3cHTisBvx?= =?us-ascii?Q?m/CtFqSTMJGGDxusWNXLNDIaCj60Rm+hfFHLYX97Q6CPc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P9QeZDBeACL8qXPspgEX1H2K4=; 5:Ry1nyEH+pDlV2bDz/CbmFIjdIMHSL5AzJS6D6XQHgLsEWedAJUnNW7AkHgkoGvTk0MID7jL6dIrujj6eKROl6D81YYT6wnumifJ24Vq3+W5JAjzSbX4E0B1IGUeNMS9crD8LHp4C3c0iyA/eJBV1fllR7VCG5pPdMBTsxHAk7h8=; 24:NUawMK+VNwqPVeWNn9C41M1ZUva33K4Q6H1KJSujWdt+kL12oG7QPE60+HBPvxIyAUxXc0sWSIvxcZL6B/isTRi2wxAD0vA6DlPDi8Lbmv0=; 7:/f/7X2bRWt+Cg6Oj1bFamXHICcgFByrYcRxzlP4pOEOf4xtS3sSElcY8793USPyTenuaYOPGkE/qi3l8feu7Eeyz8yI2nrpIA9E+jNPNGG8EFAPbGY8BTovCLpuTMdz6A77v5dmyJmamVRBH3Epl6s3o7ap7jC12GAojHiNEDRRLQpMnCCq64ndKxRNW8t0AZ5OCo/Ac5SAQkVIrY9qnuaaE80Mx09JuXvZ/Xwb64LbDCi4+l/8YGW8fY/5adsk7 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2018 09:15:28.7110 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c6f3fc3-3555-450d-a611-08d579d4d1cd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR05MB1934 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: Dmitry Lebed Add wiphy EXT_FEATURE flag to indicate that HW or driver does all DFS actions by itself. User-space functionality already implemented in hostapd using vendor-specific (QCA) OUI to advertise DFS offload support. Need to introduce generic flag to inform about DFS offload support. For deivces with DFS_OFFLOAD flag set user-space will no longer need to issue CAC or do any actions in response to "radar detected" events. HW will do everything by itself and send events to user-space to indicate that CAC was started/finished, etc. Signed-off-by: Dmitrii Lebed --- V1->V2 changes: - moved from wiphy_flags to ext_features flags usage include/uapi/linux/nl80211.h | 7 +++++++ net/wireless/nl80211.c | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 22cca373161d..811928ce4e1c 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4948,6 +4948,12 @@ enum nl80211_feature_flags { * probe request tx deferral and suppression * @NL80211_EXT_FEATURE_MFP_OPTIONAL: Driver supports the %NL80211_MFP_OPTIONAL * value in %NL80211_ATTR_USE_MFP. + * @NL80211_EXT_FEATURE_DFS_OFFLOAD: HW/driver will offload DFS actions. + * Device or driver will do all DFS-related actions by itself, + * informing user-space about CAC progress, radar detection event, + * channel change triggered by radar detection event. + * No need to start CAC from user-space, no need to react to + * "radar detected" event. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -4975,6 +4981,7 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE, NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION, NL80211_EXT_FEATURE_MFP_OPTIONAL, + NL80211_EXT_FEATURE_DFS_OFFLOAD, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b5e613d14d6a..d57aba58a418 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -7786,12 +7786,13 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; struct wireless_dev *wdev = dev->ieee80211_ptr; + struct wiphy *wiphy = wdev->wiphy; struct cfg80211_chan_def chandef; enum nl80211_dfs_regions dfs_region; unsigned int cac_time_ms; int err; - dfs_region = reg_get_dfs_region(wdev->wiphy); + dfs_region = reg_get_dfs_region(wiphy); if (dfs_region == NL80211_DFS_UNSET) return -EINVAL; @@ -7805,17 +7806,20 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, if (wdev->cac_started) return -EBUSY; - err = cfg80211_chandef_dfs_required(wdev->wiphy, &chandef, - wdev->iftype); + err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype); if (err < 0) return err; if (err == 0) return -EINVAL; - if (!cfg80211_chandef_dfs_usable(wdev->wiphy, &chandef)) + if (!cfg80211_chandef_dfs_usable(wiphy, &chandef)) return -EINVAL; + /* CAC start is offloaded to HW and can't be started manually */ + if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD)) + return -EOPNOTSUPP; + if (!rdev->ops->start_radar_detection) return -EOPNOTSUPP;