From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro Subject: Re: [PATCH] net/mlx5: change calculating inline room for Tx Date: Fri, 14 Apr 2017 08:51:39 +0200 Message-ID: <20170414065139.GD14075@autoinstall.dev.6wind.com> References: <20170413174651.27860-1-yskoh@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: ferruh.yigit@intel.com, dev@dpdk.org, adrien.mazarguil@6wind.com To: Yongseok Koh Return-path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 7933BDE0 for ; Fri, 14 Apr 2017 08:51:48 +0200 (CEST) Received: by mail-wm0-f48.google.com with SMTP id t189so60360719wmt.1 for ; Thu, 13 Apr 2017 23:51:48 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20170413174651.27860-1-yskoh@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" Hi Yongseok, On Thu, Apr 13, 2017 at 10:46:51AM -0700, Yongseok Koh wrote: > Current implementation is error-prone if the max inline size > (txq->max_inilne) is decoupled from txq->inline_en and becomes zero. If it > becomes zero, HW can crash due to WQ overflow. By reading this log, it seems more to be a fix, no? > Signed-off-by: Yongseok Koh > Acked-by: Shahaf Shuler > --- > drivers/net/mlx5/mlx5_rxtx.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c > index 2e208bf96..6254228a9 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.c > +++ b/drivers/net/mlx5/mlx5_rxtx.c > @@ -499,6 +499,8 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) > unsigned int j = 0; > unsigned int k = 0; > unsigned int max; > + unsigned int max_inline = txq->max_inline; Cannot it be declared as const too? Seems it is only read in the whole Tx burst function, as it a chance to be update in the middle? > + const unsigned int inline_en = !!max_inline && txq->inline_en; > uint16_t max_wqe; > unsigned int comp; > volatile struct mlx5_wqe_v *wqe = NULL; > @@ -685,14 +687,14 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) > } > } > /* Inline if enough room. */ > - if (txq->inline_en || tso) { > + if (inline_en || tso) { > uintptr_t end = (uintptr_t) > (((uintptr_t)txq->wqes) + > (1 << txq->wqe_n) * MLX5_WQE_SIZE); > - unsigned int max_inline = txq->max_inline * > - RTE_CACHE_LINE_SIZE - > - (pkt_inline_sz - 2); > - uintptr_t addr_end = (addr + max_inline) & > + unsigned int inline_room = max_inline * > + RTE_CACHE_LINE_SIZE - > + (pkt_inline_sz - 2); > + uintptr_t addr_end = (addr + inline_room) & > ~(RTE_CACHE_LINE_SIZE - 1); > unsigned int copy_b = (addr_end > addr) ? > RTE_MIN((addr_end - addr), length) : > -- > 2.11.0 Thanks, -- Nélio Laranjeiro 6WIND