Skip to content

Commit 5f36bd8

Browse files
Merge patch series "smartpqi updates"
Don Brace <[email protected]> says: These patches are based on Martin Petersen's 6.11/scsi-queue tree https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 6.11/scsi-queue The functional changes of note to smartpqi are for: multipath failover and improving the accuracy of our RAID bypass counter. For multipath we are: Reverting commit 94a68c8 ("scsi: smartpqi: Quickly propagate path failures to SCSI midlayer") because under certain rare conditions involving encryption-enabled devices, a false path failure is reported to the SML causing multipath to failover to the other path. Improving errors returned from the driver back to the SML by checking for error codes returned from the firmware and returning the correct ASC/ASCQ codes to the SML. The other two patches add PCI-IDs for new controllers and change the driver version. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 52448d5 + 5b4ded3 commit 5f36bd8

File tree

2 files changed

+151
-27
lines changed

2 files changed

+151
-27
lines changed

drivers/scsi/smartpqi/smartpqi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ struct pqi_scsi_dev {
11581158

11591159
struct pqi_stream_data stream_data[NUM_STREAMS_PER_LUN];
11601160
atomic_t scsi_cmds_outstanding[PQI_MAX_LUNS_PER_DEVICE];
1161-
unsigned int raid_bypass_cnt;
1161+
u64 __percpu *raid_bypass_cnt;
11621162

11631163
struct pqi_tmf_work tmf_work[PQI_MAX_LUNS_PER_DEVICE];
11641164
};

drivers/scsi/smartpqi/smartpqi_init.c

Lines changed: 150 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
#define BUILD_TIMESTAMP
3434
#endif
3535

36-
#define DRIVER_VERSION "2.1.26-030"
36+
#define DRIVER_VERSION "2.1.28-025"
3737
#define DRIVER_MAJOR 2
3838
#define DRIVER_MINOR 1
39-
#define DRIVER_RELEASE 26
40-
#define DRIVER_REVISION 30
39+
#define DRIVER_RELEASE 28
40+
#define DRIVER_REVISION 25
4141

4242
#define DRIVER_NAME "Microchip SmartPQI Driver (v" \
4343
DRIVER_VERSION BUILD_TIMESTAMP ")"
@@ -1508,6 +1508,12 @@ static int pqi_get_raid_map(struct pqi_ctrl_info *ctrl_info,
15081508
if (rc)
15091509
goto error;
15101510

1511+
device->raid_bypass_cnt = alloc_percpu(u64);
1512+
if (!device->raid_bypass_cnt) {
1513+
rc = -ENOMEM;
1514+
goto error;
1515+
}
1516+
15111517
device->raid_map = raid_map;
15121518

15131519
return 0;
@@ -2099,6 +2105,10 @@ static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info,
20992105
/* To prevent this from being freed later. */
21002106
new_device->raid_map = NULL;
21012107
}
2108+
if (new_device->raid_bypass_enabled && existing_device->raid_bypass_cnt == NULL) {
2109+
existing_device->raid_bypass_cnt = new_device->raid_bypass_cnt;
2110+
new_device->raid_bypass_cnt = NULL;
2111+
}
21022112
existing_device->raid_bypass_configured = new_device->raid_bypass_configured;
21032113
existing_device->raid_bypass_enabled = new_device->raid_bypass_enabled;
21042114
}
@@ -2121,6 +2131,7 @@ static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info,
21212131
static inline void pqi_free_device(struct pqi_scsi_dev *device)
21222132
{
21232133
if (device) {
2134+
free_percpu(device->raid_bypass_cnt);
21242135
kfree(device->raid_map);
21252136
kfree(device);
21262137
}
@@ -2354,14 +2365,6 @@ static inline void pqi_mask_device(u8 *scsi3addr)
23542365
scsi3addr[3] |= 0xc0;
23552366
}
23562367

2357-
static inline bool pqi_is_multipath_device(struct pqi_scsi_dev *device)
2358-
{
2359-
if (pqi_is_logical_device(device))
2360-
return false;
2361-
2362-
return (device->path_map & (device->path_map - 1)) != 0;
2363-
}
2364-
23652368
static inline bool pqi_expose_device(struct pqi_scsi_dev *device)
23662369
{
23672370
return !device->is_physical_device || !pqi_skip_device(device->scsi3addr);
@@ -3244,6 +3247,20 @@ static void pqi_process_raid_io_error(struct pqi_io_request *io_request)
32443247
sense_data_length);
32453248
}
32463249

3250+
if (pqi_cmd_priv(scmd)->this_residual &&
3251+
!pqi_is_logical_device(scmd->device->hostdata) &&
3252+
scsi_status == SAM_STAT_CHECK_CONDITION &&
3253+
host_byte == DID_OK &&
3254+
sense_data_length &&
3255+
scsi_normalize_sense(error_info->data, sense_data_length, &sshdr) &&
3256+
sshdr.sense_key == ILLEGAL_REQUEST &&
3257+
sshdr.asc == 0x26 &&
3258+
sshdr.ascq == 0x0) {
3259+
host_byte = DID_NO_CONNECT;
3260+
pqi_take_device_offline(scmd->device, "AIO");
3261+
scsi_build_sense_buffer(0, scmd->sense_buffer, HARDWARE_ERROR, 0x3e, 0x1);
3262+
}
3263+
32473264
scmd->result = scsi_status;
32483265
set_host_byte(scmd, host_byte);
32493266
}
@@ -3258,14 +3275,12 @@ static void pqi_process_aio_io_error(struct pqi_io_request *io_request)
32583275
int residual_count;
32593276
int xfer_count;
32603277
bool device_offline;
3261-
struct pqi_scsi_dev *device;
32623278

32633279
scmd = io_request->scmd;
32643280
error_info = io_request->error_info;
32653281
host_byte = DID_OK;
32663282
sense_data_length = 0;
32673283
device_offline = false;
3268-
device = scmd->device->hostdata;
32693284

32703285
switch (error_info->service_response) {
32713286
case PQI_AIO_SERV_RESPONSE_COMPLETE:
@@ -3290,14 +3305,8 @@ static void pqi_process_aio_io_error(struct pqi_io_request *io_request)
32903305
break;
32913306
case PQI_AIO_STATUS_AIO_PATH_DISABLED:
32923307
pqi_aio_path_disabled(io_request);
3293-
if (pqi_is_multipath_device(device)) {
3294-
pqi_device_remove_start(device);
3295-
host_byte = DID_NO_CONNECT;
3296-
scsi_status = SAM_STAT_CHECK_CONDITION;
3297-
} else {
3298-
scsi_status = SAM_STAT_GOOD;
3299-
io_request->status = -EAGAIN;
3300-
}
3308+
scsi_status = SAM_STAT_GOOD;
3309+
io_request->status = -EAGAIN;
33013310
break;
33023311
case PQI_AIO_STATUS_NO_PATH_TO_DEVICE:
33033312
case PQI_AIO_STATUS_INVALID_DEVICE:
@@ -6007,6 +6016,7 @@ static int pqi_scsi_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scm
60076016
u16 hw_queue;
60086017
struct pqi_queue_group *queue_group;
60096018
bool raid_bypassed;
6019+
u64 *raid_bypass_cnt;
60106020
u8 lun;
60116021

60126022
scmd->host_scribble = PQI_NO_COMPLETION;
@@ -6025,7 +6035,7 @@ static int pqi_scsi_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scm
60256035

60266036
ctrl_info = shost_to_hba(shost);
60276037

6028-
if (pqi_ctrl_offline(ctrl_info) || pqi_device_in_remove(device)) {
6038+
if (pqi_ctrl_offline(ctrl_info) || pqi_device_offline(device) || pqi_device_in_remove(device)) {
60296039
set_host_byte(scmd, DID_NO_CONNECT);
60306040
pqi_scsi_done(scmd);
60316041
return 0;
@@ -6053,7 +6063,8 @@ static int pqi_scsi_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scm
60536063
rc = pqi_raid_bypass_submit_scsi_cmd(ctrl_info, device, scmd, queue_group);
60546064
if (rc == 0 || rc == SCSI_MLQUEUE_HOST_BUSY) {
60556065
raid_bypassed = true;
6056-
device->raid_bypass_cnt++;
6066+
raid_bypass_cnt = per_cpu_ptr(device->raid_bypass_cnt, smp_processor_id());
6067+
(*raid_bypass_cnt)++;
60576068
}
60586069
}
60596070
if (!raid_bypassed)
@@ -7350,7 +7361,9 @@ static ssize_t pqi_raid_bypass_cnt_show(struct device *dev,
73507361
struct scsi_device *sdev;
73517362
struct pqi_scsi_dev *device;
73527363
unsigned long flags;
7353-
unsigned int raid_bypass_cnt;
7364+
u64 raid_bypass_cnt;
7365+
int cpu;
7366+
u64 *per_cpu_bypass_cnt_ptr;
73547367

73557368
sdev = to_scsi_device(dev);
73567369
ctrl_info = shost_to_hba(sdev->host);
@@ -7366,11 +7379,18 @@ static ssize_t pqi_raid_bypass_cnt_show(struct device *dev,
73667379
return -ENODEV;
73677380
}
73687381

7369-
raid_bypass_cnt = device->raid_bypass_cnt;
7382+
raid_bypass_cnt = 0;
7383+
7384+
if (device->raid_bypass_cnt) {
7385+
for_each_online_cpu(cpu) {
7386+
per_cpu_bypass_cnt_ptr = per_cpu_ptr(device->raid_bypass_cnt, cpu);
7387+
raid_bypass_cnt += *per_cpu_bypass_cnt_ptr;
7388+
}
7389+
}
73707390

73717391
spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
73727392

7373-
return scnprintf(buffer, PAGE_SIZE, "0x%x\n", raid_bypass_cnt);
7393+
return scnprintf(buffer, PAGE_SIZE, "0x%llx\n", raid_bypass_cnt);
73747394
}
73757395

73767396
static ssize_t pqi_sas_ncq_prio_enable_show(struct device *dev,
@@ -9472,6 +9492,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {
94729492
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
94739493
0x193d, 0x110b)
94749494
},
9495+
{
9496+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
9497+
0x193d, 0x1110)
9498+
},
94759499
{
94769500
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
94779501
0x193d, 0x8460)
@@ -9588,6 +9612,14 @@ static const struct pci_device_id pqi_pci_id_table[] = {
95889612
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
95899613
0x1bd4, 0x0089)
95909614
},
9615+
{
9616+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
9617+
0x1ff9, 0x00a1)
9618+
},
9619+
{
9620+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
9621+
0x1f3a, 0x0104)
9622+
},
95919623
{
95929624
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
95939625
0x19e5, 0xd227)
@@ -10180,6 +10212,98 @@ static const struct pci_device_id pqi_pci_id_table[] = {
1018010212
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
1018110213
0x1137, 0x02fa)
1018210214
},
10215+
{
10216+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10217+
0x1ff9, 0x0045)
10218+
},
10219+
{
10220+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10221+
0x1ff9, 0x0046)
10222+
},
10223+
{
10224+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10225+
0x1ff9, 0x0047)
10226+
},
10227+
{
10228+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10229+
0x1ff9, 0x0048)
10230+
},
10231+
{
10232+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10233+
0x1ff9, 0x004a)
10234+
},
10235+
{
10236+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10237+
0x1ff9, 0x004b)
10238+
},
10239+
{
10240+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10241+
0x1ff9, 0x004c)
10242+
},
10243+
{
10244+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10245+
0x1ff9, 0x004f)
10246+
},
10247+
{
10248+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10249+
0x1ff9, 0x0051)
10250+
},
10251+
{
10252+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10253+
0x1ff9, 0x0052)
10254+
},
10255+
{
10256+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10257+
0x1ff9, 0x0053)
10258+
},
10259+
{
10260+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10261+
0x1ff9, 0x0054)
10262+
},
10263+
{
10264+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10265+
0x1ff9, 0x006b)
10266+
},
10267+
{
10268+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10269+
0x1ff9, 0x006c)
10270+
},
10271+
{
10272+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10273+
0x1ff9, 0x006d)
10274+
},
10275+
{
10276+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10277+
0x1ff9, 0x006f)
10278+
},
10279+
{
10280+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10281+
0x1ff9, 0x0070)
10282+
},
10283+
{
10284+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10285+
0x1ff9, 0x0071)
10286+
},
10287+
{
10288+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10289+
0x1ff9, 0x0072)
10290+
},
10291+
{
10292+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10293+
0x1ff9, 0x0086)
10294+
},
10295+
{
10296+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10297+
0x1ff9, 0x0087)
10298+
},
10299+
{
10300+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10301+
0x1ff9, 0x0088)
10302+
},
10303+
{
10304+
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
10305+
0x1ff9, 0x0089)
10306+
},
1018310307
{
1018410308
PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
1018510309
0x1e93, 0x1000)

0 commit comments

Comments
 (0)