From: Tomasz Duszynski <tdu@semihalf.com>
To: dev@dpdk.org
Cc: mw@semihalf.com, dima@marvell.com, nsamsono@marvell.com,
jck@semihalf.com, jianbo.liu@arm.com,
Tomasz Duszynski <tdu@semihalf.com>
Subject: [dpdk-dev] [PATCH v2 8/8] net/mrvl: add Tx queue start/stop
Date: Mon, 12 Mar 2018 09:42:12 +0100 [thread overview]
Message-ID: <1520844132-29969-9-git-send-email-tdu@semihalf.com> (raw)
In-Reply-To: <1520844132-29969-1-git-send-email-tdu@semihalf.com>
Add Tx queue start/stop feature.
Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
doc/guides/nics/mrvl.rst | 1 +
drivers/net/mrvl/mrvl_ethdev.c | 92 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 91 insertions(+), 2 deletions(-)
diff --git a/doc/guides/nics/mrvl.rst b/doc/guides/nics/mrvl.rst
index 550bd79..f9ec9d6 100644
--- a/doc/guides/nics/mrvl.rst
+++ b/doc/guides/nics/mrvl.rst
@@ -73,6 +73,7 @@ Features of the MRVL PMD are:
- Extended stats
- QoS
- RX flow control
+- TX queue start/stop
Limitations
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index 21a83c9..a6b77a2 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -134,6 +134,7 @@ struct mrvl_txq {
int port_id;
uint64_t bytes_sent;
struct mrvl_shadow_txq shadow_txqs[RTE_MAX_LCORE];
+ int tx_deferred_start;
};
static int mrvl_lcore_first;
@@ -459,6 +460,70 @@ mrvl_dev_set_link_down(struct rte_eth_dev *dev)
}
/**
+ * DPDK callback to start tx queue.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ * @param queue_id
+ * Transmit queue index.
+ *
+ * @return
+ * 0 on success, negative error value otherwise.
+ */
+static int
+mrvl_tx_queue_start(struct rte_eth_dev *dev, uint16_t queue_id)
+{
+ struct mrvl_priv *priv = dev->data->dev_private;
+ int ret;
+
+ if (!priv)
+ return -EPERM;
+
+ /* passing 1 enables given tx queue */
+ ret = pp2_ppio_set_outq_state(priv->ppio, queue_id, 1);
+ if (ret) {
+ RTE_LOG(ERR, PMD, "Failed to start txq %d\n", queue_id);
+ return ret;
+ }
+
+ dev->data->tx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+
+ return 0;
+}
+
+/**
+ * DPDK callback to stop tx queue.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ * @param queue_id
+ * Transmit queue index.
+ *
+ * @return
+ * 0 on success, negative error value otherwise.
+ */
+static int
+mrvl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t queue_id)
+{
+ struct mrvl_priv *priv = dev->data->dev_private;
+ int ret;
+
+ if (!priv->ppio)
+ return -EPERM;
+
+ /* passing 0 disables given tx queue */
+ ret = pp2_ppio_set_outq_state(priv->ppio, queue_id, 0);
+ if (ret) {
+ RTE_LOG(ERR, PMD, "Failed to stop txq %d\n", queue_id);
+ return ret;
+ }
+
+ dev->data->tx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
+
+ return 0;
+}
+
+/**
* DPDK callback to start the device.
*
* @param dev
@@ -472,7 +537,7 @@ mrvl_dev_start(struct rte_eth_dev *dev)
{
struct mrvl_priv *priv = dev->data->dev_private;
char match[MRVL_MATCH_LEN];
- int ret = 0, def_init_size;
+ int ret = 0, i, def_init_size;
snprintf(match, sizeof(match), "ppio-%d:%d",
priv->pp_id, priv->ppio_id);
@@ -559,6 +624,24 @@ mrvl_dev_start(struct rte_eth_dev *dev)
goto out;
}
+ /* start tx queues */
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
+ struct mrvl_txq *txq = dev->data->tx_queues[i];
+
+ dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+
+ if (!txq->tx_deferred_start)
+ continue;
+
+ /*
+ * All txqs are started by default. Stop them
+ * so that tx_deferred_start works as expected.
+ */
+ ret = mrvl_tx_queue_stop(dev, i);
+ if (ret)
+ goto out;
+ }
+
return 0;
out:
RTE_LOG(ERR, PMD, "Failed to start device\n");
@@ -1330,9 +1413,11 @@ static void mrvl_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
struct rte_eth_txq_info *qinfo)
{
struct mrvl_priv *priv = dev->data->dev_private;
+ struct mrvl_txq *txq = dev->data->tx_queues[tx_queue_id];
qinfo->nb_desc =
priv->ppio_params.outqs_params.outqs_params[tx_queue_id].size;
+ qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
}
/**
@@ -1643,7 +1728,7 @@ mrvl_tx_queue_offloads_okay(struct rte_eth_dev *dev, uint64_t requested)
* @param socket
* NUMA socket on which memory must be allocated.
* @param conf
- * Thresholds parameters.
+ * Tx queue configuration parameters.
*
* @return
* 0 on success, negative error value otherwise.
@@ -1671,6 +1756,7 @@ mrvl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
txq->priv = priv;
txq->queue_id = idx;
txq->port_id = dev->data->port_id;
+ txq->tx_deferred_start = conf->tx_deferred_start;
dev->data->tx_queues[idx] = txq;
priv->ppio_params.outqs_params.outqs_params[idx].size = desc;
@@ -1974,6 +2060,8 @@ static const struct eth_dev_ops mrvl_ops = {
.rxq_info_get = mrvl_rxq_info_get,
.txq_info_get = mrvl_txq_info_get,
.vlan_filter_set = mrvl_vlan_filter_set,
+ .tx_queue_start = mrvl_tx_queue_start,
+ .tx_queue_stop = mrvl_tx_queue_stop,
.rx_queue_setup = mrvl_rx_queue_setup,
.rx_queue_release = mrvl_rx_queue_release,
.tx_queue_setup = mrvl_tx_queue_setup,
--
2.7.4
next prev parent reply other threads:[~2018-03-12 8:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 14:14 [dpdk-dev] [PATCH 0/8] net/mrvl: add new features to PMD Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 1/8] net/mrvl: fix crash when port is closed without starting Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 2/8] net/mrvl: add ingress policer support Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 3/8] net/mrvl: add egress scheduler/rate limiter support Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 4/8] net/mrvl: document policer/scheduler/rate limiter usage Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 5/8] net/mrvl: add classifier support Tomasz Duszynski
2018-03-07 11:07 ` Ferruh Yigit
2018-03-07 11:16 ` Tomasz Duszynski
2018-03-07 11:24 ` Ferruh Yigit
2018-03-08 13:23 ` Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 6/8] net/mrvl: add extended statistics Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 7/8] net/mrvl: add Rx flow control Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 8/8] net/mrvl: add Tx queue start/stop Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 0/8] net/mrvl: add new features to PMD Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 1/8] net/mrvl: fix crash when port is closed without starting Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 2/8] net/mrvl: add ingress policer support Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 3/8] net/mrvl: add egress scheduler/rate limiter support Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 4/8] net/mrvl: document policer/scheduler/rate limiter usage Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 5/8] net/mrvl: add classifier support Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 6/8] net/mrvl: add extended statistics Tomasz Duszynski
2018-03-14 17:21 ` Ferruh Yigit
2018-03-15 7:09 ` Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 7/8] net/mrvl: add Rx flow control Tomasz Duszynski
2018-03-12 8:42 ` Tomasz Duszynski [this message]
2018-03-15 7:51 ` [dpdk-dev] [PATCH v3 0/8] net/mrvl: add new features to PMD Tomasz Duszynski
2018-03-15 7:51 ` [dpdk-dev] [PATCH v3 1/8] net/mrvl: fix crash when port is closed without starting Tomasz Duszynski
2018-03-15 7:51 ` [dpdk-dev] [PATCH v3 2/8] net/mrvl: add ingress policer support Tomasz Duszynski
2018-03-15 7:51 ` [dpdk-dev] [PATCH v3 3/8] net/mrvl: add egress scheduler/rate limiter support Tomasz Duszynski
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 4/8] net/mrvl: document policer/scheduler/rate limiter usage Tomasz Duszynski
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 5/8] net/mrvl: add classifier support Tomasz Duszynski
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 6/8] net/mrvl: add extended statistics Tomasz Duszynski
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 7/8] net/mrvl: add Rx flow control Tomasz Duszynski
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 8/8] net/mrvl: add Tx queue start/stop Tomasz Duszynski
2018-03-15 15:09 ` [dpdk-dev] [PATCH v3 0/8] net/mrvl: add new features to PMD 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=1520844132-29969-9-git-send-email-tdu@semihalf.com \
--to=tdu@semihalf.com \
--cc=dev@dpdk.org \
--cc=dima@marvell.com \
--cc=jck@semihalf.com \
--cc=jianbo.liu@arm.com \
--cc=mw@semihalf.com \
--cc=nsamsono@marvell.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).