scsi: hisi_sas: allocate different SAS address for directly attached situation
authorXiang Chen <chenxiang66@hisilicon.com>
Thu, 11 Apr 2019 12:46:40 +0000 (20:46 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 13 Apr 2019 01:30:12 +0000 (21:30 -0400)
In commit 8b8d66531555 ("scsi: hisi_sas: make SAS address of SATA disks
unique"), we ensured that each SATA disk in the system has a unique SAS
address, even if it is fake. That was for v2 hw.

Add this for v3 hw.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index 3b33816ea6e68401dc29b23cf8c45109f564a966..89551b772cd4d0963bfff70423e30c3ddb5e16ba 100644 (file)
@@ -1380,6 +1380,7 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba)
                struct hisi_sas_initial_fis *initial_fis;
                struct dev_to_host_fis *fis;
                u8 attached_sas_addr[SAS_ADDR_SIZE] = {0};
+               struct Scsi_Host *shost = hisi_hba->shost;
 
                dev_info(dev, "phyup: phy%d link_rate=%d(sata)\n", phy_no, link_rate);
                initial_fis = &hisi_hba->initial_fis[phy_no];
@@ -1396,6 +1397,7 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba)
 
                sas_phy->oob_mode = SATA_OOB_MODE;
                attached_sas_addr[0] = 0x50;
+               attached_sas_addr[6] = shost->host_no;
                attached_sas_addr[7] = phy_no;
                memcpy(sas_phy->attached_sas_addr,
                       attached_sas_addr,