patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] app/testpmd: fix offloads for the newly attached port
@ 2021-06-19 15:40 Viacheslav Ovsiienko
  2021-07-01 14:01 ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Viacheslav Ovsiienko @ 2021-06-19 15:40 UTC (permalink / raw)
  To: dev; +Cc: stable

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-13  9:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-19 15:40 [dpdk-stable] [PATCH] app/testpmd: fix offloads for the newly attached port Viacheslav Ovsiienko
2021-07-01 14:01 ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko
2021-07-12 10:24 ` [dpdk-stable] [PATCH v2] " Viacheslav Ovsiienko
2021-07-12 12:40 ` [dpdk-stable] [PATCH v3] " Viacheslav Ovsiienko
2021-07-13  5:37   ` Li, Xiaoyun
2021-07-13  9:50     ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko

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).