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

Function bcmfs5_dequeue_qp

dpdk/drivers/crypto/bcmfs/hw/bcmfs5_rm.c:454–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452}
453
454static uint16_t
455bcmfs5_dequeue_qp(struct bcmfs_qp *qp, void **ops, uint16_t budget)
456{
457 int err;
458 uint16_t reqid;
459 uint64_t desc;
460 uint16_t count = 0;
461 unsigned long context = 0;
462 struct bcmfs_queue *hwq = &qp->cmpl_q;
463 uint32_t cmpl_read_offset, cmpl_write_offset;
464
465 /*
466 * Check whether budget is valid, else set the budget to maximum
467 * so that all the available completions will be processed.
468 */
469 if (budget > qp->nb_pending_requests)
470 budget = qp->nb_pending_requests;
471
472 /*
473 * Get current completion read and write offset
474 *
475 * Note: We should read completion write pointer at least once
476 * after we get a MSI interrupt because HW maintains internal
477 * MSI status which will allow next MSI interrupt only after
478 * completion write pointer is read.
479 */
480 cmpl_write_offset = FS_MMIO_READ32((uint8_t *)qp->ioreg + RING_CMPL_WRITE_PTR);
481 cmpl_write_offset *= FS_RING_DESC_SIZE;
482 cmpl_read_offset = hwq->cmpl_read_ptr;
483
484 /* read the ring cmpl write ptr before cmpl read offset */
485 rte_io_rmb();
486
487 /* For each completed request notify mailbox clients */
488 reqid = 0;
489 while ((cmpl_read_offset != cmpl_write_offset) && (budget > 0)) {
490 /* Dequeue next completion descriptor */
491 desc = *((uint64_t *)((uint8_t *)hwq->base_addr +
492 cmpl_read_offset));
493
494 /* Next read offset */
495 cmpl_read_offset += FS_RING_DESC_SIZE;
496 if (cmpl_read_offset == FS_RING_CMPL_SIZE)
497 cmpl_read_offset = 0;
498
499 /* Decode error from completion descriptor */
500 err = rm_cmpl_desc_to_error(desc);
501 if (err < 0)
502 BCMFS_DP_LOG(ERR, "error desc rcvd");
503
504 /* Determine request id from completion descriptor */
505 reqid = rm_cmpl_desc_to_reqid(desc);
506
507 /* Retrieve context */
508 context = qp->ctx_pool[reqid];
509 if (context == 0)
510 BCMFS_DP_LOG(ERR, "HW error detected");
511

Callers

nothing calls this directly

Calls 3

rm_cmpl_desc_to_errorFunction · 0.85
rm_cmpl_desc_to_reqidFunction · 0.85
rte_bitmap_setFunction · 0.85

Tested by

no test coverage detected