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

Function cryptodev_config

dpdk/examples/pipeline/obj.c:198–254  ·  view source on GitHub ↗

* cryptodev */

Source from the content-addressed store, hash-verified

196 * cryptodev
197 */
198int
199cryptodev_config(const char *name, struct cryptodev_params *params)
200{
201 struct rte_cryptodev_info dev_info;
202 struct rte_cryptodev_config dev_conf;
203 struct rte_cryptodev_qp_conf queue_conf;
204 uint8_t dev_id;
205 uint32_t socket_id, i;
206 int status;
207
208 /* Check input parameters. */
209 if (!name ||
210 !params->n_queue_pairs ||
211 !params->queue_size)
212 return -EINVAL;
213
214 /* Find the crypto device. */
215 status = rte_cryptodev_get_dev_id(name);
216 if (status < 0)
217 return -EINVAL;
218
219 dev_id = (uint8_t)status;
220
221 rte_cryptodev_info_get(dev_id, &dev_info);
222 if (params->n_queue_pairs > dev_info.max_nb_queue_pairs)
223 return -EINVAL;
224
225 socket_id = rte_cryptodev_socket_id(dev_id);
226
227 /* Configure the crypto device. */
228 memset(&dev_conf, 0, sizeof(dev_conf));
229 dev_conf.socket_id = socket_id;
230 dev_conf.nb_queue_pairs = params->n_queue_pairs;
231 dev_conf.ff_disable = 0;
232
233 status = rte_cryptodev_configure(dev_id, &dev_conf);
234 if (status)
235 return status;
236
237 /* Configure the crypto device queue pairs. */
238 memset(&queue_conf, 0, sizeof(queue_conf));
239 queue_conf.nb_descriptors = params->queue_size;
240 queue_conf.mp_session = NULL;
241
242 for (i = 0; i < params->n_queue_pairs; i++) {
243 status = rte_cryptodev_queue_pair_setup(dev_id, i, &queue_conf, socket_id);
244 if (status)
245 return status;
246 }
247
248 /* Start the crypto device. */
249 status = rte_cryptodev_start(dev_id);
250 if (status)
251 return status;
252
253 return 0;
254}

Callers 1

cmd_cryptodevFunction · 0.85

Calls 7

rte_cryptodev_get_dev_idFunction · 0.85
rte_cryptodev_info_getFunction · 0.85
rte_cryptodev_socket_idFunction · 0.85
memsetFunction · 0.85
rte_cryptodev_configureFunction · 0.85
rte_cryptodev_startFunction · 0.85

Tested by

no test coverage detected