aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c2
-rw-r--r--drivers/s390/scsi/zfcp_def.h4
-rw-r--r--drivers/s390/scsi/zfcp_erp.c2
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c84
-rw-r--r--drivers/s390/scsi/zfcp_fsf.h13
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c188
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_adapter.c15
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_port.c4
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_unit.c2
9 files changed, 212 insertions, 102 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 5e84c5aa7779..167fef39d8a7 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -1125,6 +1125,8 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
1125 zfcp_free_low_mem_buffers(adapter); 1125 zfcp_free_low_mem_buffers(adapter);
1126 /* free memory of adapter data structure and queues */ 1126 /* free memory of adapter data structure and queues */
1127 zfcp_qdio_free_queues(adapter); 1127 zfcp_qdio_free_queues(adapter);
1128 kfree(adapter->fc_stats);
1129 kfree(adapter->stats_reset_data);
1128 ZFCP_LOG_TRACE("freeing adapter structure\n"); 1130 ZFCP_LOG_TRACE("freeing adapter structure\n");
1129 kfree(adapter); 1131 kfree(adapter);
1130 out: 1132 out:
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index d81b737d68cc..9bb511083a26 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -921,7 +921,6 @@ struct zfcp_adapter {
921 u32 physical_s_id; /* local FC port ID */ 921 u32 physical_s_id; /* local FC port ID */
922 struct ccw_device *ccw_device; /* S/390 ccw device */ 922 struct ccw_device *ccw_device; /* S/390 ccw device */
923 u8 fc_service_class; 923 u8 fc_service_class;
924 u32 fc_topology; /* FC topology */
925 u32 hydra_version; /* Hydra version */ 924 u32 hydra_version; /* Hydra version */
926 u32 fsf_lic_version; 925 u32 fsf_lic_version;
927 u32 adapter_features; /* FCP channel features */ 926 u32 adapter_features; /* FCP channel features */
@@ -978,6 +977,9 @@ struct zfcp_adapter {
978 struct zfcp_adapter_mempool pool; /* Adapter memory pools */ 977 struct zfcp_adapter_mempool pool; /* Adapter memory pools */
979 struct qdio_initialize qdio_init_data; /* for qdio_establish */ 978 struct qdio_initialize qdio_init_data; /* for qdio_establish */
980 struct device generic_services; /* directory for WKA ports */ 979 struct device generic_services; /* directory for WKA ports */
980 struct fc_host_statistics *fc_stats;
981 struct fsf_qtcb_bottom_port *stats_reset_data;
982 unsigned long stats_reset;
981}; 983};
982 984
983/* 985/*
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index ee7314d8c2da..7bdb00b5aeb2 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -2613,7 +2613,7 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
2613 case ZFCP_ERP_STEP_UNINITIALIZED: 2613 case ZFCP_ERP_STEP_UNINITIALIZED:
2614 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING: 2614 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
2615 case ZFCP_ERP_STEP_PORT_CLOSING: 2615 case ZFCP_ERP_STEP_PORT_CLOSING:
2616 if (adapter->fc_topology == FSF_TOPO_P2P) { 2616 if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) {
2617 if (port->wwpn != adapter->peer_wwpn) { 2617 if (port->wwpn != adapter->peer_wwpn) {
2618 ZFCP_LOG_NORMAL("Failed to open port 0x%016Lx " 2618 ZFCP_LOG_NORMAL("Failed to open port 0x%016Lx "
2619 "on adapter %s.\nPeer WWPN " 2619 "on adapter %s.\nPeer WWPN "
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 59587951c847..cbfab09899c8 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -964,6 +964,40 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
964 | ZFCP_STATUS_COMMON_ERP_FAILED); 964 | ZFCP_STATUS_COMMON_ERP_FAILED);
965 break; 965 break;
966 966
967 case FSF_STATUS_READ_NOTIFICATION_LOST:
968 ZFCP_LOG_NORMAL("Unsolicited status notification(s) lost: "
969 "adapter %s%s%s%s%s%s%s%s%s\n",
970 zfcp_get_busid_by_adapter(adapter),
971 (status_buffer->status_subtype &
972 FSF_STATUS_READ_SUB_INCOMING_ELS) ?
973 ", incoming ELS" : "",
974 (status_buffer->status_subtype &
975 FSF_STATUS_READ_SUB_SENSE_DATA) ?
976 ", sense data" : "",
977 (status_buffer->status_subtype &
978 FSF_STATUS_READ_SUB_LINK_STATUS) ?
979 ", link status change" : "",
980 (status_buffer->status_subtype &
981 FSF_STATUS_READ_SUB_PORT_CLOSED) ?
982 ", port close" : "",
983 (status_buffer->status_subtype &
984 FSF_STATUS_READ_SUB_BIT_ERROR_THRESHOLD) ?
985 ", bit error exception" : "",
986 (status_buffer->status_subtype &
987 FSF_STATUS_READ_SUB_ACT_UPDATED) ?
988 ", ACT update" : "",
989 (status_buffer->status_subtype &
990 FSF_STATUS_READ_SUB_ACT_HARDENED) ?
991 ", ACT hardening" : "",
992 (status_buffer->status_subtype &
993 FSF_STATUS_READ_SUB_FEATURE_UPDATE_ALERT) ?
994 ", adapter feature change" : "");
995
996 if (status_buffer->status_subtype &
997 FSF_STATUS_READ_SUB_ACT_UPDATED)
998 zfcp_erp_adapter_access_changed(adapter);
999 break;
1000
967 case FSF_STATUS_READ_CFDC_UPDATED: 1001 case FSF_STATUS_READ_CFDC_UPDATED:
968 ZFCP_LOG_NORMAL("CFDC has been updated on the adapter %s\n", 1002 ZFCP_LOG_NORMAL("CFDC has been updated on the adapter %s\n",
969 zfcp_get_busid_by_adapter(adapter)); 1003 zfcp_get_busid_by_adapter(adapter));
@@ -1954,6 +1988,7 @@ zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1954 erp_action->fsf_req->qtcb->bottom.config.feature_selection = 1988 erp_action->fsf_req->qtcb->bottom.config.feature_selection =
1955 FSF_FEATURE_CFDC | 1989 FSF_FEATURE_CFDC |
1956 FSF_FEATURE_LUN_SHARING | 1990 FSF_FEATURE_LUN_SHARING |
1991 FSF_FEATURE_NOTIFICATION_LOST |
1957 FSF_FEATURE_UPDATE_ALERT; 1992 FSF_FEATURE_UPDATE_ALERT;
1958 1993
1959 /* start QDIO request for this FSF request */ 1994 /* start QDIO request for this FSF request */
@@ -2008,27 +2043,30 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
2008 fc_host_port_id(shost) = bottom->s_id & ZFCP_DID_MASK; 2043 fc_host_port_id(shost) = bottom->s_id & ZFCP_DID_MASK;
2009 fc_host_speed(shost) = bottom->fc_link_speed; 2044 fc_host_speed(shost) = bottom->fc_link_speed;
2010 fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3; 2045 fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
2011 adapter->fc_topology = bottom->fc_topology;
2012 adapter->hydra_version = bottom->adapter_type; 2046 adapter->hydra_version = bottom->adapter_type;
2013 if (adapter->physical_wwpn == 0) 2047 if (fc_host_permanent_port_name(shost) == -1)
2014 adapter->physical_wwpn = fc_host_port_name(shost); 2048 fc_host_permanent_port_name(shost) =
2015 if (adapter->physical_s_id == 0) 2049 fc_host_port_name(shost);
2016 adapter->physical_s_id = fc_host_port_id(shost); 2050 if (bottom->fc_topology == FSF_TOPO_P2P) {
2051 adapter->peer_d_id = bottom->peer_d_id & ZFCP_DID_MASK;
2052 adapter->peer_wwpn = bottom->plogi_payload.wwpn;
2053 adapter->peer_wwnn = bottom->plogi_payload.wwnn;
2054 fc_host_port_type(shost) = FC_PORTTYPE_PTP;
2055 } else if (bottom->fc_topology == FSF_TOPO_FABRIC)
2056 fc_host_port_type(shost) = FC_PORTTYPE_NPORT;
2057 else if (bottom->fc_topology == FSF_TOPO_AL)
2058 fc_host_port_type(shost) = FC_PORTTYPE_NLPORT;
2059 else
2060 fc_host_port_type(shost) = FC_PORTTYPE_UNKNOWN;
2017 } else { 2061 } else {
2018 fc_host_node_name(shost) = 0; 2062 fc_host_node_name(shost) = 0;
2019 fc_host_port_name(shost) = 0; 2063 fc_host_port_name(shost) = 0;
2020 fc_host_port_id(shost) = 0; 2064 fc_host_port_id(shost) = 0;
2021 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; 2065 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
2022 adapter->fc_topology = 0; 2066 fc_host_port_type(shost) = FC_PORTTYPE_UNKNOWN;
2023 adapter->hydra_version = 0; 2067 adapter->hydra_version = 0;
2024 } 2068 }
2025 2069
2026 if (adapter->fc_topology == FSF_TOPO_P2P) {
2027 adapter->peer_d_id = bottom->peer_d_id & ZFCP_DID_MASK;
2028 adapter->peer_wwpn = bottom->plogi_payload.wwpn;
2029 adapter->peer_wwnn = bottom->plogi_payload.wwnn;
2030 }
2031
2032 if (adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT) { 2070 if (adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT) {
2033 adapter->hardware_version = bottom->hardware_version; 2071 adapter->hardware_version = bottom->hardware_version;
2034 memcpy(fc_host_serial_number(shost), bottom->serial_number, 2072 memcpy(fc_host_serial_number(shost), bottom->serial_number,
@@ -2097,8 +2135,8 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2097 if (zfcp_fsf_exchange_config_evaluate(fsf_req, 1)) 2135 if (zfcp_fsf_exchange_config_evaluate(fsf_req, 1))
2098 return -EIO; 2136 return -EIO;
2099 2137
2100 switch (adapter->fc_topology) { 2138 switch (fc_host_port_type(adapter->scsi_host)) {
2101 case FSF_TOPO_P2P: 2139 case FC_PORTTYPE_PTP:
2102 ZFCP_LOG_NORMAL("Point-to-Point fibrechannel " 2140 ZFCP_LOG_NORMAL("Point-to-Point fibrechannel "
2103 "configuration detected at adapter %s\n" 2141 "configuration detected at adapter %s\n"
2104 "Peer WWNN 0x%016llx, " 2142 "Peer WWNN 0x%016llx, "
@@ -2111,7 +2149,7 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2111 debug_text_event(fsf_req->adapter->erp_dbf, 0, 2149 debug_text_event(fsf_req->adapter->erp_dbf, 0,
2112 "top-p-to-p"); 2150 "top-p-to-p");
2113 break; 2151 break;
2114 case FSF_TOPO_AL: 2152 case FC_PORTTYPE_NLPORT:
2115 ZFCP_LOG_NORMAL("error: Arbitrated loop fibrechannel " 2153 ZFCP_LOG_NORMAL("error: Arbitrated loop fibrechannel "
2116 "topology detected at adapter %s " 2154 "topology detected at adapter %s "
2117 "unsupported, shutting down adapter\n", 2155 "unsupported, shutting down adapter\n",
@@ -2120,7 +2158,7 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2120 "top-al"); 2158 "top-al");
2121 zfcp_erp_adapter_shutdown(adapter, 0); 2159 zfcp_erp_adapter_shutdown(adapter, 0);
2122 return -EIO; 2160 return -EIO;
2123 case FSF_TOPO_FABRIC: 2161 case FC_PORTTYPE_NPORT:
2124 ZFCP_LOG_NORMAL("Switched fabric fibrechannel " 2162 ZFCP_LOG_NORMAL("Switched fabric fibrechannel "
2125 "network detected at adapter %s.\n", 2163 "network detected at adapter %s.\n",
2126 zfcp_get_busid_by_adapter(adapter)); 2164 zfcp_get_busid_by_adapter(adapter));
@@ -2133,7 +2171,6 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2133 "of a type known to the zfcp " 2171 "of a type known to the zfcp "
2134 "driver, shutting down adapter\n", 2172 "driver, shutting down adapter\n",
2135 zfcp_get_busid_by_adapter(adapter)); 2173 zfcp_get_busid_by_adapter(adapter));
2136 adapter->fc_topology = FSF_TOPO_ERROR;
2137 debug_text_exception(fsf_req->adapter->erp_dbf, 0, 2174 debug_text_exception(fsf_req->adapter->erp_dbf, 0,
2138 "unknown-topo"); 2175 "unknown-topo");
2139 zfcp_erp_adapter_shutdown(adapter, 0); 2176 zfcp_erp_adapter_shutdown(adapter, 0);
@@ -2293,14 +2330,13 @@ zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *fsf_req)
2293 data = (struct fsf_qtcb_bottom_port*) fsf_req->data; 2330 data = (struct fsf_qtcb_bottom_port*) fsf_req->data;
2294 if (data) 2331 if (data)
2295 memcpy(data, bottom, sizeof(struct fsf_qtcb_bottom_port)); 2332 memcpy(data, bottom, sizeof(struct fsf_qtcb_bottom_port));
2296 if (adapter->connection_features & FSF_FEATURE_NPIV_MODE) { 2333 if (adapter->connection_features & FSF_FEATURE_NPIV_MODE)
2297 adapter->physical_wwpn = bottom->wwpn; 2334 fc_host_permanent_port_name(shost) = bottom->wwpn;
2298 adapter->physical_s_id = bottom->fc_port_id; 2335 else
2299 } else { 2336 fc_host_permanent_port_name(shost) =
2300 adapter->physical_wwpn = fc_host_port_name(shost); 2337 fc_host_port_name(shost);
2301 adapter->physical_s_id = fc_host_port_id(shost);
2302 }
2303 fc_host_maxframe_size(shost) = bottom->maximum_frame_size; 2338 fc_host_maxframe_size(shost) = bottom->maximum_frame_size;
2339 fc_host_supported_speeds(shost) = bottom->supported_speed;
2304 break; 2340 break;
2305 2341
2306 case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: 2342 case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE:
diff --git a/drivers/s390/scsi/zfcp_fsf.h b/drivers/s390/scsi/zfcp_fsf.h
index 48719f055952..e734415cae6d 100644
--- a/drivers/s390/scsi/zfcp_fsf.h
+++ b/drivers/s390/scsi/zfcp_fsf.h
@@ -166,6 +166,7 @@
166#define FSF_STATUS_READ_BIT_ERROR_THRESHOLD 0x00000004 166#define FSF_STATUS_READ_BIT_ERROR_THRESHOLD 0x00000004
167#define FSF_STATUS_READ_LINK_DOWN 0x00000005 167#define FSF_STATUS_READ_LINK_DOWN 0x00000005
168#define FSF_STATUS_READ_LINK_UP 0x00000006 168#define FSF_STATUS_READ_LINK_UP 0x00000006
169#define FSF_STATUS_READ_NOTIFICATION_LOST 0x00000009
169#define FSF_STATUS_READ_CFDC_UPDATED 0x0000000A 170#define FSF_STATUS_READ_CFDC_UPDATED 0x0000000A
170#define FSF_STATUS_READ_CFDC_HARDENED 0x0000000B 171#define FSF_STATUS_READ_CFDC_HARDENED 0x0000000B
171#define FSF_STATUS_READ_FEATURE_UPDATE_ALERT 0x0000000C 172#define FSF_STATUS_READ_FEATURE_UPDATE_ALERT 0x0000000C
@@ -179,6 +180,16 @@
179#define FSF_STATUS_READ_SUB_FDISC_FAILED 0x00000001 180#define FSF_STATUS_READ_SUB_FDISC_FAILED 0x00000001
180#define FSF_STATUS_READ_SUB_FIRMWARE_UPDATE 0x00000002 181#define FSF_STATUS_READ_SUB_FIRMWARE_UPDATE 0x00000002
181 182
183/* status subtypes for unsolicited status notification lost */
184#define FSF_STATUS_READ_SUB_INCOMING_ELS 0x00000001
185#define FSF_STATUS_READ_SUB_SENSE_DATA 0x00000002
186#define FSF_STATUS_READ_SUB_LINK_STATUS 0x00000004
187#define FSF_STATUS_READ_SUB_PORT_CLOSED 0x00000008
188#define FSF_STATUS_READ_SUB_BIT_ERROR_THRESHOLD 0x00000010
189#define FSF_STATUS_READ_SUB_ACT_UPDATED 0x00000020
190#define FSF_STATUS_READ_SUB_ACT_HARDENED 0x00000040
191#define FSF_STATUS_READ_SUB_FEATURE_UPDATE_ALERT 0x00000080
192
182/* status subtypes for CFDC */ 193/* status subtypes for CFDC */
183#define FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE 0x00000002 194#define FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE 0x00000002
184#define FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE2 0x0000000F 195#define FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE2 0x0000000F
@@ -188,7 +199,6 @@
188#define FSF_TOPO_P2P 0x00000001 199#define FSF_TOPO_P2P 0x00000001
189#define FSF_TOPO_FABRIC 0x00000002 200#define FSF_TOPO_FABRIC 0x00000002
190#define FSF_TOPO_AL 0x00000003 201#define FSF_TOPO_AL 0x00000003
191#define FSF_TOPO_FABRIC_VIRT 0x00000004
192 202
193/* data direction for FCP commands */ 203/* data direction for FCP commands */
194#define FSF_DATADIR_WRITE 0x00000001 204#define FSF_DATADIR_WRITE 0x00000001
@@ -211,6 +221,7 @@
211/* channel features */ 221/* channel features */
212#define FSF_FEATURE_CFDC 0x00000002 222#define FSF_FEATURE_CFDC 0x00000002
213#define FSF_FEATURE_LUN_SHARING 0x00000004 223#define FSF_FEATURE_LUN_SHARING 0x00000004
224#define FSF_FEATURE_NOTIFICATION_LOST 0x00000008
214#define FSF_FEATURE_HBAAPI_MANAGEMENT 0x00000010 225#define FSF_FEATURE_HBAAPI_MANAGEMENT 0x00000010
215#define FSF_FEATURE_ELS_CT_CHAINED_SBALS 0x00000020 226#define FSF_FEATURE_ELS_CT_CHAINED_SBALS 0x00000020
216#define FSF_FEATURE_UPDATE_ALERT 0x00000100 227#define FSF_FEATURE_UPDATE_ALERT 0x00000100
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 66608d13a634..3c2cbcccbf54 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -49,8 +49,6 @@ static int zfcp_task_management_function(struct zfcp_unit *, u8,
49 49
50static struct zfcp_unit *zfcp_unit_lookup(struct zfcp_adapter *, int, scsi_id_t, 50static struct zfcp_unit *zfcp_unit_lookup(struct zfcp_adapter *, int, scsi_id_t,
51 scsi_lun_t); 51 scsi_lun_t);
52static struct zfcp_port *zfcp_port_lookup(struct zfcp_adapter *, int,
53 scsi_id_t);
54 52
55static struct device_attribute *zfcp_sysfs_sdev_attrs[]; 53static struct device_attribute *zfcp_sysfs_sdev_attrs[];
56 54
@@ -406,18 +404,6 @@ zfcp_unit_lookup(struct zfcp_adapter *adapter, int channel, scsi_id_t id,
406 return retval; 404 return retval;
407} 405}
408 406
409static struct zfcp_port *
410zfcp_port_lookup(struct zfcp_adapter *adapter, int channel, scsi_id_t id)
411{
412 struct zfcp_port *port;
413
414 list_for_each_entry(port, &adapter->port_list_head, list) {
415 if (port->rport && (id == port->rport->scsi_target_id))
416 return port;
417 }
418 return (struct zfcp_port *) NULL;
419}
420
421/** 407/**
422 * zfcp_scsi_eh_abort_handler - abort the specified SCSI command 408 * zfcp_scsi_eh_abort_handler - abort the specified SCSI command
423 * @scpnt: pointer to scsi_cmnd to be aborted 409 * @scpnt: pointer to scsi_cmnd to be aborted
@@ -731,70 +717,164 @@ zfcp_fsf_start_scsi_er_timer(struct zfcp_adapter *adapter)
731/* 717/*
732 * Support functions for FC transport class 718 * Support functions for FC transport class
733 */ 719 */
734static void 720static struct fc_host_statistics*
735zfcp_get_port_id(struct scsi_target *starget) 721zfcp_init_fc_host_stats(struct zfcp_adapter *adapter)
736{ 722{
737 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 723 struct fc_host_statistics *fc_stats;
738 struct zfcp_adapter *adapter = (struct zfcp_adapter *)shost->hostdata[0];
739 struct zfcp_port *port;
740 unsigned long flags;
741 724
742 read_lock_irqsave(&zfcp_data.config_lock, flags); 725 if (!adapter->fc_stats) {
743 port = zfcp_port_lookup(adapter, starget->channel, starget->id); 726 fc_stats = kmalloc(sizeof(*fc_stats), GFP_KERNEL);
744 if (port) 727 if (!fc_stats)
745 fc_starget_port_id(starget) = port->d_id; 728 return NULL;
746 else 729 adapter->fc_stats = fc_stats; /* freed in adater_dequeue */
747 fc_starget_port_id(starget) = -1; 730 }
748 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 731 memset(adapter->fc_stats, 0, sizeof(*adapter->fc_stats));
732 return adapter->fc_stats;
749} 733}
750 734
751static void 735static void
752zfcp_get_port_name(struct scsi_target *starget) 736zfcp_adjust_fc_host_stats(struct fc_host_statistics *fc_stats,
737 struct fsf_qtcb_bottom_port *data,
738 struct fsf_qtcb_bottom_port *old)
753{ 739{
754 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 740 fc_stats->seconds_since_last_reset = data->seconds_since_last_reset -
755 struct zfcp_adapter *adapter = (struct zfcp_adapter *)shost->hostdata[0]; 741 old->seconds_since_last_reset;
756 struct zfcp_port *port; 742 fc_stats->tx_frames = data->tx_frames - old->tx_frames;
757 unsigned long flags; 743 fc_stats->tx_words = data->tx_words - old->tx_words;
744 fc_stats->rx_frames = data->rx_frames - old->rx_frames;
745 fc_stats->rx_words = data->rx_words - old->rx_words;
746 fc_stats->lip_count = data->lip - old->lip;
747 fc_stats->nos_count = data->nos - old->nos;
748 fc_stats->error_frames = data->error_frames - old->error_frames;
749 fc_stats->dumped_frames = data->dumped_frames - old->dumped_frames;
750 fc_stats->link_failure_count = data->link_failure - old->link_failure;
751 fc_stats->loss_of_sync_count = data->loss_of_sync - old->loss_of_sync;
752 fc_stats->loss_of_signal_count = data->loss_of_signal -
753 old->loss_of_signal;
754 fc_stats->prim_seq_protocol_err_count = data->psp_error_counts -
755 old->psp_error_counts;
756 fc_stats->invalid_tx_word_count = data->invalid_tx_words -
757 old->invalid_tx_words;
758 fc_stats->invalid_crc_count = data->invalid_crcs - old->invalid_crcs;
759 fc_stats->fcp_input_requests = data->input_requests -
760 old->input_requests;
761 fc_stats->fcp_output_requests = data->output_requests -
762 old->output_requests;
763 fc_stats->fcp_control_requests = data->control_requests -
764 old->control_requests;
765 fc_stats->fcp_input_megabytes = data->input_mb - old->input_mb;
766 fc_stats->fcp_output_megabytes = data->output_mb - old->output_mb;
767}
758 768
759 read_lock_irqsave(&zfcp_data.config_lock, flags); 769static void
760 port = zfcp_port_lookup(adapter, starget->channel, starget->id); 770zfcp_set_fc_host_stats(struct fc_host_statistics *fc_stats,
761 if (port) 771 struct fsf_qtcb_bottom_port *data)
762 fc_starget_port_name(starget) = port->wwpn; 772{
763 else 773 fc_stats->seconds_since_last_reset = data->seconds_since_last_reset;
764 fc_starget_port_name(starget) = -1; 774 fc_stats->tx_frames = data->tx_frames;
765 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 775 fc_stats->tx_words = data->tx_words;
776 fc_stats->rx_frames = data->rx_frames;
777 fc_stats->rx_words = data->rx_words;
778 fc_stats->lip_count = data->lip;
779 fc_stats->nos_count = data->nos;
780 fc_stats->error_frames = data->error_frames;
781 fc_stats->dumped_frames = data->dumped_frames;
782 fc_stats->link_failure_count = data->link_failure;
783 fc_stats->loss_of_sync_count = data->loss_of_sync;
784 fc_stats->loss_of_signal_count = data->loss_of_signal;
785 fc_stats->prim_seq_protocol_err_count = data->psp_error_counts;
786 fc_stats->invalid_tx_word_count = data->invalid_tx_words;
787 fc_stats->invalid_crc_count = data->invalid_crcs;
788 fc_stats->fcp_input_requests = data->input_requests;
789 fc_stats->fcp_output_requests = data->output_requests;
790 fc_stats->fcp_control_requests = data->control_requests;
791 fc_stats->fcp_input_megabytes = data->input_mb;
792 fc_stats->fcp_output_megabytes = data->output_mb;
793}
794
795/**
796 * zfcp_get_fc_host_stats - provide fc_host_statistics for scsi_transport_fc
797 *
798 * assumption: scsi_transport_fc synchronizes calls of
799 * get_fc_host_stats and reset_fc_host_stats
800 * (XXX to be checked otherwise introduce locking)
801 */
802static struct fc_host_statistics *
803zfcp_get_fc_host_stats(struct Scsi_Host *shost)
804{
805 struct zfcp_adapter *adapter;
806 struct fc_host_statistics *fc_stats;
807 struct fsf_qtcb_bottom_port *data;
808 int ret;
809
810 adapter = (struct zfcp_adapter *)shost->hostdata[0];
811 fc_stats = zfcp_init_fc_host_stats(adapter);
812 if (!fc_stats)
813 return NULL;
814
815 data = kmalloc(sizeof(*data), GFP_KERNEL);
816 if (!data)
817 return NULL;
818 memset(data, 0, sizeof(*data));
819
820 ret = zfcp_fsf_exchange_port_data(NULL, adapter, data);
821 if (ret) {
822 kfree(data);
823 return NULL; /* XXX return zeroed fc_stats? */
824 }
825
826 if (adapter->stats_reset &&
827 ((jiffies/HZ - adapter->stats_reset) <
828 data->seconds_since_last_reset)) {
829 zfcp_adjust_fc_host_stats(fc_stats, data,
830 adapter->stats_reset_data);
831 } else
832 zfcp_set_fc_host_stats(fc_stats, data);
833
834 kfree(data);
835 return fc_stats;
766} 836}
767 837
768static void 838static void
769zfcp_get_node_name(struct scsi_target *starget) 839zfcp_reset_fc_host_stats(struct Scsi_Host *shost)
770{ 840{
771 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 841 struct zfcp_adapter *adapter;
772 struct zfcp_adapter *adapter = (struct zfcp_adapter *)shost->hostdata[0]; 842 struct fsf_qtcb_bottom_port *data, *old_data;
773 struct zfcp_port *port; 843 int ret;
774 unsigned long flags;
775 844
776 read_lock_irqsave(&zfcp_data.config_lock, flags); 845 adapter = (struct zfcp_adapter *)shost->hostdata[0];
777 port = zfcp_port_lookup(adapter, starget->channel, starget->id); 846 data = kmalloc(sizeof(*data), GFP_KERNEL);
778 if (port) 847 if (!data)
779 fc_starget_node_name(starget) = port->wwnn; 848 return;
780 else 849 memset(data, 0, sizeof(*data));
781 fc_starget_node_name(starget) = -1; 850
782 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 851 ret = zfcp_fsf_exchange_port_data(NULL, adapter, data);
852 if (ret == 0) {
853 adapter->stats_reset = jiffies/HZ;
854 old_data = adapter->stats_reset_data;
855 adapter->stats_reset_data = data; /* finally freed in
856 adater_dequeue */
857 kfree(old_data);
858 }
783} 859}
784 860
785struct fc_function_template zfcp_transport_functions = { 861struct fc_function_template zfcp_transport_functions = {
786 .get_starget_port_id = zfcp_get_port_id,
787 .get_starget_port_name = zfcp_get_port_name,
788 .get_starget_node_name = zfcp_get_node_name,
789 .show_starget_port_id = 1, 862 .show_starget_port_id = 1,
790 .show_starget_port_name = 1, 863 .show_starget_port_name = 1,
791 .show_starget_node_name = 1, 864 .show_starget_node_name = 1,
792 .show_rport_supported_classes = 1, 865 .show_rport_supported_classes = 1,
793 .show_host_node_name = 1, 866 .show_host_node_name = 1,
794 .show_host_port_name = 1, 867 .show_host_port_name = 1,
868 .show_host_permanent_port_name = 1,
795 .show_host_supported_classes = 1, 869 .show_host_supported_classes = 1,
870 .show_host_supported_speeds = 1,
796 .show_host_maxframe_size = 1, 871 .show_host_maxframe_size = 1,
797 .show_host_serial_number = 1, 872 .show_host_serial_number = 1,
873 .get_fc_host_stats = zfcp_get_fc_host_stats,
874 .reset_fc_host_stats = zfcp_reset_fc_host_stats,
875 /* no functions registered for following dynamic attributes but
876 directly set by LLDD */
877 .show_host_port_type = 1,
798 .show_host_speed = 1, 878 .show_host_speed = 1,
799 .show_host_port_id = 1, 879 .show_host_port_id = 1,
800}; 880};
diff --git a/drivers/s390/scsi/zfcp_sysfs_adapter.c b/drivers/s390/scsi/zfcp_sysfs_adapter.c
index 0cd435280e7d..9f262250043a 100644
--- a/drivers/s390/scsi/zfcp_sysfs_adapter.c
+++ b/drivers/s390/scsi/zfcp_sysfs_adapter.c
@@ -33,14 +33,6 @@
33 33
34#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG 34#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
35 35
36static const char fc_topologies[5][25] = {
37 "<error>",
38 "point-to-point",
39 "fabric",
40 "arbitrated loop",
41 "fabric (virt. adapter)"
42};
43
44/** 36/**
45 * ZFCP_DEFINE_ADAPTER_ATTR 37 * ZFCP_DEFINE_ADAPTER_ATTR
46 * @_name: name of show attribute 38 * @_name: name of show attribute
@@ -69,12 +61,8 @@ ZFCP_DEFINE_ADAPTER_ATTR(physical_wwpn, "0x%016llx\n", adapter->physical_wwpn);
69ZFCP_DEFINE_ADAPTER_ATTR(physical_s_id, "0x%06x\n", adapter->physical_s_id); 61ZFCP_DEFINE_ADAPTER_ATTR(physical_s_id, "0x%06x\n", adapter->physical_s_id);
70ZFCP_DEFINE_ADAPTER_ATTR(card_version, "0x%04x\n", adapter->hydra_version); 62ZFCP_DEFINE_ADAPTER_ATTR(card_version, "0x%04x\n", adapter->hydra_version);
71ZFCP_DEFINE_ADAPTER_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version); 63ZFCP_DEFINE_ADAPTER_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version);
72ZFCP_DEFINE_ADAPTER_ATTR(fc_service_class, "%d\n", adapter->fc_service_class);
73ZFCP_DEFINE_ADAPTER_ATTR(fc_topology, "%s\n",
74 fc_topologies[adapter->fc_topology]);
75ZFCP_DEFINE_ADAPTER_ATTR(hardware_version, "0x%08x\n", 64ZFCP_DEFINE_ADAPTER_ATTR(hardware_version, "0x%08x\n",
76 adapter->hardware_version); 65 adapter->hardware_version);
77ZFCP_DEFINE_ADAPTER_ATTR(scsi_host_no, "0x%x\n", adapter->scsi_host_no);
78ZFCP_DEFINE_ADAPTER_ATTR(in_recovery, "%d\n", atomic_test_mask 66ZFCP_DEFINE_ADAPTER_ATTR(in_recovery, "%d\n", atomic_test_mask
79 (ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status)); 67 (ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status));
80 68
@@ -259,9 +247,6 @@ static struct attribute *zfcp_adapter_attrs[] = {
259 &dev_attr_physical_s_id.attr, 247 &dev_attr_physical_s_id.attr,
260 &dev_attr_card_version.attr, 248 &dev_attr_card_version.attr,
261 &dev_attr_lic_version.attr, 249 &dev_attr_lic_version.attr,
262 &dev_attr_fc_service_class.attr,
263 &dev_attr_fc_topology.attr,
264 &dev_attr_scsi_host_no.attr,
265 &dev_attr_status.attr, 250 &dev_attr_status.attr,
266 &dev_attr_hardware_version.attr, 251 &dev_attr_hardware_version.attr,
267 NULL 252 NULL
diff --git a/drivers/s390/scsi/zfcp_sysfs_port.c b/drivers/s390/scsi/zfcp_sysfs_port.c
index c55e82d91deb..3924eb38805c 100644
--- a/drivers/s390/scsi/zfcp_sysfs_port.c
+++ b/drivers/s390/scsi/zfcp_sysfs_port.c
@@ -65,8 +65,6 @@ static ssize_t zfcp_sysfs_port_##_name##_show(struct device *dev, struct device_
65static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_port_##_name##_show, NULL); 65static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_port_##_name##_show, NULL);
66 66
67ZFCP_DEFINE_PORT_ATTR(status, "0x%08x\n", atomic_read(&port->status)); 67ZFCP_DEFINE_PORT_ATTR(status, "0x%08x\n", atomic_read(&port->status));
68ZFCP_DEFINE_PORT_ATTR(wwnn, "0x%016llx\n", port->wwnn);
69ZFCP_DEFINE_PORT_ATTR(d_id, "0x%06x\n", port->d_id);
70ZFCP_DEFINE_PORT_ATTR(in_recovery, "%d\n", atomic_test_mask 68ZFCP_DEFINE_PORT_ATTR(in_recovery, "%d\n", atomic_test_mask
71 (ZFCP_STATUS_COMMON_ERP_INUSE, &port->status)); 69 (ZFCP_STATUS_COMMON_ERP_INUSE, &port->status));
72ZFCP_DEFINE_PORT_ATTR(access_denied, "%d\n", atomic_test_mask 70ZFCP_DEFINE_PORT_ATTR(access_denied, "%d\n", atomic_test_mask
@@ -245,8 +243,6 @@ static struct attribute *zfcp_port_common_attrs[] = {
245 &dev_attr_failed.attr, 243 &dev_attr_failed.attr,
246 &dev_attr_in_recovery.attr, 244 &dev_attr_in_recovery.attr,
247 &dev_attr_status.attr, 245 &dev_attr_status.attr,
248 &dev_attr_wwnn.attr,
249 &dev_attr_d_id.attr,
250 &dev_attr_access_denied.attr, 246 &dev_attr_access_denied.attr,
251 NULL 247 NULL
252}; 248};
diff --git a/drivers/s390/scsi/zfcp_sysfs_unit.c b/drivers/s390/scsi/zfcp_sysfs_unit.c
index 0556642c9e1d..2f50815f65c7 100644
--- a/drivers/s390/scsi/zfcp_sysfs_unit.c
+++ b/drivers/s390/scsi/zfcp_sysfs_unit.c
@@ -65,7 +65,6 @@ static ssize_t zfcp_sysfs_unit_##_name##_show(struct device *dev, struct device_
65static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_unit_##_name##_show, NULL); 65static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_unit_##_name##_show, NULL);
66 66
67ZFCP_DEFINE_UNIT_ATTR(status, "0x%08x\n", atomic_read(&unit->status)); 67ZFCP_DEFINE_UNIT_ATTR(status, "0x%08x\n", atomic_read(&unit->status));
68ZFCP_DEFINE_UNIT_ATTR(scsi_lun, "0x%x\n", unit->scsi_lun);
69ZFCP_DEFINE_UNIT_ATTR(in_recovery, "%d\n", atomic_test_mask 68ZFCP_DEFINE_UNIT_ATTR(in_recovery, "%d\n", atomic_test_mask
70 (ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status)); 69 (ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status));
71ZFCP_DEFINE_UNIT_ATTR(access_denied, "%d\n", atomic_test_mask 70ZFCP_DEFINE_UNIT_ATTR(access_denied, "%d\n", atomic_test_mask
@@ -138,7 +137,6 @@ static DEVICE_ATTR(failed, S_IWUSR | S_IRUGO, zfcp_sysfs_unit_failed_show,
138 zfcp_sysfs_unit_failed_store); 137 zfcp_sysfs_unit_failed_store);
139 138
140static struct attribute *zfcp_unit_attrs[] = { 139static struct attribute *zfcp_unit_attrs[] = {
141 &dev_attr_scsi_lun.attr,
142 &dev_attr_failed.attr, 140 &dev_attr_failed.attr,
143 &dev_attr_in_recovery.attr, 141 &dev_attr_in_recovery.attr,
144 &dev_attr_status.attr, 142 &dev_attr_status.attr,