From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 4/6] net/sfc: use Tx queue max fill level calculated on init
Date: Tue, 26 Dec 2017 07:27:49 +0000 [thread overview]
Message-ID: <1514273271-19604-5-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 Tx 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_tx.h | 2 ++
drivers/net/sfc/sfc_ef10_tx.c | 20 ++++++++------------
drivers/net/sfc/sfc_tx.c | 6 ++++--
drivers/net/sfc/sfc_tx.h | 1 +
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/net/sfc/sfc_dp_tx.h b/drivers/net/sfc/sfc_dp_tx.h
index 32d7681..4485b2f 100644
--- a/drivers/net/sfc/sfc_dp_tx.h
+++ b/drivers/net/sfc/sfc_dp_tx.h
@@ -57,6 +57,8 @@ struct sfc_dp_txq {
* readable.
*/
struct sfc_dp_tx_qcreate_info {
+ /** Maximum number of pushed Tx descriptors */
+ unsigned int max_fill_level;
/** Minimum number of unused Tx descriptors to do reap */
unsigned int free_thresh;
/** Transmit queue configuration flags */
diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c
index ab3334a..99fe87e 100644
--- a/drivers/net/sfc/sfc_ef10_tx.c
+++ b/drivers/net/sfc/sfc_ef10_tx.c
@@ -77,6 +77,7 @@ struct sfc_ef10_txq {
unsigned int ptr_mask;
unsigned int added;
unsigned int completed;
+ unsigned int max_fill_level;
unsigned int free_thresh;
unsigned int evq_read_ptr;
struct sfc_ef10_tx_sw_desc *sw_ring;
@@ -288,7 +289,6 @@ static uint16_t
sfc_ef10_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
struct sfc_ef10_txq * const txq = sfc_ef10_txq_by_dp_txq(tx_queue);
- unsigned int ptr_mask;
unsigned int added;
unsigned int dma_desc_space;
bool reap_done;
@@ -299,16 +299,13 @@ sfc_ef10_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
(SFC_EF10_TXQ_NOT_RUNNING | SFC_EF10_TXQ_EXCEPTION)))
return 0;
- ptr_mask = txq->ptr_mask;
added = txq->added;
- dma_desc_space = SFC_EF10_TXQ_LIMIT(ptr_mask + 1) -
- (added - txq->completed);
+ dma_desc_space = txq->max_fill_level - (added - txq->completed);
reap_done = (dma_desc_space < txq->free_thresh);
if (reap_done) {
sfc_ef10_tx_reap(txq);
- dma_desc_space = SFC_EF10_TXQ_LIMIT(ptr_mask + 1) -
- (added - txq->completed);
+ dma_desc_space = txq->max_fill_level - (added - txq->completed);
}
for (pktp = &tx_pkts[0], pktp_end = &tx_pkts[nb_pkts];
@@ -333,7 +330,7 @@ sfc_ef10_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
sfc_ef10_tx_reap(txq);
reap_done = true;
- dma_desc_space = SFC_EF10_TXQ_LIMIT(ptr_mask + 1) -
+ dma_desc_space = txq->max_fill_level -
(added - txq->completed);
if (sfc_ef10_tx_pkt_descs_max(m_seg) > dma_desc_space)
break;
@@ -343,7 +340,7 @@ sfc_ef10_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
do {
rte_iova_t seg_addr = rte_mbuf_data_iova(m_seg);
unsigned int seg_len = rte_pktmbuf_data_len(m_seg);
- unsigned int id = added & ptr_mask;
+ unsigned int id = added & txq->ptr_mask;
SFC_ASSERT(seg_len <= SFC_EF10_TX_DMA_DESC_LEN_MAX);
@@ -446,14 +443,12 @@ sfc_ef10_simple_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
ptr_mask = txq->ptr_mask;
added = txq->added;
- dma_desc_space = SFC_EF10_TXQ_LIMIT(ptr_mask + 1) -
- (added - txq->completed);
+ dma_desc_space = txq->max_fill_level - (added - txq->completed);
reap_done = (dma_desc_space < RTE_MAX(txq->free_thresh, nb_pkts));
if (reap_done) {
sfc_ef10_simple_tx_reap(txq);
- dma_desc_space = SFC_EF10_TXQ_LIMIT(ptr_mask + 1) -
- (added - txq->completed);
+ dma_desc_space = txq->max_fill_level - (added - txq->completed);
}
pktp_end = &tx_pkts[MIN(nb_pkts, dma_desc_space)];
@@ -532,6 +527,7 @@ sfc_ef10_tx_qcreate(uint16_t port_id, uint16_t queue_id,
txq->flags = SFC_EF10_TXQ_NOT_RUNNING;
txq->ptr_mask = info->txq_entries - 1;
+ txq->max_fill_level = info->max_fill_level;
txq->free_thresh = info->free_thresh;
txq->txq_hw_ring = info->txq_hw_ring;
txq->doorbell = (volatile uint8_t *)info->mem_bar +
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index 3c9a6e9..f8ee976 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -196,6 +196,7 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
goto fail_dma_alloc;
memset(&info, 0, sizeof(info));
+ info.max_fill_level = txq_max_fill_level;
info.free_thresh = txq->free_thresh;
info.flags = tx_conf->txq_flags;
info.txq_entries = txq_info->entries;
@@ -687,7 +688,7 @@ sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
unsigned int pushed = added;
unsigned int pkts_sent = 0;
efx_desc_t *pend = &txq->pend_desc[0];
- const unsigned int hard_max_fill = EFX_TXQ_LIMIT(txq->ptr_mask + 1);
+ const unsigned int hard_max_fill = txq->max_fill_level;
const unsigned int soft_max_fill = hard_max_fill - txq->free_thresh;
unsigned int fill_level = added - txq->completed;
boolean_t reap_done;
@@ -933,6 +934,7 @@ sfc_efx_tx_qcreate(uint16_t port_id, uint16_t queue_id,
txq->evq = ctrl_txq->evq;
txq->ptr_mask = info->txq_entries - 1;
+ txq->max_fill_level = info->max_fill_level;
txq->free_thresh = info->free_thresh;
txq->dma_desc_size_max = info->dma_desc_size_max;
@@ -1022,7 +1024,7 @@ sfc_efx_tx_qdesc_status(struct sfc_dp_txq *dp_txq, uint16_t offset)
if (unlikely(offset > txq->ptr_mask))
return -EINVAL;
- if (unlikely(offset >= EFX_TXQ_LIMIT(txq->ptr_mask + 1)))
+ if (unlikely(offset >= txq->max_fill_level))
return RTE_ETH_TX_DESC_UNAVAIL;
/*
diff --git a/drivers/net/sfc/sfc_tx.h b/drivers/net/sfc/sfc_tx.h
index 0c1c708..2318f31 100644
--- a/drivers/net/sfc/sfc_tx.h
+++ b/drivers/net/sfc/sfc_tx.h
@@ -110,6 +110,7 @@ struct sfc_efx_txq {
unsigned int added;
unsigned int pending;
unsigned int completed;
+ unsigned int max_fill_level;
unsigned int free_thresh;
uint16_t hw_vlan_tci;
uint16_t dma_desc_size_max;
--
2.7.4
next prev 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 ` [dpdk-dev] [PATCH 3/6] net/sfc: use Rx queue max fill level calculated on init Andrew Rybchenko
2017-12-26 7:27 ` Andrew Rybchenko [this message]
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-5-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).