]> git.droids-corp.org - dpdk.git/commitdiff
net/sfc: support port representor related flow actions
authorIvan Malov <ivan.malov@oktetlabs.ru>
Mon, 25 Oct 2021 11:04:14 +0000 (14:04 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 2 Nov 2021 18:26:13 +0000 (19:26 +0100)
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
doc/guides/nics/sfc_efx.rst
drivers/net/sfc/sfc_mae.c

index c830426eb27e370a491bbe7eccb88134d4ad36f9..0d785f47658af6da0af9ff75ff56f78e67bc2835 100644 (file)
@@ -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
index 8dbd250b3c9d7b50796443236d8a2aaff1745673..960e25bf983b56bc675fd6a689ea14090ce4d85e 100644 (file)
@@ -248,6 +248,10 @@ Supported actions (***transfer*** rules):
 
 - VF
 
+- PORT_REPRESENTOR
+
+- REPRESENTED_PORT
+
 - PORT_ID
 
 - COUNT
index 8ec40362753b299dcaed289ecce3bd63136293db..411f2ac27e0f678d6fdbd3adb26a940e0b6a9ef3 100644 (file)
@@ -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);