Răsfoiți Sursa

mac80211: add post_channel_switch driver operation

As a counterpart to the pre_channel_switch operation, add a
post_channel_switch operation.  This allows the drivers to go back to
a normal configuration after the channel switch is completed.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Luciano Coelho 10 ani în urmă
părinte
comite
f1d65583bc
5 a modificat fișierele cu 43 adăugiri și 1 ștergeri
  1. 6 0
      include/net/mac80211.h
  2. 6 1
      net/mac80211/cfg.c
  3. 16 0
      net/mac80211/driver-ops.h
  4. 9 0
      net/mac80211/mlme.c
  5. 6 0
      net/mac80211/trace.h

+ 6 - 0
include/net/mac80211.h

@@ -2836,6 +2836,9 @@ enum ieee80211_roc_type {
  *	before a channel switch procedure is started (ie. when a STA
  *	before a channel switch procedure is started (ie. when a STA
  *	gets a CSA or an userspace initiated channel-switch), allowing
  *	gets a CSA or an userspace initiated channel-switch), allowing
  *	the driver to prepare for the channel switch.
  *	the driver to prepare for the channel switch.
+ * @post_channel_switch: This is an optional callback that is called
+ *	after a channel switch procedure is completed, allowing the
+ *	driver to go back to a normal configuration.
  *
  *
  * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
  * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
  *	information in bss_conf is set up and the beacon can be retrieved. A
  *	information in bss_conf is set up and the beacon can be retrieved. A
@@ -3046,6 +3049,9 @@ struct ieee80211_ops {
 				  struct ieee80211_vif *vif,
 				  struct ieee80211_vif *vif,
 				  struct ieee80211_channel_switch *ch_switch);
 				  struct ieee80211_channel_switch *ch_switch);
 
 
+	int (*post_channel_switch)(struct ieee80211_hw *hw,
+				   struct ieee80211_vif *vif);
+
 	int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
 	int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
 	void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
 	void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
 	u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
 	u32 (*get_expected_throughput)(struct ieee80211_sta *sta);

+ 6 - 1
net/mac80211/cfg.c

@@ -2919,7 +2919,6 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
 		return err;
 		return err;
 
 
 	ieee80211_bss_info_change_notify(sdata, changed);
 	ieee80211_bss_info_change_notify(sdata, changed);
-	cfg80211_ch_switch_notify(sdata->dev, &sdata->csa_chandef);
 
 
 	if (sdata->csa_block_tx) {
 	if (sdata->csa_block_tx) {
 		ieee80211_wake_vif_queues(local, sdata,
 		ieee80211_wake_vif_queues(local, sdata,
@@ -2927,6 +2926,12 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
 		sdata->csa_block_tx = false;
 		sdata->csa_block_tx = false;
 	}
 	}
 
 
+	err = drv_post_channel_switch(sdata);
+	if (err)
+		return err;
+
+	cfg80211_ch_switch_notify(sdata->dev, &sdata->csa_chandef);
+
 	return 0;
 	return 0;
 }
 }
 
 

+ 16 - 0
net/mac80211/driver-ops.h

@@ -1214,6 +1214,22 @@ drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
 	return ret;
 	return ret;
 }
 }
 
 
+static inline int
+drv_post_channel_switch(struct ieee80211_sub_if_data *sdata)
+{
+	struct ieee80211_local *local = sdata->local;
+	int ret = 0;
+
+	if (!check_sdata_in_driver(sdata))
+		return -EIO;
+
+	trace_drv_post_channel_switch(local, sdata);
+	if (local->ops->post_channel_switch)
+		ret = local->ops->post_channel_switch(&local->hw, &sdata->vif);
+	trace_drv_return_int(local, ret);
+	return ret;
+}
+
 static inline int drv_join_ibss(struct ieee80211_local *local,
 static inline int drv_join_ibss(struct ieee80211_local *local,
 				struct ieee80211_sub_if_data *sdata)
 				struct ieee80211_sub_if_data *sdata)
 {
 {

+ 9 - 0
net/mac80211/mlme.c

@@ -1010,6 +1010,15 @@ static void ieee80211_chswitch_work(struct work_struct *work)
 		sdata->csa_block_tx = false;
 		sdata->csa_block_tx = false;
 	}
 	}
 
 
+	ret = drv_post_channel_switch(sdata);
+	if (ret) {
+		sdata_info(sdata,
+			   "driver post channel switch failed, disconnecting\n");
+		ieee80211_queue_work(&local->hw,
+				     &ifmgd->csa_connection_drop_work);
+		goto out;
+	}
+
 	ieee80211_sta_reset_beacon_monitor(sdata);
 	ieee80211_sta_reset_beacon_monitor(sdata);
 	ieee80211_sta_reset_conn_monitor(sdata);
 	ieee80211_sta_reset_conn_monitor(sdata);
 
 

+ 6 - 0
net/mac80211/trace.h

@@ -2141,6 +2141,12 @@ TRACE_EVENT(drv_pre_channel_switch,
 	)
 	)
 );
 );
 
 
+DEFINE_EVENT(local_sdata_evt, drv_post_channel_switch,
+	     TP_PROTO(struct ieee80211_local *local,
+		      struct ieee80211_sub_if_data *sdata),
+	     TP_ARGS(local, sdata)
+);
+
 
 
 #ifdef CONFIG_MAC80211_MESSAGE_TRACING
 #ifdef CONFIG_MAC80211_MESSAGE_TRACING
 #undef TRACE_SYSTEM
 #undef TRACE_SYSTEM