From 57725162f05dfb9f81fa3bae76018488083f9493 Mon Sep 17 00:00:00 2001 From: Viacheslav Ovsiienko Date: Wed, 27 Nov 2019 12:33:12 +0000 Subject: [PATCH] net/mlx5: fix legacy non-inline multi-packet performance The legacy multi-packet write is the feature allowing to put multiple packets into one transmitting descriptor, this feature is supported by only NIC ConnectX-4LX. The number of packets should be limited to provide optimal size descriptor and better performance. Fixes: 18a1c20044c0 ("net/mlx5: implement Tx burst template") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_prm.h | 2 ++ drivers/net/mlx5/mlx5_rxtx.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_prm.h b/drivers/net/mlx5/mlx5_prm.h index 651006bd39..2bac6a74e0 100644 --- a/drivers/net/mlx5/mlx5_prm.h +++ b/drivers/net/mlx5/mlx5_prm.h @@ -99,6 +99,8 @@ * in tx burst routine at the moment of freeing multiple mbufs. */ #define MLX5_EMPW_MAX_PACKETS MLX5_TX_COMP_THRESH +#define MLX5_MPW_MAX_PACKETS 6 + /* * Default packet length threshold to be inlined with * ordinary SEND. Inlining saves the MR key search diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 73c16dedbc..25d915c8fd 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -3888,7 +3888,9 @@ mlx5_tx_burst_empw_simple(struct mlx5_txq_data *restrict txq, next_empw: assert(NB_SEGS(loc->mbuf) == 1); - part = RTE_MIN(pkts_n, MLX5_EMPW_MAX_PACKETS); + part = RTE_MIN(pkts_n, MLX5_TXOFF_CONFIG(MPW) ? + MLX5_MPW_MAX_PACKETS : + MLX5_EMPW_MAX_PACKETS); if (unlikely(loc->elts_free < part)) { /* We have no enough elts to save all mbufs. */ if (unlikely(loc->elts_free < MLX5_EMPW_MIN_PACKETS)) -- 2.20.1