All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>,
	Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Subject: [PATCH 01/14] qtnfmac: make regulatory notifier work on per-phy basis
Date: Wed, 20 Mar 2019 10:03:48 +0000	[thread overview]
Message-ID: <20190320100340.14168-2-sergey.matyukevich.os@quantenna.com> (raw)
In-Reply-To: <20190320100340.14168-1-sergey.matyukevich.os@quantenna.com>

From: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>

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 <igor.mitsyanko.os@quantenna.com>
---
 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,
-- 
2.11.0


  reply	other threads:[~2019-03-20 10:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 10:03 [PATCH 00/14] qtnfmac: regulatory rework and misc fixes Sergey Matyukevich
2019-03-20 10:03 ` Sergey Matyukevich [this message]
2019-04-04  9:58   ` [PATCH 01/14] qtnfmac: make regulatory notifier work on per-phy basis Kalle Valo
2019-03-20 10:03 ` [PATCH 02/14] qtnfmac: simplify error reporting in regulatory notifier Sergey Matyukevich
2019-03-20 10:03 ` [PATCH 03/14] qtnfmac: include full channels info to " Sergey Matyukevich
2019-03-20 10:03 ` [PATCH 04/14] qtnfmac: pass complete channel info in " Sergey Matyukevich
2019-03-20 10:03 ` [PATCH 05/14] qtnfmac: flexible regulatory domain registration logic Sergey Matyukevich
2019-03-20 10:03 ` [PATCH 06/14] qtnfmac: allow each MAC to specify its own regulatory rules Sergey Matyukevich
2019-03-20 10:03 ` [PATCH 07/14] qtnfmac: pass DFS region to firmware on region update Sergey Matyukevich
2019-03-20 10:04 ` [PATCH 08/14] qtnfmac: update bands information on CHANGE_INTF command Sergey Matyukevich
2019-03-20 10:04 ` [PATCH 09/14] qtnfmac: fix core attach error path in pcie backend Sergey Matyukevich
2019-03-20 10:04 ` [PATCH 10/14] qtnfmac: simplify firmware state tracking Sergey Matyukevich
2019-03-20 10:04 ` [PATCH 11/14] qtnfmac: allow changing the netns Sergey Matyukevich
2019-03-20 10:04 ` [PATCH 12/14] qtnfmac: fix debugfs entries for multiple cards on the same host Sergey Matyukevich
2019-03-20 14:05   ` Kalle Valo
2019-03-20 15:16     ` Sergey Matyukevich
2019-03-21  7:35       ` Kalle Valo
2019-03-21  8:26         ` Sergey Matyukevich
2019-03-22  8:44           ` Kalle Valo
2019-03-21 10:14         ` Arend Van Spriel
2019-03-21 15:46           ` Sergey Matyukevich
2019-03-21 17:06           ` Kalle Valo
2019-03-20 10:04 ` [PATCH 13/14] qtnfmac: send EAPOL frames via control path Sergey Matyukevich
2019-03-20 10:04 ` [PATCH 14/14] qtnfmac: use scan duration param for different scan types Sergey Matyukevich
2019-03-20 14:08   ` Kalle Valo
2019-03-20 15:21     ` Sergey Matyukevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190320100340.14168-2-sergey.matyukevich.os@quantenna.com \
    --to=sergey.matyukevich.os@quantenna.com \
    --cc=igor.mitsyanko.os@quantenna.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.