mwifiex: channel switch support for mwifiex
authorAvinash Patil <patila@marvell.com>
Wed, 28 Jan 2015 10:24:24 +0000 (15:54 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 29 Jan 2015 08:22:10 +0000 (10:22 +0200)
This patch adds cfg80211 channel_switch support for mwifiex.
Upon receiving channel switch request, driver would parse channel
switch announcement IE from beacon_data.
If TX is blocked, netdev queues are stopped. IEs from csa_beacon
are then parsed and set to FW.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Qingshui Gao <gaoqs@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mwifiex/11h.c
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/ie.c
drivers/net/wireless/mwifiex/main.h

index 08c12ae..d794686 100644 (file)
@@ -240,3 +240,40 @@ int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
 
        return 0;
 }
+
+/* This is work queue function for channel switch handling.
+ * This function takes care of updating new channel definitin to
+ * bss config structure, restart AP and indicate channel switch success
+ * to cfg80211.
+ */
+void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work)
+{
+       struct mwifiex_uap_bss_param *bss_cfg;
+       struct delayed_work *delayed_work =
+                       container_of(work, struct delayed_work, work);
+       struct mwifiex_private *priv =
+                       container_of(delayed_work, struct mwifiex_private,
+                                    dfs_chan_sw_work);
+
+       if (WARN_ON(!priv))
+               return;
+
+       bss_cfg = &priv->bss_cfg;
+       if (!bss_cfg->beacon_period) {
+               dev_err(priv->adapter->dev,
+                       "channel switch: AP already stopped\n");
+               return;
+       }
+
+       mwifiex_uap_set_channel(bss_cfg, priv->dfs_chandef);
+
+       if (mwifiex_config_start_uap(priv, bss_cfg)) {
+               dev_dbg(priv->adapter->dev,
+                       "Failed to start AP after channel switch\n");
+               return;
+       }
+
+       dev_notice(priv->adapter->dev,
+                  "indicating channel switch completion to kernel\n");
+       cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef);
+}
Simple merge
Simple merge