wil6210: single station disconnect
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Thu, 27 Feb 2014 14:20:54 +0000 (16:20 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 28 Feb 2014 19:33:37 +0000 (14:33 -0500)
implement del_station() method in the struct cfg80211_ops
It allows to disconnect single peer from the AP

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/wil6210/cfg80211.c
drivers/net/wireless/ath/wil6210/main.c
drivers/net/wireless/ath/wil6210/wil6210.h
drivers/net/wireless/ath/wil6210/wmi.c

index c19e8954d8b3208b9e6e60039beb717cb642f884..a4da064dbbc4b5c33b114dd251edcdd4b887c5b2 100644 (file)
@@ -657,6 +657,14 @@ static int wil_cfg80211_stop_ap(struct wiphy *wiphy,
        return rc;
 }
 
+static int wil_cfg80211_del_station(struct wiphy *wiphy,
+                                   struct net_device *dev, u8 *mac)
+{
+       struct wil6210_priv *wil = wiphy_to_wil(wiphy);
+       wil6210_disconnect(wil, mac);
+       return 0;
+}
+
 static struct cfg80211_ops wil_cfg80211_ops = {
        .scan = wil_cfg80211_scan,
        .connect = wil_cfg80211_connect,
@@ -674,6 +682,7 @@ static struct cfg80211_ops wil_cfg80211_ops = {
        /* AP mode */
        .start_ap = wil_cfg80211_start_ap,
        .stop_ap = wil_cfg80211_stop_ap,
+       .del_station = wil_cfg80211_del_station,
 };
 
 static void wil_wiphy_init(struct wiphy *wiphy)
index a0ea135efd11a3a138cc95ae719d902d7cc56f22..41c362dee0329a5934df1f39c8ecb06d808fded3 100644 (file)
@@ -58,6 +58,12 @@ static void wil_disconnect_cid(struct wil6210_priv *wil, int cid)
 {
        uint i;
        struct wil_sta_info *sta = &wil->sta[cid];
+
+       if (sta->status != wil_sta_unused) {
+               wmi_disconnect_sta(wil, sta->addr, WLAN_REASON_DEAUTH_LEAVING);
+               sta->status = wil_sta_unused;
+       }
+
        for (i = 0; i < WIL_STA_TID_NUM; i++) {
                struct wil_tid_ampdu_rx *r = sta->tid_rx[i];
                sta->tid_rx[i] = NULL;
index b64175aae1ddf42c8d397dfcb16eb919dc645e65..980dccc82b32c3dffc2b2d4a7bdc4c8847fa19a2 100644 (file)
@@ -437,6 +437,7 @@ int wmi_rx_chain_add(struct wil6210_priv *wil, struct vring *vring);
 int wmi_p2p_cfg(struct wil6210_priv *wil, int channel);
 int wmi_rxon(struct wil6210_priv *wil, bool on);
 int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_m, u32 *t_r);
+int wmi_disconnect_sta(struct wil6210_priv *wil, const u8 *mac, u16 reason);
 
 int wil6210_init_irq(struct wil6210_priv *wil, int irq);
 void wil6210_fini_irq(struct wil6210_priv *wil, int irq);
index 70b3a9b20450857ec4d371d8ef523738758167d1..24eed096358104e7c4f4f346bb0efc1bf3066953 100644 (file)
@@ -455,19 +455,14 @@ static void wmi_evt_disconnect(struct wil6210_priv *wil, int id,
                               void *d, int len)
 {
        struct wmi_disconnect_event *evt = d;
-       int cid = wil_find_cid(wil, evt->bssid);
 
-       wil_dbg_wmi(wil, "Disconnect %pM CID %d reason %d proto %d wmi\n",
-                   evt->bssid, cid,
+       wil_dbg_wmi(wil, "Disconnect %pM reason %d proto %d wmi\n",
+                   evt->bssid,
                    evt->protocol_reason_status, evt->disconnect_reason);
 
        wil->sinfo_gen++;
 
-       /* TODO: fix for multiple connections */
-
        wil6210_disconnect(wil, evt->bssid);
-       if (cid >= 0)
-               wil->sta[cid].status = wil_sta_unused;
 }
 
 static void wmi_evt_notify(struct wil6210_priv *wil, int id, void *d, int len)
@@ -1062,6 +1057,18 @@ int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_m, u32 *t_r)
        return 0;
 }
 
+int wmi_disconnect_sta(struct wil6210_priv *wil, const u8 *mac, u16 reason)
+{
+       struct wmi_disconnect_sta_cmd cmd = {
+               .disconnect_reason = cpu_to_le16(reason),
+       };
+       memcpy(cmd.dst_mac, mac, ETH_ALEN);
+
+       wil_dbg_wmi(wil, "%s(%pM, reason %d)\n", __func__, mac, reason);
+
+       return wmi_send(wil, WMI_DISCONNECT_STA_CMDID, &cmd, sizeof(cmd));
+}
+
 void wmi_event_flush(struct wil6210_priv *wil)
 {
        struct pending_wmi_event *evt, *t;