aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa_cmd.h
diff options
context:
space:
mode:
authorDon Brace <don.brace@pmcs.com>2015-01-23 17:43:30 -0500
committerJames Bottomley <JBottomley@Parallels.com>2015-02-02 12:57:40 -0500
commit03383736348bb73a45f8460afca3c5f5bd1be172 (patch)
treebd4d9b4450027d3f9f4f259d60c000558a68d7f4 /drivers/scsi/hpsa_cmd.h
parent080ef1cc7fdf5d0800775c8626718da807e7ba99 (diff)
hpsa: honor queue depth of physical devices
When using the ioaccel submission methods, requests destined for RAID volumes are sometimes diverted to physical devices. The OS has no or limited knowledge of these physical devices, so it is up to the driver to avoid pushing the device too hard. It is better to honor the physical device queue limit rather than making the device spew zillions of TASK SET FULL responses. This is so that hpsa based devices support /sys/block/sdNN/device/queue_type of simple, which lets the SCSI midlayer automatically adjust the queue_depth based on TASK SET FULL and GOOD status. Adjust the queue depth for a new device after it is created based on the maximum queue depths of the physical devices that constitute the device. This drops the maximum queue depth from .can_queue of 1024 to something like 174 for single-drive RAID-0, 348 for two-drive RAID-1, etc. It also adjusts for the ratio of data to parity drives. Reviewed-by: Scott Teel <scott.teel@pmcs.com> Signed-off-by: Webb Scales <webbnh@hp.com> Signed-off-by: Don Brace <don.brace@pmcs.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/hpsa_cmd.h')
-rw-r--r--drivers/scsi/hpsa_cmd.h148
1 files changed, 148 insertions, 0 deletions
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index 3f2f0af6abb2..4726dbb67fa3 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -240,6 +240,10 @@ struct ReportLUNdata {
240 240
241struct ext_report_lun_entry { 241struct ext_report_lun_entry {
242 u8 lunid[8]; 242 u8 lunid[8];
243#define GET_BMIC_BUS(lunid) ((lunid)[7] & 0x3F)
244#define GET_BMIC_LEVEL_TWO_TARGET(lunid) ((lunid)[6])
245#define GET_BMIC_DRIVE_NUMBER(lunid) (((GET_BMIC_BUS((lunid)) - 1) << 8) + \
246 GET_BMIC_LEVEL_TWO_TARGET((lunid)))
243 u8 wwid[8]; 247 u8 wwid[8];
244 u8 device_type; 248 u8 device_type;
245 u8 device_flags; 249 u8 device_flags;
@@ -268,6 +272,7 @@ struct SenseSubsystem_info {
268#define HPSA_CACHE_FLUSH 0x01 /* C2 was already being used by HPSA */ 272#define HPSA_CACHE_FLUSH 0x01 /* C2 was already being used by HPSA */
269#define BMIC_FLASH_FIRMWARE 0xF7 273#define BMIC_FLASH_FIRMWARE 0xF7
270#define BMIC_SENSE_CONTROLLER_PARAMETERS 0x64 274#define BMIC_SENSE_CONTROLLER_PARAMETERS 0x64
275#define BMIC_IDENTIFY_PHYSICAL_DEVICE 0x15
271 276
272/* Command List Structure */ 277/* Command List Structure */
273union SCSI3Addr { 278union SCSI3Addr {
@@ -405,6 +410,17 @@ struct CommandList {
405 struct completion *waiting; 410 struct completion *waiting;
406 void *scsi_cmd; 411 void *scsi_cmd;
407 struct work_struct work; 412 struct work_struct work;
413
414 /*
415 * For commands using either of the two "ioaccel" paths to
416 * bypass the RAID stack and go directly to the physical disk
417 * phys_disk is a pointer to the hpsa_scsi_dev_t to which the
418 * i/o is destined. We need to store that here because the command
419 * may potentially encounter TASK SET FULL and need to be resubmitted
420 * For "normal" i/o's not using the "ioaccel" paths, phys_disk is
421 * not used.
422 */
423 struct hpsa_scsi_dev_t *phys_disk;
408} __aligned(COMMANDLIST_ALIGNMENT); 424} __aligned(COMMANDLIST_ALIGNMENT);
409 425
410/* Max S/G elements in I/O accelerator command */ 426/* Max S/G elements in I/O accelerator command */
@@ -641,5 +657,137 @@ struct hpsa_pci_info {
641 u32 board_id; 657 u32 board_id;
642}; 658};
643 659
660struct bmic_identify_physical_device {
661 u8 scsi_bus; /* SCSI Bus number on controller */
662 u8 scsi_id; /* SCSI ID on this bus */
663 __le16 block_size; /* sector size in bytes */
664 __le32 total_blocks; /* number for sectors on drive */
665 __le32 reserved_blocks; /* controller reserved (RIS) */
666 u8 model[40]; /* Physical Drive Model */
667 u8 serial_number[40]; /* Drive Serial Number */
668 u8 firmware_revision[8]; /* drive firmware revision */
669 u8 scsi_inquiry_bits; /* inquiry byte 7 bits */
670 u8 compaq_drive_stamp; /* 0 means drive not stamped */
671 u8 last_failure_reason;
672#define BMIC_LAST_FAILURE_TOO_SMALL_IN_LOAD_CONFIG 0x01
673#define BMIC_LAST_FAILURE_ERROR_ERASING_RIS 0x02
674#define BMIC_LAST_FAILURE_ERROR_SAVING_RIS 0x03
675#define BMIC_LAST_FAILURE_FAIL_DRIVE_COMMAND 0x04
676#define BMIC_LAST_FAILURE_MARK_BAD_FAILED 0x05
677#define BMIC_LAST_FAILURE_MARK_BAD_FAILED_IN_FINISH_REMAP 0x06
678#define BMIC_LAST_FAILURE_TIMEOUT 0x07
679#define BMIC_LAST_FAILURE_AUTOSENSE_FAILED 0x08
680#define BMIC_LAST_FAILURE_MEDIUM_ERROR_1 0x09
681#define BMIC_LAST_FAILURE_MEDIUM_ERROR_2 0x0a
682#define BMIC_LAST_FAILURE_NOT_READY_BAD_SENSE 0x0b
683#define BMIC_LAST_FAILURE_NOT_READY 0x0c
684#define BMIC_LAST_FAILURE_HARDWARE_ERROR 0x0d
685#define BMIC_LAST_FAILURE_ABORTED_COMMAND 0x0e
686#define BMIC_LAST_FAILURE_WRITE_PROTECTED 0x0f
687#define BMIC_LAST_FAILURE_SPIN_UP_FAILURE_IN_RECOVER 0x10
688#define BMIC_LAST_FAILURE_REBUILD_WRITE_ERROR 0x11
689#define BMIC_LAST_FAILURE_TOO_SMALL_IN_HOT_PLUG 0x12
690#define BMIC_LAST_FAILURE_BUS_RESET_RECOVERY_ABORTED 0x13
691#define BMIC_LAST_FAILURE_REMOVED_IN_HOT_PLUG 0x14
692#define BMIC_LAST_FAILURE_INIT_REQUEST_SENSE_FAILED 0x15
693#define BMIC_LAST_FAILURE_INIT_START_UNIT_FAILED 0x16
694#define BMIC_LAST_FAILURE_INQUIRY_FAILED 0x17
695#define BMIC_LAST_FAILURE_NON_DISK_DEVICE 0x18
696#define BMIC_LAST_FAILURE_READ_CAPACITY_FAILED 0x19
697#define BMIC_LAST_FAILURE_INVALID_BLOCK_SIZE 0x1a
698#define BMIC_LAST_FAILURE_HOT_PLUG_REQUEST_SENSE_FAILED 0x1b
699#define BMIC_LAST_FAILURE_HOT_PLUG_START_UNIT_FAILED 0x1c
700#define BMIC_LAST_FAILURE_WRITE_ERROR_AFTER_REMAP 0x1d
701#define BMIC_LAST_FAILURE_INIT_RESET_RECOVERY_ABORTED 0x1e
702#define BMIC_LAST_FAILURE_DEFERRED_WRITE_ERROR 0x1f
703#define BMIC_LAST_FAILURE_MISSING_IN_SAVE_RIS 0x20
704#define BMIC_LAST_FAILURE_WRONG_REPLACE 0x21
705#define BMIC_LAST_FAILURE_GDP_VPD_INQUIRY_FAILED 0x22
706#define BMIC_LAST_FAILURE_GDP_MODE_SENSE_FAILED 0x23
707#define BMIC_LAST_FAILURE_DRIVE_NOT_IN_48BIT_MODE 0x24
708#define BMIC_LAST_FAILURE_DRIVE_TYPE_MIX_IN_HOT_PLUG 0x25
709#define BMIC_LAST_FAILURE_DRIVE_TYPE_MIX_IN_LOAD_CFG 0x26
710#define BMIC_LAST_FAILURE_PROTOCOL_ADAPTER_FAILED 0x27
711#define BMIC_LAST_FAILURE_FAULTY_ID_BAY_EMPTY 0x28
712#define BMIC_LAST_FAILURE_FAULTY_ID_BAY_OCCUPIED 0x29
713#define BMIC_LAST_FAILURE_FAULTY_ID_INVALID_BAY 0x2a
714#define BMIC_LAST_FAILURE_WRITE_RETRIES_FAILED 0x2b
715
716#define BMIC_LAST_FAILURE_SMART_ERROR_REPORTED 0x37
717#define BMIC_LAST_FAILURE_PHY_RESET_FAILED 0x38
718#define BMIC_LAST_FAILURE_ONLY_ONE_CTLR_CAN_SEE_DRIVE 0x40
719#define BMIC_LAST_FAILURE_KC_VOLUME_FAILED 0x41
720#define BMIC_LAST_FAILURE_UNEXPECTED_REPLACEMENT 0x42
721#define BMIC_LAST_FAILURE_OFFLINE_ERASE 0x80
722#define BMIC_LAST_FAILURE_OFFLINE_TOO_SMALL 0x81
723#define BMIC_LAST_FAILURE_OFFLINE_DRIVE_TYPE_MIX 0x82
724#define BMIC_LAST_FAILURE_OFFLINE_ERASE_COMPLETE 0x83
725
726 u8 flags;
727 u8 more_flags;
728 u8 scsi_lun; /* SCSI LUN for phys drive */
729 u8 yet_more_flags;
730 u8 even_more_flags;
731 __le32 spi_speed_rules;/* SPI Speed data:Ultra disable diagnose */
732 u8 phys_connector[2]; /* connector number on controller */
733 u8 phys_box_on_bus; /* phys enclosure this drive resides */
734 u8 phys_bay_in_box; /* phys drv bay this drive resides */
735 __le32 rpm; /* Drive rotational speed in rpm */
736 u8 device_type; /* type of drive */
737 u8 sata_version; /* only valid when drive_type is SATA */
738 __le64 big_total_block_count;
739 __le64 ris_starting_lba;
740 __le32 ris_size;
741 u8 wwid[20];
742 u8 controller_phy_map[32];
743 __le16 phy_count;
744 u8 phy_connected_dev_type[256];
745 u8 phy_to_drive_bay_num[256];
746 __le16 phy_to_attached_dev_index[256];
747 u8 box_index;
748 u8 reserved;
749 __le16 extra_physical_drive_flags;
750#define BMIC_PHYS_DRIVE_SUPPORTS_GAS_GAUGE(idphydrv) \
751 (idphydrv->extra_physical_drive_flags & (1 << 10))
752 u8 negotiated_link_rate[256];
753 u8 phy_to_phy_map[256];
754 u8 redundant_path_present_map;
755 u8 redundant_path_failure_map;
756 u8 active_path_number;
757 __le16 alternate_paths_phys_connector[8];
758 u8 alternate_paths_phys_box_on_port[8];
759 u8 multi_lun_device_lun_count;
760 u8 minimum_good_fw_revision[8];
761 u8 unique_inquiry_bytes[20];
762 u8 current_temperature_degreesC;
763 u8 temperature_threshold_degreesC;
764 u8 max_temperature_degreesC;
765 u8 logical_blocks_per_phys_block_exp; /* phyblocksize = 512*2^exp */
766 __le16 current_queue_depth_limit;
767 u8 switch_name[10];
768 __le16 switch_port;
769 u8 alternate_paths_switch_name[40];
770 u8 alternate_paths_switch_port[8];
771 __le16 power_on_hours; /* valid only if gas gauge supported */
772 __le16 percent_endurance_used; /* valid only if gas gauge supported. */
773#define BMIC_PHYS_DRIVE_SSD_WEAROUT(idphydrv) \
774 ((idphydrv->percent_endurance_used & 0x80) || \
775 (idphydrv->percent_endurance_used > 10000))
776 u8 drive_authentication;
777#define BMIC_PHYS_DRIVE_AUTHENTICATED(idphydrv) \
778 (idphydrv->drive_authentication == 0x80)
779 u8 smart_carrier_authentication;
780#define BMIC_SMART_CARRIER_AUTHENTICATION_SUPPORTED(idphydrv) \
781 (idphydrv->smart_carrier_authentication != 0x0)
782#define BMIC_SMART_CARRIER_AUTHENTICATED(idphydrv) \
783 (idphydrv->smart_carrier_authentication == 0x01)
784 u8 smart_carrier_app_fw_version;
785 u8 smart_carrier_bootloader_fw_version;
786 u8 encryption_key_name[64];
787 __le32 misc_drive_flags;
788 __le16 dek_index;
789 u8 padding[112];
790};
791
644#pragma pack() 792#pragma pack()
645#endif /* HPSA_CMD_H */ 793#endif /* HPSA_CMD_H */