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 D3DFEA034F; Mon, 11 Oct 2021 16:50:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DD5C4116E; Mon, 11 Oct 2021 16:49:37 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 75D4241161 for ; Mon, 11 Oct 2021 16:49:35 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id 42DD17F6FA; Mon, 11 Oct 2021 17:49:35 +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 6B9527F703; Mon, 11 Oct 2021 17:49:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 6B9527F703 Authentication-Results: shelob.oktetlabs.ru/6B9527F703; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: dev@dpdk.org Cc: Igor Romanov , Andy Moreton , Ivan Malov Date: Mon, 11 Oct 2021 17:48:33 +0300 Message-Id: <20211011144857.446802-15-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 14/38] common/sfc_efx/base: add mport alias MCDI wrappers 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: Igor Romanov The APIs allow creation of mports for port representor traffic filtering. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton Reviewed-by: Ivan Malov --- drivers/common/sfc_efx/base/efx.h | 13 ++++ drivers/common/sfc_efx/base/efx_mae.c | 90 +++++++++++++++++++++++++++ drivers/common/sfc_efx/version.map | 2 + 3 files changed, 105 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index a59c2e47ef..0a178128ba 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4599,6 +4599,19 @@ efx_mae_action_rule_remove( __in efx_nic_t *enp, __in const efx_mae_rule_id_t *ar_idp); +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mcdi_mport_alloc_alias( + __in efx_nic_t *enp, + __out efx_mport_id_t *mportp, + __out_opt uint32_t *labelp); + +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mae_mport_free( + __in efx_nic_t *enp, + __in const efx_mport_id_t *mportp); + #endif /* EFSYS_OPT_MAE */ #if EFSYS_OPT_VIRTIO diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index f5d981f973..3f498fe189 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -3142,4 +3142,94 @@ efx_mae_action_rule_remove( return (rc); } + __checkReturn efx_rc_t +efx_mcdi_mport_alloc_alias( + __in efx_nic_t *enp, + __out efx_mport_id_t *mportp, + __out_opt uint32_t *labelp) +{ + const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp); + efx_mcdi_req_t req; + EFX_MCDI_DECLARE_BUF(payload, + MC_CMD_MAE_MPORT_ALLOC_ALIAS_IN_LEN, + MC_CMD_MAE_MPORT_ALLOC_ALIAS_OUT_LEN); + efx_rc_t rc; + + if (encp->enc_mae_supported == B_FALSE) { + rc = ENOTSUP; + goto fail1; + } + + req.emr_cmd = MC_CMD_MAE_MPORT_ALLOC; + req.emr_in_buf = payload; + req.emr_in_length = MC_CMD_MAE_MPORT_ALLOC_ALIAS_IN_LEN; + req.emr_out_buf = payload; + req.emr_out_length = MC_CMD_MAE_MPORT_ALLOC_ALIAS_OUT_LEN; + + MCDI_IN_SET_DWORD(req, MAE_MPORT_ALLOC_IN_TYPE, + MC_CMD_MAE_MPORT_ALLOC_IN_MPORT_TYPE_ALIAS); + MCDI_IN_SET_DWORD(req, MAE_MPORT_ALLOC_ALIAS_IN_DELIVER_MPORT, + MAE_MPORT_SELECTOR_ASSIGNED); + + efx_mcdi_execute(enp, &req); + + if (req.emr_rc != 0) { + rc = req.emr_rc; + goto fail2; + } + + mportp->id = MCDI_OUT_DWORD(req, MAE_MPORT_ALLOC_OUT_MPORT_ID); + if (labelp != NULL) + *labelp = MCDI_OUT_DWORD(req, MAE_MPORT_ALLOC_ALIAS_OUT_LABEL); + + return (0); + +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + + __checkReturn efx_rc_t +efx_mae_mport_free( + __in efx_nic_t *enp, + __in const efx_mport_id_t *mportp) +{ + const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp); + efx_mcdi_req_t req; + EFX_MCDI_DECLARE_BUF(payload, + MC_CMD_MAE_MPORT_FREE_IN_LEN, + MC_CMD_MAE_MPORT_FREE_OUT_LEN); + efx_rc_t rc; + + if (encp->enc_mae_supported == B_FALSE) { + rc = ENOTSUP; + goto fail1; + } + + req.emr_cmd = MC_CMD_MAE_MPORT_FREE; + req.emr_in_buf = payload; + req.emr_in_length = MC_CMD_MAE_MPORT_FREE_IN_LEN; + req.emr_out_buf = payload; + req.emr_out_length = MC_CMD_MAE_MPORT_FREE_OUT_LEN; + + MCDI_IN_SET_DWORD(req, MAE_MPORT_FREE_IN_MPORT_ID, mportp->id); + + efx_mcdi_execute(enp, &req); + + if (req.emr_rc != 0) { + rc = req.emr_rc; + goto fail2; + } + + return (0); + +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + #endif /* EFSYS_OPT_MAE */ diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map index 8c5d813c19..3488367f68 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_by_id; + efx_mae_mport_free; efx_mae_mport_id_by_selector; efx_mae_mport_invalid; efx_mae_outer_rule_insert; @@ -136,6 +137,7 @@ INTERNAL { efx_mcdi_get_proxy_handle; efx_mcdi_get_timeout; efx_mcdi_init; + efx_mcdi_mport_alloc_alias; efx_mcdi_new_epoch; efx_mcdi_reboot; efx_mcdi_request_abort; -- 2.30.2