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

Function rte_cryptodev_remove_enq_callback

dpdk/lib/cryptodev/rte_cryptodev.c:1556–1630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1554}
1555
1556int
1557rte_cryptodev_remove_enq_callback(uint8_t dev_id,
1558 uint16_t qp_id,
1559 struct rte_cryptodev_cb *cb)
1560{
1561#ifndef RTE_CRYPTO_CALLBACKS
1562 return -ENOTSUP;
1563#endif
1564 struct rte_cryptodev *dev;
1565 RTE_ATOMIC(struct rte_cryptodev_cb *) *prev_cb;
1566 struct rte_cryptodev_cb *curr_cb;
1567 struct rte_cryptodev_cb_rcu *list;
1568 int ret;
1569
1570 ret = -EINVAL;
1571
1572 if (!cb) {
1573 CDEV_LOG_ERR("Callback is NULL");
1574 return -EINVAL;
1575 }
1576
1577 if (!rte_cryptodev_is_valid_dev(dev_id)) {
1578 CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
1579 return -ENODEV;
1580 }
1581
1582 rte_cryptodev_trace_remove_enq_callback(dev_id, qp_id, cb->fn);
1583
1584 dev = &rte_crypto_devices[dev_id];
1585 if (qp_id >= dev->data->nb_queue_pairs) {
1586 CDEV_LOG_ERR("Invalid queue_pair_id=%d", qp_id);
1587 return -ENODEV;
1588 }
1589
1590 rte_spinlock_lock(&rte_cryptodev_callback_lock);
1591 if (dev->enq_cbs == NULL) {
1592 CDEV_LOG_ERR("Callback not initialized");
1593 goto cb_err;
1594 }
1595
1596 list = &dev->enq_cbs[qp_id];
1597 if (list == NULL) {
1598 CDEV_LOG_ERR("Callback list is NULL");
1599 goto cb_err;
1600 }
1601
1602 if (list->qsbr == NULL) {
1603 CDEV_LOG_ERR("Rcu qsbr is NULL");
1604 goto cb_err;
1605 }
1606
1607 prev_cb = &list->next;
1608 for (; *prev_cb != NULL; prev_cb = &curr_cb->next) {
1609 curr_cb = *prev_cb;
1610 if (curr_cb == cb) {
1611 /* Remove the user cb from the callback list. */
1612 rte_atomic_store_explicit(prev_cb, curr_cb->next,
1613 rte_memory_order_relaxed);

Callers 1

test_enq_callback_setupFunction · 0.85

Calls 5

rte_rcu_qsbr_synchronizeFunction · 0.85
rte_freeFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by 1

test_enq_callback_setupFunction · 0.68