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

Function dpaa2_qdma_dequeue_multi

dpdk/drivers/dma/dpaa2/dpaa2_qdma.c:982–1047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

980}
981
982static uint16_t
983dpaa2_qdma_dequeue_multi(struct qdma_device *qdma_dev,
984 struct qdma_virt_queue *qdma_vq,
985 struct rte_dpaa2_qdma_job **jobs,
986 uint16_t nb_jobs)
987{
988 struct qdma_virt_queue *temp_qdma_vq;
989 int ring_count;
990 int ret = 0, i;
991
992 if (qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) {
993 /** Make sure there are enough space to get jobs.*/
994 if (unlikely(nb_jobs < DPAA2_QDMA_MAX_SG_NB))
995 return -EINVAL;
996 }
997
998 /* Only dequeue when there are pending jobs on VQ */
999 if (qdma_vq->num_enqueues == qdma_vq->num_dequeues)
1000 return 0;
1001
1002 if (!(qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) &&
1003 qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs))
1004 nb_jobs = RTE_MIN((qdma_vq->num_enqueues -
1005 qdma_vq->num_dequeues), nb_jobs);
1006
1007 if (qdma_vq->exclusive_hw_queue) {
1008 /* In case of exclusive queue directly fetch from HW queue */
1009 ret = qdma_vq->dequeue_job(qdma_vq, NULL, jobs, nb_jobs);
1010 if (ret < 0) {
1011 DPAA2_QDMA_ERR(
1012 "Dequeue from DPDMAI device failed: %d", ret);
1013 return ret;
1014 }
1015 } else {
1016 uint16_t temp_vq_id[DPAA2_QDMA_MAX_DESC];
1017
1018 /* Get the QDMA completed jobs from the software ring.
1019 * In case they are not available on the ring poke the HW
1020 * to fetch completed jobs from corresponding HW queues
1021 */
1022 ring_count = rte_ring_count(qdma_vq->status_ring);
1023 if (ring_count < nb_jobs) {
1024 ret = qdma_vq->dequeue_job(qdma_vq,
1025 temp_vq_id, jobs, nb_jobs);
1026 for (i = 0; i < ret; i++) {
1027 temp_qdma_vq = &qdma_dev->vqs[temp_vq_id[i]];
1028 rte_ring_enqueue(temp_qdma_vq->status_ring,
1029 (void *)(jobs[i]));
1030 }
1031 ring_count = rte_ring_count(
1032 qdma_vq->status_ring);
1033 }
1034
1035 if (ring_count) {
1036 /* Dequeue job from the software ring
1037 * to provide to the user
1038 */
1039 ret = rte_ring_dequeue_bulk(qdma_vq->status_ring,

Callers 3

dpaa2_qdma_dequeueFunction · 0.85

Calls 3

rte_ring_countFunction · 0.85
rte_ring_enqueueFunction · 0.85
rte_ring_dequeue_bulkFunction · 0.85

Tested by

no test coverage detected