patch 'net/sfc: invalidate switch port entry on representor unplug' has been queued to stable release 22.11.2
Xueming Li
xuemingl at nvidia.com
Sun Apr 9 17:25:01 CEST 2023
Hi,
FYI, your patch has been queued to stable release 22.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 04/11/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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging
This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/8a6d064801721157e4d9bbf375616d5e1d5ea552
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 8a6d064801721157e4d9bbf375616d5e1d5ea552 Mon Sep 17 00:00:00 2001
From: Ivan Malov <ivan.malov at arknetworks.am>
Date: Fri, 10 Mar 2023 21:07:17 +0400
Subject: [PATCH] net/sfc: invalidate switch port entry on representor unplug
Cc: Xueming Li <xuemingl at nvidia.com>
[ 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 <ivan.malov at arknetworks.am>
Reviewed-by: Andy Moreton <amoreton at xilinx.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
---
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 4b03b101d8..919048e278 100644
--- a/drivers/net/sfc/sfc_repr.c
+++ b/drivers/net/sfc/sfc_repr.c
@@ -836,6 +836,8 @@ 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;
dev->dev_ops = 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
@@ -489,6 +489,7 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id,
uint16_t switch_port_id)
{
struct sfc_mae_switch_domain *domain;
+ struct sfc_mae_switch_port *port;
rte_spinlock_lock(&sfc_mae_switch.lock);
@@ -504,6 +505,17 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id,
domain->mae_admin_port = NULL;
}
+ 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.25.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2023-04-09 21:45:41.670323900 +0800
+++ 0113-net-sfc-invalidate-switch-port-entry-on-representor-.patch 2023-04-09 21:45:38.769042200 +0800
@@ -1 +1 @@
-From 723327bed49fb434bfb24b1e4393d5c4db537fda Mon Sep 17 00:00:00 2001
+From 8a6d064801721157e4d9bbf375616d5e1d5ea552 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 723327bed49fb434bfb24b1e4393d5c4db537fda ]
@@ -22 +24,0 @@
-Cc: stable at dpdk.org
More information about the stable
mailing list