devtools: recommend new logtype helpers
[dpdk.git] / app / test-crypto-perf / cperf_ops.c
index e06b59f..0d7baf2 100644 (file)
@@ -8,7 +8,7 @@
 #include "cperf_ops.h"
 #include "cperf_test_vectors.h"
 
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
 static int
 cperf_set_ops_security(struct rte_crypto_op **ops,
                uint32_t src_buf_offset __rte_unused,
@@ -26,6 +26,10 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
                        (struct rte_security_session *)sess;
                uint32_t buf_sz;
 
+               uint32_t *per_pkt_hfn = rte_crypto_op_ctod_offset(ops[i],
+                                       uint32_t *, iv_offset);
+               *per_pkt_hfn = options->pdcp_ses_hfn_en ? 0 : PDCP_DEFAULT_HFN;
+
                ops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
                rte_security_attach_session(ops[i], sec_sess);
                sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +
@@ -44,6 +48,10 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
                        } else
                                buf_sz = options->test_buffer_size;
 
+                       sym_op->m_src->buf_len = options->segment_sz;
+                       sym_op->m_src->data_len = buf_sz;
+                       sym_op->m_src->pkt_len = buf_sz;
+
                        /* DOCSIS header is not CRC'ed */
                        sym_op->auth.data.offset = options->docsis_hdr_sz;
                        sym_op->auth.data.length = buf_sz -
@@ -543,7 +551,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
        struct rte_crypto_sym_xform aead_xform;
        struct rte_cryptodev_sym_session *sess = NULL;
 
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
        /*
         * security only
         */
@@ -554,16 +562,15 @@ cperf_create_session(struct rte_mempool *sess_mp,
                cipher_xform.cipher.algo = options->cipher_algo;
                cipher_xform.cipher.op = options->cipher_op;
                cipher_xform.cipher.iv.offset = iv_offset;
+               cipher_xform.cipher.iv.length = 4;
 
                /* cipher different than null */
                if (options->cipher_algo != RTE_CRYPTO_CIPHER_NULL) {
                        cipher_xform.cipher.key.data = test_vector->cipher_key.data;
                        cipher_xform.cipher.key.length = test_vector->cipher_key.length;
-                       cipher_xform.cipher.iv.length = test_vector->cipher_iv.length;
                } else {
                        cipher_xform.cipher.key.data = NULL;
                        cipher_xform.cipher.key.length = 0;
-                       cipher_xform.cipher.iv.length = 0;
                }
 
                /* Setup Auth Parameters */
@@ -601,8 +608,10 @@ cperf_create_session(struct rte_mempool *sess_mp,
                                .domain = options->pdcp_domain,
                                .pkt_dir = 0,
                                .sn_size = options->pdcp_sn_sz,
-                               .hfn = 0x1,
+                               .hfn = options->pdcp_ses_hfn_en ?
+                                       PDCP_DEFAULT_HFN : 0,
                                .hfn_threshold = 0x70C0A,
+                               .hfn_ovrd = !(options->pdcp_ses_hfn_en),
                        } },
                        .crypto_xform = &cipher_xform
                };
@@ -612,7 +621,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 
                /* Create security session */
                return (void *)rte_security_session_create(ctx,
-                                       &sess_conf, sess_mp);
+                                       &sess_conf, sess_mp, priv_mp);
        }
        if (options->op_type == CPERF_DOCSIS) {
                enum rte_security_docsis_direction direction;
@@ -655,7 +664,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
 
                /* Create security session */
                return (void *)rte_security_session_create(ctx,
-                                       &sess_conf, priv_mp);
+                                       &sess_conf, sess_mp, priv_mp);
        }
 #endif
        sess = rte_cryptodev_sym_session_create(sess_mp);
@@ -835,7 +844,7 @@ cperf_get_op_functions(const struct cperf_options *options,
                        op_fns->populate_ops = cperf_set_ops_cipher;
                return 0;
        }
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
        if (options->op_type == CPERF_PDCP) {
                op_fns->populate_ops = cperf_set_ops_security;
                return 0;