patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Rasesh Mody <rmody@marvell.com>
To: <dev@dpdk.org>, <jerinj@marvell.com>, <ferruh.yigit@intel.com>
Cc: Rasesh Mody <rmody@marvell.com>,
	<GR-Everest-DPDK-Dev@marvell.com>, <stable@dpdk.org>
Subject: [dpdk-stable] [PATCH v2 2/2] examples/kni: fix MTU change to setup Tx queue
Date: Wed, 13 May 2020 21:09:38 -0700
Message-ID: <20200514040938.25505-2-rmody@marvell.com> (raw)
In-Reply-To: <20200505030943.1091-1-rmody@marvell.com>

This patch adds a fix to setup Tx queue when changing KNI interface MTU.
It ensures device can safely start txq post MTU change operation.

Fixes: fc9ee41b7016 ("examples/kni: convert to new ethdev offloads API")
Cc: stable@dpdk.org

Signed-off-by: Rasesh Mody <rmody@marvell.com>
---
 examples/kni/main.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/examples/kni/main.c b/examples/kni/main.c
index 6b4ab3b5b..7a927a50c 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -774,9 +774,11 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
 {
 	int ret;
 	uint16_t nb_rxd = NB_RXD;
+	uint16_t nb_txd = NB_TXD;
 	struct rte_eth_conf conf;
 	struct rte_eth_dev_info dev_info;
 	struct rte_eth_rxconf rxq_conf;
+	struct rte_eth_txconf txq_conf;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
 		RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id);
@@ -804,7 +806,7 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
 		return ret;
 	}
 
-	ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, NULL);
+	ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd);
 	if (ret < 0)
 		rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors "
 				"for port%u (%d)\n", (unsigned int)port_id,
@@ -829,6 +831,16 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
 		return ret;
 	}
 
+	txq_conf = dev_info.default_txconf;
+	txq_conf.offloads = conf.txmode.offloads;
+	ret = rte_eth_tx_queue_setup(port_id, 0, nb_txd,
+		rte_eth_dev_socket_id(port_id), &txq_conf);
+	if (ret < 0) {
+		RTE_LOG(ERR, APP, "Fail to setup Tx queue of port %d\n",
+				port_id);
+		return ret;
+	}
+
 	/* Restart specific port */
 	ret = rte_eth_dev_start(port_id);
 	if (ret < 0) {
-- 
2.18.0


  parent reply	other threads:[~2020-05-14  4:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05  3:09 [dpdk-stable] [PATCH 1/2] net/qede: fix assignment of Rx/Tx handlers Rasesh Mody
2020-05-05  9:01 ` Ferruh Yigit
2020-05-06  2:34   ` [dpdk-stable] [EXT] " Rasesh Mody
2020-05-14  4:09 ` [dpdk-stable] [PATCH v2 " Rasesh Mody
2020-05-14  4:09 ` Rasesh Mody [this message]
2020-05-14 15:33   ` [dpdk-stable] [PATCH v2 2/2] examples/kni: fix MTU change to setup Tx queue Ferruh Yigit
2020-05-15 11:29   ` Ferruh Yigit
2020-05-19 16:31     ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2020-05-15  6:34 ` [dpdk-stable] [PATCH v3 1/2] net/qede: fix assignment of Rx/Tx handlers Rasesh Mody
2020-05-15 12:26   ` [dpdk-stable] [dpdk-dev] " Jerin Jacob
2020-05-15  6:34 ` [dpdk-stable] [PATCH v3 2/2] net/qede: fix port reconfiguration Rasesh Mody

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=20200514040938.25505-2-rmody@marvell.com \
    --to=rmody@marvell.com \
    --cc=GR-Everest-DPDK-Dev@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.com \
    --cc=stable@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

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git