/* This function looks up the iocb_lookup table to get the command iocb corresponding to the given response iocb using the iotag of the response iocb. 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(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *prspiocb)
/* This function looks up the iocb_lookup table to get the command iocb corresponding to the given response iocb using the iotag of the response iocb. 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(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *prspiocb)
{
	struct lpfc_iocbq *cmd_iocb = NULL;
	uint16_t iotag;
	iotag = prspiocb->iocb.ulpIoTag;
	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,
			"0317 iotag x%x is out off "
			"range: max iotag x%x wd0 x%x\n",
			iotag, phba->sli.last_iotag,
			*(((uint32_t *) &prspiocb->iocb) + 7));
	return NULL;
}