/* This function looks up the iocb_lookup table to get the command iocb corresponding to the given iotag. This function is called with the hbalock held. This function returns the command iocb object if it finds the command iocb else returns NULL.  */
static struct lpfc_iocbq* lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint16_t iotag)
/* This function looks up the iocb_lookup table to get the command iocb corresponding to the given iotag. This function is called with the hbalock held. This function returns the command iocb object if it finds the command iocb else returns NULL.  */
static struct lpfc_iocbq* lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint16_t iotag)
{
	struct lpfc_iocbq *cmd_iocb;
	if (iotag != 0 && iotag <= phba->sli.last_iotag) {
		cmd_iocb = phba->sli.iocbq_lookup[iotag];
		list_del_init(&cmd_iocb->list);
		pring->txcmplq_cnt--;
		return cmd_iocb;
	}
	lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
			"0372 iotag x%x is out off range: max iotag (x%x)\n",
			iotag, phba->sli.last_iotag);
	return NULL;
}