Linux wireless drivers development
 help / color / mirror / Atom feed
From: Sergey Matyukevich OS <sergey.matyukevich.os@quantenna.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Igor Mitsyanko OS <igor.mitsyanko.os@quantenna.com>,
	Sergey Matyukevich OS <sergey.matyukevich.os@quantenna.com>
Subject: [PATCH 13/13] qtnfmac: implement dump_station support for STA mode
Date: Tue, 2 Oct 2018 09:26:10 +0000	[thread overview]
Message-ID: <20181002092542.18966-14-sergey.matyukevich.os@quantenna.com> (raw)
In-Reply-To: <20181002092542.18966-1-sergey.matyukevich.os@quantenna.com>

Current implementation of dump_station cfg80211 callback supports
AP mode only. Add support for STA mode as well: by default in STA
mode this callback is supposed to return AP on managed interface.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
---
 drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 30 ++++++++++++++++-------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
index 18179965bd38..51b33ec78fac 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
@@ -480,19 +480,31 @@ qtnf_dump_station(struct wiphy *wiphy, struct net_device *dev,
 	const struct qtnf_sta_node *sta_node;
 	int ret;
 
-	sta_node = qtnf_sta_list_lookup_index(&vif->sta_list, idx);
+	switch (vif->wdev.iftype) {
+	case NL80211_IFTYPE_STATION:
+		if (idx != 0 || !vif->wdev.current_bss)
+			return -ENOENT;
 
-	if (unlikely(!sta_node))
-		return -ENOENT;
+		ether_addr_copy(mac, vif->bssid);
+		break;
+	case NL80211_IFTYPE_AP:
+		sta_node = qtnf_sta_list_lookup_index(&vif->sta_list, idx);
+		if (unlikely(!sta_node))
+			return -ENOENT;
 
-	ether_addr_copy(mac, sta_node->mac_addr);
+		ether_addr_copy(mac, sta_node->mac_addr);
+		break;
+	default:
+		return -ENOTSUPP;
+	}
 
-	ret = qtnf_cmd_get_sta_info(vif, sta_node->mac_addr, sinfo);
+	ret = qtnf_cmd_get_sta_info(vif, mac, sinfo);
 
-	if (unlikely(ret == -ENOENT)) {
-		qtnf_sta_list_del(vif, mac);
-		cfg80211_del_sta(vif->netdev, mac, GFP_KERNEL);
-		sinfo->filled = 0;
+	if (vif->wdev.iftype == NL80211_IFTYPE_AP) {
+		if (ret == -ENOENT) {
+			cfg80211_del_sta(vif->netdev, mac, GFP_KERNEL);
+			sinfo->filled = 0;
+		}
 	}
 
 	sinfo->generation = vif->generation;
-- 
2.11.0


  parent reply	other threads:[~2018-10-02  9:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02  9:25 [PATCH 00/13] qtnfmac: fixes and cleanups for STA mode Sergey Matyukevich OS
2018-10-02  9:25 ` [PATCH 01/13] qtnfmac: do not track STA states in driver Sergey Matyukevich OS
2018-10-02  9:25 ` [PATCH 02/13] qtnfmac: generate local disconnect event in disconnect callback Sergey Matyukevich OS
2018-10-02  9:25 ` [PATCH 03/13] qtnfmac: request userspace to do OBSS scanning if FW can not Sergey Matyukevich OS
2018-10-02  9:25 ` [PATCH 04/13] qtnfmac: do not initialize per-MAC data multiple times Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 05/13] qtnfmac: cleanup and unify command error handling Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 06/13] qtnfmac: do not cancel scan in disconnect callback Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 07/13] qtnfmac: pass sgi rate info flag to wireless core Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 08/13] qtnfmac: pass supported extended capabilities to wiphy Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 09/13] qtnfmac: drop error reports for out-of-bounds key indexes Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 10/13] qtnfmac: add support for scan flush Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 11/13] qtnfmac: add support for scan dwell time configuration Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 12/13] qtnfmac: drop redundant data copy in control path Sergey Matyukevich OS
2018-10-02  9:26 ` Sergey Matyukevich OS [this message]
2018-10-05  8:19 ` [PATCH 00/13] qtnfmac: fixes and cleanups for STA mode Kalle Valo
2018-10-05  9:56   ` 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=20181002092542.18966-14-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox