blob: 5550c79e022aa17f0899efad2710275ba075ba6a [file] [log] [blame]
From 2fa95d09e85fe9697be59f95a3cf4159495ba3d8 Mon Sep 17 00:00:00 2001
From: Denton Gentry <dgentry@google.com>
Date: Sun, 25 May 2014 14:41:36 -0700
Subject: [PATCH] mwifiex_cfg80211_dump_station implementation
Exports MAC addresses of connected STAs, but nothing more yet.
---
drivers/net/wireless/mwifiex/cfg80211.c | 17 ++++++++++++-----
drivers/net/wireless/mwifiex/main.h | 4 ++++
drivers/net/wireless/mwifiex/util.c | 23 +++++++++++++++++++++++
3 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 8a37ec7..fbb479f 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1014,13 +1014,20 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
int idx, u8 *mac, struct station_info *sinfo)
{
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
+ struct mwifiex_sta_node *node;
+ unsigned long flags;
+ int ret = -ENOENT;
- if (!priv->media_connected || idx)
- return -ENOENT;
-
- memcpy(mac, priv->cfg_bssid, ETH_ALEN);
+ spin_lock_irqsave(&priv->sta_list_spinlock, flags);
+ node = mwifiex_get_sta_entry_by_idx(priv, idx);
+ spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
+ if (node) {
+ memcpy(mac, node->mac_addr, ETH_ALEN);
+ sinfo->filled = 0;
+ ret = 0;
+ }
- return mwifiex_dump_station_info(priv, sinfo);
+ return ret;
}
/* Supported rates to be advertised to the cfg80211 */
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index d53e1e8..58261f9 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -912,6 +912,8 @@ int mwifiex_process_sta_event(struct mwifiex_private *);
int mwifiex_process_uap_event(struct mwifiex_private *);
struct mwifiex_sta_node *
mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac);
+struct mwifiex_sta_node *
+mwifiex_get_sta_entry_by_idx(struct mwifiex_private *priv, int idx);
void mwifiex_delete_all_station_list(struct mwifiex_private *priv);
void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb);
void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb);
@@ -1228,6 +1230,8 @@ struct mwifiex_sta_node *
mwifiex_add_sta_entry(struct mwifiex_private *priv, u8 *mac);
struct mwifiex_sta_node *
mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac);
+struct mwifiex_sta_node *
+mwifiex_get_sta_entry_by_idx(struct mwifiex_private *priv, int idx);
int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, u8 *peer,
u8 action_code, u8 dialog_token,
u16 status_code, const u8 *extra_ies,
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c
index c3824e3..7b3985f 100644
--- a/drivers/net/wireless/mwifiex/util.c
+++ b/drivers/net/wireless/mwifiex/util.c
@@ -274,6 +274,29 @@ mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac)
return NULL;
}
+/* This function will return the pointer to station entry in station list
+ * table by index.
+ * This function should be called after acquiring RA list spinlock.
+ * NULL is returned if station entry is not found in associated STA list.
+ */
+struct mwifiex_sta_node *
+mwifiex_get_sta_entry_by_idx(struct mwifiex_private *priv, int idx)
+{
+ struct mwifiex_sta_node *node;
+ int i = 0;
+
+ list_for_each_entry(node, &priv->sta_list, list) {
+ if (i < idx) {
+ ++i;
+ continue;
+ }
+ return node;
+ }
+
+ return NULL;
+}
+
+
/* This function will add a sta_node entry to associated station list
* table with the given mac address.
* If entry exist already, existing entry is returned.
--
1.9.1.423.g4596e3a