net/mvpp2: config and commit tm after port configured
Checks
Commit Message
From: Dana Vardi <danat@marvell.com>
Need to set configure flag to allow create and commit mrvl tm
hierarchy tree. tm configuration depends on parameters that are
being set in port configure stage, e.g. nb_tx_queues.
This also aligned with the tm api description.
Fixes: 429c394417 ("net/mvpp2: support traffic manager")
Cc: tdu@semihalf.com
Signed-off-by: Dana Vardi <danat@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
drivers/net/mvpp2/mrvl_ethdev.c | 10 ++++-
drivers/net/mvpp2/mrvl_ethdev.h | 2 +
drivers/net/mvpp2/mrvl_tm.c | 65 +++++++++++++++++++++++++++++++++
3 files changed, 75 insertions(+), 2 deletions(-)
Comments
On Sun, Jul 11, 2021 at 6:42 PM <danat@marvell.com> wrote:
>
> From: Dana Vardi <danat@marvell.com>
>
> Need to set configure flag to allow create and commit mrvl tm
> hierarchy tree. tm configuration depends on parameters that are
> being set in port configure stage, e.g. nb_tx_queues.
> This also aligned with the tm api description.
>
> Fixes: 429c394417 ("net/mvpp2: support traffic manager")
> Cc: tdu@semihalf.com
>
> Signed-off-by: Dana Vardi <danat@marvell.com>
> Reviewed-by: Liron Himi <lironh@marvell.com>
Change the subject to net/mvpp2: fix configured state dependency
Applied to dpdk-next-net-mrvl/for-next-net. Thanks
> ---
> drivers/net/mvpp2/mrvl_ethdev.c | 10 ++++-
> drivers/net/mvpp2/mrvl_ethdev.h | 2 +
> drivers/net/mvpp2/mrvl_tm.c | 65 +++++++++++++++++++++++++++++++++
> 3 files changed, 75 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
> index 63d348e279..1802695a0e 100644
> --- a/drivers/net/mvpp2/mrvl_ethdev.c
> +++ b/drivers/net/mvpp2/mrvl_ethdev.c
> @@ -533,12 +533,18 @@ mrvl_dev_configure(struct rte_eth_dev *dev)
> dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_RSS) {
> MRVL_LOG(WARNING, "Disabling hash for 1 rx queue");
> priv->ppio_params.inqs_params.hash_type = PP2_PPIO_HASH_T_NONE;
> -
> + priv->configured = 1;
> return 0;
> }
>
> - return mrvl_configure_rss(priv,
> + ret = mrvl_configure_rss(priv,
> &dev->data->dev_conf.rx_adv_conf.rss_conf);
> + if (ret < 0)
> + return ret;
> +
> + priv->configured = 1;
> +
> + return 0;
> }
>
> /**
> diff --git a/drivers/net/mvpp2/mrvl_ethdev.h b/drivers/net/mvpp2/mrvl_ethdev.h
> index fda239a53c..426cf33548 100644
> --- a/drivers/net/mvpp2/mrvl_ethdev.h
> +++ b/drivers/net/mvpp2/mrvl_ethdev.h
> @@ -186,6 +186,8 @@ struct mrvl_priv {
>
> uint8_t forward_bad_frames;
> uint32_t fill_bpool_buffs;
> +
> + uint8_t configured; /** indicates if device has been configured */
> };
>
> /** Flow operations forward declaration. */
> diff --git a/drivers/net/mvpp2/mrvl_tm.c b/drivers/net/mvpp2/mrvl_tm.c
> index 4d75f8e915..efab7852e5 100644
> --- a/drivers/net/mvpp2/mrvl_tm.c
> +++ b/drivers/net/mvpp2/mrvl_tm.c
> @@ -146,6 +146,11 @@ mrvl_node_type_get(struct rte_eth_dev *dev, uint32_t node_id, int *is_leaf,
> struct mrvl_priv *priv = dev->data->dev_private;
> struct mrvl_tm_node *node;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> if (!is_leaf)
> return -rte_tm_error_set(error, EINVAL,
> RTE_TM_ERROR_TYPE_UNSPECIFIED,
> @@ -177,6 +182,11 @@ mrvl_capabilities_get(struct rte_eth_dev *dev,
> {
> struct mrvl_priv *priv = dev->data->dev_private;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> if (!cap)
> return -rte_tm_error_set(error, EINVAL,
> RTE_TM_ERROR_TYPE_UNSPECIFIED,
> @@ -228,6 +238,11 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
> {
> struct mrvl_priv *priv = dev->data->dev_private;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> if (!cap)
> return -rte_tm_error_set(error, EINVAL,
> RTE_TM_ERROR_TYPE_UNSPECIFIED,
> @@ -294,6 +309,11 @@ mrvl_node_capabilities_get(struct rte_eth_dev *dev, uint32_t node_id,
> struct mrvl_priv *priv = dev->data->dev_private;
> struct mrvl_tm_node *node;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> if (!cap)
> return -rte_tm_error_set(error, EINVAL,
> RTE_TM_ERROR_TYPE_UNSPECIFIED,
> @@ -366,6 +386,11 @@ mrvl_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
> struct mrvl_priv *priv = dev->data->dev_private;
> struct mrvl_tm_shaper_profile *profile;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> if (!params)
> return -rte_tm_error_set(error, EINVAL,
> RTE_TM_ERROR_TYPE_UNSPECIFIED,
> @@ -434,6 +459,11 @@ mrvl_shaper_profile_delete(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
> struct mrvl_priv *priv = dev->data->dev_private;
> struct mrvl_tm_shaper_profile *profile;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> profile = mrvl_shaper_profile_from_id(priv, shaper_profile_id);
> if (!profile)
> return -rte_tm_error_set(error, ENODEV,
> @@ -580,6 +610,11 @@ mrvl_node_add(struct rte_eth_dev *dev, uint32_t node_id,
> struct mrvl_tm_node *node, *parent = NULL;
> int ret;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> if (priv->ppio)
> return -rte_tm_error_set(error, EPERM,
> RTE_TM_ERROR_TYPE_UNSPECIFIED,
> @@ -665,6 +700,11 @@ mrvl_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
> struct mrvl_priv *priv = dev->data->dev_private;
> struct mrvl_tm_node *node;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> if (priv->ppio) {
> return -rte_tm_error_set(error, EPERM,
> RTE_TM_ERROR_TYPE_UNSPECIFIED,
> @@ -729,6 +769,11 @@ mrvl_node_suspend(struct rte_eth_dev *dev, uint32_t node_id,
> struct mrvl_tm_node *node, *tmp;
> int ret;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> node = mrvl_node_from_id(priv, node_id);
> if (!node)
> return -rte_tm_error_set(error, ENODEV,
> @@ -770,6 +815,11 @@ mrvl_node_resume(struct rte_eth_dev *dev, uint32_t node_id,
> struct mrvl_tm_node *node;
> int ret;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> node = mrvl_node_from_id(priv, node_id);
> if (!node)
> return -rte_tm_error_set(error, ENODEV,
> @@ -806,6 +856,11 @@ mrvl_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail,
> struct mrvl_tm_node *node;
> int ret;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> if (priv->ppio) {
> ret = -rte_tm_error_set(error, EPERM,
> RTE_TM_ERROR_TYPE_UNSPECIFIED,
> @@ -912,6 +967,11 @@ mrvl_node_stats_read(struct rte_eth_dev *dev, uint32_t node_id,
> struct mrvl_tm_node *node;
> int ret;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> if (!priv->ppio) {
> return -rte_tm_error_set(error, EPERM,
> RTE_TM_ERROR_TYPE_UNSPECIFIED,
> @@ -981,6 +1041,11 @@ mrvl_node_stats_update(struct rte_eth_dev *dev, uint32_t node_id,
> struct mrvl_priv *priv = dev->data->dev_private;
> struct mrvl_tm_node *node;
>
> + if (!priv->configured)
> + return -rte_tm_error_set(error, ENODEV,
> + RTE_TM_ERROR_TYPE_UNSPECIFIED,
> + NULL, "Port didn't configured\n");
> +
> node = mrvl_node_from_id(priv, node_id);
> if (!node)
> return -rte_tm_error_set(error, ENODEV,
> --
> 2.17.1
>
@@ -533,12 +533,18 @@ mrvl_dev_configure(struct rte_eth_dev *dev)
dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_RSS) {
MRVL_LOG(WARNING, "Disabling hash for 1 rx queue");
priv->ppio_params.inqs_params.hash_type = PP2_PPIO_HASH_T_NONE;
-
+ priv->configured = 1;
return 0;
}
- return mrvl_configure_rss(priv,
+ ret = mrvl_configure_rss(priv,
&dev->data->dev_conf.rx_adv_conf.rss_conf);
+ if (ret < 0)
+ return ret;
+
+ priv->configured = 1;
+
+ return 0;
}
/**
@@ -186,6 +186,8 @@ struct mrvl_priv {
uint8_t forward_bad_frames;
uint32_t fill_bpool_buffs;
+
+ uint8_t configured; /** indicates if device has been configured */
};
/** Flow operations forward declaration. */
@@ -146,6 +146,11 @@ mrvl_node_type_get(struct rte_eth_dev *dev, uint32_t node_id, int *is_leaf,
struct mrvl_priv *priv = dev->data->dev_private;
struct mrvl_tm_node *node;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
if (!is_leaf)
return -rte_tm_error_set(error, EINVAL,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
@@ -177,6 +182,11 @@ mrvl_capabilities_get(struct rte_eth_dev *dev,
{
struct mrvl_priv *priv = dev->data->dev_private;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
if (!cap)
return -rte_tm_error_set(error, EINVAL,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
@@ -228,6 +238,11 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
{
struct mrvl_priv *priv = dev->data->dev_private;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
if (!cap)
return -rte_tm_error_set(error, EINVAL,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
@@ -294,6 +309,11 @@ mrvl_node_capabilities_get(struct rte_eth_dev *dev, uint32_t node_id,
struct mrvl_priv *priv = dev->data->dev_private;
struct mrvl_tm_node *node;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
if (!cap)
return -rte_tm_error_set(error, EINVAL,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
@@ -366,6 +386,11 @@ mrvl_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
struct mrvl_priv *priv = dev->data->dev_private;
struct mrvl_tm_shaper_profile *profile;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
if (!params)
return -rte_tm_error_set(error, EINVAL,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
@@ -434,6 +459,11 @@ mrvl_shaper_profile_delete(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
struct mrvl_priv *priv = dev->data->dev_private;
struct mrvl_tm_shaper_profile *profile;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
profile = mrvl_shaper_profile_from_id(priv, shaper_profile_id);
if (!profile)
return -rte_tm_error_set(error, ENODEV,
@@ -580,6 +610,11 @@ mrvl_node_add(struct rte_eth_dev *dev, uint32_t node_id,
struct mrvl_tm_node *node, *parent = NULL;
int ret;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
if (priv->ppio)
return -rte_tm_error_set(error, EPERM,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
@@ -665,6 +700,11 @@ mrvl_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
struct mrvl_priv *priv = dev->data->dev_private;
struct mrvl_tm_node *node;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
if (priv->ppio) {
return -rte_tm_error_set(error, EPERM,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
@@ -729,6 +769,11 @@ mrvl_node_suspend(struct rte_eth_dev *dev, uint32_t node_id,
struct mrvl_tm_node *node, *tmp;
int ret;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
node = mrvl_node_from_id(priv, node_id);
if (!node)
return -rte_tm_error_set(error, ENODEV,
@@ -770,6 +815,11 @@ mrvl_node_resume(struct rte_eth_dev *dev, uint32_t node_id,
struct mrvl_tm_node *node;
int ret;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
node = mrvl_node_from_id(priv, node_id);
if (!node)
return -rte_tm_error_set(error, ENODEV,
@@ -806,6 +856,11 @@ mrvl_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail,
struct mrvl_tm_node *node;
int ret;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
if (priv->ppio) {
ret = -rte_tm_error_set(error, EPERM,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
@@ -912,6 +967,11 @@ mrvl_node_stats_read(struct rte_eth_dev *dev, uint32_t node_id,
struct mrvl_tm_node *node;
int ret;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
if (!priv->ppio) {
return -rte_tm_error_set(error, EPERM,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
@@ -981,6 +1041,11 @@ mrvl_node_stats_update(struct rte_eth_dev *dev, uint32_t node_id,
struct mrvl_priv *priv = dev->data->dev_private;
struct mrvl_tm_node *node;
+ if (!priv->configured)
+ return -rte_tm_error_set(error, ENODEV,
+ RTE_TM_ERROR_TYPE_UNSPECIFIED,
+ NULL, "Port didn't configured\n");
+
node = mrvl_node_from_id(priv, node_id);
if (!node)
return -rte_tm_error_set(error, ENODEV,