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 4DE6345844; Thu, 22 Aug 2024 09:41:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1DC642E7D; Thu, 22 Aug 2024 09:41:25 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 6794D42E71 for ; Thu, 22 Aug 2024 09:41:21 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47M1U4Gu009927; Thu, 22 Aug 2024 00:41:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=e gjRhpJLxq9REyimVzBllIYC9KAcojKNI4ydaRI3Cls=; b=g5huAJB3OYV8MlPeX eCiPjXmXkDCPND+jq5j5BV8x10b+Y0NO5NODj3M48UendzT7cb1VrTT/aoEA4CAi 1HykYXD5BmEUAmd8rWDS4W82JFm6qf7egEK/1etGOMrn7M9uQAoP5XuYqETZVS82 Gs7HAjm2VT+Sp5q6QSsd6DpSrCzHn1QbKCx0X/4m/PtDqZlnJi9IZeyonxro2pvE +VdSi93iJ1dc2TBaZoqnHO2saXc8luRExyrheIVQAAFi5D6lyKAKSy14iTh9LZPw MZYa2/1WHZsAHitbjSaLpH8Z0oQWjxIq22hdLk2eeS5kPSTayjTbQxHvuel+JaYv W6oIA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 415uqns0yd-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Aug 2024 00:41:20 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 22 Aug 2024 00:41:18 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 22 Aug 2024 00:41:18 -0700 Received: from anoobj2204.marvell.com (unknown [10.28.34.118]) by maili.marvell.com (Postfix) with ESMTP id 4017A5B6C4E; Thu, 22 Aug 2024 00:16:58 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Fan Zhang CC: Hemant Agrawal , Jerin Jacob , Aakash Sasidharan , Tejasree Kondoj , Vidya Sagar Velumuri , Subject: [PATCH 2/6] test/crypto: enable larger packet sizes with TLS Date: Thu, 22 Aug 2024 07:16:30 +0000 Message-ID: <20240822071651.2403105-3-anoobj@marvell.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240822071651.2403105-1-anoobj@marvell.com> References: <20240822071651.2403105-1-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: zX1ulat-BmhsaZHBid0CUQiV3UvnWXxV X-Proofpoint-ORIG-GUID: zX1ulat-BmhsaZHBid0CUQiV3UvnWXxV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-22_03,2024-08-19_03,2024-05-17_01 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 Enable larger packet sizes with TLS. Add wrapper for existing create_segmented_mbuf() function to get allocations from both pools. Signed-off-by: Anoob Joseph --- app/test/test_cryptodev.c | 13 +++++-- app/test/test_cryptodev.h | 38 +++++++++++++++++++ app/test/test_cryptodev_security_tls_record.h | 12 +++--- app/test/test_security_proto.h | 7 +++- 4 files changed, 58 insertions(+), 12 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9d8ca8f616..5444d82c50 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -12139,12 +12139,13 @@ test_tls_record_proto_process(const struct tls_record_test_data td[], } /* Setup source mbuf payload */ - ut_params->ibuf = create_segmented_mbuf(ts_params->mbuf_pool, td[i].input_text.len, - nb_segs, 0); + ut_params->ibuf = create_segmented_mbuf_multi_pool(ts_params->mbuf_pool, + ts_params->large_mbuf_pool, td[i].input_text.len, nb_segs, 0); pktmbuf_write(ut_params->ibuf, 0, td[i].input_text.len, td[i].input_text.data); if (flags->out_of_place) - ut_params->obuf = create_segmented_mbuf(ts_params->mbuf_pool, - td[i].output_text.len, nb_segs, 0); + ut_params->obuf = create_segmented_mbuf_multi_pool(ts_params->mbuf_pool, + ts_params->large_mbuf_pool, td[i].output_text.len, nb_segs, + 0); else ut_params->obuf = NULL; @@ -12375,6 +12376,10 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags) pass_cnt++; } + if (flags->data_walkthrough) + printf("\t Min payload size: %d, Max payload size: %d\n", + TLS_RECORD_PLAINTEXT_MIN_LEN, max_payload_len); + if (pass_cnt > 0) return TEST_SUCCESS; else diff --git a/app/test/test_cryptodev.h b/app/test/test_cryptodev.h index af56145cdd..c322f10b94 100644 --- a/app/test/test_cryptodev.h +++ b/app/test/test_cryptodev.h @@ -233,6 +233,44 @@ create_segmented_mbuf(struct rte_mempool *mbuf_pool, int pkt_len, return NULL; } +static inline struct rte_mbuf * +create_segmented_mbuf_multi_pool(struct rte_mempool *mbuf_pool_small, + struct rte_mempool *mbuf_pool_large, int pkt_len, int nb_segs, uint8_t pattern) +{ + struct rte_mempool *mbuf_pool; + int max_seg_len, seg_len; + + if (nb_segs < 1) { + printf("Number of segments must be 1 or more (is %d)\n", nb_segs); + return NULL; + } + + if (pkt_len >= nb_segs) + seg_len = pkt_len / nb_segs; + else + seg_len = 1; + + /* Determine max segment length */ + max_seg_len = seg_len + pkt_len % nb_segs; + + if (max_seg_len > LARGE_MBUF_DATAPAYLOAD_SIZE) { + printf("Segment size %d is too big\n", max_seg_len); + return NULL; + } + + if (max_seg_len > MBUF_DATAPAYLOAD_SIZE) + mbuf_pool = mbuf_pool_large; + else + mbuf_pool = mbuf_pool_small; + + if (mbuf_pool == NULL) { + printf("Invalid mbuf pool\n"); + return NULL; + } + + return create_segmented_mbuf(mbuf_pool, pkt_len, nb_segs, pattern); +} + int process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id, struct rte_crypto_op *op, uint8_t is_cipher, uint8_t is_auth, diff --git a/app/test/test_cryptodev_security_tls_record.h b/app/test/test_cryptodev_security_tls_record.h index e4a291c153..a98cea24f6 100644 --- a/app/test/test_cryptodev_security_tls_record.h +++ b/app/test/test_cryptodev_security_tls_record.h @@ -11,32 +11,32 @@ #include "test_security_proto.h" /* TLS 1.2 Ciphertext length can be up to (2^14 + 2048 + 5 (TLS Header)) Bytes */ -#define TLS_1_2_RECORD_CIPHERTEXT_MAX_LEN (4096u) +#define TLS_1_2_RECORD_CIPHERTEXT_MAX_LEN (18437u) static_assert(TLS_1_2_RECORD_CIPHERTEXT_MAX_LEN <= TEST_SEC_CIPHERTEXT_MAX_LEN, "TEST_SEC_CIPHERTEXT_MAX_LEN should be at least RECORD MAX LEN!"); /* TLS 1.2 Plaintext length can be up to (2^14 + 1024) Bytes */ -#define TLS_1_2_RECORD_PLAINTEXT_MAX_LEN (3072u) +#define TLS_1_2_RECORD_PLAINTEXT_MAX_LEN (17408u) static_assert(TLS_1_2_RECORD_PLAINTEXT_MAX_LEN <= TEST_SEC_CLEARTEXT_MAX_LEN, "TEST_SEC_CLEARTEXT_MAX_LEN should be at least RECORD MAX LEN!"); /* DTLS 1.2 Ciphertext length is similar to TLS 1.2 */ -#define DTLS_1_2_RECORD_CIPHERTEXT_MAX_LEN (4096u) +#define DTLS_1_2_RECORD_CIPHERTEXT_MAX_LEN (18437u) static_assert(DTLS_1_2_RECORD_CIPHERTEXT_MAX_LEN <= TEST_SEC_CIPHERTEXT_MAX_LEN, "TEST_SEC_CIPHERTEXT_MAX_LEN should be at least RECORD MAX LEN!"); /* DTLS 1.2 Plaintext length is similar to TLS 1.2 */ -#define DTLS_1_2_RECORD_PLAINTEXT_MAX_LEN (3072u) +#define DTLS_1_2_RECORD_PLAINTEXT_MAX_LEN (17408u) static_assert(DTLS_1_2_RECORD_PLAINTEXT_MAX_LEN <= TEST_SEC_CLEARTEXT_MAX_LEN, "TEST_SEC_CLEARTEXT_MAX_LEN should be at least RECORD MAX LEN!"); /* TLS 1.3 Ciphertext length can be up to (2^14 + 256 + 5 (TLS Header)) Bytes */ -#define TLS_1_3_RECORD_CIPHERTEXT_MAX_LEN (4096u) +#define TLS_1_3_RECORD_CIPHERTEXT_MAX_LEN (16645u) static_assert(TLS_1_3_RECORD_CIPHERTEXT_MAX_LEN <= TEST_SEC_CIPHERTEXT_MAX_LEN, "TEST_SEC_CIPHERTEXT_MAX_LEN should be at least RECORD MAX LEN!"); /* TLS 1.3 Plaintext length can be up to 2^14 Bytes */ -#define TLS_1_3_RECORD_PLAINTEXT_MAX_LEN (3072u) +#define TLS_1_3_RECORD_PLAINTEXT_MAX_LEN (16384u) static_assert(TLS_1_3_RECORD_PLAINTEXT_MAX_LEN <= TEST_SEC_CLEARTEXT_MAX_LEN, "TEST_SEC_CLEARTEXT_MAX_LEN should be at least RECORD MAX LEN!"); diff --git a/app/test/test_security_proto.h b/app/test/test_security_proto.h index 7eb815604a..8acb0fecca 100644 --- a/app/test/test_security_proto.h +++ b/app/test/test_security_proto.h @@ -10,10 +10,13 @@ #include "test_cryptodev.h" -#define TEST_SEC_CLEARTEXT_MAX_LEN (MBUF_DATAPAYLOAD_SIZE - 1024) -#define TEST_SEC_CIPHERTEXT_MAX_LEN (MBUF_DATAPAYLOAD_SIZE) +#define TEST_SEC_CLEARTEXT_MAX_LEN 17408u +#define TEST_SEC_CIPHERTEXT_MAX_LEN 18437u #define TEST_SEC_PKTS_MAX 32 +static_assert(TEST_SEC_CIPHERTEXT_MAX_LEN <= LARGE_MBUF_DATAPAYLOAD_SIZE, + "TEST_SEC_CIPHERTEXT_MAX_LEN should not be greater than LARGE_MBUF_DATAPAYLOAD_SIZE"); + struct crypto_param { enum rte_crypto_sym_xform_type type; union { -- 2.45.2