From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: Re: [PATCH] net/mlx4: verify Tx max sges Date: Fri, 5 Jan 2018 17:53:17 +0100 Message-ID: <20180105165317.GV4256@6wind.com> References: <1515082323-179525-1-git-send-email-motih@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org To: Moti Haimovsky Return-path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id C1CF47D30 for ; Fri, 5 Jan 2018 17:53:29 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id n138so3544817wmg.2 for ; Fri, 05 Jan 2018 08:53:29 -0800 (PST) Content-Disposition: inline In-Reply-To: <1515082323-179525-1-git-send-email-motih@mellanox.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 Except for a really minor nit below: Acked-by: 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..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