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 <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
This commit is contained in:
Igor Romanov 2021-10-11 17:48:32 +03:00 committed by Ferruh Yigit
parent ba459fad12
commit 3d6e8e459c
3 changed files with 31 additions and 0 deletions

View File

@ -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

View File

@ -827,6 +827,23 @@ efx_mae_mport_id_by_selector(
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,

View File

@ -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;