patch 'app/testpmd: fix bonding mode set' has been queued to stable release 21.11.1

Kevin Traynor ktraynor at redhat.com
Mon Feb 21 16:35:27 CET 2022


Hi,

FYI, your patch has been queued to stable release 21.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/26/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/605d1de0d3a4ca8d99d66c1cb6af831556ccc904

Thanks.

Kevin

---
>From 605d1de0d3a4ca8d99d66c1cb6af831556ccc904 Mon Sep 17 00:00:00 2001
From: "Min Hu (Connor)" <humin29 at huawei.com>
Date: Fri, 28 Jan 2022 10:35:19 +0800
Subject: [PATCH] app/testpmd: fix bonding mode set

[ upstream commit 39ddd5d1895e72ba2bc974eddbc12a3135639ed1 ]

when start testpmd, and type command like this, it will lead to
Segmentation fault, like:

testpmd> create bonded device 4 0
testpmd> add bonding slave 0 2
testpmd> add bonding slave 1 2
testpmd> port start 2
testpmd> set bonding mode 0 2
testpmd> quit
Stopping port 0...
Stopping ports...
...
Bye...
Segmentation fault

The reason to the bug is that rte timer do not be cancelled when quit.
That is, in 'bond_ethdev_start', resources are allocated according to
different bonding mode. In 'bond_ethdev_stop', resources are free by
the corresponding mode.

For example, 'bond_ethdev_start' start bond_mode_8023ad_ext_periodic_cb
timer for bonding mode 4. and 'bond_ethdev_stop' cancel the timer only
when the current bonding mode is 4. If the bonding mode is changed,
and directly quit the process, the timer will still on, and freed memory
will be accessed, then segmentation fault.

'bonding mode' changed means resources changed, reallocate resources for
different mode should be done, that is, device should be restarted.

Fixes: 2950a769315e ("bond: testpmd support")

Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
Tested-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 app/test-pmd/cmdline.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e626b1c7d9..16ad4be005 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5916,4 +5916,17 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result,
 	struct cmd_set_bonding_mode_result *res = parsed_result;
 	portid_t port_id = res->port_id;
+	struct rte_port *port = &ports[port_id];
+
+	/*
+	 * Bonding mode changed means resources of device changed, like whether
+	 * started rte timer or not. Device should be restarted when resources
+	 * of device changed.
+	 */
+	if (port->port_status != RTE_PORT_STOPPED) {
+		fprintf(stderr,
+			"\t Error: Can't set bonding mode when port %d is not stopped\n",
+			port_id);
+		return;
+	}
 
 	/* Set the bonding mode for the relevant port. */
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-02-21 15:22:47.581722491 +0000
+++ 0138-app-testpmd-fix-bonding-mode-set.patch	2022-02-21 15:22:44.290704574 +0000
@@ -1 +1 @@
-From 39ddd5d1895e72ba2bc974eddbc12a3135639ed1 Mon Sep 17 00:00:00 2001
+From 605d1de0d3a4ca8d99d66c1cb6af831556ccc904 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 39ddd5d1895e72ba2bc974eddbc12a3135639ed1 ]
+
@@ -36 +37,0 @@
-Cc: stable at dpdk.org



More information about the stable mailing list