From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id 452D91B6C1 for ; Tue, 15 May 2018 19:20:14 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id m17-v6so1375389lfj.8 for ; Tue, 15 May 2018 10:20:14 -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=7bchPPq+/9FoiRCndyPp6CqXdaMoMcwpwQ29k9p/gBw=; b=hYkUG8aZBwlzBGflGC8AMypeQaxAmN8FZBj7twyiKxhsOEKtXp2xM/BFft1l3jYwsL nGG4oxczf1MMv7E68+yUu+na/Njyhd3vGldwvrMoaPT+IwVbyFlUbwcrw3Vau2QPWJBA ZENvq7Rb3+aCWPWTVTtlm66ia1mHG93J8BdoL7QgiFLKIpMMovVRkyclCyGwCXsIWJtP 7gibFZtUOEjh+NxI/jf1k7KLgsJa/fzsraJ4IP1400kJYuAXQWjgwORbuaQAUBjPErG6 nh+V5iZO14vvOrH38FjjZa/MEA0FKrXW31y/No66ChNqtpw0hNM81SXGyeBTggBZcgFe SreQ== 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=7bchPPq+/9FoiRCndyPp6CqXdaMoMcwpwQ29k9p/gBw=; b=G1CxBQ+MmFL8MNyIEitY910UD077ydJtkXBAVHS8DwuqLK9ILhiI//kXwRJ/PtFsai AAHvh1ASJXlZFQZSVpi1LN/d6zWg4hwRn4nn6VPGv5ff+2+RH8A3+mzK4sU+2eWzffQG u0jBhPOLFOpQFn4l9VyCeXzkZMWxvRKNhXPjF8+RR/SVcJ8fsa9aS8K/PG+MinmeIBC7 PTuDr+y6fqhyQbgdqYU1qV1azuD1oizZRWjLLB7U54iyRPzd/+e2O2pR/KRVULofXS0l uXuY+lZ3mLLIkaYnkPG03lDDiuoxLyd66uUNTh3T/xP8agfENLXH4YShO6OY8AFO22FV +O1g== X-Gm-Message-State: ALKqPwfin929QXd+mS2w1fAlYfBr6424XEj4o1lPgl9XwTwrxsE/AuaS qPN3T17A9RaxLSYgUt0G4dF32ao0/nM= X-Google-Smtp-Source: AB8JxZriP5uZHMkPxL65DESaKmwlZxMwoWBKU/8Tebz8pw4pZSJrUipEu1VpyhOrFpRz3EHOXw1s9Q== X-Received: by 2002:a2e:3503:: with SMTP id z3-v6mr7955602ljz.95.1526404813841; Tue, 15 May 2018 10:20:13 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id l67-v6sm130332lfk.33.2018.05.15.10.20.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 10:20:13 -0700 (PDT) From: luca.boccassi@gmail.com To: Matan Azrad Cc: dpdk stable Date: Tue, 15 May 2018 18:19:19 +0100 Message-Id: <20180515171933.12882-18-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180515171933.12882-1-luca.boccassi@gmail.com> References: <20180501104509.17238-46-luca.boccassi@gmail.com> <20180515171933.12882-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'app/testpmd: fix synchronic port hotplug' has been queued to LTS release 16.11.7 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 17:20:14 -0000 Hi, FYI, your patch has been queued to LTS release 16.11.7 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 1d2ac280f7474827f1521ca9c1a2cffc7d4924f8 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 94d1c72b4..765afef9a 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -980,6 +980,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. */ @@ -1574,6 +1599,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"); } @@ -1596,6 +1623,8 @@ detach_port(uint8_t port_id) ports[port_id].enabled = 0; 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 81034d0ea..aad598e56 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -493,6 +493,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.14.2