Bläddra i källkod

qcacmn: Add API to get osif handle for wds ext peer

Add API to get osif handle for wds ext peer

Change-Id: I1294acee12c9f4d12f8b8728f8d89e61fec81d9f
CRs-Fixed: 3430300
Himanshu Batra 2 år sedan
förälder
incheckning
fe8e699301
4 ändrade filer med 74 tillägg och 0 borttagningar
  1. 21 0
      dp/inc/cdp_txrx_cmn.h
  2. 5 0
      dp/inc/cdp_txrx_ops.h
  3. 17 0
      dp/wifi3.0/dp_internal.h
  4. 31 0
      dp/wifi3.0/dp_main.c

+ 21 - 0
dp/inc/cdp_txrx_cmn.h

@@ -2911,6 +2911,27 @@ cdp_wds_ext_set_peer_rx(ol_txrx_soc_handle soc, uint8_t vdev_id,
 	return soc->ops->cmn_drv_ops->set_wds_ext_peer_rx
 			(soc, vdev_id, mac, rx, osif_peer);
 }
+
+static inline QDF_STATUS
+cdp_wds_ext_get_peer_osif_handle(
+			ol_txrx_soc_handle soc, uint8_t vdev_id,
+			uint8_t *mac,
+			ol_osif_peer_handle *osif_peer)
+{
+	if (!soc || !soc->ops) {
+		dp_cdp_debug("Invalid Instance");
+		QDF_BUG(0);
+		return QDF_STATUS_E_FAULT;
+	}
+
+	if (!soc->ops->cmn_drv_ops ||
+	    !soc->ops->cmn_drv_ops->get_wds_ext_peer_osif_handle)
+		return QDF_STATUS_E_FAULT;
+
+	return soc->ops->cmn_drv_ops->get_wds_ext_peer_osif_handle
+			(soc, vdev_id, mac, osif_peer);
+}
+
 #endif /* QCA_SUPPORT_WDS_EXTENDED */
 
 /**

+ 5 - 0
dp/inc/cdp_txrx_ops.h

@@ -678,6 +678,11 @@ struct cdp_cmn_ops {
 					  uint8_t *mac,
 					  ol_txrx_rx_fp rx,
 					  ol_osif_peer_handle osif_peer);
+	QDF_STATUS (*get_wds_ext_peer_osif_handle)
+					(ol_txrx_soc_handle soc,
+					 uint8_t vdev_id,
+					 uint8_t *mac,
+					 ol_osif_peer_handle *osif_peer);
 #endif /* QCA_SUPPORT_WDS_EXTENDED */
 	void (*txrx_drain)(ol_txrx_soc_handle soc);
 	int (*get_free_desc_poolsize)(struct cdp_soc_t *soc);

+ 17 - 0
dp/wifi3.0/dp_internal.h

@@ -4228,6 +4228,23 @@ QDF_STATUS dp_wds_ext_set_peer_rx(ol_txrx_soc_handle soc,
 				  uint8_t *mac,
 				  ol_txrx_rx_fp rx,
 				  ol_osif_peer_handle osif_peer);
+
+/**
+ * dp_wds_ext_get_peer_osif_handle(): function to get peer osif handle
+ * @soc: Datapath soc handle
+ * @vdev_id: vdev id
+ * @mac: Peer mac address
+ * @osif_peer: OSIF peer handle
+ *
+ * Return: QDF_STATUS_SUCCESS on success
+ *         QDF_STATUS_E_INVAL if peer is not found
+ */
+QDF_STATUS dp_wds_ext_get_peer_osif_handle(
+				ol_txrx_soc_handle soc,
+				uint8_t vdev_id,
+				uint8_t *mac,
+				ol_osif_peer_handle *osif_peer);
+
 #endif /* QCA_SUPPORT_WDS_EXTENDED */
 
 #ifdef DP_MEM_PRE_ALLOC

+ 31 - 0
dp/wifi3.0/dp_main.c

@@ -14241,6 +14241,7 @@ static struct cdp_cmn_ops dp_ops_cmn = {
 	.get_peer_id = dp_get_peer_id,
 #ifdef QCA_SUPPORT_WDS_EXTENDED
 	.set_wds_ext_peer_rx = dp_wds_ext_set_peer_rx,
+	.get_wds_ext_peer_osif_handle = dp_wds_ext_get_peer_osif_handle,
 #endif /* QCA_SUPPORT_WDS_EXTENDED */
 
 #if defined(FEATURE_RUNTIME_PM) || defined(DP_POWER_SAVE)
@@ -16317,6 +16318,36 @@ QDF_STATUS dp_wds_ext_set_peer_rx(ol_txrx_soc_handle soc,
 
 	return status;
 }
+
+QDF_STATUS dp_wds_ext_get_peer_osif_handle(
+				ol_txrx_soc_handle soc,
+				uint8_t vdev_id,
+				uint8_t *mac,
+				ol_osif_peer_handle *osif_peer)
+{
+	struct dp_soc *dp_soc = (struct dp_soc *)soc;
+	struct dp_txrx_peer *txrx_peer = NULL;
+	struct dp_peer *peer = dp_peer_find_hash_find(dp_soc,
+						      mac, 0, vdev_id,
+						      DP_MOD_ID_CDP);
+
+	if (!peer) {
+		dp_cdp_debug("%pK: Peer is NULL!\n", dp_soc);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	txrx_peer = dp_get_txrx_peer(peer);
+	if (!txrx_peer) {
+		dp_cdp_debug("%pK: TXRX Peer is NULL!\n", dp_soc);
+		dp_peer_unref_delete(peer, DP_MOD_ID_CDP);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*osif_peer = txrx_peer->wds_ext.osif_peer;
+	dp_peer_unref_delete(peer, DP_MOD_ID_CDP);
+
+	return QDF_STATUS_SUCCESS;
+}
 #endif /* QCA_SUPPORT_WDS_EXTENDED */
 
 /**