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 D4C4EA057F for ; Tue, 28 Jun 2022 17:20:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB1AC42825; Tue, 28 Jun 2022 17:20:01 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 281C842825 for ; Tue, 28 Jun 2022 17:19:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656429598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KD8swLJaxUGkivp6CoK7ulJ+GpjqN+aYSFjpL1XVM4A=; b=eL6sa6EfLeHioWSlhfZlaoRyzMXI6eBJ5D/mIS6VN8InJs+PQEi6gDFPyyL8YvRW0fV/kt GPvp+puux+CCbbFEeQwBDgRcWl8BhAqUTDH0GV/PNvkCF2Nxpf60ReZ81Luho84/a9ndRi gtnE57ivgdhNJEfuWmWx3Vb4lf/7qug= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-605-N7PGuEqRPByIFy8JMnNlWw-1; Tue, 28 Jun 2022 11:19:55 -0400 X-MC-Unique: N7PGuEqRPByIFy8JMnNlWw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25C9F85A582; Tue, 28 Jun 2022 15:19:55 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E1021415108; Tue, 28 Jun 2022 15:19:54 +0000 (UTC) From: Kevin Traynor To: Dmitry Kozlyuk Cc: Matan Azrad , Andrew Rybchenko , dpdk stable Subject: patch 'app/testpmd: cleanup port resources after implicit close' has been queued to stable release 21.11.2 Date: Tue, 28 Jun 2022 16:19:21 +0100 Message-Id: <20220628151938.2278711-9-ktraynor@redhat.com> In-Reply-To: <20220628151938.2278711-1-ktraynor@redhat.com> References: <20220628151938.2278711-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.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 06/30/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/2a4ad9bb84854736a79e3264f9b5a630f036407c Thanks. Kevin --- >From 2a4ad9bb84854736a79e3264f9b5a630f036407c Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk Date: Thu, 16 Jun 2022 02:12:12 +0300 Subject: [PATCH] app/testpmd: cleanup port resources after implicit close [ upstream commit 4b27989d24f4d662f95bb42b5ad892c9a5d9b60f ] When a port is closed implicitly by the PMD, for example, if it is a representor port and its master port is detached, flow indirect actions could remain with their handles no longer valid. If a newly attached device is assigned the same ID as the closed port, those indirect actions became accessible again. Any attempt to use them resulted in an undefined behavior. Flow flex items had no such issue on close, but had it on detach. Introduce flush_port_owned_resources() function for consistent cleanup and call it when a port is closed or detached. Make it flush flow rules and multicast addresses too because they logically belong to the port being removed. Fixes: 55509e3a49fb ("app/testpmd: support shared flow action") Fixes: 59f3a8acbcdb ("app/testpmd: add flex item commands") Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad Acked-by: Andrew Rybchenko --- app/test-pmd/testpmd.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 389b7c3c69..3699c5fd64 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3204,4 +3204,13 @@ remove_invalid_ports(void) } +static void +flush_port_owned_resources(portid_t pi) +{ + mcast_addr_pool_destroy(pi); + port_flow_flush(pi); + port_flex_item_flush(pi); + port_action_handle_flush(pi); +} + static void clear_bonding_slave_device(portid_t *slave_pids, uint16_t num_slaves) @@ -3268,8 +3277,5 @@ close_port(portid_t pid) if (is_proc_primary()) { - mcast_addr_pool_destroy(pi); - port_flow_flush(pi); - port_flex_item_flush(pi); - port_action_handle_flush(pi); + flush_port_owned_resources(pi); #ifdef RTE_NET_BOND if (port->bond_flag == 1) @@ -3428,5 +3434,5 @@ detach_device(struct rte_device *dev) return; } - port_flow_flush(sibling); + flush_port_owned_resources(sibling); } } @@ -3495,5 +3501,5 @@ detach_devargs(char *identifier) return; } - port_flow_flush(port_id); + flush_port_owned_resources(port_id); } } -- 2.34.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-28 16:18:04.251250473 +0100 +++ 0009-app-testpmd-cleanup-port-resources-after-implicit-cl.patch 2022-06-28 16:18:04.010387176 +0100 @@ -1 +1 @@ -From 4b27989d24f4d662f95bb42b5ad892c9a5d9b60f Mon Sep 17 00:00:00 2001 +From 2a4ad9bb84854736a79e3264f9b5a630f036407c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4b27989d24f4d662f95bb42b5ad892c9a5d9b60f ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org @@ -31 +32 @@ -index e6321bdedb..addcbcac85 100644 +index 389b7c3c69..3699c5fd64 100644 @@ -34 +35 @@ -@@ -3207,4 +3207,13 @@ remove_invalid_ports(void) +@@ -3204,4 +3204,13 @@ remove_invalid_ports(void) @@ -48 +49 @@ -@@ -3271,8 +3280,5 @@ close_port(portid_t pid) +@@ -3268,8 +3277,5 @@ close_port(portid_t pid) @@ -58 +59 @@ -@@ -3431,5 +3437,5 @@ detach_device(struct rte_device *dev) +@@ -3428,5 +3434,5 @@ detach_device(struct rte_device *dev) @@ -65 +66 @@ -@@ -3498,5 +3504,5 @@ detach_devargs(char *identifier) +@@ -3495,5 +3501,5 @@ detach_devargs(char *identifier)