Sfoglia il codice sorgente

qcacld-3.0: Define WMA callback to update NDI conn info

Unlike other connection types, vdev start parameters for NDI
do not reflect the correct connection information for the
datapath. Once an NDP is established on NDI this info in WMA
needs to be updated accordingly. Define a WMA callback and
use it after NDP confirm and NDP End to update the connection
info for NDI.

Use WMA callback for updating NDI connection info.

Change-Id: Iefb515a751bd3fb5e10610d191bdadaf3a01f59a
CRs-Fixed: 2407153
Nachiket Kukade 6 anni fa
parent
commit
15bd4f725e

+ 4 - 0
components/nan/core/inc/nan_public_structs.h

@@ -709,6 +709,7 @@ struct nan_datapath_sch_update_event {
  * @peer_departed_ind: HDD callback for handling departing of NDP peer
  * @ndp_delete_peers: LIM callback for deleting NDP peer
  * @delete_peers_by_addr: LIM callback for deleting peer by MAC address
+ * @update_ndi_conn: WMA callback to update NDI's connection info
  */
 struct nan_callbacks {
 	/* callback to os_if layer from umac */
@@ -730,6 +731,9 @@ struct nan_callbacks {
 				  bool);
 	void (*ndp_delete_peers)(struct peer_nan_datapath_map*, uint8_t);
 	void (*delete_peers_by_addr)(uint8_t, struct qdf_mac_addr);
+	QDF_STATUS (*update_ndi_conn)(uint8_t vdev_id,
+				      struct nan_datapath_channel_info
+								    *chan_info);
 };
 
 /**

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

@@ -417,7 +417,8 @@ ndi_remove_and_update_primary_connection(struct wlan_objmgr_psoc *psoc,
 	}
 
 	if (peer_nan_obj && psoc_nan_obj->nan_caps.ndi_dbs_supported) {
-		/* TODO: Update NDI's primary chan info to WMA */
+		psoc_nan_obj->cb_obj.update_ndi_conn(wlan_vdev_get_id(vdev),
+						 &peer_nan_obj->home_chan_info);
 		/* TODO: Update policy mgr with connection info */
 		qdf_mem_copy(vdev_nan_obj->primary_peer_mac.bytes,
 			     wlan_peer_get_macaddr(peer), QDF_MAC_ADDR_SIZE);
@@ -434,11 +435,18 @@ ndi_update_ndp_session(struct wlan_objmgr_vdev *vdev,
 {
 	struct wlan_objmgr_psoc *psoc;
 	struct wlan_objmgr_peer *peer;
+	struct nan_psoc_priv_obj *psoc_nan_obj;
 	struct nan_vdev_priv_obj *vdev_nan_obj;
 	struct nan_peer_priv_obj *peer_nan_obj;
 
 	psoc = wlan_vdev_get_psoc(vdev);
 
+	psoc_nan_obj = nan_get_psoc_priv_obj(psoc);
+	if (!psoc_nan_obj) {
+		nan_err("psoc_nan_obj is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
 	vdev_nan_obj = nan_get_vdev_priv_obj(vdev);
 	if (!vdev_nan_obj) {
 		nan_err("NAN vdev private object is NULL");
@@ -464,7 +472,8 @@ ndi_update_ndp_session(struct wlan_objmgr_vdev *vdev,
 	qdf_spin_lock_bh(&peer_nan_obj->lock);
 	qdf_mem_copy(&peer_nan_obj->home_chan_info, ndp_chan_info,
 		     sizeof(*ndp_chan_info));
-	/* TODO: Update NDI's primary chan info to WMA */
+	psoc_nan_obj->cb_obj.update_ndi_conn(wlan_vdev_get_id(vdev),
+					     &peer_nan_obj->home_chan_info);
 	qdf_spin_unlock_bh(&peer_nan_obj->lock);
 	wlan_objmgr_peer_release_ref(peer, WLAN_NAN_ID);
 
@@ -533,7 +542,7 @@ static QDF_STATUS nan_handle_confirm(
 		qdf_mem_copy(vdev_nan_obj->primary_peer_mac.bytes,
 			     &confirm->peer_ndi_mac_addr, QDF_MAC_ADDR_SIZE);
 
-		/* TODO: Update primary connection info in the WMA interfaces */
+		psoc_nan_obj->cb_obj.update_ndi_conn(vdev_id, &confirm->ch[0]);
 
 		if (psoc_nan_obj->nan_caps.ndi_dbs_supported) {
 			/*

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

@@ -265,6 +265,15 @@ void ucfg_nan_set_tgt_caps(struct wlan_objmgr_psoc *psoc,
  */
 void ucfg_nan_disable_concurrency(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * ucfg_nan_register_wma_callbacks: ucfg API to register WMA callbacks
+ * @psoc: pointer to psoc object
+ * @cb_obj: Pointer to NAN callback structure
+ *
+ * Return: status of operation
+ */
+int ucfg_nan_register_wma_callbacks(struct wlan_objmgr_psoc *psoc,
+				    struct nan_callbacks *cb_obj);
 #else /* WLAN_FEATURE_NAN */
 
 static inline

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

@@ -409,6 +409,21 @@ int ucfg_nan_register_lim_callbacks(struct wlan_objmgr_psoc *psoc,
 	return 0;
 }
 
+int ucfg_nan_register_wma_callbacks(struct wlan_objmgr_psoc *psoc,
+				    struct nan_callbacks *cb_obj)
+{
+	struct nan_psoc_priv_obj *psoc_obj = nan_get_psoc_priv_obj(psoc);
+
+	if (!psoc_obj) {
+		nan_err("nan psoc priv object is NULL");
+		return -EINVAL;
+	}
+
+	psoc_obj->cb_obj.update_ndi_conn = cb_obj->update_ndi_conn;
+
+	return 0;
+}
+
 void ucfg_nan_set_tgt_caps(struct wlan_objmgr_psoc *psoc,
 			   struct nan_tgt_caps *nan_caps)
 {

+ 2 - 0
core/wma/inc/wma_api.h

@@ -158,6 +158,8 @@ uint8_t *wma_get_vdev_address_by_vdev_id(uint8_t vdev_id);
 struct wma_txrx_node *wma_get_interface_by_vdev_id(uint8_t vdev_id);
 QDF_STATUS wma_get_connection_info(uint8_t vdev_id,
 		struct policy_mgr_vdev_entry_info *conn_table_entry);
+QDF_STATUS wma_ndi_update_connection_info(uint8_t vdev_id,
+		struct nan_datapath_channel_info *ndp_chan_info);
 
 bool wma_is_vdev_up(uint8_t vdev_id);
 

+ 18 - 0
core/wma/src/wma_main.c

@@ -95,6 +95,7 @@
 #include "wlan_mlme_ucfg_api.h"
 #include "cfg_ucfg_api.h"
 #include "init_cmd_api.h"
+#include "nan_ucfg_api.h"
 
 #define WMA_LOG_COMPLETION_TIMER 3000 /* 3 seconds */
 #define WMI_TLV_HEADROOM 128
@@ -3150,6 +3151,22 @@ void wma_get_phy_mode_cb(uint8_t chan, uint32_t chan_width, uint32_t *phy_mode)
 	*phy_mode = wma_chan_phy_mode(chan, chan_width, dot11_mode);
 }
 
+#ifdef WLAN_FEATURE_NAN
+static void
+wma_register_nan_callbacks(tp_wma_handle wma_handle)
+{
+	struct nan_callbacks cb_obj = {0};
+
+	cb_obj.update_ndi_conn = wma_ndi_update_connection_info;
+
+	ucfg_nan_register_wma_callbacks(wma_handle->psoc, &cb_obj);
+}
+#else
+static void wma_register_nan_callbacks(tp_wma_handle wma_handle)
+{
+}
+#endif
+
 /**
  * wma_open() - Allocate wma context and initialize it.
  * @cds_context:  cds context
@@ -3667,6 +3684,7 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
 	pmo_register_get_beacon_interval_callback(wma_handle->psoc,
 						  wma_vdev_get_beacon_interval);
 	wma_cbacks.wma_get_connection_info = wma_get_connection_info;
+	wma_register_nan_callbacks(wma_handle);
 	qdf_status = policy_mgr_register_wma_cb(wma_handle->psoc, &wma_cbacks);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 		WMA_LOGE("Failed to register wma cb with Policy Manager");

+ 29 - 0
core/wma/src/wma_utils.c

@@ -4016,6 +4016,35 @@ QDF_STATUS wma_get_connection_info(uint8_t vdev_id,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS wma_ndi_update_connection_info(uint8_t vdev_id,
+				struct nan_datapath_channel_info *ndp_chan_info)
+{
+	struct wma_txrx_node *wma_iface_entry;
+
+	wma_iface_entry = wma_get_interface_by_vdev_id(vdev_id);
+	if (NULL == wma_iface_entry) {
+		WMA_LOGE("%s: can't find vdev_id %d in WMA table", __func__, vdev_id);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (WMI_VDEV_TYPE_NDI != wma_iface_entry->type) {
+		WMA_LOGE("%s: Given vdev id(%d) not of type NDI!",
+			 __func__, vdev_id);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (!ndp_chan_info) {
+		WMA_LOGE("%s: Provided chan info is NULL!", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	wma_iface_entry->chan_width = ndp_chan_info->ch_width;
+	wma_iface_entry->mhz = ndp_chan_info->channel;
+	wma_iface_entry->nss = ndp_chan_info->nss;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * wma_get_interface_by_vdev_id() - lookup interface entry using vdev ID
  * @vdev_id: vdev id