All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add new IPsec test cases
@ 2022-02-18 12:52 Volodymyr Fialko
  2022-02-18 12:52 ` [PATCH 1/2] test/crypto: add TTL and hop limit decrement cases Volodymyr Fialko
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Volodymyr Fialko @ 2022-02-18 12:52 UTC (permalink / raw)
  To: dev; +Cc: jerinj, Volodymyr Fialko

Following test cases were added:
- IPv4 TTL
- IPv6 hop limit
- IPv4 L4 checksum in transport mode

Volodymyr Fialko (2):
  test/crypto: add TTL and hop limit decrement cases
  test/crypto: add L4 checksum case for transport mode

 app/test/test_cryptodev.c                | 44 ++++++++++++++++++++++++
 app/test/test_cryptodev_security_ipsec.c | 37 ++++++++++++++++++++
 app/test/test_cryptodev_security_ipsec.h |  1 +
 3 files changed, 82 insertions(+)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] test/crypto: add TTL and hop limit decrement cases
  2022-02-18 12:52 [PATCH 0/2] Add new IPsec test cases Volodymyr Fialko
@ 2022-02-18 12:52 ` Volodymyr Fialko
  2022-02-18 12:52 ` [PATCH 2/2] test/crypto: add L4 checksum case for transport mode Volodymyr Fialko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Volodymyr Fialko @ 2022-02-18 12:52 UTC (permalink / raw)
  To: dev, Akhil Goyal, Fan Zhang; +Cc: jerinj, Volodymyr Fialko, Anoob Joseph

Add test cases to verify TTL and hop limit decrement with lookaside
IPsec offload.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
---
 app/test/test_cryptodev.c                | 29 +++++++++++++++++++
 app/test/test_cryptodev_security_ipsec.c | 37 ++++++++++++++++++++++++
 app/test/test_cryptodev_security_ipsec.h |  1 +
 3 files changed, 67 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index a63c199964..f6c3cd2b7b 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -9811,6 +9811,27 @@ test_PDCP_PROTO_all(void)
 		return TEST_SUCCESS;
 }
 
+static int
+test_ipsec_proto_ipv4_ttl_decrement(const void *data __rte_unused)
+{
+	struct ipsec_test_flags flags = {
+		.dec_ttl_or_hop_limit = true
+	};
+
+	return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv6_hop_limit_decrement(const void *data __rte_unused)
+{
+	struct ipsec_test_flags flags = {
+		.ipv6 = true,
+		.dec_ttl_or_hop_limit = true
+	};
+
+	return test_ipsec_proto_all(&flags);
+}
+
 static int
 test_docsis_proto_uplink(const void *data)
 {
@@ -14808,6 +14829,14 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
 			"Tunnel header set DF 1 (inner 0)",
 			ut_setup_security, ut_teardown,
 			test_ipsec_proto_set_df_1_inner_0),
+		TEST_CASE_NAMED_ST(
+			"Tunnel header IPv4 decrement inner TTL",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_ipv4_ttl_decrement),
+		TEST_CASE_NAMED_ST(
+			"Tunnel header IPv6 decrement inner hop limit",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_ipv6_hop_limit_decrement),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c
index 229eadf5de..77e4ee84cb 100644
--- a/app/test/test_cryptodev_security_ipsec.c
+++ b/app/test/test_cryptodev_security_ipsec.c
@@ -432,6 +432,9 @@ test_ipsec_td_prepare(const struct crypto_param *param1,
 		if (flags->df == TEST_IPSEC_COPY_DF_INNER_0 ||
 		    flags->df == TEST_IPSEC_COPY_DF_INNER_1)
 			td->ipsec_xform.options.copy_df = 1;
+
+		if (flags->dec_ttl_or_hop_limit)
+			td->ipsec_xform.options.dec_ttl = 1;
 	}
 }
 
@@ -639,6 +642,32 @@ test_ipsec_l4_csum_verify(struct rte_mbuf *m)
 	return TEST_SUCCESS;
 }
 
+static int
+test_ipsec_ttl_or_hop_decrement_verify(void *received, void *expected)
+{
+	struct rte_ipv4_hdr *iph4_ex, *iph4_re;
+	struct rte_ipv6_hdr *iph6_ex, *iph6_re;
+
+	if (is_ipv4(received) && is_ipv4(expected)) {
+		iph4_ex = expected;
+		iph4_re = received;
+		iph4_ex->time_to_live -= 1;
+		if (iph4_re->time_to_live != iph4_ex->time_to_live)
+			return TEST_FAILED;
+	} else if (!is_ipv4(received) && !is_ipv4(expected)) {
+		iph6_ex = expected;
+		iph6_re = received;
+		iph6_ex->hop_limits -= 1;
+		if (iph6_re->hop_limits != iph6_ex->hop_limits)
+			return TEST_FAILED;
+	} else {
+		printf("IP header version miss match\n");
+		return TEST_FAILED;
+	}
+
+	return TEST_SUCCESS;
+}
+
 static int
 test_ipsec_td_verify(struct rte_mbuf *m, const struct ipsec_test_data *td,
 		     bool silent, const struct ipsec_test_flags *flags)
@@ -728,6 +757,14 @@ test_ipsec_td_verify(struct rte_mbuf *m, const struct ipsec_test_data *td,
 
 	memcpy(td_output_text, td->output_text.data + skip, len);
 
+	if ((td->ipsec_xform.direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS) &&
+				flags->dec_ttl_or_hop_limit) {
+		if (test_ipsec_ttl_or_hop_decrement_verify(output_text, td_output_text)) {
+			printf("Inner TTL/hop limit decrement test failed\n");
+			return TEST_FAILED;
+		}
+	}
+
 	if (test_ipsec_pkt_update(td_output_text, flags)) {
 		printf("Could not update expected vector");
 		return TEST_FAILED;
diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h
index 12a9b77c55..faf2928846 100644
--- a/app/test/test_cryptodev_security_ipsec.h
+++ b/app/test/test_cryptodev_security_ipsec.h
@@ -74,6 +74,7 @@ struct ipsec_test_flags {
 	bool fragment;
 	bool stats_success;
 	enum df_flags df;
+	bool dec_ttl_or_hop_limit;
 };
 
 struct crypto_param {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] test/crypto: add L4 checksum case for transport mode
  2022-02-18 12:52 [PATCH 0/2] Add new IPsec test cases Volodymyr Fialko
  2022-02-18 12:52 ` [PATCH 1/2] test/crypto: add TTL and hop limit decrement cases Volodymyr Fialko
@ 2022-02-18 12:52 ` Volodymyr Fialko
  2022-02-22 19:41 ` [EXT] [PATCH 0/2] Add new IPsec test cases Akhil Goyal
  2022-02-23 10:40 ` [PATCH v2 " Volodymyr Fialko
  3 siblings, 0 replies; 8+ messages in thread
From: Volodymyr Fialko @ 2022-02-18 12:52 UTC (permalink / raw)
  To: dev, Akhil Goyal, Fan Zhang; +Cc: jerinj, Volodymyr Fialko, Anoob Joseph

Added test case to verify L4 checksum offload in IPsec transport mode.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
---
 app/test/test_cryptodev.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index f6c3cd2b7b..2236736227 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -9697,6 +9697,17 @@ test_ipsec_proto_transport_v4(const void *data __rte_unused)
 	return test_ipsec_proto_all(&flags);
 }
 
+static int
+test_ipsec_proto_transport_l4_csum(const void *data __rte_unused)
+{
+	struct ipsec_test_flags flags = {
+		.l4_csum = true,
+		.transport = true,
+	};
+
+	return test_ipsec_proto_all(&flags);
+}
+
 static int
 test_ipsec_proto_stats(const void *data __rte_unused)
 {
@@ -14805,6 +14816,10 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
 			"Transport IPv4",
 			ut_setup_security, ut_teardown,
 			test_ipsec_proto_transport_v4),
+		TEST_CASE_NAMED_ST(
+			"Transport l4 checksum",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_transport_l4_csum),
 		TEST_CASE_NAMED_ST(
 			"Statistics: success",
 			ut_setup_security, ut_teardown,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [EXT] [PATCH 0/2] Add new IPsec test cases
  2022-02-18 12:52 [PATCH 0/2] Add new IPsec test cases Volodymyr Fialko
  2022-02-18 12:52 ` [PATCH 1/2] test/crypto: add TTL and hop limit decrement cases Volodymyr Fialko
  2022-02-18 12:52 ` [PATCH 2/2] test/crypto: add L4 checksum case for transport mode Volodymyr Fialko
@ 2022-02-22 19:41 ` Akhil Goyal
  2022-02-23 10:40 ` [PATCH v2 " Volodymyr Fialko
  3 siblings, 0 replies; 8+ messages in thread
From: Akhil Goyal @ 2022-02-22 19:41 UTC (permalink / raw)
  To: Volodymyr Fialko, dev; +Cc: Jerin Jacob Kollanukkaran, Volodymyr Fialko

Hi Volodymyr,

Could you please rebase this series to current TOT of dpdk-next-crypto?

> Following test cases were added:
> - IPv4 TTL
> - IPv6 hop limit
> - IPv4 L4 checksum in transport mode
> 
> Volodymyr Fialko (2):
>   test/crypto: add TTL and hop limit decrement cases
>   test/crypto: add L4 checksum case for transport mode
> 
>  app/test/test_cryptodev.c                | 44 ++++++++++++++++++++++++
>  app/test/test_cryptodev_security_ipsec.c | 37 ++++++++++++++++++++
>  app/test/test_cryptodev_security_ipsec.h |  1 +
>  3 files changed, 82 insertions(+)
> 
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 0/2] Add new IPsec test cases
  2022-02-18 12:52 [PATCH 0/2] Add new IPsec test cases Volodymyr Fialko
                   ` (2 preceding siblings ...)
  2022-02-22 19:41 ` [EXT] [PATCH 0/2] Add new IPsec test cases Akhil Goyal
@ 2022-02-23 10:40 ` Volodymyr Fialko
  2022-02-23 10:40   ` [PATCH v2 1/2] test/crypto: add TTL and hop limit decrement cases Volodymyr Fialko
  2022-02-23 10:40   ` [PATCH v2 2/2] test/crypto: add L4 checksum case for transport mode Volodymyr Fialko
  3 siblings, 2 replies; 8+ messages in thread
From: Volodymyr Fialko @ 2022-02-23 10:40 UTC (permalink / raw)
  To: dev; +Cc: jerinj, Volodymyr Fialko

Following test cases were added:
- IPv4 TTL
- IPv6 hop limit
- IPv4 L4 checksum in transport mode

v2:
- rebase to the latest for-main

Volodymyr Fialko (2):
  test/crypto: add TTL and hop limit decrement cases
  test/crypto: add L4 checksum case for transport mode

 app/test/test_cryptodev.c                | 44 ++++++++++++++++++++++++
 app/test/test_cryptodev_security_ipsec.c | 37 ++++++++++++++++++++
 app/test/test_cryptodev_security_ipsec.h |  1 +
 3 files changed, 82 insertions(+)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] test/crypto: add TTL and hop limit decrement cases
  2022-02-23 10:40 ` [PATCH v2 " Volodymyr Fialko
@ 2022-02-23 10:40   ` Volodymyr Fialko
  2022-02-23 10:48     ` Akhil Goyal
  2022-02-23 10:40   ` [PATCH v2 2/2] test/crypto: add L4 checksum case for transport mode Volodymyr Fialko
  1 sibling, 1 reply; 8+ messages in thread
From: Volodymyr Fialko @ 2022-02-23 10:40 UTC (permalink / raw)
  To: dev, Akhil Goyal, Fan Zhang; +Cc: jerinj, Volodymyr Fialko, Anoob Joseph

Add test cases to verify TTL and hop limit decrement with lookaside
IPsec offload.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
---
 app/test/test_cryptodev.c                | 29 +++++++++++++++++++
 app/test/test_cryptodev_security_ipsec.c | 37 ++++++++++++++++++++++++
 app/test/test_cryptodev_security_ipsec.h |  1 +
 3 files changed, 67 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index fc3c09d86f..694b073f4f 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -10102,6 +10102,27 @@ test_PDCP_PROTO_all(void)
 		return TEST_SUCCESS;
 }
 
+static int
+test_ipsec_proto_ipv4_ttl_decrement(const void *data __rte_unused)
+{
+	struct ipsec_test_flags flags = {
+		.dec_ttl_or_hop_limit = true
+	};
+
+	return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv6_hop_limit_decrement(const void *data __rte_unused)
+{
+	struct ipsec_test_flags flags = {
+		.ipv6 = true,
+		.dec_ttl_or_hop_limit = true
+	};
+
+	return test_ipsec_proto_all(&flags);
+}
+
 static int
 test_docsis_proto_uplink(const void *data)
 {
@@ -15158,6 +15179,14 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
 			ut_setup_security, ut_teardown,
 			test_ipsec_proto_pkt_esn_antireplay4096,
 			&pkt_aes_128_gcm),
+		TEST_CASE_NAMED_ST(
+			"Tunnel header IPv4 decrement inner TTL",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_ipv4_ttl_decrement),
+		TEST_CASE_NAMED_ST(
+			"Tunnel header IPv6 decrement inner hop limit",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_ipv6_hop_limit_decrement),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c
index 3887b05135..f66360f4c4 100644
--- a/app/test/test_cryptodev_security_ipsec.c
+++ b/app/test/test_cryptodev_security_ipsec.c
@@ -443,6 +443,9 @@ test_ipsec_td_prepare(const struct crypto_param *param1,
 		if (flags->dscp == TEST_IPSEC_COPY_DSCP_INNER_0 ||
 		    flags->dscp == TEST_IPSEC_COPY_DSCP_INNER_1)
 			td->ipsec_xform.options.copy_dscp = 1;
+
+		if (flags->dec_ttl_or_hop_limit)
+			td->ipsec_xform.options.dec_ttl = 1;
 	}
 }
 
@@ -650,6 +653,32 @@ test_ipsec_l4_csum_verify(struct rte_mbuf *m)
 	return TEST_SUCCESS;
 }
 
+static int
+test_ipsec_ttl_or_hop_decrement_verify(void *received, void *expected)
+{
+	struct rte_ipv4_hdr *iph4_ex, *iph4_re;
+	struct rte_ipv6_hdr *iph6_ex, *iph6_re;
+
+	if (is_ipv4(received) && is_ipv4(expected)) {
+		iph4_ex = expected;
+		iph4_re = received;
+		iph4_ex->time_to_live -= 1;
+		if (iph4_re->time_to_live != iph4_ex->time_to_live)
+			return TEST_FAILED;
+	} else if (!is_ipv4(received) && !is_ipv4(expected)) {
+		iph6_ex = expected;
+		iph6_re = received;
+		iph6_ex->hop_limits -= 1;
+		if (iph6_re->hop_limits != iph6_ex->hop_limits)
+			return TEST_FAILED;
+	} else {
+		printf("IP header version miss match\n");
+		return TEST_FAILED;
+	}
+
+	return TEST_SUCCESS;
+}
+
 static int
 test_ipsec_td_verify(struct rte_mbuf *m, const struct ipsec_test_data *td,
 		     bool silent, const struct ipsec_test_flags *flags)
@@ -740,6 +769,14 @@ test_ipsec_td_verify(struct rte_mbuf *m, const struct ipsec_test_data *td,
 
 	memcpy(td_output_text, td->output_text.data + skip, len);
 
+	if ((td->ipsec_xform.direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS) &&
+				flags->dec_ttl_or_hop_limit) {
+		if (test_ipsec_ttl_or_hop_decrement_verify(output_text, td_output_text)) {
+			printf("Inner TTL/hop limit decrement test failed\n");
+			return TEST_FAILED;
+		}
+	}
+
 	if (test_ipsec_pkt_update(td_output_text, flags)) {
 		printf("Could not update expected vector");
 		return TEST_FAILED;
diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h
index a15c1d3015..7529d2ae50 100644
--- a/app/test/test_cryptodev_security_ipsec.h
+++ b/app/test/test_cryptodev_security_ipsec.h
@@ -87,6 +87,7 @@ struct ipsec_test_flags {
 	bool antireplay;
 	enum df_flags df;
 	enum dscp_flags dscp;
+	bool dec_ttl_or_hop_limit;
 };
 
 struct crypto_param {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] test/crypto: add L4 checksum case for transport mode
  2022-02-23 10:40 ` [PATCH v2 " Volodymyr Fialko
  2022-02-23 10:40   ` [PATCH v2 1/2] test/crypto: add TTL and hop limit decrement cases Volodymyr Fialko
@ 2022-02-23 10:40   ` Volodymyr Fialko
  1 sibling, 0 replies; 8+ messages in thread
From: Volodymyr Fialko @ 2022-02-23 10:40 UTC (permalink / raw)
  To: dev, Akhil Goyal, Fan Zhang; +Cc: jerinj, Volodymyr Fialko, Anoob Joseph

Added test case to verify L4 checksum offload in IPsec transport mode.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
---
 app/test/test_cryptodev.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 694b073f4f..a0c8926776 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -9724,6 +9724,17 @@ test_ipsec_proto_transport_v4(const void *data __rte_unused)
 	return test_ipsec_proto_all(&flags);
 }
 
+static int
+test_ipsec_proto_transport_l4_csum(const void *data __rte_unused)
+{
+	struct ipsec_test_flags flags = {
+		.l4_csum = true,
+		.transport = true,
+	};
+
+	return test_ipsec_proto_all(&flags);
+}
+
 static int
 test_ipsec_proto_stats(const void *data __rte_unused)
 {
@@ -15096,6 +15107,10 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
 			"Transport IPv4",
 			ut_setup_security, ut_teardown,
 			test_ipsec_proto_transport_v4),
+		TEST_CASE_NAMED_ST(
+			"Transport l4 checksum",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_transport_l4_csum),
 		TEST_CASE_NAMED_ST(
 			"Statistics: success",
 			ut_setup_security, ut_teardown,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH v2 1/2] test/crypto: add TTL and hop limit decrement cases
  2022-02-23 10:40   ` [PATCH v2 1/2] test/crypto: add TTL and hop limit decrement cases Volodymyr Fialko
@ 2022-02-23 10:48     ` Akhil Goyal
  0 siblings, 0 replies; 8+ messages in thread
From: Akhil Goyal @ 2022-02-23 10:48 UTC (permalink / raw)
  To: Volodymyr Fialko, dev, Fan Zhang
  Cc: Jerin Jacob Kollanukkaran, Volodymyr Fialko, Anoob Joseph

> Add test cases to verify TTL and hop limit decrement with lookaside
> IPsec offload.
> 
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
> Acked-by: Anoob Joseph <anoobj@marvell.com>
Series Applied to dpdk-next-crypto

Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-23 10:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 12:52 [PATCH 0/2] Add new IPsec test cases Volodymyr Fialko
2022-02-18 12:52 ` [PATCH 1/2] test/crypto: add TTL and hop limit decrement cases Volodymyr Fialko
2022-02-18 12:52 ` [PATCH 2/2] test/crypto: add L4 checksum case for transport mode Volodymyr Fialko
2022-02-22 19:41 ` [EXT] [PATCH 0/2] Add new IPsec test cases Akhil Goyal
2022-02-23 10:40 ` [PATCH v2 " Volodymyr Fialko
2022-02-23 10:40   ` [PATCH v2 1/2] test/crypto: add TTL and hop limit decrement cases Volodymyr Fialko
2022-02-23 10:48     ` Akhil Goyal
2022-02-23 10:40   ` [PATCH v2 2/2] test/crypto: add L4 checksum case for transport mode Volodymyr Fialko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.