From: Viacheslav Galaktionov Date: Fri, 15 Oct 2021 06:49:01 +0000 (+0300) Subject: common/sfc_efx/base: support unprivileged MAE clients X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=40ccb311584f63b702d86456bad31cce6fe89865;p=dpdk.git common/sfc_efx/base: support unprivileged MAE clients In order to differentiate between privileged and unprivileged MAE clients, add a separate boolean flag to represent a NIC's MAE privilege level. Allow initializing unprivileged MAE clients by avoiding calls to functions that can only be called by the admin NIC. Signed-off-by: Viacheslav Galaktionov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c index 3cd9ff89d0..bbc59811ec 100644 --- a/drivers/common/sfc_efx/base/ef10_nic.c +++ b/drivers/common/sfc_efx/base/ef10_nic.c @@ -1442,13 +1442,19 @@ ef10_get_datapath_caps( * MAE support requires the privilege is granted initially, * and ignore later dynamic changes. */ - if (CAP_FLAGS3(req, MAE_SUPPORTED) && - EFX_MCDI_HAVE_PRIVILEGE(encp->enc_privilege_mask, MAE)) + if (CAP_FLAGS3(req, MAE_SUPPORTED)) { encp->enc_mae_supported = B_TRUE; - else + if (EFX_MCDI_HAVE_PRIVILEGE(encp->enc_privilege_mask, MAE)) + encp->enc_mae_admin = B_TRUE; + else + encp->enc_mae_admin = B_FALSE; + } else { encp->enc_mae_supported = B_FALSE; + encp->enc_mae_admin = B_FALSE; + } #else encp->enc_mae_supported = B_FALSE; + encp->enc_mae_admin = B_FALSE; #endif /* EFSYS_OPT_MAE */ #undef CAP_FLAGS1 diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 8975c6e747..60533881c2 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -1618,6 +1618,13 @@ typedef struct efx_nic_cfg_s { boolean_t enc_hlb_counters; /* NIC support for Match-Action Engine (MAE). */ boolean_t enc_mae_supported; + /* + * NIC is privileged, i.e. it is the MAE admin. + * Only privileged MAE clients can manage MAE flow rules, + * for example, modify, count and route traffic to selected + * destination (a MAE client or network port). + */ + boolean_t enc_mae_admin; /* Firmware support for "FLAG" and "MARK" filter actions */ boolean_t enc_filter_action_flag_supported; boolean_t enc_filter_action_mark_supported; diff --git a/drivers/common/sfc_efx/base/siena_nic.c b/drivers/common/sfc_efx/base/siena_nic.c index 29283eac72..8b810d3ae3 100644 --- a/drivers/common/sfc_efx/base/siena_nic.c +++ b/drivers/common/sfc_efx/base/siena_nic.c @@ -197,6 +197,7 @@ siena_board_cfg( encp->enc_filter_action_mark_max = 0; encp->enc_mae_supported = B_FALSE; + encp->enc_mae_admin = B_FALSE; return (0);