From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3EC35A00E6 for ; Wed, 7 Aug 2019 14:58:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 18F962C0C; Wed, 7 Aug 2019 14:58:17 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id E39332BF3 for ; Wed, 7 Aug 2019 14:58:15 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from viacheslavo@mellanox.com) with ESMTPS (AES256-SHA encrypted); 7 Aug 2019 15:58:11 +0300 Received: from pegasus12.mtr.labs.mlnx (pegasus12.mtr.labs.mlnx [10.210.17.40]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x77CwBeK009490; Wed, 7 Aug 2019 15:58:11 +0300 Received: from pegasus12.mtr.labs.mlnx (localhost [127.0.0.1]) by pegasus12.mtr.labs.mlnx (8.14.7/8.14.7) with ESMTP id x77CwBPi010778; Wed, 7 Aug 2019 12:58:11 GMT Received: (from viacheslavo@localhost) by pegasus12.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id x77CwBFh010777; Wed, 7 Aug 2019 12:58:11 GMT X-Authentication-Warning: pegasus12.mtr.labs.mlnx: viacheslavo set sender to viacheslavo@mellanox.com using -f From: Viacheslav Ovsiienko To: dev@dpdk.org Cc: yskoh@mellanox.com, shahafs@mellanox.com Date: Wed, 7 Aug 2019 12:58:10 +0000 Message-Id: <1565182690-10740-1-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix completion request for multi-segment packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The copying of sent mbufs pointers might be deferred to the end of tx_burst() routine to be copied in one call of rte_memcpy. For the multi segment packets this optimization is not applicable, because number of packets does not match with number of mbufs and we do not have linear array of pointers in pkts parameter. The completion request generating routine wrongly took into account the inconsistent (for multi-segment packets) deferred pointer copying. Fixes: 5a93e173b874 ("net/mlx5: fix Tx completion request generation") Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_rxtx.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 3e51bb0..4c01187 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -2130,6 +2130,9 @@ enum mlx5_txcmp_code { * Pointer to TX queue structure. * @param loc * Pointer to burst routine local context. + * @param multi, + * Routine is called from multi-segment sending loop, + * do not correct the elts_head according to the pkts_copy. * @param olx * Configured Tx offloads mask. It is fully defined at * compile time and may be used for optimization. @@ -2137,12 +2140,14 @@ enum mlx5_txcmp_code { static __rte_always_inline void mlx5_tx_request_completion(struct mlx5_txq_data *restrict txq, struct mlx5_txq_local *restrict loc, + bool multi, unsigned int olx) { uint16_t head = txq->elts_head; unsigned int part; - part = MLX5_TXOFF_CONFIG(INLINE) ? 0 : loc->pkts_sent - loc->pkts_copy; + part = (MLX5_TXOFF_CONFIG(INLINE) || multi) ? + 0 : loc->pkts_sent - loc->pkts_copy; head += part; if ((uint16_t)(head - txq->elts_comp) >= MLX5_TX_COMP_THRESH || (MLX5_TXOFF_CONFIG(INLINE) && @@ -3091,7 +3096,7 @@ enum mlx5_txcmp_code { txq->wqe_ci += (ds + 3) / 4; loc->wqe_free -= (ds + 3) / 4; /* Request CQE generation if limits are reached. */ - mlx5_tx_request_completion(txq, loc, olx); + mlx5_tx_request_completion(txq, loc, true, olx); return MLX5_TXCMP_CODE_MULTI; } @@ -3201,7 +3206,7 @@ enum mlx5_txcmp_code { txq->wqe_ci += (ds + 3) / 4; loc->wqe_free -= (ds + 3) / 4; /* Request CQE generation if limits are reached. */ - mlx5_tx_request_completion(txq, loc, olx); + mlx5_tx_request_completion(txq, loc, true, olx); return MLX5_TXCMP_CODE_MULTI; } @@ -3359,7 +3364,7 @@ enum mlx5_txcmp_code { txq->wqe_ci += (ds + 3) / 4; loc->wqe_free -= (ds + 3) / 4; /* Request CQE generation if limits are reached. */ - mlx5_tx_request_completion(txq, loc, olx); + mlx5_tx_request_completion(txq, loc, true, olx); return MLX5_TXCMP_CODE_MULTI; } @@ -3570,7 +3575,7 @@ enum mlx5_txcmp_code { ++loc->pkts_sent; --pkts_n; /* Request CQE generation if limits are reached. */ - mlx5_tx_request_completion(txq, loc, olx); + mlx5_tx_request_completion(txq, loc, false, olx); if (unlikely(!pkts_n || !loc->elts_free || !loc->wqe_free)) return MLX5_TXCMP_CODE_EXIT; loc->mbuf = *pkts++; @@ -3728,7 +3733,7 @@ enum mlx5_txcmp_code { txq->wqe_ci += (ds + 3) / 4; loc->wqe_free -= (ds + 3) / 4; /* Request CQE generation if limits are reached. */ - mlx5_tx_request_completion(txq, loc, olx); + mlx5_tx_request_completion(txq, loc, false, olx); } /* @@ -3772,7 +3777,7 @@ enum mlx5_txcmp_code { txq->wqe_ci += (len + 3) / 4; loc->wqe_free -= (len + 3) / 4; /* Request CQE generation if limits are reached. */ - mlx5_tx_request_completion(txq, loc, olx); + mlx5_tx_request_completion(txq, loc, false, olx); } /** @@ -3965,7 +3970,7 @@ enum mlx5_txcmp_code { loc->wqe_free -= (2 + part + 3) / 4; pkts_n -= part; /* Request CQE generation if limits are reached. */ - mlx5_tx_request_completion(txq, loc, olx); + mlx5_tx_request_completion(txq, loc, false, olx); if (unlikely(!pkts_n || !loc->elts_free || !loc->wqe_free)) return MLX5_TXCMP_CODE_EXIT; loc->mbuf = *pkts++; @@ -4440,7 +4445,7 @@ enum mlx5_txcmp_code { ++loc->pkts_sent; --pkts_n; /* Request CQE generation if limits are reached. */ - mlx5_tx_request_completion(txq, loc, olx); + mlx5_tx_request_completion(txq, loc, false, olx); if (unlikely(!pkts_n || !loc->elts_free || !loc->wqe_free)) return MLX5_TXCMP_CODE_EXIT; loc->mbuf = *pkts++; -- 1.8.3.1