@@ -159,6 +159,15 @@ module_param(enable_sdev_max_qd, bool, 0444);
159159MODULE_PARM_DESC (enable_sdev_max_qd ,
160160 "Enable sdev max qd as can_queue, def=disabled(0)" );
161161
162+ static int multipath_on_hba = -1 ;
163+ module_param (multipath_on_hba , int , 0 );
164+ MODULE_PARM_DESC (multipath_on_hba ,
165+ "Multipath support to add same target device\n\t\t"
166+ "as many times as it is visible to HBA from various paths\n\t\t"
167+ "(by default:\n\t\t"
168+ "\t SAS 2.0 & SAS 3.0 HBA - This will be disabled,\n\t\t"
169+ "\t SAS 3.5 HBA - This will be enabled)" );
170+
162171/* raid transport support */
163172static struct raid_template * mpt3sas_raid_template ;
164173static struct raid_template * mpt2sas_raid_template ;
@@ -373,6 +382,14 @@ mpt3sas_get_port_by_id(struct MPT3SAS_ADAPTER *ioc,
373382{
374383 struct hba_port * port , * port_next ;
375384
385+ /*
386+ * When multipath_on_hba is disabled then
387+ * search the hba_port entry using default
388+ * port id i.e. 255
389+ */
390+ if (!ioc -> multipath_on_hba )
391+ port_id = MULTIPATH_DISABLED_PORT_ID ;
392+
376393 list_for_each_entry_safe (port , port_next ,
377394 & ioc -> port_table_list , list ) {
378395 if (port -> port_id != port_id )
@@ -384,6 +401,24 @@ mpt3sas_get_port_by_id(struct MPT3SAS_ADAPTER *ioc,
384401 return port ;
385402 }
386403
404+ /*
405+ * Allocate hba_port object for default port id (i.e. 255)
406+ * when multipath_on_hba is disabled for the HBA.
407+ * And add this object to port_table_list.
408+ */
409+ if (!ioc -> multipath_on_hba ) {
410+ port = kzalloc (sizeof (struct hba_port ), GFP_KERNEL );
411+ if (!port )
412+ return NULL ;
413+
414+ port -> port_id = port_id ;
415+ ioc_info (ioc ,
416+ "hba_port entry: %p, port: %d is added to hba_port list\n" ,
417+ port , port -> port_id );
418+ list_add_tail (& port -> list ,
419+ & ioc -> port_table_list );
420+ return port ;
421+ }
387422 return NULL ;
388423}
389424
@@ -10014,6 +10049,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc)
1001410049 u16 ioc_status ;
1001510050 u64 sas_address ;
1001610051 u16 handle ;
10052+ u8 port ;
1001710053
1001810054 ioc_info (ioc , "search for expanders: start\n" );
1001910055
@@ -10031,10 +10067,12 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc)
1003110067
1003210068 handle = le16_to_cpu (expander_pg0 .DevHandle );
1003310069 sas_address = le64_to_cpu (expander_pg0 .SASAddress );
10070+ port = expander_pg0 .PhysicalPort ;
1003410071 pr_info (
1003510072 "\texpander present: handle(0x%04x), sas_addr(0x%016llx), port:%d\n" ,
1003610073 handle , (unsigned long long )sas_address ,
10037- expander_pg0 .PhysicalPort );
10074+ (ioc -> multipath_on_hba ?
10075+ port : MULTIPATH_DISABLED_PORT_ID ));
1003810076 _scsih_mark_responding_expander (ioc , & expander_pg0 );
1003910077 }
1004010078
@@ -10477,8 +10515,10 @@ mpt3sas_scsih_reset_done_handler(struct MPT3SAS_ADAPTER *ioc)
1047710515 dtmprintk (ioc , ioc_info (ioc , "%s: MPT3_IOC_DONE_RESET\n" , __func__ ));
1047810516 if ((!ioc -> is_driver_loading ) && !(disable_discovery > 0 &&
1047910517 !ioc -> sas_hba .num_phys )) {
10480- _scsih_sas_port_refresh (ioc );
10481- _scsih_update_vphys_after_reset (ioc );
10518+ if (ioc -> multipath_on_hba ) {
10519+ _scsih_sas_port_refresh (ioc );
10520+ _scsih_update_vphys_after_reset (ioc );
10521+ }
1048210522 _scsih_prep_device_scan (ioc );
1048310523 _scsih_create_enclosure_list_after_reset (ioc );
1048410524 _scsih_search_responding_sas_devices (ioc );
@@ -11766,6 +11806,12 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1176611806 ioc -> mfg_pg10_hide_flag = MFG_PAGE10_EXPOSE_ALL_DISKS ;
1176711807 break ;
1176811808 }
11809+
11810+ if (multipath_on_hba == -1 || multipath_on_hba == 0 )
11811+ ioc -> multipath_on_hba = 0 ;
11812+ else
11813+ ioc -> multipath_on_hba = 1 ;
11814+
1176911815 break ;
1177011816 case MPI25_VERSION :
1177111817 case MPI26_VERSION :
@@ -11827,6 +11873,23 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1182711873 ioc -> combined_reply_index_count =
1182811874 MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G3 ;
1182911875 }
11876+
11877+ switch (ioc -> is_gen35_ioc ) {
11878+ case 0 :
11879+ if (multipath_on_hba == -1 || multipath_on_hba == 0 )
11880+ ioc -> multipath_on_hba = 0 ;
11881+ else
11882+ ioc -> multipath_on_hba = 1 ;
11883+ break ;
11884+ case 1 :
11885+ if (multipath_on_hba == -1 || multipath_on_hba > 0 )
11886+ ioc -> multipath_on_hba = 1 ;
11887+ else
11888+ ioc -> multipath_on_hba = 0 ;
11889+ default :
11890+ break ;
11891+ }
11892+
1183011893 break ;
1183111894 default :
1183211895 return - ENODEV ;
0 commit comments