diff options
Diffstat (limited to 'examples/l2fwd-crypto')
-rw-r--r-- | examples/l2fwd-crypto/main.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 4d8341e2..4bca87b1 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -1474,8 +1474,8 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options) options->aead_iv_random_size = -1; options->aead_iv.length = 0; - options->auth_xform.aead.algo = RTE_CRYPTO_AEAD_AES_GCM; - options->auth_xform.aead.op = RTE_CRYPTO_AEAD_OP_ENCRYPT; + options->aead_xform.aead.algo = RTE_CRYPTO_AEAD_AES_GCM; + options->aead_xform.aead.op = RTE_CRYPTO_AEAD_OP_ENCRYPT; options->aad_param = 0; options->aad_random_size = -1; @@ -1721,7 +1721,7 @@ l2fwd_crypto_parse_args(struct l2fwd_crypto_options *options, /* Check the link status of all ports in up to 9s, and print them finally */ static void -check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) +check_all_ports_link_status(uint32_t port_mask) { #define CHECK_INTERVAL 100 /* 100ms */ #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */ @@ -1733,7 +1733,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) fflush(stdout); for (count = 0; count <= MAX_CHECK_TIME; count++) { all_ports_up = 1; - for (portid = 0; portid < port_num; portid++) { + RTE_ETH_FOREACH_DEV(portid) { if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); @@ -1982,7 +1982,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, } for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) { - sess_sz = rte_cryptodev_get_private_session_size(cdev_id); + sess_sz = rte_cryptodev_sym_get_private_session_size(cdev_id); if (sess_sz > max_sess_sz) max_sess_sz = sess_sz; } @@ -2309,9 +2309,9 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, static int initialize_ports(struct l2fwd_crypto_options *options) { - uint16_t last_portid, portid; + uint16_t last_portid = 0, portid; unsigned enabled_portcount = 0; - unsigned nb_ports = rte_eth_dev_count(); + unsigned nb_ports = rte_eth_dev_count_avail(); if (nb_ports == 0) { printf("No Ethernet ports - bye\n"); @@ -2322,7 +2322,7 @@ initialize_ports(struct l2fwd_crypto_options *options) for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) l2fwd_dst_ports[portid] = 0; - for (last_portid = 0, portid = 0; portid < nb_ports; portid++) { + RTE_ETH_FOREACH_DEV(portid) { int retval; struct rte_eth_dev_info dev_info; struct rte_eth_rxconf rxq_conf; @@ -2426,7 +2426,7 @@ initialize_ports(struct l2fwd_crypto_options *options) return -1; } - check_all_ports_link_status(nb_ports, l2fwd_enabled_port_mask); + check_all_ports_link_status(l2fwd_enabled_port_mask); return enabled_portcount; } @@ -2470,12 +2470,12 @@ reserve_key_memory(struct l2fwd_crypto_options *options) int main(int argc, char **argv) { - struct lcore_queue_conf *qconf; + struct lcore_queue_conf *qconf = NULL; struct l2fwd_crypto_options options; uint8_t nb_cryptodevs, cdev_id; - uint16_t nb_ports, portid; - unsigned lcore_id, rx_lcore_id; + uint16_t portid; + unsigned lcore_id, rx_lcore_id = 0; int ret, enabled_cdevcount, enabled_portcount; uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS] = {0}; @@ -2516,10 +2516,8 @@ main(int argc, char **argv) if (enabled_portcount < 1) rte_exit(EXIT_FAILURE, "Failed to initial Ethernet ports\n"); - nb_ports = rte_eth_dev_count(); /* Initialize the port/queue configuration of each logical core */ - for (rx_lcore_id = 0, qconf = NULL, portid = 0; - portid < nb_ports; portid++) { + RTE_ETH_FOREACH_DEV(portid) { /* skip ports that are not enabled */ if ((options.portmask & (1 << portid)) == 0) |