From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro Subject: Re: [PATCH] net/mlx5: fix calculating TSO inline size Date: Mon, 4 Sep 2017 16:01:08 +0200 Message-ID: <20170904140107.nkr565m266sw5cyf@localhost> References: <20170831162706.30899-1-yskoh@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: adrien.mazarguil@6wind.com, dev@dpdk.org, stable@dpdk.org, Shahaf Shuler To: Yongseok Koh Return-path: Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id D0B21378E for ; Mon, 4 Sep 2017 16:01:51 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id 108so1830236wra.5 for ; Mon, 04 Sep 2017 07:01:51 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20170831162706.30899-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, Please see some comments below, On Thu, Aug 31, 2017 at 09:27:06AM -0700, Yongseok Koh wrote: > Tx descriptor for TSO embeds packet header to be replicated. If Tx inline > is enabled, there could be additional packet data inlined with 4B inline > header ahead. And between the header and additional inlined packet data, > there may be padding to make the inline part aligned to > MLX5_WQE_DWORD_SIZE. In calculating the total size of inlined data, the > size of inline header and padding is missing. > > Fixes: 3f13f8c23a7c ("net/mlx5: support hardware TSO") > Cc: stable@dpdk.org > > Signed-off-by: Shahaf Shuler > Signed-off-by: Yongseok Koh > --- > drivers/net/mlx5/mlx5_rxtx.c | 25 +++++++++---------------- > 1 file changed, 9 insertions(+), 16 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c > index fe9e7eac0..f89fa40b5 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.c > +++ b/drivers/net/mlx5/mlx5_rxtx.c > @@ -524,19 +521,20 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) > } > /* Inline if enough room. */ > if (inline_en || tso) { > + uint32_t inl; > uintptr_t end = (uintptr_t) > (((uintptr_t)txq->wqes) + > (1 << txq->wqe_n) * MLX5_WQE_SIZE); > unsigned int inline_room = max_inline * > RTE_CACHE_LINE_SIZE - > - (pkt_inline_sz - 2); > + (pkt_inline_sz - 2) - > + !!tso * sizeof(inl); Is not it dangerous to assume inl will always be 4 bytes long? Why not writing the real value instead? > 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) : > 0; > > - raw += MLX5_WQE_DWORD_SIZE; > if (copy_b && ((end - (uintptr_t)raw) > copy_b)) { > /* > * One Dseg remains in the current WQE. To Thanks, -- Nélio Laranjeiro 6WIND