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

Function rte_cryptodev_configure

dpdk/lib/cryptodev/rte_cryptodev.c:1223–1268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1221}
1222
1223int
1224rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
1225{
1226 struct rte_cryptodev *dev;
1227 int diag;
1228
1229 if (!rte_cryptodev_is_valid_dev(dev_id)) {
1230 CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
1231 return -EINVAL;
1232 }
1233
1234 dev = &rte_crypto_devices[dev_id];
1235
1236 if (dev->data->dev_started) {
1237 CDEV_LOG_ERR(
1238 "device %d must be stopped to allow configuration", dev_id);
1239 return -EBUSY;
1240 }
1241
1242 if (*dev->dev_ops->dev_configure == NULL)
1243 return -ENOTSUP;
1244
1245 rte_spinlock_lock(&rte_cryptodev_callback_lock);
1246 cryptodev_cb_cleanup(dev);
1247 rte_spinlock_unlock(&rte_cryptodev_callback_lock);
1248
1249 /* Setup new number of queue pairs and reconfigure device. */
1250 diag = rte_cryptodev_queue_pairs_config(dev, config->nb_queue_pairs,
1251 config->socket_id);
1252 if (diag != 0) {
1253 CDEV_LOG_ERR("dev%d rte_crypto_dev_queue_pairs_config = %d",
1254 dev_id, diag);
1255 return diag;
1256 }
1257
1258 rte_spinlock_lock(&rte_cryptodev_callback_lock);
1259 diag = cryptodev_cb_init(dev);
1260 rte_spinlock_unlock(&rte_cryptodev_callback_lock);
1261 if (diag) {
1262 CDEV_LOG_ERR("Callback init failed for dev_id=%d", dev_id);
1263 return diag;
1264 }
1265
1266 rte_cryptodev_trace_configure(dev_id, config);
1267 return (*dev->dev_ops->dev_configure)(dev, config);
1268}
1269
1270int
1271rte_cryptodev_start(uint8_t dev_id)

Callers 15

scheduler_pmd_configFunction · 0.85
testsuite_setupFunction · 0.85
testsuite_teardownFunction · 0.85
ut_setup_asymFunction · 0.85
testsuite_setupFunction · 0.85
dev_configure_and_startFunction · 0.85
test_device_reconfigureFunction · 0.85
test_enq_callback_setupFunction · 0.85

Calls 6

cryptodev_cb_cleanupFunction · 0.85
cryptodev_cb_initFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by 15

testsuite_setupFunction · 0.68
testsuite_teardownFunction · 0.68
ut_setup_asymFunction · 0.68
testsuite_setupFunction · 0.68
dev_configure_and_startFunction · 0.68
test_device_reconfigureFunction · 0.68
test_enq_callback_setupFunction · 0.68
test_deq_callback_setupFunction · 0.68
configure_cryptodevFunction · 0.68