From: jack_wang Date: Sat, 19 Feb 2011 10:20:53 +0000 (+0800) Subject: [SCSI] libsas: fix loopback topology bug during discovery X-Git-Tag: firefly_0821_release~7613^2~2168^2~32 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=183ce896d726fb987da589fa8e36fb7214a494cc;p=firefly-linux-kernel-4.4.55.git [SCSI] libsas: fix loopback topology bug during discovery In some test envirenment, there is loopback topology test. We should handle this during discovery. Signed-off-by: Jack Wang Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 505ffe358293..f3f693b772ac 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -244,6 +244,11 @@ static int sas_ex_phy_discover_helper(struct domain_device *dev, u8 *disc_req, * dev to host FIS as described in section G.5 of * sas-2 r 04b */ dr = &((struct smp_resp *)disc_resp)->disc; + if (memcmp(dev->sas_addr, dr->attached_sas_addr, + SAS_ADDR_SIZE) == 0) { + sas_printk("Found loopback topology, just ignore it!\n"); + return 0; + } if (!(dr->attached_dev_type == 0 && dr->attached_sata_dev)) break;