From: Andrew Boyer <aboyer@pensando.io>
To: dev@dpdk.org
Cc: Alfredo Cardigliano <cardigliano@ntop.org>,
Andrew Boyer <aboyer@pensando.io>
Subject: [dpdk-dev] [PATCH 5/6] net/ionic: improve queue state handling
Date: Thu, 10 Dec 2020 06:22:30 -0800 [thread overview]
Message-ID: <20201210142231.63209-6-aboyer@pensando.io> (raw)
In-Reply-To: <20201210142231.63209-1-aboyer@pensando.io>
Skip ionic_lif_[rxq|txq]_init() in queue start if it's already done.
Move ionic_lif_[rxq|txq]_deinit() from queue stop to queue release.
This allows the queues to be restarted.
Signed-off-by: Andrew Boyer <aboyer@pensando.io>
---
drivers/net/ionic/ionic_rxtx.c | 62 +++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c
index b689c8381..d06f1246c 100644
--- a/drivers/net/ionic/ionic_rxtx.c
+++ b/drivers/net/ionic/ionic_rxtx.c
@@ -125,6 +125,8 @@ ionic_dev_tx_queue_release(void *tx_queue)
IONIC_PRINT_CALL();
+ ionic_lif_txq_deinit(txq);
+
ionic_qcq_free(txq);
}
@@ -137,6 +139,9 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id)
txq = eth_dev->data->tx_queues[tx_queue_id];
+ eth_dev->data->tx_queue_state[tx_queue_id] =
+ RTE_ETH_QUEUE_STATE_STOPPED;
+
/*
* Note: we should better post NOP Tx desc and wait for its completion
* before disabling Tx queue
@@ -146,11 +151,6 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id)
ionic_tx_flush(&txq->cq);
- ionic_lif_txq_deinit(txq);
-
- eth_dev->data->tx_queue_state[tx_queue_id] =
- RTE_ETH_QUEUE_STATE_STOPPED;
-
return 0;
}
@@ -187,6 +187,9 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
eth_dev->data->tx_queues[tx_queue_id] = NULL;
}
+ eth_dev->data->tx_queue_state[tx_queue_id] =
+ RTE_ETH_QUEUE_STATE_STOPPED;
+
err = ionic_tx_qcq_alloc(lif, tx_queue_id, nb_desc, &txq);
if (err) {
IONIC_PRINT(DEBUG, "Queue allocation failure");
@@ -210,22 +213,30 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
int __rte_cold
ionic_dev_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id)
{
+ uint8_t *tx_queue_state = eth_dev->data->tx_queue_state;
struct ionic_qcq *txq;
int err;
+ if (tx_queue_state[tx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) {
+ IONIC_PRINT(DEBUG, "TX queue %u already started",
+ tx_queue_id);
+ return 0;
+ }
+
txq = eth_dev->data->tx_queues[tx_queue_id];
IONIC_PRINT(DEBUG, "Starting TX queue %u, %u descs",
tx_queue_id, txq->q.num_descs);
- err = ionic_lif_txq_init(txq);
- if (err)
- return err;
+ if (!(txq->flags & IONIC_QCQ_F_INITED)) {
+ err = ionic_lif_txq_init(txq);
+ if (err)
+ return err;
+ }
ionic_qcq_enable(txq);
- eth_dev->data->tx_queue_state[tx_queue_id] =
- RTE_ETH_QUEUE_STATE_STARTED;
+ tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
return 0;
}
@@ -634,6 +645,8 @@ ionic_dev_rx_queue_release(void *rx_queue)
ionic_rx_empty(&rxq->q);
+ ionic_lif_rxq_deinit(rxq);
+
ionic_qcq_free(rxq);
}
@@ -682,6 +695,9 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
eth_dev->data->rx_queues[rx_queue_id] = NULL;
}
+ eth_dev->data->rx_queue_state[rx_queue_id] =
+ RTE_ETH_QUEUE_STATE_STOPPED;
+
err = ionic_rx_qcq_alloc(lif, rx_queue_id, nb_desc, &rxq);
if (err) {
IONIC_PRINT(ERR, "Queue %d allocation failure", rx_queue_id);
@@ -953,17 +969,26 @@ int __rte_cold
ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
{
uint32_t frame_size = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
+ uint8_t *rx_queue_state = eth_dev->data->rx_queue_state;
struct ionic_qcq *rxq;
int err;
+ if (rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) {
+ IONIC_PRINT(DEBUG, "RX queue %u already started",
+ rx_queue_id);
+ return 0;
+ }
+
rxq = eth_dev->data->rx_queues[rx_queue_id];
IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs (size: %u)",
rx_queue_id, rxq->q.num_descs, frame_size);
- err = ionic_lif_rxq_init(rxq);
- if (err)
- return err;
+ if (!(rxq->flags & IONIC_QCQ_F_INITED)) {
+ err = ionic_lif_rxq_init(rxq);
+ if (err)
+ return err;
+ }
/* Allocate buffers for descriptor rings */
if (ionic_rx_fill(rxq, frame_size) != 0) {
@@ -974,8 +999,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
ionic_qcq_enable(rxq);
- eth_dev->data->rx_queue_state[rx_queue_id] =
- RTE_ETH_QUEUE_STATE_STARTED;
+ rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
return 0;
}
@@ -1044,16 +1068,14 @@ ionic_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
rxq = eth_dev->data->rx_queues[rx_queue_id];
+ eth_dev->data->rx_queue_state[rx_queue_id] =
+ RTE_ETH_QUEUE_STATE_STOPPED;
+
ionic_qcq_disable(rxq);
/* Flush */
ionic_rxq_service(&rxq->cq, -1, NULL);
- ionic_lif_rxq_deinit(rxq);
-
- eth_dev->data->rx_queue_state[rx_queue_id] =
- RTE_ETH_QUEUE_STATE_STOPPED;
-
return 0;
}
--
2.17.1
next prev parent reply other threads:[~2020-12-10 14:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-10 14:22 [dpdk-dev] [PATCH 0/6] net/ionic: fixes for stop and start Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 1/6] net/ionic: preserve RSS state unless RETA size changes Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 2/6] net/ionic: preserve RX mode across LIF stop/start Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 3/6] net/ionic: fully implement remove-on-close Andrew Boyer
2020-12-15 13:42 ` Ferruh Yigit
2020-12-16 19:52 ` Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 4/6] net/ionic: improve link state handling Andrew Boyer
2020-12-10 14:22 ` Andrew Boyer [this message]
2020-12-10 14:22 ` [dpdk-dev] [PATCH 6/6] net/ionic: stop queues when LIF is stopped Andrew Boyer
2020-12-15 14:01 ` [dpdk-dev] [PATCH 0/6] net/ionic: fixes for stop and start Ferruh Yigit
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 0/7] " Andrew Boyer
2021-01-11 17:08 ` Ferruh Yigit
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 1/7] net/ionic: preserve RSS state unless RETA size changes Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 2/7] net/ionic: preserve Rx mode across LIF stop/start Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 3/7] net/ionic: remove multi-LIF support Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 4/7] net/ionic: fully implement remove-on-close Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 5/7] net/ionic: improve link state handling Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 6/7] net/ionic: improve queue " Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 7/7] net/ionic: stop queues when LIF is stopped Andrew Boyer
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=20201210142231.63209-6-aboyer@pensando.io \
--to=aboyer@pensando.io \
--cc=cardigliano@ntop.org \
--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).