/* This routine releases @psb scsi buffer by adding it to tail of @phba lpfc_scsi_buf_list list. For SLI4 XRI's are tied to the scsi buffer and cannot be reused for at least RA_TOV amount of time if it was aborted.  */
static void lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb)
/* This routine releases @psb scsi buffer by adding it to tail of @phba lpfc_scsi_buf_list list. For SLI4 XRI's are tied to the scsi buffer and cannot be reused for at least RA_TOV amount of time if it was aborted.  */
static void lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb)
{
	unsigned long iflag = 0;
	if (psb->status == IOSTAT_LOCAL_REJECT
		&& psb->result == IOERR_ABORT_REQUESTED) {
		spin_lock_irqsave(&phba->sli4_hba.abts_scsi_buf_list_lock,
					iflag);
		psb->pCmd = NULL;
		list_add_tail(&psb->list,
			&phba->sli4_hba.lpfc_abts_scsi_buf_list);
		spin_unlock_irqrestore(&phba->sli4_hba.abts_scsi_buf_list_lock,
					iflag);
	} else {
		spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag);
		psb->pCmd = NULL;
		list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list);
		spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag);
	}
}