X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fl2fwd-crypto%2Fmain.c;h=17673a35218347ab590c4a59f25df767e1ed6d60;hb=455446276493a68117f738b2b778f2791751a2a7;hp=83446f386979769fdfa37f73ce0e447d338d73d1;hpb=acdfecba455401d91ca1e2d16e33e42588bdde16;p=dpdk.git diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 83446f3869..17673a3521 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -662,7 +662,12 @@ initialize_crypto_session(struct l2fwd_crypto_options *options, uint8_t cdev_id) { struct rte_crypto_sym_xform *first_xform; struct rte_cryptodev_sym_session *session; - uint8_t socket_id = rte_cryptodev_socket_id(cdev_id); + int retval = rte_cryptodev_socket_id(cdev_id); + + if (retval < 0) + return NULL; + + uint8_t socket_id = (uint8_t) retval; struct rte_mempool *sess_mp = session_pool_socket[socket_id]; if (options->xform_chain == L2FWD_CRYPTO_AEAD) { @@ -1083,6 +1088,7 @@ parse_key(uint8_t *data, char *input_arg) unsigned byte_count; char *token; + errno = 0; for (byte_count = 0, token = strtok(input_arg, ":"); (byte_count < MAX_KEY_SIZE) && (token != NULL); token = strtok(NULL, ":")) { @@ -1996,7 +2002,14 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cdev_id++) { struct rte_cryptodev_qp_conf qp_conf; struct rte_cryptodev_info dev_info; - uint8_t socket_id = rte_cryptodev_socket_id(cdev_id); + retval = rte_cryptodev_socket_id(cdev_id); + + if (retval < 0) { + printf("Invalid crypto device id used\n"); + return -1; + } + + uint8_t socket_id = (uint8_t) retval; struct rte_cryptodev_config conf = { .nb_queue_pairs = 1,