MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cryptodev_create

Function cryptodev_create

dpdk/examples/ip_pipeline/cryptodev.c:48–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48struct cryptodev *
49cryptodev_create(const char *name, struct cryptodev_params *params)
50{
51 struct rte_cryptodev_info dev_info;
52 struct rte_cryptodev_config dev_conf;
53 struct rte_cryptodev_qp_conf queue_conf;
54 struct cryptodev *cryptodev;
55 uint32_t dev_id, i;
56 uint32_t socket_id;
57 uint32_t cache_size;
58 char mp_name[NAME_SIZE];
59 int status;
60
61 /* Check input params */
62 if ((name == NULL) ||
63 cryptodev_find(name) ||
64 (params->n_queues == 0) ||
65 (params->queue_size == 0) ||
66 (params->session_pool_size == 0))
67 return NULL;
68
69 if (params->dev_name) {
70 status = rte_cryptodev_get_dev_id(params->dev_name);
71 if (status == -1)
72 return NULL;
73
74 dev_id = (uint32_t)status;
75 } else {
76 if (rte_cryptodev_is_valid_dev(params->dev_id) == 0)
77 return NULL;
78
79 dev_id = params->dev_id;
80 }
81
82 cache_size = (params->session_pool_size / 2 <
83 PIPELINE_CRYPTO_SESSION_CACHE_SIZE) ?
84 (params->session_pool_size / 2) :
85 PIPELINE_CRYPTO_SESSION_CACHE_SIZE;
86
87 socket_id = rte_cryptodev_socket_id(dev_id);
88 rte_cryptodev_info_get(dev_id, &dev_info);
89
90 if (dev_info.max_nb_queue_pairs < params->n_queues)
91 return NULL;
92
93 dev_conf.socket_id = socket_id;
94 dev_conf.nb_queue_pairs = params->n_queues;
95 dev_conf.ff_disable = 0;
96
97 status = rte_cryptodev_configure(dev_id, &dev_conf);
98 if (status < 0)
99 return NULL;
100
101 queue_conf.nb_descriptors = params->queue_size;
102 for (i = 0; i < params->n_queues; i++) {
103 status = rte_cryptodev_queue_pair_setup(dev_id, i,
104 &queue_conf, socket_id);
105 if (status < 0)

Callers 1

cmd_cryptodevFunction · 0.85

Calls 15

rte_cryptodev_get_dev_idFunction · 0.85
rte_cryptodev_socket_idFunction · 0.85
rte_cryptodev_info_getFunction · 0.85
rte_cryptodev_configureFunction · 0.85
rte_cryptodev_startFunction · 0.85
callocFunction · 0.85
rte_cryptodev_stopFunction · 0.85
snprintfFunction · 0.85
rte_mempool_createFunction · 0.85

Tested by

no test coverage detected