Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F169831243
D8403.id21854.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D8403.id21854.diff
View Options
Index: sys/dev/mpr/mpr.c
===================================================================
--- sys/dev/mpr/mpr.c
+++ sys/dev/mpr/mpr.c
@@ -1387,6 +1387,7 @@
TUNABLE_INT_FETCH("hw.mpr.max_io_pages", &sc->max_io_pages);
TUNABLE_INT_FETCH("hw.mpr.enable_ssu", &sc->enable_ssu);
TUNABLE_INT_FETCH("hw.mpr.spinup_wait_time", &sc->spinup_wait_time);
+ TUNABLE_INT_FETCH("hw.mpr.use_phy_num", &sc->use_phynum);
/* Grab the unit-instance variables */
snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.debug_level",
@@ -1421,6 +1422,10 @@
snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.spinup_wait_time",
device_get_unit(sc->mpr_dev));
TUNABLE_INT_FETCH(tmpstr, &sc->spinup_wait_time);
+
+ snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.use_phy_num",
+ device_get_unit(sc->mpr_dev));
+ TUNABLE_INT_FETCH(tmpstr, &sc->use_phynum);
}
static void
@@ -1510,6 +1515,10 @@
OID_AUTO, "spinup_wait_time", CTLFLAG_RD,
&sc->spinup_wait_time, DEFAULT_SPINUP_WAIT, "seconds to wait for "
"spinup after SATA ID error");
+
+ SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
+ OID_AUTO, "use_phy_num", CTLFLAG_RD, &sc->use_phynum, 0,
+ "use the phy number for enumation");
}
int
Index: sys/dev/mpr/mpr_sas_lsi.c
===================================================================
--- sys/dev/mpr/mpr_sas_lsi.c
+++ sys/dev/mpr/mpr_sas_lsi.c
@@ -757,13 +757,24 @@
}
}
- id = mpr_mapping_get_sas_id(sc, sas_address, handle);
+ /*
+ * use_phynum:
+ * 1 - use the PhyNum field as a fallback to the mapping logic
+ * 0 - never use the PhyNum field
+ * -1 - only use the PhyNum field
+ */
+ id = MPR_MAP_BAD_ID;
+ if (sc->use_phynum != -1)
+ id = mpr_mapping_get_sas_id(sc, sas_address, handle);
if (id == MPR_MAP_BAD_ID) {
- printf("failure at %s:%d/%s()! Could not get ID for device "
- "with handle 0x%04x\n", __FILE__, __LINE__, __func__,
- handle);
- error = ENXIO;
- goto out;
+ if ((sc->use_phynum == 0)
+ || ((id = config_page.PhyNum) > sassc->maxtargets)) {
+ mpr_dprint(sc, MPR_INFO, "failure at %s:%d/%s()! "
+ "Could not get ID for device with handle 0x%04x\n",
+ __FILE__, __LINE__, __func__, handle);
+ error = ENXIO;
+ goto out;
+ }
}
if (mprsas_check_id(sassc, id) != 0) {
@@ -772,9 +783,16 @@
goto out;
}
+ targ = &sassc->targets[id];
+ if (targ->handle != 0x0) {
+ mpr_dprint(sc, MPR_MAPPING, "Attempting to reuse target id "
+ "%d handle 0x%04x\n", id, targ->handle);
+ error = ENXIO;
+ goto out;
+ }
+
mpr_dprint(sc, MPR_MAPPING, "SAS Address from SAS device page0 = %jx\n",
sas_address);
- targ = &sassc->targets[id];
targ->devinfo = device_info;
targ->devname = le32toh(config_page.DeviceName.High);
targ->devname = (targ->devname << 32) |
Index: sys/dev/mpr/mprvar.h
===================================================================
--- sys/dev/mpr/mprvar.h
+++ sys/dev/mpr/mprvar.h
@@ -370,6 +370,7 @@
uint32_t pending_map_events;
uint8_t mt_full_retry;
uint8_t mt_add_device_failed;
+ int use_phynum;
/* FW diag Buffer List */
mpr_fw_diagnostic_buffer_t
Index: sys/dev/mps/mps.c
===================================================================
--- sys/dev/mps/mps.c
+++ sys/dev/mps/mps.c
@@ -1364,6 +1364,7 @@
TUNABLE_INT_FETCH("hw.mps.max_io_pages", &sc->max_io_pages);
TUNABLE_INT_FETCH("hw.mps.enable_ssu", &sc->enable_ssu);
TUNABLE_INT_FETCH("hw.mps.spinup_wait_time", &sc->spinup_wait_time);
+ TUNABLE_INT_FETCH("hw.mps.use_phy_num", &sc->use_phynum);
/* Grab the unit-instance variables */
snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.debug_level",
@@ -1398,6 +1399,10 @@
snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.spinup_wait_time",
device_get_unit(sc->mps_dev));
TUNABLE_INT_FETCH(tmpstr, &sc->spinup_wait_time);
+
+ snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.use_phy_num",
+ device_get_unit(sc->mps_dev));
+ TUNABLE_INT_FETCH(tmpstr, &sc->use_phynum);
}
static void
@@ -1495,6 +1500,10 @@
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
OID_AUTO, "encl_table_dump", CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
mps_mapping_encl_dump, "A", "Enclosure Table Dump");
+
+ SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
+ OID_AUTO, "use_phy_num", CTLFLAG_RD, &sc->use_phynum, 0,
+ "use the phy number for enumation");
}
int
Index: sys/dev/mps/mps_sas_lsi.c
===================================================================
--- sys/dev/mps/mps_sas_lsi.c
+++ sys/dev/mps/mps_sas_lsi.c
@@ -669,13 +669,24 @@
}
}
- id = mps_mapping_get_sas_id(sc, sas_address, handle);
+ /*
+ * use_phynum:
+ * 1 - use the PhyNum field as a fallback to the mapping logic
+ * 0 - never use the PhyNum field
+ * -1 - only use the PhyNum field
+ */
+ id = MPS_MAP_BAD_ID;
+ if (sc->use_phynum != -1)
+ id = mps_mapping_get_sas_id(sc, sas_address, handle);
if (id == MPS_MAP_BAD_ID) {
- printf("failure at %s:%d/%s()! Could not get ID for device "
- "with handle 0x%04x\n", __FILE__, __LINE__, __func__,
- handle);
- error = ENXIO;
- goto out;
+ if ((sc->use_phynum == 0)
+ || ((id = config_page.PhyNum) > sassc->maxtargets)) {
+ mps_dprint(sc, MPS_INFO, "failure at %s:%d/%s()! "
+ "Could not get ID for device with handle 0x%04x\n",
+ __FILE__, __LINE__, __func__, handle);
+ error = ENXIO;
+ goto out;
+ }
}
if (mpssas_check_id(sassc, id) != 0) {
@@ -684,9 +695,16 @@
goto out;
}
+ targ = &sassc->targets[id];
+ if (targ->handle != 0x0) {
+ mps_dprint(sc, MPS_MAPPING, "Attempting to reuse target id "
+ "%d handle 0x%04x\n", id, targ->handle);
+ error = ENXIO;
+ goto out;
+ }
+
mps_dprint(sc, MPS_MAPPING, "SAS Address from SAS device page0 = %jx\n",
sas_address);
- targ = &sassc->targets[id];
targ->devinfo = device_info;
targ->devname = le32toh(config_page.DeviceName.High);
targ->devname = (targ->devname << 32) |
Index: sys/dev/mps/mpsvar.h
===================================================================
--- sys/dev/mps/mpsvar.h
+++ sys/dev/mps/mpsvar.h
@@ -383,6 +383,7 @@
uint32_t pending_map_events;
uint8_t mt_full_retry;
uint8_t mt_add_device_failed;
+ int use_phynum;
/* FW diag Buffer List */
mps_fw_diagnostic_buffer_t
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Sep 3, 5:06 PM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38054911
Default Alt Text
D8403.id21854.diff (6 KB)
Attached To
Mode
D8403: mpr/mps device mapper override
Attached
Detach File
Event Timeline
Log In to Comment