Ver código fonte

Merge "qcacld-3.0: cleanup NAN state upon NAN enable/disable timeout" into wlan-cld3.driver.lnx.2.0

CNSS_WLAN Service 4 anos atrás
pai
commit
24db0e64d5

+ 14 - 1
components/nan/core/inc/wlan_nan_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -200,6 +200,13 @@ uint32_t wlan_nan_get_disc_5g_ch_freq(struct wlan_objmgr_psoc *psoc);
  */
 bool wlan_nan_get_sap_conc_support(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * nan_disable_cleanup: Cleanup NAN state upon NAN disable
+ * @psoc: pointer to psoc object
+ *
+ * Return: Cleanup NAN state upon NAN disable
+ */
+QDF_STATUS nan_disable_cleanup(struct wlan_objmgr_psoc *psoc);
 #else /* WLAN_FEATURE_NAN */
 static inline QDF_STATUS nan_init(void)
 {
@@ -239,5 +246,11 @@ bool wlan_nan_get_sap_conc_support(struct wlan_objmgr_psoc *psoc)
 {
 	return false;
 }
+
+static inline
+QDF_STATUS nan_disable_cleanup(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_E_FAILURE;
+}
 #endif /* WLAN_FEATURE_NAN */
 #endif /* _WLAN_NAN_API_H_ */

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

@@ -888,14 +888,17 @@ done:
 	return QDF_STATUS_SUCCESS;
 }
 
-static QDF_STATUS nan_handle_disable_ind(struct nan_event_params *nan_event)
+QDF_STATUS nan_disable_cleanup(struct wlan_objmgr_psoc *psoc)
 {
 	struct nan_psoc_priv_obj *psoc_nan_obj;
-	struct wlan_objmgr_psoc *psoc;
 	QDF_STATUS status;
 	uint8_t vdev_id;
 
-	psoc = nan_event->psoc;
+	if (!psoc) {
+		nan_err("psoc is NULL");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
 	psoc_nan_obj = nan_get_psoc_priv_obj(psoc);
 	if (!psoc_nan_obj) {
 		nan_err("psoc_nan_obj is NULL");
@@ -925,6 +928,11 @@ static QDF_STATUS nan_handle_disable_ind(struct nan_event_params *nan_event)
 	return status;
 }
 
+static QDF_STATUS nan_handle_disable_ind(struct nan_event_params *nan_event)
+{
+	return nan_disable_cleanup(nan_event->psoc);
+}
+
 static QDF_STATUS nan_handle_schedule_update(
 				struct nan_datapath_sch_update_event *ind)
 {

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

@@ -505,5 +505,11 @@ ucfg_nan_disable_ndi(struct wlan_objmgr_psoc *psoc, uint32_t ndi_vdev_id)
 {
 	return QDF_STATUS_E_INVAL;
 }
+
+static inline
+bool ucfg_is_nan_disable_supported(struct wlan_objmgr_psoc *psoc)
+{
+	return false;
+}
 #endif /* WLAN_FEATURE_NAN */
 #endif /* _NAN_UCFG_API_H_ */

+ 10 - 2
components/nan/dispatcher/src/nan_ucfg_api.c

@@ -758,13 +758,21 @@ post_msg:
 
 	if (req_type != NAN_GENERIC_REQ) {
 		err = osif_request_wait_for_response(request);
-		if (err)
+		if (err) {
 			nan_debug("NAN request: %u timed out: %d",
 				  req_type, err);
 
+			if (req_type == NAN_ENABLE_REQ) {
+				nan_set_discovery_state(psoc,
+							NAN_DISC_DISABLED);
+				policy_mgr_check_n_start_opportunistic_timer(
+									psoc);
+			} else if (req_type == NAN_DISABLE_REQ) {
+				nan_disable_cleanup(psoc);
+			}
+		}
 		if (req_type == NAN_DISABLE_REQ)
 			psoc_priv->is_explicit_disable = false;
-
 		osif_request_put(request);
 	}
 

+ 7 - 2
core/hdd/src/wlan_hdd_main.c

@@ -6645,8 +6645,13 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
 			memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
 			hdd_wext_send_event(adapter->dev, SIOCGIWAP, &wrqu,
 					    NULL);
-		} else if (adapter->device_mode == QDF_NAN_DISC_MODE &&
-			   ucfg_is_nan_disc_active(hdd_ctx->psoc))
+		}
+
+		if ((adapter->device_mode == QDF_NAN_DISC_MODE ||
+		     (adapter->device_mode == QDF_STA_MODE &&
+		      !ucfg_nan_is_vdev_creation_allowed(hdd_ctx->psoc))) &&
+		    ucfg_is_nan_disable_supported(hdd_ctx->psoc) &&
+		    ucfg_is_nan_disc_active(hdd_ctx->psoc))
 			ucfg_disable_nan_discovery(hdd_ctx->psoc, NULL, 0);
 
 		wlan_hdd_scan_abort(adapter);