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 9512742C4E; Wed, 7 Jun 2023 17:20:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7FA3342B8E; Wed, 7 Jun 2023 17:19:58 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 58F9A40A84 for ; Wed, 7 Jun 2023 17:19:56 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 357Dvj7Z028182; Wed, 7 Jun 2023 08:19:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Ao0FnCwxlA1FTzoUWq+ioGvYF/pEBwQffY2sbUizsAM=; b=LjghxcrxMod6kzyiyWznWVoWQMSSFZlNgeUbYKJw6QaeFM+iJESVCrf1KYxEtRrXEtrB ObuZfCuZMyfkBD69LBrOs3K04yVx/UlyX77dEqP86RrQQmMHVc22tqI0OXyO4FZjjKpy RenEOMBldiQNDF8DutJKfj85teQIC3kLAt97AxRyJS/zoYY4C+XIG0hz/OYdHQon7RMF nxGqbzUmIQvw1TyxxFYhXn8AxWvmq43d1FIu+LAiOUeBLnWnE8gxgelIx99xtbOZgX9N JuicodrUXbT9bCMb/xt16WToC6d4QLbPAtJSj3iDaK9tvvckegmQB1uGKgArXzFXCRtz Eg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3r2a7bv64y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 07 Jun 2023 08:19:53 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 7 Jun 2023 08:19:51 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 7 Jun 2023 08:19:51 -0700 Received: from localhost.localdomain (unknown [10.28.36.102]) by maili.marvell.com (Postfix) with ESMTP id 528253F7088; Wed, 7 Jun 2023 08:19:48 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , , Akhil Goyal Subject: [PATCH v2 01/13] security: add direction in SA/SC configuration Date: Wed, 7 Jun 2023 20:49:28 +0530 Message-ID: <20230607151940.223417-2-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230607151940.223417-1-gakhil@marvell.com> References: <20230523194918.1940212-1-gakhil@marvell.com> <20230607151940.223417-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: ApB596M3Q6NDWS5IWaDFPKbotBqSoZtO X-Proofpoint-GUID: ApB596M3Q6NDWS5IWaDFPKbotBqSoZtO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-07_07,2023-06-07_01,2023-05-22_02 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 MACsec SC/SA ids are created based on direction of the flow. Hence, added the missing field for configuration and cleanup of the SCs and SAs. Signed-off-by: Akhil Goyal --- devtools/libabigail.abignore | 7 +++++++ lib/security/rte_security.c | 16 ++++++++++------ lib/security/rte_security.h | 14 ++++++++++---- lib/security/rte_security_driver.h | 12 ++++++++++-- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore index c0361bfc7b..14d8fa4293 100644 --- a/devtools/libabigail.abignore +++ b/devtools/libabigail.abignore @@ -37,6 +37,13 @@ [suppress_type] type_kind = enum changed_enumerators = RTE_CRYPTO_ASYM_XFORM_ECPM, RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END +; Ignore changes to rte_security_ops MACsec APIs which are experimental +[suppress_type] + name = rte_security_ops + has_data_member_inserted_between = + { + offset_of(security_macsec_sc_create_t), offset_of(security_macsec_sa_stats_get_t) + } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Temporary exceptions till next major ABI version ; diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c index e102c55e55..c4d64bb8e9 100644 --- a/lib/security/rte_security.c +++ b/lib/security/rte_security.c @@ -164,13 +164,14 @@ rte_security_macsec_sa_create(struct rte_security_ctx *instance, } int -rte_security_macsec_sc_destroy(struct rte_security_ctx *instance, uint16_t sc_id) +rte_security_macsec_sc_destroy(struct rte_security_ctx *instance, uint16_t sc_id, + enum rte_security_macsec_direction dir) { int ret; RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, macsec_sc_destroy, -EINVAL, -ENOTSUP); - ret = instance->ops->macsec_sc_destroy(instance->device, sc_id); + ret = instance->ops->macsec_sc_destroy(instance->device, sc_id, dir); if (ret != 0) return ret; @@ -181,13 +182,14 @@ rte_security_macsec_sc_destroy(struct rte_security_ctx *instance, uint16_t sc_id } int -rte_security_macsec_sa_destroy(struct rte_security_ctx *instance, uint16_t sa_id) +rte_security_macsec_sa_destroy(struct rte_security_ctx *instance, uint16_t sa_id, + enum rte_security_macsec_direction dir) { int ret; RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, macsec_sa_destroy, -EINVAL, -ENOTSUP); - ret = instance->ops->macsec_sa_destroy(instance->device, sa_id); + ret = instance->ops->macsec_sa_destroy(instance->device, sa_id, dir); if (ret != 0) return ret; @@ -199,22 +201,24 @@ rte_security_macsec_sa_destroy(struct rte_security_ctx *instance, uint16_t sa_id int rte_security_macsec_sc_stats_get(struct rte_security_ctx *instance, uint16_t sc_id, + enum rte_security_macsec_direction dir, struct rte_security_macsec_sc_stats *stats) { RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, macsec_sc_stats_get, -EINVAL, -ENOTSUP); RTE_PTR_OR_ERR_RET(stats, -EINVAL); - return instance->ops->macsec_sc_stats_get(instance->device, sc_id, stats); + return instance->ops->macsec_sc_stats_get(instance->device, sc_id, dir, stats); } int rte_security_macsec_sa_stats_get(struct rte_security_ctx *instance, uint16_t sa_id, + enum rte_security_macsec_direction dir, struct rte_security_macsec_sa_stats *stats) { RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, macsec_sa_stats_get, -EINVAL, -ENOTSUP); RTE_PTR_OR_ERR_RET(stats, -EINVAL); - return instance->ops->macsec_sa_stats_get(instance->device, sa_id, stats); + return instance->ops->macsec_sa_stats_get(instance->device, sa_id, dir, stats); } int diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h index 4bacf9fcd9..c7a523b6d6 100644 --- a/lib/security/rte_security.h +++ b/lib/security/rte_security.h @@ -761,6 +761,7 @@ rte_security_macsec_sc_create(struct rte_security_ctx *instance, * * @param instance security instance * @param sc_id SC ID to be destroyed + * @param dir direction of the SC * @return * - 0 if successful. * - -EINVAL if sc_id is invalid or instance is NULL. @@ -768,7 +769,8 @@ rte_security_macsec_sc_create(struct rte_security_ctx *instance, */ __rte_experimental int -rte_security_macsec_sc_destroy(struct rte_security_ctx *instance, uint16_t sc_id); +rte_security_macsec_sc_destroy(struct rte_security_ctx *instance, uint16_t sc_id, + enum rte_security_macsec_direction dir); /** * @warning @@ -798,6 +800,7 @@ rte_security_macsec_sa_create(struct rte_security_ctx *instance, * * @param instance security instance * @param sa_id SA ID to be destroyed + * @param dir direction of the SA * @return * - 0 if successful. * - -EINVAL if sa_id is invalid or instance is NULL. @@ -805,7 +808,8 @@ rte_security_macsec_sa_create(struct rte_security_ctx *instance, */ __rte_experimental int -rte_security_macsec_sa_destroy(struct rte_security_ctx *instance, uint16_t sa_id); +rte_security_macsec_sa_destroy(struct rte_security_ctx *instance, uint16_t sa_id, + enum rte_security_macsec_direction dir); /** Device-specific metadata field type */ typedef uint64_t rte_security_dynfield_t; @@ -1077,6 +1081,7 @@ rte_security_session_stats_get(struct rte_security_ctx *instance, * * @param instance security instance * @param sa_id SA ID for which stats are needed + * @param dir direction of the SA * @param stats statistics * @return * - On success, return 0. @@ -1085,7 +1090,7 @@ rte_security_session_stats_get(struct rte_security_ctx *instance, __rte_experimental int rte_security_macsec_sa_stats_get(struct rte_security_ctx *instance, - uint16_t sa_id, + uint16_t sa_id, enum rte_security_macsec_direction dir, struct rte_security_macsec_sa_stats *stats); /** @@ -1096,6 +1101,7 @@ rte_security_macsec_sa_stats_get(struct rte_security_ctx *instance, * * @param instance security instance * @param sc_id SC ID for which stats are needed + * @param dir direction of the SC * @param stats SC statistics * @return * - On success, return 0. @@ -1104,7 +1110,7 @@ rte_security_macsec_sa_stats_get(struct rte_security_ctx *instance, __rte_experimental int rte_security_macsec_sc_stats_get(struct rte_security_ctx *instance, - uint16_t sc_id, + uint16_t sc_id, enum rte_security_macsec_direction dir, struct rte_security_macsec_sc_stats *stats); /** diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h index 421e6f7780..677c7d1f91 100644 --- a/lib/security/rte_security_driver.h +++ b/lib/security/rte_security_driver.h @@ -106,8 +106,10 @@ typedef int (*security_macsec_sc_create_t)(void *device, struct rte_security_mac * * @param device Crypto/eth device pointer * @param sc_id MACsec SC ID + * @param dir Direction of SC */ -typedef int (*security_macsec_sc_destroy_t)(void *device, uint16_t sc_id); +typedef int (*security_macsec_sc_destroy_t)(void *device, uint16_t sc_id, + enum rte_security_macsec_direction dir); /** * Configure a MACsec security Association (SA) on a device. @@ -128,8 +130,10 @@ typedef int (*security_macsec_sa_create_t)(void *device, struct rte_security_mac * * @param device Crypto/eth device pointer * @param sa_id MACsec SA ID + * @param dir Direction of SA */ -typedef int (*security_macsec_sa_destroy_t)(void *device, uint16_t sa_id); +typedef int (*security_macsec_sa_destroy_t)(void *device, uint16_t sa_id, + enum rte_security_macsec_direction dir); /** * Get the size of a security session @@ -162,6 +166,7 @@ typedef int (*security_session_stats_get_t)(void *device, * * @param device Crypto/eth device pointer * @param sc_id secure channel ID created by rte_security_macsec_sc_create() + * @param dir direction of SC * @param stats SC stats of the driver * * @return @@ -169,6 +174,7 @@ typedef int (*security_session_stats_get_t)(void *device, * - -EINVAL if sc_id or device is invalid. */ typedef int (*security_macsec_sc_stats_get_t)(void *device, uint16_t sc_id, + enum rte_security_macsec_direction dir, struct rte_security_macsec_sc_stats *stats); /** @@ -176,6 +182,7 @@ typedef int (*security_macsec_sc_stats_get_t)(void *device, uint16_t sc_id, * * @param device Crypto/eth device pointer * @param sa_id secure channel ID created by rte_security_macsec_sc_create() + * @param dir direction of SA * @param stats SC stats of the driver * * @return @@ -183,6 +190,7 @@ typedef int (*security_macsec_sc_stats_get_t)(void *device, uint16_t sc_id, * - -EINVAL if sa_id or device is invalid. */ typedef int (*security_macsec_sa_stats_get_t)(void *device, uint16_t sa_id, + enum rte_security_macsec_direction dir, struct rte_security_macsec_sa_stats *stats); -- 2.25.1