From: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
To: martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, sathya.prakash@broadcom.com,
suganath-prabu.subramani@broadcom.com,
Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Subject: [PATCH 13/14] mpt3sas: add module parameter multipath_on_hba
Date: Fri, 9 Oct 2020 22:44:39 +0530 [thread overview]
Message-ID: <20201009171440.4949-14-sreekanth.reddy@broadcom.com> (raw)
In-Reply-To: <20201009171440.4949-1-sreekanth.reddy@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 7475 bytes --]
Add module parameter multipath_on_hba to enable/disable
the support a multi-port path topology.
By default this feature is enabled on SAS3.5 HBA device
and disabled on SAS3 &SAS2.5 HBA devices.
when this module parameter is disabled then driver uses
a default PhysicalPort(PortID) number i.e. 255 instead of
PhysicalPort number provided by HBA firmware.
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.h | 2 +
drivers/scsi/mpt3sas/mpt3sas_ctl.c | 6 ++-
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 69 ++++++++++++++++++++++--
drivers/scsi/mpt3sas/mpt3sas_transport.c | 6 ++-
4 files changed, 76 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index cca14ab..badd823 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1246,6 +1246,7 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc);
* which ensures the syncrhonization between cli/sysfs_show path.
* @atomic_desc_capable: Atomic Request Descriptor support.
* @GET_MSIX_INDEX: Get the msix index of high iops queues.
+ * @multipath_on_hba: flag to determine multipath on hba is enabled or not
* @port_table_list: list containing HBA's wide/narrow port's info
*/
struct MPT3SAS_ADAPTER {
@@ -1540,6 +1541,7 @@ struct MPT3SAS_ADAPTER {
PUT_SMID_DEFAULT put_smid_default;
GET_MSIX_INDEX get_msix_index_for_smlio;
+ u8 multipath_on_hba;
struct list_head port_table_list;
};
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 5c32dbb..af2d3e3 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -902,8 +902,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
(Mpi2SmpPassthroughRequest_t *)mpi_request;
u8 *data;
- /* ioc determines which port to use */
- smp_request->PhysicalPort = 0xFF;
+ if (!ioc->multipath_on_hba) {
+ /* ioc determines which port to use */
+ smp_request->PhysicalPort = 0xFF;
+ }
if (smp_request->PassthroughFlags &
MPI2_SMP_PT_REQ_PT_FLAGS_IMMEDIATE)
data = (u8 *)&smp_request->SGL;
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index da4ffa6..699fc9a 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -159,6 +159,15 @@ module_param(enable_sdev_max_qd, bool, 0444);
MODULE_PARM_DESC(enable_sdev_max_qd,
"Enable sdev max qd as can_queue, def=disabled(0)");
+static int multipath_on_hba = -1;
+module_param(multipath_on_hba, int, 0);
+MODULE_PARM_DESC(multipath_on_hba,
+ "Multipath support to add same target device\n\t\t"
+ "as many times as it is visible to HBA from various paths\n\t\t"
+ "(by default:\n\t\t"
+ "\t SAS 2.0 & SAS 3.0 HBA - This will be disabled,\n\t\t"
+ "\t SAS 3.5 HBA - This will be enabled)");
+
/* raid transport support */
static struct raid_template *mpt3sas_raid_template;
static struct raid_template *mpt2sas_raid_template;
@@ -373,6 +382,14 @@ mpt3sas_get_port_by_id(struct MPT3SAS_ADAPTER *ioc,
{
struct hba_port *port, *port_next;
+ /*
+ * When multipath_on_hba is disabled then
+ * search the hba_port entry using default
+ * port id i.e. 255
+ */
+ if (!ioc->multipath_on_hba)
+ port_id = MULTIPATH_DISABLED_PORT_ID;
+
list_for_each_entry_safe(port, port_next,
&ioc->port_table_list, list) {
if (port->port_id != port_id)
@@ -384,6 +401,24 @@ mpt3sas_get_port_by_id(struct MPT3SAS_ADAPTER *ioc,
return port;
}
+ /*
+ * Allocate hba_port object for default port id (i.e. 255)
+ * when multipath_on_hba is disabled for the HBA.
+ * And add this object to port_table_list.
+ */
+ if (!ioc->multipath_on_hba) {
+ port = kzalloc(sizeof(struct hba_port), GFP_KERNEL);
+ if (!port)
+ return NULL;
+
+ port->port_id = port_id;
+ ioc_info(ioc,
+ "hba_port entry: %p, port: %d is added to hba_port list\n",
+ port, port->port_id);
+ list_add_tail(&port->list,
+ &ioc->port_table_list);
+ return port;
+ }
return NULL;
}
@@ -10013,6 +10048,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc)
u16 ioc_status;
u64 sas_address;
u16 handle;
+ u8 port;
ioc_info(ioc, "search for expanders: start\n");
@@ -10030,10 +10066,12 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc)
handle = le16_to_cpu(expander_pg0.DevHandle);
sas_address = le64_to_cpu(expander_pg0.SASAddress);
+ port = expander_pg0.PhysicalPort;
pr_info(
"\texpander present: handle(0x%04x), sas_addr(0x%016llx), port:%d\n",
handle, (unsigned long long)sas_address,
- expander_pg0.PhysicalPort);
+ (ioc->multipath_on_hba ?
+ port : MULTIPATH_DISABLED_PORT_ID));
_scsih_mark_responding_expander(ioc, &expander_pg0);
}
@@ -10476,8 +10514,10 @@ mpt3sas_scsih_reset_done_handler(struct MPT3SAS_ADAPTER *ioc)
dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__));
if ((!ioc->is_driver_loading) && !(disable_discovery > 0 &&
!ioc->sas_hba.num_phys)) {
- _scsih_sas_port_refresh(ioc);
- _scsih_update_vphys_after_reset(ioc);
+ if (ioc->multipath_on_hba) {
+ _scsih_sas_port_refresh(ioc);
+ _scsih_update_vphys_after_reset(ioc);
+ }
_scsih_prep_device_scan(ioc);
_scsih_create_enclosure_list_after_reset(ioc);
_scsih_search_responding_sas_devices(ioc);
@@ -11765,6 +11805,12 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ioc->mfg_pg10_hide_flag = MFG_PAGE10_EXPOSE_ALL_DISKS;
break;
}
+
+ if (multipath_on_hba == -1 || multipath_on_hba == 0)
+ ioc->multipath_on_hba = 0;
+ else
+ ioc->multipath_on_hba = 1;
+
break;
case MPI25_VERSION:
case MPI26_VERSION:
@@ -11826,6 +11872,23 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ioc->combined_reply_index_count =
MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G3;
}
+
+ switch (ioc->is_gen35_ioc) {
+ case 0:
+ if (multipath_on_hba == -1 || multipath_on_hba == 0)
+ ioc->multipath_on_hba = 0;
+ else
+ ioc->multipath_on_hba = 1;
+ break;
+ case 1:
+ if (multipath_on_hba == -1 || multipath_on_hba > 0)
+ ioc->multipath_on_hba = 1;
+ else
+ ioc->multipath_on_hba = 0;
+ default:
+ break;
+ }
+
break;
default:
return -ENODEV;
diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c
index 0d06025..6f47082 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_transport.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c
@@ -912,7 +912,8 @@ mpt3sas_transport_port_remove(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,
return;
}
- if (sas_node->handle <= ioc->sas_hba.num_phys) {
+ if (sas_node->handle <= ioc->sas_hba.num_phys &&
+ (ioc->multipath_on_hba)) {
if (port->vphys_mask) {
list_for_each_entry_safe(vphy, vphy_next,
&port->vphys_list, list) {
@@ -1172,7 +1173,8 @@ mpt3sas_transport_update_links(struct MPT3SAS_ADAPTER *ioc,
if (handle && (link_rate >= MPI2_SAS_NEG_LINK_RATE_1_5)) {
_transport_set_identify(ioc, handle,
&mpt3sas_phy->remote_identify);
- if (sas_node->handle <= ioc->sas_hba.num_phys) {
+ if ((sas_node->handle <= ioc->sas_hba.num_phys) &&
+ (ioc->multipath_on_hba)) {
list_for_each_entry(hba_port,
&ioc->port_table_list, list) {
if (hba_port->sas_address == sas_address &&
--
2.18.4
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4175 bytes --]
next prev parent reply other threads:[~2020-10-09 17:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-09 17:14 [PATCH 00/14] mpt3sas: Add support for multi-port path topology Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 01/14] mpt3sas: Define hba_port structure Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 02/14] mpt3sas: Allocate memory for hba_port objects Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 03/14] mpt3sas: Rearrange _scsih_mark_responding_sas_device() Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 04/14] mpt3sas: Update hba_port's sas_address & phy_mask Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 05/14] mpt3sas: Get device objects using sas_address & portID Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 06/14] mpt3sas: Rename transport_del_phy_from_an_existing_port Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 07/14] mpt3sas: Get sas_device objects using device's rphy Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 08/14] mpt3sas: Update hba_port objects after host reset Sreekanth Reddy
2020-10-12 12:22 ` Dan Carpenter
2020-10-12 12:22 ` Dan Carpenter
2020-10-12 12:22 ` Dan Carpenter
2020-10-09 17:14 ` [PATCH 09/14] mpt3sas: Set valid PhysicalPort in SMPPassThrough Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 10/14] mpt3sas: Handling HBA vSES device Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 11/14] mpt3sas: Add bypass_dirty_port_flag parameter Sreekanth Reddy
2020-10-09 17:14 ` [PATCH 12/14] mpt3sas: Handle vSES vphy object during HBA reset Sreekanth Reddy
2020-10-09 17:14 ` Sreekanth Reddy [this message]
2020-10-09 17:14 ` [PATCH 14/14] mpt3sas: Bump driver version to 35.101.00.00 Sreekanth Reddy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201009171440.4949-14-sreekanth.reddy@broadcom.com \
--to=sreekanth.reddy@broadcom.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sathya.prakash@broadcom.com \
--cc=suganath-prabu.subramani@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.