* [PATCHv2 0/3] mpt3sas: Full mq support, part 2
@ 2017-02-17 8:25 Hannes Reinecke
2017-02-17 8:25 ` [PATCHv2 1/3] mpt3sas: Use 'msix_index' as argument for put_smid functions Hannes Reinecke
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Hannes Reinecke @ 2017-02-17 8:25 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, Sreekanth Reddy,
Kashyap Desai, Sathya Prakash, linux-scsi, Hannes Reinecke
Hi all,
this is the second part of my patchset to enable scsi multiqueue for the
mpt3sas driver.
While the HBA only has a single mailbox register for submitting commands,
it does have individual receive queues per MSI-X interrupt and as such
does benefit from converting it to full multiqueue support.
On request from Broadcom the patchset has been split in two parts, one
to enable lockless command submission and converting to scsi-mq, and
the other one for exposing all hardware queues to the OS.
As usual, comments and reviews are welcome.
Changes to v1:
- Include reviews from Christoph
- Use reserved commands for ioctl passthrough commands
- Include reviews from Sreekanth
Hannes Reinecke (3):
mpt3sas: Use 'msix_index' as argument for put_smid functions
block: Add blk_mq_make_unique_tag()
mpt3sas: scsi-mq interrupt steering
block/blk-mq-tag.c | 3 +-
drivers/scsi/mpt3sas/mpt3sas_base.c | 76 +++++++++++++++++++-------------
drivers/scsi/mpt3sas/mpt3sas_base.h | 18 ++++++--
drivers/scsi/mpt3sas/mpt3sas_config.c | 2 +-
drivers/scsi/mpt3sas/mpt3sas_ctl.c | 21 ++++-----
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 48 +++++++++++++++-----
drivers/scsi/mpt3sas/mpt3sas_transport.c | 8 ++--
include/linux/blk-mq.h | 5 +++
8 files changed, 119 insertions(+), 62 deletions(-)
--
1.8.5.6
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCHv2 1/3] mpt3sas: Use 'msix_index' as argument for put_smid functions
2017-02-17 8:25 [PATCHv2 0/3] mpt3sas: Full mq support, part 2 Hannes Reinecke
@ 2017-02-17 8:25 ` Hannes Reinecke
2017-02-17 8:26 ` [PATCHv2 2/3] block: Add blk_mq_make_unique_tag() Hannes Reinecke
2017-02-17 8:26 ` [PATCHv2 3/3] mpt3sas: scsi-mq interrupt steering Hannes Reinecke
2 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2017-02-17 8:25 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, Sreekanth Reddy,
Kashyap Desai, Sathya Prakash, linux-scsi, Hannes Reinecke,
Hannes Reinecke
Use msix_index as explicit argument for the various put_smid
callbacks.
No functional change.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 56 +++++++++++++++++---------------
drivers/scsi/mpt3sas/mpt3sas_base.h | 18 ++++++++--
drivers/scsi/mpt3sas/mpt3sas_config.c | 2 +-
drivers/scsi/mpt3sas/mpt3sas_ctl.c | 21 ++++++------
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 21 ++++++------
drivers/scsi/mpt3sas/mpt3sas_transport.c | 8 ++---
6 files changed, 71 insertions(+), 55 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 97189ad..96adf84 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -849,7 +849,7 @@ static int mpt3sas_remove_dead_ioc_func(void *arg)
ack_request->EventContext = mpi_reply->EventContext;
ack_request->VF_ID = 0; /* TODO */
ack_request->VP_ID = 0;
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
out:
@@ -2302,12 +2302,6 @@ struct scsiio_tracker *
return ioc->reply + (phys_addr - (u32)ioc->reply_dma);
}
-static inline u8
-_base_get_msix_index(struct MPT3SAS_ADAPTER *ioc)
-{
- return ioc->cpu_msix_table[raw_smp_processor_id()];
-}
-
/**
* mpt3sas_base_get_smid - obtain a free smid from internal queue
* @ioc: per adapter object
@@ -2366,7 +2360,7 @@ struct scsiio_tracker *
smid = tag + 1;
}
request->cb_idx = cb_idx;
- request->msix_io = _base_get_msix_index(ioc);
+ request->msix_io = mpt3sas_base_get_msix_index(ioc);
request->smid = smid;
INIT_LIST_HEAD(&request->chain_list);
return request->smid;
@@ -2508,18 +2502,20 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
* @ioc: per adapter object
* @smid: system request message index
* @handle: device handle
+ * @msix_index: MSI-X index
*
* Return nothing.
*/
static void
-_base_put_smid_scsi_io(struct MPT3SAS_ADAPTER *ioc, u16 smid, u16 handle)
+_base_put_smid_scsi_io(struct MPT3SAS_ADAPTER *ioc, u16 smid,
+ u16 handle, u16 msix_index)
{
Mpi2RequestDescriptorUnion_t descriptor;
u64 *request = (u64 *)&descriptor;
descriptor.SCSIIO.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO;
- descriptor.SCSIIO.MSIxIndex = _base_get_msix_index(ioc);
+ descriptor.SCSIIO.MSIxIndex = cpu_to_le16(msix_index);
descriptor.SCSIIO.SMID = cpu_to_le16(smid);
descriptor.SCSIIO.DevHandle = cpu_to_le16(handle);
descriptor.SCSIIO.LMID = 0;
@@ -2532,19 +2528,20 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
* @ioc: per adapter object
* @smid: system request message index
* @handle: device handle
+ * @msix_index: MSI-X index
*
* Return nothing.
*/
static void
_base_put_smid_fast_path(struct MPT3SAS_ADAPTER *ioc, u16 smid,
- u16 handle)
+ u16 handle, u16 msix_index)
{
Mpi2RequestDescriptorUnion_t descriptor;
u64 *request = (u64 *)&descriptor;
descriptor.SCSIIO.RequestFlags =
MPI25_REQ_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO;
- descriptor.SCSIIO.MSIxIndex = _base_get_msix_index(ioc);
+ descriptor.SCSIIO.MSIxIndex = cpu_to_le16(msix_index);
descriptor.SCSIIO.SMID = cpu_to_le16(smid);
descriptor.SCSIIO.DevHandle = cpu_to_le16(handle);
descriptor.SCSIIO.LMID = 0;
@@ -2568,7 +2565,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
descriptor.HighPriority.RequestFlags =
MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
- descriptor.HighPriority.MSIxIndex = msix_task;
+ descriptor.HighPriority.MSIxIndex = cpu_to_le16(msix_task);
descriptor.HighPriority.SMID = cpu_to_le16(smid);
descriptor.HighPriority.LMID = 0;
descriptor.HighPriority.Reserved1 = 0;
@@ -2580,17 +2577,18 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
* _base_put_smid_default - Default, primarily used for config pages
* @ioc: per adapter object
* @smid: system request message index
+ * @msix_index: MSI-X index
*
* Return nothing.
*/
static void
-_base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid)
+_base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid, u16 msix_index)
{
Mpi2RequestDescriptorUnion_t descriptor;
u64 *request = (u64 *)&descriptor;
descriptor.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
- descriptor.Default.MSIxIndex = _base_get_msix_index(ioc);
+ descriptor.Default.MSIxIndex = cpu_to_le16(msix_index);
descriptor.Default.SMID = cpu_to_le16(smid);
descriptor.Default.LMID = 0;
descriptor.Default.DescriptorTypeDependent = 0;
@@ -2604,18 +2602,19 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
* @ioc: per adapter object
* @smid: system request message index
* @handle: device handle, unused in this function, for function type match
+* @msix_index: MSI-X index
*
* Return nothing.
*/
static void
_base_put_smid_scsi_io_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid,
- u16 handle)
+ u16 handle, u16 msix_index)
{
Mpi26AtomicRequestDescriptor_t descriptor;
u32 *request = (u32 *)&descriptor;
descriptor.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO;
- descriptor.MSIxIndex = _base_get_msix_index(ioc);
+ descriptor.MSIxIndex = cpu_to_le16(msix_index);
descriptor.SMID = cpu_to_le16(smid);
writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost);
@@ -2627,17 +2626,18 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
* @ioc: per adapter object
* @smid: system request message index
* @handle: device handle, unused in this function, for function type match
+ * @msix_index: MSI-X index
* Return nothing
*/
static void
_base_put_smid_fast_path_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid,
- u16 handle)
+ u16 handle, u16 msix_index)
{
Mpi26AtomicRequestDescriptor_t descriptor;
u32 *request = (u32 *)&descriptor;
descriptor.RequestFlags = MPI25_REQ_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO;
- descriptor.MSIxIndex = _base_get_msix_index(ioc);
+ descriptor.MSIxIndex = cpu_to_le16(msix_index);
descriptor.SMID = cpu_to_le16(smid);
writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost);
@@ -2660,7 +2660,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
u32 *request = (u32 *)&descriptor;
descriptor.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
- descriptor.MSIxIndex = msix_task;
+ descriptor.MSIxIndex = cpu_to_le16(msix_task);
descriptor.SMID = cpu_to_le16(smid);
writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost);
@@ -2671,17 +2671,19 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
* use Atomic Request Descriptor
* @ioc: per adapter object
* @smid: system request message index
+ * @msix_index: MSI-X index
*
* Return nothing.
*/
static void
-_base_put_smid_default_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid)
+_base_put_smid_default_atomic(struct MPT3SAS_ADAPTER *ioc,
+ u16 smid, u16 msix_index)
{
Mpi26AtomicRequestDescriptor_t descriptor;
u32 *request = (u32 *)&descriptor;
descriptor.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
- descriptor.MSIxIndex = _base_get_msix_index(ioc);
+ descriptor.MSIxIndex = cpu_to_le16(msix_index);
descriptor.SMID = cpu_to_le16(smid);
writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost);
@@ -4188,7 +4190,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
mpi_request->Operation == MPI2_SAS_OP_PHY_LINK_RESET)
ioc->ioc_link_reset_in_progress = 1;
init_completion(&ioc->base_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->base_cmds.done,
msecs_to_jiffies(10000));
if ((mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET ||
@@ -4288,7 +4290,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
ioc->base_cmds.smid = smid;
memcpy(request, mpi_request, sizeof(Mpi2SepReply_t));
init_completion(&ioc->base_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->base_cmds.done,
msecs_to_jiffies(10000));
if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {
@@ -4702,7 +4704,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
mpi_request->Function = MPI2_FUNCTION_PORT_ENABLE;
init_completion(&ioc->port_enable_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->port_enable_cmds.done, 300*HZ);
if (!(ioc->port_enable_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n",
@@ -4765,7 +4767,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
memset(mpi_request, 0, sizeof(Mpi2PortEnableRequest_t));
mpi_request->Function = MPI2_FUNCTION_PORT_ENABLE;
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
return 0;
}
@@ -4884,7 +4886,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
mpi_request->EventMasks[i] =
cpu_to_le32(ioc->event_masks[i]);
init_completion(&ioc->base_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ);
if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n",
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 8b38e49..ce2019c 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -736,8 +736,9 @@ typedef void (*MPT_BUILD_ZERO_LEN_SGE)(struct MPT3SAS_ADAPTER *ioc,
/* To support atomic and non atomic descriptors*/
typedef void (*PUT_SMID_IO_FP_HIP) (struct MPT3SAS_ADAPTER *ioc, u16 smid,
- u16 funcdep);
-typedef void (*PUT_SMID_DEFAULT) (struct MPT3SAS_ADAPTER *ioc, u16 smid);
+ u16 funcdep, u16 msix_index);
+typedef void (*PUT_SMID_DEFAULT) (struct MPT3SAS_ADAPTER *ioc, u16 smid,
+ u16 msix_index);
/* IOC Facts and Port Facts converted from little endian to cpu */
union mpi3_version_union {
@@ -1196,7 +1197,7 @@ struct MPT3SAS_ADAPTER {
u8 atomic_desc_capable;
PUT_SMID_IO_FP_HIP put_smid_scsi_io;
PUT_SMID_IO_FP_HIP put_smid_fast_path;
- PUT_SMID_IO_FP_HIP put_smid_hi_priority;
+ PUT_SMID_DEFAULT put_smid_hi_priority;
PUT_SMID_DEFAULT put_smid_default;
};
@@ -1278,6 +1279,17 @@ void mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc,
int mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc);
+static inline u8
+mpt3sas_base_get_msix_index(struct MPT3SAS_ADAPTER *ioc)
+{
+ return ioc->cpu_msix_table[raw_smp_processor_id()];
+}
+
+static inline void
+mpt3sas_base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid)
+{
+ ioc->put_smid_default(ioc, smid, mpt3sas_base_get_msix_index(ioc));
+}
/* scsih shared API */
u8 mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
diff --git a/drivers/scsi/mpt3sas/mpt3sas_config.c b/drivers/scsi/mpt3sas/mpt3sas_config.c
index dd62701..cebfd73 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_config.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_config.c
@@ -384,7 +384,7 @@ struct config_request {
memcpy(config_request, mpi_request, sizeof(Mpi2ConfigRequest_t));
_config_display_some_debug(ioc, smid, "config_request", NULL);
init_completion(&ioc->config_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->config_cmds.done, timeout*HZ);
if (!(ioc->config_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n",
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index e2a8c5d..4329408 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -845,9 +845,10 @@ struct smid_match_data {
ioc->build_sg(ioc, psge, data_out_dma, data_out_sz,
data_in_dma, data_in_sz);
if (mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST)
- ioc->put_smid_scsi_io(ioc, smid, device_handle);
+ ioc->put_smid_scsi_io(ioc, smid, device_handle,
+ mpt3sas_base_get_msix_index(ioc));
else
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
break;
}
case MPI2_FUNCTION_SCSI_TASK_MGMT:
@@ -915,7 +916,7 @@ struct smid_match_data {
}
ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma,
data_in_sz);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
break;
}
case MPI2_FUNCTION_SATA_PASSTHROUGH:
@@ -930,7 +931,7 @@ struct smid_match_data {
}
ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma,
data_in_sz);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
break;
}
case MPI2_FUNCTION_FW_DOWNLOAD:
@@ -938,7 +939,7 @@ struct smid_match_data {
{
ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma,
data_in_sz);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
break;
}
case MPI2_FUNCTION_TOOLBOX:
@@ -953,7 +954,7 @@ struct smid_match_data {
ioc->build_sg_mpi(ioc, psge, data_out_dma, data_out_sz,
data_in_dma, data_in_sz);
}
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
break;
}
case MPI2_FUNCTION_SAS_IO_UNIT_CONTROL:
@@ -972,7 +973,7 @@ struct smid_match_data {
default:
ioc->build_sg_mpi(ioc, psge, data_out_dma, data_out_sz,
data_in_dma, data_in_sz);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
break;
}
@@ -1561,7 +1562,7 @@ struct smid_match_data {
cpu_to_le32(ioc->product_specific[buffer_type][i]);
init_completion(&ioc->ctl_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->ctl_cmds.done,
MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
@@ -1908,7 +1909,7 @@ struct smid_match_data {
mpi_request->VP_ID = 0;
init_completion(&ioc->ctl_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->ctl_cmds.done,
MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
@@ -2175,7 +2176,7 @@ struct smid_match_data {
mpi_request->VP_ID = 0;
init_completion(&ioc->ctl_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->ctl_cmds.done,
MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index b8e47da..77ab449 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3270,7 +3270,7 @@ static struct fw_event_work *dequeue_next_fw_event(struct MPT3SAS_ADAPTER *ioc)
mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL;
mpi_request->Operation = MPI2_SAS_OP_REMOVE_DEVICE;
mpi_request->DevHandle = mpi_request_tm->DevHandle;
- ioc->put_smid_default(ioc, smid_sas_ctrl);
+ ioc->put_smid_default(ioc, smid_sas_ctrl, msix_index);
return _scsih_check_for_pending_tm(ioc, smid);
}
@@ -3365,7 +3365,7 @@ static struct fw_event_work *dequeue_next_fw_event(struct MPT3SAS_ADAPTER *ioc)
mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
mpi_request->DevHandle = cpu_to_le16(handle);
mpi_request->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET;
- ioc->put_smid_hi_priority(ioc, smid, 0);
+ ioc->put_smid_hi_priority(ioc, smid, mpt3sas_base_get_msix_index(ioc));
}
/**
@@ -3457,7 +3457,7 @@ static struct fw_event_work *dequeue_next_fw_event(struct MPT3SAS_ADAPTER *ioc)
ack_request->EventContext = event_context;
ack_request->VF_ID = 0; /* TODO */
ack_request->VP_ID = 0;
- ioc->put_smid_default(ioc, smid);
+ ioc->put_smid_default(ioc, smid, mpt3sas_base_get_msix_index(ioc));
}
/**
@@ -3514,7 +3514,7 @@ static struct fw_event_work *dequeue_next_fw_event(struct MPT3SAS_ADAPTER *ioc)
mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL;
mpi_request->Operation = MPI2_SAS_OP_REMOVE_DEVICE;
mpi_request->DevHandle = handle;
- ioc->put_smid_default(ioc, smid);
+ ioc->put_smid_default(ioc, smid, mpt3sas_base_get_msix_index(ioc));
}
/**
@@ -4035,6 +4035,7 @@ void _flush_running(struct request *req, void *data, bool reserved)
u32 mpi_control;
u16 smid;
u16 handle;
+ u16 msix_task = mpt3sas_base_get_msix_index(ioc);
if (ioc->logging_level & MPT_DEBUG_SCSI)
scsi_print_command(scmd);
@@ -4153,12 +4154,12 @@ void _flush_running(struct request *req, void *data, bool reserved)
if (sas_target_priv_data->flags & MPT_TARGET_FASTPATH_IO) {
mpi_request->IoFlags = cpu_to_le16(scmd->cmd_len |
MPI25_SCSIIO_IOFLAGS_FAST_PATH);
- ioc->put_smid_fast_path(ioc, smid, handle);
+ ioc->put_smid_fast_path(ioc, smid, handle, msix_task);
} else
ioc->put_smid_scsi_io(ioc, smid,
- le16_to_cpu(mpi_request->DevHandle));
+ le16_to_cpu(mpi_request->DevHandle), msix_task);
} else
- ioc->put_smid_default(ioc, smid);
+ ioc->put_smid_default(ioc, smid, msix_task);
return 0;
out:
@@ -4657,7 +4658,7 @@ void _flush_running(struct request *req, void *data, bool reserved)
mpi_request->DevHandle =
cpu_to_le16(sas_device_priv_data->sas_target->handle);
ioc->put_smid_scsi_io(ioc, smid,
- sas_device_priv_data->sas_target->handle);
+ sas_device_priv_data->sas_target->handle, msix_index);
return 0;
}
/* turning off TLR */
@@ -6269,7 +6270,7 @@ void _abort_sas_task(struct request *req, void *data, bool reserved)
handle, phys_disk_num));
init_completion(&ioc->scsih_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ);
if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) {
@@ -8128,7 +8129,7 @@ void _abort_sas_task(struct request *req, void *data, bool reserved)
if (!ioc->hide_ir_msg)
pr_info(MPT3SAS_FMT "IR shutdown (sending)\n", ioc->name);
init_completion(&ioc->scsih_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ ioc->put_smid_default(ioc, smid, mpt3sas_base_get_msix_index(ioc));
wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ);
if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) {
diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c
index 7f1d578..b74faf1 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_transport.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c
@@ -392,7 +392,7 @@ struct rep_manu_reply {
"report_manufacture - send to sas_addr(0x%016llx)\n",
ioc->name, (unsigned long long)sas_address));
init_completion(&ioc->transport_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
@@ -1198,7 +1198,7 @@ struct phy_error_log_reply {
ioc->name, (unsigned long long)phy->identify.sas_address,
phy->number));
init_completion(&ioc->transport_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
@@ -1514,7 +1514,7 @@ struct phy_control_reply {
ioc->name, (unsigned long long)phy->identify.sas_address,
phy->number, phy_operation));
init_completion(&ioc->transport_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
@@ -2032,7 +2032,7 @@ struct phy_control_reply {
"%s - sending smp request\n", ioc->name, __func__));
init_completion(&ioc->transport_cmds.done);
- ioc->put_smid_default(ioc, smid);
+ mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
--
1.8.5.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv2 2/3] block: Add blk_mq_make_unique_tag()
2017-02-17 8:25 [PATCHv2 0/3] mpt3sas: Full mq support, part 2 Hannes Reinecke
2017-02-17 8:25 ` [PATCHv2 1/3] mpt3sas: Use 'msix_index' as argument for put_smid functions Hannes Reinecke
@ 2017-02-17 8:26 ` Hannes Reinecke
2017-02-17 8:26 ` [PATCHv2 3/3] mpt3sas: scsi-mq interrupt steering Hannes Reinecke
2 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2017-02-17 8:26 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, Sreekanth Reddy,
Kashyap Desai, Sathya Prakash, linux-scsi, Hannes Reinecke,
Hannes Reinecke
Implement blk_mq_make_unique_tag() to generate a unique tag
value from a given hardware queue and tag value.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
block/blk-mq-tag.c | 3 +--
include/linux/blk-mq.h | 5 +++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index dcf5ce3..2df6d35 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -450,8 +450,7 @@ u32 blk_mq_unique_tag(struct request *rq)
hwq = hctx->queue_num;
}
- return (hwq << BLK_MQ_UNIQUE_TAG_BITS) |
- (rq->tag & BLK_MQ_UNIQUE_TAG_MASK);
+ return blk_mq_make_unique_tag(hwq, rq->tag);
}
EXPORT_SYMBOL(blk_mq_unique_tag);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 4a2ab5d9..1442c34 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -212,6 +212,11 @@ static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag)
return unique_tag & BLK_MQ_UNIQUE_TAG_MASK;
}
+static inline u32 blk_mq_make_unique_tag(u16 hwq, u16 tag)
+{
+ return (hwq << BLK_MQ_UNIQUE_TAG_BITS) |
+ (tag & BLK_MQ_UNIQUE_TAG_MASK);
+}
int blk_mq_request_started(struct request *rq);
void blk_mq_start_request(struct request *rq);
--
1.8.5.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv2 3/3] mpt3sas: scsi-mq interrupt steering
2017-02-17 8:25 [PATCHv2 0/3] mpt3sas: Full mq support, part 2 Hannes Reinecke
2017-02-17 8:25 ` [PATCHv2 1/3] mpt3sas: Use 'msix_index' as argument for put_smid functions Hannes Reinecke
2017-02-17 8:26 ` [PATCHv2 2/3] block: Add blk_mq_make_unique_tag() Hannes Reinecke
@ 2017-02-17 8:26 ` Hannes Reinecke
2 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2017-02-17 8:26 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, Sreekanth Reddy,
Kashyap Desai, Sathya Prakash, linux-scsi, Hannes Reinecke,
Hannes Reinecke
The device has several reply queues, so this patch implements
correct scsi-mq interrupt steering to take advantage of full
blk-mq support.
However, as performance results are inconclusive this patch
also adds a module parameter 'use_blk_mq' to enable full
mq support; the parameter itself is off by default.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 22 +++++++++++++++++-----
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 27 ++++++++++++++++++++++++++-
2 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 96adf84..10102de 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -865,12 +865,15 @@ static int mpt3sas_remove_dead_ioc_func(void *arg)
struct scsiio_tracker *
mpt3sas_get_st_from_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
{
+ u16 hwq, tag;
u32 unique_tag;
struct scsi_cmnd *cmd;
WARN_ON(!smid);
WARN_ON(smid >= ioc->hi_priority_smid);
- unique_tag = smid - 1;
+ hwq = (smid - 1) % ioc->shost->nr_hw_queues;
+ tag = (smid - 1) / ioc->shost->nr_hw_queues;
+ unique_tag = blk_mq_make_unique_tag(hwq, tag);
cmd = scsi_host_find_tag(ioc->shost, unique_tag);
if (cmd)
return scsi_cmd_priv(cmd);
@@ -2347,6 +2350,7 @@ struct scsiio_tracker *
{
struct scsiio_tracker *request;
u16 smid;
+ u16 hwq = 0;
if (!scmd) {
smid = 1;
@@ -2356,11 +2360,15 @@ struct scsiio_tracker *
u16 tag = blk_mq_unique_tag_to_tag(unique_tag);
WARN_ON(tag < ioc->shost->reserved_cmds);
+ hwq = blk_mq_unique_tag_to_hwq(unique_tag);
+ smid = (tag * ioc->shost->nr_hw_queues) + hwq + 1;
request = scsi_cmd_priv(scmd);
- smid = tag + 1;
}
request->cb_idx = cb_idx;
- request->msix_io = mpt3sas_base_get_msix_index(ioc);
+ if (scmd && ioc->shost->nr_hw_queues > 1)
+ request->msix_io = hwq;
+ else
+ request->msix_io = mpt3sas_base_get_msix_index(ioc);
request->smid = smid;
INIT_LIST_HEAD(&request->chain_list);
return request->smid;
@@ -3527,9 +3535,13 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
*/
ioc->shost->reserved_cmds = INTERNAL_SCSIIO_CMDS_COUNT;
ioc->shost->can_queue = ioc->scsiio_depth - ioc->shost->reserved_cmds;
+ if (ioc->shost->nr_hw_queues > 1) {
+ ioc->shost->nr_hw_queues = ioc->reply_queue_count;
+ ioc->shost->can_queue /= ioc->reply_queue_count;
+ }
dinitprintk(ioc, pr_info(MPT3SAS_FMT
- "scsi host: can_queue depth (%d)\n",
- ioc->name, ioc->shost->can_queue));
+ "scsi host: can_queue depth (%d), nr_hw_queues (%d)\n",
+ ioc->name, ioc->shost->can_queue, ioc->shost->nr_hw_queues));
/* contiguous pool for request and chains, 16 byte align, one extra "
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 77ab449..c68d7a7 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -54,6 +54,7 @@
#include <linux/interrupt.h>
#include <linux/aer.h>
#include <linux/raid_class.h>
+#include <linux/blk-mq-pci.h>
#include <asm/unaligned.h>
#include "mpt3sas_base.h"
@@ -147,6 +148,11 @@ static int _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle,
module_param(prot_mask, int, 0);
MODULE_PARM_DESC(prot_mask, " host protection capabilities mask, def=7 ");
+static int use_blk_mq;
+module_param(use_blk_mq, int, S_IRUGO);
+MODULE_PARM_DESC(use_blk_mq,
+ "Enable scsi-mq (single queue=0/all queues=1/default=0)");
+
/* raid transport support */
struct raid_template *mpt3sas_raid_template;
struct raid_template *mpt2sas_raid_template;
@@ -1072,7 +1078,9 @@ struct _sas_node *
_scsih_scsi_lookup_get_clear(struct MPT3SAS_ADAPTER *ioc, u16 smid)
{
if (smid > 0) {
- u32 unique_tag = smid - 1;
+ u16 hwq = (smid - 1) % ioc->shost->nr_hw_queues;
+ u16 tag = (smid - 1) / ioc->shost->nr_hw_queues;
+ u32 unique_tag = blk_mq_make_unique_tag(hwq, tag);
return scsi_host_find_tag(ioc->shost, unique_tag);
}
@@ -4150,6 +4158,11 @@ void _flush_running(struct request *req, void *data, bool reserved)
if (raid_device && raid_device->direct_io_enabled)
mpt3sas_setup_direct_io(ioc, scmd, raid_device, mpi_request);
+ if (shost_use_blk_mq(ioc->shost) && (ioc->shost->nr_hw_queues > 1)) {
+ u32 unique_tag = blk_mq_unique_tag(scmd->request);
+
+ msix_task = blk_mq_unique_tag_to_hwq(unique_tag);
+ }
if (likely(mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST)) {
if (sas_target_priv_data->flags & MPT_TARGET_FASTPATH_IO) {
mpi_request->IoFlags = cpu_to_le16(scmd->cmd_len |
@@ -8545,6 +8558,16 @@ static void sas_device_make_active(struct MPT3SAS_ADAPTER *ioc,
return 1;
}
+static int scsih_map_queues(struct Scsi_Host *shost)
+{
+ struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
+
+ if (shost->nr_hw_queues > 1)
+ return blk_mq_pci_map_queues(&shost->tag_set, ioc->pdev);
+
+ return -EINVAL;
+}
+
/* shost template for SAS 2.0 HBA devices */
static struct scsi_host_template mpt2sas_driver_template = {
.module = THIS_MODULE,
@@ -8558,6 +8581,7 @@ static void sas_device_make_active(struct MPT3SAS_ADAPTER *ioc,
.slave_destroy = scsih_slave_destroy,
.scan_finished = scsih_scan_finished,
.scan_start = scsih_scan_start,
+ .map_queues = scsih_map_queues,
.change_queue_depth = scsih_change_queue_depth,
.eh_abort_handler = scsih_abort,
.eh_device_reset_handler = scsih_dev_reset,
@@ -8825,6 +8849,7 @@ static void sas_device_make_active(struct MPT3SAS_ADAPTER *ioc,
shost->transportt = mpt3sas_transport_template;
shost->unique_id = ioc->id;
shost->use_blk_mq = 1;
+ shost->nr_hw_queues = use_blk_mq ? num_online_cpus() : 1;
if (max_sectors != 0xFFFF) {
if (max_sectors < 64) {
--
1.8.5.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-17 8:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-17 8:25 [PATCHv2 0/3] mpt3sas: Full mq support, part 2 Hannes Reinecke
2017-02-17 8:25 ` [PATCHv2 1/3] mpt3sas: Use 'msix_index' as argument for put_smid functions Hannes Reinecke
2017-02-17 8:26 ` [PATCHv2 2/3] block: Add blk_mq_make_unique_tag() Hannes Reinecke
2017-02-17 8:26 ` [PATCHv2 3/3] mpt3sas: scsi-mq interrupt steering Hannes Reinecke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox