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 A5749A0524 for ; Fri, 5 Feb 2021 12:22:05 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F42F1606BA; Fri, 5 Feb 2021 12:22:05 +0100 (CET) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mails.dpdk.org (Postfix) with ESMTP id 7C0961606BA for ; Fri, 5 Feb 2021 12:22:04 +0100 (CET) Received: by mail-wr1-f46.google.com with SMTP id g10so7307461wrx.1 for ; Fri, 05 Feb 2021 03:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cX62Cqh40ad63DxXytxD71WqTg9Gp4D+ykhcKUzvxPQ=; b=gBrzKi6NOnKawiKbGBiIIx/+ckiFs6rR6O0vGuoLnT2lcwyT285SIQF8Lyd6fL11vA ly8Yy6dBzM9a2RnNlq5W2VWc/Zwg3lbqzJ5QFq8Y97zET+5VmYphqSl9LLHjYcotRqVE CxrQ4cYOYRypH61bCqWa+OK8zwjznzlnNfiV7mbeymekHsnM4rmKhD80wJqF4oeSszFY q/nL4eilQWMwLUglPWUYHOubtqmrrJi2MIoiq1evvK13EATSv2BrGvxEwpFsGodFFz6+ 7KE3ZKuX1wPGCPeE+xmbrCjisafD8U1uDrJ8esheQyRE3GqSorlxKjb19QlJ32vP+osC L2Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cX62Cqh40ad63DxXytxD71WqTg9Gp4D+ykhcKUzvxPQ=; b=PIFVc0i53zHi0KFJvbfPjXU2FV0H6LAgi0RLFWXaBQ+/gkHASTorA+QCLs+Sagwb+O l/FVG4Qwc++WoNslZ6uXDRuvj5Mkpcnyh/3dLHrifbESaR0AuoWxK4FecHMu+j5+DSG/ b9VOm9xnSX97q00H0HXdJwn4hBQ6LZfwv3OKzkT3lKz+q/KcMMLA3mSKhAR2wYJSexCK ymdiRA68obfp7pJfb1ZXlzDa+7GzY74MAaydzDGyAmJThsFLJ1bB8GbDctCc2jSTDI1U S2FmTyg4RDg0vtkMk3NQd14MKfFNHnhvSQy7hhr//4UQ+ivBWGX8KK7YsaGKv619JByi iucA== X-Gm-Message-State: AOAM533ZbesZ83hZHUkVgPqDzac1f8I6WE8Yft+LkpOux89vBHgpg7Qp v0BNMwNRuX3c8D787kzmYTc= X-Google-Smtp-Source: ABdhPJySJG9l94gbJyWMEfdulw335RYOZ8Di+XWVsNvhp7GqX6odOStdwrdj9b5ihKnCMCHQAOhvFg== X-Received: by 2002:adf:f2d1:: with SMTP id d17mr4641794wrp.110.1612524124303; Fri, 05 Feb 2021 03:22:04 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id o13sm5134861wmh.2.2021.02.05.03.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:22:03 -0800 (PST) From: luca.boccassi@gmail.com To: Ivan Malov Cc: Andy Moreton , Andrew Rybchenko , dpdk stable Date: Fri, 5 Feb 2021 11:15:36 +0000 Message-Id: <20210205111920.1272063-50-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'common/sfc_efx/base: check for MAE privilege' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/fd0e7135ccd69adf74aa3486cbdb52d2c3be98e7 Thanks. Luca Boccassi --- >From fd0e7135ccd69adf74aa3486cbdb52d2c3be98e7 Mon Sep 17 00:00:00 2001 From: Ivan Malov Date: Fri, 11 Dec 2020 18:34:21 +0300 Subject: [PATCH] common/sfc_efx/base: check for MAE privilege [ upstream commit be2f2be77ce2ee52cbc15ba4831152974990ac5c ] VFs can't control MAE, so it's important to override the general MAE capability bit by taking MAE privilege into account. Reorder the code slightly to have the privileges queried before datapath capabilities are discovered and add required MAE privilege check. Fixes: eb4e80085fae ("common/sfc_efx/base: indicate support for MAE") Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Reviewed-by: Andrew Rybchenko --- drivers/common/sfc_efx/base/ef10_nic.c | 48 ++++++++++++++++---------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c index 68414d9fa9..9dccde9576 100644 --- a/drivers/common/sfc_efx/base/ef10_nic.c +++ b/drivers/common/sfc_efx/base/ef10_nic.c @@ -1423,11 +1423,19 @@ ef10_get_datapath_caps( #if EFSYS_OPT_MAE /* - * Indicate support for MAE. - * MAE is supported by Riverhead boards starting with R2, - * and it is required that FW is built with MAE support, too. + * Check support for EF100 Match Action Engine (MAE). + * MAE hardware is present on Riverhead boards (from R2), + * and on Keystone, and requires support in firmware. + * + * MAE control operations require MAE control privilege, + * which is not available for VFs. + * + * Privileges can change dynamically at runtime: we assume + * MAE support requires the privilege is granted initially, + * and ignore later dynamic changes. */ - if (CAP_FLAGS3(req, MAE_SUPPORTED)) + if (CAP_FLAGS3(req, MAE_SUPPORTED) && + EFX_MCDI_HAVE_PRIVILEGE(encp->enc_privilege_mask, MAE)) encp->enc_mae_supported = B_TRUE; else encp->enc_mae_supported = B_FALSE; @@ -1896,6 +1904,18 @@ efx_mcdi_nic_board_cfg( EFX_MAC_ADDR_COPY(encp->enc_mac_addr, mac_addr); + /* + * Get the current privilege mask. Note that this may be modified + * dynamically, so for most cases the value is informational only. + * If the privilege being discovered can't be granted dynamically, + * it's fine to rely on the value. In all other cases, DO NOT use + * the privilege mask to check for sufficient privileges, as that + * can result in time-of-check/time-of-use bugs. + */ + if ((rc = ef10_get_privilege_mask(enp, &mask)) != 0) + goto fail6; + encp->enc_privilege_mask = mask; + /* Board configuration (legacy) */ rc = efx_mcdi_get_board_cfg(enp, &board_type, NULL, NULL); if (rc != 0) { @@ -1903,14 +1923,14 @@ efx_mcdi_nic_board_cfg( if (rc == EACCES) board_type = 0; else - goto fail6; + goto fail7; } encp->enc_board_type = board_type; /* Fill out fields in enp->en_port and enp->en_nic_cfg from MCDI */ if ((rc = efx_mcdi_get_phy_cfg(enp)) != 0) - goto fail7; + goto fail8; /* * Firmware with support for *_FEC capability bits does not @@ -1929,18 +1949,18 @@ efx_mcdi_nic_board_cfg( /* Obtain the default PHY advertised capabilities */ if ((rc = ef10_phy_get_link(enp, &els)) != 0) - goto fail8; + goto fail9; epp->ep_default_adv_cap_mask = els.epls.epls_adv_cap_mask; epp->ep_adv_cap_mask = els.epls.epls_adv_cap_mask; /* Check capabilities of running datapath firmware */ if ((rc = ef10_get_datapath_caps(enp)) != 0) - goto fail9; + goto fail10; /* Get interrupt vector limits */ if ((rc = efx_mcdi_get_vector_cfg(enp, &base, &nvec, NULL)) != 0) { if (EFX_PCI_FUNCTION_IS_PF(encp)) - goto fail10; + goto fail11; /* Ignore error (cannot query vector limits from a VF). */ base = 0; @@ -1949,16 +1969,6 @@ efx_mcdi_nic_board_cfg( encp->enc_intr_vec_base = base; encp->enc_intr_limit = nvec; - /* - * Get the current privilege mask. Note that this may be modified - * dynamically, so this value is informational only. DO NOT use - * the privilege mask to check for sufficient privileges, as that - * can result in time-of-check/time-of-use bugs. - */ - if ((rc = ef10_get_privilege_mask(enp, &mask)) != 0) - goto fail11; - encp->enc_privilege_mask = mask; - return (0); fail11: -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:31.543744906 +0000 +++ 0050-common-sfc_efx-base-check-for-MAE-privilege.patch 2021-02-05 11:18:28.774690503 +0000 @@ -1 +1 @@ -From be2f2be77ce2ee52cbc15ba4831152974990ac5c Mon Sep 17 00:00:00 2001 +From fd0e7135ccd69adf74aa3486cbdb52d2c3be98e7 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit be2f2be77ce2ee52cbc15ba4831152974990ac5c ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org