diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 212 |
1 files changed, 129 insertions, 83 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index f247e786af99..95fe77e816f8 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-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 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 * |
@@ -20,6 +20,7 @@ | |||
20 | *******************************************************************/ | 20 | *******************************************************************/ |
21 | 21 | ||
22 | #include <linux/ctype.h> | 22 | #include <linux/ctype.h> |
23 | #include <linux/delay.h> | ||
23 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
24 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
25 | 26 | ||
@@ -213,6 +214,7 @@ lpfc_issue_lip(struct Scsi_Host *host) | |||
213 | int mbxstatus = MBXERR_ERROR; | 214 | int mbxstatus = MBXERR_ERROR; |
214 | 215 | ||
215 | if ((phba->fc_flag & FC_OFFLINE_MODE) || | 216 | if ((phba->fc_flag & FC_OFFLINE_MODE) || |
217 | (phba->fc_flag & FC_BLOCK_MGMT_IO) || | ||
216 | (phba->hba_state != LPFC_HBA_READY)) | 218 | (phba->hba_state != LPFC_HBA_READY)) |
217 | return -EPERM; | 219 | return -EPERM; |
218 | 220 | ||
@@ -235,6 +237,7 @@ lpfc_issue_lip(struct Scsi_Host *host) | |||
235 | phba->fc_ratov * 2); | 237 | phba->fc_ratov * 2); |
236 | } | 238 | } |
237 | 239 | ||
240 | lpfc_set_loopback_flag(phba); | ||
238 | if (mbxstatus == MBX_TIMEOUT) | 241 | if (mbxstatus == MBX_TIMEOUT) |
239 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 242 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
240 | else | 243 | else |
@@ -247,19 +250,62 @@ lpfc_issue_lip(struct Scsi_Host *host) | |||
247 | } | 250 | } |
248 | 251 | ||
249 | static int | 252 | static int |
250 | lpfc_selective_reset(struct lpfc_hba *phba) | 253 | lpfc_do_offline(struct lpfc_hba *phba, uint32_t type) |
251 | { | 254 | { |
252 | struct completion online_compl; | 255 | struct completion online_compl; |
256 | struct lpfc_sli_ring *pring; | ||
257 | struct lpfc_sli *psli; | ||
253 | int status = 0; | 258 | int status = 0; |
259 | int cnt = 0; | ||
260 | int i; | ||
254 | 261 | ||
255 | init_completion(&online_compl); | 262 | init_completion(&online_compl); |
256 | lpfc_workq_post_event(phba, &status, &online_compl, | 263 | lpfc_workq_post_event(phba, &status, &online_compl, |
257 | LPFC_EVT_OFFLINE); | 264 | LPFC_EVT_OFFLINE_PREP); |
265 | wait_for_completion(&online_compl); | ||
266 | |||
267 | if (status != 0) | ||
268 | return -EIO; | ||
269 | |||
270 | psli = &phba->sli; | ||
271 | |||
272 | for (i = 0; i < psli->num_rings; i++) { | ||
273 | pring = &psli->ring[i]; | ||
274 | /* The linkdown event takes 30 seconds to timeout. */ | ||
275 | while (pring->txcmplq_cnt) { | ||
276 | msleep(10); | ||
277 | if (cnt++ > 3000) { | ||
278 | lpfc_printf_log(phba, | ||
279 | KERN_WARNING, LOG_INIT, | ||
280 | "%d:0466 Outstanding IO when " | ||
281 | "bringing Adapter offline\n", | ||
282 | phba->brd_no); | ||
283 | break; | ||
284 | } | ||
285 | } | ||
286 | } | ||
287 | |||
288 | init_completion(&online_compl); | ||
289 | lpfc_workq_post_event(phba, &status, &online_compl, type); | ||
258 | wait_for_completion(&online_compl); | 290 | wait_for_completion(&online_compl); |
259 | 291 | ||
260 | if (status != 0) | 292 | if (status != 0) |
261 | return -EIO; | 293 | return -EIO; |
262 | 294 | ||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | static int | ||
299 | lpfc_selective_reset(struct lpfc_hba *phba) | ||
300 | { | ||
301 | struct completion online_compl; | ||
302 | int status = 0; | ||
303 | |||
304 | status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); | ||
305 | |||
306 | if (status != 0) | ||
307 | return status; | ||
308 | |||
263 | init_completion(&online_compl); | 309 | init_completion(&online_compl); |
264 | lpfc_workq_post_event(phba, &status, &online_compl, | 310 | lpfc_workq_post_event(phba, &status, &online_compl, |
265 | LPFC_EVT_ONLINE); | 311 | LPFC_EVT_ONLINE); |
@@ -324,23 +370,19 @@ lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count) | |||
324 | 370 | ||
325 | init_completion(&online_compl); | 371 | init_completion(&online_compl); |
326 | 372 | ||
327 | if(strncmp(buf, "online", sizeof("online") - 1) == 0) | 373 | if(strncmp(buf, "online", sizeof("online") - 1) == 0) { |
328 | lpfc_workq_post_event(phba, &status, &online_compl, | 374 | lpfc_workq_post_event(phba, &status, &online_compl, |
329 | LPFC_EVT_ONLINE); | 375 | LPFC_EVT_ONLINE); |
330 | else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) | 376 | wait_for_completion(&online_compl); |
331 | lpfc_workq_post_event(phba, &status, &online_compl, | 377 | } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) |
332 | LPFC_EVT_OFFLINE); | 378 | status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); |
333 | else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) | 379 | else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) |
334 | lpfc_workq_post_event(phba, &status, &online_compl, | 380 | status = lpfc_do_offline(phba, LPFC_EVT_WARM_START); |
335 | LPFC_EVT_WARM_START); | 381 | else if (strncmp(buf, "error", sizeof("error") - 1) == 0) |
336 | else if (strncmp(buf, "error", sizeof("error") - 1) == 0) | 382 | status = lpfc_do_offline(phba, LPFC_EVT_KILL); |
337 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
338 | LPFC_EVT_KILL); | ||
339 | else | 383 | else |
340 | return -EINVAL; | 384 | return -EINVAL; |
341 | 385 | ||
342 | wait_for_completion(&online_compl); | ||
343 | |||
344 | if (!status) | 386 | if (!status) |
345 | return strlen(buf); | 387 | return strlen(buf); |
346 | else | 388 | else |
@@ -645,9 +687,7 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count) | |||
645 | dev_printk(KERN_NOTICE, &phba->pcidev->dev, | 687 | dev_printk(KERN_NOTICE, &phba->pcidev->dev, |
646 | "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); | 688 | "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); |
647 | 689 | ||
648 | init_completion(&online_compl); | 690 | stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); |
649 | lpfc_workq_post_event(phba, &stat1, &online_compl, LPFC_EVT_OFFLINE); | ||
650 | wait_for_completion(&online_compl); | ||
651 | if (stat1) | 691 | if (stat1) |
652 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 692 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
653 | "%d:0463 lpfc_soft_wwpn attribute set failed to reinit " | 693 | "%d:0463 lpfc_soft_wwpn attribute set failed to reinit " |
@@ -789,6 +829,18 @@ lpfc_nodev_tmo_init(struct lpfc_hba *phba, int val) | |||
789 | return -EINVAL; | 829 | return -EINVAL; |
790 | } | 830 | } |
791 | 831 | ||
832 | static void | ||
833 | lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba) | ||
834 | { | ||
835 | struct lpfc_nodelist *ndlp; | ||
836 | |||
837 | spin_lock_irq(phba->host->host_lock); | ||
838 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) | ||
839 | if (ndlp->rport) | ||
840 | ndlp->rport->dev_loss_tmo = phba->cfg_devloss_tmo; | ||
841 | spin_unlock_irq(phba->host->host_lock); | ||
842 | } | ||
843 | |||
792 | static int | 844 | static int |
793 | lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) | 845 | lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) |
794 | { | 846 | { |
@@ -804,6 +856,7 @@ lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) | |||
804 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { | 856 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { |
805 | phba->cfg_nodev_tmo = val; | 857 | phba->cfg_nodev_tmo = val; |
806 | phba->cfg_devloss_tmo = val; | 858 | phba->cfg_devloss_tmo = val; |
859 | lpfc_update_rport_devloss_tmo(phba); | ||
807 | return 0; | 860 | return 0; |
808 | } | 861 | } |
809 | 862 | ||
@@ -839,6 +892,7 @@ lpfc_devloss_tmo_set(struct lpfc_hba *phba, int val) | |||
839 | phba->cfg_nodev_tmo = val; | 892 | phba->cfg_nodev_tmo = val; |
840 | phba->cfg_devloss_tmo = val; | 893 | phba->cfg_devloss_tmo = val; |
841 | phba->dev_loss_tmo_changed = 1; | 894 | phba->dev_loss_tmo_changed = 1; |
895 | lpfc_update_rport_devloss_tmo(phba); | ||
842 | return 0; | 896 | return 0; |
843 | } | 897 | } |
844 | 898 | ||
@@ -931,9 +985,10 @@ LPFC_ATTR_RW(topology, 0, 0, 6, "Select Fibre Channel topology"); | |||
931 | # 1 = 1 Gigabaud | 985 | # 1 = 1 Gigabaud |
932 | # 2 = 2 Gigabaud | 986 | # 2 = 2 Gigabaud |
933 | # 4 = 4 Gigabaud | 987 | # 4 = 4 Gigabaud |
934 | # Value range is [0,4]. Default value is 0. | 988 | # 8 = 8 Gigabaud |
989 | # Value range is [0,8]. Default value is 0. | ||
935 | */ | 990 | */ |
936 | LPFC_ATTR_R(link_speed, 0, 0, 4, "Select link speed"); | 991 | LPFC_ATTR_R(link_speed, 0, 0, 8, "Select link speed"); |
937 | 992 | ||
938 | /* | 993 | /* |
939 | # lpfc_fcp_class: Determines FC class to use for the FCP protocol. | 994 | # lpfc_fcp_class: Determines FC class to use for the FCP protocol. |
@@ -958,7 +1013,7 @@ LPFC_ATTR_R(ack0, 0, 0, 1, "Enable ACK0 support"); | |||
958 | /* | 1013 | /* |
959 | # lpfc_cr_delay & lpfc_cr_count: Default values for I/O colaesing | 1014 | # lpfc_cr_delay & lpfc_cr_count: Default values for I/O colaesing |
960 | # cr_delay (msec) or cr_count outstanding commands. cr_delay can take | 1015 | # cr_delay (msec) or cr_count outstanding commands. cr_delay can take |
961 | # value [0,63]. cr_count can take value [0,255]. Default value of cr_delay | 1016 | # value [0,63]. cr_count can take value [1,255]. Default value of cr_delay |
962 | # is 0. Default value of cr_count is 1. The cr_count feature is disabled if | 1017 | # is 0. Default value of cr_count is 1. The cr_count feature is disabled if |
963 | # cr_delay is set to 0. | 1018 | # cr_delay is set to 0. |
964 | */ | 1019 | */ |
@@ -1227,11 +1282,11 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1227 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | 1282 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
1228 | int rc; | 1283 | int rc; |
1229 | 1284 | ||
1230 | if (off > sizeof(MAILBOX_t)) | 1285 | if (off > MAILBOX_CMD_SIZE) |
1231 | return -ERANGE; | 1286 | return -ERANGE; |
1232 | 1287 | ||
1233 | if ((count + off) > sizeof(MAILBOX_t)) | 1288 | if ((count + off) > MAILBOX_CMD_SIZE) |
1234 | count = sizeof(MAILBOX_t) - off; | 1289 | count = MAILBOX_CMD_SIZE - off; |
1235 | 1290 | ||
1236 | if (off % 4 || count % 4 || (unsigned long)buf % 4) | 1291 | if (off % 4 || count % 4 || (unsigned long)buf % 4) |
1237 | return -EINVAL; | 1292 | return -EINVAL; |
@@ -1307,6 +1362,12 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1307 | return -EPERM; | 1362 | return -EPERM; |
1308 | } | 1363 | } |
1309 | 1364 | ||
1365 | if (phba->fc_flag & FC_BLOCK_MGMT_IO) { | ||
1366 | sysfs_mbox_idle(phba); | ||
1367 | spin_unlock_irq(host->host_lock); | ||
1368 | return -EAGAIN; | ||
1369 | } | ||
1370 | |||
1310 | if ((phba->fc_flag & FC_OFFLINE_MODE) || | 1371 | if ((phba->fc_flag & FC_OFFLINE_MODE) || |
1311 | (!(phba->sli.sli_flag & LPFC_SLI2_ACTIVE))){ | 1372 | (!(phba->sli.sli_flag & LPFC_SLI2_ACTIVE))){ |
1312 | 1373 | ||
@@ -1326,6 +1387,11 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1326 | } | 1387 | } |
1327 | 1388 | ||
1328 | if (rc != MBX_SUCCESS) { | 1389 | if (rc != MBX_SUCCESS) { |
1390 | if (rc == MBX_TIMEOUT) { | ||
1391 | phba->sysfs_mbox.mbox->mbox_cmpl = | ||
1392 | lpfc_sli_def_mbox_cmpl; | ||
1393 | phba->sysfs_mbox.mbox = NULL; | ||
1394 | } | ||
1329 | sysfs_mbox_idle(phba); | 1395 | sysfs_mbox_idle(phba); |
1330 | spin_unlock_irq(host->host_lock); | 1396 | spin_unlock_irq(host->host_lock); |
1331 | return (rc == MBX_TIMEOUT) ? -ETIME : -ENODEV; | 1397 | return (rc == MBX_TIMEOUT) ? -ETIME : -ENODEV; |
@@ -1344,7 +1410,7 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1344 | 1410 | ||
1345 | phba->sysfs_mbox.offset = off + count; | 1411 | phba->sysfs_mbox.offset = off + count; |
1346 | 1412 | ||
1347 | if (phba->sysfs_mbox.offset == sizeof(MAILBOX_t)) | 1413 | if (phba->sysfs_mbox.offset == MAILBOX_CMD_SIZE) |
1348 | sysfs_mbox_idle(phba); | 1414 | sysfs_mbox_idle(phba); |
1349 | 1415 | ||
1350 | spin_unlock_irq(phba->host->host_lock); | 1416 | spin_unlock_irq(phba->host->host_lock); |
@@ -1358,7 +1424,7 @@ static struct bin_attribute sysfs_mbox_attr = { | |||
1358 | .mode = S_IRUSR | S_IWUSR, | 1424 | .mode = S_IRUSR | S_IWUSR, |
1359 | .owner = THIS_MODULE, | 1425 | .owner = THIS_MODULE, |
1360 | }, | 1426 | }, |
1361 | .size = sizeof(MAILBOX_t), | 1427 | .size = MAILBOX_CMD_SIZE, |
1362 | .read = sysfs_mbox_read, | 1428 | .read = sysfs_mbox_read, |
1363 | .write = sysfs_mbox_write, | 1429 | .write = sysfs_mbox_write, |
1364 | }; | 1430 | }; |
@@ -1494,6 +1560,9 @@ lpfc_get_host_speed(struct Scsi_Host *shost) | |||
1494 | case LA_4GHZ_LINK: | 1560 | case LA_4GHZ_LINK: |
1495 | fc_host_speed(shost) = FC_PORTSPEED_4GBIT; | 1561 | fc_host_speed(shost) = FC_PORTSPEED_4GBIT; |
1496 | break; | 1562 | break; |
1563 | case LA_8GHZ_LINK: | ||
1564 | fc_host_speed(shost) = FC_PORTSPEED_8GBIT; | ||
1565 | break; | ||
1497 | default: | 1566 | default: |
1498 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; | 1567 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; |
1499 | break; | 1568 | break; |
@@ -1546,6 +1615,9 @@ lpfc_get_stats(struct Scsi_Host *shost) | |||
1546 | unsigned long seconds; | 1615 | unsigned long seconds; |
1547 | int rc = 0; | 1616 | int rc = 0; |
1548 | 1617 | ||
1618 | if (phba->fc_flag & FC_BLOCK_MGMT_IO) | ||
1619 | return NULL; | ||
1620 | |||
1549 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 1621 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
1550 | if (!pmboxq) | 1622 | if (!pmboxq) |
1551 | return NULL; | 1623 | return NULL; |
@@ -1631,6 +1703,8 @@ lpfc_get_stats(struct Scsi_Host *shost) | |||
1631 | else | 1703 | else |
1632 | hs->seconds_since_last_reset = seconds - psli->stats_start; | 1704 | hs->seconds_since_last_reset = seconds - psli->stats_start; |
1633 | 1705 | ||
1706 | mempool_free(pmboxq, phba->mbox_mem_pool); | ||
1707 | |||
1634 | return hs; | 1708 | return hs; |
1635 | } | 1709 | } |
1636 | 1710 | ||
@@ -1644,6 +1718,9 @@ lpfc_reset_stats(struct Scsi_Host *shost) | |||
1644 | MAILBOX_t *pmb; | 1718 | MAILBOX_t *pmb; |
1645 | int rc = 0; | 1719 | int rc = 0; |
1646 | 1720 | ||
1721 | if (phba->fc_flag & FC_BLOCK_MGMT_IO) | ||
1722 | return; | ||
1723 | |||
1647 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 1724 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
1648 | if (!pmboxq) | 1725 | if (!pmboxq) |
1649 | return; | 1726 | return; |
@@ -1699,6 +1776,8 @@ lpfc_reset_stats(struct Scsi_Host *shost) | |||
1699 | 1776 | ||
1700 | psli->stats_start = get_seconds(); | 1777 | psli->stats_start = get_seconds(); |
1701 | 1778 | ||
1779 | mempool_free(pmboxq, phba->mbox_mem_pool); | ||
1780 | |||
1702 | return; | 1781 | return; |
1703 | } | 1782 | } |
1704 | 1783 | ||
@@ -1706,67 +1785,51 @@ lpfc_reset_stats(struct Scsi_Host *shost) | |||
1706 | * The LPFC driver treats linkdown handling as target loss events so there | 1785 | * The LPFC driver treats linkdown handling as target loss events so there |
1707 | * are no sysfs handlers for link_down_tmo. | 1786 | * are no sysfs handlers for link_down_tmo. |
1708 | */ | 1787 | */ |
1709 | static void | 1788 | |
1710 | lpfc_get_starget_port_id(struct scsi_target *starget) | 1789 | static struct lpfc_nodelist * |
1790 | lpfc_get_node_by_target(struct scsi_target *starget) | ||
1711 | { | 1791 | { |
1712 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1792 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
1713 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; | 1793 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; |
1714 | uint32_t did = -1; | 1794 | struct lpfc_nodelist *ndlp; |
1715 | struct lpfc_nodelist *ndlp = NULL; | ||
1716 | 1795 | ||
1717 | spin_lock_irq(shost->host_lock); | 1796 | spin_lock_irq(shost->host_lock); |
1718 | /* Search the mapped list for this target ID */ | 1797 | /* Search for this, mapped, target ID */ |
1719 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | 1798 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) { |
1720 | if (starget->id == ndlp->nlp_sid) { | 1799 | if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && |
1721 | did = ndlp->nlp_DID; | 1800 | starget->id == ndlp->nlp_sid) { |
1722 | break; | 1801 | spin_unlock_irq(shost->host_lock); |
1802 | return ndlp; | ||
1723 | } | 1803 | } |
1724 | } | 1804 | } |
1725 | spin_unlock_irq(shost->host_lock); | 1805 | spin_unlock_irq(shost->host_lock); |
1806 | return NULL; | ||
1807 | } | ||
1808 | |||
1809 | static void | ||
1810 | lpfc_get_starget_port_id(struct scsi_target *starget) | ||
1811 | { | ||
1812 | struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget); | ||
1726 | 1813 | ||
1727 | fc_starget_port_id(starget) = did; | 1814 | fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; |
1728 | } | 1815 | } |
1729 | 1816 | ||
1730 | static void | 1817 | static void |
1731 | lpfc_get_starget_node_name(struct scsi_target *starget) | 1818 | lpfc_get_starget_node_name(struct scsi_target *starget) |
1732 | { | 1819 | { |
1733 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1820 | struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget); |
1734 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; | ||
1735 | u64 node_name = 0; | ||
1736 | struct lpfc_nodelist *ndlp = NULL; | ||
1737 | |||
1738 | spin_lock_irq(shost->host_lock); | ||
1739 | /* Search the mapped list for this target ID */ | ||
1740 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | ||
1741 | if (starget->id == ndlp->nlp_sid) { | ||
1742 | node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn); | ||
1743 | break; | ||
1744 | } | ||
1745 | } | ||
1746 | spin_unlock_irq(shost->host_lock); | ||
1747 | 1821 | ||
1748 | fc_starget_node_name(starget) = node_name; | 1822 | fc_starget_node_name(starget) = |
1823 | ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; | ||
1749 | } | 1824 | } |
1750 | 1825 | ||
1751 | static void | 1826 | static void |
1752 | lpfc_get_starget_port_name(struct scsi_target *starget) | 1827 | lpfc_get_starget_port_name(struct scsi_target *starget) |
1753 | { | 1828 | { |
1754 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1829 | struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget); |
1755 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; | ||
1756 | u64 port_name = 0; | ||
1757 | struct lpfc_nodelist *ndlp = NULL; | ||
1758 | |||
1759 | spin_lock_irq(shost->host_lock); | ||
1760 | /* Search the mapped list for this target ID */ | ||
1761 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | ||
1762 | if (starget->id == ndlp->nlp_sid) { | ||
1763 | port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); | ||
1764 | break; | ||
1765 | } | ||
1766 | } | ||
1767 | spin_unlock_irq(shost->host_lock); | ||
1768 | 1830 | ||
1769 | fc_starget_port_name(starget) = port_name; | 1831 | fc_starget_port_name(starget) = |
1832 | ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; | ||
1770 | } | 1833 | } |
1771 | 1834 | ||
1772 | static void | 1835 | static void |
@@ -1895,25 +1958,8 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
1895 | sizeof(struct fcp_rsp) + | 1958 | sizeof(struct fcp_rsp) + |
1896 | (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); | 1959 | (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); |
1897 | 1960 | ||
1898 | switch (phba->pcidev->device) { | ||
1899 | case PCI_DEVICE_ID_LP101: | ||
1900 | case PCI_DEVICE_ID_BSMB: | ||
1901 | case PCI_DEVICE_ID_ZSMB: | ||
1902 | phba->cfg_hba_queue_depth = LPFC_LP101_HBA_Q_DEPTH; | ||
1903 | break; | ||
1904 | case PCI_DEVICE_ID_RFLY: | ||
1905 | case PCI_DEVICE_ID_PFLY: | ||
1906 | case PCI_DEVICE_ID_BMID: | ||
1907 | case PCI_DEVICE_ID_ZMID: | ||
1908 | case PCI_DEVICE_ID_TFLY: | ||
1909 | phba->cfg_hba_queue_depth = LPFC_LC_HBA_Q_DEPTH; | ||
1910 | break; | ||
1911 | default: | ||
1912 | phba->cfg_hba_queue_depth = LPFC_DFT_HBA_Q_DEPTH; | ||
1913 | } | ||
1914 | 1961 | ||
1915 | if (phba->cfg_hba_queue_depth > lpfc_hba_queue_depth) | 1962 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); |
1916 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); | ||
1917 | 1963 | ||
1918 | return; | 1964 | return; |
1919 | } | 1965 | } |