app/testpmd: fix metering and policing command for RFC4115
[dpdk.git] / app / test / test_cryptodev.c
index 2adec1d..524019c 100644 (file)
@@ -3,6 +3,8 @@
  * Copyright 2020 NXP
  */
 
+#ifndef RTE_EXEC_ENV_WINDOWS
+
 #include <time.h>
 
 #include <rte_common.h>
@@ -209,6 +211,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
        int enqueue_status, dequeue_status;
        struct crypto_unittest_params *ut_params = &unittest_params;
        int is_sgl = sop->m_src->nb_segs > 1;
+       int is_oop = 0;
 
        ctx_service_size = rte_cryptodev_get_raw_dp_ctx_size(dev_id);
        if (ctx_service_size < 0) {
@@ -247,6 +250,9 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
 
        ofs.raw = 0;
 
+       if ((sop->m_dst != NULL) && (sop->m_dst != sop->m_src))
+               is_oop = 1;
+
        if (is_cipher && is_auth) {
                cipher_offset = sop->cipher.data.offset;
                cipher_len = sop->cipher.data.length;
@@ -277,6 +283,8 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
                if (is_sgl) {
                        uint32_t remaining_off = auth_offset + auth_len;
                        struct rte_mbuf *sgl_buf = sop->m_src;
+                       if (is_oop)
+                               sgl_buf = sop->m_dst;
 
                        while (remaining_off >= rte_pktmbuf_data_len(sgl_buf)
                                        && sgl_buf->next != NULL) {
@@ -293,7 +301,8 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
                /* Then check if digest-encrypted conditions are met */
                if ((auth_offset + auth_len < cipher_offset + cipher_len) &&
                                (digest.iova == auth_end_iova) && is_sgl)
-                       max_len = RTE_MAX(max_len, auth_offset + auth_len +
+                       max_len = RTE_MAX(max_len,
+                               auth_offset + auth_len +
                                ut_params->auth_xform.auth.digest_length);
 
        } else if (is_cipher) {
@@ -356,7 +365,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
 
        sgl.num = n;
        /* Out of place */
-       if (sop->m_dst != NULL) {
+       if (is_oop) {
                dest_sgl.vec = dest_data_vec;
                vec.dest_sgl = &dest_sgl;
                n = rte_crypto_mbuf_to_vec(sop->m_dst, 0, max_len,
@@ -836,6 +845,7 @@ ipsec_proto_testsuite_setup(void)
        }
 
        test_ipsec_alg_list_populate();
+       test_ipsec_ah_alg_list_populate();
 
        /*
         * Stop the device. Device would be started again by individual test
@@ -6228,8 +6238,8 @@ test_zuc_authentication(const struct wireless_test_data *tdata)
        else
                ut_params->op = process_crypto_request(ts_params->valid_devs[0],
                                ut_params->op);
-       ut_params->obuf = ut_params->op->sym->m_src;
        TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
+       ut_params->obuf = ut_params->op->sym->m_src;
        ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
                        + plaintext_pad_len;
 
@@ -8360,6 +8370,11 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
        struct rte_security_ctx *ctx = (struct rte_security_ctx *)
                                rte_cryptodev_get_sec_ctx(
                                ts_params->valid_devs[0]);
+       struct rte_cryptodev_info dev_info;
+       uint64_t feat_flags;
+
+       rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
+       feat_flags = dev_info.feature_flags;
 
        /* Verify the capabilities */
        struct rte_security_capability_idx sec_cap_idx;
@@ -8381,6 +8396,11 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
                                                  input_vec_len);
        memcpy(plaintext, input_vec, input_vec_len);
 
+       if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) &&
+                       (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) {
+               printf("Device does not support RAW data-path APIs.\n");
+               return TEST_SKIPPED;
+       }
        /* Out of place support */
        if (oop) {
                /*
@@ -8473,8 +8493,16 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
                ut_params->op->sym->m_dst = ut_params->obuf;
 
        /* Process crypto operation */
-       if (process_crypto_request(ts_params->valid_devs[0], ut_params->op)
-               == NULL) {
+       if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+               /* filling lengths */
+               ut_params->op->sym->cipher.data.length = ut_params->op->sym->m_src->pkt_len;
+               ut_params->op->sym->auth.data.length = ut_params->op->sym->m_src->pkt_len;
+               process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
+                       ut_params->op, 1, 1, 0, 0);
+       } else {
+               ut_params->op = process_crypto_request(ts_params->valid_devs[0], ut_params->op);
+       }
+       if (ut_params->op == NULL) {
                printf("TestCase %s()-%d line %d failed %s: ",
                        __func__, i, __LINE__,
                        "failed to process sym crypto op");
@@ -9129,6 +9157,8 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
                                0x0000, 0x001a};
        uint16_t v6_dst[8] = {0x2001, 0x0470, 0xe5bf, 0xdead, 0x4957, 0x2174,
                                0xe82c, 0x4887};
+       const struct rte_ipv4_hdr *ipv4 =
+                       (const struct rte_ipv4_hdr *)td[0].output_text.data;
        struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct crypto_unittest_params *ut_params = &unittest_params;
        struct rte_security_capability_idx sec_cap_idx;
@@ -9137,11 +9167,10 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
        uint8_t dev_id = ts_params->valid_devs[0];
        enum rte_security_ipsec_sa_direction dir;
        struct ipsec_test_data *res_d_tmp = NULL;
-       uint32_t src = RTE_IPV4(192, 168, 1, 0);
-       uint32_t dst = RTE_IPV4(192, 168, 1, 1);
        int salt_len, i, ret = TEST_SUCCESS;
        struct rte_security_ctx *ctx;
        uint8_t *input_text;
+       uint32_t src, dst;
        uint32_t verify;
 
        ut_params->type = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL;
@@ -9155,6 +9184,9 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
        dir = ipsec_xform.direction;
        verify = flags->tunnel_hdr_verify;
 
+       memcpy(&src, &ipv4->src_addr, sizeof(ipv4->src_addr));
+       memcpy(&dst, &ipv4->dst_addr, sizeof(ipv4->dst_addr));
+
        if ((dir == RTE_SECURITY_IPSEC_SA_DIR_INGRESS) && verify) {
                if (verify == RTE_SECURITY_IPSEC_TUNNEL_VERIFY_SRC_DST_ADDR)
                        src += 1;
@@ -9169,7 +9201,28 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
                               sizeof(src));
                        memcpy(&ipsec_xform.tunnel.ipv4.dst_ip, &dst,
                               sizeof(dst));
+
+                       if (flags->df == TEST_IPSEC_SET_DF_0_INNER_1)
+                               ipsec_xform.tunnel.ipv4.df = 0;
+
+                       if (flags->df == TEST_IPSEC_SET_DF_1_INNER_0)
+                               ipsec_xform.tunnel.ipv4.df = 1;
+
+                       if (flags->dscp == TEST_IPSEC_SET_DSCP_0_INNER_1)
+                               ipsec_xform.tunnel.ipv4.dscp = 0;
+
+                       if (flags->dscp == TEST_IPSEC_SET_DSCP_1_INNER_0)
+                               ipsec_xform.tunnel.ipv4.dscp =
+                                               TEST_IPSEC_DSCP_VAL;
+
                } else {
+                       if (flags->dscp == TEST_IPSEC_SET_DSCP_0_INNER_1)
+                               ipsec_xform.tunnel.ipv6.dscp = 0;
+
+                       if (flags->dscp == TEST_IPSEC_SET_DSCP_1_INNER_0)
+                               ipsec_xform.tunnel.ipv6.dscp =
+                                               TEST_IPSEC_DSCP_VAL;
+
                        memcpy(&ipsec_xform.tunnel.ipv6.src_addr, &v6_src,
                               sizeof(v6_src));
                        memcpy(&ipsec_xform.tunnel.ipv6.dst_addr, &v6_dst,
@@ -9208,6 +9261,19 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
                                        "Crypto capabilities not supported\n");
                        return TEST_SKIPPED;
                }
+       } else if (td[0].auth_only) {
+               memcpy(&ut_params->auth_xform, &td[0].xform.chain.auth,
+                      sizeof(ut_params->auth_xform));
+               ut_params->auth_xform.auth.key.data = td[0].auth_key.data;
+
+               if (test_ipsec_crypto_caps_auth_verify(
+                               sec_cap,
+                               &ut_params->auth_xform) != 0) {
+                       if (!silent)
+                               RTE_LOG(INFO, USER1,
+                                       "Auth crypto capabilities not supported\n");
+                       return TEST_SKIPPED;
+               }
        } else {
                memcpy(&ut_params->cipher_xform, &td[0].xform.chain.cipher,
                       sizeof(ut_params->cipher_xform));
@@ -9246,11 +9312,17 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
                .protocol = RTE_SECURITY_PROTOCOL_IPSEC,
        };
 
-       if (td[0].aead) {
+       if (td[0].aead || td[0].aes_gmac) {
                salt_len = RTE_MIN(sizeof(ipsec_xform.salt), td[0].salt.len);
                memcpy(&ipsec_xform.salt, td[0].salt.data, salt_len);
+       }
+
+       if (td[0].aead) {
                sess_conf.ipsec = ipsec_xform;
                sess_conf.crypto_xform = &ut_params->aead_xform;
+       } else if (td[0].auth_only) {
+               sess_conf.ipsec = ipsec_xform;
+               sess_conf.crypto_xform = &ut_params->auth_xform;
        } else {
                sess_conf.ipsec = ipsec_xform;
                if (dir == RTE_SECURITY_IPSEC_SA_DIR_EGRESS) {
@@ -9271,6 +9343,18 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
                return TEST_SKIPPED;
 
        for (i = 0; i < nb_td; i++) {
+               if (flags->antireplay &&
+                   (dir == RTE_SECURITY_IPSEC_SA_DIR_EGRESS)) {
+                       sess_conf.ipsec.esn.value = td[i].ipsec_xform.esn.value;
+                       ret = rte_security_session_update(ctx,
+                               ut_params->sec_session, &sess_conf);
+                       if (ret) {
+                               printf("Could not update sequence number in "
+                                      "session\n");
+                               return TEST_SKIPPED;
+                       }
+               }
+
                /* Setup source mbuf payload */
                ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
                memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
@@ -9282,6 +9366,9 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
                memcpy(input_text, td[i].input_text.data,
                       td[i].input_text.len);
 
+               if (test_ipsec_pkt_update(input_text, flags))
+                       return TEST_FAILED;
+
                /* Generate crypto op data structure */
                ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
                                        RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -9311,6 +9398,8 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
 
                        if (td[i].aead)
                                len = td[i].xform.aead.aead.iv.length;
+                       else if (td[i].aes_gmac)
+                               len = td[i].xform.chain.auth.auth.iv.length;
                        else
                                len = td[i].xform.chain.cipher.cipher.iv.length;
 
@@ -9320,7 +9409,8 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
                /* Process crypto operation */
                process_crypto_request(dev_id, ut_params->op);
 
-               ret = test_ipsec_status_check(ut_params->op, flags, dir, i + 1);
+               ret = test_ipsec_status_check(&td[i], ut_params->op, flags, dir,
+                                             i + 1);
                if (ret != TEST_SUCCESS)
                        goto crypto_op_free;
 
@@ -9332,6 +9422,11 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],
                if (ret != TEST_SUCCESS)
                        goto crypto_op_free;
 
+               ret = test_ipsec_stats_verify(ctx, ut_params->sec_session,
+                                             flags, dir);
+               if (ret != TEST_SUCCESS)
+                       goto crypto_op_free;
+
                rte_crypto_op_free(ut_params->op);
                ut_params->op = NULL;
 
@@ -9363,8 +9458,12 @@ test_ipsec_proto_known_vec(const void *test_data)
 
        memcpy(&td_outb, test_data, sizeof(td_outb));
 
-       /* Disable IV gen to be able to test with known vectors */
-       td_outb.ipsec_xform.options.iv_gen_disable = 1;
+       if (td_outb.aes_gmac || td_outb.aead ||
+           ((td_outb.ipsec_xform.proto != RTE_SECURITY_IPSEC_SA_PROTO_AH) &&
+            (td_outb.xform.chain.cipher.cipher.algo != RTE_CRYPTO_CIPHER_NULL))) {
+               /* Disable IV gen to be able to test with known vectors */
+               td_outb.ipsec_xform.options.iv_gen_disable = 1;
+       }
 
        return test_ipsec_proto_process(&td_outb, NULL, 1, false, &flags);
 }
@@ -9423,6 +9522,27 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags)
                                      td_outb,
                                      nb_pkts);
 
+               if (!td_outb->aead) {
+                       enum rte_crypto_cipher_algorithm cipher_alg;
+                       enum rte_crypto_auth_algorithm auth_alg;
+
+                       cipher_alg = td_outb->xform.chain.cipher.cipher.algo;
+                       auth_alg = td_outb->xform.chain.auth.auth.algo;
+
+                       if (td_outb->aes_gmac && cipher_alg != RTE_CRYPTO_CIPHER_NULL)
+                               continue;
+
+                       /* ICV is not applicable for NULL auth */
+                       if (flags->icv_corrupt &&
+                           auth_alg == RTE_CRYPTO_AUTH_NULL)
+                               continue;
+
+                       /* IV is not applicable for NULL cipher */
+                       if (flags->iv_gen &&
+                           cipher_alg == RTE_CRYPTO_CIPHER_NULL)
+                               continue;
+               }
+
                ret = test_ipsec_proto_process(td_outb, td_inb, nb_pkts, true,
                                               flags);
                if (ret == TEST_SKIPPED)
@@ -9454,6 +9574,52 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags)
                return TEST_SKIPPED;
 }
 
+static int
+test_ipsec_ah_proto_all(const struct ipsec_test_flags *flags)
+{
+       struct ipsec_test_data td_outb[IPSEC_TEST_PACKETS_MAX];
+       struct ipsec_test_data td_inb[IPSEC_TEST_PACKETS_MAX];
+       unsigned int i, nb_pkts = 1, pass_cnt = 0;
+       int ret;
+
+       for (i = 0; i < RTE_DIM(ah_alg_list); i++) {
+               test_ipsec_td_prepare(ah_alg_list[i].param1,
+                                     ah_alg_list[i].param2,
+                                     flags,
+                                     td_outb,
+                                     nb_pkts);
+
+               ret = test_ipsec_proto_process(td_outb, td_inb, nb_pkts, true,
+                                              flags);
+               if (ret == TEST_SKIPPED)
+                       continue;
+
+               if (ret == TEST_FAILED)
+                       return TEST_FAILED;
+
+               test_ipsec_td_update(td_inb, td_outb, nb_pkts, flags);
+
+               ret = test_ipsec_proto_process(td_inb, NULL, nb_pkts, true,
+                                              flags);
+               if (ret == TEST_SKIPPED)
+                       continue;
+
+               if (ret == TEST_FAILED)
+                       return TEST_FAILED;
+
+               if (flags->display_alg)
+                       test_ipsec_display_alg(ah_alg_list[i].param1,
+                                              ah_alg_list[i].param2);
+
+               pass_cnt++;
+       }
+
+       if (pass_cnt > 0)
+               return TEST_SUCCESS;
+       else
+               return TEST_SKIPPED;
+}
+
 static int
 test_ipsec_proto_display_list(const void *data __rte_unused)
 {
@@ -9466,6 +9632,32 @@ test_ipsec_proto_display_list(const void *data __rte_unused)
        return test_ipsec_proto_all(&flags);
 }
 
+static int
+test_ipsec_proto_ah_tunnel_ipv4(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.ah = true;
+       flags.display_alg = true;
+
+       return test_ipsec_ah_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ah_transport_ipv4(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.ah = true;
+       flags.transport = true;
+
+       return test_ipsec_ah_proto_all(&flags);
+}
+
 static int
 test_ipsec_proto_iv_gen(const void *data __rte_unused)
 {
@@ -9652,6 +9844,354 @@ 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)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.stats_success = true;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_pkt_fragment(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.fragment = true;
+
+       return test_ipsec_proto_all(&flags);
+
+}
+
+static int
+test_ipsec_proto_copy_df_inner_0(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.df = TEST_IPSEC_COPY_DF_INNER_0;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_copy_df_inner_1(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.df = TEST_IPSEC_COPY_DF_INNER_1;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_set_df_0_inner_1(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.df = TEST_IPSEC_SET_DF_0_INNER_1;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_set_df_1_inner_0(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.df = TEST_IPSEC_SET_DF_1_INNER_0;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv4_copy_dscp_inner_0(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.dscp = TEST_IPSEC_COPY_DSCP_INNER_0;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv4_copy_dscp_inner_1(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.dscp = TEST_IPSEC_COPY_DSCP_INNER_1;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv4_set_dscp_0_inner_1(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_CN9K_PMD)))
+               return TEST_SKIPPED;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.dscp = TEST_IPSEC_SET_DSCP_0_INNER_1;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv4_set_dscp_1_inner_0(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_CN9K_PMD)))
+               return TEST_SKIPPED;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.dscp = TEST_IPSEC_SET_DSCP_1_INNER_0;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv6_copy_dscp_inner_0(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.ipv6 = true;
+       flags.tunnel_ipv6 = true;
+       flags.dscp = TEST_IPSEC_COPY_DSCP_INNER_0;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv6_copy_dscp_inner_1(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.ipv6 = true;
+       flags.tunnel_ipv6 = true;
+       flags.dscp = TEST_IPSEC_COPY_DSCP_INNER_1;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv6_set_dscp_0_inner_1(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_CN9K_PMD)))
+               return TEST_SKIPPED;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.ipv6 = true;
+       flags.tunnel_ipv6 = true;
+       flags.dscp = TEST_IPSEC_SET_DSCP_0_INNER_1;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_proto_ipv6_set_dscp_1_inner_0(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       if (gbl_driver_id == rte_cryptodev_driver_id_get(
+                       RTE_STR(CRYPTODEV_NAME_CN9K_PMD)))
+               return TEST_SKIPPED;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.ipv6 = true;
+       flags.tunnel_ipv6 = true;
+       flags.dscp = TEST_IPSEC_SET_DSCP_1_INNER_0;
+
+       return test_ipsec_proto_all(&flags);
+}
+
+static int
+test_ipsec_pkt_replay(const void *test_data, const uint64_t esn[],
+                     bool replayed_pkt[], uint32_t nb_pkts, bool esn_en,
+                     uint64_t winsz)
+{
+       struct ipsec_test_data td_outb[IPSEC_TEST_PACKETS_MAX];
+       struct ipsec_test_data td_inb[IPSEC_TEST_PACKETS_MAX];
+       struct ipsec_test_flags flags;
+       uint32_t i = 0, ret = 0;
+
+       memset(&flags, 0, sizeof(flags));
+       flags.antireplay = true;
+
+       for (i = 0; i < nb_pkts; i++) {
+               memcpy(&td_outb[i], test_data, sizeof(td_outb[i]));
+               td_outb[i].ipsec_xform.options.iv_gen_disable = 1;
+               td_outb[i].ipsec_xform.replay_win_sz = winsz;
+               td_outb[i].ipsec_xform.options.esn = esn_en;
+       }
+
+       for (i = 0; i < nb_pkts; i++)
+               td_outb[i].ipsec_xform.esn.value = esn[i];
+
+       ret = test_ipsec_proto_process(td_outb, td_inb, nb_pkts, true,
+                                      &flags);
+       if (ret != TEST_SUCCESS)
+               return ret;
+
+       test_ipsec_td_update(td_inb, td_outb, nb_pkts, &flags);
+
+       for (i = 0; i < nb_pkts; i++) {
+               td_inb[i].ipsec_xform.options.esn = esn_en;
+               /* Set antireplay flag for packets to be dropped */
+               td_inb[i].ar_packet = replayed_pkt[i];
+       }
+
+       ret = test_ipsec_proto_process(td_inb, NULL, nb_pkts, true,
+                                      &flags);
+
+       return ret;
+}
+
+static int
+test_ipsec_proto_pkt_antireplay(const void *test_data, uint64_t winsz)
+{
+
+       uint32_t nb_pkts = 5;
+       bool replayed_pkt[5];
+       uint64_t esn[5];
+
+       /* 1. Advance the TOP of the window to WS * 2 */
+       esn[0] = winsz * 2;
+       /* 2. Test sequence number within the new window(WS + 1) */
+       esn[1] = winsz + 1;
+       /* 3. Test sequence number less than the window BOTTOM */
+       esn[2] = winsz;
+       /* 4. Test sequence number in the middle of the window */
+       esn[3] = winsz + (winsz / 2);
+       /* 5. Test replay of the packet in the middle of the window */
+       esn[4] = winsz + (winsz / 2);
+
+       replayed_pkt[0] = false;
+       replayed_pkt[1] = false;
+       replayed_pkt[2] = true;
+       replayed_pkt[3] = false;
+       replayed_pkt[4] = true;
+
+       return test_ipsec_pkt_replay(test_data, esn, replayed_pkt, nb_pkts,
+                                    false, winsz);
+}
+
+static int
+test_ipsec_proto_pkt_antireplay1024(const void *test_data)
+{
+       return test_ipsec_proto_pkt_antireplay(test_data, 1024);
+}
+
+static int
+test_ipsec_proto_pkt_antireplay2048(const void *test_data)
+{
+       return test_ipsec_proto_pkt_antireplay(test_data, 2048);
+}
+
+static int
+test_ipsec_proto_pkt_antireplay4096(const void *test_data)
+{
+       return test_ipsec_proto_pkt_antireplay(test_data, 4096);
+}
+
+static int
+test_ipsec_proto_pkt_esn_antireplay(const void *test_data, uint64_t winsz)
+{
+
+       uint32_t nb_pkts = 7;
+       bool replayed_pkt[7];
+       uint64_t esn[7];
+
+       /* Set the initial sequence number */
+       esn[0] = (uint64_t)(0xFFFFFFFF - winsz);
+       /* 1. Advance the TOP of the window to (1<<32 + WS/2) */
+       esn[1] = (uint64_t)((1ULL << 32) + (winsz / 2));
+       /* 2. Test sequence number within new window (1<<32 + WS/2 + 1) */
+       esn[2] = (uint64_t)((1ULL << 32) - (winsz / 2) + 1);
+       /* 3. Test with sequence number within window (1<<32 - 1) */
+       esn[3] = (uint64_t)((1ULL << 32) - 1);
+       /* 4. Test with sequence number within window (1<<32 - 1) */
+       esn[4] = (uint64_t)(1ULL << 32);
+       /* 5. Test with duplicate sequence number within
+        * new window (1<<32 - 1)
+        */
+       esn[5] = (uint64_t)((1ULL << 32) - 1);
+       /* 6. Test with duplicate sequence number within new window (1<<32) */
+       esn[6] = (uint64_t)(1ULL << 32);
+
+       replayed_pkt[0] = false;
+       replayed_pkt[1] = false;
+       replayed_pkt[2] = false;
+       replayed_pkt[3] = false;
+       replayed_pkt[4] = false;
+       replayed_pkt[5] = true;
+       replayed_pkt[6] = true;
+
+       return test_ipsec_pkt_replay(test_data, esn, replayed_pkt, nb_pkts,
+                                    true, winsz);
+}
+
+static int
+test_ipsec_proto_pkt_esn_antireplay1024(const void *test_data)
+{
+       return test_ipsec_proto_pkt_esn_antireplay(test_data, 1024);
+}
+
+static int
+test_ipsec_proto_pkt_esn_antireplay2048(const void *test_data)
+{
+       return test_ipsec_proto_pkt_esn_antireplay(test_data, 2048);
+}
+
+static int
+test_ipsec_proto_pkt_esn_antireplay4096(const void *test_data)
+{
+       return test_ipsec_proto_pkt_esn_antireplay(test_data, 4096);
+}
+
 static int
 test_PDCP_PROTO_all(void)
 {
@@ -9693,6 +10233,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)
 {
@@ -14547,6 +15108,26 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
                        ut_setup_security, ut_teardown,
                        test_ipsec_proto_known_vec,
                        &pkt_aes_128_cbc_hmac_sha256_v6),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Outbound known vector (ESP tunnel mode IPv4 NULL AES-XCBC-MAC [12B ICV])",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_known_vec,
+                       &pkt_null_aes_xcbc),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Outbound known vector (AH tunnel mode IPv4 HMAC-SHA256)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_known_vec,
+                       &pkt_ah_tunnel_sha256),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Outbound known vector (AH transport mode IPv4 HMAC-SHA256)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_known_vec,
+                       &pkt_ah_transport_sha256),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Outbound known vector (AH transport mode IPv4 AES-GMAC 128)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_known_vec,
+                       &pkt_ah_ipv4_aes_gmac_128),
                TEST_CASE_NAMED_WITH_DATA(
                        "Outbound fragmented packet",
                        ut_setup_security, ut_teardown,
@@ -14592,10 +15173,34 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
                        ut_setup_security, ut_teardown,
                        test_ipsec_proto_known_vec_inb,
                        &pkt_aes_128_cbc_hmac_sha256_v6),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Inbound known vector (ESP tunnel mode IPv4 NULL AES-XCBC-MAC [12B ICV])",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_known_vec_inb,
+                       &pkt_null_aes_xcbc),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Inbound known vector (AH tunnel mode IPv4 HMAC-SHA256)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_known_vec_inb,
+                       &pkt_ah_tunnel_sha256),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Inbound known vector (AH transport mode IPv4 HMAC-SHA256)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_known_vec_inb,
+                       &pkt_ah_transport_sha256),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Inbound known vector (AH transport mode IPv4 AES-GMAC 128)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_known_vec_inb,
+                       &pkt_ah_ipv4_aes_gmac_128),
                TEST_CASE_NAMED_ST(
                        "Combined test alg list",
                        ut_setup_security, ut_teardown,
                        test_ipsec_proto_display_list),
+               TEST_CASE_NAMED_ST(
+                       "Combined test alg list (AH)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ah_tunnel_ipv4),
                TEST_CASE_NAMED_ST(
                        "IV generation",
                        ut_setup_security, ut_teardown,
@@ -14656,6 +15261,105 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
                        "Transport IPv4",
                        ut_setup_security, ut_teardown,
                        test_ipsec_proto_transport_v4),
+               TEST_CASE_NAMED_ST(
+                       "AH transport IPv4",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ah_transport_ipv4),
+               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,
+                       test_ipsec_proto_stats),
+               TEST_CASE_NAMED_ST(
+                       "Fragmented packet",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_pkt_fragment),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header copy DF (inner 0)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_copy_df_inner_0),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header copy DF (inner 1)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_copy_df_inner_1),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header set DF 0 (inner 1)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_set_df_0_inner_1),
+               TEST_CASE_NAMED_ST(
+                       "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 copy DSCP (inner 0)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ipv4_copy_dscp_inner_0),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header IPv4 copy DSCP (inner 1)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ipv4_copy_dscp_inner_1),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header IPv4 set DSCP 0 (inner 1)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ipv4_set_dscp_0_inner_1),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header IPv4 set DSCP 1 (inner 0)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ipv4_set_dscp_1_inner_0),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header IPv6 copy DSCP (inner 0)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ipv6_copy_dscp_inner_0),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header IPv6 copy DSCP (inner 1)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ipv6_copy_dscp_inner_1),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header IPv6 set DSCP 0 (inner 1)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ipv6_set_dscp_0_inner_1),
+               TEST_CASE_NAMED_ST(
+                       "Tunnel header IPv6 set DSCP 1 (inner 0)",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_ipv6_set_dscp_1_inner_0),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Antireplay with window size 1024",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_pkt_antireplay1024, &pkt_aes_128_gcm),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Antireplay with window size 2048",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_pkt_antireplay2048, &pkt_aes_128_gcm),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Antireplay with window size 4096",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_pkt_antireplay4096, &pkt_aes_128_gcm),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "ESN and Antireplay with window size 1024",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_pkt_esn_antireplay1024,
+                       &pkt_aes_128_gcm),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "ESN and Antireplay with window size 2048",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_pkt_esn_antireplay2048,
+                       &pkt_aes_128_gcm),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "ESN and Antireplay with window size 4096",
+                       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 */
        }
 };
@@ -15902,7 +16606,7 @@ test_cryptodev_dpaa2_sec_raw_api(void)
 static int
 test_cryptodev_dpaa_sec_raw_api(void)
 {
-       static const char *pmd_name = RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD);
+       static const char *pmd_name = RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD);
        int ret;
 
        ret = require_feature_flag(pmd_name, RTE_CRYPTODEV_FF_SYM_RAW_DP,
@@ -15950,3 +16654,5 @@ REGISTER_TEST_COMMAND(cryptodev_nitrox_autotest, test_cryptodev_nitrox);
 REGISTER_TEST_COMMAND(cryptodev_bcmfs_autotest, test_cryptodev_bcmfs);
 REGISTER_TEST_COMMAND(cryptodev_cn9k_autotest, test_cryptodev_cn9k);
 REGISTER_TEST_COMMAND(cryptodev_cn10k_autotest, test_cryptodev_cn10k);
+
+#endif /* !RTE_EXEC_ENV_WINDOWS */