* [dpdk-dev] [PATCH] net/octeontx2: fix device configuration sequence
@ 2020-04-04 15:19 pbhagavatula
2020-04-06 6:19 ` Jerin Jacob
0 siblings, 1 reply; 2+ messages in thread
From: pbhagavatula @ 2020-04-04 15:19 UTC (permalink / raw)
To: jerinj, Nithin Dabilpuram, Kiran Kumar K; +Cc: dev, Pavan Nikhilesh, stable
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
When an application invokes rte_eth_dev_configure consecutively without
setting up Rx/Tx queues, it will incorrectly return error while trying
to restore Rx/Tx queue configuration.
Fix configuration sequence by checking if any Rx/Tx queues are
previously configured before trying to restore them.
Fixes: 548b5839a32b ("net/octeontx2: add device configure operation")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
drivers/net/octeontx2/otx2_ethdev.c | 16 ++++++++++++----
drivers/net/octeontx2/otx2_ethdev.h | 1 +
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index e60f4901c..9fbca2b05 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1132,10 +1132,12 @@ nix_store_queue_cfg_and_then_release(struct rte_eth_dev *eth_dev)
txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues;
for (i = 0; i < nb_txq; i++) {
if (txq[i] == NULL) {
- otx2_err("txq[%d] is already released", i);
- goto fail;
+ tx_qconf[i].valid = false;
+ otx2_info("txq[%d] is already released", i);
+ continue;
}
memcpy(&tx_qconf[i], &txq[i]->qconf, sizeof(*tx_qconf));
+ tx_qconf[i].valid = true;
otx2_nix_tx_queue_release(txq[i]);
eth_dev->data->tx_queues[i] = NULL;
}
@@ -1143,10 +1145,12 @@ nix_store_queue_cfg_and_then_release(struct rte_eth_dev *eth_dev)
rxq = (struct otx2_eth_rxq **)eth_dev->data->rx_queues;
for (i = 0; i < nb_rxq; i++) {
if (rxq[i] == NULL) {
- otx2_err("rxq[%d] is already released", i);
- goto fail;
+ rx_qconf[i].valid = false;
+ otx2_info("rxq[%d] is already released", i);
+ continue;
}
memcpy(&rx_qconf[i], &rxq[i]->qconf, sizeof(*rx_qconf));
+ rx_qconf[i].valid = true;
otx2_nix_rx_queue_release(rxq[i]);
eth_dev->data->rx_queues[i] = NULL;
}
@@ -1201,6 +1205,8 @@ nix_restore_queue_cfg(struct rte_eth_dev *eth_dev)
* queues are already setup in port_configure().
*/
for (i = 0; i < nb_txq; i++) {
+ if (!tx_qconf[i].valid)
+ continue;
rc = otx2_nix_tx_queue_setup(eth_dev, i, tx_qconf[i].nb_desc,
tx_qconf[i].socket_id,
&tx_qconf[i].conf.tx);
@@ -1216,6 +1222,8 @@ nix_restore_queue_cfg(struct rte_eth_dev *eth_dev)
free(tx_qconf); tx_qconf = NULL;
for (i = 0; i < nb_rxq; i++) {
+ if (!rx_qconf[i].valid)
+ continue;
rc = otx2_nix_rx_queue_setup(eth_dev, i, rx_qconf[i].nb_desc,
rx_qconf[i].socket_id,
&rx_qconf[i].conf.rx,
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index e5684f9f0..238afb3a8 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -196,6 +196,7 @@ struct otx2_eth_qconf {
void *mempool;
uint32_t socket_id;
uint16_t nb_desc;
+ uint8_t valid;
};
struct otx2_fc_info {
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] net/octeontx2: fix device configuration sequence
2020-04-04 15:19 [dpdk-dev] [PATCH] net/octeontx2: fix device configuration sequence pbhagavatula
@ 2020-04-06 6:19 ` Jerin Jacob
0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2020-04-06 6:19 UTC (permalink / raw)
To: Pavan Nikhilesh
Cc: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, dpdk-dev, dpdk stable
On Sat, Apr 4, 2020 at 8:50 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> When an application invokes rte_eth_dev_configure consecutively without
> setting up Rx/Tx queues, it will incorrectly return error while trying
> to restore Rx/Tx queue configuration.
>
> Fix configuration sequence by checking if any Rx/Tx queues are
> previously configured before trying to restore them.
>
> Fixes: 548b5839a32b ("net/octeontx2: add device configure operation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-mrvl/master. Thanks
> ---
> drivers/net/octeontx2/otx2_ethdev.c | 16 ++++++++++++----
> drivers/net/octeontx2/otx2_ethdev.h | 1 +
> 2 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
> index e60f4901c..9fbca2b05 100644
> --- a/drivers/net/octeontx2/otx2_ethdev.c
> +++ b/drivers/net/octeontx2/otx2_ethdev.c
> @@ -1132,10 +1132,12 @@ nix_store_queue_cfg_and_then_release(struct rte_eth_dev *eth_dev)
> txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues;
> for (i = 0; i < nb_txq; i++) {
> if (txq[i] == NULL) {
> - otx2_err("txq[%d] is already released", i);
> - goto fail;
> + tx_qconf[i].valid = false;
> + otx2_info("txq[%d] is already released", i);
> + continue;
> }
> memcpy(&tx_qconf[i], &txq[i]->qconf, sizeof(*tx_qconf));
> + tx_qconf[i].valid = true;
> otx2_nix_tx_queue_release(txq[i]);
> eth_dev->data->tx_queues[i] = NULL;
> }
> @@ -1143,10 +1145,12 @@ nix_store_queue_cfg_and_then_release(struct rte_eth_dev *eth_dev)
> rxq = (struct otx2_eth_rxq **)eth_dev->data->rx_queues;
> for (i = 0; i < nb_rxq; i++) {
> if (rxq[i] == NULL) {
> - otx2_err("rxq[%d] is already released", i);
> - goto fail;
> + rx_qconf[i].valid = false;
> + otx2_info("rxq[%d] is already released", i);
> + continue;
> }
> memcpy(&rx_qconf[i], &rxq[i]->qconf, sizeof(*rx_qconf));
> + rx_qconf[i].valid = true;
> otx2_nix_rx_queue_release(rxq[i]);
> eth_dev->data->rx_queues[i] = NULL;
> }
> @@ -1201,6 +1205,8 @@ nix_restore_queue_cfg(struct rte_eth_dev *eth_dev)
> * queues are already setup in port_configure().
> */
> for (i = 0; i < nb_txq; i++) {
> + if (!tx_qconf[i].valid)
> + continue;
> rc = otx2_nix_tx_queue_setup(eth_dev, i, tx_qconf[i].nb_desc,
> tx_qconf[i].socket_id,
> &tx_qconf[i].conf.tx);
> @@ -1216,6 +1222,8 @@ nix_restore_queue_cfg(struct rte_eth_dev *eth_dev)
> free(tx_qconf); tx_qconf = NULL;
>
> for (i = 0; i < nb_rxq; i++) {
> + if (!rx_qconf[i].valid)
> + continue;
> rc = otx2_nix_rx_queue_setup(eth_dev, i, rx_qconf[i].nb_desc,
> rx_qconf[i].socket_id,
> &rx_qconf[i].conf.rx,
> diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
> index e5684f9f0..238afb3a8 100644
> --- a/drivers/net/octeontx2/otx2_ethdev.h
> +++ b/drivers/net/octeontx2/otx2_ethdev.h
> @@ -196,6 +196,7 @@ struct otx2_eth_qconf {
> void *mempool;
> uint32_t socket_id;
> uint16_t nb_desc;
> + uint8_t valid;
> };
>
> struct otx2_fc_info {
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-06 6:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04 15:19 [dpdk-dev] [PATCH] net/octeontx2: fix device configuration sequence pbhagavatula
2020-04-06 6:19 ` Jerin Jacob
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).