From: Anoob Joseph <anoobj@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>, Fan Zhang <fanzhang.oss@gmail.com>
Cc: Hemant Agrawal <hemant.agrawal@nxp.com>,
Jerin Jacob <jerinj@marvell.com>,
Aakash Sasidharan <asasidharan@marvell.com>,
Tejasree Kondoj <ktejasree@marvell.com>,
Vidya Sagar Velumuri <vvelumuri@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 2/6] test/crypto: enable larger packet sizes with TLS
Date: Thu, 22 Aug 2024 07:16:30 +0000 [thread overview]
Message-ID: <20240822071651.2403105-3-anoobj@marvell.com> (raw)
In-Reply-To: <20240822071651.2403105-1-anoobj@marvell.com>
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 <anoobj@marvell.com>
---
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
next prev parent reply other threads:[~2024-08-22 7:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 7:16 [PATCH 0/6] Fixes and improvements in crypto unit tests Anoob Joseph
2024-08-22 7:16 ` [PATCH 1/6] test/crypto: add asserts to validate test lengths Anoob Joseph
2024-08-22 7:16 ` Anoob Joseph [this message]
2024-08-22 7:16 ` [PATCH 3/6] test/crypto: remove redefinition Anoob Joseph
2024-08-22 7:16 ` [PATCH 4/6] test/crypto: remove unused macros Anoob Joseph
2024-08-22 7:16 ` [PATCH 5/6] test/crypto: start opening brace in new line Anoob Joseph
2024-08-22 7:16 ` [PATCH 6/6] test/crypto: free pools in teardown Anoob Joseph
2024-09-18 5:36 ` [PATCH 0/6] Fixes and improvements in crypto unit tests Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240822071651.2403105-3-anoobj@marvell.com \
--to=anoobj@marvell.com \
--cc=asasidharan@marvell.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
--cc=hemant.agrawal@nxp.com \
--cc=jerinj@marvell.com \
--cc=ktejasree@marvell.com \
--cc=vvelumuri@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).