From: Igor Romanov Date: Mon, 11 Oct 2021 14:48:32 +0000 (+0300) Subject: common/sfc_efx/base: add API to get mport selector by ID X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3d6e8e459c189a0badc758289a4d5c7bc8a89b73;p=dpdk.git common/sfc_efx/base: add API to get mport selector by ID The conversion is required when mport ID is received via mport allocation and mport selector is required for filter creation. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton Reviewed-by: Ivan Malov --- diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 7f04b42bae..a59c2e47ef 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4237,6 +4237,19 @@ efx_mae_mport_by_pcie_function( __in uint32_t vf, __out efx_mport_sel_t *mportp); +/* + * Get MPORT selector by an MPORT ID + * + * The resulting MPORT selector is opaque to the caller and can be + * passed as an argument to efx_mae_match_spec_mport_set() + * and efx_mae_action_set_populate_deliver(). + */ +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mae_mport_by_id( + __in const efx_mport_id_t *mport_idp, + __out efx_mport_sel_t *mportp); + /* Get MPORT ID by an MPORT selector */ LIBEFX_API extern __checkReturn efx_rc_t diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index b7afe8fdc8..f5d981f973 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -827,6 +827,23 @@ fail1: return (rc); } + __checkReturn efx_rc_t +efx_mae_mport_by_id( + __in const efx_mport_id_t *mport_idp, + __out efx_mport_sel_t *mportp) +{ + efx_dword_t dword; + + EFX_POPULATE_DWORD_2(dword, + MAE_MPORT_SELECTOR_TYPE, MAE_MPORT_SELECTOR_TYPE_MPORT_ID, + MAE_MPORT_SELECTOR_MPORT_ID, mport_idp->id); + + memset(mportp, 0, sizeof (*mportp)); + mportp->sel = __LE_TO_CPU_32(dword.ed_u32[0]); + + return (0); +} + __checkReturn efx_rc_t efx_mae_match_spec_field_set( __in efx_mae_match_spec_t *spec, diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map index 611757ccde..8c5d813c19 100644 --- a/drivers/common/sfc_efx/version.map +++ b/drivers/common/sfc_efx/version.map @@ -126,6 +126,7 @@ INTERNAL { efx_mae_match_specs_equal; efx_mae_mport_by_pcie_function; efx_mae_mport_by_phy_port; + efx_mae_mport_by_id; efx_mae_mport_id_by_selector; efx_mae_mport_invalid; efx_mae_outer_rule_insert;