From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH v2 6/6] net/sfc: support more options for a number of Tx descriptors
Date: Tue, 9 Jan 2018 20:24:55 +0000 [thread overview]
Message-ID: <1515529495-16157-7-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1515529495-16157-1-git-send-email-arybchenko@solarflare.com>
The number of Tx descriptors is not used as HW Tx ring size any more.
It simply defines maximum fill level.
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
---
drivers/net/sfc/sfc_dp_tx.h | 8 ++++++++
drivers/net/sfc/sfc_ef10_tx.c | 29 ++++++++++++++++++++++++++---
drivers/net/sfc/sfc_ethdev.c | 3 +++
drivers/net/sfc/sfc_tx.c | 5 ++++-
4 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/drivers/net/sfc/sfc_dp_tx.h b/drivers/net/sfc/sfc_dp_tx.h
index 4485b2f..a384a53 100644
--- a/drivers/net/sfc/sfc_dp_tx.h
+++ b/drivers/net/sfc/sfc_dp_tx.h
@@ -80,6 +80,13 @@ struct sfc_dp_tx_qcreate_info {
};
/**
+ * Get Tx datapath specific device info.
+ *
+ * @param dev_info Device info to be adjusted
+ */
+typedef void (sfc_dp_tx_get_dev_info_t)(struct rte_eth_dev_info *dev_info);
+
+/**
* Get size of transmit and event queue rings by the number of Tx
* descriptors.
*
@@ -162,6 +169,7 @@ struct sfc_dp_tx {
#define SFC_DP_TX_FEAT_MULTI_PROCESS 0x8
#define SFC_DP_TX_FEAT_MULTI_POOL 0x10
#define SFC_DP_TX_FEAT_REFCNT 0x20
+ sfc_dp_tx_get_dev_info_t *get_dev_info;
sfc_dp_tx_qsize_up_rings_t *qsize_up_rings;
sfc_dp_tx_qcreate_t *qcreate;
sfc_dp_tx_qdestroy_t *qdestroy;
diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c
index 99fe87e..02df39c 100644
--- a/drivers/net/sfc/sfc_ef10_tx.c
+++ b/drivers/net/sfc/sfc_ef10_tx.c
@@ -481,6 +481,17 @@ sfc_ef10_simple_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
return pktp - &tx_pkts[0];
}
+static sfc_dp_tx_get_dev_info_t sfc_ef10_get_dev_info;
+static void
+sfc_ef10_get_dev_info(struct rte_eth_dev_info *dev_info)
+{
+ /*
+ * Number of descriptors just defines maximum number of pushed
+ * descriptors (fill level).
+ */
+ dev_info->tx_desc_lim.nb_min = 1;
+ dev_info->tx_desc_lim.nb_align = 1;
+}
static sfc_dp_tx_qsize_up_rings_t sfc_ef10_tx_qsize_up_rings;
static int
@@ -489,9 +500,19 @@ sfc_ef10_tx_qsize_up_rings(uint16_t nb_tx_desc,
unsigned int *evq_entries,
unsigned int *txq_max_fill_level)
{
- *txq_entries = nb_tx_desc;
- *evq_entries = nb_tx_desc;
- *txq_max_fill_level = SFC_EF10_TXQ_LIMIT(*txq_entries);
+ /*
+ * rte_ethdev API guarantees that the number meets min, max and
+ * alignment requirements.
+ */
+ if (nb_tx_desc <= EFX_TXQ_MINNDESCS)
+ *txq_entries = EFX_TXQ_MINNDESCS;
+ else
+ *txq_entries = rte_align32pow2(nb_tx_desc);
+
+ *evq_entries = *txq_entries;
+
+ *txq_max_fill_level = RTE_MIN(nb_tx_desc,
+ SFC_EF10_TXQ_LIMIT(*evq_entries));
return 0;
}
@@ -637,6 +658,7 @@ struct sfc_dp_tx sfc_ef10_tx = {
SFC_DP_TX_FEAT_MULTI_POOL |
SFC_DP_TX_FEAT_REFCNT |
SFC_DP_TX_FEAT_MULTI_PROCESS,
+ .get_dev_info = sfc_ef10_get_dev_info,
.qsize_up_rings = sfc_ef10_tx_qsize_up_rings,
.qcreate = sfc_ef10_tx_qcreate,
.qdestroy = sfc_ef10_tx_qdestroy,
@@ -654,6 +676,7 @@ struct sfc_dp_tx sfc_ef10_simple_tx = {
.type = SFC_DP_TX,
},
.features = SFC_DP_TX_FEAT_MULTI_PROCESS,
+ .get_dev_info = sfc_ef10_get_dev_info,
.qsize_up_rings = sfc_ef10_tx_qsize_up_rings,
.qcreate = sfc_ef10_tx_qcreate,
.qdestroy = sfc_ef10_tx_qdestroy,
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index fec91c3..e677ba5 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -178,6 +178,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
*/
dev_info->rx_desc_lim.nb_align = EFX_RXQ_MINNDESCS;
+ /* Initialize to hardware limits */
dev_info->tx_desc_lim.nb_max = sa->txq_max_entries;
dev_info->tx_desc_lim.nb_min = EFX_TXQ_MINNDESCS;
/*
@@ -188,6 +189,8 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
if (sa->dp_rx->get_dev_info != NULL)
sa->dp_rx->get_dev_info(dev_info);
+ if (sa->dp_tx->get_dev_info != NULL)
+ sa->dp_tx->get_dev_info(dev_info);
}
static const uint32_t *
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index 8f932b0..bdf63b7 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -160,6 +160,10 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
&txq_max_fill_level);
if (rc != 0)
goto fail_size_up_rings;
+ SFC_ASSERT(txq_entries >= EFX_TXQ_MINNDESCS);
+ SFC_ASSERT(txq_entries <= sa->txq_max_entries);
+ SFC_ASSERT(txq_entries >= nb_tx_desc);
+ SFC_ASSERT(txq_max_fill_level <= nb_tx_desc);
rc = sfc_tx_qcheck_conf(sa, txq_max_fill_level, tx_conf);
if (rc != 0)
@@ -168,7 +172,6 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
SFC_ASSERT(sw_index < sa->txq_count);
txq_info = &sa->txq_info[sw_index];
- SFC_ASSERT(txq_entries <= sa->txq_max_entries);
txq_info->entries = txq_entries;
rc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_TX, sw_index,
--
2.7.4
next prev parent reply other threads:[~2018-01-09 20:25 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 ` [dpdk-dev] [PATCH 4/6] net/sfc: use Tx " 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 ` Andrew Rybchenko [this message]
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=1515529495-16157-7-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.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).