DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx4: verify Tx max sges
@ 2018-01-04 16:12 Moti Haimovsky
  2018-01-05 16:53 ` Adrien Mazarguil
  2018-01-10 15:19 ` [dpdk-dev] [PATCH V2] " Moti Haimovsky
  0 siblings, 2 replies; 4+ messages in thread
From: Moti Haimovsky @ 2018-01-04 16:12 UTC (permalink / raw)
  To: adrien.mazarguil; +Cc: dev, Moti Haimovsky

Max number of Tx scatter-gather entries is a property of the device
and is queried at init. This value was not changed in a while and
most probably will not be changed in the future, Therefore and
in order to enhance Tx performance, the Tx max-sge value is hardcoded
in mlx4 PRM code.
This patch adds a verification that the above assumption still holds
and that the hardcoded value is still supported by the mlx4 hardware.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
 drivers/net/mlx4/mlx4.c     | 1 +
 drivers/net/mlx4/mlx4_prm.h | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 4bc4a6f..61c5bf4 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -505,6 +505,7 @@ struct mlx4_conf {
 		rte_errno = ENODEV;
 		goto error;
 	}
+	assert(device_attr.max_sge >= MLX4_MAX_SGE);
 	for (i = 0; i < device_attr.phys_port_cnt; i++) {
 		uint32_t port = i + 1; /* ports are indexed from one */
 		struct ibv_context *ctx = NULL;
diff --git a/drivers/net/mlx4/mlx4_prm.h b/drivers/net/mlx4/mlx4_prm.h
index 217ea50..b382d59 100644
--- a/drivers/net/mlx4/mlx4_prm.h
+++ b/drivers/net/mlx4/mlx4_prm.h
@@ -53,7 +53,10 @@
 #define MLX4_TXBB_SIZE (1 << MLX4_TXBB_SHIFT)
 
 /* Typical TSO descriptor with 16 gather entries is 352 bytes. */
-#define MLX4_MAX_WQE_SIZE 512
+#define MLX4_MAX_SGE 32
+#define MLX4_MAX_WQE_SIZE \
+	(MLX4_MAX_SGE * sizeof(struct mlx4_wqe_data_seg) + \
+	sizeof(struct mlx4_wqe_ctrl_seg))
 #define MLX4_SEG_SHIFT 4
 
 /* Send queue stamping/invalidating information. */
-- 
1.8.3.1

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

* Re: [dpdk-dev] [PATCH] net/mlx4: verify Tx max sges
  2018-01-04 16:12 [dpdk-dev] [PATCH] net/mlx4: verify Tx max sges Moti Haimovsky
@ 2018-01-05 16:53 ` Adrien Mazarguil
  2018-01-10 15:19   ` Shahaf Shuler
  2018-01-10 15:19 ` [dpdk-dev] [PATCH V2] " Moti Haimovsky
  1 sibling, 1 reply; 4+ messages in thread
From: Adrien Mazarguil @ 2018-01-05 16:53 UTC (permalink / raw)
  To: Moti Haimovsky; +Cc: dev

On Thu, Jan 04, 2018 at 06:12:03PM +0200, Moti Haimovsky wrote:
> Max number of Tx scatter-gather entries is a property of the device
> and is queried at init. This value was not changed in a while and
> most probably will not be changed in the future, Therefore and
> in order to enhance Tx performance, the Tx max-sge value is hardcoded
> in mlx4 PRM code.
> This patch adds a verification that the above assumption still holds
> and that the hardcoded value is still supported by the mlx4 hardware.
> 
> Signed-off-by: Moti Haimovsky <motih@mellanox.com>

Except for a really minor nit below:

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

> ---
>  drivers/net/mlx4/mlx4.c     | 1 +
>  drivers/net/mlx4/mlx4_prm.h | 5 ++++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
> index 4bc4a6f..61c5bf4 100644
> --- a/drivers/net/mlx4/mlx4.c
> +++ b/drivers/net/mlx4/mlx4.c
> @@ -505,6 +505,7 @@ struct mlx4_conf {
>  		rte_errno = ENODEV;
>  		goto error;
>  	}
> +	assert(device_attr.max_sge >= MLX4_MAX_SGE);
>  	for (i = 0; i < device_attr.phys_port_cnt; i++) {
>  		uint32_t port = i + 1; /* ports are indexed from one */
>  		struct ibv_context *ctx = NULL;
> diff --git a/drivers/net/mlx4/mlx4_prm.h b/drivers/net/mlx4/mlx4_prm.h
> index 217ea50..b382d59 100644
> --- a/drivers/net/mlx4/mlx4_prm.h
> +++ b/drivers/net/mlx4/mlx4_prm.h
> @@ -53,7 +53,10 @@
>  #define MLX4_TXBB_SIZE (1 << MLX4_TXBB_SHIFT)
>  
>  /* Typical TSO descriptor with 16 gather entries is 352 bytes. */
> -#define MLX4_MAX_WQE_SIZE 512
> +#define MLX4_MAX_SGE 32
> +#define MLX4_MAX_WQE_SIZE \
> +	(MLX4_MAX_SGE * sizeof(struct mlx4_wqe_data_seg) + \
> +	sizeof(struct mlx4_wqe_ctrl_seg))

One extra indent space is needed before sizeof to align with parenthesis
contents.

-- 
Adrien Mazarguil
6WIND

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

* [dpdk-dev] [PATCH V2] net/mlx4: verify Tx max sges
  2018-01-04 16:12 [dpdk-dev] [PATCH] net/mlx4: verify Tx max sges Moti Haimovsky
  2018-01-05 16:53 ` Adrien Mazarguil
@ 2018-01-10 15:19 ` Moti Haimovsky
  1 sibling, 0 replies; 4+ messages in thread
From: Moti Haimovsky @ 2018-01-10 15:19 UTC (permalink / raw)
  To: adrien.mazarguil, shahafs; +Cc: dev, Moti Haimovsky

Max number of Tx scatter-gather entries is a property of the device
and is queried at init. This value was not changed in a while and
most probably will not be changed in the future, Therefore and
in order to enhance Tx performance, the Tx max-sge value is hardcoded
in mlx4 PRM code.
This patch adds a verification that the above assumption still holds
and that the hardcoded value is still supported by the mlx4 hardware.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
V2:
* Modifications according to inputs from Adrien Mazarguil
---
 drivers/net/mlx4/mlx4.c     | 1 +
 drivers/net/mlx4/mlx4_prm.h | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 4bc4a6f..61c5bf4 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -505,6 +505,7 @@ struct mlx4_conf {
 		rte_errno = ENODEV;
 		goto error;
 	}
+	assert(device_attr.max_sge >= MLX4_MAX_SGE);
 	for (i = 0; i < device_attr.phys_port_cnt; i++) {
 		uint32_t port = i + 1; /* ports are indexed from one */
 		struct ibv_context *ctx = NULL;
diff --git a/drivers/net/mlx4/mlx4_prm.h b/drivers/net/mlx4/mlx4_prm.h
index 217ea50..3803cbd 100644
--- a/drivers/net/mlx4/mlx4_prm.h
+++ b/drivers/net/mlx4/mlx4_prm.h
@@ -53,7 +53,10 @@
 #define MLX4_TXBB_SIZE (1 << MLX4_TXBB_SHIFT)
 
 /* Typical TSO descriptor with 16 gather entries is 352 bytes. */
-#define MLX4_MAX_WQE_SIZE 512
+#define MLX4_MAX_SGE 32
+#define MLX4_MAX_WQE_SIZE \
+	(MLX4_MAX_SGE * sizeof(struct mlx4_wqe_data_seg) + \
+	 sizeof(struct mlx4_wqe_ctrl_seg))
 #define MLX4_SEG_SHIFT 4
 
 /* Send queue stamping/invalidating information. */
-- 
1.8.3.1

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

* Re: [dpdk-dev] [PATCH] net/mlx4: verify Tx max sges
  2018-01-05 16:53 ` Adrien Mazarguil
@ 2018-01-10 15:19   ` Shahaf Shuler
  0 siblings, 0 replies; 4+ messages in thread
From: Shahaf Shuler @ 2018-01-10 15:19 UTC (permalink / raw)
  To: Adrien Mazarguil, Mordechay Haimovsky; +Cc: dev

Friday, January 5, 2018 6:53 PM, Adrien Mazarguil:
> > Signed-off-by: Moti Haimovsky <motih@mellanox.com>
> 
> Except for a really minor nit below:
> 
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Applied to next-net-mlx with the suggested fix. Thanks 

> 
> > ---
> >  drivers/net/mlx4/mlx4.c     | 1 +
> >  drivers/net/mlx4/mlx4_prm.h | 5 ++++-
> >  2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index
> > 4bc4a6f..61c5bf4 100644
> > --- a/drivers/net/mlx4/mlx4.c
> > +++ b/drivers/net/mlx4/mlx4.c
> > @@ -505,6 +505,7 @@ struct mlx4_conf {
> >  		rte_errno = ENODEV;
> >  		goto error;
> >  	}
> > +	assert(device_attr.max_sge >= MLX4_MAX_SGE);
> >  	for (i = 0; i < device_attr.phys_port_cnt; i++) {
> >  		uint32_t port = i + 1; /* ports are indexed from one */
> >  		struct ibv_context *ctx = NULL;
> > diff --git a/drivers/net/mlx4/mlx4_prm.h b/drivers/net/mlx4/mlx4_prm.h
> > index 217ea50..b382d59 100644
> > --- a/drivers/net/mlx4/mlx4_prm.h
> > +++ b/drivers/net/mlx4/mlx4_prm.h
> > @@ -53,7 +53,10 @@
> >  #define MLX4_TXBB_SIZE (1 << MLX4_TXBB_SHIFT)
> >
> >  /* Typical TSO descriptor with 16 gather entries is 352 bytes. */
> > -#define MLX4_MAX_WQE_SIZE 512
> > +#define MLX4_MAX_SGE 32
> > +#define MLX4_MAX_WQE_SIZE \
> > +	(MLX4_MAX_SGE * sizeof(struct mlx4_wqe_data_seg) + \
> > +	sizeof(struct mlx4_wqe_ctrl_seg))
> 
> One extra indent space is needed before sizeof to align with parenthesis
> contents.
> 
> --
> Adrien Mazarguil
> 6WIND

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

end of thread, other threads:[~2018-01-10 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-04 16:12 [dpdk-dev] [PATCH] net/mlx4: verify Tx max sges Moti Haimovsky
2018-01-05 16:53 ` Adrien Mazarguil
2018-01-10 15:19   ` Shahaf Shuler
2018-01-10 15:19 ` [dpdk-dev] [PATCH V2] " Moti Haimovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).