-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhpsa-clean-up-queue-depth-getting-code
102 lines (97 loc) · 3.33 KB
/
hpsa-clean-up-queue-depth-getting-code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
hpsa: clean up queue depth getting code
From: Stephen M. Cameron <[email protected]>
This patch should be squashed with previous patch before sending upstream
---
drivers/scsi/hpsa.c | 52 ++++++++++++++++++++++++-----------------------
drivers/scsi/hpsa_cmd.h | 4 ++++
2 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 5e239f6..9008832 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3311,6 +3311,31 @@ static int hpsa_hba_mode_enabled(struct ctlr_info *h)
return hba_mode_enabled;
}
+/* get physical drive ioaccel handle and queue depth */
+void hpsa_get_ioaccel_drive_info(struct ctlr_info *h,
+ struct hpsa_scsi_dev_t *dev,
+ u8 *lunaddrbytes,
+ struct bmic_identify_physical_device *id_phys)
+{
+ int rc;
+ struct ext_report_lun_entry *rle =
+ (struct ext_report_lun_entry *) lunaddrbytes;
+
+ dev->ioaccel_handle = rle->ioaccel_handle;
+ memset(id_phys, 0, sizeof(*id_phys));
+ rc = hpsa_bmic_id_physical_device(h, lunaddrbytes,
+ GET_BMIC_DRIVE_NUMBER(lunaddrbytes), id_phys,
+ sizeof(*id_phys));
+ if (!rc)
+ /* Reserve space for FW operations */
+#define DRIVE_CMDS_RESERVED_FOR_FW 2
+ dev->queue_depth =
+ le16_to_cpu(id_phys->current_queue_depth_limit) -
+ DRIVE_CMDS_RESERVED_FOR_FW;
+ else
+ dev->queue_depth = 7; /* conservative */
+}
+
static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
{
/* the idea here is we could get notified
@@ -3333,9 +3358,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
int ncurrent = 0;
int i, n_ext_target_devs, ndevs_to_allocate;
int raid_ctlr_position;
- u8 bmic_bus;
- u8 bmic_lev_two_tgt;
- u16 bmic_drive_number;
int rescan_hba_mode;
DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS);
@@ -3477,28 +3499,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
}
if (h->transMethod & CFGTBL_Trans_io_accel1 ||
h->transMethod & CFGTBL_Trans_io_accel2) {
- int rc;
-
- memcpy(&this_device->ioaccel_handle,
- &lunaddrbytes[20],
- sizeof(this_device->ioaccel_handle));
- bmic_bus = lunaddrbytes[7] & 0x3F;
- bmic_lev_two_tgt = lunaddrbytes[6];
- bmic_drive_number = ((bmic_bus - 1) << 8) +
- bmic_lev_two_tgt;
-
- memset(id_phys, 0, sizeof(*id_phys));
- rc = hpsa_bmic_id_physical_device(h, lunaddrbytes,
- bmic_drive_number, id_phys,
- sizeof(*id_phys));
- if (!rc)
- /* Reserve space for FW operations */
-#define DRIVE_CMDS_RESERVED_FOR_FW 2
- this_device->queue_depth =
- le16_to_cpu(id_phys->current_queue_depth_limit) -
- DRIVE_CMDS_RESERVED_FOR_FW;
- else
- this_device->queue_depth = 7; /* conservative */
+ hpsa_get_ioaccel_drive_info(h, this_device,
+ lunaddrbytes, id_phys);
ncurrent++;
}
break;
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index 84f0e53..7df2346 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -250,6 +250,10 @@ struct ReportLUNdata {
struct ext_report_lun_entry {
u8 lunid[8];
#define MASKED_DEVICE(x) ((x)[3] & 0xC0)
+#define GET_BMIC_BUS(lunid) ((lunid)[7] & 0x3F)
+#define GET_BMIC_LEVEL_TWO_TARGET(lunid) ((lunid)[6])
+#define GET_BMIC_DRIVE_NUMBER(lunid) (((GET_BMIC_BUS((lunid)) - 1) << 8) + \
+ GET_BMIC_LEVEL_TWO_TARGET((lunid)))
u8 wwid[8];
u8 device_type;
u8 device_flags;