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 57127A034F; Mon, 11 Oct 2021 16:50:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1FB141143; Mon, 11 Oct 2021 16:49:29 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 6FFB84112E for ; Mon, 11 Oct 2021 16:49:27 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id E76D07F6F8; Mon, 11 Oct 2021 17:49:26 +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 05FBB7F6FE; Mon, 11 Oct 2021 17:49:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 05FBB7F6FE Authentication-Results: shelob.oktetlabs.ru/05FBB7F6FE; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: dev@dpdk.org Cc: Viacheslav Galaktionov , Andy Moreton Date: Mon, 11 Oct 2021 17:48:29 +0300 Message-Id: <20211011144857.446802-11-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211011144857.446802-1-andrew.rybchenko@oktetlabs.ru> References: <20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru> <20211011144857.446802-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 10/38] common/sfc_efx/base: allow creating invalid mport selectors 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 There isn't always a valid mport that can be used. For these cases, special invalid selectors can be generated. Requests that use such selectors in any way will be rejected. Signed-off-by: Viacheslav Galaktionov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx.h | 11 +++++++++++ drivers/common/sfc_efx/base/efx_mae.c | 25 +++++++++++++++++++++++++ drivers/common/sfc_efx/version.map | 1 + 3 files changed, 37 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 94803815ac..c0d1535017 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4196,6 +4196,17 @@ typedef struct efx_mport_id_s { #define EFX_MPORT_NULL (0U) +/* + * Generate an invalid MPORT selector. + * + * The resulting MPORT selector is opaque to the caller. Requests + * that attempt to use it will be rejected. + */ +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mae_mport_invalid( + __out efx_mport_sel_t *mportp); + /* * Get MPORT selector of a physical port. * diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index b38b1143d6..b7afe8fdc8 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -660,6 +660,31 @@ static const efx_mae_mv_bit_desc_t __efx_mae_action_rule_mv_bit_desc_set[] = { #undef EFX_MAE_MV_BIT_DESC }; + __checkReturn efx_rc_t +efx_mae_mport_invalid( + __out efx_mport_sel_t *mportp) +{ + efx_dword_t dword; + efx_rc_t rc; + + if (mportp == NULL) { + rc = EINVAL; + goto fail1; + } + + EFX_POPULATE_DWORD_1(dword, + MAE_MPORT_SELECTOR_TYPE, MAE_MPORT_SELECTOR_TYPE_INVALID); + + memset(mportp, 0, sizeof (*mportp)); + mportp->sel = dword.ed_u32[0]; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + __checkReturn efx_rc_t efx_mae_mport_by_phy_port( __in uint32_t phy_port, diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map index 3dc21878c0..611757ccde 100644 --- a/drivers/common/sfc_efx/version.map +++ b/drivers/common/sfc_efx/version.map @@ -127,6 +127,7 @@ INTERNAL { efx_mae_mport_by_pcie_function; efx_mae_mport_by_phy_port; efx_mae_mport_id_by_selector; + efx_mae_mport_invalid; efx_mae_outer_rule_insert; efx_mae_outer_rule_remove; -- 2.30.2