From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id B09452AA0 for ; Sun, 20 May 2018 15:08:56 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 5E78821DCE; Sun, 20 May 2018 09:08:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 20 May 2018 09:08:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=BvPb14pHciz0oTceJ pcYAeH6yBzrOfDGtIzbMbH0UgE=; b=RPW5uidIJhksym9sM0BbvSvCMQoruJ826 a8HkMxk/B0w9QUxRS1dWOZ3oiOWutbaqrpxSFmlA9fdqqjAQrjCfKM5fFKu3+0Mo b5DaSSlm4NfUTlpUIl5Aqy9b62fqpBg+rNW2k5yZUXP2oO7dmNpwYoBDZeMJpIA7 lBnSwR9cvY4SHGNMu0Bft5TXjym2sJx0hBxwdTubcOCb0zL4/LXa9k0VxGb4DCcV r23Fn995DK1ivQY6WfGAu6n7INNhpNVVylwgIbJkqys9E+YjfkawfvAy+sYMH5tu +I0gywEfPqTDVCMWwNyrb0Z0LMpX6xm3AWOZUwm4MVeik8iF03uqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=BvPb14pHciz0oTceJpcYAeH6yBzrOfDGtIzbMbH0UgE=; b=A6RCgWJM x1D5FJ2bYFr41DMocrX8opFC+4JJd1d2IIPUGLJz3ci75XBJ4QSVK6ZlQFbSBwpT Ch+iXjixkjvGA+ZrbxxintcfyBKqA5kor5P24ruEOvlreuRcekBHZ0TYITrJG8qS wg4nXrQskoWpZvFcbkWrWvJNLr9l4Wt6QKBD9vMq2+XtYYAZYoe/DsP6fPdufwgs beaUKIbC5pjyeUipWvn0b5ZZEvcZ0+0UgeiPjtg+MiSyD/aShz2Vm37Qe273kBDA eeekOExsfLaeITxOcCiWhq2RG2AcLwfAjLsNFuDjVBO9HEMm2cGLGM6WZMwM7z2I Z3Yc6vSlP6+qfA== X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from yuanhanliu-NB0.tencent.com (unknown [223.74.148.80]) by mail.messagingengine.com (Postfix) with ESMTPA id E363810260; Sun, 20 May 2018 09:08:54 -0400 (EDT) From: Yuanhan Liu To: Matan Azrad Cc: dpdk stable Date: Sun, 20 May 2018 21:02:29 +0800 Message-Id: <20180520130246.16287-13-yliu@fridaylinux.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180520130246.16287-1-yliu@fridaylinux.org> References: <20180520130246.16287-1-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'app/testpmd: fix synchronic port hotplug' has been queued to LTS release 17.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 May 2018 13:08:57 -0000 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 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 --- 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