[1/2] net/cnxk: update meter bpf ID in rq
Checks
Commit Message
Patch updates configured meter bpf is in rq context
during meter creation
Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
---
drivers/net/cnxk/cn10k_rte_flow.c | 9 ++++-----
drivers/net/cnxk/cnxk_ethdev_mtr.c | 25 ++++++++++++++++++-------
2 files changed, 22 insertions(+), 12 deletions(-)
Comments
>-----Original Message-----
>From: Rakesh Kudurumalla <rkudurumalla@marvell.com>
>Sent: Tuesday, November 30, 2021 12:12 PM
>To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar
>Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori
><skori@marvell.com>; Satha Koteswara Rao Kottidi
><skoteshwar@marvell.com>
>Cc: dev@dpdk.org; Rakesh Kudurumalla <rkudurumalla@marvell.com>
>Subject: [PATCH 1/2] net/cnxk: update meter bpf ID in rq
>
>Patch updates configured meter bpf is in rq context during meter creation
>
>Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
>---
> drivers/net/cnxk/cn10k_rte_flow.c | 9 ++++-----
>drivers/net/cnxk/cnxk_ethdev_mtr.c | 25 ++++++++++++++++++-------
> 2 files changed, 22 insertions(+), 12 deletions(-)
>
>diff --git a/drivers/net/cnxk/cn10k_rte_flow.c
>b/drivers/net/cnxk/cn10k_rte_flow.c
>index b830abe63e..402bb1c72f 100644
>--- a/drivers/net/cnxk/cn10k_rte_flow.c
>+++ b/drivers/net/cnxk/cn10k_rte_flow.c
>@@ -36,20 +36,20 @@ cn10k_mtr_configure(struct rte_eth_dev *eth_dev,
> for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
> if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
> mtr_conf = (const struct rte_flow_action_meter
>- *)(actions->conf);
>+ *)(actions[i].conf);
> mtr_id = mtr_conf->mtr_id;
> is_mtr_act = true;
> }
> if (actions[i].type == RTE_FLOW_ACTION_TYPE_QUEUE) {
> q_conf = (const struct rte_flow_action_queue
>- *)(actions->conf);
>+ *)(actions[i].conf);
> if (is_mtr_act)
> nix_mtr_rq_update(eth_dev, mtr_id, 1,
> &q_conf->index);
> }
> if (actions[i].type == RTE_FLOW_ACTION_TYPE_RSS) {
> rss_conf = (const struct rte_flow_action_rss
>- *)(actions->conf);
>+ *)(actions[i].conf);
> if (is_mtr_act)
> nix_mtr_rq_update(eth_dev, mtr_id,
> rss_conf->queue_num,
>@@ -98,7 +98,7 @@ cn10k_rss_action_validate(struct rte_eth_dev *eth_dev,
> return -EINVAL;
> }
>
>- if (eth_dev->data->dev_conf.rxmode.mq_mode !=
>RTE_ETH_MQ_RX_RSS) {
>+ if (eth_dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
> plt_err("multi-queue mode is disabled");
> return -ENOTSUP;
> }
>@@ -171,7 +171,6 @@ cn10k_flow_create(struct rte_eth_dev *eth_dev, const
>struct rte_flow_attr *attr,
> return NULL;
> }
> }
>-
> for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
> if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
> mtr = (const struct rte_flow_action_meter *)actions[i]
>diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c
>b/drivers/net/cnxk/cnxk_ethdev_mtr.c
>index 39d8563826..a36fcb8aaf 100644
>--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
>+++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
>@@ -35,7 +35,6 @@ static struct rte_mtr_capabilities mtr_capa = {
> .chaining_n_mtrs_per_flow_max = NIX_MTR_COUNT_PER_FLOW,
> .chaining_use_prev_mtr_color_supported = true,
> .chaining_use_prev_mtr_color_enforced = true,
>- .meter_rate_max = NIX_BPF_RATE_MAX / 8, /* Bytes per second */
> .color_aware_srtcm_rfc2697_supported = true,
> .color_aware_trtcm_rfc2698_supported = true,
> .color_aware_trtcm_rfc4115_supported = true, @@ -180,20 +179,20
>@@ cnxk_nix_mtr_capabilities_get(struct rte_eth_dev *dev,
> struct rte_mtr_capabilities *capa,
> struct rte_mtr_error *error)
> {
>- struct cnxk_eth_dev *eth_dev = cnxk_eth_pmd_priv(dev);
>- uint16_t count[ROC_NIX_BPF_LEVEL_MAX] = {0};
> uint8_t lvl_mask = ROC_NIX_BPF_LEVEL_F_LEAF |
>ROC_NIX_BPF_LEVEL_F_MID |
> ROC_NIX_BPF_LEVEL_F_TOP;
>+ struct cnxk_eth_dev *eth_dev = cnxk_eth_pmd_priv(dev);
>+ uint16_t count[ROC_NIX_BPF_LEVEL_MAX] = {0};
> struct roc_nix *nix = ð_dev->nix;
>- int rc;
>- int i;
>+ uint32_t time_unit;
>+ int rc, i;
>
> RTE_SET_USED(dev);
>
> if (!capa)
> return -rte_mtr_error_set(error, EINVAL,
>- RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL,
>- "NULL input parameter");
>+
>RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL,
>+ "NULL input parameter");
>
> rc = roc_nix_bpf_count_get(nix, lvl_mask, count);
> if (rc)
>@@ -207,6 +206,15 @@ cnxk_nix_mtr_capabilities_get(struct rte_eth_dev
>*dev,
> mtr_capa.meter_trtcm_rfc4115_n_max = mtr_capa.n_max;
> mtr_capa.meter_policy_n_max = mtr_capa.n_max;
>
>+ rc = roc_nix_bpf_timeunit_get(nix, &time_unit);
>+ if (rc)
>+ return rc;
>+
>+ mtr_capa.meter_rate_max =
>+ NIX_BPF_RATE(time_unit, NIX_BPF_MAX_RATE_EXPONENT,
>+ NIX_BPF_MAX_RATE_MANTISSA, 0) /
>+ 8;
>+
> *capa = mtr_capa;
> return 0;
> }
>@@ -304,6 +312,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev
>*dev,
> if (action->type ==
>RTE_FLOW_ACTION_TYPE_DROP)
> supported[i] = true;
>
>+ if (action->type ==
>RTE_FLOW_ACTION_TYPE_VOID)
>+ supported[i] = true;
>+
> if (!supported[i]) {
> sprintf(message,
> "%s action is not valid",
>--
>2.25.1
Acked-by: Sunil Kumar Kori <skori@mavell.com>
On Tue, Nov 30, 2021 at 12:47 PM Sunil Kumar Kori <skori@marvell.com> wrote:
>
> >-----Original Message-----
> >From: Rakesh Kudurumalla <rkudurumalla@marvell.com>
> >Sent: Tuesday, November 30, 2021 12:12 PM
> >To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar
> >Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori
> ><skori@marvell.com>; Satha Koteswara Rao Kottidi
> ><skoteshwar@marvell.com>
> >Cc: dev@dpdk.org; Rakesh Kudurumalla <rkudurumalla@marvell.com>
> >Subject: [PATCH 1/2] net/cnxk: update meter bpf ID in rq
> >
> >Patch updates configured meter bpf is in rq context during meter creation
> >
> >Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Series applied to dpdk-next-net-mrvl/for-next-net. Thanks.
> >---
> > drivers/net/cnxk/cn10k_rte_flow.c | 9 ++++-----
> >drivers/net/cnxk/cnxk_ethdev_mtr.c | 25 ++++++++++++++++++-------
> > 2 files changed, 22 insertions(+), 12 deletions(-)
> >
> >diff --git a/drivers/net/cnxk/cn10k_rte_flow.c
> >b/drivers/net/cnxk/cn10k_rte_flow.c
> >index b830abe63e..402bb1c72f 100644
> >--- a/drivers/net/cnxk/cn10k_rte_flow.c
> >+++ b/drivers/net/cnxk/cn10k_rte_flow.c
> >@@ -36,20 +36,20 @@ cn10k_mtr_configure(struct rte_eth_dev *eth_dev,
> > for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
> > if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
> > mtr_conf = (const struct rte_flow_action_meter
> >- *)(actions->conf);
> >+ *)(actions[i].conf);
> > mtr_id = mtr_conf->mtr_id;
> > is_mtr_act = true;
> > }
> > if (actions[i].type == RTE_FLOW_ACTION_TYPE_QUEUE) {
> > q_conf = (const struct rte_flow_action_queue
> >- *)(actions->conf);
> >+ *)(actions[i].conf);
> > if (is_mtr_act)
> > nix_mtr_rq_update(eth_dev, mtr_id, 1,
> > &q_conf->index);
> > }
> > if (actions[i].type == RTE_FLOW_ACTION_TYPE_RSS) {
> > rss_conf = (const struct rte_flow_action_rss
> >- *)(actions->conf);
> >+ *)(actions[i].conf);
> > if (is_mtr_act)
> > nix_mtr_rq_update(eth_dev, mtr_id,
> > rss_conf->queue_num,
> >@@ -98,7 +98,7 @@ cn10k_rss_action_validate(struct rte_eth_dev *eth_dev,
> > return -EINVAL;
> > }
> >
> >- if (eth_dev->data->dev_conf.rxmode.mq_mode !=
> >RTE_ETH_MQ_RX_RSS) {
> >+ if (eth_dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
> > plt_err("multi-queue mode is disabled");
> > return -ENOTSUP;
> > }
> >@@ -171,7 +171,6 @@ cn10k_flow_create(struct rte_eth_dev *eth_dev, const
> >struct rte_flow_attr *attr,
> > return NULL;
> > }
> > }
> >-
> > for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
> > if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
> > mtr = (const struct rte_flow_action_meter *)actions[i]
> >diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c
> >b/drivers/net/cnxk/cnxk_ethdev_mtr.c
> >index 39d8563826..a36fcb8aaf 100644
> >--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
> >+++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
> >@@ -35,7 +35,6 @@ static struct rte_mtr_capabilities mtr_capa = {
> > .chaining_n_mtrs_per_flow_max = NIX_MTR_COUNT_PER_FLOW,
> > .chaining_use_prev_mtr_color_supported = true,
> > .chaining_use_prev_mtr_color_enforced = true,
> >- .meter_rate_max = NIX_BPF_RATE_MAX / 8, /* Bytes per second */
> > .color_aware_srtcm_rfc2697_supported = true,
> > .color_aware_trtcm_rfc2698_supported = true,
> > .color_aware_trtcm_rfc4115_supported = true, @@ -180,20 +179,20
> >@@ cnxk_nix_mtr_capabilities_get(struct rte_eth_dev *dev,
> > struct rte_mtr_capabilities *capa,
> > struct rte_mtr_error *error)
> > {
> >- struct cnxk_eth_dev *eth_dev = cnxk_eth_pmd_priv(dev);
> >- uint16_t count[ROC_NIX_BPF_LEVEL_MAX] = {0};
> > uint8_t lvl_mask = ROC_NIX_BPF_LEVEL_F_LEAF |
> >ROC_NIX_BPF_LEVEL_F_MID |
> > ROC_NIX_BPF_LEVEL_F_TOP;
> >+ struct cnxk_eth_dev *eth_dev = cnxk_eth_pmd_priv(dev);
> >+ uint16_t count[ROC_NIX_BPF_LEVEL_MAX] = {0};
> > struct roc_nix *nix = ð_dev->nix;
> >- int rc;
> >- int i;
> >+ uint32_t time_unit;
> >+ int rc, i;
> >
> > RTE_SET_USED(dev);
> >
> > if (!capa)
> > return -rte_mtr_error_set(error, EINVAL,
> >- RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL,
> >- "NULL input parameter");
> >+
> >RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL,
> >+ "NULL input parameter");
> >
> > rc = roc_nix_bpf_count_get(nix, lvl_mask, count);
> > if (rc)
> >@@ -207,6 +206,15 @@ cnxk_nix_mtr_capabilities_get(struct rte_eth_dev
> >*dev,
> > mtr_capa.meter_trtcm_rfc4115_n_max = mtr_capa.n_max;
> > mtr_capa.meter_policy_n_max = mtr_capa.n_max;
> >
> >+ rc = roc_nix_bpf_timeunit_get(nix, &time_unit);
> >+ if (rc)
> >+ return rc;
> >+
> >+ mtr_capa.meter_rate_max =
> >+ NIX_BPF_RATE(time_unit, NIX_BPF_MAX_RATE_EXPONENT,
> >+ NIX_BPF_MAX_RATE_MANTISSA, 0) /
> >+ 8;
> >+
> > *capa = mtr_capa;
> > return 0;
> > }
> >@@ -304,6 +312,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev
> >*dev,
> > if (action->type ==
> >RTE_FLOW_ACTION_TYPE_DROP)
> > supported[i] = true;
> >
> >+ if (action->type ==
> >RTE_FLOW_ACTION_TYPE_VOID)
> >+ supported[i] = true;
> >+
> > if (!supported[i]) {
> > sprintf(message,
> > "%s action is not valid",
> >--
> >2.25.1
>
> Acked-by: Sunil Kumar Kori <skori@mavell.com>
On 11/30/2021 6:41 AM, Rakesh Kudurumalla wrote:
> Patch updates configured meter bpf is in rq context
> during meter creation
RQ is receive queue, right? Can you please use the long version for clarification?
>
> Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
> ---
> drivers/net/cnxk/cn10k_rte_flow.c | 9 ++++-----
> drivers/net/cnxk/cnxk_ethdev_mtr.c | 25 ++++++++++++++++++-------
> 2 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/cnxk/cn10k_rte_flow.c b/drivers/net/cnxk/cn10k_rte_flow.c
> index b830abe63e..402bb1c72f 100644
> --- a/drivers/net/cnxk/cn10k_rte_flow.c
> +++ b/drivers/net/cnxk/cn10k_rte_flow.c
> @@ -36,20 +36,20 @@ cn10k_mtr_configure(struct rte_eth_dev *eth_dev,
> for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
> if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
> mtr_conf = (const struct rte_flow_action_meter
> - *)(actions->conf);
> + *)(actions[i].conf);
> mtr_id = mtr_conf->mtr_id;
> is_mtr_act = true;
> }
> if (actions[i].type == RTE_FLOW_ACTION_TYPE_QUEUE) {
> q_conf = (const struct rte_flow_action_queue
> - *)(actions->conf);
> + *)(actions[i].conf);
> if (is_mtr_act)
> nix_mtr_rq_update(eth_dev, mtr_id, 1,
> &q_conf->index);
> }
> if (actions[i].type == RTE_FLOW_ACTION_TYPE_RSS) {
> rss_conf = (const struct rte_flow_action_rss
> - *)(actions->conf);
> + *)(actions[i].conf);
> if (is_mtr_act)
> nix_mtr_rq_update(eth_dev, mtr_id,
> rss_conf->queue_num,
> @@ -98,7 +98,7 @@ cn10k_rss_action_validate(struct rte_eth_dev *eth_dev,
> return -EINVAL;
> }
>
> - if (eth_dev->data->dev_conf.rxmode.mq_mode != RTE_ETH_MQ_RX_RSS) {
> + if (eth_dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
This change seems unintended. Please keep the original value.
<...>
> if (!capa)
> return -rte_mtr_error_set(error, EINVAL,
> - RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL,
> - "NULL input parameter");
> + RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL,
> + "NULL input parameter");
>
Previous indentation looks more consistent with DPDK coding guide.
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, January 11, 2022 6:16 PM
> To: Rakesh Kudurumalla <rkudurumalla@marvell.com>; Nithin Kumar
> Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda
> <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha
> Koteswara Rao Kottidi <skoteshwar@marvell.com>
> Cc: dev@dpdk.org
> Subject: [EXT] Re: [PATCH 1/2] net/cnxk: update meter bpf ID in rq
>
> External Email
>
> ----------------------------------------------------------------------
> On 11/30/2021 6:41 AM, Rakesh Kudurumalla wrote:
> > Patch updates configured meter bpf is in rq context during meter
> > creation
>
> RQ is receive queue, right? Can you please use the long version for
> clarification?
Yes RQ is receive queue. Sure will use long version
>
> >
> > Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
> > ---
> > drivers/net/cnxk/cn10k_rte_flow.c | 9 ++++-----
> > drivers/net/cnxk/cnxk_ethdev_mtr.c | 25 ++++++++++++++++++-------
> > 2 files changed, 22 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/net/cnxk/cn10k_rte_flow.c
> > b/drivers/net/cnxk/cn10k_rte_flow.c
> > index b830abe63e..402bb1c72f 100644
> > --- a/drivers/net/cnxk/cn10k_rte_flow.c
> > +++ b/drivers/net/cnxk/cn10k_rte_flow.c
> > @@ -36,20 +36,20 @@ cn10k_mtr_configure(struct rte_eth_dev *eth_dev,
> > for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
> > if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
> > mtr_conf = (const struct rte_flow_action_meter
> > - *)(actions->conf);
> > + *)(actions[i].conf);
> > mtr_id = mtr_conf->mtr_id;
> > is_mtr_act = true;
> > }
> > if (actions[i].type == RTE_FLOW_ACTION_TYPE_QUEUE) {
> > q_conf = (const struct rte_flow_action_queue
> > - *)(actions->conf);
> > + *)(actions[i].conf);
> > if (is_mtr_act)
> > nix_mtr_rq_update(eth_dev, mtr_id, 1,
> > &q_conf->index);
> > }
> > if (actions[i].type == RTE_FLOW_ACTION_TYPE_RSS) {
> > rss_conf = (const struct rte_flow_action_rss
> > - *)(actions->conf);
> > + *)(actions[i].conf);
> > if (is_mtr_act)
> > nix_mtr_rq_update(eth_dev, mtr_id,
> > rss_conf->queue_num,
> > @@ -98,7 +98,7 @@ cn10k_rss_action_validate(struct rte_eth_dev
> *eth_dev,
> > return -EINVAL;
> > }
> >
> > - if (eth_dev->data->dev_conf.rxmode.mq_mode !=
> RTE_ETH_MQ_RX_RSS) {
> > + if (eth_dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS)
> {
>
> This change seems unintended. Please keep the original value.
Will keep original value
>
>
>
> <...>
>
> > if (!capa)
> > return -rte_mtr_error_set(error, EINVAL,
> > - RTE_MTR_ERROR_TYPE_MTR_PARAMS,
> NULL,
> > - "NULL input parameter");
> > +
> RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL,
> > + "NULL input parameter");
> >
>
> Previous indentation looks more consistent with DPDK coding guide.
Will update to pervious indentation
@@ -36,20 +36,20 @@ cn10k_mtr_configure(struct rte_eth_dev *eth_dev,
for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
mtr_conf = (const struct rte_flow_action_meter
- *)(actions->conf);
+ *)(actions[i].conf);
mtr_id = mtr_conf->mtr_id;
is_mtr_act = true;
}
if (actions[i].type == RTE_FLOW_ACTION_TYPE_QUEUE) {
q_conf = (const struct rte_flow_action_queue
- *)(actions->conf);
+ *)(actions[i].conf);
if (is_mtr_act)
nix_mtr_rq_update(eth_dev, mtr_id, 1,
&q_conf->index);
}
if (actions[i].type == RTE_FLOW_ACTION_TYPE_RSS) {
rss_conf = (const struct rte_flow_action_rss
- *)(actions->conf);
+ *)(actions[i].conf);
if (is_mtr_act)
nix_mtr_rq_update(eth_dev, mtr_id,
rss_conf->queue_num,
@@ -98,7 +98,7 @@ cn10k_rss_action_validate(struct rte_eth_dev *eth_dev,
return -EINVAL;
}
- if (eth_dev->data->dev_conf.rxmode.mq_mode != RTE_ETH_MQ_RX_RSS) {
+ if (eth_dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
plt_err("multi-queue mode is disabled");
return -ENOTSUP;
}
@@ -171,7 +171,6 @@ cn10k_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
return NULL;
}
}
-
for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
mtr = (const struct rte_flow_action_meter *)actions[i]
@@ -35,7 +35,6 @@ static struct rte_mtr_capabilities mtr_capa = {
.chaining_n_mtrs_per_flow_max = NIX_MTR_COUNT_PER_FLOW,
.chaining_use_prev_mtr_color_supported = true,
.chaining_use_prev_mtr_color_enforced = true,
- .meter_rate_max = NIX_BPF_RATE_MAX / 8, /* Bytes per second */
.color_aware_srtcm_rfc2697_supported = true,
.color_aware_trtcm_rfc2698_supported = true,
.color_aware_trtcm_rfc4115_supported = true,
@@ -180,20 +179,20 @@ cnxk_nix_mtr_capabilities_get(struct rte_eth_dev *dev,
struct rte_mtr_capabilities *capa,
struct rte_mtr_error *error)
{
- struct cnxk_eth_dev *eth_dev = cnxk_eth_pmd_priv(dev);
- uint16_t count[ROC_NIX_BPF_LEVEL_MAX] = {0};
uint8_t lvl_mask = ROC_NIX_BPF_LEVEL_F_LEAF | ROC_NIX_BPF_LEVEL_F_MID |
ROC_NIX_BPF_LEVEL_F_TOP;
+ struct cnxk_eth_dev *eth_dev = cnxk_eth_pmd_priv(dev);
+ uint16_t count[ROC_NIX_BPF_LEVEL_MAX] = {0};
struct roc_nix *nix = ð_dev->nix;
- int rc;
- int i;
+ uint32_t time_unit;
+ int rc, i;
RTE_SET_USED(dev);
if (!capa)
return -rte_mtr_error_set(error, EINVAL,
- RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL,
- "NULL input parameter");
+ RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL,
+ "NULL input parameter");
rc = roc_nix_bpf_count_get(nix, lvl_mask, count);
if (rc)
@@ -207,6 +206,15 @@ cnxk_nix_mtr_capabilities_get(struct rte_eth_dev *dev,
mtr_capa.meter_trtcm_rfc4115_n_max = mtr_capa.n_max;
mtr_capa.meter_policy_n_max = mtr_capa.n_max;
+ rc = roc_nix_bpf_timeunit_get(nix, &time_unit);
+ if (rc)
+ return rc;
+
+ mtr_capa.meter_rate_max =
+ NIX_BPF_RATE(time_unit, NIX_BPF_MAX_RATE_EXPONENT,
+ NIX_BPF_MAX_RATE_MANTISSA, 0) /
+ 8;
+
*capa = mtr_capa;
return 0;
}
@@ -304,6 +312,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
if (action->type == RTE_FLOW_ACTION_TYPE_DROP)
supported[i] = true;
+ if (action->type == RTE_FLOW_ACTION_TYPE_VOID)
+ supported[i] = true;
+
if (!supported[i]) {
sprintf(message,
"%s action is not valid",