From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12664A0C4C; Fri, 15 Oct 2021 08:49:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D5DEA4117B; Fri, 15 Oct 2021 08:49:17 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 766F340041 for ; Fri, 15 Oct 2021 08:49:15 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id 120447F6F8; Fri, 15 Oct 2021 09:49:15 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id 4385D7F6C6; Fri, 15 Oct 2021 09:49:11 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 4385D7F6C6 Authentication-Results: shelob.oktetlabs.ru/4385D7F6C6; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: dev@dpdk.org Cc: Viacheslav Galaktionov , Andy Moreton Date: Fri, 15 Oct 2021 09:49:01 +0300 Message-Id: <20211015064903.3302489-2-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211015064903.3302489-1-andrew.rybchenko@oktetlabs.ru> References: <20211015064903.3302489-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/3] common/sfc_efx/base: support unprivileged MAE clients X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Viacheslav Galaktionov 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 --- drivers/common/sfc_efx/base/ef10_nic.c | 12 +++++++++--- drivers/common/sfc_efx/base/efx.h | 7 +++++++ drivers/common/sfc_efx/base/siena_nic.c | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) 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); -- 2.30.2