From patchwork Tue Apr 9 07:35:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10890671 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 2E43017E1 for ; Tue, 9 Apr 2019 07:37:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1838728864 for ; Tue, 9 Apr 2019 07:37:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A21E28875; Tue, 9 Apr 2019 07:37:01 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 7360D28864 for ; Tue, 9 Apr 2019 07:37:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbfDIHg7 (ORCPT ); Tue, 9 Apr 2019 03:36:59 -0400 Received: from mail-eopbgr760049.outbound.protection.outlook.com ([40.107.76.49]:41382 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726766AbfDIHg7 (ORCPT ); Tue, 9 Apr 2019 03:36:59 -0400 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:X-MS-Exchange-SenderADCheck; bh=irAXeeXbwENGIl6DiAFAHNx3X0FXoLq6YEflbjpvFbw=; b=RcF4tcIhUG5+9By7Ex4Xz5DYDV5Mj8FBhhfp+la3WGQtGNXl4ia0TNLzkRwOYuBDrsIGw2UulRj64wQ8V4peDSt5hYCfw1K0LgdMRYV7DCFRIm+bULSqaw2lCHXn7tcSg7dzC8fv+OEdzlgkqux2P9Qm4kqIfHsw05qoMOrVr+A= Received: from DM6PR05MB5883.namprd05.prod.outlook.com (20.178.26.204) by DM6PR05MB4475.namprd05.prod.outlook.com (20.176.79.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.9; Tue, 9 Apr 2019 07:36:36 +0000 Received: from DM6PR05MB5883.namprd05.prod.outlook.com ([fe80::d5d5:7b9f:869e:9c43]) by DM6PR05MB5883.namprd05.prod.outlook.com ([fe80::d5d5:7b9f:869e:9c43%5]) with mapi id 15.20.1792.009; Tue, 9 Apr 2019 07:36:36 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB5103.namprd05.prod.outlook.com (20.177.250.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.8; Tue, 9 Apr 2019 07:35:10 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::ecfd:3a22:dcb3:3b9e]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::ecfd:3a22:dcb3:3b9e%4]) with mapi id 15.20.1792.009; Tue, 9 Apr 2019 07:35:10 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Sergey Matyukevich Subject: [PATCH 2/3] qtnfmac: allow to control DFS slave radar detection Thread-Topic: [PATCH 2/3] qtnfmac: allow to control DFS slave radar detection Thread-Index: AQHU7qbDxK8saf+Zg0+BlKCDHeW1Xg== Date: Tue, 9 Apr 2019 07:35:10 +0000 Message-ID: <20190409073500.16402-3-sergey.matyukevich.os@quantenna.com> References: <20190409073500.16402-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20190409073500.16402-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR08CA0016.namprd08.prod.outlook.com (2603:10b6:a03:100::29) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 93d54d7e-70bf-4d72-0fcf-08d6bcbde55f x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020);SRVR:SN6PR05MB5103; x-ms-traffictypediagnostic: SN6PR05MB5103:|DM6PR05MB4475: x-moderation-data: 4/9/2019 7:36:35 AM x-microsoft-antispam-prvs: x-forefront-prvs: 000227DA0C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(366004)(376002)(39850400004)(189003)(199004)(99286004)(76176011)(25786009)(8936002)(97736004)(26005)(386003)(2906002)(102836004)(6506007)(54906003)(316002)(6486002)(105586002)(106356001)(103116003)(68736007)(71190400001)(6916009)(2501003)(14454004)(1076003)(36756003)(6436002)(81166006)(71200400001)(50226002)(81156014)(478600001)(7736002)(8676002)(86362001)(486006)(2616005)(436003)(2351001)(6512007)(446003)(11346002)(5640700003)(53936002)(186003)(4326008)(107886003)(5660300002)(14444005)(5024004)(256004)(305945005)(52116002)(66066001)(3846002)(6116002)(476003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR05MB4475;H:DM6PR05MB5883.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: XCvB0P/ZUt5jNebv6IXmLUisxfEWVw01nRLSnVmXc481Ay3AnqJtZT1/z9t9Elj8Mz9gc5X+Wwe39UUxRHRhEsTNe8IGRa3LKh1JJXfrA8kLuJAVgTgOHCccyHlZStqcuISOu+KV+d6Ncg7Z2viBlO5PlgrZQclVbEc3FtfGRUvMQhpwJ+UG6GGOEP7z9IJuZfq8PjmysxeUjaCHQQaGarKMLzqScN+B+vC0Ti9jJteIhh4AmnZ5yX7cNK7FlUXMNI61p1YCnpxyZTZTkhd/El7qvenW8UiC6LU8ZvoQ9JBXzhZ02Ss3+9NOlc+jsHECPb4Tekyk1eYVuAvCGOlcZ4KMlNZ8i1dXe+imIfmbb6LM30gscP4rjGwy0xZPD/AvhrI6zX77UNcOADWkhhCOF5lrrx3PlehZ8DbBkc/3CBM= MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93d54d7e-70bf-4d72-0fcf-08d6bcbde55f X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2019 07:36:36.8999 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4475 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 In ETSI region DFS slave device can operate in two modes on DFS channels: - do on-channel radar detection and use higher Tx power - don't do radar detection and use lower Tx power as a consequence Allow user to control that behavior through qtnfmac module parameter. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 2 +- drivers/net/wireless/quantenna/qtnfmac/commands.c | 4 +++- drivers/net/wireless/quantenna/qtnfmac/commands.h | 3 ++- drivers/net/wireless/quantenna/qtnfmac/core.c | 9 +++++++++ drivers/net/wireless/quantenna/qtnfmac/core.h | 1 + drivers/net/wireless/quantenna/qtnfmac/qlink.h | 4 +++- 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index c78500bcaa2d..d90016125dfc 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -1008,7 +1008,7 @@ static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy, pr_debug("MAC%u: initiator=%d alpha=%c%c\n", mac->macid, req->initiator, req->alpha2[0], req->alpha2[1]); - ret = qtnf_cmd_reg_notify(mac, req); + ret = qtnf_cmd_reg_notify(mac, req, qtnf_mac_slave_radar_get(wiphy)); if (ret) { pr_err("MAC%u: failed to update region to %c%c: %d\n", mac->macid, req->alpha2[0], req->alpha2[1], ret); diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 22313a46c3ae..459f6b81d2eb 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -2367,7 +2367,8 @@ int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, bool up) return ret; } -int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req) +int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req, + bool slave_radar) { struct wiphy *wiphy = priv_to_wiphy(mac); struct qtnf_bus *bus = mac->bus; @@ -2429,6 +2430,7 @@ int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req) break; } + cmd->slave_radar = slave_radar; cmd->num_channels = 0; for (band = 0; band < NUM_NL80211_BANDS; band++) { diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.h b/drivers/net/wireless/quantenna/qtnfmac/commands.h index 6406365287fc..88d7a3cd90d2 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.h +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.h @@ -57,7 +57,8 @@ int qtnf_cmd_send_disconnect(struct qtnf_vif *vif, u16 reason_code); int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, bool up); -int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req); +int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req, + bool slave_radar); int qtnf_cmd_get_chan_stats(struct qtnf_wmac *mac, u16 channel, struct qtnf_chan_stats *stats); int qtnf_cmd_send_chan_switch(struct qtnf_vif *vif, diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index 54ea86ae4959..ad0c9e012056 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -16,6 +16,10 @@ #define QTNF_DMP_MAX_LEN 48 #define QTNF_PRIMARY_VIF_IDX 0 +static bool slave_radar = true; +module_param(slave_radar, bool, 0644); +MODULE_PARM_DESC(slave_radar, "set 0 to disable radar detection in slave mode"); + struct qtnf_frame_meta_info { u8 magic_s; u8 ifidx; @@ -426,6 +430,11 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus, return mac; } +bool qtnf_mac_slave_radar_get(struct wiphy *wiphy) +{ + return slave_radar; +} + static const struct ethtool_ops qtnf_ethtool_ops = { .get_drvinfo = cfg80211_get_drvinfo, }; diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.h b/drivers/net/wireless/quantenna/qtnfmac/core.h index af8372dfb927..d5caff45ac47 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.h +++ b/drivers/net/wireless/quantenna/qtnfmac/core.h @@ -134,6 +134,7 @@ struct qtnf_vif *qtnf_mac_get_free_vif(struct qtnf_wmac *mac); struct qtnf_vif *qtnf_mac_get_base_vif(struct qtnf_wmac *mac); void qtnf_mac_iface_comb_free(struct qtnf_wmac *mac); void qtnf_mac_ext_caps_free(struct qtnf_wmac *mac); +bool qtnf_mac_slave_radar_get(struct wiphy *wiphy); struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus); int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *priv, const char *name, unsigned char name_assign_type); diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 158c9eba20ef..8a3c6344fa8e 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -588,6 +588,7 @@ enum qlink_user_reg_hint_type { * of &enum qlink_user_reg_hint_type. * @num_channels: number of &struct qlink_tlv_channel in a variable portion of a * payload. + * @slave_radar: whether slave device should enable radar detection. * @dfs_region: one of &enum qlink_dfs_regions. * @info: variable portion of regulatory notifier callback. */ @@ -598,7 +599,8 @@ struct qlink_cmd_reg_notify { u8 user_reg_hint_type; u8 num_channels; u8 dfs_region; - u8 rsvd[2]; + u8 slave_radar; + u8 rsvd[1]; u8 info[0]; } __packed;