[PATCH RFC v3 08/22] scsi: scsi_transport_sas: Alloc sdev for expander
From: John Garry
Date: Tue Oct 25 2022 - 05:50:38 EST
Allocate a scsi device for an expander for sending SMP commands on the
expander sdev request queue.
Use channel=1 to not conflict with scsi target devices.
Signed-off-by: John Garry <john.garry@xxxxxxxxxx>
---
drivers/scsi/scsi_transport_sas.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 2f88c61216ee..da075dfc7cd0 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -1548,6 +1548,11 @@ int sas_rphy_add(struct sas_rphy *rphy)
scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun,
SCSI_SCAN_INITIAL);
+ } else if (identify->device_type == SAS_EDGE_EXPANDER_DEVICE ||
+ identify->device_type == SAS_FANOUT_EXPANDER_DEVICE) {
+
+ if (!scsi_get_dev(&rphy->dev, 1, rphy->scsi_target_id, 0))
+ return -ENODEV;
}
return 0;
@@ -1627,6 +1632,7 @@ sas_rphy_remove(struct sas_rphy *rphy)
case SAS_EDGE_EXPANDER_DEVICE:
case SAS_FANOUT_EXPANDER_DEVICE:
sas_remove_children(dev);
+ scsi_remove_target(dev);
break;
default:
break;
--
2.35.3