diff options
author | Swen Schillig <swen@vnet.ibm.com> | 2008-06-10 12:21:00 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-07-12 09:22:26 -0400 |
commit | cc8c282963bd258a5bf49d3aa52675a4ae6d31f6 (patch) | |
tree | d0f353c918158b203c71603d9afdf4b71c126f63 /drivers/s390/scsi/zfcp_erp.c | |
parent | 85a82392fe6fe7620d8fe0eb694f926cefe62e1f (diff) |
[SCSI] zfcp: Automatically attach remote ports
Automatically attach the remote ports in zfcp when the adapter is set
online. This is done by querying all available ports from the FC
namesever. The scan for remote ports is also triggered by RSCNs and
can be triggered manually with the sysfs attribute 'port_rescan'.
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_erp.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_erp.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index c06156b288ea..9b9c999cf39f 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -1199,6 +1199,10 @@ zfcp_erp_strategy_check_port(struct zfcp_port *port, int result) | |||
1199 | zfcp_erp_port_unblock(port); | 1199 | zfcp_erp_port_unblock(port); |
1200 | break; | 1200 | break; |
1201 | case ZFCP_ERP_FAILED : | 1201 | case ZFCP_ERP_FAILED : |
1202 | if (atomic_test_mask(ZFCP_STATUS_COMMON_NOESC, &port->status)) { | ||
1203 | zfcp_erp_port_block(port, 0); | ||
1204 | result = ZFCP_ERP_EXIT; | ||
1205 | } | ||
1202 | atomic_inc(&port->erp_counter); | 1206 | atomic_inc(&port->erp_counter); |
1203 | if (atomic_read(&port->erp_counter) > ZFCP_MAX_ERPS) | 1207 | if (atomic_read(&port->erp_counter) > ZFCP_MAX_ERPS) |
1204 | zfcp_erp_port_failed(port, 22, NULL); | 1208 | zfcp_erp_port_failed(port, 22, NULL); |
@@ -1607,6 +1611,7 @@ zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *erp_action, int close) | |||
1607 | goto failed_openfcp; | 1611 | goto failed_openfcp; |
1608 | 1612 | ||
1609 | atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &erp_action->adapter->status); | 1613 | atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &erp_action->adapter->status); |
1614 | schedule_work(&erp_action->adapter->scan_work); | ||
1610 | goto out; | 1615 | goto out; |
1611 | 1616 | ||
1612 | close_only: | 1617 | close_only: |
@@ -1665,10 +1670,19 @@ zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action) | |||
1665 | return zfcp_erp_adapter_strategy_open_fsf_statusread(erp_action); | 1670 | return zfcp_erp_adapter_strategy_open_fsf_statusread(erp_action); |
1666 | } | 1671 | } |
1667 | 1672 | ||
1673 | static void zfcp_erp_open_ptp_port(struct zfcp_adapter *adapter) | ||
1674 | { | ||
1675 | struct zfcp_port *port; | ||
1676 | port = zfcp_port_enqueue(adapter, adapter->peer_wwpn, 0, | ||
1677 | adapter->peer_d_id); | ||
1678 | if (!port) /* error or port already attached */ | ||
1679 | return; | ||
1680 | zfcp_erp_port_reopen_internal(port, 0, 150, NULL); | ||
1681 | } | ||
1682 | |||
1668 | static int | 1683 | static int |
1669 | zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) | 1684 | zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) |
1670 | { | 1685 | { |
1671 | int retval = ZFCP_ERP_SUCCEEDED; | ||
1672 | int retries; | 1686 | int retries; |
1673 | int sleep = ZFCP_EXCHANGE_CONFIG_DATA_FIRST_SLEEP; | 1687 | int sleep = ZFCP_EXCHANGE_CONFIG_DATA_FIRST_SLEEP; |
1674 | struct zfcp_adapter *adapter = erp_action->adapter; | 1688 | struct zfcp_adapter *adapter = erp_action->adapter; |
@@ -1682,8 +1696,9 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) | |||
1682 | zfcp_erp_action_to_running(erp_action); | 1696 | zfcp_erp_action_to_running(erp_action); |
1683 | write_unlock_irq(&adapter->erp_lock); | 1697 | write_unlock_irq(&adapter->erp_lock); |
1684 | if (zfcp_fsf_exchange_config_data(erp_action)) { | 1698 | if (zfcp_fsf_exchange_config_data(erp_action)) { |
1685 | retval = ZFCP_ERP_FAILED; | 1699 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, |
1686 | break; | 1700 | &adapter->status); |
1701 | return ZFCP_ERP_FAILED; | ||
1687 | } | 1702 | } |
1688 | 1703 | ||
1689 | /* | 1704 | /* |
@@ -1719,9 +1734,12 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) | |||
1719 | 1734 | ||
1720 | if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, | 1735 | if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, |
1721 | &adapter->status)) | 1736 | &adapter->status)) |
1722 | retval = ZFCP_ERP_FAILED; | 1737 | return ZFCP_ERP_FAILED; |
1723 | 1738 | ||
1724 | return retval; | 1739 | if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) |
1740 | zfcp_erp_open_ptp_port(adapter); | ||
1741 | |||
1742 | return ZFCP_ERP_SUCCEEDED; | ||
1725 | } | 1743 | } |
1726 | 1744 | ||
1727 | static int | 1745 | static int |
@@ -1899,14 +1917,12 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action) | |||
1899 | retval = zfcp_erp_port_strategy_open_port(erp_action); | 1917 | retval = zfcp_erp_port_strategy_open_port(erp_action); |
1900 | break; | 1918 | break; |
1901 | } | 1919 | } |
1902 | if (!(adapter->nameserver_port)) { | 1920 | |
1903 | retval = zfcp_nameserver_enqueue(adapter); | 1921 | if (!adapter->nameserver_port) { |
1904 | if (retval != 0) { | 1922 | dev_err(&adapter->ccw_device->dev, |
1905 | dev_err(&adapter->ccw_device->dev, | 1923 | "Nameserver port unavailable.\n"); |
1906 | "Nameserver port unavailable.\n"); | 1924 | retval = ZFCP_ERP_FAILED; |
1907 | retval = ZFCP_ERP_FAILED; | 1925 | break; |
1908 | break; | ||
1909 | } | ||
1910 | } | 1926 | } |
1911 | if (!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, | 1927 | if (!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, |
1912 | &adapter->nameserver_port->status)) { | 1928 | &adapter->nameserver_port->status)) { |