* [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
* [dpdk-dev] [PATCH 2/7] net/sfc: rename ethdev m-port retrieval helper
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 ` Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 3/7] net/sfc: improve m-port related log messages Ivan Malov
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ivan Malov @ 2021-10-25 11:04 UTC (permalink / raw)
To: dev; +Cc: Andrew Rybchenko
The function in question has an unfortunate name that reads
like finding a SW switch port entry. In fact just one of
the two m-ports is retrieved from that entry.
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/net/sfc/sfc_mae.c | 10 +++++-----
drivers/net/sfc/sfc_switch.c | 6 +++---
drivers/net/sfc/sfc_switch.h | 6 +++---
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index 455744c570..84b13925ff 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -1276,8 +1276,8 @@ sfc_mae_rule_parse_item_port_id(const struct rte_flow_item *item,
"The port ID is too large");
}
- rc = sfc_mae_switch_port_by_ethdev(ctx_mae->sa->mae.switch_domain_id,
- spec->id, &mport_sel);
+ rc = sfc_mae_switch_get_ethdev_mport(ctx_mae->sa->mae.switch_domain_id,
+ spec->id, &mport_sel);
if (rc != 0) {
return rte_flow_error_set(error, rc,
RTE_FLOW_ERROR_TYPE_ITEM, item,
@@ -1335,7 +1335,7 @@ sfc_mae_rule_parse_item_port_representor(const struct rte_flow_item *item,
if (spec == NULL)
return 0;
- rc = sfc_mae_switch_port_by_ethdev(
+ rc = sfc_mae_switch_get_ethdev_mport(
ctx_mae->sa->mae.switch_domain_id,
spec->port_id, &mport_sel);
if (rc != 0) {
@@ -3406,8 +3406,8 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,
port_id = (conf->original != 0) ? sas->port_id : conf->id;
- rc = sfc_mae_switch_port_by_ethdev(mae->switch_domain_id,
- port_id, &mport);
+ rc = sfc_mae_switch_get_ethdev_mport(mae->switch_domain_id,
+ port_id, &mport);
if (rc != 0) {
sfc_err(sa, "failed to find MAE switch port SW entry for RTE ethdev port %u: %s",
port_id, strerror(rc));
diff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c
index 265a17f4c4..3f7518fa30 100644
--- a/drivers/net/sfc/sfc_switch.c
+++ b/drivers/net/sfc/sfc_switch.c
@@ -537,9 +537,9 @@ sfc_mae_find_switch_port_by_ethdev(uint16_t switch_domain_id,
}
int
-sfc_mae_switch_port_by_ethdev(uint16_t switch_domain_id,
- uint16_t ethdev_port_id,
- efx_mport_sel_t *mport_sel)
+sfc_mae_switch_get_ethdev_mport(uint16_t switch_domain_id,
+ uint16_t ethdev_port_id,
+ efx_mport_sel_t *mport_sel)
{
struct sfc_mae_switch_port *port;
int rc;
diff --git a/drivers/net/sfc/sfc_switch.h b/drivers/net/sfc/sfc_switch.h
index 7917141038..a5a0fb4fc5 100644
--- a/drivers/net/sfc/sfc_switch.h
+++ b/drivers/net/sfc/sfc_switch.h
@@ -102,9 +102,9 @@ int sfc_mae_assign_switch_port(uint16_t switch_domain_id,
int sfc_mae_clear_switch_port(uint16_t switch_domain_id,
uint16_t switch_port_id);
-int sfc_mae_switch_port_by_ethdev(uint16_t switch_domain_id,
- uint16_t ethdev_port_id,
- efx_mport_sel_t *mport_sel);
+int sfc_mae_switch_get_ethdev_mport(uint16_t switch_domain_id,
+ uint16_t ethdev_port_id,
+ efx_mport_sel_t *mport_sel);
int sfc_mae_switch_port_id_by_entity(uint16_t switch_domain_id,
const efx_mport_sel_t *entity_mportp,
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 3/7] net/sfc: improve m-port related log messages
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 ` Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 4/7] net/sfc: assign correct m-ports to independent switch ports Ivan Malov
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ivan Malov @ 2021-10-25 11:04 UTC (permalink / raw)
To: dev; +Cc: Andrew Rybchenko
Make these messages more specific.
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/net/sfc/sfc_mae.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index 84b13925ff..a4a22f32c6 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -1281,7 +1281,7 @@ sfc_mae_rule_parse_item_port_id(const struct rte_flow_item *item,
if (rc != 0) {
return rte_flow_error_set(error, rc,
RTE_FLOW_ERROR_TYPE_ITEM, item,
- "Can't find RTE ethdev by the port ID");
+ "Can't get m-port for the given ethdev");
}
rc = efx_mae_match_spec_mport_set(ctx_mae->match_spec,
@@ -1341,7 +1341,7 @@ sfc_mae_rule_parse_item_port_representor(const struct rte_flow_item *item,
if (rc != 0) {
return rte_flow_error_set(error, rc,
RTE_FLOW_ERROR_TYPE_ITEM, item,
- "Can't find RTE ethdev by the port ID");
+ "Can't get m-port for the given ethdev");
}
rc = efx_mae_match_spec_mport_set(ctx_mae->match_spec,
@@ -3409,7 +3409,7 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,
rc = sfc_mae_switch_get_ethdev_mport(mae->switch_domain_id,
port_id, &mport);
if (rc != 0) {
- sfc_err(sa, "failed to find MAE switch port SW entry for RTE ethdev port %u: %s",
+ sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
port_id, strerror(rc));
return rc;
}
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 4/7] net/sfc: assign correct m-ports to independent switch ports
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 ` Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 5/7] net/sfc: support represented port flow item Ivan Malov
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ivan Malov @ 2021-10-25 11:04 UTC (permalink / raw)
To: dev; +Cc: Andrew Rybchenko
In accordance with patches [1-4], MAE admin ethdev represents a
network port and not the PF which it sits on. Rework the way
how "ethdev" and "entity" m-ports are assigned in SW switch
port entries of independent ethdevs. Explain in comments.
[1] commit 081e42dab11d ("ethdev: add port representor item to flow API")
[2] commit 49863ae2bf95 ("ethdev: add represented port item to flow API")
[3] commit 8edb6bc0263e ("ethdev: add port representor action
to flow API")
[4] commit 88caad251c8d ("ethdev: add represented port action
to flow API")
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/net/sfc/sfc_mae.c | 41 ++++++++++++++++++++++++++++++++++++---
1 file changed, 38 insertions(+), 3 deletions(-)
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index a4a22f32c6..bd8a913a49 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -23,7 +23,7 @@
#include "sfc_service.h"
static int
-sfc_mae_assign_entity_mport(struct sfc_adapter *sa,
+sfc_mae_assign_ethdev_mport(struct sfc_adapter *sa,
efx_mport_sel_t *mportp)
{
const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
@@ -32,6 +32,35 @@ sfc_mae_assign_entity_mport(struct sfc_adapter *sa,
mportp);
}
+static int
+sfc_mae_assign_entity_mport(struct sfc_adapter *sa,
+ efx_mport_sel_t *mportp)
+{
+ const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
+ int rc = 0;
+
+ if (encp->enc_mae_admin) {
+ /*
+ * This ethdev sits on MAE admin PF. The represented
+ * entity is the network port assigned to that PF.
+ */
+ rc = efx_mae_mport_by_phy_port(encp->enc_assigned_port, mportp);
+ } else {
+ /*
+ * This ethdev sits on unprivileged PF / VF. The entity
+ * represented by the ethdev can change dynamically
+ * as MAE admin changes default traffic rules.
+ *
+ * For the sake of simplicity, do not fill in the m-port
+ * and assume that flow rules should not be allowed to
+ * reference the entity represented by this ethdev.
+ */
+ efx_mae_mport_invalid(mportp);
+ }
+
+ return rc;
+}
+
static int
sfc_mae_counter_registry_init(struct sfc_mae_counter_registry *registry,
uint32_t nb_counters_max)
@@ -184,6 +213,7 @@ sfc_mae_attach(struct sfc_adapter *sa)
struct sfc_adapter_shared * const sas = sfc_sa2shared(sa);
struct sfc_mae_switch_port_request switch_port_request = {0};
const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
+ efx_mport_sel_t ethdev_mport;
efx_mport_sel_t entity_mport;
struct sfc_mae *mae = &sa->mae;
struct sfc_mae_bounce_eh *bounce_eh = &mae->bounce_eh;
@@ -218,6 +248,11 @@ sfc_mae_attach(struct sfc_adapter *sa)
}
}
+ sfc_log_init(sa, "assign ethdev MPORT");
+ rc = sfc_mae_assign_ethdev_mport(sa, ðdev_mport);
+ if (rc != 0)
+ goto fail_mae_assign_ethdev_mport;
+
sfc_log_init(sa, "assign entity MPORT");
rc = sfc_mae_assign_entity_mport(sa, &entity_mport);
if (rc != 0)
@@ -230,9 +265,8 @@ sfc_mae_attach(struct sfc_adapter *sa)
sfc_log_init(sa, "assign RTE switch port");
switch_port_request.type = SFC_MAE_SWITCH_PORT_INDEPENDENT;
+ switch_port_request.ethdev_mportp = ðdev_mport;
switch_port_request.entity_mportp = &entity_mport;
- /* RTE ethdev MPORT matches that of the entity for independent ports. */
- switch_port_request.ethdev_mportp = &entity_mport;
switch_port_request.ethdev_port_id = sas->port_id;
switch_port_request.port_data.indep.mae_admin =
encp->enc_mae_admin == B_TRUE;
@@ -272,6 +306,7 @@ sfc_mae_attach(struct sfc_adapter *sa)
fail_mae_assign_switch_port:
fail_mae_assign_switch_domain:
fail_mae_assign_entity_mport:
+fail_mae_assign_ethdev_mport:
if (encp->enc_mae_admin)
sfc_mae_counter_registry_fini(&mae->counter_registry);
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 5/7] net/sfc: support represented port flow item
2021-10-25 11:04 [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors Ivan Malov
` (2 preceding siblings ...)
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 ` Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 6/7] net/sfc: support port representor related flow actions Ivan Malov
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ivan Malov @ 2021-10-25 11:04 UTC (permalink / raw)
To: dev; +Cc: Andrew Rybchenko
Add support for item REPRESENTED_PORT to match on traffic entering
the embedded switch from the entity represented by the given
ethdev (network port or VF).
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
doc/guides/nics/features/sfc.ini | 1 +
doc/guides/nics/sfc_efx.rst | 2 ++
drivers/net/sfc/sfc_mae.c | 52 +++++++++++++++++++++++++-------
drivers/net/sfc/sfc_switch.c | 29 ++++++++++++++++++
drivers/net/sfc/sfc_switch.h | 4 +++
5 files changed, 77 insertions(+), 11 deletions(-)
diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini
index 7db868e59f..c830426eb2 100644
--- a/doc/guides/nics/features/sfc.ini
+++ b/doc/guides/nics/features/sfc.ini
@@ -53,6 +53,7 @@ port_id = Y
port_representor = Y
pppoed = Y
pppoes = Y
+represented_port = Y
tcp = Y
udp = Y
vf = Y
diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 843c24991c..8dbd250b3c 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -194,6 +194,8 @@ Supported pattern items (***transfer*** rules):
- PORT_REPRESENTOR (cannot repeat; conflicts with other traffic source items)
+- REPRESENTED_PORT (cannot repeat; conflicts with other traffic source items)
+
- PORT_ID (cannot repeat; conflicts with other traffic source items)
- PHY_PORT (cannot repeat; conflicts with other traffic source items)
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index bd8a913a49..8ec4036275 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -1333,9 +1333,9 @@ sfc_mae_rule_parse_item_port_id(const struct rte_flow_item *item,
}
static int
-sfc_mae_rule_parse_item_port_representor(const struct rte_flow_item *item,
- struct sfc_flow_parse_ctx *ctx,
- struct rte_flow_error *error)
+sfc_mae_rule_parse_item_ethdev_based(const struct rte_flow_item *item,
+ struct sfc_flow_parse_ctx *ctx,
+ struct rte_flow_error *error)
{
struct sfc_mae_parse_ctx *ctx_mae = ctx->mae;
const struct rte_flow_item_ethdev supp_mask = {
@@ -1363,20 +1363,38 @@ sfc_mae_rule_parse_item_port_representor(const struct rte_flow_item *item,
if (mask->port_id != supp_mask.port_id) {
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM, item,
- "Bad mask in the PORT_REPRESENTOR pattern item");
+ "Bad mask in the ethdev-based pattern item");
}
/* If "spec" is not set, could be any port ID */
if (spec == NULL)
return 0;
- rc = sfc_mae_switch_get_ethdev_mport(
- ctx_mae->sa->mae.switch_domain_id,
- spec->port_id, &mport_sel);
- if (rc != 0) {
- return rte_flow_error_set(error, rc,
+ switch (item->type) {
+ case RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR:
+ rc = sfc_mae_switch_get_ethdev_mport(
+ ctx_mae->sa->mae.switch_domain_id,
+ spec->port_id, &mport_sel);
+ if (rc != 0) {
+ return rte_flow_error_set(error, rc,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "Can't get m-port for the given ethdev");
+ }
+ break;
+ case RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT:
+ rc = sfc_mae_switch_get_entity_mport(
+ ctx_mae->sa->mae.switch_domain_id,
+ spec->port_id, &mport_sel);
+ if (rc != 0) {
+ return rte_flow_error_set(error, rc,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "Can't get m-port for the given ethdev");
+ }
+ break;
+ default:
+ return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM, item,
- "Can't get m-port for the given ethdev");
+ "Unsupported ethdev-based flow item");
}
rc = efx_mae_match_spec_mport_set(ctx_mae->match_spec,
@@ -2329,7 +2347,19 @@ static const struct sfc_flow_item sfc_flow_items[] = {
.prev_layer = SFC_FLOW_ITEM_ANY_LAYER,
.layer = SFC_FLOW_ITEM_ANY_LAYER,
.ctx_type = SFC_FLOW_PARSE_CTX_MAE,
- .parse = sfc_mae_rule_parse_item_port_representor,
+ .parse = sfc_mae_rule_parse_item_ethdev_based,
+ },
+ {
+ .type = RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT,
+ .name = "REPRESENTED_PORT",
+ /*
+ * In terms of RTE flow, this item is a META one,
+ * and its position in the pattern is don't care.
+ */
+ .prev_layer = SFC_FLOW_ITEM_ANY_LAYER,
+ .layer = SFC_FLOW_ITEM_ANY_LAYER,
+ .ctx_type = SFC_FLOW_PARSE_CTX_MAE,
+ .parse = sfc_mae_rule_parse_item_ethdev_based,
},
{
.type = RTE_FLOW_ITEM_TYPE_PHY_PORT,
diff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c
index 3f7518fa30..5c10e8fc74 100644
--- a/drivers/net/sfc/sfc_switch.c
+++ b/drivers/net/sfc/sfc_switch.c
@@ -567,6 +567,35 @@ sfc_mae_switch_get_ethdev_mport(uint16_t switch_domain_id,
return rc;
}
+int
+sfc_mae_switch_get_entity_mport(uint16_t switch_domain_id,
+ uint16_t ethdev_port_id,
+ efx_mport_sel_t *mport_sel)
+{
+ static 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, &port);
+ if (rc != 0)
+ goto unlock;
+
+ if (port->type == SFC_MAE_SWITCH_PORT_INDEPENDENT &&
+ !port->data.indep.mae_admin) {
+ /* See sfc_mae_assign_entity_mport() */
+ rc = ENOTSUP;
+ goto unlock;
+ }
+
+ *mport_sel = port->entity_mport;
+
+unlock:
+ rte_spinlock_unlock(&sfc_mae_switch.lock);
+
+ return rc;
+}
+
int
sfc_mae_switch_port_id_by_entity(uint16_t switch_domain_id,
const efx_mport_sel_t *entity_mportp,
diff --git a/drivers/net/sfc/sfc_switch.h b/drivers/net/sfc/sfc_switch.h
index a5a0fb4fc5..62aea9b785 100644
--- a/drivers/net/sfc/sfc_switch.h
+++ b/drivers/net/sfc/sfc_switch.h
@@ -106,6 +106,10 @@ int sfc_mae_switch_get_ethdev_mport(uint16_t switch_domain_id,
uint16_t ethdev_port_id,
efx_mport_sel_t *mport_sel);
+int sfc_mae_switch_get_entity_mport(uint16_t switch_domain_id,
+ uint16_t ethdev_port_id,
+ efx_mport_sel_t *mport_sel);
+
int sfc_mae_switch_port_id_by_entity(uint16_t switch_domain_id,
const efx_mport_sel_t *entity_mportp,
enum sfc_mae_switch_port_type type,
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 6/7] net/sfc: support port representor related flow actions
2021-10-25 11:04 [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors Ivan Malov
` (3 preceding siblings ...)
2021-10-25 11:04 ` [dpdk-dev] [PATCH 5/7] net/sfc: support represented port flow item Ivan Malov
@ 2021-10-25 11:04 ` 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
6 siblings, 0 replies; 8+ messages in thread
From: Ivan Malov @ 2021-10-25 11:04 UTC (permalink / raw)
To: dev; +Cc: Andrew Rybchenko
Add support for actions PORT_REPRESENTOR and REPRESENTED_PORT.
The former should be used instead of ambiguous PORT_ID.
The latter sends traffic to the entity represented by
the given ethdev (network port or VF).
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
doc/guides/nics/features/sfc.ini | 2 +
doc/guides/nics/sfc_efx.rst | 4 ++
drivers/net/sfc/sfc_mae.c | 66 ++++++++++++++++++++++++++++++++
3 files changed, 72 insertions(+)
diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini
index c830426eb2..0d785f4765 100644
--- a/doc/guides/nics/features/sfc.ini
+++ b/doc/guides/nics/features/sfc.ini
@@ -73,6 +73,8 @@ of_set_vlan_vid = Y
pf = Y
phy_port = Y
port_id = Y
+port_representor = Y
+represented_port = Y
queue = Y
rss = Y
vf = Y
diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 8dbd250b3c..960e25bf98 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -248,6 +248,10 @@ Supported actions (***transfer*** rules):
- VF
+- PORT_REPRESENTOR
+
+- REPRESENTED_PORT
+
- PORT_ID
- COUNT
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index 8ec4036275..411f2ac27e 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -3488,6 +3488,58 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,
return rc;
}
+static int
+sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa,
+ const struct rte_flow_action_ethdev *conf,
+ efx_mae_actions_t *spec)
+{
+ struct sfc_mae *mae = &sa->mae;
+ efx_mport_sel_t mport;
+ int rc;
+
+ rc = sfc_mae_switch_get_ethdev_mport(mae->switch_domain_id,
+ conf->port_id, &mport);
+ if (rc != 0) {
+ sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
+ conf->port_id, strerror(rc));
+ return rc;
+ }
+
+ rc = efx_mae_action_set_populate_deliver(spec, &mport);
+ if (rc != 0) {
+ sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
+ mport.sel, strerror(rc));
+ }
+
+ return rc;
+}
+
+static int
+sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa,
+ const struct rte_flow_action_ethdev *conf,
+ efx_mae_actions_t *spec)
+{
+ struct sfc_mae *mae = &sa->mae;
+ efx_mport_sel_t mport;
+ int rc;
+
+ rc = sfc_mae_switch_get_entity_mport(mae->switch_domain_id,
+ conf->port_id, &mport);
+ if (rc != 0) {
+ sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
+ conf->port_id, strerror(rc));
+ return rc;
+ }
+
+ rc = efx_mae_action_set_populate_deliver(spec, &mport);
+ if (rc != 0) {
+ sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
+ mport.sel, strerror(rc));
+ }
+
+ return rc;
+}
+
static const char * const action_names[] = {
[RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = "VXLAN_DECAP",
[RTE_FLOW_ACTION_TYPE_OF_POP_VLAN] = "OF_POP_VLAN",
@@ -3501,6 +3553,8 @@ static const char * const action_names[] = {
[RTE_FLOW_ACTION_TYPE_PF] = "PF",
[RTE_FLOW_ACTION_TYPE_VF] = "VF",
[RTE_FLOW_ACTION_TYPE_PORT_ID] = "PORT_ID",
+ [RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR] = "PORT_REPRESENTOR",
+ [RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT] = "REPRESENTED_PORT",
[RTE_FLOW_ACTION_TYPE_DROP] = "DROP",
[RTE_FLOW_ACTION_TYPE_JUMP] = "JUMP",
};
@@ -3609,6 +3663,18 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa,
bundle->actions_mask);
rc = sfc_mae_rule_parse_action_port_id(sa, action->conf, spec);
break;
+ case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:
+ SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
+ bundle->actions_mask);
+ rc = sfc_mae_rule_parse_action_port_representor(sa,
+ action->conf, spec);
+ break;
+ case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
+ SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
+ bundle->actions_mask);
+ rc = sfc_mae_rule_parse_action_represented_port(sa,
+ action->conf, spec);
+ break;
case RTE_FLOW_ACTION_TYPE_DROP:
SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_DROP,
bundle->actions_mask);
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 7/7] net/sfc: ignore direction attributes in transfer flows
2021-10-25 11:04 [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors Ivan Malov
` (4 preceding siblings ...)
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 ` 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
6 siblings, 0 replies; 8+ messages in thread
From: Ivan Malov @ 2021-10-25 11:04 UTC (permalink / raw)
To: dev; +Cc: Andrew Rybchenko
[1] has deprecated the use of direction attributes in "transfer"
flows. Ignore them during the transition period.
[1] commit 9d2a349b388a ("ethdev: deprecate direction attributes
in transfer flows")
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/net/sfc/sfc_flow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index be2dfe778a..fc74c8035e 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -1252,13 +1252,13 @@ sfc_flow_parse_attr(struct sfc_adapter *sa,
"Groups are not supported");
return -rte_errno;
}
- if (attr->egress != 0) {
+ if (attr->egress != 0 && attr->transfer == 0) {
rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, attr,
"Egress is not supported");
return -rte_errno;
}
- if (attr->ingress == 0) {
+ if (attr->ingress == 0 && attr->transfer == 0) {
rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, attr,
"Ingress is compulsory");
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors
2021-10-25 11:04 [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors Ivan Malov
` (5 preceding siblings ...)
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 ` Ferruh Yigit
6 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2021-11-02 18:27 UTC (permalink / raw)
To: Ivan Malov, dev; +Cc: Andrew Rybchenko, Andy Moreton, Igor Romanov
On 10/25/2021 12:04 PM, Ivan Malov wrote:
> 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>
Series applied to dpdk-next-net/main, thanks.
^ 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).