mbuf_offload: remove library
[dpdk.git] / examples / l2fwd-crypto / main.c
index d70fc9a..65e90b5 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,6 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
-#include <rte_mbuf_offload.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
 #include <rte_mempool.h>
@@ -104,6 +103,11 @@ struct pkt_buffer {
        struct rte_mbuf *buffer[MAX_PKT_BURST];
 };
 
+struct op_buffer {
+       unsigned len;
+       struct rte_crypto_op *buffer[MAX_PKT_BURST];
+};
+
 #define MAX_RX_QUEUE_PER_LCORE 16
 #define MAX_TX_QUEUE_PER_PORT 16
 
@@ -112,6 +116,12 @@ enum l2fwd_crypto_xform_chain {
        L2FWD_CRYPTO_HASH_CIPHER
 };
 
+struct l2fwd_key {
+       uint8_t *data;
+       uint32_t length;
+       phys_addr_t phys_addr;
+};
+
 /** l2fwd crypto application command line options */
 struct l2fwd_crypto_options {
        unsigned portmask;
@@ -124,13 +134,13 @@ struct l2fwd_crypto_options {
 
        enum l2fwd_crypto_xform_chain xform_chain;
 
-       struct rte_crypto_xform cipher_xform;
+       struct rte_crypto_sym_xform cipher_xform;
        uint8_t ckey_data[32];
 
-       struct rte_crypto_key iv_key;
+       struct l2fwd_key iv_key;
        uint8_t ivkey_data[16];
 
-       struct rte_crypto_xform auth_xform;
+       struct rte_crypto_sym_xform auth_xform;
        uint8_t akey_data[128];
 };
 
@@ -141,9 +151,8 @@ struct l2fwd_crypto_params {
 
        unsigned digest_length;
        unsigned block_size;
-
-       struct rte_crypto_key iv_key;
-       struct rte_cryptodev_session *session;
+       struct l2fwd_key iv_key;
+       struct rte_cryptodev_sym_session *session;
 };
 
 /** lcore configuration */
@@ -154,8 +163,8 @@ struct lcore_queue_conf {
        unsigned nb_crypto_devs;
        unsigned cryptodev_list[MAX_RX_QUEUE_PER_LCORE];
 
-       struct pkt_buffer crypto_pkt_buf[RTE_MAX_ETHPORTS];
-       struct pkt_buffer tx_pkt_buf[RTE_MAX_ETHPORTS];
+       struct op_buffer op_buf[RTE_MAX_ETHPORTS];
+       struct pkt_buffer pkt_buf[RTE_MAX_ETHPORTS];
 } __rte_cache_aligned;
 
 struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE];
@@ -175,7 +184,7 @@ static const struct rte_eth_conf port_conf = {
 };
 
 struct rte_mempool *l2fwd_pktmbuf_pool;
-struct rte_mempool *l2fwd_mbuf_ol_pool;
+struct rte_mempool *l2fwd_crypto_op_pool;
 
 /* Per-port statistics struct */
 struct l2fwd_port_statistics {
@@ -205,17 +214,22 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_MAX_ETHPORTS];
 /* default period is 10 seconds */
 static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000;
 
-uint64_t total_packets_dropped = 0, total_packets_tx = 0, total_packets_rx = 0,
-       total_packets_enqueued = 0, total_packets_dequeued = 0,
-       total_packets_errors = 0;
-
 /* Print out statistics on packets dropped */
 static void
 print_stats(void)
 {
+       uint64_t total_packets_dropped, total_packets_tx, total_packets_rx;
+       uint64_t total_packets_enqueued, total_packets_dequeued,
+               total_packets_errors;
        unsigned portid;
        uint64_t cdevid;
 
+       total_packets_dropped = 0;
+       total_packets_tx = 0;
+       total_packets_rx = 0;
+       total_packets_enqueued = 0;
+       total_packets_dequeued = 0;
+       total_packets_errors = 0;
 
        const char clr[] = { 27, '[', '2', 'J', '\0' };
        const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };
@@ -284,20 +298,21 @@ static int
 l2fwd_crypto_send_burst(struct lcore_queue_conf *qconf, unsigned n,
                struct l2fwd_crypto_params *cparams)
 {
-       struct rte_mbuf **pkt_buffer;
+       struct rte_crypto_op **op_buffer;
        unsigned ret;
 
-       pkt_buffer = (struct rte_mbuf **)
-                       qconf->crypto_pkt_buf[cparams->dev_id].buffer;
+       op_buffer = (struct rte_crypto_op **)
+                       qconf->op_buf[cparams->dev_id].buffer;
+
+       ret = rte_cryptodev_enqueue_burst(cparams->dev_id,
+                       cparams->qp_id, op_buffer, (uint16_t) n);
 
-       ret = rte_cryptodev_enqueue_burst(cparams->dev_id, cparams->qp_id,
-                       pkt_buffer, (uint16_t) n);
        crypto_statistics[cparams->dev_id].enqueued += ret;
        if (unlikely(ret < n)) {
                crypto_statistics[cparams->dev_id].errors += (n - ret);
                do {
-                       rte_pktmbuf_offload_free(pkt_buffer[ret]->offload_ops);
-                       rte_pktmbuf_free(pkt_buffer[ret]);
+                       rte_pktmbuf_free(op_buffer[ret]->sym->m_src);
+                       rte_crypto_op_free(op_buffer[ret]);
                } while (++ret < n);
        }
 
@@ -305,7 +320,8 @@ l2fwd_crypto_send_burst(struct lcore_queue_conf *qconf, unsigned n,
 }
 
 static int
-l2fwd_crypto_enqueue(struct rte_mbuf *m, struct l2fwd_crypto_params *cparams)
+l2fwd_crypto_enqueue(struct rte_crypto_op *op,
+               struct l2fwd_crypto_params *cparams)
 {
        unsigned lcore_id, len;
        struct lcore_queue_conf *qconf;
@@ -313,23 +329,23 @@ l2fwd_crypto_enqueue(struct rte_mbuf *m, struct l2fwd_crypto_params *cparams)
        lcore_id = rte_lcore_id();
 
        qconf = &lcore_queue_conf[lcore_id];
-       len = qconf->crypto_pkt_buf[cparams->dev_id].len;
-       qconf->crypto_pkt_buf[cparams->dev_id].buffer[len] = m;
+       len = qconf->op_buf[cparams->dev_id].len;
+       qconf->op_buf[cparams->dev_id].buffer[len] = op;
        len++;
 
-       /* enough pkts to be sent */
+       /* enough ops to be sent */
        if (len == MAX_PKT_BURST) {
                l2fwd_crypto_send_burst(qconf, MAX_PKT_BURST, cparams);
                len = 0;
        }
 
-       qconf->crypto_pkt_buf[cparams->dev_id].len = len;
+       qconf->op_buf[cparams->dev_id].len = len;
        return 0;
 }
 
 static int
 l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
-               struct rte_mbuf_offload *ol,
+               struct rte_crypto_op *op,
                struct l2fwd_crypto_params *cparams)
 {
        struct ether_hdr *eth_hdr;
@@ -367,43 +383,43 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
        }
 
        /* Set crypto operation data parameters */
-       rte_crypto_op_attach_session(&ol->op.crypto, cparams->session);
+       rte_crypto_op_attach_sym_session(op, cparams->session);
 
        /* Append space for digest to end of packet */
-       ol->op.crypto.digest.data = (uint8_t *)rte_pktmbuf_append(m,
+       op->sym->auth.digest.data = (uint8_t *)rte_pktmbuf_append(m,
                        cparams->digest_length);
-       ol->op.crypto.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
+       op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
                        rte_pktmbuf_pkt_len(m) - cparams->digest_length);
-       ol->op.crypto.digest.length = cparams->digest_length;
+       op->sym->auth.digest.length = cparams->digest_length;
 
-       ol->op.crypto.iv.data = cparams->iv_key.data;
-       ol->op.crypto.iv.phys_addr = cparams->iv_key.phys_addr;
-       ol->op.crypto.iv.length = cparams->iv_key.length;
+       op->sym->auth.data.offset = ipdata_offset;
+       op->sym->auth.data.length = data_len;
 
-       ol->op.crypto.data.to_cipher.offset = ipdata_offset;
-       ol->op.crypto.data.to_cipher.length = data_len;
 
-       ol->op.crypto.data.to_hash.offset = ipdata_offset;
-       ol->op.crypto.data.to_hash.length = data_len;
+       op->sym->cipher.iv.data = cparams->iv_key.data;
+       op->sym->cipher.iv.phys_addr = cparams->iv_key.phys_addr;
+       op->sym->cipher.iv.length = cparams->iv_key.length;
 
-       rte_pktmbuf_offload_attach(m, ol);
+       op->sym->cipher.data.offset = ipdata_offset;
+       op->sym->cipher.data.length = data_len;
 
-       return l2fwd_crypto_enqueue(m, cparams);
+       op->sym->m_src = m;
+
+       return l2fwd_crypto_enqueue(op, cparams);
 }
 
 
 /* Send the burst of packets on an output interface */
 static int
-l2fwd_send_burst(struct lcore_queue_conf *qconf, unsigned n, uint8_t port)
+l2fwd_send_burst(struct lcore_queue_conf *qconf, unsigned n,
+               uint8_t port)
 {
        struct rte_mbuf **pkt_buffer;
        unsigned ret;
-       unsigned queueid = 0;
 
-       pkt_buffer = (struct rte_mbuf **)qconf->tx_pkt_buf[port].buffer;
+       pkt_buffer = (struct rte_mbuf **)qconf->pkt_buf[port].buffer;
 
-       ret = rte_eth_tx_burst(port, (uint16_t) queueid, pkt_buffer,
-                       (uint16_t)n);
+       ret = rte_eth_tx_burst(port, 0, pkt_buffer, (uint16_t)n);
        port_statistics[port].tx += ret;
        if (unlikely(ret < n)) {
                port_statistics[port].dropped += (n - ret);
@@ -425,8 +441,8 @@ l2fwd_send_packet(struct rte_mbuf *m, uint8_t port)
        lcore_id = rte_lcore_id();
 
        qconf = &lcore_queue_conf[lcore_id];
-       len = qconf->tx_pkt_buf[port].len;
-       qconf->tx_pkt_buf[port].buffer[len] = m;
+       len = qconf->pkt_buf[port].len;
+       qconf->pkt_buf[port].buffer[len] = m;
        len++;
 
        /* enough pkts to be sent */
@@ -435,7 +451,7 @@ l2fwd_send_packet(struct rte_mbuf *m, uint8_t port)
                len = 0;
        }
 
-       qconf->tx_pkt_buf[port].len = len;
+       qconf->pkt_buf[port].len = len;
        return 0;
 }
 
@@ -469,11 +485,11 @@ generate_random_key(uint8_t *key, unsigned length)
                key[i] = rand() % 0xff;
 }
 
-static struct rte_cryptodev_session *
+static struct rte_cryptodev_sym_session *
 initialize_crypto_session(struct l2fwd_crypto_options *options,
                uint8_t cdev_id)
 {
-       struct rte_crypto_xform *first_xform;
+       struct rte_crypto_sym_xform *first_xform;
 
        if (options->xform_chain == L2FWD_CRYPTO_CIPHER_HASH) {
                first_xform = &options->cipher_xform;
@@ -484,7 +500,7 @@ initialize_crypto_session(struct l2fwd_crypto_options *options,
        }
 
        /* Setup Cipher Parameters */
-       return rte_cryptodev_session_create(cdev_id, first_xform);
+       return rte_cryptodev_sym_session_create(cdev_id, first_xform);
 }
 
 static void
@@ -495,6 +511,8 @@ static void
 l2fwd_main_loop(struct l2fwd_crypto_options *options)
 {
        struct rte_mbuf *m, *pkts_burst[MAX_PKT_BURST];
+       struct rte_crypto_op *ops_burst[MAX_PKT_BURST];
+
        unsigned lcore_id = rte_lcore_id();
        uint64_t prev_tsc = 0, diff_tsc, cur_tsc, timer_tsc = 0;
        unsigned i, j, portid, nb_rx;
@@ -555,12 +573,12 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
                if (unlikely(diff_tsc > drain_tsc)) {
 
                        for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
-                               if (qconf->tx_pkt_buf[portid].len == 0)
+                               if (qconf->pkt_buf[portid].len == 0)
                                        continue;
                                l2fwd_send_burst(&lcore_queue_conf[lcore_id],
-                                                qconf->tx_pkt_buf[portid].len,
+                                                qconf->pkt_buf[portid].len,
                                                 (uint8_t) portid);
-                               qconf->tx_pkt_buf[portid].len = 0;
+                               qconf->pkt_buf[portid].len = 0;
                        }
 
                        /* if timer is enabled */
@@ -589,8 +607,6 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
                 * Read packet from RX queues
                 */
                for (i = 0; i < qconf->nb_rx_ports; i++) {
-                       struct rte_mbuf_offload *ol;
-
                        portid = qconf->rx_port_list[i];
 
                        cparams = &port_cparams[i];
@@ -600,44 +616,49 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
 
                        port_statistics[portid].rx += nb_rx;
 
-                       /* Enqueue packets from Crypto device*/
-                       for (j = 0; j < nb_rx; j++) {
-                               m = pkts_burst[j];
-                               ol = rte_pktmbuf_offload_alloc(
-                                               l2fwd_mbuf_ol_pool,
-                                               RTE_PKTMBUF_OL_CRYPTO);
+                       if (nb_rx) {
                                /*
-                                * If we can't allocate a offload, then drop
+                                * If we can't allocate a crypto_ops, then drop
                                 * the rest of the burst and dequeue and
                                 * process the packets to free offload structs
                                 */
-                               if (unlikely(ol == NULL)) {
-                                       for (; j < nb_rx; j++) {
-                                               rte_pktmbuf_free(pkts_burst[j]);
-                                               port_statistics[portid].dropped++;
-                                       }
-                                       break;
+                               if (rte_crypto_op_bulk_alloc(
+                                               l2fwd_crypto_op_pool,
+                                               RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+                                               ops_burst, nb_rx) !=
+                                                               nb_rx) {
+                                       for (j = 0; j < nb_rx; j++)
+                                               rte_pktmbuf_free(pkts_burst[i]);
+
+                                       nb_rx = 0;
                                }
 
-                               rte_prefetch0(rte_pktmbuf_mtod(m, void *));
-                               rte_prefetch0((void *)ol);
+                               /* Enqueue packets from Crypto device*/
+                               for (j = 0; j < nb_rx; j++) {
+                                       m = pkts_burst[j];
 
-                               l2fwd_simple_crypto_enqueue(m, ol, cparams);
+                                       l2fwd_simple_crypto_enqueue(m,
+                                                       ops_burst[j], cparams);
+                               }
                        }
 
                        /* Dequeue packets from Crypto device */
-                       nb_rx = rte_cryptodev_dequeue_burst(
-                                       cparams->dev_id, cparams->qp_id,
-                                       pkts_burst, MAX_PKT_BURST);
-                       crypto_statistics[cparams->dev_id].dequeued += nb_rx;
-
-                       /* Forward crypto'd packets */
-                       for (j = 0; j < nb_rx; j++) {
-                               m = pkts_burst[j];
-                               rte_pktmbuf_offload_free(m->offload_ops);
-                               rte_prefetch0(rte_pktmbuf_mtod(m, void *));
-                               l2fwd_simple_forward(m, portid);
-                       }
+                       do {
+                               nb_rx = rte_cryptodev_dequeue_burst(
+                                               cparams->dev_id, cparams->qp_id,
+                                               ops_burst, MAX_PKT_BURST);
+
+                               crypto_statistics[cparams->dev_id].dequeued +=
+                                               nb_rx;
+
+                               /* Forward crypto'd packets */
+                               for (j = 0; j < nb_rx; j++) {
+                                       m = ops_burst[j]->sym->m_src;
+
+                                       rte_crypto_op_free(ops_burst[j]);
+                                       l2fwd_simple_forward(m, portid);
+                               }
+                       } while (nb_rx == MAX_PKT_BURST);
                }
        }
 }
@@ -666,8 +687,9 @@ l2fwd_crypto_usage(const char *prgname)
                "  --cipher_algo ALGO\n"
                "  --cipher_op ENCRYPT / DECRYPT\n"
                "  --cipher_key KEY\n"
+               "  --iv IV\n"
 
-               "  --auth ALGO\n"
+               "  --auth_algo ALGO\n"
                "  --auth_op GENERATE / VERIFY\n"
                "  --auth_key KEY\n"
 
@@ -683,7 +705,7 @@ parse_cryptodev_type(enum rte_cryptodev_type *type, char *optarg)
                *type = RTE_CRYPTODEV_AESNI_MB_PMD;
                return 0;
        } else if (strcmp("QAT", optarg) == 0) {
-               *type = RTE_CRYPTODEV_QAT_PMD;
+               *type = RTE_CRYPTODEV_QAT_SYM_PMD;
                return 0;
        }
 
@@ -739,7 +761,7 @@ parse_cipher_op(enum rte_crypto_cipher_operation *op, char *optarg)
 
 /** Parse crypto key command line argument */
 static int
-parse_key(struct rte_crypto_key *key __rte_unused,
+parse_key(struct l2fwd_key *key __rte_unused,
                unsigned length __rte_unused, char *arg __rte_unused)
 {
        printf("Currently an unsupported argument!\n");
@@ -787,7 +809,7 @@ parse_auth_op(enum rte_crypto_auth_operation *op, char *optarg)
                *op = RTE_CRYPTO_AUTH_OP_VERIFY;
                return 0;
        } else if (strcmp("GENERATE", optarg) == 0) {
-               *op = RTE_CRYPTO_AUTH_OP_VERIFY;
+               *op = RTE_CRYPTO_AUTH_OP_GENERATE;
                return 0;
        }
 
@@ -815,28 +837,42 @@ l2fwd_crypto_parse_args_long_options(struct l2fwd_crypto_options *options,
                return parse_cipher_op(&options->cipher_xform.cipher.op,
                                optarg);
 
-       else if (strcmp(lgopts[option_index].name, "cipher_key") == 0)
-               return parse_key(&options->cipher_xform.cipher.key,
-                               sizeof(options->ckey_data), optarg);
+       else if (strcmp(lgopts[option_index].name, "cipher_key") == 0) {
+               struct l2fwd_key key = { 0 };
+               int retval = 0;
+
+               retval = parse_key(&key, sizeof(options->ckey_data), optarg);
+
+               options->cipher_xform.cipher.key.data = key.data;
+               options->cipher_xform.cipher.key.length = key.length;
 
-       else if (strcmp(lgopts[option_index].name, "iv") == 0)
+               return retval;
+
+       } else if (strcmp(lgopts[option_index].name, "iv") == 0)
                return parse_key(&options->iv_key, sizeof(options->ivkey_data),
                                optarg);
 
        /* Authentication options */
        else if (strcmp(lgopts[option_index].name, "auth_algo") == 0)
-               return parse_auth_algo(&options->cipher_xform.auth.algo,
+               return parse_auth_algo(&options->auth_xform.auth.algo,
                                optarg);
 
        else if (strcmp(lgopts[option_index].name, "auth_op") == 0)
-               return parse_auth_op(&options->cipher_xform.auth.op,
+               return parse_auth_op(&options->auth_xform.auth.op,
                                optarg);
 
-       else if (strcmp(lgopts[option_index].name, "auth_key") == 0)
-               return parse_key(&options->auth_xform.auth.key,
-                               sizeof(options->akey_data), optarg);
+       else if (strcmp(lgopts[option_index].name, "auth_key") == 0) {
+               struct l2fwd_key key = { 0 };
+               int retval = 0;
+
+               retval = parse_key(&key, sizeof(options->akey_data), optarg);
+
+               options->auth_xform.auth.key.data = key.data;
+               options->auth_xform.auth.key.length = key.length;
+
+               return retval;
 
-       else if (strcmp(lgopts[option_index].name, "sessionless") == 0) {
+       else if (strcmp(lgopts[option_index].name, "sessionless") == 0) {
                options->sessionless = 1;
                return 0;
        }
@@ -931,7 +967,7 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options)
        options->xform_chain = L2FWD_CRYPTO_CIPHER_HASH;
 
        /* Cipher Data */
-       options->cipher_xform.type = RTE_CRYPTO_XFORM_CIPHER;
+       options->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
        options->cipher_xform.next = NULL;
 
        options->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
@@ -940,12 +976,11 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options)
        generate_random_key(options->ckey_data, sizeof(options->ckey_data));
 
        options->cipher_xform.cipher.key.data = options->ckey_data;
-       options->cipher_xform.cipher.key.phys_addr = 0;
        options->cipher_xform.cipher.key.length = 16;
 
 
        /* Authentication Data */
-       options->auth_xform.type = RTE_CRYPTO_XFORM_AUTH;
+       options->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
        options->auth_xform.next = NULL;
 
        options->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
@@ -957,7 +992,6 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options)
        generate_random_key(options->akey_data, sizeof(options->akey_data));
 
        options->auth_xform.auth.key.data = options->akey_data;
-       options->auth_xform.auth.key.phys_addr = 0;
        options->auth_xform.auth.key.length = 20;
 }
 
@@ -975,9 +1009,9 @@ l2fwd_crypto_options_print(struct l2fwd_crypto_options *options)
 
        switch (options->cdev_type) {
        case RTE_CRYPTODEV_AESNI_MB_PMD:
-               printf("crytpodev type: AES-NI MB PMD\n"); break;
-       case RTE_CRYPTODEV_QAT_PMD:
-               printf("crytpodev type: QAT PMD\n"); break;
+               printf("cryptodev type: AES-NI MB PMD\n"); break;
+       case RTE_CRYPTODEV_QAT_SYM_PMD:
+               printf("cryptodev type: QAT PMD\n"); break;
        default:
                break;
        }
@@ -1173,14 +1207,14 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports)
        unsigned i, cdev_id, cdev_count, enabled_cdev_count = 0;
        int retval;
 
-       if (options->cdev_type == RTE_CRYPTODEV_QAT_PMD) {
+       if (options->cdev_type == RTE_CRYPTODEV_QAT_SYM_PMD) {
                if (rte_cryptodev_count() < nb_ports)
                        return -1;
        } else if (options->cdev_type == RTE_CRYPTODEV_AESNI_MB_PMD) {
                for (i = 0; i < nb_ports; i++) {
-                       int id = rte_eal_vdev_init(CRYPTODEV_NAME_AESNI_MB_PMD,
+                       int retval = rte_eal_vdev_init(CRYPTODEV_NAME_AESNI_MB_PMD,
                                        NULL);
-                       if (id < 0)
+                       if (retval < 0)
                                return -1;
                }
        }
@@ -1361,15 +1395,17 @@ main(int argc, char **argv)
                rte_exit(EXIT_FAILURE, "Invalid L2FWD-CRYPTO arguments\n");
 
        /* create the mbuf pool */
-       l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 128,
-               0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
+       l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 512,
+                       sizeof(struct rte_crypto_op),
+                       RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
        if (l2fwd_pktmbuf_pool == NULL)
                rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
 
        /* create crypto op pool */
-       l2fwd_mbuf_ol_pool = rte_pktmbuf_offload_pool_create(
-                       "mbuf_offload_pool", NB_MBUF, 128, 0, rte_socket_id());
-       if (l2fwd_mbuf_ol_pool == NULL)
+       l2fwd_crypto_op_pool = rte_crypto_op_pool_create("crypto_op_pool",
+                       RTE_CRYPTO_OP_TYPE_SYMMETRIC, NB_MBUF, 128, 0,
+                       rte_socket_id());
+       if (l2fwd_crypto_op_pool == NULL)
                rte_exit(EXIT_FAILURE, "Cannot create crypto op pool\n");
 
        /* Enable Ethernet ports */