From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E871D423B0; Thu, 12 Jan 2023 05:16:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB62F40A7D; Thu, 12 Jan 2023 05:16:25 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 332BC400EF for ; Thu, 12 Jan 2023 05:16:24 +0100 (CET) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NsrjS6x6GzJqC3; Thu, 12 Jan 2023 12:12:12 +0800 (CST) Received: from [10.67.103.231] (10.67.103.231) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 12 Jan 2023 12:16:20 +0800 Message-ID: <199259a7-2a42-1aac-acc6-fe5dadcccf72@huawei.com> Date: Thu, 12 Jan 2023 12:16:20 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH V4 5/5] app/testpmd: stop forwarding in new or destroy event To: Ferruh Yigit , , CC: , , , , Aman Singh References: <20220825024425.10534-1-lihuisong@huawei.com> <20221206092649.8287-1-lihuisong@huawei.com> <20221206092649.8287-6-lihuisong@huawei.com> From: "lihuisong (C)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 在 2023/1/11 20:52, Ferruh Yigit 写道: > On 12/6/2022 9:26 AM, Huisong Li wrote: >> When testpmd receives the new or destroy event, the port related >> information will be updated. Testpmd must stop packet forwarding >> before updating the information to avoid some serious problems. >> >> Signed-off-by: Huisong Li >> --- >> app/test-pmd/testpmd.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c >> index 2e6329c853..746f07652a 100644 >> --- a/app/test-pmd/testpmd.c >> +++ b/app/test-pmd/testpmd.c >> @@ -3806,6 +3806,8 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param, >> >> switch (type) { >> case RTE_ETH_EVENT_NEW: >> + if (test_done == 0) >> + stop_packet_forwarding(); > testpmd is test application, why not prevent user to issue attach / > detach commands when packet forwarding is going on, and force user to > stop forwarding explicitly instead of doing this implicitly and silently? For primary process, maybe it is ok by forcing user to stop forwarding explicitly. But for multiple process, it is better to do this before removing or adding. otherwise there'll be a lot of weird prints. > > Similar to previous comments, as we make things more complex for > specific use cases it will be very difficult to update testpmd without > hitting unexpected side effects everywhere, at least this is my concern. Understand your concern. But it's a problem. > >> if (setup_on_probe_event) >> setup_attached_port(port_id); >> break; >> @@ -3816,6 +3818,8 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param, >> "Could not set up deferred device removal\n"); >> break; >> case RTE_ETH_EVENT_DESTROY: >> + if (test_done == 0) >> + stop_packet_forwarding(); >> ports[port_id].port_status = RTE_PORT_CLOSED; >> printf("Port %u is closed\n", port_id); >> if (rte_eal_alarm_set(100000, remove_invalid_ports_callback, > .