aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c217
1 files changed, 191 insertions, 26 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 80a11218b9bb..4bae4a2ed2f1 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -45,6 +45,10 @@
45#define LPFC_MIN_DEVLOSS_TMO 1 45#define LPFC_MIN_DEVLOSS_TMO 1
46#define LPFC_MAX_DEVLOSS_TMO 255 46#define LPFC_MAX_DEVLOSS_TMO 255
47 47
48#define LPFC_MAX_LINK_SPEED 8
49#define LPFC_LINK_SPEED_BITMAP 0x00000117
50#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8"
51
48static void 52static void
49lpfc_jedec_to_ascii(int incr, char hdw[]) 53lpfc_jedec_to_ascii(int incr, char hdw[])
50{ 54{
@@ -86,6 +90,15 @@ lpfc_serialnum_show(struct class_device *cdev, char *buf)
86} 90}
87 91
88static ssize_t 92static ssize_t
93lpfc_temp_sensor_show(struct class_device *cdev, char *buf)
94{
95 struct Scsi_Host *shost = class_to_shost(cdev);
96 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
97 struct lpfc_hba *phba = vport->phba;
98 return snprintf(buf, PAGE_SIZE, "%d\n",phba->temp_sensor_support);
99}
100
101static ssize_t
89lpfc_modeldesc_show(struct class_device *cdev, char *buf) 102lpfc_modeldesc_show(struct class_device *cdev, char *buf)
90{ 103{
91 struct Scsi_Host *shost = class_to_shost(cdev); 104 struct Scsi_Host *shost = class_to_shost(cdev);
@@ -178,12 +191,9 @@ lpfc_state_show(struct class_device *cdev, char *buf)
178 case LPFC_LINK_UP: 191 case LPFC_LINK_UP:
179 case LPFC_CLEAR_LA: 192 case LPFC_CLEAR_LA:
180 case LPFC_HBA_READY: 193 case LPFC_HBA_READY:
181 len += snprintf(buf + len, PAGE_SIZE-len, "Link Up - \n"); 194 len += snprintf(buf + len, PAGE_SIZE-len, "Link Up - ");
182 195
183 switch (vport->port_state) { 196 switch (vport->port_state) {
184 len += snprintf(buf + len, PAGE_SIZE-len,
185 "initializing\n");
186 break;
187 case LPFC_LOCAL_CFG_LINK: 197 case LPFC_LOCAL_CFG_LINK:
188 len += snprintf(buf + len, PAGE_SIZE-len, 198 len += snprintf(buf + len, PAGE_SIZE-len,
189 "Configuring Link\n"); 199 "Configuring Link\n");
@@ -252,8 +262,7 @@ lpfc_issue_lip(struct Scsi_Host *shost)
252 int mbxstatus = MBXERR_ERROR; 262 int mbxstatus = MBXERR_ERROR;
253 263
254 if ((vport->fc_flag & FC_OFFLINE_MODE) || 264 if ((vport->fc_flag & FC_OFFLINE_MODE) ||
255 (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) || 265 (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO))
256 (vport->port_state != LPFC_VPORT_READY))
257 return -EPERM; 266 return -EPERM;
258 267
259 pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); 268 pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL);
@@ -305,12 +314,14 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type)
305 314
306 psli = &phba->sli; 315 psli = &phba->sli;
307 316
317 /* Wait a little for things to settle down, but not
318 * long enough for dev loss timeout to expire.
319 */
308 for (i = 0; i < psli->num_rings; i++) { 320 for (i = 0; i < psli->num_rings; i++) {
309 pring = &psli->ring[i]; 321 pring = &psli->ring[i];
310 /* The linkdown event takes 30 seconds to timeout. */
311 while (pring->txcmplq_cnt) { 322 while (pring->txcmplq_cnt) {
312 msleep(10); 323 msleep(10);
313 if (cnt++ > 3000) { 324 if (cnt++ > 500) { /* 5 secs */
314 lpfc_printf_log(phba, 325 lpfc_printf_log(phba,
315 KERN_WARNING, LOG_INIT, 326 KERN_WARNING, LOG_INIT,
316 "0466 Outstanding IO when " 327 "0466 Outstanding IO when "
@@ -336,6 +347,9 @@ lpfc_selective_reset(struct lpfc_hba *phba)
336 struct completion online_compl; 347 struct completion online_compl;
337 int status = 0; 348 int status = 0;
338 349
350 if (!phba->cfg_enable_hba_reset)
351 return -EIO;
352
339 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); 353 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
340 354
341 if (status != 0) 355 if (status != 0)
@@ -409,6 +423,8 @@ lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count)
409 struct completion online_compl; 423 struct completion online_compl;
410 int status=0; 424 int status=0;
411 425
426 if (!phba->cfg_enable_hba_reset)
427 return -EACCES;
412 init_completion(&online_compl); 428 init_completion(&online_compl);
413 429
414 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { 430 if(strncmp(buf, "online", sizeof("online") - 1) == 0) {
@@ -908,6 +924,8 @@ static CLASS_DEVICE_ATTR(used_rpi, S_IRUGO, lpfc_used_rpi_show, NULL);
908static CLASS_DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL); 924static CLASS_DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL);
909static CLASS_DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL); 925static CLASS_DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL);
910static CLASS_DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL); 926static CLASS_DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL);
927static CLASS_DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show,
928 NULL);
911 929
912 930
913static char *lpfc_soft_wwn_key = "C99G71SL8032A"; 931static char *lpfc_soft_wwn_key = "C99G71SL8032A";
@@ -971,6 +989,14 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count)
971 unsigned int i, j, cnt=count; 989 unsigned int i, j, cnt=count;
972 u8 wwpn[8]; 990 u8 wwpn[8];
973 991
992 if (!phba->cfg_enable_hba_reset)
993 return -EACCES;
994 spin_lock_irq(&phba->hbalock);
995 if (phba->over_temp_state == HBA_OVER_TEMP) {
996 spin_unlock_irq(&phba->hbalock);
997 return -EACCES;
998 }
999 spin_unlock_irq(&phba->hbalock);
974 /* count may include a LF at end of string */ 1000 /* count may include a LF at end of string */
975 if (buf[cnt-1] == '\n') 1001 if (buf[cnt-1] == '\n')
976 cnt--; 1002 cnt--;
@@ -1102,7 +1128,13 @@ MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:"
1102 " 2 - select SLI-2 even on SLI-3 capable HBAs," 1128 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
1103 " 3 - select SLI-3"); 1129 " 3 - select SLI-3");
1104 1130
1105LPFC_ATTR_R(enable_npiv, 0, 0, 1, "Enable NPIV functionality"); 1131int lpfc_enable_npiv = 0;
1132module_param(lpfc_enable_npiv, int, 0);
1133MODULE_PARM_DESC(lpfc_enable_npiv, "Enable NPIV functionality");
1134lpfc_param_show(enable_npiv);
1135lpfc_param_init(enable_npiv, 0, 0, 1);
1136static CLASS_DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO,
1137 lpfc_enable_npiv_show, NULL);
1106 1138
1107/* 1139/*
1108# lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear 1140# lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear
@@ -1248,6 +1280,13 @@ LPFC_VPORT_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff,
1248 "Verbose logging bit-mask"); 1280 "Verbose logging bit-mask");
1249 1281
1250/* 1282/*
1283# lpfc_enable_da_id: This turns on the DA_ID CT command that deregisters
1284# objects that have been registered with the nameserver after login.
1285*/
1286LPFC_VPORT_ATTR_R(enable_da_id, 0, 0, 1,
1287 "Deregister nameserver objects before LOGO");
1288
1289/*
1251# lun_queue_depth: This parameter is used to limit the number of outstanding 1290# lun_queue_depth: This parameter is used to limit the number of outstanding
1252# commands per FCP LUN. Value range is [1,128]. Default value is 30. 1291# commands per FCP LUN. Value range is [1,128]. Default value is 30.
1253*/ 1292*/
@@ -1369,7 +1408,33 @@ LPFC_VPORT_ATTR_R(scan_down, 1, 0, 1,
1369# Set loop mode if you want to run as an NL_Port. Value range is [0,0x6]. 1408# Set loop mode if you want to run as an NL_Port. Value range is [0,0x6].
1370# Default value is 0. 1409# Default value is 0.
1371*/ 1410*/
1372LPFC_ATTR_RW(topology, 0, 0, 6, "Select Fibre Channel topology"); 1411static int
1412lpfc_topology_set(struct lpfc_hba *phba, int val)
1413{
1414 int err;
1415 uint32_t prev_val;
1416 if (val >= 0 && val <= 6) {
1417 prev_val = phba->cfg_topology;
1418 phba->cfg_topology = val;
1419 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport));
1420 if (err)
1421 phba->cfg_topology = prev_val;
1422 return err;
1423 }
1424 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1425 "%d:0467 lpfc_topology attribute cannot be set to %d, "
1426 "allowed range is [0, 6]\n",
1427 phba->brd_no, val);
1428 return -EINVAL;
1429}
1430static int lpfc_topology = 0;
1431module_param(lpfc_topology, int, 0);
1432MODULE_PARM_DESC(lpfc_topology, "Select Fibre Channel topology");
1433lpfc_param_show(topology)
1434lpfc_param_init(topology, 0, 0, 6)
1435lpfc_param_store(topology)
1436static CLASS_DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR,
1437 lpfc_topology_show, lpfc_topology_store);
1373 1438
1374/* 1439/*
1375# lpfc_link_speed: Link speed selection for initializing the Fibre Channel 1440# lpfc_link_speed: Link speed selection for initializing the Fibre Channel
@@ -1381,7 +1446,59 @@ LPFC_ATTR_RW(topology, 0, 0, 6, "Select Fibre Channel topology");
1381# 8 = 8 Gigabaud 1446# 8 = 8 Gigabaud
1382# Value range is [0,8]. Default value is 0. 1447# Value range is [0,8]. Default value is 0.
1383*/ 1448*/
1384LPFC_ATTR_R(link_speed, 0, 0, 8, "Select link speed"); 1449static int
1450lpfc_link_speed_set(struct lpfc_hba *phba, int val)
1451{
1452 int err;
1453 uint32_t prev_val;
1454
1455 if (((val == LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) ||
1456 ((val == LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) ||
1457 ((val == LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) ||
1458 ((val == LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) ||
1459 ((val == LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)))
1460 return -EINVAL;
1461
1462 if ((val >= 0 && val <= LPFC_MAX_LINK_SPEED)
1463 && (LPFC_LINK_SPEED_BITMAP & (1 << val))) {
1464 prev_val = phba->cfg_link_speed;
1465 phba->cfg_link_speed = val;
1466 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport));
1467 if (err)
1468 phba->cfg_link_speed = prev_val;
1469 return err;
1470 }
1471
1472 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1473 "%d:0469 lpfc_link_speed attribute cannot be set to %d, "
1474 "allowed range is [0, 8]\n",
1475 phba->brd_no, val);
1476 return -EINVAL;
1477}
1478
1479static int lpfc_link_speed = 0;
1480module_param(lpfc_link_speed, int, 0);
1481MODULE_PARM_DESC(lpfc_link_speed, "Select link speed");
1482lpfc_param_show(link_speed)
1483static int
1484lpfc_link_speed_init(struct lpfc_hba *phba, int val)
1485{
1486 if ((val >= 0 && val <= LPFC_MAX_LINK_SPEED)
1487 && (LPFC_LINK_SPEED_BITMAP & (1 << val))) {
1488 phba->cfg_link_speed = val;
1489 return 0;
1490 }
1491 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1492 "0454 lpfc_link_speed attribute cannot "
1493 "be set to %d, allowed values are "
1494 "["LPFC_LINK_SPEED_STRING"]\n", val);
1495 phba->cfg_link_speed = 0;
1496 return -EINVAL;
1497}
1498
1499lpfc_param_store(link_speed)
1500static CLASS_DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR,
1501 lpfc_link_speed_show, lpfc_link_speed_store);
1385 1502
1386/* 1503/*
1387# lpfc_fcp_class: Determines FC class to use for the FCP protocol. 1504# lpfc_fcp_class: Determines FC class to use for the FCP protocol.
@@ -1479,7 +1596,30 @@ LPFC_ATTR_RW(poll_tmo, 10, 1, 255,
1479*/ 1596*/
1480LPFC_ATTR_R(use_msi, 0, 0, 1, "Use Message Signaled Interrupts, if possible"); 1597LPFC_ATTR_R(use_msi, 0, 0, 1, "Use Message Signaled Interrupts, if possible");
1481 1598
1599/*
1600# lpfc_enable_hba_reset: Allow or prevent HBA resets to the hardware.
1601# 0 = HBA resets disabled
1602# 1 = HBA resets enabled (default)
1603# Value range is [0,1]. Default value is 1.
1604*/
1605LPFC_ATTR_R(enable_hba_reset, 1, 0, 1, "Enable HBA resets from the driver.");
1606
1607/*
1608# lpfc_enable_hba_heartbeat: Enable HBA heartbeat timer..
1609# 0 = HBA Heartbeat disabled
1610# 1 = HBA Heartbeat enabled (default)
1611# Value range is [0,1]. Default value is 1.
1612*/
1613LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat.");
1482 1614
1615/*
1616 * lpfc_sg_seg_cnt: Initial Maximum DMA Segment Count
1617 * This value can be set to values between 64 and 256. The default value is
1618 * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer
1619 * will be allowed to request I/Os of sizes up to (MAX_SEG_COUNT * SEG_SIZE).
1620 */
1621LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT,
1622 LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count");
1483 1623
1484struct class_device_attribute *lpfc_hba_attrs[] = { 1624struct class_device_attribute *lpfc_hba_attrs[] = {
1485 &class_device_attr_info, 1625 &class_device_attr_info,
@@ -1494,6 +1634,7 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
1494 &class_device_attr_state, 1634 &class_device_attr_state,
1495 &class_device_attr_num_discovered_ports, 1635 &class_device_attr_num_discovered_ports,
1496 &class_device_attr_lpfc_drvr_version, 1636 &class_device_attr_lpfc_drvr_version,
1637 &class_device_attr_lpfc_temp_sensor,
1497 &class_device_attr_lpfc_log_verbose, 1638 &class_device_attr_lpfc_log_verbose,
1498 &class_device_attr_lpfc_lun_queue_depth, 1639 &class_device_attr_lpfc_lun_queue_depth,
1499 &class_device_attr_lpfc_hba_queue_depth, 1640 &class_device_attr_lpfc_hba_queue_depth,
@@ -1530,6 +1671,9 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
1530 &class_device_attr_lpfc_soft_wwnn, 1671 &class_device_attr_lpfc_soft_wwnn,
1531 &class_device_attr_lpfc_soft_wwpn, 1672 &class_device_attr_lpfc_soft_wwpn,
1532 &class_device_attr_lpfc_soft_wwn_enable, 1673 &class_device_attr_lpfc_soft_wwn_enable,
1674 &class_device_attr_lpfc_enable_hba_reset,
1675 &class_device_attr_lpfc_enable_hba_heartbeat,
1676 &class_device_attr_lpfc_sg_seg_cnt,
1533 NULL, 1677 NULL,
1534}; 1678};
1535 1679
@@ -1552,6 +1696,7 @@ struct class_device_attribute *lpfc_vport_attrs[] = {
1552 &class_device_attr_lpfc_max_luns, 1696 &class_device_attr_lpfc_max_luns,
1553 &class_device_attr_nport_evt_cnt, 1697 &class_device_attr_nport_evt_cnt,
1554 &class_device_attr_npiv_info, 1698 &class_device_attr_npiv_info,
1699 &class_device_attr_lpfc_enable_da_id,
1555 NULL, 1700 NULL,
1556}; 1701};
1557 1702
@@ -1727,13 +1872,18 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
1727 1872
1728 spin_lock_irq(&phba->hbalock); 1873 spin_lock_irq(&phba->hbalock);
1729 1874
1875 if (phba->over_temp_state == HBA_OVER_TEMP) {
1876 sysfs_mbox_idle(phba);
1877 spin_unlock_irq(&phba->hbalock);
1878 return -EACCES;
1879 }
1880
1730 if (off == 0 && 1881 if (off == 0 &&
1731 phba->sysfs_mbox.state == SMBOX_WRITING && 1882 phba->sysfs_mbox.state == SMBOX_WRITING &&
1732 phba->sysfs_mbox.offset >= 2 * sizeof(uint32_t)) { 1883 phba->sysfs_mbox.offset >= 2 * sizeof(uint32_t)) {
1733 1884
1734 switch (phba->sysfs_mbox.mbox->mb.mbxCommand) { 1885 switch (phba->sysfs_mbox.mbox->mb.mbxCommand) {
1735 /* Offline only */ 1886 /* Offline only */
1736 case MBX_WRITE_NV:
1737 case MBX_INIT_LINK: 1887 case MBX_INIT_LINK:
1738 case MBX_DOWN_LINK: 1888 case MBX_DOWN_LINK:
1739 case MBX_CONFIG_LINK: 1889 case MBX_CONFIG_LINK:
@@ -1744,9 +1894,7 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
1744 case MBX_DUMP_CONTEXT: 1894 case MBX_DUMP_CONTEXT:
1745 case MBX_RUN_DIAGS: 1895 case MBX_RUN_DIAGS:
1746 case MBX_RESTART: 1896 case MBX_RESTART:
1747 case MBX_FLASH_WR_ULA:
1748 case MBX_SET_MASK: 1897 case MBX_SET_MASK:
1749 case MBX_SET_SLIM:
1750 case MBX_SET_DEBUG: 1898 case MBX_SET_DEBUG:
1751 if (!(vport->fc_flag & FC_OFFLINE_MODE)) { 1899 if (!(vport->fc_flag & FC_OFFLINE_MODE)) {
1752 printk(KERN_WARNING "mbox_read:Command 0x%x " 1900 printk(KERN_WARNING "mbox_read:Command 0x%x "
@@ -1756,6 +1904,8 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
1756 spin_unlock_irq(&phba->hbalock); 1904 spin_unlock_irq(&phba->hbalock);
1757 return -EPERM; 1905 return -EPERM;
1758 } 1906 }
1907 case MBX_WRITE_NV:
1908 case MBX_WRITE_VPARMS:
1759 case MBX_LOAD_SM: 1909 case MBX_LOAD_SM:
1760 case MBX_READ_NV: 1910 case MBX_READ_NV:
1761 case MBX_READ_CONFIG: 1911 case MBX_READ_CONFIG:
@@ -1772,6 +1922,8 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
1772 case MBX_LOAD_EXP_ROM: 1922 case MBX_LOAD_EXP_ROM:
1773 case MBX_BEACON: 1923 case MBX_BEACON:
1774 case MBX_DEL_LD_ENTRY: 1924 case MBX_DEL_LD_ENTRY:
1925 case MBX_SET_VARIABLE:
1926 case MBX_WRITE_WWN:
1775 break; 1927 break;
1776 case MBX_READ_SPARM64: 1928 case MBX_READ_SPARM64:
1777 case MBX_READ_LA: 1929 case MBX_READ_LA:
@@ -1793,6 +1945,17 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
1793 return -EPERM; 1945 return -EPERM;
1794 } 1946 }
1795 1947
1948 /* If HBA encountered an error attention, allow only DUMP
1949 * mailbox command until the HBA is restarted.
1950 */
1951 if ((phba->pport->stopped) &&
1952 (phba->sysfs_mbox.mbox->mb.mbxCommand
1953 != MBX_DUMP_MEMORY)) {
1954 sysfs_mbox_idle(phba);
1955 spin_unlock_irq(&phba->hbalock);
1956 return -EPERM;
1957 }
1958
1796 phba->sysfs_mbox.mbox->vport = vport; 1959 phba->sysfs_mbox.mbox->vport = vport;
1797 1960
1798 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) { 1961 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) {
@@ -1993,7 +2156,8 @@ lpfc_get_host_speed(struct Scsi_Host *shost)
1993 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; 2156 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
1994 break; 2157 break;
1995 } 2158 }
1996 } 2159 } else
2160 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
1997 2161
1998 spin_unlock_irq(shost->host_lock); 2162 spin_unlock_irq(shost->host_lock);
1999} 2163}
@@ -2013,7 +2177,7 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost)
2013 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); 2177 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn);
2014 else 2178 else
2015 /* fabric is local port if there is no F/FL_Port */ 2179 /* fabric is local port if there is no F/FL_Port */
2016 node_name = wwn_to_u64(vport->fc_nodename.u.wwn); 2180 node_name = 0;
2017 2181
2018 spin_unlock_irq(shost->host_lock); 2182 spin_unlock_irq(shost->host_lock);
2019 2183
@@ -2337,8 +2501,6 @@ struct fc_function_template lpfc_transport_functions = {
2337 .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk, 2501 .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk,
2338 .terminate_rport_io = lpfc_terminate_rport_io, 2502 .terminate_rport_io = lpfc_terminate_rport_io,
2339 2503
2340 .vport_create = lpfc_vport_create,
2341 .vport_delete = lpfc_vport_delete,
2342 .dd_fcvport_size = sizeof(struct lpfc_vport *), 2504 .dd_fcvport_size = sizeof(struct lpfc_vport *),
2343}; 2505};
2344 2506
@@ -2414,21 +2576,23 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
2414 lpfc_poll_tmo_init(phba, lpfc_poll_tmo); 2576 lpfc_poll_tmo_init(phba, lpfc_poll_tmo);
2415 lpfc_enable_npiv_init(phba, lpfc_enable_npiv); 2577 lpfc_enable_npiv_init(phba, lpfc_enable_npiv);
2416 lpfc_use_msi_init(phba, lpfc_use_msi); 2578 lpfc_use_msi_init(phba, lpfc_use_msi);
2579 lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset);
2580 lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat);
2417 phba->cfg_poll = lpfc_poll; 2581 phba->cfg_poll = lpfc_poll;
2418 phba->cfg_soft_wwnn = 0L; 2582 phba->cfg_soft_wwnn = 0L;
2419 phba->cfg_soft_wwpn = 0L; 2583 phba->cfg_soft_wwpn = 0L;
2420 /* 2584 lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt);
2421 * The total number of segments is the configuration value plus 2 2585 /* Also reinitialize the host templates with new values. */
2422 * since the IOCB need a command and response bde. 2586 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;
2423 */ 2587 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;
2424 phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2;
2425 /* 2588 /*
2426 * Since the sg_tablesize is module parameter, the sg_dma_buf_size 2589 * Since the sg_tablesize is module parameter, the sg_dma_buf_size
2427 * used to create the sg_dma_buf_pool must be dynamically calculated 2590 * used to create the sg_dma_buf_pool must be dynamically calculated.
2591 * 2 segments are added since the IOCB needs a command and response bde.
2428 */ 2592 */
2429 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + 2593 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) +
2430 sizeof(struct fcp_rsp) + 2594 sizeof(struct fcp_rsp) +
2431 (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); 2595 ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64));
2432 lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); 2596 lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth);
2433 return; 2597 return;
2434} 2598}
@@ -2448,5 +2612,6 @@ lpfc_get_vport_cfgparam(struct lpfc_vport *vport)
2448 lpfc_discovery_threads_init(vport, lpfc_discovery_threads); 2612 lpfc_discovery_threads_init(vport, lpfc_discovery_threads);
2449 lpfc_max_luns_init(vport, lpfc_max_luns); 2613 lpfc_max_luns_init(vport, lpfc_max_luns);
2450 lpfc_scan_down_init(vport, lpfc_scan_down); 2614 lpfc_scan_down_init(vport, lpfc_scan_down);
2615 lpfc_enable_da_id_init(vport, lpfc_enable_da_id);
2451 return; 2616 return;
2452} 2617}