Parcourir la source

qcacld-3.0: Disable TDLS offchannel if more than 1 peer connects

Disable TDLS offchannel if number of connected peers are more than
one.
Also, re-enable offchannel if all peers are disconnected expect one.
With this change, it is possible to increase the limit of max
connected peers which was previously set as one when TDLS
Offchannel is enabled.

Change-Id: Ic0826aa32c8ef805a2df6da6c7506895cdc08a09
CRs-Fixed: 3265868
Utkarsh Bhatnagar il y a 2 ans
Parent
commit
ce8795375d

+ 38 - 1
components/tdls/core/src/wlan_tdls_cmds_process.c

@@ -213,6 +213,15 @@ void tdls_decrement_peer_count(struct wlan_objmgr_vdev *vdev,
 	    soc_obj->tdls_osif_update_cb.tdls_osif_disconn_update)
 	    soc_obj->tdls_osif_update_cb.tdls_osif_disconn_update)
 		soc_obj->tdls_osif_update_cb.tdls_osif_disconn_update(vdev);
 		soc_obj->tdls_osif_update_cb.tdls_osif_disconn_update(vdev);
 	tdls_update_6g_power(vdev, soc_obj, false);
 	tdls_update_6g_power(vdev, soc_obj, false);
+
+	/*
+	 * Offchannel is allowed only when TDLS is connected with one peer.
+	 * If more than one peer is connected then Offchannel is disabled by
+	 * WMI_TDLS_SET_OFFCHAN_MODE_CMDID with DISABLE_CHANSWITCH.
+	 * Hence, re-enable offchannel when only one conencted peer is left.
+	 */
+	if (soc_obj->connected_peer_count == 1)
+		tdls_set_tdls_offchannelmode(vdev, ENABLE_CHANSWITCH);
 }
 }
 
 
 /**
 /**
@@ -1797,6 +1806,19 @@ QDF_STATUS tdls_process_enable_link(struct tdls_oper_request *req)
 		goto error;
 		goto error;
 	}
 	}
 
 
+	/*
+	 * Offchannel is allowed only when TDLS is connected with one peer.
+	 * If more than one peer is connected then Disable Offchannel by sending
+	 * WMI_TDLS_SET_OFFCHAN_MODE_CMDID with DISABLE_CHANSWITCH.
+	 * So, basically when the 2nd peer enable_link is there, offchannel
+	 * should be disabled and will remain disabled for all subsequent
+	 * TDLS peer conenction.
+	 * Offchannel will be re-enabled when connected peer count again
+	 * becomes 1.
+	 */
+	if (soc_obj->connected_peer_count == 1)
+		tdls_set_tdls_offchannelmode(vdev, DISABLE_CHANSWITCH);
+
 	peer->tdls_support = TDLS_CAP_SUPPORTED;
 	peer->tdls_support = TDLS_CAP_SUPPORTED;
 	if (TDLS_LINK_CONNECTED != peer->link_status)
 	if (TDLS_LINK_CONNECTED != peer->link_status)
 		tdls_set_peer_link_status(peer, TDLS_LINK_CONNECTED,
 		tdls_set_peer_link_status(peer, TDLS_LINK_CONNECTED,
@@ -2550,13 +2572,28 @@ free:
 
 
 int tdls_process_set_offchan_mode(struct tdls_set_offchanmode *req)
 int tdls_process_set_offchan_mode(struct tdls_set_offchanmode *req)
 {
 {
-	int status;
+	int status = QDF_STATUS_E_FAILURE;
+	struct tdls_soc_priv_obj *tdls_soc_obj;
 
 
 	tdls_debug("TDLS offchan mode to be configured %d", req->offchan_mode);
 	tdls_debug("TDLS offchan mode to be configured %d", req->offchan_mode);
+
+	tdls_soc_obj = wlan_vdev_get_tdls_soc_obj(req->vdev);
+	if (!tdls_soc_obj)
+		goto free;
+
+	if ((tdls_get_connected_peer_count(tdls_soc_obj) > 1) &&
+	    req->offchan_mode == ENABLE_CHANSWITCH) {
+		tdls_debug("Reject off chan enable, Connected peer count %d",
+			   tdls_get_connected_peer_count(tdls_soc_obj));
+		goto free;
+	}
+
 	status = tdls_set_tdls_offchannelmode(req->vdev, req->offchan_mode);
 	status = tdls_set_tdls_offchannelmode(req->vdev, req->offchan_mode);
 
 
 	if (req->callback)
 	if (req->callback)
 		req->callback(req->vdev);
 		req->callback(req->vdev);
+
+free:
 	qdf_mem_free(req);
 	qdf_mem_free(req);
 
 
 	return status;
 	return status;

+ 2 - 0
components/tdls/core/src/wlan_tdls_ct.c

@@ -1130,6 +1130,8 @@ int tdls_set_tdls_offchannelmode(struct wlan_objmgr_vdev *vdev,
 				vdev, conn_peer->pref_off_chan_freq,
 				vdev, conn_peer->pref_off_chan_freq,
 				conn_peer->pref_off_chan_width,
 				conn_peer->pref_off_chan_width,
 				&chan_switch_params.tdls_off_ch_bw_offset);
 				&chan_switch_params.tdls_off_ch_bw_offset);
+			chan_switch_params.tdls_off_chan_freq =
+						 conn_peer->pref_off_chan_freq;
 		} else {
 		} else {
 			tdls_err("TDLS off-channel parameters are not set yet!!!");
 			tdls_err("TDLS off-channel parameters are not set yet!!!");
 			return -EINVAL;
 			return -EINVAL;

+ 2 - 2
components/tdls/dispatcher/inc/cfg_tdls.h

@@ -129,7 +129,7 @@
  * gEnableTDLSOffChannel - Enables off-channel support for TDLS link.
  * gEnableTDLSOffChannel - Enables off-channel support for TDLS link.
  * @Min: 0
  * @Min: 0
  * @Max: 1
  * @Max: 1
- * @Default: 0
+ * @Default: 1
  *
  *
  * This ini is used to enable/disable off-channel support for TDLS link.
  * This ini is used to enable/disable off-channel support for TDLS link.
  *
  *
@@ -143,7 +143,7 @@
  */
  */
 #define CFG_TDLS_OFF_CHANNEL_ENABLED CFG_INI_BOOL( \
 #define CFG_TDLS_OFF_CHANNEL_ENABLED CFG_INI_BOOL( \
 	"gEnableTDLSOffChannel", \
 	"gEnableTDLSOffChannel", \
-	0, \
+	1, \
 	"Enables off-channel support for TDLS")
 	"Enables off-channel support for TDLS")
 
 
 /*
 /*

+ 1 - 2
components/tdls/dispatcher/src/wlan_tdls_ucfg_api.c

@@ -485,8 +485,7 @@ QDF_STATUS ucfg_tdls_update_config(struct wlan_objmgr_psoc *psoc,
 
 
 	soc_obj->tdls_last_mode = soc_obj->tdls_current_mode;
 	soc_obj->tdls_last_mode = soc_obj->tdls_current_mode;
 	if (TDLS_IS_BUFFER_STA_ENABLED(tdls_feature_flags) ||
 	if (TDLS_IS_BUFFER_STA_ENABLED(tdls_feature_flags) ||
-	    TDLS_IS_SLEEP_STA_ENABLED(tdls_feature_flags) ||
-	    TDLS_IS_OFF_CHANNEL_ENABLED(tdls_feature_flags))
+	    TDLS_IS_SLEEP_STA_ENABLED(tdls_feature_flags))
 		soc_obj->max_num_tdls_sta =
 		soc_obj->max_num_tdls_sta =
 			WLAN_TDLS_STA_P_UAPSD_OFFCHAN_MAX_NUM;
 			WLAN_TDLS_STA_P_UAPSD_OFFCHAN_MAX_NUM;