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 5EF9C42C4D; Wed, 7 Jun 2023 15:05:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B601C42F88; Wed, 7 Jun 2023 15:03:13 +0200 (CEST) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id CCB45427F2 for ; Wed, 7 Jun 2023 15:02:58 +0200 (CEST) Received: from localhost.localdomain (unknown [78.109.69.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id 57EA9E1B5B; Wed, 7 Jun 2023 17:02:58 +0400 (+04) From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Ferruh Yigit , Andy Moreton Subject: [PATCH v4 21/34] common/sfc_efx/base: provide an API to clone MAE match specs Date: Wed, 7 Jun 2023 17:02:32 +0400 Message-Id: <20230607130245.8048-22-ivan.malov@arknetworks.am> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230607130245.8048-1-ivan.malov@arknetworks.am> References: <20230601195538.8265-1-ivan.malov@arknetworks.am> <20230607130245.8048-1-ivan.malov@arknetworks.am> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The DPDK driver would like to have a means to make a copy of the action rule match specification before trying to dissect it to possibly move out the per-connection 5-tuple data from it to build up an entry in the HW conntrack assistance table. Making such a copy at the end of parsing should be preferred over maintaining DPDK-level structures because the resulting code is easier on eyes and less prone to errors in this case. Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx.h | 7 +++++++ drivers/common/sfc_efx/base/efx_mae.c | 26 ++++++++++++++++++++++++++ drivers/common/sfc_efx/version.map | 1 + 3 files changed, 34 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 49f807823e..97271f0f00 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4452,6 +4452,13 @@ efx_mae_match_spec_recirc_id_set( __in efx_mae_match_spec_t *spec, __in uint8_t recirc_id); +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mae_match_spec_clone( + __in efx_nic_t *enp, + __in efx_mae_match_spec_t *orig, + __out efx_mae_match_spec_t **clonep); + LIBEFX_API extern __checkReturn boolean_t efx_mae_match_specs_equal( diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index 7732d99992..43dfba518a 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -1163,6 +1163,32 @@ efx_mae_match_spec_mport_set( fail2: EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + + __checkReturn efx_rc_t +efx_mae_match_spec_clone( + __in efx_nic_t *enp, + __in efx_mae_match_spec_t *orig, + __out efx_mae_match_spec_t **clonep) +{ + efx_mae_match_spec_t *clone; + efx_rc_t rc; + + EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (*clone), clone); + if (clone == NULL) { + rc = ENOMEM; + goto fail1; + } + + memcpy(clone, orig, sizeof (efx_mae_match_spec_t)); + + *clonep = clone; + + return (0); + fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map index d083a54a03..931d556e80 100644 --- a/drivers/common/sfc_efx/version.map +++ b/drivers/common/sfc_efx/version.map @@ -124,6 +124,7 @@ INTERNAL { efx_mae_mac_addr_alloc; efx_mae_mac_addr_free; efx_mae_match_spec_bit_set; + efx_mae_match_spec_clone; efx_mae_match_spec_field_set; efx_mae_match_spec_fini; efx_mae_match_spec_init; -- 2.30.2