Commit f5393a56 authored by Xingui Yang's avatar Xingui Yang Committed by Martin K. Petersen
Browse files

scsi: hisi_sas: Fix normally completed I/O analysed as failed



The PIO read command has no response frame and the struct iu[1024] won't be
filled. I/Os which are normally completed will be treated as failed in
sas_ata_task_done() when iu contains abnormal dirty data.

Consequently ending_fis should not be filled by iu when the response frame
hasn't been written to memory.

Fixes: d380f555 ("scsi: hisi_sas: Don't bother clearing status buffer IU in task prep")
Signed-off-by: default avatarXingui Yang <yangxingui@huawei.com>
Signed-off-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1689045300-44318-2-git-send-email-chenxiang66@hisilicon.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a9814b6c
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -2026,6 +2026,11 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba,
	u16 dma_tx_err_type = le16_to_cpu(err_record->dma_tx_err_type);
	u16 sipc_rx_err_type = le16_to_cpu(err_record->sipc_rx_err_type);
	u32 dma_rx_err_type = le32_to_cpu(err_record->dma_rx_err_type);
	struct hisi_sas_complete_v2_hdr *complete_queue =
			hisi_hba->complete_hdr[slot->cmplt_queue];
	struct hisi_sas_complete_v2_hdr *complete_hdr =
			&complete_queue[slot->cmplt_queue_slot];
	u32 dw0 = le32_to_cpu(complete_hdr->dw0);
	int error = -1;

	if (err_phase == 1) {
@@ -2310,6 +2315,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba,
			break;
		}
		}
		if (dw0 & CMPLT_HDR_RSPNS_XFRD_MSK)
			hisi_sas_sata_done(task, slot);
	}
		break;
@@ -2443,6 +2449,7 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,
	case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:
	{
		ts->stat = SAS_SAM_STAT_GOOD;
		if (dw0 & CMPLT_HDR_RSPNS_XFRD_MSK)
			hisi_sas_sata_done(task, slot);
		break;
	}
+4 −2
Original line number Diff line number Diff line
@@ -2257,6 +2257,7 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task,
			ts->stat = SAS_OPEN_REJECT;
			ts->open_rej_reason = SAS_OREJ_RSVD_RETRY;
		}
		if (dw0 & CMPLT_HDR_RSPNS_XFRD_MSK)
			hisi_sas_sata_done(task, slot);
		break;
	case SAS_PROTOCOL_SMP:
@@ -2384,6 +2385,7 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,
	case SAS_PROTOCOL_STP:
	case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:
		ts->stat = SAS_SAM_STAT_GOOD;
		if (dw0 & CMPLT_HDR_RSPNS_XFRD_MSK)
			hisi_sas_sata_done(task, slot);
		break;
	default: