DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/7] common/mlx5: fix code arrangement in tag allocation
@ 2020-06-24 11:33 Michael Baum
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 2/7] net/mlx5: use direct API to find port by device Michael Baum
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Michael Baum @ 2020-06-24 11:33 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo, stable

Flow tag action is supported only when the driver has DR or DV support.
The tag allocation is adjusted to the modes DV or DR.

In case both DR and DV are not supported in the system, the driver
handles static code for error report.
This error code, wrongly, was compiled when DV is supported while in
this case it cannot be accessed at all.

Ignore the aforementioned static error code in case of DV by
preprocessor commands rearrangement.

Fixes: cbb66daa3c85 ("net/mlx5: prepare Direct Verbs for Direct Rule")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/common/mlx5/linux/mlx5_glue.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c
index c91ee33..a41650d 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.c
+++ b/drivers/common/mlx5/linux/mlx5_glue.c
@@ -752,7 +752,7 @@
 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
 #ifdef HAVE_MLX5DV_DR
 	return mlx5dv_dr_action_create_tag(tag);
-#else
+#else /* HAVE_MLX5DV_DR */
 	struct mlx5dv_flow_action_attr *action;
 	action = malloc(sizeof(*action));
 	if (!action)
@@ -760,11 +760,12 @@
 	action->type = MLX5DV_FLOW_ACTION_TAG;
 	action->tag_value = tag;
 	return action;
-#endif
-#endif
+#endif /* HAVE_MLX5DV_DR */
+#else /* HAVE_IBV_FLOW_DV_SUPPORT */
 	(void)tag;
 	errno = ENOTSUP;
 	return NULL;
+#endif /* HAVE_IBV_FLOW_DV_SUPPORT */
 }
 
 static void *
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 2/7] net/mlx5: use direct API to find port by device
  2020-06-24 11:33 [dpdk-dev] [PATCH 1/7] common/mlx5: fix code arrangement in tag allocation Michael Baum
@ 2020-06-24 11:33 ` Michael Baum
  2020-06-28 13:55   ` Raslan Darawsheh
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 3/7] net/mlx5: fix iterator type in Rx queue management Michael Baum
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Michael Baum @ 2020-06-24 11:33 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo

Using RTE_ETH_FOREACH_DEV_OF loop is not necessary when the driver wants
to find only the first match.

Use rte_eth_find_next_of to find it.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5_mr.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index adbe07c..3b781b6 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -313,9 +313,10 @@ struct mr_update_mp_data {
 {
 	uint16_t port_id;
 
-	RTE_ETH_FOREACH_DEV_OF(port_id, &pdev->device)
-		return &rte_eth_devices[port_id];
-	return NULL;
+	port_id = rte_eth_find_next_of(0, &pdev->device);
+	if (port_id == RTE_MAX_ETHPORTS)
+		return NULL;
+	return &rte_eth_devices[port_id];
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 3/7] net/mlx5: fix iterator type in Rx queue management
  2020-06-24 11:33 [dpdk-dev] [PATCH 1/7] common/mlx5: fix code arrangement in tag allocation Michael Baum
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 2/7] net/mlx5: use direct API to find port by device Michael Baum
@ 2020-06-24 11:33 ` Michael Baum
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 4/7] net/mlx4: use anonymous DV allocator argument Michael Baum
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Baum @ 2020-06-24 11:33 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo, stable

The mlx5_check_vec_rx_support function in the mlx5_rxtx_vec.c file
passes the RX queues array in the loop. Similarly, the mlx5_mprq_enabled
function in the mlx5_rxq.c file passes the RX queues array in the loop.

In both cases, the iterator of the loop is called i and the variable
representing the array size is called rxqs_n.
The i variable is of UINT16_T type while the rxqs_n variable is of
unsigned int type. The size of the rxqs_n variable is much larger than
the number of iterations allowed by the i type, theoretically there may
be a situation where the value of the rxqs_n will be greater than can be
represented by 16 bits and the loop will never end.

Change the type of i to UINT32_T.

Fixes: 7d6bf6b866b8 ("net/mlx5: add Multi-Packet Rx support")
Fixes: 6cb559d67b83 ("net/mlx5: add vectorized Rx/Tx burst for x86")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxq.c      | 2 +-
 drivers/net/mlx5/mlx5_rxtx_vec.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index bd0037b..b436f06 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -108,7 +108,7 @@
 mlx5_mprq_enabled(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
-	uint16_t i;
+	uint32_t i;
 	uint16_t n = 0;
 	uint16_t n_ibv = 0;
 
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c
index b38bd20..7fae201 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.c
@@ -156,7 +156,7 @@
 mlx5_check_vec_rx_support(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
-	uint16_t i;
+	uint32_t i;
 
 	if (!priv->config.rx_vec_en)
 		return -ENOTSUP;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 4/7] net/mlx4: use anonymous DV allocator argument
  2020-06-24 11:33 [dpdk-dev] [PATCH 1/7] common/mlx5: fix code arrangement in tag allocation Michael Baum
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 2/7] net/mlx5: use direct API to find port by device Michael Baum
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 3/7] net/mlx5: fix iterator type in Rx queue management Michael Baum
@ 2020-06-24 11:33 ` Michael Baum
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 5/7] net/mlx4: remove useless assignment Michael Baum
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Baum @ 2020-06-24 11:33 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo

The mlx4_pci_probe function defines an struct mlx4dv_ctx_allocators type
variable several hundred rows after it starts, with the only use it
being passed as a parameter to the mlx4_glue->dv_set_context_attr
function.
However, according to DPDK Coding Style Guidelines, variables should be
declared at the start of a block of code rather than in the middle.
Therefore, to improve the Coding Style, the variable is passed directly
to the function without declaring it before.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx4/mlx4.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 5d72027..ff270b4 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -1054,14 +1054,13 @@ struct mlx4_conf {
 		eth_dev->dev_ops = &mlx4_dev_ops;
 #ifdef HAVE_IBV_MLX4_BUF_ALLOCATORS
 		/* Hint libmlx4 to use PMD allocator for data plane resources */
-		struct mlx4dv_ctx_allocators alctr = {
-			.alloc = &mlx4_alloc_verbs_buf,
-			.free = &mlx4_free_verbs_buf,
-			.data = priv,
-		};
 		err = mlx4_glue->dv_set_context_attr
 			(ctx, MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS,
-			 (void *)((uintptr_t)&alctr));
+			 (void *)((uintptr_t)&(struct mlx4dv_ctx_allocators){
+				 .alloc = &mlx4_alloc_verbs_buf,
+				 .free = &mlx4_free_verbs_buf,
+				 .data = priv,
+			}));
 		if (err)
 			WARN("Verbs external allocator is not supported");
 		else
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 5/7] net/mlx4: remove useless assignment
  2020-06-24 11:33 [dpdk-dev] [PATCH 1/7] common/mlx5: fix code arrangement in tag allocation Michael Baum
                   ` (2 preceding siblings ...)
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 4/7] net/mlx4: use anonymous DV allocator argument Michael Baum
@ 2020-06-24 11:33 ` Michael Baum
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 6/7] common/mlx5: " Michael Baum
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 7/7] net/mlx5: use anonymous DV allocator argument Michael Baum
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Baum @ 2020-06-24 11:33 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo

The mlx4_ibv_device_to_pci_addr function defines a variable called ret
inside a loop and uses it.

During the loop, the function assigns a value within the variable and
breaks from the loop, so that this assigning has done nothing and is
actually unnecessary.

Remove the unnecessary assigning.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx4/mlx4.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index ff270b4..1657ea3 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -492,7 +492,6 @@ struct mlx4_conf {
 			   &pci_addr->bus,
 			   &pci_addr->devid,
 			   &pci_addr->function) == 4) {
-			ret = 0;
 			break;
 		}
 	}
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 6/7] common/mlx5: remove useless assignment
  2020-06-24 11:33 [dpdk-dev] [PATCH 1/7] common/mlx5: fix code arrangement in tag allocation Michael Baum
                   ` (3 preceding siblings ...)
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 5/7] net/mlx4: remove useless assignment Michael Baum
@ 2020-06-24 11:33 ` Michael Baum
  2020-06-29  8:44   ` Raslan Darawsheh
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 7/7] net/mlx5: use anonymous DV allocator argument Michael Baum
  5 siblings, 1 reply; 9+ messages in thread
From: Michael Baum @ 2020-06-24 11:33 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo

The mlx5_dev_to_pci_addr function defines a variable called ret inside a
loop and uses it.

During the loop, the function assigns a value within the variable and
breaks from the loop, so that this assigning has done nothing and is
actually unnecessary.

Remove the unnecessary assigning.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/common/mlx5/linux/mlx5_common_os.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c
index e422e95..e74aa89 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -66,7 +66,6 @@
 			   &pci_addr->bus,
 			   &pci_addr->devid,
 			   &pci_addr->function) == 4) {
-			ret = 0;
 			break;
 		}
 	}
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 7/7] net/mlx5: use anonymous DV allocator argument
  2020-06-24 11:33 [dpdk-dev] [PATCH 1/7] common/mlx5: fix code arrangement in tag allocation Michael Baum
                   ` (4 preceding siblings ...)
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 6/7] common/mlx5: " Michael Baum
@ 2020-06-24 11:33 ` Michael Baum
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Baum @ 2020-06-24 11:33 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo

The mlx5_dev_spawn function defines an struct mlx5dv_ctx_allocators type
variable several hundred rows after it starts, with the only use it
being passed as a parameter to the mlx5_glue->dv_set_context_attr
function.
However, according to DPDK Coding Style Guidelines, variables should be
declared at the start of a block of code rather than in the middle.
Therefore, to improve the Coding Style, the variable is passed directly
to the function without declaring it before.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/linux/mlx5_os.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index f0147e6..2dc57b2 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -988,14 +988,13 @@
 	TAILQ_INIT(&priv->flow_meters);
 	TAILQ_INIT(&priv->flow_meter_profiles);
 	/* Hint libmlx5 to use PMD allocator for data plane resources */
-	struct mlx5dv_ctx_allocators alctr = {
-		.alloc = &mlx5_alloc_verbs_buf,
-		.free = &mlx5_free_verbs_buf,
-		.data = priv,
-	};
 	mlx5_glue->dv_set_context_attr(sh->ctx,
-				       MLX5DV_CTX_ATTR_BUF_ALLOCATORS,
-				       (void *)((uintptr_t)&alctr));
+			MLX5DV_CTX_ATTR_BUF_ALLOCATORS,
+			(void *)((uintptr_t)&(struct mlx5dv_ctx_allocators){
+				.alloc = &mlx5_alloc_verbs_buf,
+				.free = &mlx5_free_verbs_buf,
+				.data = priv,
+			}));
 	/* Bring Ethernet device up. */
 	DRV_LOG(DEBUG, "port %u forcing Ethernet interface up",
 		eth_dev->data->port_id);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH 2/7] net/mlx5: use direct API to find port by device
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 2/7] net/mlx5: use direct API to find port by device Michael Baum
@ 2020-06-28 13:55   ` Raslan Darawsheh
  0 siblings, 0 replies; 9+ messages in thread
From: Raslan Darawsheh @ 2020-06-28 13:55 UTC (permalink / raw)
  To: Michael Baum, dev; +Cc: Matan Azrad, Slava Ovsiienko

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Michael Baum
> Sent: Wednesday, June 24, 2020 2:33 PM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>
> Subject: [dpdk-dev] [PATCH 2/7] net/mlx5: use direct API to find port by
> device
> 
> Using RTE_ETH_FOREACH_DEV_OF loop is not necessary when the driver
> wants
> to find only the first match.
> 
> Use rte_eth_find_next_of to find it.
> 
> Signed-off-by: Michael Baum <michaelba@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_mr.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
> index adbe07c..3b781b6 100644
> --- a/drivers/net/mlx5/mlx5_mr.c
> +++ b/drivers/net/mlx5/mlx5_mr.c
> @@ -313,9 +313,10 @@ struct mr_update_mp_data {
>  {
>  	uint16_t port_id;
> 
> -	RTE_ETH_FOREACH_DEV_OF(port_id, &pdev->device)
> -		return &rte_eth_devices[port_id];
> -	return NULL;
> +	port_id = rte_eth_find_next_of(0, &pdev->device);
> +	if (port_id == RTE_MAX_ETHPORTS)
> +		return NULL;
> +	return &rte_eth_devices[port_id];
>  }
> 
>  /**
> --
> 1.8.3.1


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH 6/7] common/mlx5: remove useless assignment
  2020-06-24 11:33 ` [dpdk-dev] [PATCH 6/7] common/mlx5: " Michael Baum
@ 2020-06-29  8:44   ` Raslan Darawsheh
  0 siblings, 0 replies; 9+ messages in thread
From: Raslan Darawsheh @ 2020-06-29  8:44 UTC (permalink / raw)
  To: Michael Baum, dev; +Cc: Matan Azrad, Slava Ovsiienko

Hi

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Michael Baum
> Sent: Wednesday, June 24, 2020 2:33 PM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>
> Subject: [dpdk-dev] [PATCH 6/7] common/mlx5: remove useless assignment
> 
> The mlx5_dev_to_pci_addr function defines a variable called ret inside a
> loop and uses it.
> 
> During the loop, the function assigns a value within the variable and
> breaks from the loop, so that this assigning has done nothing and is
> actually unnecessary.
> 
> Remove the unnecessary assigning.
> 
> Signed-off-by: Michael Baum <michaelba@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/common/mlx5/linux/mlx5_common_os.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c
> b/drivers/common/mlx5/linux/mlx5_common_os.c
> index e422e95..e74aa89 100644
> --- a/drivers/common/mlx5/linux/mlx5_common_os.c
> +++ b/drivers/common/mlx5/linux/mlx5_common_os.c
> @@ -66,7 +66,6 @@
>  			   &pci_addr->bus,
>  			   &pci_addr->devid,
>  			   &pci_addr->function) == 4) {
> -			ret = 0;
>  			break;
>  		}
>  	}
> --
> 1.8.3.1

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-29  8:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 11:33 [dpdk-dev] [PATCH 1/7] common/mlx5: fix code arrangement in tag allocation Michael Baum
2020-06-24 11:33 ` [dpdk-dev] [PATCH 2/7] net/mlx5: use direct API to find port by device Michael Baum
2020-06-28 13:55   ` Raslan Darawsheh
2020-06-24 11:33 ` [dpdk-dev] [PATCH 3/7] net/mlx5: fix iterator type in Rx queue management Michael Baum
2020-06-24 11:33 ` [dpdk-dev] [PATCH 4/7] net/mlx4: use anonymous DV allocator argument Michael Baum
2020-06-24 11:33 ` [dpdk-dev] [PATCH 5/7] net/mlx4: remove useless assignment Michael Baum
2020-06-24 11:33 ` [dpdk-dev] [PATCH 6/7] common/mlx5: " Michael Baum
2020-06-29  8:44   ` Raslan Darawsheh
2020-06-24 11:33 ` [dpdk-dev] [PATCH 7/7] net/mlx5: use anonymous DV allocator argument Michael Baum

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git