From a3249bd41ec9a9790c400aabc720eb19a38741e3 Mon Sep 17 00:00:00 2001 From: Debasis Das Date: Fri, 1 Mar 2019 11:58:22 +0530 Subject: [PATCH] qcacmn: cdp support for 8021pCoS to tid mapping Add members in the ops framework and the respective function definitions for supporting 8021pcos to tid mapping. Change-Id: Iaa15efbda0824cecb1b2db67ea8b6ee585a8d56c --- dp/inc/cdp_txrx_cmn.h | 156 ++++++++++++++++++++++++++++++++++++++++++ dp/inc/cdp_txrx_ops.h | 8 +++ 2 files changed, 164 insertions(+) diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index 552337f2f2fe..c80c9cbf1ab7 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -1963,6 +1963,67 @@ QDF_STATUS cdp_set_pdev_tx_capture(ol_txrx_soc_handle soc, return QDF_STATUS_SUCCESS; } +/** + * cdp_set_pdev_pcp_tid_map() - set pdev pcp-tid-map + * @soc: opaque soc handle + * @pdev: data path pdev handle + * @pcp: pcp value + * @tid: tid value + * + * This API is used to configure the pcp-to-tid mapping for a pdev. + * + * Return: QDF_STATUS_SUCCESS if value set successfully + * QDF_STATUS_E_INVAL false if error + */ +static inline +QDF_STATUS cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev, + uint32_t pcp, uint32_t tid) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + return QDF_STATUS_E_INVAL; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map) + return QDF_STATUS_E_INVAL; + + return soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map(pdev, pcp, tid); +} + +/** + * cdp_set_pdev_pcp_tidmap_prty() - set pdev tidmap priority + * @soc: opaque soc handle + * @pdev: data path pdev handle + * @val: priority value + * + * This API is used to configure the tidmap priority for a pdev. + * The tidmap priority decides which mapping, namely DSCP-TID, SVLAN_PCP-TID, + * CVLAN_PCP-TID will be used. + * + * Return: QDF_STATUS_SUCCESS if value set successfully + * QDF_STATUS_E_INVAL false if error + */ +static inline +QDF_STATUS cdp_set_pdev_tidmap_prty(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev_handle, + uint32_t val) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + return QDF_STATUS_E_INVAL; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->set_pdev_tidmap_prty) + return QDF_STATUS_E_INVAL; + + return soc->ops->cmn_drv_ops->set_pdev_tidmap_prty(pdev_handle, val); +} + /** * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id * @soc: opaque soc handle @@ -2378,4 +2439,99 @@ cdp_flush_rate_stats_request(struct cdp_soc_t *soc, struct cdp_pdev *pdev) soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request(soc, pdev); } + +/** + * cdp_set_vdev_pcp_tid_map() - set vdev pcp-tid-map + * @soc: opaque soc handle + * @vdev: data path vdev handle + * @pcp: pcp value + * @tid: tid value + * + * This API is used to configure the pcp-to-tid mapping for a pdev. + * + * Return: QDF_STATUS_SUCCESS if value set successfully + * QDF_STATUS_E_INVAL false if error + */ +static inline +QDF_STATUS cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc, + struct cdp_vdev *vdev_handle, + uint8_t pcp, uint8_t tid) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + return QDF_STATUS_E_INVAL; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map) + return QDF_STATUS_E_INVAL; + + return soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map(vdev_handle, + pcp, tid); +} + +/** + * cdp_set_vdev_tidmap_tbl_id() - set vdev tidmap table id + * + * @soc: opaque soc handle + * @vdev: data path vdev handle + * @mapid: value of mapid + * + * This API is used to configure the table-id of the tid-mapping for a vdev. + * Table '0' is for using the pdev's pcp-tid mapping and '1' is for using + * the vdev's pcp-tid mapping. + * + * Return: QDF_STATUS_SUCCESS if value set successfully + * QDF_STATUS_E_INVAL false if error + */ +static inline +QDF_STATUS cdp_set_vdev_tidmap_tbl_id(ol_txrx_soc_handle soc, + struct cdp_vdev *vdev_handle, + uint8_t mapid) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + return QDF_STATUS_E_INVAL; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->set_vdev_tidmap_tbl_id) + return QDF_STATUS_E_INVAL; + + return soc->ops->cmn_drv_ops->set_vdev_tidmap_tbl_id(vdev_handle, + mapid); +} + +/** + * cdp_set_vdev_tidmap_prty() - set vdev tidmap priority + * @soc: opaque soc handle + * @vdev: data path vdev handle + * @prio: tidmap priority value + * + * This API is used to configure the tidmap priority for a vdev. + * The tidmap priority decides which mapping, namely DSCP-TID, SVLAN_PCP-TID, + * CVLAN_PCP-TID will be used. + * The vdev tidmap priority will be used only when the tidmap_tbl_id is '1'. + * + * Return: QDF_STATUS_SUCCESS if value set successfully + * QDF_STATUS_E_INVAL false if error + */ +static inline +QDF_STATUS cdp_set_vdev_tidmap_prty(ol_txrx_soc_handle soc, + struct cdp_vdev *vdev_handle, uint8_t prio) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + return QDF_STATUS_E_INVAL; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->set_vdev_tidmap_prty) + return QDF_STATUS_E_INVAL; + + return soc->ops->cmn_drv_ops->set_vdev_tidmap_prty(vdev_handle, prio); +} #endif /* _CDP_TXRX_CMN_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index d3dbf879b7cd..da62a3c49de9 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -447,6 +447,14 @@ struct cdp_cmn_ops { void *buf); void (*txrx_flush_rate_stats_request)(struct cdp_soc_t *soc, struct cdp_pdev *pdev); + QDF_STATUS (*set_pdev_pcp_tid_map)(struct cdp_pdev *pdev, + uint8_t pcp, uint8_t tid); + QDF_STATUS (*set_pdev_tidmap_prty)(struct cdp_pdev *pdev, uint8_t prty); + QDF_STATUS (*set_vdev_pcp_tid_map)(struct cdp_vdev *vdev, + uint8_t pcp, uint8_t tid); + QDF_STATUS (*set_vdev_tidmap_prty)(struct cdp_vdev *vdev, uint8_t prty); + QDF_STATUS (*set_vdev_tidmap_tbl_id)(struct cdp_vdev *vdev, + uint8_t mapid); }; struct cdp_ctrl_ops {