Commit 4e188184 authored by Bader Ali Saleh's avatar Bader Ali Saleh Committed by Martin K. Petersen

scsi: hpsa: update discovery polling

Correct a corner case where newly created volumes are not detected
automatically on an external RAID controller that has no configured
volumes during initial device discovery.

The fix is to set the discovery_polling flag when an external RAID
controller is detected. This causes a device rescan every 20-30 seconds,
so that newly created volumes will be detected automatically.
Reviewed-by: default avatarScott Benesh <scott.benesh@microsemi.com>
Reviewed-by: default avatarScott Teel <scott.teel@microsemi.com>
Reviewed-by: default avatarKevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: default avatarDon Brace <don.brace@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b9b08cad
......@@ -3472,6 +3472,30 @@ static void hpsa_get_sas_address(struct ctlr_info *h, unsigned char *scsi3addr,
dev->sas_address = sa;
}
static void hpsa_ext_ctrl_present(struct ctlr_info *h,
struct ReportExtendedLUNdata *physdev)
{
u32 nphysicals;
int i;
if (h->discovery_polling)
return;
nphysicals = (get_unaligned_be32(physdev->LUNListLength) / 24) + 1;
for (i = 0; i < nphysicals; i++) {
if (physdev->LUN[i].device_type ==
BMIC_DEVICE_TYPE_CONTROLLER
&& !is_hba_lunid(physdev->LUN[i].lunid)) {
dev_info(&h->pdev->dev,
"External controller present, activate discovery polling and disable rld caching\n");
hpsa_disable_rld_caching(h);
h->discovery_polling = 1;
break;
}
}
}
/* Get a device id from inquiry page 0x83 */
static bool hpsa_vpd_page_supported(struct ctlr_info *h,
unsigned char scsi3addr[], u8 page)
......@@ -4228,6 +4252,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
*/
ndevs_to_allocate = nphysicals + nlogicals + MAX_EXT_TARGETS + 1;
hpsa_ext_ctrl_present(h, physdev_list);
/* Allocate the per device structures */
for (i = 0; i < ndevs_to_allocate; i++) {
if (i >= HPSA_MAX_DEVICES) {
......@@ -4298,18 +4324,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
figure_bus_target_lun(h, lunaddrbytes, tmpdevice);
this_device = currentsd[ncurrent];
/* Turn on discovery_polling if there are ext target devices.
* Event-based change notification is unreliable for those.
*/
if (!h->discovery_polling) {
if (tmpdevice->external) {
h->discovery_polling = 1;
dev_info(&h->pdev->dev,
"External target, activate discovery polling.\n");
}
}
*this_device = *tmpdevice;
this_device->physical_device = physical_device;
......@@ -8247,7 +8261,6 @@ static void hpsa_rescan_ctlr_worker(struct work_struct *work)
if (h->drv_req_rescan || hpsa_offline_devices_ready(h)) {
hpsa_perform_rescan(h);
} else if (h->discovery_polling) {
hpsa_disable_rld_caching(h);
if (hpsa_luns_changed(h)) {
dev_info(&h->pdev->dev,
"driver discovery polling rescan.\n");
......
......@@ -780,6 +780,8 @@ struct bmic_identify_physical_device {
u8 phys_bay_in_box; /* phys drv bay this drive resides */
__le32 rpm; /* Drive rotational speed in rpm */
u8 device_type; /* type of drive */
#define BMIC_DEVICE_TYPE_CONTROLLER 0x07
u8 sata_version; /* only valid when drive_type is SATA */
__le64 big_total_block_count;
__le64 ris_starting_lba;
......
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