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

Function cryptodev_cb_init

dpdk/lib/cryptodev/rte_cryptodev.c:672–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672static int
673cryptodev_cb_init(struct rte_cryptodev *dev)
674{
675 struct rte_cryptodev_cb_rcu *list;
676 struct rte_rcu_qsbr *qsbr;
677 uint16_t qp_id;
678 size_t size;
679
680 /* Max thread set to 1, as one DP thread accessing a queue-pair */
681 const uint32_t max_threads = 1;
682
683 dev->enq_cbs = rte_zmalloc(NULL,
684 sizeof(struct rte_cryptodev_cb_rcu) *
685 dev->data->nb_queue_pairs, 0);
686 if (dev->enq_cbs == NULL) {
687 CDEV_LOG_ERR("Failed to allocate memory for enq callbacks");
688 return -ENOMEM;
689 }
690
691 dev->deq_cbs = rte_zmalloc(NULL,
692 sizeof(struct rte_cryptodev_cb_rcu) *
693 dev->data->nb_queue_pairs, 0);
694 if (dev->deq_cbs == NULL) {
695 CDEV_LOG_ERR("Failed to allocate memory for deq callbacks");
696 rte_free(dev->enq_cbs);
697 return -ENOMEM;
698 }
699
700 /* Create RCU QSBR variable */
701 size = rte_rcu_qsbr_get_memsize(max_threads);
702
703 for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
704 list = &dev->enq_cbs[qp_id];
705 qsbr = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
706 if (qsbr == NULL) {
707 CDEV_LOG_ERR("Failed to allocate memory for RCU on "
708 "queue_pair_id=%d", qp_id);
709 goto cb_init_err;
710 }
711
712 if (rte_rcu_qsbr_init(qsbr, max_threads)) {
713 CDEV_LOG_ERR("Failed to initialize for RCU on "
714 "queue_pair_id=%d", qp_id);
715 goto cb_init_err;
716 }
717
718 list->qsbr = qsbr;
719 }
720
721 for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
722 list = &dev->deq_cbs[qp_id];
723 qsbr = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
724 if (qsbr == NULL) {
725 CDEV_LOG_ERR("Failed to allocate memory for RCU on "
726 "queue_pair_id=%d", qp_id);
727 goto cb_init_err;
728 }
729

Callers 1

rte_cryptodev_configureFunction · 0.85

Calls 5

rte_zmallocFunction · 0.85
rte_freeFunction · 0.85
rte_rcu_qsbr_get_memsizeFunction · 0.85
rte_rcu_qsbr_initFunction · 0.85
cryptodev_cb_cleanupFunction · 0.85

Tested by

no test coverage detected