From patchwork Wed Mar 20 10:03:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10861235 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 D1C3C17E0 for ; Wed, 20 Mar 2019 10:04:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4EDF29AA8 for ; Wed, 20 Mar 2019 10:04:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A689229AB8; Wed, 20 Mar 2019 10:04:52 +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 2897C29AA8 for ; Wed, 20 Mar 2019 10:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727247AbfCTKEv (ORCPT ); Wed, 20 Mar 2019 06:04:51 -0400 Received: from mail-eopbgr710079.outbound.protection.outlook.com ([40.107.71.79]:22688 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725905AbfCTKEv (ORCPT ); Wed, 20 Mar 2019 06:04:51 -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=l+8YlrRsoHgqbYEKCDNyaacjBfAukgSQ9kyFGgvf6u0=; b=3Bs5IRznA54L0/ibPmXDXQOm70430JzA2JagDco8sv/0NNbDhS9FxwVAIu+iQ/sOMWvOaT5iCOfg7DQ2V0Ph4DrN47iJYQa+FauK7wyPVKmHMrm6Wy6avZMuRSIXcTHAcCA4uBtEaWmpA7IXC+Jf2pWt0qjLKXtu/7oFeIzAnww= Received: from SN6PR05MB4656.namprd05.prod.outlook.com (52.135.114.202) by SN6PR05MB5424.namprd05.prod.outlook.com (52.135.109.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Wed, 20 Mar 2019 10:04:42 +0000 Received: from SN6PR05MB4656.namprd05.prod.outlook.com ([fe80::a8f6:a314:5b0f:f2a]) by SN6PR05MB4656.namprd05.prod.outlook.com ([fe80::a8f6:a314:5b0f:f2a%5]) with mapi id 15.20.1709.015; Wed, 20 Mar 2019 10:04:42 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB4672.namprd05.prod.outlook.com (52.135.114.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.15; Wed, 20 Mar 2019 10:03:48 +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.1709.015; Wed, 20 Mar 2019 10:03:48 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Sergey Matyukevich Subject: [PATCH 01/14] qtnfmac: make regulatory notifier work on per-phy basis Thread-Topic: [PATCH 01/14] qtnfmac: make regulatory notifier work on per-phy basis Thread-Index: AQHU3wQ2GdxTz1znikS9tg7IZCFdOg== Date: Wed, 20 Mar 2019 10:03:48 +0000 Message-ID: <20190320100340.14168-2-sergey.matyukevich.os@quantenna.com> References: <20190320100340.14168-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20190320100340.14168-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR05CA0106.namprd05.prod.outlook.com (2603:10b6:a03:e0::47) 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: 54721120-37fc-445c-c354-08d6ad1b5852 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020);SRVR:SN6PR05MB4672; x-ms-traffictypediagnostic: SN6PR05MB4672:|SN6PR05MB5424: x-moderation-data: 3/20/2019 10:04:38 AM x-microsoft-antispam-prvs: x-forefront-prvs: 098291215C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(346002)(136003)(376002)(39850400004)(199004)(189003)(14454004)(36756003)(1076003)(14444005)(256004)(97736004)(15650500001)(305945005)(103116003)(7736002)(478600001)(2351001)(11346002)(446003)(186003)(99286004)(436003)(6116002)(3846002)(486006)(2616005)(476003)(54906003)(6436002)(6486002)(316002)(52116002)(76176011)(71200400001)(71190400001)(386003)(105586002)(106356001)(25786009)(6506007)(6916009)(2906002)(102836004)(26005)(6512007)(8676002)(8936002)(5640700003)(4326008)(81156014)(68736007)(5660300002)(2501003)(53936002)(86362001)(50226002)(107886003)(81166006)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR05MB5424;H:SN6PR05MB4656.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: IaIBuZRU2SFLbCTG2emcKtWSey8dcbgMMaKhGmplKLZlV08kdP1M/NXriK4rnEiWloGJxBcDeRFaaH/qK/9KktO1cte/y7VCV0e0AIAVORhQq4gtm5Z0NwrwEj0pud042fFD5qm8J97SbqGOlbn1O0mx0FFXptCShXDv/3nQj6oWvdRu3pfPyEiBSki7vaQlLyb2ZuJPUIz4yk7au+Me3AMUDtxRB6gbTCqEvtXCf8kytmhCDkFkfr2AdDnmimwQP6U1UEPfUjnYLlZIKnAVAow2IttTQS6XD7XT3pr/5QY2TD8lVohdGtEkU+Gx7Z4VceJ8y0ct6T9wsvYfwKm+THtZbyRymm57oy7OppUGDScjyJNf1TSI40wgtxCKnqdk8AUzgMSbkq7A52LbaVQ61dGHR0ZANb7aTFllIaT5a0Q= MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54721120-37fc-445c-c354-08d6ad1b5852 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: 20 Mar 2019 10:04:42.0911 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR05MB5424 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 Wireless core calls regulatory notifier for each wiphy and it only guarantees that bands info is updated for this particular wiphy prior to calling a notifier. Hence updating all wiphy which belong to driver in a single notifier callback is redundant and incorrect. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 32 +++++++---------------- drivers/net/wireless/quantenna/qtnfmac/commands.c | 9 +++---- drivers/net/wireless/quantenna/qtnfmac/commands.h | 2 +- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index dcb0991432f4..295890b2673c 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -993,20 +993,17 @@ static struct cfg80211_ops qtn_cfg80211_ops = { #endif }; -static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy_in, +static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy, struct regulatory_request *req) { - struct qtnf_wmac *mac = wiphy_priv(wiphy_in); - struct qtnf_bus *bus = mac->bus; - struct wiphy *wiphy; - unsigned int mac_idx; + struct qtnf_wmac *mac = wiphy_priv(wiphy); enum nl80211_band band; int ret; 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(bus, req); + ret = qtnf_cmd_reg_notify(mac, req); if (ret) { if (ret == -EOPNOTSUPP) { pr_warn("reg update not supported\n"); @@ -1021,25 +1018,14 @@ static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy_in, return; } - for (mac_idx = 0; mac_idx < QTNF_MAX_MAC; ++mac_idx) { - if (!(bus->hw_info.mac_bitmap & (1 << mac_idx))) - continue; - - mac = bus->mac[mac_idx]; - if (!mac) + for (band = 0; band < NUM_NL80211_BANDS; ++band) { + if (!wiphy->bands[band]) continue; - wiphy = priv_to_wiphy(mac); - - for (band = 0; band < NUM_NL80211_BANDS; ++band) { - if (!wiphy->bands[band]) - continue; - - ret = qtnf_cmd_band_info_get(mac, wiphy->bands[band]); - if (ret) - pr_err("failed to get chan info for mac %u band %u\n", - mac_idx, band); - } + ret = qtnf_cmd_band_info_get(mac, wiphy->bands[band]); + if (ret) + pr_err("MAC%u: failed to update band %u\n", + mac->macid, band); } } diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 85a2a58f4c16..9aabba7429ed 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -2404,13 +2404,14 @@ int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, bool up) return ret; } -int qtnf_cmd_reg_notify(struct qtnf_bus *bus, struct regulatory_request *req) +int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req) { + struct qtnf_bus *bus = mac->bus; struct sk_buff *cmd_skb; int ret; struct qlink_cmd_reg_notify *cmd; - cmd_skb = qtnf_cmd_alloc_new_cmdskb(QLINK_MACID_RSVD, QLINK_VIFID_RSVD, + cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, QLINK_CMD_REG_NOTIFY, sizeof(*cmd)); if (!cmd_skb) @@ -2449,10 +2450,6 @@ int qtnf_cmd_reg_notify(struct qtnf_bus *bus, struct regulatory_request *req) qtnf_bus_lock(bus); ret = qtnf_cmd_send(bus, cmd_skb); - if (ret) - goto out; - -out: qtnf_bus_unlock(bus); return ret; diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.h b/drivers/net/wireless/quantenna/qtnfmac/commands.h index 64f0b9dc8a14..050f9a49d16c 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.h +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.h @@ -57,7 +57,7 @@ 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_bus *bus, struct regulatory_request *req); +int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req); 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,