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 3229542C5A; Thu, 8 Jun 2023 08:56:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8B7A42D6C; Thu, 8 Jun 2023 08:55:56 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 8B18042D4B for ; Thu, 8 Jun 2023 08:55:53 +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 357LwHmD023579; Wed, 7 Jun 2023 23:55:50 -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=iozv4oTPdxq+e0eRjdE5Qm2QRfrN2VIW+dmmBsrw11M=; b=D/vNd3DE5+Fli6IxVsk9tI7iNt5W4zHUDmAbXFWmpSNNtRVm2dsrh9+2xoIfmQq91dvA pWzFSTnL3yKZFa61XM89ztjVb+KxLni5qZe6z6DCx/Vq/DTyGjVwluz2IzwpdcjNhiPE 8IdF371VLPW044xR4AdbQ96nJ+f8bqnh+AyTcYOyBTixFwMmpyiPdK5v//lizakuWwo0 bFD3unCNZcM6vJm3+wqUlobc5ZrzV4ZhNp5ejWq4WBNHAsbvgifav0antlgBWsuveW+Z 5P4cGyDfkNwxhz3J4szS0Z21CGbqs/8+5B0mQcR21ddEFtEAVWSU2y1gzrp20Vwk5Ux4 ig== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3r329c1jum-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 07 Jun 2023 23:55:50 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 7 Jun 2023 23:55:46 -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; Wed, 7 Jun 2023 23:55:45 -0700 Received: from localhost.localdomain (unknown [10.28.36.102]) by maili.marvell.com (Postfix) with ESMTP id E517A3F703F; Wed, 7 Jun 2023 23:55:42 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , Subject: [PATCH v3 11/13] test/security: verify MACsec Rx rekey Date: Thu, 8 Jun 2023 12:24:56 +0530 Message-ID: <20230608065458.333670-12-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230608065458.333670-1-gakhil@marvell.com> References: <20230607151940.223417-1-gakhil@marvell.com> <20230608065458.333670-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: thQWSDQeGfWJ2zX3epp3rmCLGEu3PrfJ X-Proofpoint-ORIG-GUID: thQWSDQeGfWJ2zX3epp3rmCLGEu3PrfJ 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-08_04,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 From: Ankur Dwivedi This patch enables the Rx rekey test case for MACSEC. Signed-off-by: Ankur Dwivedi --- app/test/test_security_inline_macsec.c | 50 +++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/app/test/test_security_inline_macsec.c b/app/test/test_security_inline_macsec.c index 2172f61199..d832dfc170 100644 --- a/app/test/test_security_inline_macsec.c +++ b/app/test/test_security_inline_macsec.c @@ -906,8 +906,14 @@ test_macsec(const struct mcs_test_vector *td[], enum mcs_op op, const struct mcs if (op == MCS_DECAP || op == MCS_ENCAP_DECAP || op == MCS_VERIFY_ONLY || op == MCS_AUTH_VERIFY) { for (an = 0; an < RTE_SECURITY_MACSEC_NUM_AN; an++) { + if (opts->rekey_en && an == + (opts->rekey_td->secure_pkt.data[tci_off] & + RTE_MACSEC_AN_MASK)) + fill_macsec_sa_conf(opts->rekey_td, &sa_conf, + RTE_SECURITY_MACSEC_DIR_RX, an, tci_off); + else /* For simplicity, using same SA conf for all AN */ - fill_macsec_sa_conf(td[i], &sa_conf, + fill_macsec_sa_conf(td[i], &sa_conf, RTE_SECURITY_MACSEC_DIR_RX, an, tci_off); id = rte_security_macsec_sa_create(ctx, &sa_conf); if (id < 0) { @@ -1054,6 +1060,9 @@ test_macsec(const struct mcs_test_vector *td[], enum mcs_op op, const struct mcs } tx_sa_id[0][0] = (uint16_t)id; break; + case RTE_ETH_EVENT_MACSEC_RX_SA_PN_SOFT_EXP: + printf("Received RTE_ETH_EVENT_MACSEC_RX_SA_PN_SOFT_EXP event\n"); + break; default: printf("Received unsupported event\n"); } @@ -1951,6 +1960,41 @@ test_inline_macsec_rekey_tx(const void *data __rte_unused) return all_err; } +static int +test_inline_macsec_rekey_rx(const void *data __rte_unused) +{ + const struct mcs_test_vector *cur_td; + struct mcs_test_opts opts = {0}; + int err, all_err = 0; + int i, size; + + opts.val_frames = RTE_SECURITY_MACSEC_VALIDATE_STRICT; + opts.protect_frames = true; + opts.sa_in_use = 1; + opts.nb_td = 1; + opts.sectag_insert_mode = 1; + opts.mtu = RTE_ETHER_MTU; + opts.rekey_en = 1; + + size = (sizeof(list_mcs_rekey_vectors) / sizeof((list_mcs_rekey_vectors)[0])); + for (i = 0; i < size; i++) { + cur_td = &list_mcs_rekey_vectors[i]; + opts.rekey_td = &list_mcs_rekey_vectors[++i]; + err = test_macsec(&cur_td, MCS_DECAP, &opts); + if (err) { + printf("Rx rekey test case %d failed\n", i); + err = -1; + } else { + printf("Rx rekey test case %d passed\n", i); + err = 0; + } + all_err += err; + } + + printf("\n%s: Success: %d, Failure: %d\n", __func__, size + all_err, -all_err); + return all_err; +} + static int ut_setup_inline_macsec(void) { @@ -2184,6 +2228,10 @@ static struct unit_test_suite inline_macsec_testsuite = { "MACsec re-key Tx", ut_setup_inline_macsec, ut_teardown_inline_macsec, test_inline_macsec_rekey_tx), + TEST_CASE_NAMED_ST( + "MACsec re-key Rx", + ut_setup_inline_macsec, ut_teardown_inline_macsec, + test_inline_macsec_rekey_rx), TEST_CASES_END() /**< NULL terminate unit test array */ }, -- 2.25.1