DPDK patches and discussions
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
To: <dev@dpdk.org>
Cc: <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] app/testpmd: fix offloads for the newly attached port
Date: Sat, 19 Jun 2021 18:40:12 +0300	[thread overview]
Message-ID: <20210619154012.27295-1-viacheslavo@nvidia.com> (raw)

For the newly attached ports (with "port attach" command) the
default offloads settings, configured from application command
line, were not applied, causing port start failure following
the attach. For example, if scattering offload was configured
in command line and rxpkts was configured for multiple segments,
the newly attached port start was failed due to missing scattering
offload enable in the new port settings. The missing code to apply
the offloads to the new device and its queues is added.

Cc: stable@dpdk.org
Fixes: c9cce42876f5 ("ethdev: remove deprecated attach/detach functions")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 app/test-pmd/testpmd.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 8ed1b97dec..b4ec182423 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1599,6 +1599,7 @@ reconfig(portid_t new_port_id, unsigned socket_id)
 {
 	struct rte_port *port;
 	int ret;
+	int i;
 
 	/* Reconfiguration of Ethernet ports. */
 	port = &ports[new_port_id];
@@ -1611,7 +1612,38 @@ reconfig(portid_t new_port_id, unsigned socket_id)
 	port->need_reconfig = 1;
 	port->need_reconfig_queues = 1;
 	port->socket_id = socket_id;
+	port->tx_metadata = 0;
+
+	/* Apply default TxRx configuration to the port */
+	port->dev_conf.txmode = tx_mode;
+	port->dev_conf.rxmode = rx_mode;
+
+	if (!(port->dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE))
+		port->dev_conf.txmode.offloads &=
+					~DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+
+	/* Apply Rx offloads configuration */
+	for (i = 0; i < port->dev_info.max_rx_queues; i++)
+		port->rx_conf[i].offloads = port->dev_conf.rxmode.offloads;
+	/* Apply Tx offloads configuration */
+	for (i = 0; i < port->dev_info.max_tx_queues; i++)
+		port->tx_conf[i].offloads = port->dev_conf.txmode.offloads;
+
+	/* Check for maximum number of segments per MTU. Accordingly
+	 * update the mbuf data size.
+	 */
+	if (port->dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
+	    port->dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
+		uint16_t data_size = rx_mode.max_rx_pkt_len /
+				port->dev_info.rx_desc_lim.nb_mtu_seg_max;
 
+		if ((data_size + RTE_PKTMBUF_HEADROOM) > mbuf_data_size[0]) {
+			mbuf_data_size[0] = data_size + RTE_PKTMBUF_HEADROOM;
+			TESTPMD_LOG(WARNING,
+			    "Adjusted mbuf size of the first segment %hu\n",
+			    mbuf_data_size[0]);
+		}
+	}
 	init_port_config();
 }
 
-- 
2.18.1


             reply	other threads:[~2021-06-19 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19 15:40 Viacheslav Ovsiienko [this message]
2021-06-23  9:09 ` Singh, Aman Deep
2021-07-01 14:01 ` Andrew Rybchenko
2021-07-12 10:24 ` [dpdk-dev] [PATCH v2] " Viacheslav Ovsiienko
2021-07-12 12:40 ` [dpdk-dev] [PATCH v3] " Viacheslav Ovsiienko
2021-07-13  5:37   ` [dpdk-dev] [dpdk-stable] " Li, Xiaoyun
2021-07-13  9:50     ` Andrew Rybchenko

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=20210619154012.27295-1-viacheslavo@nvidia.com \
    --to=viacheslavo@nvidia.com \
    --cc=dev@dpdk.org \
    --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
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).