From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matan Azrad Subject: [PATCH 2/8] net/mlx4: remove unnecessary Tx wraparound checks Date: Tue, 28 Nov 2017 12:19:24 +0000 Message-ID: <1511871570-16826-3-git-send-email-matan@mellanox.com> References: <1511871570-16826-1-git-send-email-matan@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain Cc: dev@dpdk.org To: Adrien Mazarguil Return-path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0045.outbound.protection.outlook.com [104.47.1.45]) by dpdk.org (Postfix) with ESMTP id 026E42B9E for ; Tue, 28 Nov 2017 13:20:02 +0100 (CET) In-Reply-To: <1511871570-16826-1-git-send-email-matan@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" There is no need to check Tx queue wraparound for segments which are not at the beginning of a Tx block. Especially relevant in a single segment case. Remove unnecessary aforementioned checks from Tx path. Signed-off-by: Matan Azrad --- drivers/net/mlx4/mlx4_rxtx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c index 0d008ed..9a32b3f 100644 --- a/drivers/net/mlx4/mlx4_rxtx.c +++ b/drivers/net/mlx4/mlx4_rxtx.c @@ -461,15 +461,11 @@ struct pv { for (sbuf = buf; sbuf != NULL; sbuf = sbuf->next, dseg++) { addr = rte_pktmbuf_mtod(sbuf, uintptr_t); rte_prefetch0((volatile void *)addr); - /* Handle WQE wraparound. */ - if (dseg >= (volatile struct mlx4_wqe_data_seg *)sq->eob) - dseg = (volatile struct mlx4_wqe_data_seg *)sq->buf; - dseg->addr = rte_cpu_to_be_64(addr); /* Memory region key (big endian) for this memory pool. */ lkey = mlx4_txq_mp2mr(txq, mlx4_txq_mb2mp(sbuf)); dseg->lkey = rte_cpu_to_be_32(lkey); /* Calculate the needed work queue entry size for this packet */ - if (unlikely(dseg->lkey == rte_cpu_to_be_32((uint32_t)-1))) { + if (unlikely(lkey == rte_cpu_to_be_32((uint32_t)-1))) { /* MR does not exist. */ DEBUG("%p: unable to get MP <-> MR association", (void *)txq); @@ -501,6 +497,8 @@ struct pv { * control segment. */ if ((uintptr_t)dseg & (uintptr_t)(MLX4_TXBB_SIZE - 1)) { + dseg->addr = rte_cpu_to_be_64(addr); + dseg->lkey = rte_cpu_to_be_32(lkey); #if RTE_CACHE_LINE_SIZE < 64 /* * Need a barrier here before writing the byte_count @@ -520,6 +518,13 @@ struct pv { * TXBB, so we need to postpone its byte_count writing * for later. */ + /* Handle WQE wraparound. */ + if (dseg >= + (volatile struct mlx4_wqe_data_seg *)sq->eob) + dseg = (volatile struct mlx4_wqe_data_seg *) + sq->buf; + dseg->addr = rte_cpu_to_be_64(addr); + dseg->lkey = rte_cpu_to_be_32(lkey); pv[pv_counter].dseg = dseg; pv[pv_counter++].val = byte_count; } @@ -625,11 +630,6 @@ struct pv { sizeof(struct mlx4_wqe_ctrl_seg)); addr = rte_pktmbuf_mtod(buf, uintptr_t); rte_prefetch0((volatile void *)addr); - /* Handle WQE wraparound. */ - if (dseg >= - (volatile struct mlx4_wqe_data_seg *)sq->eob) - dseg = (volatile struct mlx4_wqe_data_seg *) - sq->buf; dseg->addr = rte_cpu_to_be_64(addr); /* Memory region key (big endian). */ lkey = mlx4_txq_mp2mr(txq, mlx4_txq_mb2mp(buf)); -- 1.8.3.1