patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Bing Zhao <bingz@nvidia.com>
To: <stable@dpdk.org>, <christian.ehrhardt@canonical.com>
Cc: <viacheslavo@nvidia.com>, <matan@nvidia.com>
Subject: [dpdk-stable] [PATCH 19.11 v2] net/mlx5: fix multi-segment inline for the first segments
Date: Tue, 17 Aug 2021 16:54:21 +0300	[thread overview]
Message-ID: <20210817135421.1967100-1-bingz@nvidia.com> (raw)
In-Reply-To: <20210816162952.1931473-1-bingz@nvidia.com>

From: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

[ upstream commit ec837ad0fc7c6df4912cc2706b9cd54b225f4a34 ]

Before 19.08 release the Tx burst routines of mlx5 PMD
provided data inline for the first short segments of the
multi-segment packets. In the release 19.08 mlx5 Tx datapath
was refactored and this behavior was broken, affecting the
performance.

For example, the T-Rex traffic generator might use small
leading segments to handle packet headers and performance
degradation was noticed.

If the first segments of the multi-segment packet are short
and the overall length is below the inline threshold it
should be inline into the WQE to fix the performance.

Fixes: 18a1c20044c0 ("net/mlx5: implement Tx burst template")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 73dbf68d2b..8a6162ebd6 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -3336,6 +3336,8 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *restrict txq,
 		unsigned int nxlen;
 		uintptr_t start;
 
+		mbuf = loc->mbuf;
+		nxlen = rte_pktmbuf_data_len(mbuf);
 		/*
 		 * Packet length exceeds the allowed inline
 		 * data length, check whether the minimal
@@ -3345,27 +3347,22 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *restrict txq,
 			assert(txq->inlen_mode >= MLX5_ESEG_MIN_INLINE_SIZE);
 			assert(txq->inlen_mode <= txq->inlen_send);
 			inlen = txq->inlen_mode;
-		} else {
-			if (!vlan || txq->vlan_en) {
-				/*
-				 * VLAN insertion will be done inside by HW.
-				 * It is not utmost effective - VLAN flag is
-				 * checked twice, but we should proceed the
-				 * inlining length correctly and take into
-				 * account the VLAN header being inserted.
-				 */
-				return mlx5_tx_packet_multi_send
-							(txq, loc, olx);
-			}
+		} else if (vlan && !txq->vlan_en) {
+			/*
+			 * VLAN insertion is requested and hardware does not
+			 * support the offload, will do with software inline.
+			 */
 			inlen = MLX5_ESEG_MIN_INLINE_SIZE;
+		} else if (nxlen > txq->inlen_send) {
+			return mlx5_tx_packet_multi_send(txq, loc, olx);
+		} else {
+			goto do_first;
 		}
 		/*
 		 * Now we know the minimal amount of data is requested
 		 * to inline. Check whether we should inline the buffers
 		 * from the chain beginning to eliminate some mbufs.
 		 */
-		mbuf = loc->mbuf;
-		nxlen = rte_pktmbuf_data_len(mbuf);
 		if (unlikely(nxlen <= txq->inlen_send)) {
 			/* We can inline first mbuf at least. */
 			if (nxlen < inlen) {
@@ -3387,6 +3384,7 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *restrict txq,
 					goto do_align;
 				}
 			}
+do_first:
 			do {
 				inlen = nxlen;
 				mbuf = NEXT(mbuf);
-- 
2.25.1


      parent reply	other threads:[~2021-08-17 13:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 16:29 [dpdk-stable] [PATCH 19.11 0/6] Cumulative fixes for stable 19.11 Bing Zhao
2021-08-16 16:29 ` [dpdk-stable] [PATCH 19.11 1/6] app/testpmd: fix offloads for newly attached port Bing Zhao
2021-08-16 16:29 ` [dpdk-stable] [PATCH 19.11 2/6] common/mlx5: fix compatibility with OFED port query API Bing Zhao
2021-08-16 16:29 ` [dpdk-stable] [PATCH 19.11 3/6] net/mlx5: fix switchdev mode recognition Bing Zhao
2021-08-16 16:29 ` [dpdk-stable] [PATCH 19.11 4/6] net/mlx5: fix RoCE LAG bond device probing Bing Zhao
2021-08-16 16:29 ` [dpdk-stable] [PATCH 19.11 5/6] common/mlx5: use new port query API if available Bing Zhao
2021-08-16 16:29 ` [dpdk-stable] [PATCH 19.11 6/6] net/mlx5: fix multi-segment inline for the first segments Bing Zhao
2021-08-17 11:55   ` Christian Ehrhardt
2021-08-17 13:55     ` Bing Zhao
2021-08-17  9:42 ` [dpdk-stable] [PATCH 19.11 0/6] Cumulative fixes for stable 19.11 Christian Ehrhardt
2021-08-17 13:54 ` Bing Zhao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210817135421.1967100-1-bingz@nvidia.com \
    --to=bingz@nvidia.com \
    --cc=christian.ehrhardt@canonical.com \
    --cc=matan@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).