[PATCH 0/3] net/mlx5: some RSS fixes

2022-04-10 Thread Michael Baum
Some RxQ management fixes affecting RSS flow rules.

Michael Baum (3):
  net/mlx5: fix setting flags to external RxQ
  net/mlx5: fix reading invalid index in RxQ array
  net/mlx5: optimize Rx is hairpin function

 drivers/net/mlx5/mlx5_flow.c | 10 --
 drivers/net/mlx5/mlx5_rxq.c  | 22 +-
 2 files changed, 21 insertions(+), 11 deletions(-)

-- 
2.25.1



[PATCH 1/3] net/mlx5: fix setting flags to external RxQ

2022-04-10 Thread Michael Baum
The flow_drv_rxq_flags_set sets the Rx queue flags (Mark/Flag and Tunnel
Ptypes) according to the device flow.

It tries to get the RxQ control structure to update its ptype. however,
external RxQs don't have control structure to update and it may cause a
crash.

This patch add check whether this Queue is external.

Fixes: 311b17e669ab ("net/mlx5: support queue/RSS actions for external Rx 
queue")
Cc: sta...@dpdk.org

Signed-off-by: Michael Baum 
Acked-by: Matan Azrad 
---
 drivers/net/mlx5/mlx5_flow.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 78cb38d42b..e7542afa80 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1379,8 +1379,11 @@ flow_drv_rxq_flags_set(struct rte_eth_dev *dev,
return;
for (i = 0; i != ind_tbl->queues_n; ++i) {
int idx = ind_tbl->queues[i];
-   struct mlx5_rxq_ctrl *rxq_ctrl = mlx5_rxq_ctrl_get(dev, idx);
+   struct mlx5_rxq_ctrl *rxq_ctrl;
 
+   if (mlx5_is_external_rxq(dev, idx))
+   continue;
+   rxq_ctrl = mlx5_rxq_ctrl_get(dev, idx);
MLX5_ASSERT(rxq_ctrl != NULL);
if (rxq_ctrl == NULL)
continue;
@@ -1483,8 +1486,11 @@ flow_drv_rxq_flags_trim(struct rte_eth_dev *dev,
MLX5_ASSERT(dev->data->dev_started);
for (i = 0; i != ind_tbl->queues_n; ++i) {
int idx = ind_tbl->queues[i];
-   struct mlx5_rxq_ctrl *rxq_ctrl = mlx5_rxq_ctrl_get(dev, idx);
+   struct mlx5_rxq_ctrl *rxq_ctrl;
 
+   if (mlx5_is_external_rxq(dev, idx))
+   continue;
+   rxq_ctrl = mlx5_rxq_ctrl_get(dev, idx);
MLX5_ASSERT(rxq_ctrl != NULL);
if (rxq_ctrl == NULL)
continue;
-- 
2.25.1



[PATCH 2/3] net/mlx5: fix reading invalid index in RxQ array

2022-04-10 Thread Michael Baum
The mlx5_rxq_get() function gets RxQ index and return RxQ priv
accordingly.

When it gets an invalid index, it accesses out of array bounds which
might cause undefined behavior.

This patch adds a check for invalid indexes before accessing to array.

Fixes: 0cedf34da78f ("net/mlx5: move Rx queue reference count")
Cc: sta...@dpdk.org

Signed-off-by: Michael Baum 
Acked-by: Matan Azrad 
---
 drivers/net/mlx5/mlx5_rxq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index f16795bac3..d41834f46f 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -2042,6 +2042,8 @@ mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx)
 {
struct mlx5_priv *priv = dev->data->dev_private;
 
+   if (idx >= priv->rxqs_n)
+   return NULL;
MLX5_ASSERT(priv->rxq_privs != NULL);
return (*priv->rxq_privs)[idx];
 }
-- 
2.25.1



[PATCH 3/3] net/mlx5: optimize Rx is hairpin function

2022-04-10 Thread Michael Baum
The mlx5_rxq_is_hairpin() function checks whether RxQ type is Hairpin.
It is done by reading a flag in Rx control structure coming from
mlx5_rxq_ctrl_get() function.

The function verifies that the queue index is valid even though it has
been checked within the mlx5_rxq_ctrl_get() function.

This patch removes the redundant check.

Signed-off-by: Michael Baum 
Acked-by: Matan Azrad 
---
 drivers/net/mlx5/mlx5_rxq.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index d41834f46f..1782d52f71 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -2332,13 +2332,12 @@ mlx5_ext_rxq_verify(struct rte_eth_dev *dev)
 bool
 mlx5_rxq_is_hairpin(struct rte_eth_dev *dev, uint16_t idx)
 {
-   struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_rxq_ctrl *rxq_ctrl;
 
if (mlx5_is_external_rxq(dev, idx))
return false;
rxq_ctrl = mlx5_rxq_ctrl_get(dev, idx);
-   return (idx < priv->rxqs_n && rxq_ctrl != NULL && rxq_ctrl->is_hairpin);
+   return (rxq_ctrl != NULL && rxq_ctrl->is_hairpin);
 }
 
 /*
@@ -2355,9 +2354,12 @@ mlx5_rxq_is_hairpin(struct rte_eth_dev *dev, uint16_t 
idx)
 const struct rte_eth_hairpin_conf *
 mlx5_rxq_get_hairpin_conf(struct rte_eth_dev *dev, uint16_t idx)
 {
-   struct mlx5_rxq_priv *rxq = mlx5_rxq_get(dev, idx);
+   if (mlx5_rxq_is_hairpin(dev, idx)) {
+   struct mlx5_rxq_priv *rxq = mlx5_rxq_get(dev, idx);
 
-   return mlx5_rxq_is_hairpin(dev, idx) ? &rxq->hairpin_conf : NULL;
+   return rxq != NULL ? &rxq->hairpin_conf : NULL;
+   }
+   return NULL;
 }
 
 /**
@@ -2367,7 +2369,7 @@ mlx5_rxq_get_hairpin_conf(struct rte_eth_dev *dev, 
uint16_t idx)
  * @param ind_tbl
  *   Pointer to indirection table to match.
  * @param queues
- *   Queues to match to ques in indirection table.
+ *   Queues to match to queues in indirection table.
  * @param queues_n
  *   Number of queues in the array.
  *
@@ -2376,11 +2378,11 @@ mlx5_rxq_get_hairpin_conf(struct rte_eth_dev *dev, 
uint16_t idx)
  */
 static int
 mlx5_ind_table_obj_match_queues(const struct mlx5_ind_table_obj *ind_tbl,
-  const uint16_t *queues, uint32_t queues_n)
+   const uint16_t *queues, uint32_t queues_n)
 {
-   return (ind_tbl->queues_n == queues_n) &&
-   (!memcmp(ind_tbl->queues, queues,
-   ind_tbl->queues_n * sizeof(ind_tbl->queues[0])));
+   return (ind_tbl->queues_n == queues_n) &&
+   (!memcmp(ind_tbl->queues, queues,
+ind_tbl->queues_n * sizeof(ind_tbl->queues[0])));
 }
 
 /**
-- 
2.25.1



[PATCH 0/2] net/mlx5: support missing functionality for Windows

2022-04-10 Thread Adham Masarwah
Adding support for set promiscuous modes and for MTU set/get

Adham Masarwah (2):
  net/mlx5: add support for set promiscuous modes in Windows
  net/mlx5: add support for set and get MTU in Windows

 drivers/common/mlx5/windows/mlx5_glue.c   | 86 +++
 drivers/common/mlx5/windows/mlx5_glue.h   |  8 +++
 drivers/net/mlx5/windows/mlx5_ethdev_os.c | 31 +--
 drivers/net/mlx5/windows/mlx5_os.c| 15 +++---
 4 files changed, 127 insertions(+), 13 deletions(-)

-- 
2.16.1.windows.4



[PATCH 0/2] net/mlx5: support missing functionality for Windows

2022-04-10 Thread Adham Masarwah
Adding support for set promiscuous modes and for MTU set/get

Adham Masarwah (2):
  net/mlx5: add support for set promiscuous modes in Windows
  net/mlx5: add support for set and get MTU in Windows

 drivers/common/mlx5/windows/mlx5_glue.c   | 86 +++
 drivers/common/mlx5/windows/mlx5_glue.h   |  8 +++
 drivers/net/mlx5/windows/mlx5_ethdev_os.c | 31 +--
 drivers/net/mlx5/windows/mlx5_os.c| 15 +++---
 4 files changed, 127 insertions(+), 13 deletions(-)

-- 
2.16.1.windows.4



[PATCH 1/2] net/mlx5: add support for set promiscuous modes in Windows

2022-04-10 Thread Adham Masarwah
Support of the set promiscuous modes by calling the new API
In Mlx5DevX Lib.
Added new glue API for Windows which will be used to communicate
with Windows driver to enable/disable PROMISC or ALLMC.

Signed-off-by: Adham Masarwah 
Tested-by: Idan Hackmon 
Acked-by: Matan Azard 
---
 drivers/common/mlx5/windows/mlx5_glue.c | 31 +++
 drivers/common/mlx5/windows/mlx5_glue.h |  6 ++
 drivers/net/mlx5/windows/mlx5_os.c  | 15 ++-
 3 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/drivers/common/mlx5/windows/mlx5_glue.c 
b/drivers/common/mlx5/windows/mlx5_glue.c
index 535487a8d4..73d63ffd98 100644
--- a/drivers/common/mlx5/windows/mlx5_glue.c
+++ b/drivers/common/mlx5/windows/mlx5_glue.c
@@ -328,6 +328,36 @@ mlx5_glue_devx_init_showdown_event(void *ctx)
return 0;
 }
 
+static int
+mlx5_glue_devx_set_promisc_vport(void *ctx, uint32_t promisc_type, uint8_t 
f_enable)
+{
+#ifdef HAVE_DEVX_SET_PROMISC_SUPPORT
+   int devx_promisc_type = MLX5_DEVX_SET_PROMISC_VPORT_PROMISC_MODE;
+   struct mlx5_context *mlx5_ctx;
+   int err;
+
+   if (!ctx) {
+   errno = EINVAL;
+   return errno;
+   }
+   mlx5_ctx = (struct mlx5_context *)ctx;
+   if (promisc_type == MC_PROMISC)
+   devx_promisc_type = MLX5_DEVX_SET_PROMISC_VPORT_ALL_MULTICAST;
+   err = devx_set_promisc_vport(mlx5_ctx->devx_ctx, devx_promisc_type, 
f_enable);
+   if (err) {
+   errno = err;
+   return errno;
+   }
+   return 0;
+#else
+   (void)promisc_type;
+   (void)f_enable;
+   (void)ctx;
+   DRV_LOG(WARNING, "%s: is not supported", __func__);
+   return -ENOTSUP;
+#endif
+}
+
 alignas(RTE_CACHE_LINE_SIZE)
 const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
.version = MLX5_GLUE_VERSION,
@@ -351,4 +381,5 @@ const struct mlx5_glue *mlx5_glue = &(const struct 
mlx5_glue){
.devx_query_eqn = mlx5_glue_devx_query_eqn,
.query_rt_values = mlx5_glue_query_rt_values,
.devx_init_showdown_event = mlx5_glue_devx_init_showdown_event,
+   .devx_set_promisc_vport = mlx5_glue_devx_set_promisc_vport,
 };
diff --git a/drivers/common/mlx5/windows/mlx5_glue.h 
b/drivers/common/mlx5/windows/mlx5_glue.h
index db8f2e8319..eae8070b3f 100644
--- a/drivers/common/mlx5/windows/mlx5_glue.h
+++ b/drivers/common/mlx5/windows/mlx5_glue.h
@@ -49,6 +49,11 @@ struct mlx5dv_dr_action_dest_attr {
 };
 #endif
 
+enum {
+   ALL_PROMISC,
+   MC_PROMISC,
+};
+
 /* LIB_GLUE_VERSION must be updated every time this structure is modified. */
 struct mlx5_glue {
const char *version;
@@ -87,6 +92,7 @@ struct mlx5_glue {
int (*devx_query_eqn)(void *context, uint32_t cpus, uint32_t *eqn);
int (*query_rt_values)(void *ctx, void *devx_clock);
int (*devx_init_showdown_event)(void *ctx);
+   int (*devx_set_promisc_vport)(void *ctx, uint32_t promisc_type, uint8_t 
f_enable);
 };
 
 extern const struct mlx5_glue *mlx5_glue;
diff --git a/drivers/net/mlx5/windows/mlx5_os.c 
b/drivers/net/mlx5/windows/mlx5_os.c
index c7bb81549e..77f04cc931 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -729,7 +729,6 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv,
 
 /**
  * Set device promiscuous mode
- * Currently it has no support under Windows.
  *
  * @param dev
  *   Pointer to Ethernet device structure.
@@ -742,10 +741,9 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv,
 int
 mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable)
 {
-   (void)dev;
-   (void)enable;
-   DRV_LOG(WARNING, "%s: is not supported", __func__);
-   return -ENOTSUP;
+   struct mlx5_priv *priv = dev->data->dev_private;
+
+   return mlx5_glue->devx_set_promisc_vport(priv->sh->cdev->ctx, 
ALL_PROMISC, enable);
 }
 
 /**
@@ -762,10 +760,9 @@ mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable)
 int
 mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)
 {
-   (void)dev;
-   (void)enable;
-   DRV_LOG(WARNING, "%s: is not supported", __func__);
-   return -ENOTSUP;
+   struct mlx5_priv *priv = dev->data->dev_private;
+
+   return mlx5_glue->devx_set_promisc_vport(priv->sh->cdev->ctx, 
MC_PROMISC, enable);
 }
 
 /**
-- 
2.16.1.windows.4



[PATCH 2/2] net/mlx5: add support for set and get MTU in Windows

2022-04-10 Thread Adham Masarwah
Mlx5Devx library has new API's for setting and getting MTU.
Added new glue functions that wrap the new mlx5devx lib API's.
Implemented the os_ethdev callbacks to use the new glue
functions in Windows.

Signed-off-by: Adham Masarwah 
Tested-by: Idan Hackmon 
Acked-by: Matan Azard 
---
 drivers/common/mlx5/windows/mlx5_glue.c   | 55 +++
 drivers/common/mlx5/windows/mlx5_glue.h   |  2 ++
 drivers/net/mlx5/windows/mlx5_ethdev_os.c | 31 ++---
 3 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/drivers/common/mlx5/windows/mlx5_glue.c 
b/drivers/common/mlx5/windows/mlx5_glue.c
index 73d63ffd98..6935811bf4 100644
--- a/drivers/common/mlx5/windows/mlx5_glue.c
+++ b/drivers/common/mlx5/windows/mlx5_glue.c
@@ -358,6 +358,59 @@ mlx5_glue_devx_set_promisc_vport(void *ctx, uint32_t 
promisc_type, uint8_t f_ena
 #endif
 }
 
+static int
+mlx5_glue_devx_get_mtu(void *ctx, uint32_t *mtu)
+{
+   int err = 0;
+   struct mlx5_context *mlx5_ctx;
+
+   if (!ctx) {
+   errno = EINVAL;
+   return errno;
+   }
+   mlx5_ctx = (struct mlx5_context *)ctx;
+#ifdef HAVE_DEVX_SET_GET_MTU_SUPPORT
+   err = devx_get_mtu(mlx5_ctx->devx_ctx, mtu);
+   if (err) {
+   errno = err;
+   return errno;
+   }
+#else
+   *mtu = mlx5_ctx->mlx5_dev.mtu_bytes;
+#endif
+
+   return err;
+}
+
+static int
+mlx5_glue_devx_set_mtu(void *ctx, uint32_t mtu)
+{
+#ifdef HAVE_DEVX_SET_GET_MTU_SUPPORT
+   struct mlx5_context *mlx5_ctx;
+   int err;
+
+   if (!ctx) {
+   errno = EINVAL;
+   return errno;
+   }
+   mlx5_ctx = (struct mlx5_context *)ctx;
+   err = devx_set_mtu(mlx5_ctx->devx_ctx, mtu);
+   if (err) {
+   errno = err;
+   return errno;
+   }
+   return 0;
+#else
+   (void)mtu;
+   (void)ctx;
+   DRV_LOG(WARNING, "%s: is not supported", __func__);
+   return -ENOTSUP;
+#endif
+
+}
+
+
+
 alignas(RTE_CACHE_LINE_SIZE)
 const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
.version = MLX5_GLUE_VERSION,
@@ -382,4 +435,6 @@ const struct mlx5_glue *mlx5_glue = &(const struct 
mlx5_glue){
.query_rt_values = mlx5_glue_query_rt_values,
.devx_init_showdown_event = mlx5_glue_devx_init_showdown_event,
.devx_set_promisc_vport = mlx5_glue_devx_set_promisc_vport,
+   .devx_get_mtu = mlx5_glue_devx_get_mtu,
+   .devx_set_mtu = mlx5_glue_devx_set_mtu,
 };
diff --git a/drivers/common/mlx5/windows/mlx5_glue.h 
b/drivers/common/mlx5/windows/mlx5_glue.h
index eae8070b3f..5ba324ebc4 100644
--- a/drivers/common/mlx5/windows/mlx5_glue.h
+++ b/drivers/common/mlx5/windows/mlx5_glue.h
@@ -93,6 +93,8 @@ struct mlx5_glue {
int (*query_rt_values)(void *ctx, void *devx_clock);
int (*devx_init_showdown_event)(void *ctx);
int (*devx_set_promisc_vport)(void *ctx, uint32_t promisc_type, uint8_t 
f_enable);
+   int (*devx_get_mtu)(void *ctx, uint32_t *mtu);
+   int (*devx_set_mtu)(void *ctx, uint32_t mtu);
 };
 
 extern const struct mlx5_glue *mlx5_glue;
diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c 
b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
index c6315ce368..f97526580d 100644
--- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
@@ -85,6 +85,8 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char 
(*ifname)[MLX5_NAMESIZE])
 int
 mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu)
 {
+   int err;
+   uint32_t curr_mtu;
struct mlx5_priv *priv;
mlx5_context_st *context_obj;
 
@@ -94,7 +96,14 @@ mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu)
}
priv = dev->data->dev_private;
context_obj = (mlx5_context_st *)priv->sh->cdev->ctx;
-   *mtu = context_obj->mlx5_dev.mtu_bytes;
+
+   err = mlx5_glue->devx_get_mtu(context_obj, &curr_mtu);
+   if (err != 0) {
+   DRV_LOG(WARNING, "Could not get the MTU!");
+   return err;
+   }
+   *mtu = (uint16_t)curr_mtu;
+
return 0;
 }
 
@@ -112,9 +121,23 @@ mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu)
 int
 mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 {
-   RTE_SET_USED(dev);
-   RTE_SET_USED(mtu);
-   return -ENOTSUP;
+   int err;
+   struct mlx5_priv *priv;
+   mlx5_context_st *context_obj;
+
+   if (!dev) {
+   rte_errno = EINVAL;
+   return -rte_errno;
+   }
+   priv = dev->data->dev_private;
+   context_obj = (mlx5_context_st *)priv->sh->cdev->ctx;
+
+   err = mlx5_glue->devx_set_mtu(context_obj, mtu);
+   if (err != 0) {
+   DRV_LOG(WARNING, "Could not set the MTU!");
+   return err;
+   }
+   return 0;
 }
 
 /*
-- 
2.16.1.windows.4



RE: [PATCH] app/eventdev_dump: introduce eventdev_dump application

2022-04-10 Thread McDaniel, Timothy


> -Original Message-
> From: Jerin Jacob 
> Sent: Sunday, April 10, 2022 1:49 AM
> To: McDaniel, Timothy ; Maryam Tahhan
> ; Pattan, Reshma 
> Cc: Jerin Jacob ; dpdk-dev 
> Subject: Re: [PATCH] app/eventdev_dump: introduce eventdev_dump
> application
> 
> On Sat, Apr 9, 2022 at 9:01 PM Timothy McDaniel
>  wrote:
> >
> > The eventdev_dump application provides an easy way to query
> > and display xstats and pmd dump data.  It should work with all
> > eventdevs. See the help usage for the full set of supported
> > queries.
> 
> + maryam.tah...@intel.com, reshma.pat...@intel.com
> Why add another app? Please extend app/proc-info/ which does the same
> thing for ethdev so that we can reuse parsing and adapter info if
> needed.

Thanks for the feedback, Jerin. That sounds like a good idea. I'll take a look 
at that.

Tim


[RFC 1/3] eal: add macro to warn for unused function return values

2022-04-10 Thread Mattias Rönnblom
This patch adds a wrapper macro __rte_warn_unused_result for the
warn_unused_result function attribute.

Marking a function __rte_warn_unused_result will make the compiler
emit a warning in case the caller does not use the function's return
value.

Signed-off-by: Mattias Rönnblom 
---
 lib/eal/include/rte_common.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 4a399cc7c8..544e7de2e7 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -222,6 +222,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), 
used)) func(void)
  */
 #define __rte_noreturn __attribute__((noreturn))
 
+/**
+ * Issue warning in case the function's return value is ignore
+ */
+#define __rte_warn_unused_result __attribute__((warn_unused_result))
+
 /**
  * Force a function to be inlined
  */
-- 
2.25.1



[RFC 2/3] eal: emit warning for unused trylock return value

2022-04-10 Thread Mattias Rönnblom
Mark the trylock family of spinlock functions with
__rte_warn_unused_result.

Signed-off-by: Mattias Rönnblom 
---
 lib/eal/include/generic/rte_spinlock.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/eal/include/generic/rte_spinlock.h 
b/lib/eal/include/generic/rte_spinlock.h
index 40fe49d5ad..73ed4bfbdc 100644
--- a/lib/eal/include/generic/rte_spinlock.h
+++ b/lib/eal/include/generic/rte_spinlock.h
@@ -97,6 +97,7 @@ rte_spinlock_unlock (rte_spinlock_t *sl)
  * @return
  *   1 if the lock is successfully taken; 0 otherwise.
  */
+__rte_warn_unused_result
 static inline int
 rte_spinlock_trylock (rte_spinlock_t *sl);
 
@@ -174,6 +175,7 @@ rte_spinlock_unlock_tm(rte_spinlock_t *sl);
  *   1 if the hardware memory transaction is successfully started
  *   or lock is successfully taken; 0 otherwise.
  */
+__rte_warn_unused_result
 static inline int
 rte_spinlock_trylock_tm(rte_spinlock_t *sl);
 
@@ -243,6 +245,7 @@ static inline void 
rte_spinlock_recursive_unlock(rte_spinlock_recursive_t *slr)
  * @return
  *   1 if the lock is successfully taken; 0 otherwise.
  */
+__rte_warn_unused_result
 static inline int rte_spinlock_recursive_trylock(rte_spinlock_recursive_t *slr)
 {
int id = rte_gettid();
@@ -299,6 +302,7 @@ static inline void rte_spinlock_recursive_unlock_tm(
  *   1 if the hardware memory transaction is successfully started
  *   or lock is successfully taken; 0 otherwise.
  */
+__rte_warn_unused_result
 static inline int rte_spinlock_recursive_trylock_tm(
rte_spinlock_recursive_t *slr);
 
-- 
2.25.1



[RFC 3/3] examples/bond: fix invalid use of trylock

2022-04-10 Thread Mattias Rönnblom
The conditional rte_spinlock_trylock() was used as if it is an
unconditional lock operation in a number of places.

Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding 
mode 6")
Cc: michalx.k.jastrzeb...@intel.com

Signed-off-by: Mattias Rönnblom 
---
 examples/bond/main.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 335bde5c8d..4efebb3902 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -373,7 +373,7 @@ static int lcore_main(__rte_unused void *arg1)
bond_ip = BOND_IP_1 | (BOND_IP_2 << 8) |
(BOND_IP_3 << 16) | (BOND_IP_4 << 24);
 
-   rte_spinlock_trylock(&global_flag_stru_p->lock);
+   rte_spinlock_lock(&global_flag_stru_p->lock);
 
while (global_flag_stru_p->LcoreMainIsRunning) {
rte_spinlock_unlock(&global_flag_stru_p->lock);
@@ -456,7 +456,7 @@ static int lcore_main(__rte_unused void *arg1)
if (is_free == 0)
rte_pktmbuf_free(pkts[i]);
}
-   rte_spinlock_trylock(&global_flag_stru_p->lock);
+   rte_spinlock_lock(&global_flag_stru_p->lock);
}
rte_spinlock_unlock(&global_flag_stru_p->lock);
printf("BYE lcore_main\n");
@@ -571,7 +571,7 @@ static void cmd_start_parsed(__rte_unused void 
*parsed_result,
 {
int worker_core_id = rte_lcore_id();
 
-   rte_spinlock_trylock(&global_flag_stru_p->lock);
+   rte_spinlock_lock(&global_flag_stru_p->lock);
if (global_flag_stru_p->LcoreMainIsRunning == 0) {
if (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore)
!= WAIT) {
@@ -591,7 +591,7 @@ static void cmd_start_parsed(__rte_unused void 
*parsed_result,
if ((worker_core_id >= RTE_MAX_LCORE) || (worker_core_id == 0))
return;
 
-   rte_spinlock_trylock(&global_flag_stru_p->lock);
+   rte_spinlock_lock(&global_flag_stru_p->lock);
global_flag_stru_p->LcoreMainIsRunning = 1;
rte_spinlock_unlock(&global_flag_stru_p->lock);
cmdline_printf(cl,
@@ -659,7 +659,7 @@ static void cmd_stop_parsed(__rte_unused void 
*parsed_result,
struct cmdline *cl,
__rte_unused void *data)
 {
-   rte_spinlock_trylock(&global_flag_stru_p->lock);
+   rte_spinlock_lock(&global_flag_stru_p->lock);
if (global_flag_stru_p->LcoreMainIsRunning == 0){
cmdline_printf(cl,
"lcore_main not running on core:%d\n",
@@ -700,7 +700,7 @@ static void cmd_quit_parsed(__rte_unused void 
*parsed_result,
struct cmdline *cl,
__rte_unused void *data)
 {
-   rte_spinlock_trylock(&global_flag_stru_p->lock);
+   rte_spinlock_lock(&global_flag_stru_p->lock);
if (global_flag_stru_p->LcoreMainIsRunning == 0){
cmdline_printf(cl,
"lcore_main not running on core:%d\n",
@@ -762,7 +762,7 @@ static void cmd_show_parsed(__rte_unused void 
*parsed_result,
printf("\n");
}
 
-   rte_spinlock_trylock(&global_flag_stru_p->lock);
+   rte_spinlock_lock(&global_flag_stru_p->lock);
cmdline_printf(cl,
"Active_slaves:%d "
"packets received:Tot:%d Arp:%d IPv4:%d\n",
-- 
2.25.1



Re: [RFC 1/3] eal: add macro to warn for unused function return values

2022-04-10 Thread Stephen Hemminger
On Sun, 10 Apr 2022 15:51:38 +0200
Mattias Rönnblom  wrote:

> This patch adds a wrapper macro __rte_warn_unused_result for the
> warn_unused_result function attribute.
> 
> Marking a function __rte_warn_unused_result will make the compiler
> emit a warning in case the caller does not use the function's return
> value.
> 
> Signed-off-by: Mattias Rönnblom 

Looks good, but are these attributes compiler specific?


[RFC] compress/mlx5: add support for LZ4 decompress

2022-04-10 Thread Raja Zidane
LZ4 decompress will be supported starting from BlueField3.

Add LZ4 params struct to RTE XFORM struct.
Add case to check for LZ4 algo, and pass params from RTE XFORM.

Signed-off-by: Raja Zidane 
---
 drivers/common/mlx5/mlx5_prm.h|  6 +
 drivers/compress/mlx5/mlx5_compress.c | 29 +++
 lib/compressdev/rte_comp.h| 34 +++
 3 files changed, 64 insertions(+), 5 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 2ded67e85e..b89bf922b8 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -548,9 +548,15 @@ struct mlx5_rdma_write_wqe {
 #defineMLX5_OPC_MOD_MMO_DECOMP 0x3u
 #defineMLX5_OPC_MOD_MMO_DMA 0x1u
 
+#define WQE_GGA_DECOMP_DEFLATE 0x0u
+#define WQE_GGA_DECOMP_SNAPPY 0x1u
+#define WQE_GGA_DECOMP_LZ4 0x2u
+
 #define WQE_GGA_COMP_WIN_SIZE_OFFSET 12u
 #define WQE_GGA_COMP_BLOCK_SIZE_OFFSET 16u
 #define WQE_GGA_COMP_DYNAMIC_SIZE_OFFSET 20u
+#define WQE_GGA_DECOMP_PARAMS_OFFSET 20u
+#define WQE_GGA_DECOMP_TYPE_OFFSET 8u
 #define MLX5_GGA_COMP_WIN_SIZE_UNITS 1024u
 #define MLX5_GGA_COMP_WIN_SIZE_MAX (32u * MLX5_GGA_COMP_WIN_SIZE_UNITS)
 #define MLX5_GGA_COMP_LOG_BLOCK_SIZE_MAX 15u
diff --git a/drivers/compress/mlx5/mlx5_compress.c 
b/drivers/compress/mlx5/mlx5_compress.c
index 82b871bd86..4994e38ab6 100644
--- a/drivers/compress/mlx5/mlx5_compress.c
+++ b/drivers/compress/mlx5/mlx5_compress.c
@@ -298,6 +298,10 @@ mlx5_compress_xform_create(struct rte_compressdev *dev,
DRV_LOG(ERR, "Not enough capabilities to support 
compress operation, maybe old FW/OFED version?");
return -ENOTSUP;
}
+   if (xform->compress.algo == RTE_COMP_ALGO_LZ4) {
+   DRV_LOG(ERR, "LZ4 compression is not supported.");
+   return -ENOTSUP;
+   }
if (xform->compress.level == RTE_COMP_LEVEL_NONE) {
DRV_LOG(ERR, "Non-compressed block is not supported.");
return -ENOTSUP;
@@ -371,6 +375,31 @@ mlx5_compress_xform_create(struct rte_compressdev *dev,
case RTE_COMP_ALGO_DEFLATE:
xfrm->opcode += MLX5_OPC_MOD_MMO_DECOMP <<
WQE_CSEG_OPC_MOD_OFFSET;
+   xfrm->gga_ctrl1 += WQE_GGA_DECOMP_DEFLATE <<
+   WQE_GGA_DECOMP_TYPE_OFFSET;
+   break;
+   case RTE_COMP_ALGO_LZ4:
+   xfrm->opcode += MLX5_OPC_MOD_MMO_DECOMP <<
+   WQE_CSEG_OPC_MOD_OFFSET;
+   xfrm->gga_ctrl1 += WQE_GGA_DECOMP_LZ4 <<
+   WQE_GGA_DECOMP_TYPE_OFFSET;
+   switch (xform->decompress.lz4.lz4) {
+   case RTE_COMP_LZ4_DATA_ONLY:
+   xfrm->gga_ctrl1 += 0u <<
+   WQE_GGA_DECOMP_PARAMS_OFFSET;
+   break;
+   case RTE_COMP_LZ4_BLOCK_WITHOUT_CHECKSUM:
+   xfrm->gga_ctrl1 += 1u <<
+   WQE_GGA_DECOMP_PARAMS_OFFSET;
+   break;
+   case RTE_COMP_LZ4_BLOCK_WITH_CHECKSUM:
+   xfrm->gga_ctrl1 += 2u <<
+   WQE_GGA_DECOMP_PARAMS_OFFSET;
+   break;
+   default:
+   xfrm->gga_ctrl1 += 0u <<
+   WQE_GGA_DECOMP_PARAMS_OFFSET;
+   }
break;
default:
goto err;
diff --git a/lib/compressdev/rte_comp.h b/lib/compressdev/rte_comp.h
index 95306c5d03..2a0cd79873 100644
--- a/lib/compressdev/rte_comp.h
+++ b/lib/compressdev/rte_comp.h
@@ -109,6 +109,10 @@ enum rte_comp_algorithm {
/**< LZS compression algorithm
 * https://tools.ietf.org/html/rfc2395
 */
+   RTE_COMP_ALGO_LZ4,
+   /**< LZ4 compression algorithm
+* 
+*/
RTE_COMP_ALGO_LIST_END
 };
 
@@ -162,6 +166,14 @@ enum rte_comp_huffman {
/**< Use Dynamic Huffman codes */
 };
 
+enum rte_comp_lz4 {
+   RTE_COMP_LZ4_DEFAULT,
+   /**< PMD may choose which LZ4 codes to use */
+   RTE_COMP_LZ4_DATA_ONLY,
+   RTE_COMP_LZ4_BLOCK_WITHOUT_CHECKSUM,
+   RTE_COMP_LZ4_BLOCK_WITH_CHECKSUM,
+};
+
 /** Compression flush flags */
 enum rte_comp_flush_flag {
RTE_COMP_FLUSH_NONE,
@@ -215,6 +227,12 @@ struct rte_comp_deflate_params {
/**< Compression huffman encoding type */
 };
 
+/** Parameters specific to the lz4 algorithm */
+struct rte_comp_lz4_params {
+   enum rte

Re: [RFC 1/3] eal: add macro to warn for unused function return values

2022-04-10 Thread Mattias Rönnblom
On 2022-04-10 20:02, Stephen Hemminger wrote:
> On Sun, 10 Apr 2022 15:51:38 +0200
> Mattias Rönnblom  wrote:
> 
>> This patch adds a wrapper macro __rte_warn_unused_result for the
>> warn_unused_result function attribute.
>>
>> Marking a function __rte_warn_unused_result will make the compiler
>> emit a warning in case the caller does not use the function's return
>> value.
>>
>> Signed-off-by: Mattias Rönnblom 
> 
> Looks good, but are these attributes compiler specific?

GCC and LLVM clang supports this and many other attributes (some of 
which are already wrapped by ___rte_* macros). The whole attribute 
machinery is compiler (or rather, "implementation") specific, as 
suggested by the double-underscore prefix (__attribute__).

I don't know about icc.


RE: [PATCH] app/testpmd: fix use of indirect action after port close

2022-04-10 Thread Dmitry Kozlyuk
Hi Aman,

> From: Dmitry Kozlyuk 
> Sent: Thursday, March 31, 2022 1:57 AM
> [...]
> > From: Singh, Aman Deep 
> > Sent: Wednesday, March 30, 2022 5:24 PM
> > [...]
> > On 3/7/2022 10:18 PM, Dmitry Kozlyuk wrote:
> > > When a port was closed, indirect actions could remain
> > > with their handles no longer valid.
> > > If a newly attached device was assigned the same ID as the closed
> port,
> > > those indirect actions became accessible again.
> > > Any attempt to use them resulted in an undefined behavior.
> > > Automatically flush indirect actions when a port is closed.
> > >
> > > Fixes: 4b61b8774be9 ("ethdev: introduce indirect flow action")
> > > Cc: sta...@dpdk.org
> > >
> > > Signed-off-by: Dmitry Kozlyuk 
> > > Acked-by: Matan Azrad 
> > > ---
> > From: guides/prog_guide/rte_flow.rst
> > /"If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised,//
> > //this means that the PMD can keep at least some indirect actions//
> > //across device stop and start.
> >
> > /Please check, if we are inline with the guidelines given in the
> section.
> 
> This patch is related to port closing, not port stopping.
> Flow API resources are owned by the port,
> so they cannot be valid when the port is closed and its ethdev removed.
> TestPMD was keeping indirect action handles contrary to this.
> 
> As for RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP,
> there is already "flow indirect_action destroy"
> to erase indirect actions before stopping the port if this is desired.
> I had another patch in mind to add "flow indirect_action flush"
> for convenience, but it is independent of this fix.

Did my response clear up your concern?
In short: this patch is aligned with the defined flow resource behavior.


[PATCH] ethdev: prohibit polling of a stopped queue

2022-04-10 Thread Dmitry Kozlyuk
Whether it is allowed to call Rx/Tx functions for a stopped queue
was undocumented. Some PMDs make this behavior a no-op
either by explicitly checking the queue state
or by the way how their routines are implemented or HW works.

No-op behavior may be convenient for application developers.
But it also means that pollers of stopped queues
would go all the way down to PMD Rx/Tx routines, wasting cycles.
Some PMDs would do a check for the queue state on data path,
even though it may never be needed for a particular application.
Also, use cases for stopping queues or starting them deferred
do not logically require polling stopped queues.

Use case 1: a secondary that was polling the queue has crashed,
the primary is doing a recovery to free all mbufs.
By definition the queue to be restarted is not polled.

Use case 2: deferred queue start or queue reconfiguration.
The polling thread must be synchronized anyway,
because queue start and stop are non-atomic.

Prohibit calling Rx/Tx functions on stopped queues.

Fixes: 0748be2cf9a2 ("ethdev: queue start and stop")
Cc: sta...@dpdk.org

Signed-off-by: Dmitry Kozlyuk 
---
This patch is was originally a part of the series:
http://patchwork.dpdk.org/project/dpdk/patch/20220307125351.697936-3-dkozl...@nvidia.com/
The discussion there is summarized in the commit message.

 lib/ethdev/rte_ethdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 04cff8ee10..435720a84e 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -74,7 +74,7 @@
  * rte_eth_rx_queue_setup()), it must call rte_eth_dev_stop() first to stop the
  * device and then do the reconfiguration before calling rte_eth_dev_start()
  * again. The transmit and receive functions should not be invoked when the
- * device is stopped.
+ * device is stopped or when the queue is stopped (for that queue).
  *
  * Please note that some configuration is not stored between calls to
  * rte_eth_dev_stop()/rte_eth_dev_start(). The following configuration will
-- 
2.25.1



[PATCH v2] event/dlb2: add CQ weight support

2022-04-10 Thread Timothy McDaniel
Enabling the weight limit on a CQ allows the enqueued QEs' 2-bit weight
value (representing weights of 1, 2, 4, and 8) to factor into whether a
CQ is full. If the sum of the weights of the QEs in the CQ meet or exceed
its weight limit, DLB will stop scheduling QEs to it (until software pops
enough QEs from the CQ to reverse that).

CQ weight support is enabled via the command line, and applies to
DLB 2.5 (and above) load balanced ports. The DLB2 documentation will
be updated with further details.

Signed-off-by: Timothy McDaniel 
---
Depends-on: patch-109544("event/dlb2: add support for single 512B write of 4 
QEs")

V2: Added
* Added patch dependency line in commit message
---
 drivers/event/dlb2/dlb2.c  | 109 +-
 drivers/event/dlb2/dlb2_iface.c|   4 +
 drivers/event/dlb2/dlb2_iface.h|   4 +
 drivers/event/dlb2/dlb2_priv.h |  10 +-
 drivers/event/dlb2/dlb2_user.h |  30 +++
 drivers/event/dlb2/pf/base/dlb2_resource.c | 221 +
 drivers/event/dlb2/pf/base/dlb2_resource.h |  33 +++
 drivers/event/dlb2/pf/dlb2_pf.c|  68 +++
 8 files changed, 475 insertions(+), 4 deletions(-)

diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index e2a5303310..9bac92c7b5 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -106,6 +106,16 @@ dlb2_init_queue_depth_thresholds(struct dlb2_eventdev 
*dlb2,
}
 }
 
+/* override defaults with value(s) provided on command line */
+static void
+dlb2_init_cq_weight(struct dlb2_eventdev *dlb2, int *cq_weight)
+{
+   int q;
+
+   for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++)
+   dlb2->ev_ports[q].cq_weight = cq_weight[q];
+}
+
 static int
 dlb2_hw_query_resources(struct dlb2_eventdev *dlb2)
 {
@@ -546,6 +556,53 @@ set_qid_depth_thresh_v2_5(const char *key __rte_unused,
return 0;
 }
 
+static int
+set_cq_weight(const char *key __rte_unused,
+ const char *value,
+ void *opaque)
+{
+   struct dlb2_cq_weight *cq_weight = opaque;
+   int first, last, weight, i;
+
+   if (value == NULL || opaque == NULL) {
+   DLB2_LOG_ERR("NULL pointer\n");
+   return -EINVAL;
+   }
+
+   /* command line override may take one of the following 3 forms:
+* qid_depth_thresh=all: ... all queues
+* qid_depth_thresh=qidA-qidB: ... a range of queues
+* qid_depth_thresh=qid: ... just one queue
+*/
+   if (sscanf(value, "all:%d", &weight) == 1) {
+   first = 0;
+   last = DLB2_MAX_NUM_LDB_PORTS - 1;
+   } else if (sscanf(value, "%d-%d:%d", &first, &last, &weight) == 3) {
+   /* we have everything we need */
+   } else if (sscanf(value, "%d:%d", &first, &weight) == 2) {
+   last = first;
+   } else {
+   DLB2_LOG_ERR("Error parsing ldb port qe weight devarg. Should 
be all:val, qid-qid:val, or qid:val\n");
+   return -EINVAL;
+   }
+
+   if (first > last || first < 0 ||
+   last >= DLB2_MAX_NUM_LDB_PORTS) {
+   DLB2_LOG_ERR("Error parsing ldb port qe weight arg, invalid 
port value\n");
+   return -EINVAL;
+   }
+
+   if (weight < 0 || weight > DLB2_MAX_CQ_DEPTH_OVERRIDE) {
+   DLB2_LOG_ERR("Error parsing ldb port qe weight devarg, must be 
< cq depth\n");
+   return -EINVAL;
+   }
+
+   for (i = first; i <= last; i++)
+   cq_weight->limit[i] = weight; /* indexed by qid */
+
+   return 0;
+}
+
 static void
 dlb2_eventdev_info_get(struct rte_eventdev *dev,
   struct rte_event_dev_info *dev_info)
@@ -1366,7 +1423,14 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2,
return -EINVAL;
 
if (dequeue_depth < DLB2_MIN_CQ_DEPTH) {
-   DLB2_LOG_ERR("dlb2: invalid enqueue_depth, must be at least 
%d\n",
+   DLB2_LOG_ERR("dlb2: invalid cq depth, must be at least %d\n",
+DLB2_MIN_CQ_DEPTH);
+   return -EINVAL;
+   }
+
+   if (dlb2->version == DLB2_HW_V2 && ev_port->cq_weight != 0 &&
+   ev_port->cq_weight > dequeue_depth) {
+   DLB2_LOG_ERR("dlb2: invalid cq depth, must be >= cq weight%d\n",
 DLB2_MIN_CQ_DEPTH);
return -EINVAL;
}
@@ -1444,8 +1508,24 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2,
if (dlb2->version == DLB2_HW_V2) {
qm_port->cached_ldb_credits = 0;
qm_port->cached_dir_credits = 0;
-   } else
+   if (ev_port->cq_weight) {
+   struct dlb2_enable_cq_weight_args cq_weight_args = {0};
+
+   cq_weight_args.port_id = qm_port->id;
+   cq_weight_args.limit = ev_port->cq_weight;
+   ret = dlb2_iface_enable_cq_weight(handle, 
&cq_weight_args);

[PATCH] event/dlb2: add ldb port specific COS support

2022-04-10 Thread Timothy McDaniel
DLB supports 4 class of service domains, to aid in managing the
device bandwidth across ldb ports. This commit allows specifying
which ldb ports will participate in the COS scheme, which class
they are a part of, and the specific bandwidth percentage
associated with each class. The cumulative bandwidth associated
with the 4 classes must not exceed 100%. This feature is enabled
on the command line, and will be documented in the DLB2 programmers
guide.

Signed-off-by: Timothy McDaniel 
---
Depends-on: patch-109560 ("[v2] event/dlb2: add CQ weight support")
---
 drivers/event/dlb2/dlb2.c  | 249 ++---
 drivers/event/dlb2/dlb2_iface.c|   3 +
 drivers/event/dlb2/dlb2_iface.h|   3 +
 drivers/event/dlb2/dlb2_priv.h |  20 +-
 drivers/event/dlb2/pf/base/dlb2_resource.c |  65 ++
 drivers/event/dlb2/pf/dlb2_pf.c|  21 +-
 6 files changed, 278 insertions(+), 83 deletions(-)

diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 9bac92c7b5..895dcb3550 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -116,6 +116,28 @@ dlb2_init_cq_weight(struct dlb2_eventdev *dlb2, int 
*cq_weight)
dlb2->ev_ports[q].cq_weight = cq_weight[q];
 }
 
+/* override defaults with value(s) provided on command line */
+static void
+dlb2_init_port_cos(struct dlb2_eventdev *dlb2, int *port_cos)
+{
+   int q;
+
+   for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++) {
+   dlb2->ev_ports[q].cos_id = port_cos[q];
+   dlb2->cos_ports[port_cos[q]]++;
+   }
+}
+
+static void
+dlb2_init_cos_bw(struct dlb2_eventdev *dlb2,
+struct dlb2_cos_bw *cos_bw)
+{
+   int q;
+   for (q = 0; q < DLB2_COS_NUM_VALS; q++)
+   dlb2->cos_bw[q] = cos_bw->val[q];
+
+}
+
 static int
 dlb2_hw_query_resources(struct dlb2_eventdev *dlb2)
 {
@@ -330,36 +352,6 @@ set_dev_id(const char *key __rte_unused,
return 0;
 }
 
-static int
-set_cos(const char *key __rte_unused,
-   const char *value,
-   void *opaque)
-{
-   enum dlb2_cos *cos_id = opaque;
-   int x = 0;
-   int ret;
-
-   if (value == NULL || opaque == NULL) {
-   DLB2_LOG_ERR("NULL pointer\n");
-   return -EINVAL;
-   }
-
-   ret = dlb2_string_to_int(&x, value);
-   if (ret < 0)
-   return ret;
-
-   if (x != DLB2_COS_DEFAULT && (x < DLB2_COS_0 || x > DLB2_COS_3)) {
-   DLB2_LOG_ERR(
-   "COS %d out of range, must be DLB2_COS_DEFAULT or 
0-3\n",
-   x);
-   return -EINVAL;
-   }
-
-   *cos_id = x;
-
-   return 0;
-}
-
 static int
 set_poll_interval(const char *key __rte_unused,
const char *value,
@@ -603,6 +595,80 @@ set_cq_weight(const char *key __rte_unused,
return 0;
 }
 
+static int
+set_port_cos(const char *key __rte_unused,
+const char *value,
+void *opaque)
+{
+   struct dlb2_port_cos *port_cos = opaque;
+   int first, last, cos_id, i;
+
+   if (value == NULL || opaque == NULL) {
+   DLB2_LOG_ERR("NULL pointer\n");
+   return -EINVAL;
+   }
+
+   /* command line override may take one of the following 3 forms:
+* port_cos=all: ... all ports
+* port_cos=port-port: ... a range of ports
+* port_cos=port: ... just one port
+*/
+   if (sscanf(value, "all:%d", &cos_id) == 1) {
+   first = 0;
+   last = DLB2_MAX_NUM_LDB_PORTS - 1;
+   } else if (sscanf(value, "%d-%d:%d", &first, &last, &cos_id) == 3) {
+   /* we have everything we need */
+   } else if (sscanf(value, "%d:%d", &first, &cos_id) == 2) {
+   last = first;
+   } else {
+   DLB2_LOG_ERR("Error parsing ldb port port_cos devarg. Should be 
all:val, port-port:val, or port:val\n");
+   return -EINVAL;
+   }
+
+   if (first > last || first < 0 ||
+   last >= DLB2_MAX_NUM_LDB_PORTS) {
+   DLB2_LOG_ERR("Error parsing ldb port cos_id arg, invalid port 
value\n");
+   return -EINVAL;
+   }
+
+   if (cos_id < DLB2_COS_0 || cos_id > DLB2_COS_3) {
+   DLB2_LOG_ERR("Error parsing ldb port cos_id devarg, must be 
between 0 and 4\n");
+   return -EINVAL;
+   }
+
+   for (i = first; i <= last; i++)
+   port_cos->cos_id[i] = cos_id; /* indexed by port */
+
+   return 0;
+}
+
+static int
+set_cos_bw(const char *key __rte_unused,
+const char *value,
+void *opaque)
+{
+   struct dlb2_cos_bw *cos_bw = opaque;
+
+   if (opaque == NULL) {
+   DLB2_LOG_ERR("NULL pointer\n");
+   return -EINVAL;
+   }
+
+   /* format must be %d,%d,%d,%d */
+
+   if (sscanf(value, "%d,%d,%d,%d", &cos_bw->val[0], &cos_bw->val[1],
+  &cos_bw->val[2], &cos_bw->val[3

Re: 21.11.1 patches review and test

2022-04-10 Thread Pei Zhang
cc Yanghang Liu from RedHat, he will do this testing soon :)

Best regards,

Pei

On Fri, Apr 1, 2022 at 6:22 PM Kevin Traynor  wrote:

> Hi all,
>
> Here is a list of patches targeted for stable release 21.11.1.
>
> Please try and complete validation by April 13th.
>
> Please help with testing and validation of your use cases and report
> any issues/results with reply-all to this mail. For the final release
> the fixes and reported validations will be added to the release notes.
>
> A release candidate tarball can be found at:
>
> https://dpdk.org/browse/dpdk-stable/tag/?id=v21.11.1-rc1
>
> These patches are located at branch 21.11 of dpdk-stable repo:
> https://dpdk.org/browse/dpdk-stable/
>
> Thanks.
>
> Kevin
>
> ---
> Adham Masarwah (2):
>   net/mlx5: fix destroying empty matchers list
>   app/testpmd: fix show RSS RETA on Windows
>
> Ajit Khaparde (7):
>   net/bnxt: fix ring teardown
>   net/bnxt: fix PAM4 mask setting
>   net/bnxt: fix crash by validating pointer
>   net/bnxt: check VF representor pointer before access
>   net/bnxt: fix VF resource allocation strategy
>   net/bnxt: set HW coalescing parameters
>   net/bnxt: fix ring calculation for representors
>
> Alexander Kozyrev (4):
>   net/mlx5: fix maximum packet headers size for TSO
>   net/mlx5: fix MPRQ WQE size assertion
>   net/mlx5: fix committed bucket size
>   net/mlx5: fix meter capabilities reporting
>
> Ali Alnubani (1):
>   doc: fix typos and punctuation in flow API guide
>
> Anatoly Burakov (1):
>   net/qede: fix redundant condition in debug code
>
> Andy Pei (1):
>   vdpa/ifc: fix log info mismatch
>
> Ankur Dwivedi (1):
>   common/cnxk: fix NPC key extraction validation
>
> Anoob Joseph (4):
>   common/cnxk: fix reset of fields
>   crypto/cnxk: fix inflight count calculation
>   crypto/cnxk: fix extend tail calculation
>   crypto/cnxk: fix update of number of descriptors
>
> Arek Kusztal (1):
>   cryptodev: fix RSA key type name
>
> Asaf Ravid (1):
>   net/cnxk: fix promiscuous mode in multicast enable flow
>
> Ashwin Sekhar T K (1):
>   mempool/cnxk: fix batch allocation failure path
>
> Bin Zheng (1):
>   net/ixgbe: add vector Rx parameter check
>
> Bing Zhao (5):
>   common/mlx5: fix probing failure code
>   app/testpmd: fix raw encap of GENEVE option
>   net/mlx5: fix matcher priority with ICMP or ICMPv6
>   net/mlx5: remove unused reference counter
>   net/mlx5: fix configuration without Rx queue
>
> Brian Dooley (13):
>   eal: add missing C++ guards
>   telemetry: add missing C++ guards
>   ethdev: add missing C++ guards
>   metrics: add missing C++ guards
>   acl: add missing C++ guards
>   compressdev: add missing C++ guards
>   eventdev: add missing C++ guards
>   kni: add missing C++ guards
>   vhost: add missing C++ guards
>   bpf: add missing C++ guards
>   cryptodev: add missing C++ guards
>   examples/l2fwd-crypto: fix port mask overflow
>   crypto/virtio: fix out-of-bounds access
>
> Bruce Richardson (23):
>   doc: remove dependency on findutils on FreeBSD
>   dma/idxd: fix burst capacity calculation
>   dma/idxd: fix paths to driver sysfs directory
>   dma/idxd: fix wrap-around in burst capacity calculation
>   build: fix warnings when running external commands
>   build: remove deprecated Meson functions
>   eal: fix C++ include
>   eventdev: fix C++ include
>   graph: fix C++ include
>   ipsec: fix C++ include
>   table: fix C++ include
>   vhost: fix C++ include
>   ethdev: fix cast for C++ compatibility
>   test/dma: fix missing checks for device capacity
>   dma/idxd: configure maximum batch size to high value
>   doc: improve configuration examples in idxd guide
>   distributor: fix potential overflow
>   eal/freebsd: add missing C++ include guards
>   compressdev: fix missing space in log macro
>   cryptodev: fix clang C++ include
>   eventdev: fix clang C++ include
>   doc: replace characters for (R) symbol in Linux guide
>   doc: fix missing note on UIO module in Linux guide
>
> Chandubabu Namburu (1):
>   net/axgbe: use PCI root complex device to distinguish device
>
> Chenbo Xia (1):
>   vhost: fix queue number check when setting inflight FD
>
> Chengchang Tang (1):
>   net/bonding: fix offloading configuration
>
> Chengwen Feng (2):
>   net/hns3: delete duplicated RSS type
>   dma/hisilicon: use common PCI device naming
>
> Chuanshe Zhang (1):
>   examples/flow_classify: fix failure message
>
> Ciara Loftus (2):
>   net/af_xdp: fix build with -Wunused-function
>   net/af_xdp: ensure socket is deleted on Rx queue setup error
>
> Ciara Power (4):
>   crypto/ipsec_mb: fix queue setup null pointer dereference
>   crypto/ipsec_mb: fix queue cleanup null pointer dereference
>   crypto/ipsec_mb: f

RE: [PATCH] net/bonding: fix rss key configuration when the key length is 52

2022-04-10 Thread Zhang, Ke1X



> -Original Message-
> From: Min Hu (Connor) 
> Sent: Friday, April 8, 2022 10:33 AM
> To: Zhang, Ke1X ; ch...@att.com; dev@dpdk.org
> Subject: Re: [PATCH] net/bonding: fix rss key configuration when the key
> length is 52
> 
> Hi,
> 
> 在 2022/4/7 17:36, Ke Zhang 写道:
> > when creating a bonding device, if the slave device's rss key length
> > is 52, then bonding device will be same as slave, in function
> > bond_ethdev_configure(), the default_rss_key length is 40, it is not
> > matched, so it should calculate a new key for bonding device if the
> > deault key could not be used.
> wrong spelling.

This is a coding waring as below:
 
 _coding style issues_
 
WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'?
#64:
when creating a bonding device, if the slave device's rss key length

WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'?
#65:
 is 52, then bonding device will be same as slave, in function

total: 0 errors, 2 warnings, 0 checks, 19 lines checked

the 'slave' is correct, for exsample, testpmd cmd:
add bonding slave 0 2

> >
> > Signed-off-by: Ke Zhang 
> > ---
> >   drivers/net/bonding/rte_eth_bond_pmd.c | 12 ++--
> >   1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c
> > b/drivers/net/bonding/rte_eth_bond_pmd.c
> > index b305b6a35b..4214b33f40 100644
> > --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> > @@ -3617,13 +3617,13 @@ bond_ethdev_configure(struct rte_eth_dev
> *dev)
> >internals->rss_key_len);
> > } else {
> > if (internals->rss_key_len > sizeof(default_rss_key))
> {
> > -   RTE_BOND_LOG(ERR,
> > -  "There is no suitable default hash key");
> > -   return -EINVAL;
> > +   /* If the rss_key_len is 52, it should calculate
> the hash key */
> I think the comment should be more common, no need to emphysize '52'.
> > +   for (i = 0; i < internals->rss_key_len; i++)
> > +   internals->rss_key[i] =
> (uint8_t)rte_rand();
> > +   } else {
> > +   memcpy(internals->rss_key, default_rss_key,
> > +   internals->rss_key_len);
> > }
> > -
> > -   memcpy(internals->rss_key, default_rss_key,
> > -  internals->rss_key_len);
> > }
> >
> > for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
> >


[PATCH v2 1/1] net/bonding: fix rss key configuration when the key length is 52

2022-04-10 Thread Ke Zhang
when creating a bonding device, if the slave device's rss key length
is 52, then bonding device will be same as slave, in function
bond_ethdev_configure(), the default_rss_key length is 40, it
is not matched, so it should calculate a new key for bonding
device if the deault key could not be used.

Signed-off-by: Ke Zhang 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index b305b6a35b..027339b0d9 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3617,13 +3617,18 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
   internals->rss_key_len);
} else {
if (internals->rss_key_len > sizeof(default_rss_key)) {
-   RTE_BOND_LOG(ERR,
-  "There is no suitable default hash key");
-   return -EINVAL;
+   /*
+* If the rss_key includes standard_rss_key and
+* extended_hash_key, the rss key length will
+* larger than default rss key length, so it 
should
+* re-calculate the hash key
+*/
+   for (i = 0; i < internals->rss_key_len; i++)
+   internals->rss_key[i] = 
(uint8_t)rte_rand();
+   } else {
+   memcpy(internals->rss_key, default_rss_key,
+   internals->rss_key_len);
}
-
-   memcpy(internals->rss_key, default_rss_key,
-  internals->rss_key_len);
}
 
for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
-- 
2.25.1



[PATCH v6] ip_frag: add IPv4 options fragment and test data

2022-04-10 Thread Huichao Cai
According to RFC791,the options may appear or not in datagrams.
They must be implemented by all IP modules (host and gateways).
What is optional is their transmission in any particular datagram,
not their implementation.So we have to deal with it during the
fragmenting process.Add some test data for the IPv4 header optional
field fragmenting.

Signed-off-by: Huichao Cai 
---
 app/test/test_ipfrag.c   | 219 ---
 lib/ip_frag/rte_ip_frag.h|   6 +
 lib/ip_frag/rte_ipv4_fragmentation.c |  70 ++-
 3 files changed, 272 insertions(+), 23 deletions(-)

diff --git a/app/test/test_ipfrag.c b/app/test/test_ipfrag.c
index 1ced25a..8289a60 100644
--- a/app/test/test_ipfrag.c
+++ b/app/test/test_ipfrag.c
@@ -18,10 +18,50 @@
 #define NUM_MBUFS 128
 #define BURST 32
 
+uint8_t expected_first_frag_ipv4_opts_copied[] = {
+   0x07, 0x0b, 0x04, 0x00,
+   0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x83,
+   0x07, 0x04, 0xc0, 0xa8,
+   0xe3, 0x96, 0x00, 0x00,
+};
+
+uint8_t expected_sub_frag_ipv4_opts_copied[] = {
+   0x83, 0x07, 0x04, 0xc0,
+   0xa8, 0xe3, 0x96, 0x00,
+};
+
+uint8_t expected_first_frag_ipv4_opts_nocopied[] = {
+   0x07, 0x0b, 0x04, 0x00,
+   0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00,
+};
+
+uint8_t expected_sub_frag_ipv4_opts_nocopied[0];
+
+struct test_opt_data {
+   bool is_first_frag;  /**< offset is 0 */
+   bool opt_copied; /**< ip option copied flag */
+   uint16_t len;/**< option data len */
+   uint8_t data[RTE_IPV4_IPOPT_MAX_LEN]; /**< option data */
+};
+
 static struct rte_mempool *pkt_pool,
  *direct_pool,
  *indirect_pool;
 
+static inline void
+hex_to_str(uint8_t *hex, uint16_t len, char *str)
+{
+   int i;
+
+   for (i = 0; i < len; i++) {
+   sprintf(str, "%02x", hex[i]);
+   str += 2;
+   }
+   *str = 0;
+}
+
 static int
 setup_buf_pool(void)
 {
@@ -88,23 +128,67 @@ static void ut_teardown(void)
 {
 }
 
+static inline void
+test_get_ipv4_opt(bool is_first_frag, bool opt_copied,
+   struct test_opt_data *expected_opt)
+{
+   if (is_first_frag) {
+   if (opt_copied) {
+   expected_opt->len =
+   sizeof(expected_first_frag_ipv4_opts_copied);
+   rte_memcpy(expected_opt->data,
+   expected_first_frag_ipv4_opts_copied,
+   sizeof(expected_first_frag_ipv4_opts_copied));
+   } else {
+   expected_opt->len =
+   sizeof(expected_first_frag_ipv4_opts_nocopied);
+   rte_memcpy(expected_opt->data,
+   expected_first_frag_ipv4_opts_nocopied,
+   sizeof(expected_first_frag_ipv4_opts_nocopied));
+   }
+   } else {
+   if (opt_copied) {
+   expected_opt->len =
+   sizeof(expected_sub_frag_ipv4_opts_copied);
+   rte_memcpy(expected_opt->data,
+   expected_sub_frag_ipv4_opts_copied,
+   sizeof(expected_sub_frag_ipv4_opts_copied));
+   } else {
+   expected_opt->len =
+   sizeof(expected_sub_frag_ipv4_opts_nocopied);
+   rte_memcpy(expected_opt->data,
+   expected_sub_frag_ipv4_opts_nocopied,
+   sizeof(expected_sub_frag_ipv4_opts_nocopied));
+   }
+   }
+}
+
 static void
-v4_allocate_packet_of(struct rte_mbuf *b, int fill,
- size_t s, int df, uint8_t mf, uint16_t off,
- uint8_t ttl, uint8_t proto, uint16_t pktid)
+v4_allocate_packet_of(struct rte_mbuf *b, int fill, size_t s,
+   int df, uint8_t mf, uint16_t off, uint8_t ttl, uint8_t proto,
+   uint16_t pktid, bool have_opt, bool is_first_frag, bool opt_copied)
 {
/* Create a packet, 2k bytes long */
b->data_off = 0;
char *data = rte_pktmbuf_mtod(b, char *);
-   rte_be16_t fragment_offset = 0; /**< fragmentation offset */
+   rte_be16_t fragment_offset = 0; /* fragmentation offset */
+   uint16_t iph_len;
+   struct test_opt_data opt;
+
+   opt.len = 0;
+
+   if (have_opt)
+   test_get_ipv4_opt(is_first_frag, opt_copied, &opt);
 
-   memset(data, fill, sizeof(struct rte_ipv4_hdr) + s);
+   iph_len = sizeof(struct rte_ipv4_hdr) + opt.len;
+   memset(data, fill, iph_len + s);
 
struct rte_ipv4_hdr *hdr = (struct rte_ipv4_hdr *)data;
 
-   hdr->version_ihl = 0x45; /* standard IP header... */
+   hdr->version_ihl = 0x40; /* ipv4 */
+   hdr->version_ihl += (iph_len / 4);
hdr->type_of_ser

[PATCH] vhost: support sync copy when data buffer is small

2022-04-10 Thread Wenwu Ma
In async datapath, if the length of data buffer
is less than 256, the data will be copied by CPU
instead of DMA.

Signed-off-by: Wenwu Ma 
---
 lib/vhost/vhost.h  |  6 ++-
 lib/vhost/virtio_net.c | 96 ++
 2 files changed, 73 insertions(+), 29 deletions(-)

diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h
index 9209558465..d0da53aa46 100644
--- a/lib/vhost/vhost.h
+++ b/lib/vhost/vhost.h
@@ -125,8 +125,10 @@ struct vring_used_elem_packed {
  * iovec
  */
 struct vhost_iovec {
-   void *src_addr;
-   void *dst_addr;
+   void *src_io_addr;
+   void *dst_io_addr;
+   void *src_virt_addr;
+   void *dst_virt_addr;
size_t len;
 };
 
diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 3085905d17..46f35ac05f 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -26,6 +26,8 @@
 
 #define MAX_BATCH_LEN 256
 
+#define CPU_COPY_THRESHOLD_LEN 256
+
 /* DMA device copy operation tracking array. */
 struct async_dma_info dma_copy_track[RTE_DMADEV_DEFAULT_MAX];
 
@@ -61,28 +63,37 @@ vhost_async_dma_transfer_one(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
int copy_idx = 0;
uint32_t nr_segs = pkt->nr_segs;
uint16_t i;
+   bool is_cpu_copy = true;
 
if (rte_dma_burst_capacity(dma_id, vchan_id) < nr_segs)
return -1;
 
for (i = 0; i < nr_segs; i++) {
-   copy_idx = rte_dma_copy(dma_id, vchan_id, 
(rte_iova_t)iov[i].src_addr,
-   (rte_iova_t)iov[i].dst_addr, iov[i].len, 
RTE_DMA_OP_FLAG_LLC);
-   /**
-* Since all memory is pinned and DMA vChannel
-* ring has enough space, failure should be a
-* rare case. If failure happens, it means DMA
-* device encounters serious errors; in this
-* case, please stop async data-path and check
-* what has happened to DMA device.
-*/
-   if (unlikely(copy_idx < 0)) {
-   if (!vhost_async_dma_copy_log) {
-   VHOST_LOG_DATA(ERR, "(%s) DMA copy failed for 
channel %d:%u\n",
+   if (iov[i].len > CPU_COPY_THRESHOLD_LEN) {
+   copy_idx = rte_dma_copy(dma_id, vchan_id,
+   (rte_iova_t)iov[i].src_io_addr,
+   (rte_iova_t)iov[i].dst_io_addr,
+   iov[i].len, RTE_DMA_OP_FLAG_LLC);
+   /**
+* Since all memory is pinned and DMA vChannel
+* ring has enough space, failure should be a
+* rare case. If failure happens, it means DMA
+* device encounters serious errors; in this
+* case, please stop async data-path and check
+* what has happened to DMA device.
+*/
+   if (unlikely(copy_idx < 0)) {
+   if (!vhost_async_dma_copy_log) {
+   VHOST_LOG_DATA(ERR,
+   "(%s) DMA copy failed for 
channel %d:%u\n",
dev->ifname, dma_id, vchan_id);
-   vhost_async_dma_copy_log = true;
+   vhost_async_dma_copy_log = true;
+   }
+   return -1;
}
-   return -1;
+   is_cpu_copy = false;
+   } else {
+   rte_memcpy(iov[i].dst_virt_addr, iov[i].src_virt_addr, 
iov[i].len);
}
}
 
@@ -90,7 +101,13 @@ vhost_async_dma_transfer_one(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
 * Only store packet completion flag address in the last copy's
 * slot, and other slots are set to NULL.
 */
-   dma_info->pkts_cmpl_flag_addr[copy_idx & ring_mask] = 
&vq->async->pkts_cmpl_flag[flag_idx];
+   if (is_cpu_copy == false) {
+   dma_info->pkts_cmpl_flag_addr[copy_idx & ring_mask] =
+   &vq->async->pkts_cmpl_flag[flag_idx];
+   } else {
+   vq->async->pkts_cmpl_flag[flag_idx] = true;
+   nr_segs = 0;
+   }
 
return nr_segs;
 }
@@ -123,6 +140,19 @@ vhost_async_dma_transfer(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
 
rte_spinlock_unlock(&dma_info->dma_lock);
 
+   if (unlikely(ret < 0 && pkt_idx > 0)) {
+   do {
+   head_idx = (head_idx == 0) ? vq->size : head_idx - 1;
+   if (vq->async->pkts_cmpl_flag[head_idx] == false)
+   break;
+
+   pkt_idx--;
+   vq->async->pkts_cmpl_flag[head

[PATCH v3 1/1] net/bonding: fix rss key configuration when the key length is 52

2022-04-10 Thread Ke Zhang
when creating a bonding device, if the slave device's rss key length
= standard_rss_key length + extended_hash_key length, then bonding
device will be same as slave, in function bond_ethdev_configure(),
the default_rss_key length is 40, it is not matched, so it should
calculate a new key for bonding device if the default key could not
be used.

Signed-off-by: Ke Zhang 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index b305b6a35b..5cbe89031b 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3617,13 +3617,18 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
   internals->rss_key_len);
} else {
if (internals->rss_key_len > sizeof(default_rss_key)) {
-   RTE_BOND_LOG(ERR,
-  "There is no suitable default hash key");
-   return -EINVAL;
+   /*
+* If the rss_key includes standard_rss_key and
+* extended_hash_key, the rss key length will be
+* larger than default rss key length, so it 
should
+* re-calculate the hash key.
+*/
+   for (i = 0; i < internals->rss_key_len; i++)
+   internals->rss_key[i] = 
(uint8_t)rte_rand();
+   } else {
+   memcpy(internals->rss_key, default_rss_key,
+   internals->rss_key_len);
}
-
-   memcpy(internals->rss_key, default_rss_key,
-  internals->rss_key_len);
}
 
for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
-- 
2.25.1



Re: 21.11.1 patches review and test

2022-04-10 Thread Christian Ehrhardt
On Fri, Apr 1, 2022 at 12:22 PM Kevin Traynor  wrote:
>
> Hi all,
>
> Here is a list of patches targeted for stable release 21.11.1.

Hi Kevin,
this breaks on me at build time due to symbol changes.
It is a wild mix of Base->Internal/Experimental, a few new symbols,
and even just removed ones (in gpu which is experimental, but still
would that need a minor soname bump?).
They might be intentional, but it felt too much to me without at least
discussing it.
Could you have a look if you think that they are all intentional, save
and correct for an LTS release?

dpkg-gensymbols: warning: some new symbols appeared in the symbols
file: see diff output below
dpkg-gensymbols: warning: debian/librte-common-cnxk22/DEBIAN/symbols
doesn't match completely debian/librte-common-cnxk22.symbols
--- debian/librte-common-cnxk22.symbols
(librte-common-cnxk22_21.11.1~rc1-0ubuntu1~jammyppa2_amd64)
+++ dpkg-gensymbolsUuRb8d 2022-04-11 06:46:22.276766813 +
@@ -197,6 +197,7 @@
  roc_nix_ptp_clock_read@INTERNAL 21.08
  roc_nix_ptp_info_cb_register@INTERNAL 21.08
  roc_nix_ptp_info_cb_unregister@INTERNAL 21.08
+ roc_nix_ptp_is_enable@INTERNAL 21.11.1~rc1-0ubuntu1~jammyppa2
  roc_nix_ptp_rx_ena_dis@INTERNAL 21.08
  roc_nix_ptp_sync_time_adjust@INTERNAL 21.08
  roc_nix_ptp_tx_ena_dis@INTERNAL 21.08

dpkg-gensymbols: warning: some new symbols appeared in the symbols
file: see diff output below
dpkg-gensymbols: warning: debian/librte-ethdev22/DEBIAN/symbols
doesn't match completely debian/librte-ethdev22.symbols
--- debian/librte-ethdev22.symbols
(librte-ethdev22_21.11.1~rc1-0ubuntu1~jammyppa2_amd64)
+++ dpkg-gensymbolskEnokB 2022-04-11 06:46:25.252795157 +
@@ -37,6 +37,7 @@
  rte_eth_dev_flow_ctrl_get@DPDK_22 21.11
  rte_eth_dev_flow_ctrl_set@DPDK_22 21.11
  rte_eth_dev_fw_version_get@DPDK_22 21.11
+ rte_eth_dev_get_by_name@INTERNAL 21.11.1~rc1-0ubuntu1~jammyppa2
  rte_eth_dev_get_dcb_info@DPDK_22 21.11
  rte_eth_dev_get_eeprom@DPDK_22 21.11
  rte_eth_dev_get_eeprom_length@DPDK_22 21.11

dpkg-gensymbols: warning: some new symbols appeared in the symbols
file: see diff output below
dpkg-gensymbols: error: some symbols or patterns disappeared in the
symbols file: see diff output below
dpkg-gensymbols: warning: debian/librte-regexdev22/DEBIAN/symbols
doesn't match completely debian/librte-regexdev22.symbols
--- debian/librte-regexdev22.symbols
(librte-regexdev22_21.11.1~rc1-0ubuntu1~jammyppa2_amd64)
+++ dpkg-gensymbolsPD0Ygo 2022-04-11 06:46:33.368872490 +
@@ -1,6 +1,8 @@
 librte_regexdev.so.22 librte-regexdev22 #MINVER#
  EXPERIMENTAL@EXPERIMENTAL 20.11
- rte_regex_devices@Base 20.11
+ INTERNAL@INTERNAL 21.11.1~rc1-0ubuntu1~jammyppa2
+ rte_regex_devices@EXPERIMENTAL 21.11.1~rc1-0ubuntu1~jammyppa2
  rte_regexdev_attr_get@EXPERIMENTAL 20.11
  rte_regexdev_attr_set@EXPERIMENTAL 20.11
  rte_regexdev_close@EXPERIMENTAL 20.11
@@ -8,12 +10,16 @@
  rte_regexdev_count@EXPERIMENTAL 20.11
  rte_regexdev_dump@EXPERIMENTAL 20.11
  rte_regexdev_get_dev_id@EXPERIMENTAL 20.11
- rte_regexdev_get_device_by_name@Base 20.11
+ rte_regexdev_get_device_by_name@INTERNAL 21.11.1~rc1-0ubuntu1~jammyppa2
  rte_regexdev_info_get@EXPERIMENTAL 20.11
- rte_regexdev_is_valid_dev@Base 20.11
- rte_regexdev_logtype@Base 20.11
+ rte_regexdev_is_valid_dev@EXPERIMENTAL 21.11.1~rc1-0ubuntu1~jammyppa2
+ rte_regexdev_logtype@EXPERIMENTAL 21.11.1~rc1-0ubuntu1~jammyppa2
  rte_regexdev_queue_pair_setup@EXPERIMENTAL 20.11
- rte_regexdev_register@Base 20.11
+ rte_regexdev_register@INTERNAL 21.11.1~rc1-0ubuntu1~jammyppa2
  rte_regexdev_rule_db_compile_activate@EXPERIMENTAL 20.11
  rte_regexdev_rule_db_export@EXPERIMENTAL 20.11
  rte_regexdev_rule_db_import@EXPERIMENTAL 20.11
@@ -21,7 +27,8 @@
  rte_regexdev_selftest@EXPERIMENTAL 20.11
  rte_regexdev_start@EXPERIMENTAL 20.11
  rte_regexdev_stop@EXPERIMENTAL 20.11
- rte_regexdev_unregister@Base 20.11
+ rte_regexdev_unregister@INTERNAL 21.11.1~rc1-0ubuntu1~jammyppa2
  rte_regexdev_xstats_by_name_get@EXPERIMENTAL 20.11
  rte_regexdev_xstats_get@EXPERIMENTAL 20.11
  rte_regexdev_xstats_names_get@EXPERIMENTAL 20.11

dpkg-gensymbols: error: some symbols or patterns disappeared in the
symbols file: see diff output below
dpkg-gensymbols: warning: debian/librte-gpudev22/DEBIAN/symbols
doesn't match completely debian/librte-gpudev22.symbols
--- debian/librte-gpudev22.symbols
(librte-gpudev22_21.11.1~rc1-0ubuntu1~jammyppa2_amd64)
+++ dpkg-gensymbols4qkXdt 2022-04-11 06:46:34.552883776 +
@@ -1,7 +1,7 @@
 librte_gpudev.so.22 librte-gpudev22 #MINVER#
  EXPERIMENTAL@EXPERIMENTAL 21.11
  INTERNAL@INTERNAL 21.11
- gpu_logtype@Base 21.11
  rte_gpu_add_child@EXPERIMENTAL 21.11
  rte_gpu_allocate@INTERNAL 21.11
  rte_gpu_attach@INTERNAL 21.11


Full log:
https://launchpadlibrarian.net/596047842/buildlog_ubuntu-jammy-amd64.dpdk_21.11.1~rc1-0ubuntu1~jammyppa2_BUILDING.txt.gz

> Please try and complete validation by April 13th.
>
> Please help with testing and validation of your use cases and report
> any issues/results with reply-all to this