/* This routine will get the first valid Completion Queue Entry from @q, update the queue's internal hba index, and return the CQE. If no valid CQEs are in the Queue (no more work to do), or the Queue is full of CQEs that have been processed, but not popped back to the HBA then this routine will return NULL.  */
static struct lpfc_cqe* lpfc_sli4_cq_get(struct lpfc_queue *q)
/* This routine will get the first valid Completion Queue Entry from @q, update the queue's internal hba index, and return the CQE. If no valid CQEs are in the Queue (no more work to do), or the Queue is full of CQEs that have been processed, but not popped back to the HBA then this routine will return NULL.  */
static struct lpfc_cqe* lpfc_sli4_cq_get(struct lpfc_queue *q)
{
	struct lpfc_cqe *cqe;
	if (!bf_get(lpfc_cqe_valid, q->qe[q->hba_index].cqe))
		return NULL;
	if (((q->hba_index + 1) % q->entry_count) == q->host_index)
		return NULL;
	cqe = q->qe[q->hba_index].cqe;
	q->hba_index = ((q->hba_index + 1) % q->entry_count);
	return cqe;
}