Browse Source

qcacld-3.0: NAN component updates for SAP concurrency

Add NAN+SAP concurrency related changes to NAN component. This
handles NAN discovery and SAP SCC design constraint.

Change-Id: Ief0d6735d9f011eb3bac22d813b2d2ef41f3fe7c
CRs-fixed: 2431539
Manikandan Mohan 6 years ago
parent
commit
a1f29a9bfe

+ 28 - 0
components/nan/core/inc/wlan_nan_api.h

@@ -184,6 +184,23 @@ struct wlan_nan_rx_ops *nan_psoc_get_rx_ops(struct wlan_objmgr_psoc *psoc)
 QDF_STATUS
 wlan_nan_get_connection_info(struct wlan_objmgr_psoc *psoc,
 			     struct policy_mgr_vdev_entry_info *conn_info);
+
+/**
+ * wlan_nan_get_disc_5g_ch: Get NAN Disc 5G channel
+ * @psoc: pointer to psoc object
+ *
+ * Return: NAN Disc 5G channel
+ */
+uint8_t wlan_nan_get_disc_5g_ch(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * wlan_nan_get_sap_conc_support: Get NAN+SAP conc support
+ * @psoc: pointer to psoc object
+ *
+ * Return: True if NAN+SAP supported else false
+ */
+bool wlan_nan_get_sap_conc_support(struct wlan_objmgr_psoc *psoc);
+
 #else /* WLAN_FEATURE_NAN */
 static inline QDF_STATUS nan_init(void)
 {
@@ -211,5 +228,16 @@ wlan_nan_get_connection_info(struct wlan_objmgr_psoc *psoc,
 {
 	return QDF_STATUS_SUCCESS;
 }
+
+static inline uint8_t wlan_nan_get_disc_5g_ch(struct wlan_objmgr_psoc *psoc)
+{
+	return 0;
+}
+
+static inline
+bool wlan_nan_get_sap_conc_support(struct wlan_objmgr_psoc *psoc)
+{
+	return false;
+}
 #endif /* WLAN_FEATURE_NAN */
 #endif /* _WLAN_NAN_API_H_ */

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

@@ -815,18 +815,21 @@ static QDF_STATUS nan_handle_enable_rsp(struct nan_event_params *nan_event)
 
 			policy_mgr_incr_active_session(psoc, QDF_NAN_DISC_MODE,
 						       NAN_PSEUDO_VDEV_ID);
+			policy_mgr_nan_sap_post_enable_conc_check(psoc);
 
 		} else {
 			/*
 			 * State set to DISABLED OR DISABLE_IN_PROGRESS, try to
 			 * restore the single MAC mode.
 			 */
-			psoc_nan_obj->nan_social_channel = 0;
+			psoc_nan_obj->nan_social_ch_2g = 0;
+			psoc_nan_obj->nan_social_ch_5g = 0;
 			policy_mgr_check_n_start_opportunistic_timer(psoc);
 		}
 	} else {
 		/* NAN Enable has failed, restore changes */
-		psoc_nan_obj->nan_social_channel = 0;
+		psoc_nan_obj->nan_social_ch_2g = 0;
+		psoc_nan_obj->nan_social_ch_5g = 0;
 		nan_set_discovery_state(nan_event->psoc, NAN_DISC_DISABLED);
 		policy_mgr_check_n_start_opportunistic_timer(psoc);
 	}
@@ -853,10 +856,13 @@ static QDF_STATUS nan_handle_disable_ind(struct nan_event_params *nan_event)
 		policy_mgr_decr_session_set_pcl(psoc, QDF_NAN_DISC_MODE,
 						NAN_PSEUDO_VDEV_ID);
 
-		if (psoc_nan_obj->is_explicit_disable &&
-		    psoc_nan_obj->cb_obj.ucfg_explicit_disable_cb)
-			psoc_nan_obj->cb_obj.ucfg_explicit_disable_cb(
-						 psoc_nan_obj->disable_context);
+		if (psoc_nan_obj->is_explicit_disable) {
+			if (psoc_nan_obj->cb_obj.ucfg_explicit_disable_cb)
+				psoc_nan_obj->cb_obj.ucfg_explicit_disable_cb(
+				psoc_nan_obj->disable_context);
+		} else {
+			policy_mgr_nan_sap_post_disable_conc_check(psoc);
+		}
 	} else {
 		/* Should not happen, NAN state can always be disabled */
 		nan_err("Cannot set NAN state to disabled!");
@@ -1063,6 +1069,13 @@ QDF_STATUS nan_discovery_pre_enable(struct wlan_objmgr_psoc *psoc,
 		goto pre_enable_failure;
 	}
 
+	if (!policy_mgr_nan_sap_pre_enable_conc_check(psoc, PM_NAN_DISC_MODE,
+						      nan_social_channel)) {
+		nan_debug("NAN not enabled due to concurrency constraints");
+		status = QDF_STATUS_E_INVAL;
+		goto pre_enable_failure;
+	}
+
 	/* Piggyback on any available vdev for policy manager update */
 	vdev = wlan_objmgr_pdev_get_first_vdev(pdev, WLAN_NAN_ID);
 	if (!vdev) {
@@ -1147,10 +1160,8 @@ static QDF_STATUS nan_discovery_enable_req(struct nan_enable_req *req)
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	if (req->social_chan_2g)
-		psoc_nan_obj->nan_social_channel = req->social_chan_2g;
-	else
-		psoc_nan_obj->nan_social_channel = req->social_chan_5g;
+	psoc_nan_obj->nan_social_ch_2g = req->social_chan_2g;
+	psoc_nan_obj->nan_social_ch_5g = req->social_chan_5g;
 
 	tx_ops = &psoc_nan_obj->tx_ops;
 	if (!tx_ops->nan_discovery_req_tx) {
@@ -1261,10 +1272,42 @@ wlan_nan_get_connection_info(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	conn_info->mhz = wlan_chan_to_freq(psoc_nan_obj->nan_social_channel);
+	/* For policy_mgr use NAN mandatory Social ch 6 */
+	conn_info->mhz = wlan_chan_to_freq(psoc_nan_obj->nan_social_ch_2g);
 	conn_info->mac_id = psoc_nan_obj->nan_disc_mac_id;
 	conn_info->chan_width = CH_WIDTH_20MHZ;
 	conn_info->type = WMI_VDEV_TYPE_NAN;
 
 	return QDF_STATUS_SUCCESS;
 }
+
+uint8_t wlan_nan_get_disc_5g_ch(struct wlan_objmgr_psoc *psoc)
+{
+	struct nan_psoc_priv_obj *psoc_nan_obj;
+
+	psoc_nan_obj = nan_get_psoc_priv_obj(psoc);
+	if (!psoc_nan_obj) {
+		nan_err("psoc_nan_obj is null");
+		return 0;
+	}
+
+	if (nan_get_discovery_state(psoc) != NAN_DISC_ENABLED)
+		return 0;
+
+	return psoc_nan_obj->nan_social_ch_5g;
+}
+
+bool wlan_nan_get_sap_conc_support(struct wlan_objmgr_psoc *psoc)
+{
+	struct nan_psoc_priv_obj *psoc_nan_obj;
+
+	psoc_nan_obj = nan_get_psoc_priv_obj(psoc);
+	if (!psoc_nan_obj) {
+		nan_err("psoc_nan_obj is null");
+		return 0;
+	}
+
+	return (psoc_nan_obj->nan_caps.nan_sap_supported &&
+		psoc_nan_obj->nan_caps.nan_dbs_supported &&
+		psoc_nan_obj->nan_caps.nan_disable_supported);
+}

+ 4 - 2
components/nan/core/src/nan_main_i.h

@@ -96,7 +96,8 @@ struct nan_cfg_params {
  * @tx_ops: Tx ops registered with Target IF interface
  * @rx_ops: Rx  ops registered with Target IF interface
  * @disc_state: Present NAN Discovery state
- * @nan_social_channel: NAN Social channel for discovery
+ * @nan_social_ch_2g: NAN 2G Social channel for discovery
+ * @nan_social_ch_5g: NAN 5G Social channel for discovery
  * @nan_disc_mac_id: MAC id used for NAN Discovery
  * @is_explicit_disable: Flag to indicate that NAN is being explicitly
  * disabled by driver
@@ -110,7 +111,8 @@ struct nan_psoc_priv_obj {
 	struct wlan_nan_tx_ops tx_ops;
 	struct wlan_nan_rx_ops rx_ops;
 	enum nan_disc_state disc_state;
-	uint8_t nan_social_channel;
+	uint8_t nan_social_ch_2g;
+	uint8_t nan_social_ch_5g;
 	uint8_t nan_disc_mac_id;
 	bool is_explicit_disable;
 	void *disable_context;

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

@@ -246,6 +246,16 @@ bool ucfg_is_nan_dbs_supported(struct wlan_objmgr_psoc *psoc);
  */
 bool ucfg_is_ndi_dbs_supported(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * ucfg_is_nan_dbs_supported() - ucfg API to query NAN SAP support
+ * @psoc: pointer to psoc object
+ *
+ * This function returns NAN SAP support status
+ *
+ * Return: True if NAN SAP is supported, False otherwise
+ */
+bool ucfg_is_nan_sap_supported(struct wlan_objmgr_psoc *psoc);
+
 /**
  * ucfg_is_nan_enable_allowed() - ucfg API to query if NAN Discovery is
  * allowed