patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: Yongseok Koh <yskoh@mellanox.com>
Cc: Shahaf Shuler <shahafs@mellanox.com>, dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/mlx5: fix Rx buffer replenishment threshold' has been queued to LTS release 17.11.4
Date: Thu, 26 Jul 2018 19:09:25 -0700	[thread overview]
Message-ID: <20180727021019.37388-29-yskoh@mellanox.com> (raw)
In-Reply-To: <20180727021019.37388-1-yskoh@mellanox.com>

Hi,

FYI, your patch has been queued to LTS release 17.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/28/18. So please
shout if anyone has objections.

Thanks.

Yongseok

---
>From b9e1edfe8ee644be2fe5c13e3239c8ee1f48afb4 Mon Sep 17 00:00:00 2001
From: Yongseok Koh <yskoh@mellanox.com>
Date: Tue, 26 Jun 2018 04:33:35 -0700
Subject: [PATCH] net/mlx5: fix Rx buffer replenishment threshold

[ upstream commit e10245a13b2e340f48ce80484f19bcbc13e9ebe6 ]

The threshold of buffer replenishment for vectorized Rx burst is a constant
value (64). If the size of Rx queue is comparatively small, device could
run out of buffers. For example, if the size of Rx queue is 128, buffers
are replenished only twice per a wraparound. This can cause jitter in
receiving packets and the jitter can cause unnecessary retransmission for
TCP connections.

Fixes: 6cb559d67b83 ("net/mlx5: add vectorized Rx/Tx burst for x86")
Fixes: 570acdb1da8a ("net/mlx5: add vectorized Rx/Tx burst for ARM")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5_defs.h          | 5 +++--
 drivers/net/mlx5/mlx5_rxtx_vec.h      | 4 ++--
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 2 +-
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h  | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index d70635767..e9cda9a08 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -92,10 +92,11 @@
 #define MLX5_VPMD_MIN_TXQS 4
 
 /* Threshold of buffer replenishment for vectorized Rx. */
-#define MLX5_VPMD_RXQ_RPLNSH_THRESH   64U
+#define MLX5_VPMD_RXQ_RPLNSH_THRESH(n) \
+	(RTE_MIN(MLX5_VPMD_RX_MAX_BURST, (unsigned int)(n) >> 2))
 
 /* Maximum size of burst for vectorized Rx. */
-#define MLX5_VPMD_RX_MAX_BURST        MLX5_VPMD_RXQ_RPLNSH_THRESH
+#define MLX5_VPMD_RX_MAX_BURST 64U
 
 /*
  * Maximum size of burst for vectorized Tx. This is related to the maximum size
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.h b/drivers/net/mlx5/mlx5_rxtx_vec.h
index 1f08ed0b2..d504e2aee 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.h
@@ -106,9 +106,9 @@ mlx5_rx_replenish_bulk_mbuf(struct mlx5_rxq_data *rxq, uint16_t n)
 	volatile struct mlx5_wqe_data_seg *wq = &(*rxq->wqes)[elts_idx];
 	unsigned int i;
 
-	assert(n >= MLX5_VPMD_RXQ_RPLNSH_THRESH);
+	assert(n >= MLX5_VPMD_RXQ_RPLNSH_THRESH(q_n));
 	assert(n <= (uint16_t)(q_n - (rxq->rq_ci - rxq->rq_pi)));
-	assert(MLX5_VPMD_RXQ_RPLNSH_THRESH > MLX5_VPMD_DESCS_PER_LOOP);
+	assert(MLX5_VPMD_RXQ_RPLNSH_THRESH(q_n) > MLX5_VPMD_DESCS_PER_LOOP);
 	/* Not to cross queue end. */
 	n = RTE_MIN(n - MLX5_VPMD_DESCS_PER_LOOP, q_n - elts_idx);
 	if (rte_mempool_get_bulk(rxq->mp, (void *)elts, n) < 0) {
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index cf424778a..1604d0430 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -754,7 +754,7 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n,
 	 *   N - (rq_ci - rq_pi) := # of buffers consumed (to be replenished).
 	 */
 	repl_n = q_n - (rxq->rq_ci - rxq->rq_pi);
-	if (repl_n >= MLX5_VPMD_RXQ_RPLNSH_THRESH)
+	if (repl_n >= MLX5_VPMD_RXQ_RPLNSH_THRESH(q_n))
 		mlx5_rx_replenish_bulk_mbuf(rxq, repl_n);
 	/* See if there're unreturned mbufs from compressed CQE. */
 	rcvd_pkt = rxq->cq_ci - rxq->rq_pi;
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index 793142922..01a93a4b4 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -735,7 +735,7 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n,
 	 *   N - (rq_ci - rq_pi) := # of buffers consumed (to be replenished).
 	 */
 	repl_n = q_n - (rxq->rq_ci - rxq->rq_pi);
-	if (repl_n >= MLX5_VPMD_RXQ_RPLNSH_THRESH)
+	if (repl_n >= MLX5_VPMD_RXQ_RPLNSH_THRESH(q_n))
 		mlx5_rx_replenish_bulk_mbuf(rxq, repl_n);
 	/* See if there're unreturned mbufs from compressed CQE. */
 	rcvd_pkt = rxq->cq_ci - rxq->rq_pi;
-- 
2.11.0

  parent reply	other threads:[~2018-07-27  2:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27  2:08 [dpdk-stable] patch 'net/qede: fix VF MTU update' " Yongseok Koh
2018-07-27  2:08 ` [dpdk-stable] patch 'net/mvpp2: check pointer before using it' " Yongseok Koh
2018-07-27  2:08 ` [dpdk-stable] patch 'net/qede: fix link change event notification' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/bnxt: add missing ids in xstats' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/ena: fix GENMASK_ULL macro' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/nfp: fix field initialization in Tx descriptor' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/bonding: always update bonding link status' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/bonding: fix MAC address reset' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/mlx5: fix crash in device probe' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'eventdev: fix port in Rx adapter internal function' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'eventdev: fix missing update to Rx adaper WRR position' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'eventdev: add event buffer flush in Rx adapter' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'eventdev: fix internal port logic " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'eventdev: fix Rx SW adapter stop' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'bus/dpaa: fix build' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'kni: fix build with gcc 8.1' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/ixgbe: add support for VLAN in IP mode FDIR' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/ixgbe: fix tunnel id format error for " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/ixgbe: fix tunnel type set " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/ixgbe: fix mask bits register " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/i40e: fix shifts of 32-bit value' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'app/testpmd: fix VLAN TCI mask set error for FDIR' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/i40e: workaround performance degradation' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/pcap: fix multiple queues' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/thunderx: fix build with gcc optimization on' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/qede: fix legacy interrupt mode' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/qede: remove primary MAC removal' " Yongseok Koh
2018-07-27  2:09 ` [dpdk-stable] patch 'net/ena: fix SIGFPE with 0 Rx queue' " Yongseok Koh
2018-07-27  2:09 ` Yongseok Koh [this message]
2018-07-27  2:09 ` [dpdk-stable] patch 'net/bnxt: fix HW Tx checksum offload check' " Yongseok Koh

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=20180727021019.37388-29-yskoh@mellanox.com \
    --to=yskoh@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=stable@dpdk.org \
    /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).