replace zero-length arrays with flexible ones
[dpdk.git] / app / test / test_cryptodev.c
index 7c5d553..524019c 100644 (file)
@@ -8370,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;
@@ -8391,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) {
                /*
@@ -8483,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");