brcmfmac: Add dump_station support to cfg80221 ops.
authorHante Meuleman <meuleman@broadcom.com>
Thu, 8 Oct 2015 18:33:18 +0000 (20:33 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 21 Oct 2015 07:56:49 +0000 (10:56 +0300)
With this feature it becomes possible to request a station
assoc list.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
drivers/net/wireless/brcm80211/brcmfmac/fwil.h
drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h

index ca9d2398d026836c3f21ee814800cc2c57974ebe..18293377f338479a611cd907e6750969b72f52ea 100644 (file)
@@ -2521,6 +2521,35 @@ done:
        return err;
 }
 
+static int
+brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev,
+                           int idx, u8 *mac, struct station_info *sinfo)
+{
+       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+       struct brcmf_if *ifp = netdev_priv(ndev);
+       s32 err;
+
+       brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
+
+       if (idx == 0) {
+               cfg->assoclist.count = cpu_to_le32(BRCMF_MAX_ASSOCLIST);
+               err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_ASSOCLIST,
+                                            &cfg->assoclist,
+                                            sizeof(cfg->assoclist));
+               if (err) {
+                       brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
+                                 err);
+                       cfg->assoclist.count = 0;
+                       return -EOPNOTSUPP;
+               }
+       }
+       if (idx < le32_to_cpu(cfg->assoclist.count)) {
+               memcpy(mac, cfg->assoclist.mac[idx], ETH_ALEN);
+               return brcmf_cfg80211_get_station(wiphy, ndev, mac, sinfo);
+       }
+       return -ENOENT;
+}
+
 static s32
 brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
                           bool enabled, s32 timeout)
@@ -4620,6 +4649,7 @@ static struct cfg80211_ops wl_cfg80211_ops = {
        .join_ibss = brcmf_cfg80211_join_ibss,
        .leave_ibss = brcmf_cfg80211_leave_ibss,
        .get_station = brcmf_cfg80211_get_station,
+       .dump_station = brcmf_cfg80211_dump_station,
        .set_tx_power = brcmf_cfg80211_set_tx_power,
        .get_tx_power = brcmf_cfg80211_get_tx_power,
        .add_key = brcmf_cfg80211_add_key,
index 3f5e5505d3291ed87e1cce4081dc691e6ffb8d09..4d95c6e980f16b6042e33c0f31ed536a72bf1a8d 100644 (file)
@@ -407,6 +407,7 @@ struct brcmf_cfg80211_info {
        struct brcmu_d11inf d11inf;
        bool wowl_enabled;
        u32 pre_wowl_pmmode;
+       struct brcmf_assoclist_le assoclist;
 };
 
 /**
index 5434dcf64f7d8012206975ed743fe96145b924fb..b20fc0f82a4828a5111c8b4061af2928f56fc595 100644 (file)
@@ -72,6 +72,7 @@
 #define BRCMF_C_GET_BSS_INFO                   136
 #define BRCMF_C_GET_BANDLIST                   140
 #define BRCMF_C_SET_SCB_TIMEOUT                        158
+#define BRCMF_C_GET_ASSOCLIST                  159
 #define BRCMF_C_GET_PHYLIST                    180
 #define BRCMF_C_SET_SCAN_CHANNEL_TIME          185
 #define BRCMF_C_SET_SCAN_UNASSOC_TIME          187
index 297911f38fa0458e27ac1cfdd589dc01c4ef93b9..daa427b46712e8243be5365fca928183e2745fe3 100644 (file)
 #define BRCMF_COUNTRY_BUF_SZ           4
 #define BRCMF_ANT_MAX                  4
 
+#define BRCMF_MAX_ASSOCLIST            128
+
 /* join preference types for join_pref iovar */
 enum brcmf_join_pref_types {
        BRCMF_JOIN_PREF_RSSI = 1,
@@ -621,4 +623,15 @@ struct brcmf_rev_info_le {
        __le32 nvramrev;
 };
 
+/**
+ * struct brcmf_assoclist_le - request assoc list.
+ *
+ * @count: indicates number of stations.
+ * @mac: MAC addresses of stations.
+ */
+struct brcmf_assoclist_le {
+       __le32 count;
+       u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
+};
+
 #endif /* FWIL_TYPES_H_ */