DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 3/6] net/sfc: use Rx queue max fill level calculated on init
Date: Tue, 26 Dec 2017 07:27:48 +0000	[thread overview]
Message-ID: <1514273271-19604-4-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1514273271-19604-1-git-send-email-arybchenko@solarflare.com>

Prepare to support more options for number of Rx descriptors.

libefx-based datapath is updated just for completeness to
make code more readable and less error-prone.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
---
 drivers/net/sfc/sfc_dp_rx.h   | 2 ++
 drivers/net/sfc/sfc_ef10_rx.c | 5 +++--
 drivers/net/sfc/sfc_rx.c      | 5 +++--
 drivers/net/sfc/sfc_rx.h      | 1 +
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/sfc/sfc_dp_rx.h b/drivers/net/sfc/sfc_dp_rx.h
index 3c29089..f62d79a 100644
--- a/drivers/net/sfc/sfc_dp_rx.h
+++ b/drivers/net/sfc/sfc_dp_rx.h
@@ -60,6 +60,8 @@ struct sfc_dp_rxq {
 struct sfc_dp_rx_qcreate_info {
 	/** Memory pool to allocate Rx buffer from */
 	struct rte_mempool	*refill_mb_pool;
+	/** Maximum number of pushed Rx descriptors in the queue */
+	unsigned int		max_fill_level;
 	/** Minimum number of unused Rx descriptors to do refill */
 	unsigned int		refill_threshold;
 	/**
diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c
index 29524ce..fc89078 100644
--- a/drivers/net/sfc/sfc_ef10_rx.c
+++ b/drivers/net/sfc/sfc_ef10_rx.c
@@ -93,6 +93,7 @@ struct sfc_ef10_rxq {
 	/* Used on refill */
 	uint16_t			buf_size;
 	unsigned int			added;
+	unsigned int			max_fill_level;
 	unsigned int			refill_threshold;
 	struct rte_mempool		*refill_mb_pool;
 	efx_qword_t			*rxq_hw_ring;
@@ -141,8 +142,7 @@ sfc_ef10_rx_qrefill(struct sfc_ef10_rxq *rxq)
 	void *objs[SFC_RX_REFILL_BULK];
 	unsigned int added = rxq->added;
 
-	free_space = SFC_EF10_RXQ_LIMIT(ptr_mask + 1) -
-		(added - rxq->completed);
+	free_space = rxq->max_fill_level - (added - rxq->completed);
 
 	if (free_space < rxq->refill_threshold)
 		return;
@@ -620,6 +620,7 @@ sfc_ef10_rx_qcreate(uint16_t port_id, uint16_t queue_id,
 		rxq->flags |= SFC_EF10_RXQ_RSS_HASH;
 	rxq->ptr_mask = info->rxq_entries - 1;
 	rxq->evq_hw_ring = info->evq_hw_ring;
+	rxq->max_fill_level = info->max_fill_level;
 	rxq->refill_threshold = info->refill_threshold;
 	rxq->rearm_data =
 		sfc_ef10_mk_mbuf_rearm_data(port_id, info->prefix_size);
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 43d51c4..ecf8e99 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -88,8 +88,7 @@ sfc_efx_rx_qrefill(struct sfc_efx_rxq *rxq)
 	struct rte_mbuf *m;
 	uint16_t port_id = rxq->dp.dpq.port_id;
 
-	free_space = EFX_RXQ_LIMIT(rxq->ptr_mask + 1) -
-		(added - rxq->completed);
+	free_space = rxq->max_fill_level - (added - rxq->completed);
 
 	if (free_space < rxq->refill_threshold)
 		return;
@@ -459,6 +458,7 @@ sfc_efx_rx_qcreate(uint16_t port_id, uint16_t queue_id,
 	rxq->ptr_mask = info->rxq_entries - 1;
 	rxq->batch_max = info->batch_max;
 	rxq->prefix_size = info->prefix_size;
+	rxq->max_fill_level = info->max_fill_level;
 	rxq->refill_threshold = info->refill_threshold;
 	rxq->buf_size = info->buf_size;
 	rxq->refill_mb_pool = info->refill_mb_pool;
@@ -993,6 +993,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 
 	memset(&info, 0, sizeof(info));
 	info.refill_mb_pool = rxq->refill_mb_pool;
+	info.max_fill_level = rxq_max_fill_level;
 	info.refill_threshold = rxq->refill_threshold;
 	info.buf_size = buf_size;
 	info.batch_max = encp->enc_rx_batch_max;
diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h
index 9e6282e..d2f4471 100644
--- a/drivers/net/sfc/sfc_rx.h
+++ b/drivers/net/sfc/sfc_rx.h
@@ -121,6 +121,7 @@ struct sfc_efx_rxq {
 	/* Used on refill */
 	unsigned int			added;
 	unsigned int			pushed;
+	unsigned int			max_fill_level;
 	unsigned int			refill_threshold;
 	uint16_t			buf_size;
 	struct rte_mempool		*refill_mb_pool;
-- 
2.7.4

  parent reply	other threads:[~2017-12-26  7:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-26  7:27 [dpdk-dev] [PATCH 0/6] net/sfc: support more options for a number of Rx/Tx descs Andrew Rybchenko
2017-12-26  7:27 ` [dpdk-dev] [PATCH 1/6] net/sfc: make refill threshold check Rx datapath specific Andrew Rybchenko
2017-12-26  7:27 ` [dpdk-dev] [PATCH 2/6] net/sfc: make Tx free threshold check " Andrew Rybchenko
2017-12-26  7:27 ` Andrew Rybchenko [this message]
2017-12-26  7:27 ` [dpdk-dev] [PATCH 4/6] net/sfc: use Tx queue max fill level calculated on init Andrew Rybchenko
2017-12-26  7:27 ` [dpdk-dev] [PATCH 5/6] net/sfc: support more options for a number of Rx descriptors Andrew Rybchenko
2017-12-26  7:27 ` [dpdk-dev] [PATCH 6/6] net/sfc: support more options for a number of Tx descriptors Andrew Rybchenko
2018-01-09 19:31 ` [dpdk-dev] [PATCH 0/6] net/sfc: support more options for a number of Rx/Tx descs Ferruh Yigit
2018-01-09 20:24 ` [dpdk-dev] [PATCH v2 " Andrew Rybchenko
2018-01-09 20:24   ` [dpdk-dev] [PATCH v2 1/6] net/sfc: make refill threshold check Rx datapath specific Andrew Rybchenko
2018-01-09 20:24   ` [dpdk-dev] [PATCH v2 2/6] net/sfc: make Tx free threshold check " Andrew Rybchenko
2018-01-09 20:24   ` [dpdk-dev] [PATCH v2 3/6] net/sfc: use Rx queue max fill level calculated on init Andrew Rybchenko
2018-01-09 20:24   ` [dpdk-dev] [PATCH v2 4/6] net/sfc: use Tx " Andrew Rybchenko
2018-01-09 20:24   ` [dpdk-dev] [PATCH v2 5/6] net/sfc: support more options for a number of Rx descriptors Andrew Rybchenko
2018-01-09 20:24   ` [dpdk-dev] [PATCH v2 6/6] net/sfc: support more options for a number of Tx descriptors Andrew Rybchenko
2018-01-10 19:40   ` [dpdk-dev] [PATCH v2 0/6] net/sfc: support more options for a number of Rx/Tx descs Ferruh Yigit

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=1514273271-19604-4-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@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).