Commit b9fbc6c2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] s390: zfcp host adapter

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

Add new features to the zfcp host adapater driver:
  - Add support for FCP access control.
  - Error recovery enhancements.
parent fb1a1633
......@@ -187,3 +187,5 @@ Code Seq# Include File Comments
0xB1 00-1F PPPoX <mailto:mostrows@styx.uwaterloo.ca>
0xCB 00-1F CBM serial IEC bus in development:
<mailto:michael.klein@puffin.lb.shuttle.de>
0xDD 00-3F ZFCP device driver see drivers/s390/scsi/
<mailto:aherrman@de.ibm.com>
This diff is collapsed.
......@@ -5,7 +5,8 @@
*
* CCW driver related routines
*
* Copyright (C) 2003 IBM Entwicklung GmbH, IBM Corporation
* (C) Copyright IBM Corp. 2003, 2004
*
* Authors:
* Martin Peschke <mpeschke@de.ibm.com>
* Heiko Carstens <heiko.carstens@de.ibm.com>
......@@ -25,7 +26,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define ZFCP_CCW_C_REVISION "$Revision: 1.36 $"
#define ZFCP_CCW_C_REVISION "$Revision: 1.48 $"
#include <linux/init.h>
#include <linux/module.h>
......@@ -34,18 +35,22 @@
#include "zfcp_def.h"
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
#define ZFCP_LOG_AREA_PREFIX ZFCP_LOG_AREA_PREFIX_CONFIG
static int zfcp_ccw_probe(struct ccw_device *);
static void zfcp_ccw_remove(struct ccw_device *);
static int zfcp_ccw_set_online(struct ccw_device *);
static int zfcp_ccw_set_offline(struct ccw_device *);
static int zfcp_ccw_notify(struct ccw_device *, int);
static struct ccw_device_id zfcp_ccw_device_id[] = {
{CCW_DEVICE_DEVTYPE(ZFCP_CONTROL_UNIT_TYPE,
ZFCP_CONTROL_UNIT_MODEL,
ZFCP_DEVICE_TYPE,
ZFCP_DEVICE_MODEL)},
{CCW_DEVICE_DEVTYPE(ZFCP_CONTROL_UNIT_TYPE,
ZFCP_CONTROL_UNIT_MODEL,
ZFCP_DEVICE_TYPE,
ZFCP_DEVICE_MODEL_PRIV)},
{},
};
......@@ -56,6 +61,7 @@ static struct ccw_driver zfcp_ccw_driver = {
.remove = zfcp_ccw_remove,
.set_online = zfcp_ccw_set_online,
.set_offline = zfcp_ccw_set_offline,
.notify = zfcp_ccw_notify,
};
MODULE_DEVICE_TABLE(ccw, zfcp_ccw_device_id);
......@@ -80,6 +86,9 @@ zfcp_ccw_probe(struct ccw_device *ccw_device)
adapter = zfcp_adapter_enqueue(ccw_device);
if (!adapter)
retval = -EINVAL;
else
ZFCP_LOG_DEBUG("Probed adapter %s\n",
zfcp_get_busid_by_adapter(adapter));
up(&zfcp_data.config_sema);
return retval;
}
......@@ -104,6 +113,8 @@ zfcp_ccw_remove(struct ccw_device *ccw_device)
down(&zfcp_data.config_sema);
adapter = dev_get_drvdata(&ccw_device->dev);
ZFCP_LOG_DEBUG("Removing adapter %s\n",
zfcp_get_busid_by_adapter(adapter));
write_lock_irq(&zfcp_data.config_lock);
list_for_each_entry_safe(port, p, &adapter->port_list_head, list) {
list_for_each_entry_safe(unit, u, &port->unit_list_head, list) {
......@@ -152,13 +163,26 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device)
down(&zfcp_data.config_sema);
adapter = dev_get_drvdata(&ccw_device->dev);
retval = zfcp_erp_thread_setup(adapter);
if (retval) {
ZFCP_LOG_INFO("error: out of resources. "
"error recovery thread for adapter %s "
"could not be started\n",
zfcp_get_busid_by_adapter(adapter));
goto out;
}
retval = zfcp_adapter_scsi_register(adapter);
if (retval)
goto out;
goto out_scsi_register;
zfcp_erp_modify_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING,
ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_wait(adapter);
goto out;
out_scsi_register:
zfcp_erp_thread_kill(adapter);
out:
up(&zfcp_data.config_sema);
return retval;
......@@ -183,10 +207,49 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device)
zfcp_erp_adapter_shutdown(adapter, 0);
zfcp_erp_wait(adapter);
zfcp_adapter_scsi_unregister(adapter);
zfcp_erp_thread_kill(adapter);
up(&zfcp_data.config_sema);
return 0;
}
/**
* zfcp_ccw_notify
* @ccw_device: pointer to belonging ccw device
* @event: indicates if adapter was detached or attached
*
* This function gets called by the common i/o layer if an adapter has gone
* or reappeared.
*/
static int
zfcp_ccw_notify(struct ccw_device *ccw_device, int event)
{
struct zfcp_adapter *adapter;
down(&zfcp_data.config_sema);
adapter = dev_get_drvdata(&ccw_device->dev);
switch (event) {
case CIO_GONE:
ZFCP_LOG_NORMAL("Adapter %s: device gone.\n",
zfcp_get_busid_by_adapter(adapter));
break;
case CIO_NO_PATH:
ZFCP_LOG_NORMAL("Adapter %s: no path.\n",
zfcp_get_busid_by_adapter(adapter));
break;
case CIO_OPER:
ZFCP_LOG_NORMAL("Adapter %s: operational again.\n",
zfcp_get_busid_by_adapter(adapter));
zfcp_erp_modify_adapter_status(adapter,
ZFCP_STATUS_COMMON_RUNNING,
ZFCP_SET);
zfcp_erp_adapter_reopen(adapter,
ZFCP_STATUS_COMMON_ERP_FAILED);
break;
}
up(&zfcp_data.config_sema);
return 1;
}
/**
* zfcp_ccw_register - ccw register function
*
......@@ -222,4 +285,3 @@ zfcp_ccw_unregister(void)
}
#undef ZFCP_LOG_AREA
#undef ZFCP_LOG_AREA_PREFIX
This diff is collapsed.
This diff is collapsed.
......@@ -4,11 +4,12 @@
*
* FCP adapter driver for IBM eServer zSeries
*
* Copyright 2002 IBM Corporation
* (C) Copyright IBM Corp. 2002, 2004
*
* Author(s): Martin Peschke <mpeschke@de.ibm.com>
* Raimund Schroeder <raimund.schroeder@de.ibm.com>
* Aron Zeh <arzeh@de.ibm.com>
* Wolfgang Taphorn <taphorn@de.ibm.com>
* Aron Zeh
* Wolfgang Taphorn
* Stefan Bader <stefan.bader@de.ibm.com>
* Heiko Carstens <heiko.carstens@de.ibm.com>
*
......@@ -30,7 +31,7 @@
#ifndef ZFCP_EXT_H
#define ZFCP_EXT_H
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_EXT_REVISION "$Revision: 1.38 $"
#define ZFCP_EXT_REVISION "$Revision: 1.45 $"
#include "zfcp_def.h"
......@@ -46,7 +47,6 @@ extern void zfcp_sysfs_port_remove_files(struct device *, u32);
extern int zfcp_sysfs_unit_create_files(struct device *);
extern void zfcp_sysfs_unit_remove_files(struct device *);
extern void zfcp_sysfs_port_release(struct device *);
extern int zfcp_sysfs_port_shutdown(struct zfcp_port *);
extern void zfcp_sysfs_unit_release(struct device *);
/**************************** CONFIGURATION *********************************/
......@@ -65,7 +65,6 @@ extern void zfcp_unit_dequeue(struct zfcp_unit *);
extern int zfcp_ccw_register(void);
extern void zfcp_ccw_unregister(void);
extern int zfcp_initialize_with_0copy(struct zfcp_adapter *);
extern void zfcp_qdio_zero_sbals(struct qdio_buffer **, int, int);
extern int zfcp_qdio_allocate(struct zfcp_adapter *);
extern int zfcp_qdio_allocate_queues(struct zfcp_adapter *);
......@@ -74,6 +73,16 @@ extern int zfcp_qdio_determine_pci(struct zfcp_qdio_queue *,
struct zfcp_fsf_req *);
extern int zfcp_qdio_reqid_check(struct zfcp_adapter *, void *);
extern volatile struct qdio_buffer_element *zfcp_qdio_sbale_req
(struct zfcp_fsf_req *, int, int);
extern volatile struct qdio_buffer_element *zfcp_qdio_sbale_curr
(struct zfcp_fsf_req *);
extern int zfcp_qdio_sbals_from_sg
(struct zfcp_fsf_req *, unsigned long, struct scatterlist *, int, int);
extern int zfcp_qdio_sbals_from_scsicmnd
(struct zfcp_fsf_req *, unsigned long, struct scsi_cmnd *);
/******************************** FSF ****************************************/
extern int zfcp_fsf_open_port(struct zfcp_erp_action *);
extern int zfcp_fsf_close_port(struct zfcp_erp_action *);
......@@ -83,17 +92,20 @@ extern int zfcp_fsf_open_unit(struct zfcp_erp_action *);
extern int zfcp_fsf_close_unit(struct zfcp_erp_action *);
extern int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *);
extern int zfcp_fsf_control_file(struct zfcp_adapter *, struct zfcp_fsf_req **,
u32, u32, struct zfcp_sg_list *);
extern void zfcp_fsf_scsi_er_timeout_handler(unsigned long);
extern int zfcp_fsf_req_dismiss_all(struct zfcp_adapter *);
extern int zfcp_fsf_status_read(struct zfcp_adapter *, int);
extern int zfcp_fsf_req_create(struct zfcp_adapter *,u32, unsigned long *,
int, struct zfcp_fsf_req **);
extern void zfcp_fsf_req_free(struct zfcp_fsf_req *);
extern int zfcp_fsf_send_generic(struct zfcp_fsf_req *, unsigned char,
unsigned long *, struct timer_list *);
extern int zfcp_fsf_req_create(struct zfcp_adapter *, u32, int, mempool_t *,
unsigned long *, struct zfcp_fsf_req **);
extern int zfcp_fsf_send_ct(struct zfcp_send_ct *, mempool_t *,
struct zfcp_erp_action *);
extern int zfcp_fsf_send_els(struct zfcp_send_els *);
extern int zfcp_fsf_req_wait_and_cleanup(struct zfcp_fsf_req *, int, u32 *);
extern int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *,
struct zfcp_unit *, Scsi_Cmnd *,
struct zfcp_unit *,
struct scsi_cmnd *,
int);
extern int zfcp_fsf_req_complete(struct zfcp_fsf_req *);
extern void zfcp_fsf_incoming_els(struct zfcp_fsf_req *);
......@@ -105,15 +117,11 @@ extern struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(
/******************************** FCP ****************************************/
extern int zfcp_nameserver_enqueue(struct zfcp_adapter *);
extern int zfcp_nameserver_request(struct zfcp_erp_action *);
extern void zfcp_fsf_els_processing(struct zfcp_fsf_req *);
extern int zfcp_ns_gid_pn_request(struct zfcp_erp_action *);
/******************************* SCSI ****************************************/
extern int zfcp_adapter_scsi_register(struct zfcp_adapter *);
extern void zfcp_adapter_scsi_unregister(struct zfcp_adapter *);
extern void zfcp_scsi_block_requests(struct Scsi_Host *);
extern int zfcp_create_sbals_from_sg(struct zfcp_fsf_req *,
Scsi_Cmnd *, char, int, int);
extern void zfcp_set_fcp_dl(struct fcp_cmnd_iu *, fcp_dl_t);
extern char *zfcp_get_fcp_rsp_info_ptr(struct fcp_rsp_iu *);
extern void set_host_byte(u32 *, char);
......@@ -122,6 +130,11 @@ extern char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *);
extern void zfcp_fsf_start_scsi_er_timer(struct zfcp_adapter *);
extern fcp_dl_t zfcp_get_fcp_dl(struct fcp_cmnd_iu *);
extern int zfcp_scsi_command_async(struct zfcp_adapter *,struct zfcp_unit *unit,
struct scsi_cmnd *scsi_cmnd);
extern int zfcp_scsi_command_sync(struct zfcp_unit *unit,
struct scsi_cmnd *scsi_cmnd);
/******************************** ERP ****************************************/
extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u32, int);
extern int zfcp_erp_adapter_reopen(struct zfcp_adapter *, int);
......@@ -147,10 +160,12 @@ extern int zfcp_erp_thread_kill(struct zfcp_adapter *);
extern int zfcp_erp_wait(struct zfcp_adapter *);
extern void zfcp_erp_fsf_req_handler(struct zfcp_fsf_req *);
extern int zfcp_test_link(struct zfcp_port *);
/******************************** AUX ****************************************/
extern void zfcp_cmd_dbf_event_fsf(const char *, struct zfcp_fsf_req *,
void *, int);
extern void zfcp_cmd_dbf_event_scsi(const char *, Scsi_Cmnd *);
extern void zfcp_cmd_dbf_event_scsi(const char *, struct scsi_cmnd *);
extern void zfcp_in_els_dbf_event(struct zfcp_adapter *, const char *,
struct fsf_status_read_buffer *, int);
#ifdef ZFCP_STAT_REQSIZES
......
This diff is collapsed.
......@@ -4,11 +4,12 @@
*
* FCP adapter driver for IBM eServer zSeries
*
* Copyright 2002 IBM Corporation
* (C) Copyright IBM Corp. 2002, 2004
*
* Author(s): Martin Peschke <mpeschke@de.ibm.com>
* Raimund Schroeder <raimund.schroeder@de.ibm.com>
* Aron Zeh <arzeh@de.ibm.com>
* Wolfgang Taphorn <taphorn@de.ibm.com>
* Aron Zeh
* Wolfgang Taphorn
* Stefan Bader <stefan.bader@de.ibm.com>
* Heiko Carstens <heiko.carstens@de.ibm.com>
*
......@@ -44,11 +45,22 @@
#define FSF_QTCB_SEND_ELS 0x0000000B
#define FSF_QTCB_SEND_GENERIC 0x0000000C
#define FSF_QTCB_EXCHANGE_CONFIG_DATA 0x0000000D
#define FSF_QTCB_EXCHANGE_PORT_DATA 0x0000000E
#define FSF_QTCB_DOWNLOAD_CONTROL_FILE 0x00000012
#define FSF_QTCB_UPLOAD_CONTROL_FILE 0x00000013
/* FSF QTCB types */
#define FSF_IO_COMMAND 0x00000001
#define FSF_SUPPORT_COMMAND 0x00000002
#define FSF_CONFIG_COMMAND 0x00000003
#define FSF_PORT_COMMAND 0x00000004
/* FSF control file upload/download operations' subtype and options */
#define FSF_CFDC_OPERATION_SUBTYPE 0x00020001
#define FSF_CFDC_OPTION_NORMAL_MODE 0x00000000
#define FSF_CFDC_OPTION_FORCE 0x00000001
#define FSF_CFDC_OPTION_FULL_ACCESS 0x00000002
#define FSF_CFDC_OPTION_RESTRICTED_ACCESS 0x00000004
/* FSF protocol stati */
#define FSF_PROT_GOOD 0x00000001
......@@ -71,9 +83,9 @@
#define FSF_HANDLE_MISMATCH 0x00000005
#define FSF_SERVICE_CLASS_NOT_SUPPORTED 0x00000006
#define FSF_FCPLUN_NOT_VALID 0x00000009
//#define FSF_ACCESS_DENIED 0x00000010
#define FSF_ACCESS_DENIED 0x00000010
#define FSF_ACCESS_TYPE_NOT_VALID 0x00000011
#define FSF_LUN_IN_USE 0x00000012
#define FSF_LUN_SHARING_VIOLATION 0x00000012
#define FSF_COMMAND_ABORTED_ULP 0x00000020
#define FSF_COMMAND_ABORTED_ADAPTER 0x00000021
#define FSF_FCP_COMMAND_DOES_NOT_EXIST 0x00000022
......@@ -87,13 +99,24 @@
#define FSF_RESPONSE_BUF_NOT_VALID 0x00000043
#define FSF_ELS_COMMAND_REJECTED 0x00000050
#define FSF_GENERIC_COMMAND_REJECTED 0x00000051
//#define FSF_AUTHORIZATION_FAILURE 0x00000053
#define FSF_OPERATION_PARTIALLY_SUCCESSFUL 0x00000052
#define FSF_AUTHORIZATION_FAILURE 0x00000053
#define FSF_CFDC_ERROR_DETECTED 0x00000054
#define FSF_CONTROL_FILE_UPDATE_ERROR 0x00000055
#define FSF_CONTROL_FILE_TOO_LARGE 0x00000056
#define FSF_ACCESS_CONFLICT_DETECTED 0x00000057
#define FSF_CONFLICTS_OVERRULED 0x00000058
#define FSF_PORT_BOXED 0x00000059
//#define FSF_LUN_BOXED 0x0000005A
#define FSF_LUN_BOXED 0x0000005A
#define FSF_PAYLOAD_SIZE_MISMATCH 0x00000060
#define FSF_REQUEST_SIZE_TOO_LARGE 0x00000061
#define FSF_RESPONSE_SIZE_TOO_LARGE 0x00000062
#define FSF_ADAPTER_STATUS_AVAILABLE 0x000000AD
#define FSF_FCP_RSP_AVAILABLE 0x000000AF
#define FSF_UNKNOWN_COMMAND 0x000000E2
//#define FSF_ERROR 0x000000FF
#define FSF_UNKNOWN_OP_SUBTYPE 0x000000E3
#define FSF_INVALID_COMMAND_OPTION 0x000000E5
/* #define FSF_ERROR 0x000000FF */
#define FSF_STATUS_QUALIFIER_SIZE 16
......@@ -107,6 +130,15 @@
#define FSF_SQ_COMMAND_ABORTED 0x06
#define FSF_SQ_NO_RETRY_POSSIBLE 0x07
/* FSF status qualifier for CFDC commands */
#define FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE 0x00000001
#define FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE2 0x00000002
/* CFDC subtable codes */
#define FSF_SQ_CFDC_SUBTABLE_OS 0x0001
#define FSF_SQ_CFDC_SUBTABLE_PORT_WWPN 0x0002
#define FSF_SQ_CFDC_SUBTABLE_PORT_DID 0x0003
#define FSF_SQ_CFDC_SUBTABLE_LUN 0x0004
/* FSF status qualifier (most significant 4 bytes), local link down */
#define FSF_PSQ_LINK_NOLIGHT 0x00000004
#define FSF_PSQ_LINK_WRAPPLUG 0x00000008
......@@ -124,11 +156,20 @@
#define FSF_STATUS_READ_BIT_ERROR_THRESHOLD 0x00000004
#define FSF_STATUS_READ_LINK_DOWN 0x00000005 /* FIXME: really? */
#define FSF_STATUS_READ_LINK_UP 0x00000006
#define FSF_STATUS_READ_NOTIFICATION_LOST 0x00000009
#define FSF_STATUS_READ_CFDC_UPDATED 0x0000000A
#define FSF_STATUS_READ_CFDC_HARDENED 0x0000000B
/* status subtypes in status read buffer */
#define FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT 0x00000001
#define FSF_STATUS_READ_SUB_ERROR_PORT 0x00000002
/* status subtypes for CFDC */
#define FSF_STATUS_READ_SUB_LOST_CFDC_UPDATED 0x00000020
#define FSF_STATUS_READ_SUB_LOST_CFDC_HARDENED 0x00000040
#define FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE 0x00000002
#define FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE2 0x0000000F
/* topologie that is detected by the adapter */
#define FSF_TOPO_ERROR 0x00000000
#define FSF_TOPO_P2P 0x00000001
......@@ -149,10 +190,48 @@
/* SBAL chaining */
#define FSF_MAX_SBALS_PER_REQ 36
#define FSF_MAX_SBALS_PER_ELS_REQ 2
/* logging space behind QTCB */
#define FSF_QTCB_LOG_SIZE 1024
/* channel features */
#define FSF_FEATURE_QTCB_SUPPRESSION 0x00000001
#define FSF_FEATURE_CFDC 0x00000002
#define FSF_FEATURE_SENSEDATA_REPLICATION 0x00000004
#define FSF_FEATURE_LOST_SAN_NOTIFICATION 0x00000008
#define FSF_FEATURE_HBAAPI_MANAGEMENT 0x00000010
#define FSF_FEATURE_ELS_CT_CHAINED_SBALS 0x00000020
/* option */
#define FSF_OPEN_LUN_SUPPRESS_BOXING 0x00000001
/* adapter types */
#define FSF_ADAPTER_TYPE_FICON 0x00000001
#define FSF_ADAPTER_TYPE_FICON_EXPRESS 0x00000002
/* port types */
#define FSF_HBA_PORTTYPE_UNKNOWN 0x00000001
#define FSF_HBA_PORTTYPE_NOTPRESENT 0x00000003
#define FSF_HBA_PORTTYPE_NPORT 0x00000005
#define FSF_HBA_PORTTYPE_PTP 0x00000021
/* following are not defined and used by FSF Spec
but are additionally defined by FC-HBA */
#define FSF_HBA_PORTTYPE_OTHER 0x00000002
#define FSF_HBA_PORTTYPE_NOTPRESENT 0x00000003
#define FSF_HBA_PORTTYPE_NLPORT 0x00000006
#define FSF_HBA_PORTTYPE_FLPORT 0x00000007
#define FSF_HBA_PORTTYPE_FPORT 0x00000008
#define FSF_HBA_PORTTYPE_LPORT 0x00000020
/* port states */
#define FSF_HBA_PORTSTATE_UNKNOWN 0x00000001
#define FSF_HBA_PORTSTATE_ONLINE 0x00000002
#define FSF_HBA_PORTSTATE_OFFLINE 0x00000003
#define FSF_HBA_PORTSTATE_LINKDOWN 0x00000006
#define FSF_HBA_PORTSTATE_ERROR 0x00000007
struct fsf_queue_designator;
struct fsf_status_read_buffer;
struct fsf_port_closed_payload;
......@@ -307,49 +386,92 @@ struct fsf_qtcb_bottom_io {
} __attribute__ ((packed));
struct fsf_qtcb_bottom_support {
u8 res1[16];
u32 operation_subtype;
u8 res1[12];
u32 d_id;
u32 res2;
u32 option;
u64 fcp_lun;
u64 res3;
u64 res2;
u64 req_handle;
u32 service_class;
u8 res4[3];
u8 res3[3];
u8 timeout;
u8 res5[184];
u8 res4[184];
u32 els1_length;
u32 els2_length;
u64 res6;
u32 req_buf_length;
u32 resp_buf_length;
u8 els[256];
} __attribute__ ((packed));
struct fsf_qtcb_bottom_config {
u32 lic_version;
u32 res1;
u32 feature_selection;
u32 high_qtcb_version;
u32 low_qtcb_version;
u32 max_qtcb_size;
u8 res2[12];
u32 max_data_transfer_size;
u32 supported_features;
u8 res1[4];
u32 fc_topology;
u32 fc_link_speed;
u32 adapter_type;
u32 peer_d_id;
u8 res3[12];
u8 res2[12];
u32 s_id;
struct fsf_nport_serv_param nport_serv_param;
u8 res4[320];
u8 res3[8];
u32 adapter_ports;
u32 hardware_version;
u8 serial_number[32];
u8 res4[272];
} __attribute__ ((packed));
struct fsf_qtcb_bottom_port {
u8 res1[8];
u32 fc_port_id;
u32 port_type;
u32 port_state;
u32 class_of_service; /* should be 0x00000006 for class 2 and 3 */
u8 supported_fc4_types[32]; /* should be 0x00000100 for scsi fcp */
u8 active_fc4_types[32];
u32 supported_speed; /* 0x0001 for 1 GBit/s or 0x0002 for 2 GBit/s */
u32 maximum_frame_size; /* fixed value of 2112 */
u64 seconds_since_last_reset;
u64 tx_frames;
u64 tx_words;
u64 rx_frames;
u64 rx_words;
u64 lip; /* 0 */
u64 nos; /* currently 0 */
u64 error_frames; /* currently 0 */
u64 dumped_frames; /* currently 0 */
u64 link_failure;
u64 loss_of_sync;
u64 loss_of_signal;
u64 psp_error_counts;
u64 invalid_tx_words;
u64 invalid_crcs;
u64 input_requests;
u64 output_requests;
u64 control_requests;
u64 input_mb; /* where 1 MByte == 1.000.000 Bytes */
u64 output_mb; /* where 1 MByte == 1.000.000 Bytes */
u8 res2[256];
} __attribute__ ((packed));
union fsf_qtcb_bottom {
struct fsf_qtcb_bottom_io io;
struct fsf_qtcb_bottom_support support;
struct fsf_qtcb_bottom_config config;
struct fsf_qtcb_bottom_port port;
};
struct fsf_qtcb {
struct fsf_qtcb_prefix prefix;
struct fsf_qtcb_header header;
union fsf_qtcb_bottom bottom;
u8 log[FSF_QTCB_LOG_SIZE];
} __attribute__ ((packed));
#endif /* FSF_H */
This diff is collapsed.
This diff is collapsed.
......@@ -5,7 +5,8 @@
*
* sysfs adapter related routines
*
* Copyright (C) 2003 IBM Entwicklung GmbH, IBM Corporation
* (C) Copyright IBM Corp. 2003, 2004
*
* Authors:
* Martin Peschke <mpeschke@de.ibm.com>
* Heiko Carstens <heiko.carstens@de.ibm.com>
......@@ -25,14 +26,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.26 $"
#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.30 $"
#include <asm/ccwdev.h>
#include "zfcp_ext.h"
#include "zfcp_def.h"
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
#define ZFCP_LOG_AREA_PREFIX ZFCP_LOG_AREA_PREFIX_CONFIG
static const char fc_topologies[5][25] = {
{"<error>"},
......@@ -66,12 +66,15 @@ ZFCP_DEFINE_ADAPTER_ATTR(status, "0x%08x\n", atomic_read(&adapter->status));
ZFCP_DEFINE_ADAPTER_ATTR(wwnn, "0x%016llx\n", adapter->wwnn);
ZFCP_DEFINE_ADAPTER_ATTR(wwpn, "0x%016llx\n", adapter->wwpn);
ZFCP_DEFINE_ADAPTER_ATTR(s_id, "0x%06x\n", adapter->s_id);
ZFCP_DEFINE_ADAPTER_ATTR(hw_version, "0x%04x\n", adapter->hydra_version);
ZFCP_DEFINE_ADAPTER_ATTR(card_version, "0x%04x\n", adapter->hydra_version);
ZFCP_DEFINE_ADAPTER_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version);
ZFCP_DEFINE_ADAPTER_ATTR(fc_link_speed, "%d Gb/s\n", adapter->fc_link_speed);
ZFCP_DEFINE_ADAPTER_ATTR(fc_service_class, "%d\n", adapter->fc_service_class);
ZFCP_DEFINE_ADAPTER_ATTR(fc_topology, "%s\n",
fc_topologies[adapter->fc_topology]);
ZFCP_DEFINE_ADAPTER_ATTR(hardware_version, "0x%08x\n",
adapter->hardware_version);
ZFCP_DEFINE_ADAPTER_ATTR(serial_number, "%17s\n", adapter->serial_number);
/**
* zfcp_sysfs_adapter_in_recovery_show - recovery state of adapter
......@@ -259,11 +262,6 @@ zfcp_sysfs_adapter_failed_store(struct device *dev,
goto out;
}
/* restart error recovery only if adapter is online */
if (adapter->ccw_device->online != 1) {
retval = -ENXIO;
goto out;
}
zfcp_erp_modify_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING,
ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
......@@ -304,13 +302,15 @@ static struct attribute *zfcp_adapter_attrs[] = {
&dev_attr_wwnn.attr,
&dev_attr_wwpn.attr,
&dev_attr_s_id.attr,
&dev_attr_hw_version.attr,
&dev_attr_card_version.attr,
&dev_attr_lic_version.attr,
&dev_attr_fc_link_speed.attr,
&dev_attr_fc_service_class.attr,
&dev_attr_fc_topology.attr,
&dev_attr_scsi_host_no.attr,
&dev_attr_status.attr,
&dev_attr_hardware_version.attr,
&dev_attr_serial_number.attr,
NULL
};
......@@ -343,4 +343,3 @@ zfcp_sysfs_adapter_remove_files(struct device *dev)
}
#undef ZFCP_LOG_AREA
#undef ZFCP_LOG_AREA_PREFIX
......@@ -5,7 +5,8 @@
*
* sysfs driver related routines
*
* Copyright (C) 2003 IBM Entwicklung GmbH, IBM Corporation
* (C) Copyright IBM Corp. 2003, 2004
*
* Authors:
* Martin Peschke <mpeschke@de.ibm.com>
* Heiko Carstens <heiko.carstens@de.ibm.com>
......@@ -25,14 +26,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define ZFCP_SYSFS_DRIVER_C_REVISION "$Revision: 1.8 $"
#define ZFCP_SYSFS_DRIVER_C_REVISION "$Revision: 1.12 $"
#include <asm/ccwdev.h>
#include "zfcp_ext.h"
#include "zfcp_def.h"
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
#define ZFCP_LOG_AREA_PREFIX ZFCP_LOG_AREA_PREFIX_CONFIG
/**
* ZFCP_DEFINE_DRIVER_ATTR - define for all loglevels sysfs attributes
......@@ -67,7 +67,8 @@ static ssize_t zfcp_sysfs_loglevel_##_name##_store(struct device_driver *drv, \
static ssize_t zfcp_sysfs_loglevel_##_name##_show(struct device_driver *dev, \
char *buf) \
{ \
return sprintf(buf,"%d\n", ZFCP_LOG_VALUE(ZFCP_LOG_AREA_##_define)); \
return sprintf(buf,"%d\n", \
ZFCP_GET_LOG_VALUE(ZFCP_LOG_AREA_##_define)); \
} \
\
static DRIVER_ATTR(loglevel_##_name, S_IWUSR | S_IRUGO, \
......@@ -83,6 +84,14 @@ ZFCP_DEFINE_DRIVER_ATTR(qdio, QDIO);
ZFCP_DEFINE_DRIVER_ATTR(erp, ERP);
ZFCP_DEFINE_DRIVER_ATTR(fc, FC);
static ssize_t zfcp_sysfs_version_show(struct device_driver *dev,
char *buf)
{
return sprintf(buf, "%s\n", ZFCP_VERSION);
}
static DRIVER_ATTR(version, S_IRUGO, zfcp_sysfs_version_show, NULL);
static struct attribute *zfcp_driver_attrs[] = {
&driver_attr_loglevel_other.attr,
&driver_attr_loglevel_scsi.attr,
......@@ -92,6 +101,7 @@ static struct attribute *zfcp_driver_attrs[] = {
&driver_attr_loglevel_qdio.attr,
&driver_attr_loglevel_erp.attr,
&driver_attr_loglevel_fc.attr,
&driver_attr_version.attr,
NULL
};
......@@ -124,4 +134,3 @@ zfcp_sysfs_driver_remove_files(struct device_driver *drv)
}
#undef ZFCP_LOG_AREA
#undef ZFCP_LOG_AREA_PREFIX
......@@ -5,7 +5,8 @@
*
* sysfs port related routines
*
* Copyright (C) 2003 IBM Entwicklung GmbH, IBM Corporation
* (C) Copyright IBM Corp. 2003, 2004
*
* Authors:
* Martin Peschke <mpeschke@de.ibm.com>
* Heiko Carstens <heiko.carstens@de.ibm.com>
......@@ -25,7 +26,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.32 $"
#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.37 $"
#include <linux/init.h>
#include <linux/module.h>
......@@ -34,7 +35,6 @@
#include "zfcp_def.h"
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
#define ZFCP_LOG_AREA_PREFIX ZFCP_LOG_AREA_PREFIX_CONFIG
/**
* zfcp_sysfs_port_release - gets called when a struct device port is released
......@@ -209,11 +209,6 @@ zfcp_sysfs_port_failed_store(struct device *dev, const char *buf, size_t count)
goto out;
}
/* restart error recovery only if adapter is online */
if (port->adapter->ccw_device->online != 1) {
retval = -ENXIO;
goto out;
}
zfcp_erp_modify_port_status(port, ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_wait(port->adapter);
......@@ -268,6 +263,10 @@ zfcp_sysfs_port_in_recovery_show(struct device *dev, char *buf)
static DEVICE_ATTR(in_recovery, S_IRUGO, zfcp_sysfs_port_in_recovery_show,
NULL);
/**
* zfcp_port_common_attrs
* sysfs attributes that are common for all kind of fc ports.
*/
static struct attribute *zfcp_port_common_attrs[] = {
&dev_attr_failed.attr,
&dev_attr_in_recovery.attr,
......@@ -281,6 +280,10 @@ static struct attribute_group zfcp_port_common_attr_group = {
.attrs = zfcp_port_common_attrs,
};
/**
* zfcp_port_no_ns_attrs
* sysfs attributes not to be used for nameserver ports.
*/
static struct attribute *zfcp_port_no_ns_attrs[] = {
&dev_attr_unit_add.attr,
&dev_attr_unit_remove.attr,
......@@ -330,4 +333,3 @@ zfcp_sysfs_port_remove_files(struct device *dev, u32 flags)
}
#undef ZFCP_LOG_AREA
#undef ZFCP_LOG_AREA_PREFIX
......@@ -5,7 +5,8 @@
*
* sysfs unit related routines
*
* Copyright (C) 2003 IBM Entwicklung GmbH, IBM Corporation
* (C) Copyright IBM Corp. 2003, 2004
*
* Authors:
* Martin Peschke <mpeschke@de.ibm.com>
* Heiko Carstens <heiko.carstens@de.ibm.com>
......@@ -25,7 +26,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define ZFCP_SYSFS_UNIT_C_REVISION "$Revision: 1.19 $"
#define ZFCP_SYSFS_UNIT_C_REVISION "$Revision: 1.23 $"
#include <linux/init.h>
#include <linux/module.h>
......@@ -34,7 +35,6 @@
#include "zfcp_def.h"
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
#define ZFCP_LOG_AREA_PREFIX ZFCP_LOG_AREA_PREFIX_CONFIG
/**
* zfcp_sysfs_unit_release - gets called when a struct device unit is released
......@@ -104,13 +104,9 @@ zfcp_sysfs_unit_failed_store(struct device *dev, const char *buf, size_t count)
goto out;
}
/* restart error recovery only if adapter is online */
if (unit->port->adapter->ccw_device->online != 1) {
retval = -ENXIO;
goto out;
}
zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_wait(unit->port->adapter);
out:
up(&zfcp_data.config_sema);
return retval ? retval : count;
......@@ -199,4 +195,3 @@ zfcp_sysfs_unit_remove_files(struct device *dev)
}
#undef ZFCP_LOG_AREA
#undef ZFCP_LOG_AREA_PREFIX
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment