wlcore: add dfs master restart calls
authorEliad Peller <eliad@wizery.com>
Mon, 29 Dec 2014 06:24:10 +0000 (08:24 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 9 Jan 2015 13:48:01 +0000 (15:48 +0200)
call wlcore_cmd_dfs_master_restart when starting
the ap on a new channel (after csa is done).

Add a new WLVIF_FLAG_BEACON_DISABLED flag to
indicate that dfs_master_restart command
is required.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ti/wl18xx/cmd.c
drivers/net/wireless/ti/wl18xx/cmd.h
drivers/net/wireless/ti/wl18xx/main.c
drivers/net/wireless/ti/wlcore/event.c
drivers/net/wireless/ti/wlcore/hw_ops.h
drivers/net/wireless/ti/wlcore/main.c
drivers/net/wireless/ti/wlcore/wlcore.h
drivers/net/wireless/ti/wlcore/wlcore_i.h

index 5731950d671e34b1b398648db4a5b7025a25c253..a8d176ddc73c3c8e6a6f5f7adab2ec9ea7e1c924 100644 (file)
@@ -229,3 +229,28 @@ out_free:
        kfree(cmd);
        return ret;
 }
+
+int wl18xx_cmd_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif)
+{
+       struct wl18xx_cmd_dfs_master_restart *cmd;
+       int ret = 0;
+
+       wl1271_debug(DEBUG_CMD, "cmd dfs master restart (role %d)",
+                    wlvif->role_id);
+
+       cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+       if (!cmd)
+               return -ENOMEM;
+
+       cmd->role_id = wlvif->role_id;
+
+       ret = wl1271_cmd_send(wl, CMD_DFS_MASTER_RESTART,
+                             cmd, sizeof(*cmd), 0);
+       if (ret < 0) {
+               wl1271_error("failed to send dfs master restart command");
+               goto out_free;
+       }
+out_free:
+       kfree(cmd);
+       return ret;
+}
index 0809b92c23db94428595b2fc70bba958a1a81b25..7f9440a2bff8cf6691c9ab773a00c7df28597c82 100644 (file)
@@ -66,6 +66,13 @@ struct wl18xx_cmd_dfs_radar_debug {
        u8 padding[3];
 } __packed;
 
+struct wl18xx_cmd_dfs_master_restart {
+       struct wl1271_cmd_header header;
+
+       u8 role_id;
+       u8 padding[3];
+} __packed;
+
 /* cac_start and cac_stop share the same params */
 struct wlcore_cmd_cac_start {
        struct wl1271_cmd_header header;
@@ -85,4 +92,5 @@ int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
                                          u8 key_len, u8 *key);
 int wl18xx_cmd_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start);
 int wl18xx_cmd_radar_detection_debug(struct wl1271 *wl, u8 channel);
+int wl18xx_cmd_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 #endif
index c36b1afc3891b2a8d44b793b6b69e8d796bfbcf2..0e96b38a612f6ca9ac7f2284d5bcbd80cd467eb6 100644 (file)
@@ -1705,6 +1705,7 @@ static struct wlcore_ops wl18xx_ops = {
        .rx_ba_filter   = wl18xx_acx_rx_ba_filter,
        .ap_sleep       = wl18xx_acx_ap_sleep,
        .set_cac        = wl18xx_cmd_set_cac,
+       .dfs_master_restart     = wl18xx_cmd_dfs_master_restart,
 };
 
 /* HT cap appropriate for wide channels in 2Ghz */
index 69a266121bf4a83036f881ccaefee4f0aa800db9..c42e78955e7b38604c3cffb7f95cd5dabf54f588 100644 (file)
@@ -154,6 +154,7 @@ void wlcore_event_channel_switch(struct wl1271 *wl,
                        ieee80211_chswitch_done(vif, success);
                        cancel_delayed_work(&wlvif->channel_switch_work);
                } else {
+                       set_bit(WLVIF_FLAG_BEACON_DISABLED, &wlvif->flags);
                        ieee80211_csa_finish(vif);
                }
        }
index 42fef847dc5c0d939f1613751925f1c081853d78..eec56935b1b6acb7625c0ee0018ef023484b9c6e 100644 (file)
@@ -320,4 +320,13 @@ wlcore_hw_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start)
 
        return wl->ops->set_cac(wl, wlvif, start);
 }
+
+static inline int
+wlcore_hw_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif)
+{
+       if (!wl->ops->dfs_master_restart)
+               return -EINVAL;
+
+       return wl->ops->dfs_master_restart(wl, wlvif);
+}
 #endif
index 68da50efb16472298a9cac4524fd79643e3506e8..2cbec03049e658954d998d0357d731c7317cb28b 100644 (file)
@@ -4127,8 +4127,14 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
                ret = wlcore_set_beacon_template(wl, vif, is_ap);
                if (ret < 0)
                        goto out;
-       }
 
+               if (test_and_clear_bit(WLVIF_FLAG_BEACON_DISABLED,
+                                      &wlvif->flags)) {
+                       ret = wlcore_hw_dfs_master_restart(wl, wlvif);
+                       if (ret < 0)
+                               goto out;
+               }
+       }
 out:
        if (ret != 0)
                wl1271_error("beacon info change failed: %d", ret);
@@ -4774,6 +4780,8 @@ static int __wlcore_switch_vif_chan(struct wl1271 *wl,
        if (WARN_ON_ONCE(wlvif->bss_type != BSS_TYPE_AP_BSS))
                return 0;
 
+       WARN_ON(!test_bit(WLVIF_FLAG_BEACON_DISABLED, &wlvif->flags));
+
        if (wlvif->radar_enabled) {
                wl1271_debug(DEBUG_MAC80211, "Stop radar detection");
                wlcore_hw_set_cac(wl, wlvif, false);
index caee58f72a0541bee75b648858b76e77d2def555..581c47913cec5623bb851ed6190b1fc61f61de05 100644 (file)
@@ -125,6 +125,7 @@ struct wlcore_ops {
                                          u8 key_len, u8 *key);
        int (*set_cac)(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                       bool start);
+       int (*dfs_master_restart)(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 };
 
 enum wlcore_partitions {
index b2bdb139c0204ea1417860a85b81f4cf1c7538c9..3396ce5a934d1d815206d0c9fe639cb7f2f2b697 100644 (file)
@@ -251,6 +251,7 @@ enum wl12xx_vif_flags {
        WLVIF_FLAG_AP_PROBE_RESP_SET,
        WLVIF_FLAG_IN_USE,
        WLVIF_FLAG_ACTIVE,
+       WLVIF_FLAG_BEACON_DISABLED,
 };
 
 struct wl12xx_vif;