Преглед на файлове

qcacld-3.0: Disallow TDLS when NAN is active

Since NAN has higher priority over TDLS, disallow TDLS link
when NAN is active.

Change-Id: I7de34dbb2f808c36358ac5266c26e2729b901941
CRs-fixed: 2537158
Manikandan Mohan преди 5 години
родител
ревизия
cf5048294b

+ 11 - 0
components/nan/core/src/nan_main.c

@@ -1046,6 +1046,17 @@ bool nan_is_enable_allowed(struct wlan_objmgr_psoc *psoc, uint8_t nan_chan)
 					     HW_MODE_20_MHZ));
 }
 
+bool nan_is_disc_active(struct wlan_objmgr_psoc *psoc)
+{
+	if (!psoc) {
+		nan_err("psoc object object is NULL");
+		return false;
+	}
+
+	return (NAN_DISC_ENABLED == nan_get_discovery_state(psoc) ||
+		NAN_DISC_ENABLE_IN_PROGRESS == nan_get_discovery_state(psoc));
+}
+
 QDF_STATUS nan_discovery_pre_enable(struct wlan_objmgr_psoc *psoc,
 				    uint8_t nan_social_channel)
 {

+ 8 - 0
components/nan/core/src/nan_main_i.h

@@ -244,6 +244,14 @@ enum nan_disc_state nan_get_discovery_state(struct wlan_objmgr_psoc *psoc);
  */
 bool nan_is_enable_allowed(struct wlan_objmgr_psoc *psoc, uint8_t nan_chan);
 
+/*
+ * nan_is_disc_active: Queries whether NAN Discovery is active
+ * @psoc: PSOC object
+ *
+ * Return: True if NAN Disc is active, False otherwise
+ */
+bool nan_is_disc_active(struct wlan_objmgr_psoc *psoc);
+
 /*
  * nan_get_connection_info: Gets connection info of the NAN Discovery interface
  * @psoc: PSOC object

+ 14 - 0
components/nan/dispatcher/inc/nan_ucfg_api.h

@@ -283,6 +283,15 @@ bool ucfg_is_nan_sap_supported(struct wlan_objmgr_psoc *psoc);
 bool ucfg_is_nan_enable_allowed(struct wlan_objmgr_psoc *psoc,
 				uint8_t nan_chan);
 
+/**
+ * ucfg_is_nan_disc_active() - ucfg API to query if NAN Discovery is
+ * active
+ * @psoc: pointer to psoc object
+ *
+ * Return: True if NAN Discovery is active, False otherwise
+ */
+bool ucfg_is_nan_disc_active(struct wlan_objmgr_psoc *psoc);
+
 /**
  * ucfg_nan_set_tgt_caps: ucfg API to set the NAN capabilities of the Target
  * @psoc: pointer to psoc object
@@ -359,5 +368,10 @@ static inline void ucfg_nan_psoc_close(struct wlan_objmgr_psoc *psoc)
 {
 }
 
+static inline bool ucfg_is_nan_disc_active(struct wlan_objmgr_psoc *psoc)
+{
+	return false;
+}
+
 #endif /* WLAN_FEATURE_NAN */
 #endif /* _NAN_UCFG_API_H_ */

+ 5 - 0
components/nan/dispatcher/src/nan_ucfg_api.c

@@ -553,6 +553,11 @@ bool ucfg_is_nan_enable_allowed(struct wlan_objmgr_psoc *psoc, uint8_t nan_chan)
 	return nan_is_enable_allowed(psoc, nan_chan);
 }
 
+bool ucfg_is_nan_disc_active(struct wlan_objmgr_psoc *psoc)
+{
+	return nan_is_disc_active(psoc);
+}
+
 QDF_STATUS ucfg_nan_discovery_req(void *in_req, uint32_t req_type)
 {
 	struct wlan_objmgr_psoc *psoc;

+ 19 - 2
components/tdls/core/src/wlan_tdls_cmds_process.c

@@ -36,6 +36,7 @@
 #include "wlan_tdls_cmds_process.h"
 #include "wlan_tdls_tgt_api.h"
 #include "wlan_policy_mgr_api.h"
+#include "nan_ucfg_api.h"
 
 static uint16_t tdls_get_connected_peer(struct tdls_soc_priv_obj *soc_obj)
 {
@@ -678,6 +679,11 @@ int tdls_validate_mgmt_request(struct tdls_action_frame_request *tdls_mgmt_req)
 
 	/* other than teardown frame, mgmt frames are not sent if disabled */
 	if (TDLS_TEARDOWN != tdls_validate->action_code) {
+		if (ucfg_is_nan_disc_active(tdls_soc->soc)) {
+			tdls_err("NAN active. NAN+TDLS not supported");
+			return -EPERM;
+		}
+
 		if (!tdls_check_is_tdls_allowed(vdev)) {
 			tdls_err("TDLS not allowed, reject MGMT, action = %d",
 				tdls_validate->action_code);
@@ -799,14 +805,25 @@ QDF_STATUS tdls_process_add_peer(struct tdls_add_peer_request *req)
 	struct wlan_serialization_command cmd = {0,};
 	enum wlan_serialization_status ser_cmd_status;
 	struct wlan_objmgr_vdev *vdev;
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
+	QDF_STATUS status = QDF_STATUS_E_INVAL;
+	struct wlan_objmgr_psoc *psoc;
 
 	if (!req || !req->vdev) {
 		tdls_err("req: %pK", req);
-		status = QDF_STATUS_E_INVAL;
 		goto error;
 	}
 	vdev = req->vdev;
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		tdls_err("can't get psoc");
+		goto error;
+	}
+	if (ucfg_is_nan_disc_active(psoc)) {
+		tdls_err("NAN active. NAN+TDLS not supported");
+		goto error;
+	}
+	status = QDF_STATUS_SUCCESS;
+
 	cmd.cmd_type = WLAN_SER_CMD_TDLS_ADD_PEER;
 	cmd.cmd_id = 0;
 	cmd.cmd_cb = tdls_add_peer_serialize_callback;