[01/12] common/cnxk: use computed value for wqe skip
Checks
Commit Message
Use computed value for WQE skip instead of a hardcoded value.
WQE skip needs to be number of 128B lines to accommodate rte_mbuf.
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
Depends-on: series=23500 ("common/cnxk: add cnf10kb support")
drivers/common/cnxk/roc_nix_inl.h | 2 +-
drivers/common/cnxk/roc_nix_inl_priv.h | 2 +-
drivers/event/cnxk/cnxk_eventdev_adptr.c | 5 ++++-
drivers/net/cnxk/cnxk_ethdev_sec.c | 5 ++++-
4 files changed, 10 insertions(+), 4 deletions(-)
Comments
On Thu, Jun 16, 2022 at 12:39 PM Nithin Dabilpuram
<ndabilpuram@marvell.com> wrote:
>
> Use computed value for WQE skip instead of a hardcoded value.
> WQE skip needs to be number of 128B lines to accommodate rte_mbuf.
Change wqe -> WQE in subject
>
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> ---
> Depends-on: series=23500 ("common/cnxk: add cnf10kb support")
>
> drivers/common/cnxk/roc_nix_inl.h | 2 +-
> drivers/common/cnxk/roc_nix_inl_priv.h | 2 +-
> drivers/event/cnxk/cnxk_eventdev_adptr.c | 5 ++++-
> drivers/net/cnxk/cnxk_ethdev_sec.c | 5 ++++-
> 4 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/common/cnxk/roc_nix_inl.h b/drivers/common/cnxk/roc_nix_inl.h
> index b1b4c5b..c7b1817 100644
> --- a/drivers/common/cnxk/roc_nix_inl.h
> +++ b/drivers/common/cnxk/roc_nix_inl.h
> @@ -131,7 +131,7 @@ struct roc_nix_inl_dev {
> uint16_t channel;
> uint16_t chan_mask;
> bool attach_cptlf;
> - bool wqe_skip;
> + uint16_t wqe_skip;
> uint8_t spb_drop_pc;
> uint8_t lpb_drop_pc;
> bool set_soft_exp_poll;
> diff --git a/drivers/common/cnxk/roc_nix_inl_priv.h b/drivers/common/cnxk/roc_nix_inl_priv.h
> index d61c7b2..a775efc 100644
> --- a/drivers/common/cnxk/roc_nix_inl_priv.h
> +++ b/drivers/common/cnxk/roc_nix_inl_priv.h
> @@ -84,7 +84,7 @@ struct nix_inl_dev {
> uint32_t ipsec_in_max_spi;
> uint32_t inb_spi_mask;
> bool attach_cptlf;
> - bool wqe_skip;
> + uint16_t wqe_skip;
> bool ts_ena;
> };
>
> diff --git a/drivers/event/cnxk/cnxk_eventdev_adptr.c b/drivers/event/cnxk/cnxk_eventdev_adptr.c
> index fa96090..cf5b1dd 100644
> --- a/drivers/event/cnxk/cnxk_eventdev_adptr.c
> +++ b/drivers/event/cnxk/cnxk_eventdev_adptr.c
> @@ -125,6 +125,7 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
> {
> struct roc_nix *nix = &cnxk_eth_dev->nix;
> struct roc_nix_rq *rq;
> + uint16_t wqe_skip;
> int rc;
>
> rq = &cnxk_eth_dev->rqs[rq_id];
> @@ -132,7 +133,9 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
> rq->tt = ev->sched_type;
> rq->hwgrp = ev->queue_id;
> rq->flow_tag_width = 20;
> - rq->wqe_skip = 1;
> + wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
> + wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
> + rq->wqe_skip = wqe_skip;
> rq->tag_mask = (port_id & 0xF) << 20;
> rq->tag_mask |= (((port_id >> 4) & 0xF) | (RTE_EVENT_TYPE_ETHDEV << 4))
> << 24;
> diff --git a/drivers/net/cnxk/cnxk_ethdev_sec.c b/drivers/net/cnxk/cnxk_ethdev_sec.c
> index d01ebb4..1de3454 100644
> --- a/drivers/net/cnxk/cnxk_ethdev_sec.c
> +++ b/drivers/net/cnxk/cnxk_ethdev_sec.c
> @@ -264,6 +264,7 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
> char name[CNXK_NIX_INL_DEV_NAME_LEN];
> struct roc_nix_inl_dev *inl_dev;
> const struct rte_memzone *mz;
> + uint16_t wqe_skip;
> int rc = -ENOMEM;
>
> RTE_SET_USED(pci_drv);
> @@ -295,7 +296,9 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
>
> inl_dev->attach_cptlf = true;
> /* WQE skip is one for DPDK */
> - inl_dev->wqe_skip = true;
> + wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
> + wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
> + inl_dev->wqe_skip = wqe_skip;
> inl_dev->set_soft_exp_poll = true;
> rc = roc_nix_inl_dev_init(inl_dev);
> if (rc) {
> --
> 2.8.4
>
@@ -131,7 +131,7 @@ struct roc_nix_inl_dev {
uint16_t channel;
uint16_t chan_mask;
bool attach_cptlf;
- bool wqe_skip;
+ uint16_t wqe_skip;
uint8_t spb_drop_pc;
uint8_t lpb_drop_pc;
bool set_soft_exp_poll;
@@ -84,7 +84,7 @@ struct nix_inl_dev {
uint32_t ipsec_in_max_spi;
uint32_t inb_spi_mask;
bool attach_cptlf;
- bool wqe_skip;
+ uint16_t wqe_skip;
bool ts_ena;
};
@@ -125,6 +125,7 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
{
struct roc_nix *nix = &cnxk_eth_dev->nix;
struct roc_nix_rq *rq;
+ uint16_t wqe_skip;
int rc;
rq = &cnxk_eth_dev->rqs[rq_id];
@@ -132,7 +133,9 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
rq->tt = ev->sched_type;
rq->hwgrp = ev->queue_id;
rq->flow_tag_width = 20;
- rq->wqe_skip = 1;
+ wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+ wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+ rq->wqe_skip = wqe_skip;
rq->tag_mask = (port_id & 0xF) << 20;
rq->tag_mask |= (((port_id >> 4) & 0xF) | (RTE_EVENT_TYPE_ETHDEV << 4))
<< 24;
@@ -264,6 +264,7 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
char name[CNXK_NIX_INL_DEV_NAME_LEN];
struct roc_nix_inl_dev *inl_dev;
const struct rte_memzone *mz;
+ uint16_t wqe_skip;
int rc = -ENOMEM;
RTE_SET_USED(pci_drv);
@@ -295,7 +296,9 @@ cnxk_nix_inl_dev_probe(struct rte_pci_driver *pci_drv,
inl_dev->attach_cptlf = true;
/* WQE skip is one for DPDK */
- inl_dev->wqe_skip = true;
+ wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ);
+ wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ;
+ inl_dev->wqe_skip = wqe_skip;
inl_dev->set_soft_exp_poll = true;
rc = roc_nix_inl_dev_init(inl_dev);
if (rc) {