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 2C3C3A0555 for ; Thu, 9 Jun 2022 13:37:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26D49427F9; Thu, 9 Jun 2022 13:37:59 +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 4B718406B4 for ; Thu, 9 Jun 2022 13:37:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654774676; 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=kgXLs1weq4cIBJFKltkiuBnUKTt58FRHqBNSGKOVFsQ=; b=DZItYUs+11bNUcWq2a9kLNYMXxPU+eOt0XvNewyqr2WkvBAEJqIHJlfAbFI2rOfQ7uPRRS QiharyRLohdHupXi+aHTkxKuA/GRMXDcAV7XbEtAiSYIt4X0jSjlt5T83BT7iXhDn8FO0A ESZEEjNYb2K04nVfjOkJB2OAaXp4BXU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-7-lb9cIOhaOQ-fvqPodEpKvQ-1; Thu, 09 Jun 2022 07:37:53 -0400 X-MC-Unique: lb9cIOhaOQ-fvqPodEpKvQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7166538041DF; Thu, 9 Jun 2022 11:37:53 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.195.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 648B318EA6; Thu, 9 Jun 2022 11:37:52 +0000 (UTC) From: Kevin Traynor To: Dmitry Kozlyuk Cc: Matan Azrad , Aman Singh , dpdk stable Subject: patch 'app/testpmd: fix use of indirect action after port close' has been queued to stable release 21.11.2 Date: Thu, 9 Jun 2022 12:36:18 +0100 Message-Id: <20220609113701.386938-31-ktraynor@redhat.com> In-Reply-To: <20220609113701.386938-1-ktraynor@redhat.com> References: <20220609113701.386938-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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/13/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/057ebd40e3db01e87cd7bc7029674c4bd8d97580 Thanks. Kevin --- >From 057ebd40e3db01e87cd7bc7029674c4bd8d97580 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk Date: Mon, 7 Mar 2022 18:48:21 +0200 Subject: [PATCH] app/testpmd: fix use of indirect action after port close [ upstream commit f7352c176bbf131728445680ee08961a67cc09a6 ] When a port was closed, indirect actions could remain with their handles no longer valid. If a newly attached device was assigned the same ID as the closed port, those indirect actions became accessible again. Any attempt to use them resulted in an undefined behavior. Automatically flush indirect actions when a port is closed. Fixes: 4b61b8774be9 ("ethdev: introduce indirect flow action") Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad Acked-by: Aman Singh --- app/test-pmd/config.c | 31 +++++++++++++++++++++++++++++++ app/test-pmd/testpmd.c | 1 + app/test-pmd/testpmd.h | 1 + 3 files changed, 33 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index face2f805f..ae2ace42cc 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1758,4 +1758,35 @@ port_action_handle_destroy(portid_t port_id, } +int +port_action_handle_flush(portid_t port_id) +{ + struct rte_port *port; + struct port_indirect_action **tmp; + int ret = 0; + + if (port_id_is_invalid(port_id, ENABLED_WARN) || + port_id == (portid_t)RTE_PORT_ALL) + return -EINVAL; + port = &ports[port_id]; + tmp = &port->actions_list; + while (*tmp != NULL) { + struct rte_flow_error error; + struct port_indirect_action *pia = *tmp; + + /* Poisoning to make sure PMDs update it in case of error. */ + memset(&error, 0x44, sizeof(error)); + if (pia->handle != NULL && + rte_flow_action_handle_destroy + (port_id, pia->handle, &error) != 0) { + printf("Indirect action #%u not destroyed\n", pia->id); + ret = port_flow_complain(&error); + tmp = &pia->next; + } else { + *tmp = pia->next; + free(pia); + } + } + return ret; +} /** Get indirect action by port + id */ diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index dd1f286d59..5c62f48efd 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3218,4 +3218,5 @@ close_port(portid_t pid) port_flow_flush(pi); port_flex_item_flush(pi); + port_action_handle_flush(pi); rte_eth_dev_close(pi); } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 943217f2bd..59bb9e3c66 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -885,4 +885,5 @@ int port_action_handle_create(portid_t port_id, uint32_t id, int port_action_handle_destroy(portid_t port_id, uint32_t n, const uint32_t *action); +int port_action_handle_flush(portid_t port_id); struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id, uint32_t id); -- 2.34.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-09 12:34:30.499983894 +0100 +++ 0031-app-testpmd-fix-use-of-indirect-action-after-port-cl.patch 2022-06-09 12:34:29.710980581 +0100 @@ -1 +1 @@ -From f7352c176bbf131728445680ee08961a67cc09a6 Mon Sep 17 00:00:00 2001 +From 057ebd40e3db01e87cd7bc7029674c4bd8d97580 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit f7352c176bbf131728445680ee08961a67cc09a6 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 1b1e738f83..dc9ef1e868 100644 +index face2f805f..ae2ace42cc 100644 @@ -29 +30 @@ -@@ -1906,4 +1906,35 @@ port_action_handle_destroy(portid_t port_id, +@@ -1758,4 +1758,35 @@ port_action_handle_destroy(portid_t port_id, @@ -66 +67 @@ -index 777763f749..5b742911a8 100644 +index dd1f286d59..5c62f48efd 100644 @@ -69 +70 @@ -@@ -3217,4 +3217,5 @@ close_port(portid_t pid) +@@ -3218,4 +3218,5 @@ close_port(portid_t pid) @@ -76 +77 @@ -index f04a9a11b4..8ee682b362 100644 +index 943217f2bd..59bb9e3c66 100644 @@ -79 +80 @@ -@@ -911,4 +911,5 @@ int port_action_handle_create(portid_t port_id, uint32_t id, +@@ -885,4 +885,5 @@ int port_action_handle_create(portid_t port_id, uint32_t id,