patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yliu@fridaylinux.org>
To: Matan Azrad <matan@mellanox.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'app/testpmd: fix synchronic port hotplug' has been queued to LTS release 17.11.3
Date: Sun, 20 May 2018 21:02:29 +0800	[thread overview]
Message-ID: <20180520130246.16287-13-yliu@fridaylinux.org> (raw)
In-Reply-To: <20180520130246.16287-1-yliu@fridaylinux.org>

Hi,

FYI, your patch has been queued to LTS release 17.11.3

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

Thanks.

	--yliu

---
>From 2c5ee7ede57471ce59e9f1eb0aa02e2e3ba0062e Mon Sep 17 00:00:00 2001
From: Matan Azrad <matan@mellanox.com>
Date: Thu, 3 May 2018 10:31:46 +0000
Subject: [PATCH] app/testpmd: fix synchronic port hotplug

[ upstream commit 03ce2c53a3905b11e54c424ca395ae5bea186cbd ]

When the user uses the synchronic hot-plug commands, attach\detach, in
order to insert\remove a port from the system, the forward ports list
update is missed in the current implementation.

Thus, an invalid port may be used for data-path in case of detach
because the detached port was not removed from the forward port list.

In addition, a new port is not used for data-path in case of attach, as the
default behavior of Testpmd, because the attached port was not inserted
to the forward port list.

Update the forward port list in the above cases to allow the correct
port usage for data-path in the next packet forwarding start.

Fixes: edab33b1c01d ("app/testpmd: support port hotplug")

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 app/test-pmd/testpmd.c | 29 +++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h |  1 +
 2 files changed, 30 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4b9cc4d28..c794afd83 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1216,6 +1216,31 @@ launch_packet_forwarding(lcore_function_t *pkt_fwd_on_lcore)
 }
 
 /*
+ * Update the forward ports list.
+ */
+void
+update_fwd_ports(portid_t new_pid)
+{
+	unsigned int i;
+	unsigned int new_nb_fwd_ports = 0;
+	int move = 0;
+
+	for (i = 0; i < nb_fwd_ports; ++i) {
+		if (port_id_is_invalid(fwd_ports_ids[i], DISABLED_WARN))
+			move = 1;
+		else if (move)
+			fwd_ports_ids[new_nb_fwd_ports++] = fwd_ports_ids[i];
+		else
+			new_nb_fwd_ports++;
+	}
+	if (new_pid < RTE_MAX_ETHPORTS)
+		fwd_ports_ids[new_nb_fwd_ports++] = new_pid;
+
+	nb_fwd_ports = new_nb_fwd_ports;
+	nb_cfg_ports = new_nb_fwd_ports;
+}
+
+/*
  * Launch packet forwarding configuration.
  */
 void
@@ -1878,6 +1903,8 @@ attach_port(char *identifier)
 
 	ports[pi].port_status = RTE_PORT_STOPPED;
 
+	update_fwd_ports(pi);
+
 	printf("Port %d is attached. Now total ports is %d\n", pi, nb_ports);
 	printf("Done\n");
 }
@@ -1904,6 +1931,8 @@ detach_port(portid_t port_id)
 
 	nb_ports = rte_eth_dev_count();
 
+	update_fwd_ports(RTE_MAX_ETHPORTS);
+
 	printf("Port '%s' is detached. Now total ports is %d\n",
 			name, nb_ports);
 	printf("Done\n");
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 3d3f7972a..b3b26d2c2 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -599,6 +599,7 @@ void fwd_config_setup(void);
 void set_def_fwd_config(void);
 void reconfig(portid_t new_port_id, unsigned socket_id);
 int init_fwd_streams(void);
+void update_fwd_ports(portid_t new_pid);
 
 void port_mtu_set(portid_t port_id, uint16_t mtu);
 void port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_pos);
-- 
2.11.0

  parent reply	other threads:[~2018-05-20 13:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-20 13:02 [dpdk-stable] patch 'event/dpaa2: remove link from info structure' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'crypto/scheduler: set null pointer after freeing' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'crypto/scheduler: fix memory leak' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/crypto-perf: check minimum lcore number' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'test/reorder: fix freeing mbuf twice' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'test/distributor: fix return type of thread function' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'test/pipeline: fix return type of stub miss' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'examples/quota_watermark: fix return type of threads' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix slave port detection' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix valid ports prints' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix forward ports update' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix forward ports Rx flush' " Yuanhan Liu
2018-05-20 13:02 ` Yuanhan Liu [this message]
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix removed device link status asking' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'examples/performance-thread: fix return type of threads' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'test/pipeline: fix type of table entry parameter' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'vhost: fix dead lock on closing in server mode' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/vhost: initialise device as inactive' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bnxt: fix Rx mbuf and agg ring leak in dev stop' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bnxt: fix usage of vnic id' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix empty list of RSS queues for flow' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/failsafe: fix probe cleanup' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/i40e: fix link status update' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bonding: fix slave activation simultaneously' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'mempool: fix virtual address population' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bnx2x: do not cast function pointers as a policy' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bnx2x: fix KR2 device check' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bnx2x: fix memzone name overrun' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/i40e: fix failing to disable FDIR Tx queue' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/ixgbe: fix too many interrupts' " Yuanhan Liu

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=20180520130246.16287-13-yliu@fridaylinux.org \
    --to=yliu@fridaylinux.org \
    --cc=matan@mellanox.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
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).