From: Ivan Malov Date: Tue, 20 Oct 2020 09:13:17 +0000 (+0100) Subject: net/sfc: support flow actions PF and VF in transfer rules X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=70f3cadce6fac767cd8c440c5217edc394f28425;p=dpdk.git net/sfc: support flow actions PF and VF in transfer rules The action handler will use MAE action DELIVER with MPORT of the PF/VF. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index f1489bea66..da4a096ac6 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -214,6 +214,10 @@ Supported actions (***transfer*** rules): - PHY_PORT +- PF + +- VF + Validating flow rules depends on the firmware variant. The :ref:`flow_isolated_mode` is supported. diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 7d1a3b5999..ff21351152 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -734,6 +734,30 @@ sfc_mae_rule_parse_action_phy_port(struct sfc_adapter *sa, return efx_mae_action_set_populate_deliver(spec, &mport); } +static int +sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa, + const struct rte_flow_action_vf *vf_conf, + efx_mae_actions_t *spec) +{ + const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); + efx_mport_sel_t mport; + uint32_t vf; + int rc; + + if (vf_conf == NULL) + vf = EFX_PCI_VF_INVALID; + else if (vf_conf->original != 0) + vf = encp->enc_vf; + else + vf = vf_conf->id; + + rc = efx_mae_mport_by_pcie_function(encp->enc_pf, vf, &mport); + if (rc != 0) + return rc; + + return efx_mae_action_set_populate_deliver(spec, &mport); +} + static int sfc_mae_rule_parse_action(struct sfc_adapter *sa, const struct rte_flow_action *action, @@ -779,6 +803,16 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa, bundle->actions_mask); rc = sfc_mae_rule_parse_action_phy_port(sa, action->conf, spec); break; + case RTE_FLOW_ACTION_TYPE_PF: + SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_PF, + bundle->actions_mask); + rc = sfc_mae_rule_parse_action_pf_vf(sa, NULL, spec); + break; + case RTE_FLOW_ACTION_TYPE_VF: + SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_VF, + bundle->actions_mask); + rc = sfc_mae_rule_parse_action_pf_vf(sa, action->conf, spec); + break; default: return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL,