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 3991F42B83; Tue, 23 May 2023 21:50:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8CD6442C24; Tue, 23 May 2023 21:49:59 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 07C74410EE for ; Tue, 23 May 2023 21:49:57 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34NHtmBF011695; Tue, 23 May 2023 12:49:54 -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=d7cz0LfHUe49YTa9jIaCELKodqZDkT5TPVdSsQZX5Kk=; b=cYSvsFur5R0wwV39SmVToqwnvW0tGlqtIZvvvoR25OL3cXP/T4ksAp+xarbIr2YUflC/ rfM3VdAmmbKPvbLmEwfUKky+ab4twO4/2xWJJ0BdYY8B2po2FgfU7CgpmXKbZwlXcfLO gUTTpWHdiN+lkOdiSqYzgPadN43koYUMdf+JdI9Z75cdWrH+creQsqW7gevhgkLZJrBF TsBTy1kN2tfkdArG8Yv87yMrqGmiKxvqkq5xlRl/ZM8qzghQf8TW9EPMceO5xNHVvJ4X mh9LLGIUY4sagyTk08GZP3S3pXvcqmv04G61dxf65DTvW9nrzYfl8JjtmTskpab0P+Lp fg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qpwqk30ue-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 23 May 2023 12:49:54 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 23 May 2023 12:49:52 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 23 May 2023 12:49:52 -0700 Received: from localhost.localdomain (unknown [10.28.36.102]) by maili.marvell.com (Postfix) with ESMTP id 0B1033F70AA; Tue, 23 May 2023 12:49:48 -0700 (PDT) From: Akhil Goyal To: , Akhil Goyal CC: , , , , , , , , Subject: [PATCH 01/13] security: add direction in SA/SC configuration Date: Wed, 24 May 2023 01:19:06 +0530 Message-ID: <20230523194918.1940212-2-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230523194918.1940212-1-gakhil@marvell.com> References: <20220928124516.93050-5-gakhil@marvell.com> <20230523194918.1940212-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: M14Zy0EdaT5oRa_SppVU9yiRKsmlHVOr X-Proofpoint-GUID: M14Zy0EdaT5oRa_SppVU9yiRKsmlHVOr 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-05-23_12,2023-05-23_02,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 --- lib/security/rte_security.c | 16 ++++++++++------ lib/security/rte_security.h | 14 ++++++++++---- lib/security/rte_security_driver.h | 12 ++++++++++-- 3 files changed, 30 insertions(+), 12 deletions(-) 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