Commit e8bf3941 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[SCSI] scsi_transport_sas: kill the use of channel

Using the port_id for the channel is completely unnecessary since the
host_id/target_id are constructed to be globally unique.  Also move
the mptsas driver on to virtual channel 1 for its raid devices.
Acked-by: default avatar"Moore, Eric" <Eric.Moore@lsil.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent a0e1b6ef
...@@ -634,7 +634,6 @@ typedef struct _MPT_ADAPTER ...@@ -634,7 +634,6 @@ typedef struct _MPT_ADAPTER
u16 handle; u16 handle;
int sas_index; /* index refrencing */ int sas_index; /* index refrencing */
MPT_SAS_MGMT sas_mgmt; MPT_SAS_MGMT sas_mgmt;
int num_ports;
struct work_struct sas_persist_task; struct work_struct sas_persist_task;
struct work_struct fc_setup_reset_work; struct work_struct fc_setup_reset_work;
......
...@@ -67,6 +67,11 @@ ...@@ -67,6 +67,11 @@
#define my_VERSION MPT_LINUX_VERSION_COMMON #define my_VERSION MPT_LINUX_VERSION_COMMON
#define MYNAM "mptsas" #define MYNAM "mptsas"
/*
* Reserved channel for integrated raid
*/
#define MPTSAS_RAID_CHANNEL 1
MODULE_AUTHOR(MODULEAUTHOR); MODULE_AUTHOR(MODULEAUTHOR);
MODULE_DESCRIPTION(my_NAME); MODULE_DESCRIPTION(my_NAME);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -644,16 +649,13 @@ mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure, ...@@ -644,16 +649,13 @@ mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
static int static int
mptsas_slave_configure(struct scsi_device *sdev) mptsas_slave_configure(struct scsi_device *sdev)
{ {
struct Scsi_Host *host = sdev->host;
MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
/* if (sdev->channel == MPTSAS_RAID_CHANNEL)
* RAID volumes placed beyond the last expected port. goto out;
* Ignore sending sas mode pages in that case..
*/ sas_read_port_mode_page(sdev);
if (sdev->channel < hd->ioc->num_ports)
sas_read_port_mode_page(sdev);
out:
return mptscsih_slave_configure(sdev); return mptscsih_slave_configure(sdev);
} }
...@@ -682,10 +684,7 @@ mptsas_target_alloc(struct scsi_target *starget) ...@@ -682,10 +684,7 @@ mptsas_target_alloc(struct scsi_target *starget)
hd->Targets[target_id] = vtarget; hd->Targets[target_id] = vtarget;
/* if (starget->channel == MPTSAS_RAID_CHANNEL)
* RAID volumes placed beyond the last expected port.
*/
if (starget->channel == hd->ioc->num_ports)
goto out; goto out;
rphy = dev_to_rphy(starget->dev.parent); rphy = dev_to_rphy(starget->dev.parent);
...@@ -736,7 +735,7 @@ mptsas_target_destroy(struct scsi_target *starget) ...@@ -736,7 +735,7 @@ mptsas_target_destroy(struct scsi_target *starget)
if (!starget->hostdata) if (!starget->hostdata)
return; return;
if (starget->channel == hd->ioc->num_ports) if (starget->channel == MPTSAS_RAID_CHANNEL)
goto out; goto out;
rphy = dev_to_rphy(starget->dev.parent); rphy = dev_to_rphy(starget->dev.parent);
...@@ -776,10 +775,7 @@ mptsas_slave_alloc(struct scsi_device *sdev) ...@@ -776,10 +775,7 @@ mptsas_slave_alloc(struct scsi_device *sdev)
starget = scsi_target(sdev); starget = scsi_target(sdev);
vdev->vtarget = starget->hostdata; vdev->vtarget = starget->hostdata;
/* if (sdev->channel == MPTSAS_RAID_CHANNEL)
* RAID volumes placed beyond the last expected port.
*/
if (sdev->channel == hd->ioc->num_ports)
goto out; goto out;
rphy = dev_to_rphy(sdev->sdev_target->dev.parent); rphy = dev_to_rphy(sdev->sdev_target->dev.parent);
...@@ -1728,7 +1724,6 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc) ...@@ -1728,7 +1724,6 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
hba = NULL; hba = NULL;
} }
mutex_unlock(&ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
ioc->num_ports = port_info->num_phys;
for (i = 0; i < port_info->num_phys; i++) { for (i = 0; i < port_info->num_phys; i++) {
mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i], mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i],
...@@ -1977,7 +1972,7 @@ mptsas_scan_sas_topology(MPT_ADAPTER *ioc) ...@@ -1977,7 +1972,7 @@ mptsas_scan_sas_topology(MPT_ADAPTER *ioc)
if (!ioc->raid_data.pIocPg2->NumActiveVolumes) if (!ioc->raid_data.pIocPg2->NumActiveVolumes)
goto out; goto out;
for (i=0; i<ioc->raid_data.pIocPg2->NumActiveVolumes; i++) { for (i=0; i<ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
scsi_add_device(ioc->sh, ioc->num_ports, scsi_add_device(ioc->sh, MPTSAS_RAID_CHANNEL,
ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0); ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0);
} }
out: out:
...@@ -2283,35 +2278,26 @@ mptsas_hotplug_work(void *arg) ...@@ -2283,35 +2278,26 @@ mptsas_hotplug_work(void *arg)
mptsas_set_rphy(phy_info, rphy); mptsas_set_rphy(phy_info, rphy);
break; break;
case MPTSAS_ADD_RAID: case MPTSAS_ADD_RAID:
sdev = scsi_device_lookup( sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL,
ioc->sh, ev->id, 0);
ioc->num_ports,
ev->id,
0);
if (sdev) { if (sdev) {
scsi_device_put(sdev); scsi_device_put(sdev);
break; break;
} }
printk(MYIOC_s_INFO_FMT printk(MYIOC_s_INFO_FMT
"attaching raid volume, channel %d, id %d\n", "attaching raid volume, channel %d, id %d\n",
ioc->name, ioc->num_ports, ev->id); ioc->name, MPTSAS_RAID_CHANNEL, ev->id);
scsi_add_device(ioc->sh, scsi_add_device(ioc->sh, MPTSAS_RAID_CHANNEL, ev->id, 0);
ioc->num_ports,
ev->id,
0);
mpt_findImVolumes(ioc); mpt_findImVolumes(ioc);
break; break;
case MPTSAS_DEL_RAID: case MPTSAS_DEL_RAID:
sdev = scsi_device_lookup( sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL,
ioc->sh, ev->id, 0);
ioc->num_ports,
ev->id,
0);
if (!sdev) if (!sdev)
break; break;
printk(MYIOC_s_INFO_FMT printk(MYIOC_s_INFO_FMT
"removing raid volume, channel %d, id %d\n", "removing raid volume, channel %d, id %d\n",
ioc->name, ioc->num_ports, ev->id); ioc->name, MPTSAS_RAID_CHANNEL, ev->id);
vdevice = sdev->hostdata; vdevice = sdev->hostdata;
vdevice->vtarget->deleted = 1; vdevice->vtarget->deleted = 1;
mptsas_target_reset(ioc, vdevice->vtarget); mptsas_target_reset(ioc, vdevice->vtarget);
......
...@@ -1194,7 +1194,7 @@ int sas_rphy_add(struct sas_rphy *rphy) ...@@ -1194,7 +1194,7 @@ int sas_rphy_add(struct sas_rphy *rphy)
if (identify->device_type == SAS_END_DEVICE && if (identify->device_type == SAS_END_DEVICE &&
rphy->scsi_target_id != -1) { rphy->scsi_target_id != -1) {
scsi_scan_target(&rphy->dev, parent->port_identifier, scsi_scan_target(&rphy->dev, 0,
rphy->scsi_target_id, ~0, 0); rphy->scsi_target_id, ~0, 0);
} }
...@@ -1296,15 +1296,13 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel, ...@@ -1296,15 +1296,13 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
mutex_lock(&sas_host->lock); mutex_lock(&sas_host->lock);
list_for_each_entry(rphy, &sas_host->rphy_list, list) { list_for_each_entry(rphy, &sas_host->rphy_list, list) {
struct sas_port *parent = dev_to_sas_port(rphy->dev.parent);
if (rphy->identify.device_type != SAS_END_DEVICE || if (rphy->identify.device_type != SAS_END_DEVICE ||
rphy->scsi_target_id == -1) rphy->scsi_target_id == -1)
continue; continue;
if ((channel == SCAN_WILD_CARD || channel == parent->port_identifier) && if ((channel == SCAN_WILD_CARD || channel == 0) &&
(id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) { (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) {
scsi_scan_target(&rphy->dev, parent->port_identifier, scsi_scan_target(&rphy->dev, 0,
rphy->scsi_target_id, lun, 1); rphy->scsi_target_id, lun, 1);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment