From: Vidya Sagar Velumuri <[email protected]>

Add unit test to verify the multi segment support in RX Inject

Signed-off-by: Vidya Sagar Velumuri <[email protected]>
---
 app/test/test_cryptodev.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index bd726ddcf9..a11bc00963 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -1564,7 +1564,8 @@ ut_setup_security_rx_inject(void)
        struct rte_eth_conf port_conf = {
                .rxmode = {
                        .offloads = RTE_ETH_RX_OFFLOAD_CHECKSUM |
-                                   RTE_ETH_RX_OFFLOAD_SECURITY,
+                                   RTE_ETH_RX_OFFLOAD_SECURITY |
+                                       RTE_ETH_RX_OFFLOAD_SCATTER,
                },
                .txmode = {
                        .offloads = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE,
@@ -10781,6 +10782,25 @@ test_ipsec_proto_known_vec_inb_rx_inject(const void 
*test_data)
        return test_ipsec_proto_process(&td_inb, NULL, 1, false, &flags);
 }
 
+static int
+test_ipsec_proto_known_vec_inb_rx_inject_multi_seg(const void *test_data)
+{
+       const struct ipsec_test_data *td = test_data;
+       struct ipsec_test_flags flags;
+       struct ipsec_test_data td_inb;
+
+       memset(&flags, 0, sizeof(flags));
+       flags.rx_inject = true;
+       flags.nb_segs_in_mbuf = 4;
+
+       if (td->ipsec_xform.direction == RTE_SECURITY_IPSEC_SA_DIR_EGRESS)
+               test_ipsec_td_in_from_out(td, &td_inb);
+       else
+               memcpy(&td_inb, td, sizeof(td_inb));
+
+       return test_ipsec_proto_process(&td_inb, NULL, 1, false, &flags);
+}
+
 static int
 test_ipsec_proto_all(const struct ipsec_test_flags *flags)
 {
@@ -18389,6 +18409,11 @@ static struct unit_test_suite ipsec_proto_testsuite  = 
{
                        "Inbound known vector (ESP tunnel mode IPv4 AES-GCM 
128) Rx inject",
                        ut_setup_security_rx_inject, ut_teardown_rx_inject,
                        test_ipsec_proto_known_vec_inb_rx_inject, 
&pkt_aes_128_gcm),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Inbound known vector (ESP tunnel mode IPv4 AES-GCM 
128) Rx inject multi seg",
+                       ut_setup_security_rx_inject, ut_teardown_rx_inject,
+                       test_ipsec_proto_known_vec_inb_rx_inject_multi_seg, 
&pkt_aes_128_gcm),
+
                TEST_CASES_END() /**< NULL terminate unit test array */
        }
 };
-- 
2.34.1

Reply via email to