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 9BB8F427EF for ; Wed, 22 Mar 2023 11:32:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98F0342BC9; Wed, 22 Mar 2023 11:32:40 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 507E042BAC for ; Wed, 22 Mar 2023 11:32:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679481158; 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=fqYzUqLX9+qArzvvSIxXMb1dr9Dc1o2r/kKOPtCqm3c=; b=D2N1vgNRodGBdD6JBa8K4iGuDhCA1opXssu1PIi34LBRZ60IBfgVv7KqMMSpyfsa4NRpQw EKlLZMrShOdBHjQMUnbGvIAy86x+PcZ2JktCjqs5l1cUMVgCHaSxugmclGSroZLW5I+1XY HjrRj+yNotOHB41TZfQI+D9C+pB+gQ4= 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-564-XXni0_CQNM-U0HzlsmHWsw-1; Wed, 22 Mar 2023 06:32:37 -0400 X-MC-Unique: XXni0_CQNM-U0HzlsmHWsw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 31A4A3C1068D; Wed, 22 Mar 2023 10:32:37 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id C51E9492C14; Wed, 22 Mar 2023 10:32:35 +0000 (UTC) From: Kevin Traynor To: Ivan Malov Cc: Andy Moreton , Andrew Rybchenko , dpdk stable Subject: patch 'net/sfc: invalidate switch port entry on representor unplug' has been queued to stable release 21.11.4 Date: Wed, 22 Mar 2023 10:32:00 +0000 Message-Id: <20230322103209.456098-13-ktraynor@redhat.com> In-Reply-To: <20230322103209.456098-1-ktraynor@redhat.com> References: <20230322103209.456098-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/24/23. 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/998d70414b63064c39071f20021c21b0b8ca4b2d Thanks. Kevin --- >From 998d70414b63064c39071f20021c21b0b8ca4b2d Mon Sep 17 00:00:00 2001 From: Ivan Malov Date: Fri, 10 Mar 2023 21:07:17 +0400 Subject: [PATCH] net/sfc: invalidate switch port entry on representor unplug [ upstream commit 723327bed49fb434bfb24b1e4393d5c4db537fda ] Once allocated, a switch port list entry always stays there, even after unplugging the ethdev that created it. Currently, the entry's ethdev ID is not cleared on unplug. Referencing the ethdev ID of a detached representor from a flow rule is going to succeed, which is a bug. Also, if the user unplugs endpoint "A" representor and plugs one for "B" instead, the latter will pick the same ethdev ID as the gone representor, but it will have a new port list entry added for it. If the user tries to reference the ethdev ID from a flow rule, the code will fetch the wrong entry ("A" rather than "B") since it sits closer to the list head. That is a serious bug, too. Make the driver invalidate ethdev ID field on ethdev unplug. Fixes: 1fb65e4dae8a ("net/sfc: support flow action port ID in transfer rules") Fixes: a62ec90522a6 ("net/sfc: add port representors infrastructure") Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Acked-by: Andrew Rybchenko --- drivers/net/sfc/sfc_repr.c | 2 ++ drivers/net/sfc/sfc_switch.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c index 0669780f86..170f110048 100644 --- a/drivers/net/sfc/sfc_repr.c +++ b/drivers/net/sfc/sfc_repr.c @@ -842,4 +842,6 @@ sfc_repr_dev_close(struct rte_eth_dev *dev) (void)sfc_repr_proxy_del_port(srs->pf_port_id, srs->repr_id); + sfc_mae_clear_switch_port(srs->switch_domain_id, srs->switch_port_id); + dev->rx_pkt_burst = NULL; dev->tx_pkt_burst = NULL; diff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c index 5c10e8fc74..8f1ee97fa8 100644 --- a/drivers/net/sfc/sfc_switch.c +++ b/drivers/net/sfc/sfc_switch.c @@ -490,4 +490,5 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id, { struct sfc_mae_switch_domain *domain; + struct sfc_mae_switch_port *port; rte_spinlock_lock(&sfc_mae_switch.lock); @@ -505,4 +506,15 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id, } + TAILQ_FOREACH(port, &domain->ports, switch_domain_ports) { + if (port->id == switch_port_id) { + /* + * Invalidate the field to prevent wrong + * look-ups from flow rule handling path. + */ + port->ethdev_port_id = RTE_MAX_ETHPORTS; + break; + } + } + rte_spinlock_unlock(&sfc_mae_switch.lock); return 0; -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-03-22 10:30:08.248447220 +0000 +++ 0013-net-sfc-invalidate-switch-port-entry-on-representor-.patch 2023-03-22 10:30:07.915866565 +0000 @@ -1 +1 @@ -From 723327bed49fb434bfb24b1e4393d5c4db537fda Mon Sep 17 00:00:00 2001 +From 998d70414b63064c39071f20021c21b0b8ca4b2d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 723327bed49fb434bfb24b1e4393d5c4db537fda ] + @@ -22 +23,0 @@ -Cc: stable@dpdk.org @@ -33 +34 @@ -index 4b03b101d8..919048e278 100644 +index 0669780f86..170f110048 100644 @@ -36 +37 @@ -@@ -837,4 +837,6 @@ sfc_repr_dev_close(struct rte_eth_dev *dev) +@@ -842,4 +842,6 @@ sfc_repr_dev_close(struct rte_eth_dev *dev)