DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors
@ 2021-10-25 11:04 Ivan Malov
  2021-10-25 11:04 ` [dpdk-dev] [PATCH 2/7] net/sfc: rename ethdev m-port retrieval helper Ivan Malov
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Ivan Malov @ 2021-10-25 11:04 UTC (permalink / raw)
  To: dev; +Cc: Andrew Rybchenko, Andy Moreton, Igor Romanov

VF representors do not own dedicated m-ports and thus cannot
be referred to as traffic endpoints in flow items or actions.

Fixes: a62ec90522a6 ("net/sfc: add port representors infrastructure")
Fixes: f55b61cec94a ("net/sfc: support port representor flow item")

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/net/sfc/sfc_switch.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c
index a28e861de5..265a17f4c4 100644
--- a/drivers/net/sfc/sfc_switch.c
+++ b/drivers/net/sfc/sfc_switch.c
@@ -512,7 +512,7 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id,
 static int
 sfc_mae_find_switch_port_by_ethdev(uint16_t switch_domain_id,
 				   uint16_t ethdev_port_id,
-				   efx_mport_sel_t *mport_sel)
+				   struct sfc_mae_switch_port **switch_port)
 {
 	struct sfc_mae_switch_domain *domain;
 	struct sfc_mae_switch_port *port;
@@ -528,7 +528,7 @@ sfc_mae_find_switch_port_by_ethdev(uint16_t switch_domain_id,
 
 	TAILQ_FOREACH(port, &domain->ports, switch_domain_ports) {
 		if (port->ethdev_port_id == ethdev_port_id) {
-			*mport_sel = port->ethdev_mport;
+			*switch_port = port;
 			return 0;
 		}
 	}
@@ -541,11 +541,27 @@ sfc_mae_switch_port_by_ethdev(uint16_t switch_domain_id,
 			      uint16_t ethdev_port_id,
 			      efx_mport_sel_t *mport_sel)
 {
+	struct sfc_mae_switch_port *port;
 	int rc;
 
 	rte_spinlock_lock(&sfc_mae_switch.lock);
 	rc = sfc_mae_find_switch_port_by_ethdev(switch_domain_id,
-						ethdev_port_id, mport_sel);
+						ethdev_port_id, &port);
+	if (rc != 0)
+		goto unlock;
+
+	if (port->type != SFC_MAE_SWITCH_PORT_INDEPENDENT) {
+		/*
+		 * The ethdev is a "VF representor". It does not own
+		 * a dedicated m-port suitable for use in flow rules.
+		 */
+		rc = ENOTSUP;
+		goto unlock;
+	}
+
+	*mport_sel = port->ethdev_mport;
+
+unlock:
 	rte_spinlock_unlock(&sfc_mae_switch.lock);
 
 	return rc;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-02 18:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 11:04 [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 2/7] net/sfc: rename ethdev m-port retrieval helper Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 3/7] net/sfc: improve m-port related log messages Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 4/7] net/sfc: assign correct m-ports to independent switch ports Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 5/7] net/sfc: support represented port flow item Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 6/7] net/sfc: support port representor related flow actions Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 7/7] net/sfc: ignore direction attributes in transfer flows Ivan Malov
2021-11-02 18:27 ` [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).