From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 60C621B888 for ; Tue, 15 May 2018 15:48:41 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id g21-v6so211933wrb.8 for ; Tue, 15 May 2018 06:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w0EFl51gkgCYmIvon5BNZmQdK+3KJKpTq9UA1OvODMo=; b=kqLVlcJWB6VzJPdj0iE8vNOgSUFP0CGWlCs3QI3yL3cQ7rLkSKPGNbxU7zks+5+LhH 5c1Phhuo3Stu2JLMCHvaP9OIDKEkt9BIQg7fuAtfQTt+byaQGa4z9mLM77a8mPxqKj+O DC25VHYTHU4afcizWTBThSQdfXNSE1Mya+FypMXDNakYBW/6m7S/9wD2jc5+2GajZyc9 b7UG5RihgG6sTJLBL9+u/A6B8JgKsQw7OrCYqC9urbc/QkkHdJrb2kXHbaxlIrw1iRXg YrotlmJJKupBzJCXdUDahTByUHkqhwe950QBtczD5cAzfIf2p48u40YBweWtdSOlUmKW Bn0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w0EFl51gkgCYmIvon5BNZmQdK+3KJKpTq9UA1OvODMo=; b=cmWkOoVSqjofhjD8F1Xw5rFfhbN3djx+l++EeVO9F6TgKxsjNck1uaVuWH4IJ8F0TA mKcUMbnGLWIbdkJ/X8QIQjEyRuB+6tjY/ne52diTuSoL60I/SEHHXkAa7lYJIoS1PjbX CfLBXoHWaxqMJKdsSsDO8k45gi4iyP6s/MmeQVxgeFT0GlurANGfq9yA4NKm1lPT6S0g ME4h4b6nCE/n8Ai9jCbw+l7mfgqEt99YdDRZEcEBTlUESXJO2+ehdXXLlqDHx/DLE8rX JsUG48OJt5iI7J9AZcazZuwvZNPYn0p8DYZImdHwwC4ZuLvQoNVuMi1/I/il/7Ar+DHZ Jstw== X-Gm-Message-State: ALKqPwcI1dU+FKAGqvZ0IqjC9xJUXvHmVs294RLSWYhsMHkRudJXBwiQ 8wQmUOqAMU8MsHlaXBsJj0k= X-Google-Smtp-Source: AB8JxZqkv7xyP9R8gOSL3jsBNo0ypGPwskDtkU++JdO4wxT8kkUHod3X4/fc9EOq1898yJTp9y1tvg== X-Received: by 2002:adf:b8b0:: with SMTP id i45-v6mr10585736wrf.105.1526392121084; Tue, 15 May 2018 06:48:41 -0700 (PDT) Received: from localhost (slip139-92-244-193.lon.uk.prserv.net. [139.92.244.193]) by smtp.gmail.com with ESMTPSA id x24-v6sm479072wmh.18.2018.05.15.06.48.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 06:48:40 -0700 (PDT) From: luca.boccassi@gmail.com To: Matan Azrad Cc: dpdk stable Date: Tue, 15 May 2018 14:46:46 +0100 Message-Id: <20180515134731.9337-35-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180515134731.9337-1-luca.boccassi@gmail.com> References: <20180503110612.12146-2-luca.boccassi@gmail.com> <20180515134731.9337-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'app/testpmd: fix synchronic port hotplug' has been queued to stable release 18.02.2 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: Tue, 15 May 2018 13:48:41 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 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/16/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 0035d0a222b0ef0227f9be2f4564bfeaa91a8c81 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 8487c99fe..fed7d509f 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1203,6 +1203,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. */ @@ -1879,6 +1904,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"); } @@ -1905,6 +1932,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 956a1bf98..de7b67c7b 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -564,6 +564,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 set_fwd_eth_peer(portid_t port_id, char *peer_addr); -- 2.14.2