Skip to content

Commit 8c1f0c3

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Four fixes, all in drivers: three fairly obvious small ones and a large one in aacraid to add block queue completion mapping and fix a CPU offline hang" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: lpfc: Fix incorrect big endian type assignment in bsg loopback path scsi: target: core: Fix error path in target_setup_session() scsi: storvsc: Always set no_report_opcodes scsi: aacraid: Reply queue mapping to CPUs based on IRQ affinity
2 parents ecbcffe + 9cefd6e commit 8c1f0c3

File tree

7 files changed

+51
-7
lines changed

7 files changed

+51
-7
lines changed

drivers/scsi/aacraid/aacraid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,7 @@ struct aac_dev
16781678
u32 handle_pci_error;
16791679
bool init_reset;
16801680
u8 soft_reset_support;
1681+
u8 use_map_queue;
16811682
};
16821683

16831684
#define aac_adapter_interrupt(dev) \

drivers/scsi/aacraid/commsup.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,12 @@ int aac_fib_setup(struct aac_dev * dev)
223223
struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd)
224224
{
225225
struct fib *fibptr;
226+
u32 blk_tag;
227+
int i;
226228

227-
fibptr = &dev->fibs[scsi_cmd_to_rq(scmd)->tag];
229+
blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
230+
i = blk_mq_unique_tag_to_tag(blk_tag);
231+
fibptr = &dev->fibs[i];
228232
/*
229233
* Null out fields that depend on being zero at the start of
230234
* each I/O

drivers/scsi/aacraid/linit.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <linux/compat.h>
2121
#include <linux/blkdev.h>
22+
#include <linux/blk-mq-pci.h>
2223
#include <linux/completion.h>
2324
#include <linux/init.h>
2425
#include <linux/interrupt.h>
@@ -504,6 +505,15 @@ static int aac_slave_configure(struct scsi_device *sdev)
504505
return 0;
505506
}
506507

508+
static void aac_map_queues(struct Scsi_Host *shost)
509+
{
510+
struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
511+
512+
blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
513+
aac->pdev, 0);
514+
aac->use_map_queue = true;
515+
}
516+
507517
/**
508518
* aac_change_queue_depth - alter queue depths
509519
* @sdev: SCSI device we are considering
@@ -1488,6 +1498,7 @@ static const struct scsi_host_template aac_driver_template = {
14881498
.bios_param = aac_biosparm,
14891499
.shost_groups = aac_host_groups,
14901500
.slave_configure = aac_slave_configure,
1501+
.map_queues = aac_map_queues,
14911502
.change_queue_depth = aac_change_queue_depth,
14921503
.sdev_groups = aac_dev_groups,
14931504
.eh_abort_handler = aac_eh_abort,
@@ -1775,6 +1786,8 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
17751786
shost->max_lun = AAC_MAX_LUN;
17761787

17771788
pci_set_drvdata(pdev, shost);
1789+
shost->nr_hw_queues = aac->max_msix;
1790+
shost->host_tagset = 1;
17781791

17791792
error = scsi_add_host(shost, &pdev->dev);
17801793
if (error)
@@ -1906,6 +1919,7 @@ static void aac_remove_one(struct pci_dev *pdev)
19061919
struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
19071920

19081921
aac_cancel_rescan_worker(aac);
1922+
aac->use_map_queue = false;
19091923
scsi_remove_host(shost);
19101924

19111925
__aac_shutdown(aac);

drivers/scsi/aacraid/src.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,10 @@ static int aac_src_deliver_message(struct fib *fib)
493493
#endif
494494

495495
u16 vector_no;
496+
struct scsi_cmnd *scmd;
497+
u32 blk_tag;
498+
struct Scsi_Host *shost = dev->scsi_host_ptr;
499+
struct blk_mq_queue_map *qmap;
496500

497501
atomic_inc(&q->numpending);
498502

@@ -505,8 +509,25 @@ static int aac_src_deliver_message(struct fib *fib)
505509
if ((dev->comm_interface == AAC_COMM_MESSAGE_TYPE3)
506510
&& dev->sa_firmware)
507511
vector_no = aac_get_vector(dev);
508-
else
509-
vector_no = fib->vector_no;
512+
else {
513+
if (!fib->vector_no || !fib->callback_data) {
514+
if (shost && dev->use_map_queue) {
515+
qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
516+
vector_no = qmap->mq_map[raw_smp_processor_id()];
517+
}
518+
/*
519+
* We hardcode the vector_no for
520+
* reserved commands as a valid shost is
521+
* absent during the init
522+
*/
523+
else
524+
vector_no = 0;
525+
} else {
526+
scmd = (struct scsi_cmnd *)fib->callback_data;
527+
blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
528+
vector_no = blk_mq_unique_tag_to_hwq(blk_tag);
529+
}
530+
}
510531

511532
if (native_hba) {
512533
if (fib->flags & FIB_CONTEXT_FLAG_NATIVE_HBA_TMF) {

drivers/scsi/lpfc/lpfc_bsg.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
889889
struct lpfc_iocbq *piocbq)
890890
{
891891
uint32_t evt_req_id = 0;
892-
uint32_t cmd;
892+
u16 cmd;
893893
struct lpfc_dmabuf *dmabuf = NULL;
894894
struct lpfc_bsg_event *evt;
895895
struct event_data *evt_dat = NULL;
@@ -915,7 +915,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
915915

916916
ct_req = (struct lpfc_sli_ct_request *)bdeBuf1->virt;
917917
evt_req_id = ct_req->FsType;
918-
cmd = ct_req->CommandResponse.bits.CmdRsp;
918+
cmd = be16_to_cpu(ct_req->CommandResponse.bits.CmdRsp);
919919

920920
spin_lock_irqsave(&phba->ct_ev_lock, flags);
921921
list_for_each_entry(evt, &phba->ct_ev_waiters, node) {
@@ -3186,8 +3186,8 @@ lpfc_bsg_diag_loopback_run(struct bsg_job *job)
31863186
ctreq->RevisionId.bits.InId = 0;
31873187
ctreq->FsType = SLI_CT_ELX_LOOPBACK;
31883188
ctreq->FsSubType = 0;
3189-
ctreq->CommandResponse.bits.CmdRsp = ELX_LOOPBACK_DATA;
3190-
ctreq->CommandResponse.bits.Size = size;
3189+
ctreq->CommandResponse.bits.CmdRsp = cpu_to_be16(ELX_LOOPBACK_DATA);
3190+
ctreq->CommandResponse.bits.Size = cpu_to_be16(size);
31913191
segment_offset = ELX_LOOPBACK_HEADER_SZ;
31923192
} else
31933193
segment_offset = 0;

drivers/scsi/storvsc_drv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,8 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
15671567
{
15681568
blk_queue_rq_timeout(sdevice->request_queue, (storvsc_timeout * HZ));
15691569

1570+
/* storvsc devices don't support MAINTENANCE_IN SCSI cmd */
1571+
sdevice->no_report_opcodes = 1;
15701572
sdevice->no_write_same = 1;
15711573

15721574
/*

drivers/target/target_core_transport.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ target_setup_session(struct se_portal_group *tpg,
504504

505505
free_sess:
506506
transport_free_session(sess);
507+
return ERR_PTR(rc);
508+
507509
free_cnt:
508510
target_free_cmd_counter(cmd_cnt);
509511
return ERR_PTR(rc);

0 commit comments

Comments
 (0)