diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index 698a5d332a..110e84f026 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/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 */ /** diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index b94df21a78..d1e02f7a38 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/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); diff --git a/dp/wifi3.0/dp_internal.h b/dp/wifi3.0/dp_internal.h index af45511e17..59affe4487 100644 --- a/dp/wifi3.0/dp_internal.h +++ b/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 diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 8e76b18150..f10bfd2f29 100644 --- a/dp/wifi3.0/dp_main.c +++ b/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 */ /**