forked from Minki/linux
[SCSI] zfcp: Message cleanup
Cleanup the messages used in the zfcp driver: Remove unnecessary debug and trace message and convert the remaining messages to standard kernel macros. Remove the zfcp message macros and while updating the whole flie also update the copyright headers. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
parent
00bab91066
commit
553448f6c4
@ -4,6 +4,6 @@
|
||||
|
||||
zfcp-objs := zfcp_aux.o zfcp_ccw.o zfcp_scsi.o zfcp_erp.o zfcp_qdio.o \
|
||||
zfcp_fsf.o zfcp_dbf.o zfcp_sysfs_adapter.o zfcp_sysfs_port.o \
|
||||
zfcp_sysfs_unit.o zfcp_sysfs_driver.o zfcp_fc.o zfcp_cfdc.o
|
||||
zfcp_sysfs_unit.o zfcp_fc.o zfcp_cfdc.o
|
||||
|
||||
obj-$(CONFIG_ZFCP) += zfcp.o
|
||||
|
@ -1,22 +1,9 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* Module interface and handling of zfcp data structures.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -31,13 +18,16 @@
|
||||
* Maxim Shchetynin
|
||||
* Volker Sameske
|
||||
* Ralph Wuerthner
|
||||
* Michael Loehr
|
||||
* Swen Schillig
|
||||
* Christof Schmitt
|
||||
* Martin Petermann
|
||||
* Sven Schuetz
|
||||
*/
|
||||
|
||||
#include <linux/miscdevice.h>
|
||||
#include "zfcp_ext.h"
|
||||
|
||||
/* accumulated log level (module parameter) */
|
||||
static u32 loglevel = ZFCP_LOG_LEVEL_DEFAULTS;
|
||||
static char *device;
|
||||
/*********************** FUNCTION PROTOTYPES *********************************/
|
||||
|
||||
@ -57,12 +47,6 @@ MODULE_LICENSE("GPL");
|
||||
module_param(device, charp, 0400);
|
||||
MODULE_PARM_DESC(device, "specify initial device");
|
||||
|
||||
module_param(loglevel, uint, 0400);
|
||||
MODULE_PARM_DESC(loglevel,
|
||||
"log levels, 8 nibbles: "
|
||||
"FC ERP QDIO CIO Config FSF SCSI Other, "
|
||||
"levels: 0=none 1=normal 2=devel 3=trace");
|
||||
|
||||
/****************************************************************/
|
||||
/************** Functions without logging ***********************/
|
||||
/****************************************************************/
|
||||
@ -87,8 +71,6 @@ _zfcp_hex_dump(char *addr, int count)
|
||||
/****** Functions to handle the request ID hash table ********/
|
||||
/****************************************************************/
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_FSF
|
||||
|
||||
static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter)
|
||||
{
|
||||
int idx;
|
||||
@ -118,14 +100,10 @@ int zfcp_reqlist_isempty(struct zfcp_adapter *adapter)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
||||
|
||||
/****************************************************************/
|
||||
/************** Uncategorised Functions *************************/
|
||||
/****************************************************************/
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER
|
||||
|
||||
/**
|
||||
* zfcp_device_setup - setup function
|
||||
* @str: pointer to parameter string
|
||||
@ -143,8 +121,11 @@ zfcp_device_setup(char *devstr)
|
||||
|
||||
len = strlen(devstr) + 1;
|
||||
str = kmalloc(len, GFP_KERNEL);
|
||||
if (!str)
|
||||
goto err_out;
|
||||
if (!str) {
|
||||
pr_err("zfcp: Could not allocate memory for "
|
||||
"device parameter string, device not attached.\n");
|
||||
return 0;
|
||||
}
|
||||
memcpy(str, devstr, len);
|
||||
|
||||
tmp = strchr(str, ',');
|
||||
@ -167,7 +148,8 @@ zfcp_device_setup(char *devstr)
|
||||
return 1;
|
||||
|
||||
err_out:
|
||||
ZFCP_LOG_NORMAL("Parse error for device parameter string %s\n", str);
|
||||
pr_err("zfcp: Parse error for device parameter string %s, "
|
||||
"device not attached.\n", str);
|
||||
kfree(str);
|
||||
return 0;
|
||||
}
|
||||
@ -248,8 +230,6 @@ zfcp_module_init(void)
|
||||
if (!zfcp_data.gid_pn_cache)
|
||||
goto out_gid_cache;
|
||||
|
||||
atomic_set(&zfcp_data.loglevel, loglevel);
|
||||
|
||||
/* initialize adapter list */
|
||||
INIT_LIST_HEAD(&zfcp_data.adapter_list_head);
|
||||
|
||||
@ -263,8 +243,7 @@ zfcp_module_init(void)
|
||||
|
||||
retval = misc_register(&zfcp_cfdc_misc);
|
||||
if (retval != 0) {
|
||||
ZFCP_LOG_INFO("registration of misc device "
|
||||
"zfcp_cfdc failed\n");
|
||||
pr_err("zfcp: registration of misc device zfcp_cfdc failed\n");
|
||||
goto out_misc;
|
||||
}
|
||||
|
||||
@ -277,7 +256,7 @@ zfcp_module_init(void)
|
||||
/* setup dynamic I/O */
|
||||
retval = zfcp_ccw_register();
|
||||
if (retval) {
|
||||
ZFCP_LOG_NORMAL("registration with common I/O layer failed\n");
|
||||
pr_err("zfcp: Registration with common I/O layer failed.\n");
|
||||
goto out_ccw_register;
|
||||
}
|
||||
|
||||
@ -300,14 +279,10 @@ zfcp_module_init(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
||||
|
||||
/****************************************************************/
|
||||
/****** Functions for configuration/set-up of structures ********/
|
||||
/****************************************************************/
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
|
||||
|
||||
/**
|
||||
* zfcp_get_unit_by_lun - find unit in unit list of port by FCP LUN
|
||||
* @port: pointer to port to search for unit
|
||||
@ -598,6 +573,8 @@ static void _zfcp_status_read_scheduler(struct work_struct *work)
|
||||
* All adapter internal structures are set up.
|
||||
* Proc-fs entries are also created.
|
||||
*
|
||||
* FIXME: Use -ENOMEM as return code for allocation failures
|
||||
*
|
||||
* returns: 0 if a new adapter was successfully enqueued
|
||||
* ZFCP_KNOWN if an adapter with this devno was already present
|
||||
* -ENOMEM if alloc failed
|
||||
@ -615,11 +592,8 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
|
||||
|
||||
/* try to allocate new adapter data structure (zeroed) */
|
||||
adapter = kzalloc(sizeof (struct zfcp_adapter), GFP_KERNEL);
|
||||
if (!adapter) {
|
||||
ZFCP_LOG_INFO("error: allocation of base adapter "
|
||||
"structure failed\n");
|
||||
if (!adapter)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ccw_device->handler = NULL;
|
||||
|
||||
@ -760,7 +734,6 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
|
||||
zfcp_reqlist_free(adapter);
|
||||
kfree(adapter->fc_stats);
|
||||
kfree(adapter->stats_reset_data);
|
||||
ZFCP_LOG_TRACE("freeing adapter structure\n");
|
||||
kfree(adapter);
|
||||
out:
|
||||
return;
|
||||
@ -908,12 +881,8 @@ zfcp_nameserver_enqueue(struct zfcp_adapter *adapter)
|
||||
|
||||
port = zfcp_port_enqueue(adapter, 0, ZFCP_STATUS_PORT_WKA,
|
||||
ZFCP_DID_DIRECTORY_SERVICE);
|
||||
if (!port) {
|
||||
ZFCP_LOG_INFO("error: enqueue of nameserver port for "
|
||||
"adapter %s failed\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
if (!port)
|
||||
return -ENXIO;
|
||||
}
|
||||
zfcp_port_put(port);
|
||||
|
||||
return 0;
|
||||
@ -946,5 +915,3 @@ int zfcp_sg_setup_table(struct scatterlist *sg, int count)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
||||
|
@ -1,22 +1,9 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* Debug traces for zfcp.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
#include <linux/ctype.h>
|
||||
@ -29,8 +16,6 @@ module_param(dbfsize, uint, 0400);
|
||||
MODULE_PARM_DESC(dbfsize,
|
||||
"number of pages for each debug feature area (default 4)");
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER
|
||||
|
||||
static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len,
|
||||
int level, char *from, int from_len)
|
||||
{
|
||||
@ -515,13 +500,13 @@ static const char *zfcp_rec_dbf_ids[] = {
|
||||
[52] = "port boxed close unit",
|
||||
[53] = "port boxed fcp",
|
||||
[54] = "unit boxed fcp",
|
||||
[55] = "port access denied ct",
|
||||
[56] = "port access denied els",
|
||||
[57] = "port access denied open port",
|
||||
[58] = "port access denied close physical",
|
||||
[59] = "unit access denied open unit",
|
||||
[55] = "port access denied",
|
||||
[56] = "",
|
||||
[57] = "",
|
||||
[58] = "",
|
||||
[59] = "unit access denied",
|
||||
[60] = "shared unit access denied open unit",
|
||||
[61] = "unit access denied fcp",
|
||||
[61] = "",
|
||||
[62] = "request timeout",
|
||||
[63] = "adisc link test reject or timeout",
|
||||
[64] = "adisc link test d_id changed",
|
||||
@ -586,8 +571,8 @@ static const char *zfcp_rec_dbf_ids[] = {
|
||||
[120] = "unknown fsf command",
|
||||
[121] = "no recommendation for status qualifier",
|
||||
[122] = "status read physical port closed in error",
|
||||
[123] = "fc service class not supported ct",
|
||||
[124] = "fc service class not supported els",
|
||||
[123] = "fc service class not supported",
|
||||
[124] = "",
|
||||
[125] = "need newer zfcp",
|
||||
[126] = "need newer microcode",
|
||||
[127] = "arbitrated loop not supported",
|
||||
@ -595,7 +580,7 @@ static const char *zfcp_rec_dbf_ids[] = {
|
||||
[129] = "qtcb size mismatch",
|
||||
[130] = "unknown fsf status ecd",
|
||||
[131] = "fcp request too big",
|
||||
[132] = "fc service class not supported fcp",
|
||||
[132] = "",
|
||||
[133] = "data direction not valid fcp",
|
||||
[134] = "command length not valid fcp",
|
||||
[135] = "status read act update",
|
||||
@ -1291,5 +1276,3 @@ void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter)
|
||||
adapter->hba_dbf = NULL;
|
||||
adapter->rec_dbf = NULL;
|
||||
}
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
||||
|
@ -1,22 +1,9 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* Global definitions for the zfcp device driver.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
#ifndef ZFCP_DEF_H
|
||||
@ -52,9 +39,6 @@
|
||||
|
||||
/********************* GENERAL DEFINES *********************************/
|
||||
|
||||
/* zfcp version number, it consists of major, minor, and patch-level number */
|
||||
#define ZFCP_VERSION "4.8.0"
|
||||
|
||||
/**
|
||||
* zfcp_sg_to_address - determine kernel address from struct scatterlist
|
||||
* @list: struct scatterlist
|
||||
@ -308,107 +292,6 @@ struct zfcp_rc_entry {
|
||||
*/
|
||||
#define ZFCP_CT_TIMEOUT (3 * R_A_TOV)
|
||||
|
||||
/******************** LOGGING MACROS AND DEFINES *****************************/
|
||||
|
||||
/*
|
||||
* Logging may be applied on certain kinds of driver operations
|
||||
* independently. Additionally, different log-levels are supported for
|
||||
* each of these areas.
|
||||
*/
|
||||
|
||||
#define ZFCP_NAME "zfcp"
|
||||
|
||||
/* independent log areas */
|
||||
#define ZFCP_LOG_AREA_OTHER 0
|
||||
#define ZFCP_LOG_AREA_SCSI 1
|
||||
#define ZFCP_LOG_AREA_FSF 2
|
||||
#define ZFCP_LOG_AREA_CONFIG 3
|
||||
#define ZFCP_LOG_AREA_CIO 4
|
||||
#define ZFCP_LOG_AREA_QDIO 5
|
||||
#define ZFCP_LOG_AREA_ERP 6
|
||||
#define ZFCP_LOG_AREA_FC 7
|
||||
|
||||
/* log level values*/
|
||||
#define ZFCP_LOG_LEVEL_NORMAL 0
|
||||
#define ZFCP_LOG_LEVEL_INFO 1
|
||||
#define ZFCP_LOG_LEVEL_DEBUG 2
|
||||
#define ZFCP_LOG_LEVEL_TRACE 3
|
||||
|
||||
/*
|
||||
* this allows removal of logging code by the preprocessor
|
||||
* (the most detailed log level still to be compiled in is specified,
|
||||
* higher log levels are removed)
|
||||
*/
|
||||
#define ZFCP_LOG_LEVEL_LIMIT ZFCP_LOG_LEVEL_TRACE
|
||||
|
||||
/* get "loglevel" nibble assignment */
|
||||
#define ZFCP_GET_LOG_VALUE(zfcp_lognibble) \
|
||||
((atomic_read(&zfcp_data.loglevel) >> (zfcp_lognibble<<2)) & 0xF)
|
||||
|
||||
/* set "loglevel" nibble */
|
||||
#define ZFCP_SET_LOG_NIBBLE(value, zfcp_lognibble) \
|
||||
(value << (zfcp_lognibble << 2))
|
||||
|
||||
/* all log-level defaults are combined to generate initial log-level */
|
||||
#define ZFCP_LOG_LEVEL_DEFAULTS \
|
||||
(ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_OTHER) | \
|
||||
ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_SCSI) | \
|
||||
ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_FSF) | \
|
||||
ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_CONFIG) | \
|
||||
ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_CIO) | \
|
||||
ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_QDIO) | \
|
||||
ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_ERP) | \
|
||||
ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_FC))
|
||||
|
||||
/* check whether we have the right level for logging */
|
||||
#define ZFCP_LOG_CHECK(level) \
|
||||
((ZFCP_GET_LOG_VALUE(ZFCP_LOG_AREA)) >= level)
|
||||
|
||||
/* logging routine for zfcp */
|
||||
#define _ZFCP_LOG(fmt, args...) \
|
||||
printk(KERN_ERR ZFCP_NAME": %s(%d): " fmt, __func__, \
|
||||
__LINE__ , ##args)
|
||||
|
||||
#define ZFCP_LOG(level, fmt, args...) \
|
||||
do { \
|
||||
if (ZFCP_LOG_CHECK(level)) \
|
||||
_ZFCP_LOG(fmt, ##args); \
|
||||
} while (0)
|
||||
|
||||
#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_NORMAL
|
||||
# define ZFCP_LOG_NORMAL(fmt, args...) do { } while (0)
|
||||
#else
|
||||
# define ZFCP_LOG_NORMAL(fmt, args...) \
|
||||
do { \
|
||||
if (ZFCP_LOG_CHECK(ZFCP_LOG_LEVEL_NORMAL)) \
|
||||
printk(KERN_ERR ZFCP_NAME": " fmt, ##args); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_INFO
|
||||
# define ZFCP_LOG_INFO(fmt, args...) do { } while (0)
|
||||
#else
|
||||
# define ZFCP_LOG_INFO(fmt, args...) \
|
||||
do { \
|
||||
if (ZFCP_LOG_CHECK(ZFCP_LOG_LEVEL_INFO)) \
|
||||
printk(KERN_ERR ZFCP_NAME": " fmt, ##args); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_DEBUG
|
||||
# define ZFCP_LOG_DEBUG(fmt, args...) do { } while (0)
|
||||
#else
|
||||
# define ZFCP_LOG_DEBUG(fmt, args...) \
|
||||
ZFCP_LOG(ZFCP_LOG_LEVEL_DEBUG, fmt , ##args)
|
||||
#endif
|
||||
|
||||
#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_TRACE
|
||||
# define ZFCP_LOG_TRACE(fmt, args...) do { } while (0)
|
||||
#else
|
||||
# define ZFCP_LOG_TRACE(fmt, args...) \
|
||||
ZFCP_LOG(ZFCP_LOG_LEVEL_TRACE, fmt , ##args)
|
||||
#endif
|
||||
|
||||
/*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/
|
||||
|
||||
/*
|
||||
@ -846,7 +729,6 @@ struct zfcp_data {
|
||||
char init_busid[BUS_ID_SIZE];
|
||||
wwn_t init_wwpn;
|
||||
fcp_lun_t init_fcp_lun;
|
||||
char *driver_version;
|
||||
struct kmem_cache *fsf_req_qtcb_cache;
|
||||
struct kmem_cache *sr_buffer_cache;
|
||||
struct kmem_cache *gid_pn_cache;
|
||||
|
@ -1,26 +1,11 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* Error Recovery Procedures (ERP).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP
|
||||
|
||||
#include "zfcp_ext.h"
|
||||
|
||||
static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int, u8,
|
||||
@ -171,14 +156,9 @@ static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter,
|
||||
{
|
||||
int retval;
|
||||
|
||||
ZFCP_LOG_DEBUG("reopen adapter %s\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
|
||||
zfcp_erp_adapter_block(adapter, clear_mask);
|
||||
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &adapter->status)) {
|
||||
ZFCP_LOG_DEBUG("skipped reopen of failed adapter %s\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
/* ensure propagation of failed status to new devices */
|
||||
zfcp_erp_adapter_failed(adapter, 13, NULL);
|
||||
retval = -EIO;
|
||||
@ -270,15 +250,9 @@ static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port,
|
||||
{
|
||||
int retval;
|
||||
|
||||
ZFCP_LOG_DEBUG("forced reopen of port 0x%016Lx on adapter %s\n",
|
||||
port->wwpn, zfcp_get_busid_by_port(port));
|
||||
|
||||
zfcp_erp_port_block(port, clear_mask);
|
||||
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) {
|
||||
ZFCP_LOG_DEBUG("skipped forced reopen of failed port 0x%016Lx "
|
||||
"on adapter %s\n", port->wwpn,
|
||||
zfcp_get_busid_by_port(port));
|
||||
retval = -EIO;
|
||||
goto out;
|
||||
}
|
||||
@ -332,15 +306,9 @@ static int zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask,
|
||||
{
|
||||
int retval;
|
||||
|
||||
ZFCP_LOG_DEBUG("reopen of port 0x%016Lx on adapter %s\n",
|
||||
port->wwpn, zfcp_get_busid_by_port(port));
|
||||
|
||||
zfcp_erp_port_block(port, clear_mask);
|
||||
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) {
|
||||
ZFCP_LOG_DEBUG("skipped reopen of failed port 0x%016Lx "
|
||||
"on adapter %s\n", port->wwpn,
|
||||
zfcp_get_busid_by_port(port));
|
||||
/* ensure propagation of failed status to new devices */
|
||||
zfcp_erp_port_failed(port, 14, NULL);
|
||||
retval = -EIO;
|
||||
@ -396,17 +364,9 @@ static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask,
|
||||
int retval;
|
||||
struct zfcp_adapter *adapter = unit->port->adapter;
|
||||
|
||||
ZFCP_LOG_DEBUG("reopen of unit 0x%016Lx on port 0x%016Lx "
|
||||
"on adapter %s\n", unit->fcp_lun,
|
||||
unit->port->wwpn, zfcp_get_busid_by_unit(unit));
|
||||
|
||||
zfcp_erp_unit_block(unit, clear_mask);
|
||||
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status)) {
|
||||
ZFCP_LOG_DEBUG("skipped reopen of failed unit 0x%016Lx "
|
||||
"on port 0x%016Lx on adapter %s\n",
|
||||
unit->fcp_lun, unit->port->wwpn,
|
||||
zfcp_get_busid_by_unit(unit));
|
||||
retval = -EIO;
|
||||
goto out;
|
||||
}
|
||||
@ -631,13 +591,8 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action)
|
||||
ZFCP_STATUS_FSFREQ_DISMISSED;
|
||||
zfcp_rec_dbf_event_action(142, erp_action);
|
||||
}
|
||||
if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) {
|
||||
if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
|
||||
zfcp_rec_dbf_event_action(143, erp_action);
|
||||
ZFCP_LOG_NORMAL("error: erp step timed out "
|
||||
"(action=%d, fsf_req=%p)\n ",
|
||||
erp_action->action,
|
||||
erp_action->fsf_req);
|
||||
}
|
||||
/*
|
||||
* If fsf_req is neither dismissed nor completed
|
||||
* then keep it running asynchronously and don't mess
|
||||
@ -740,11 +695,10 @@ zfcp_erp_thread_setup(struct zfcp_adapter *adapter)
|
||||
atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status);
|
||||
|
||||
retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD);
|
||||
if (retval < 0) {
|
||||
ZFCP_LOG_NORMAL("error: creation of erp thread failed for "
|
||||
"adapter %s\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
} else {
|
||||
if (retval < 0)
|
||||
dev_err(&adapter->ccw_device->dev,
|
||||
"Creation of ERP thread failed.\n");
|
||||
else {
|
||||
wait_event(adapter->erp_thread_wqh,
|
||||
atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP,
|
||||
&adapter->status));
|
||||
@ -919,15 +873,10 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action)
|
||||
This might happen if an erp_action that used a memory pool
|
||||
element was timed out.
|
||||
*/
|
||||
if (adapter->erp_total_count == adapter->erp_low_mem_count) {
|
||||
ZFCP_LOG_NORMAL("error: no mempool elements available, "
|
||||
"restarting I/O on adapter %s "
|
||||
"to free mempool\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
if (adapter->erp_total_count == adapter->erp_low_mem_count)
|
||||
zfcp_erp_adapter_reopen_internal(adapter, 0, 66, NULL);
|
||||
} else {
|
||||
retval = zfcp_erp_strategy_memwait(erp_action);
|
||||
}
|
||||
else
|
||||
retval = zfcp_erp_strategy_memwait(erp_action);
|
||||
goto unlock;
|
||||
case ZFCP_ERP_CONTINUES:
|
||||
/* leave since this action runs asynchronously */
|
||||
@ -1039,12 +988,6 @@ zfcp_erp_strategy_do_action(struct zfcp_erp_action *erp_action)
|
||||
case ZFCP_ERP_ACTION_REOPEN_UNIT:
|
||||
retval = zfcp_erp_unit_strategy(erp_action);
|
||||
break;
|
||||
|
||||
default:
|
||||
ZFCP_LOG_NORMAL("bug: unknown erp action requested on "
|
||||
"adapter %s (action=%d)\n",
|
||||
zfcp_get_busid_by_adapter(erp_action->adapter),
|
||||
erp_action->action);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@ -1083,8 +1026,7 @@ zfcp_erp_adapter_failed(struct zfcp_adapter *adapter, u8 id, void *ref)
|
||||
{
|
||||
zfcp_erp_modify_adapter_status(adapter, id, ref,
|
||||
ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
|
||||
ZFCP_LOG_NORMAL("adapter erp failed on adapter %s\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
dev_err(&adapter->ccw_device->dev, "Adapter ERP failed.\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1100,12 +1042,13 @@ zfcp_erp_port_failed(struct zfcp_port *port, u8 id, void *ref)
|
||||
ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
|
||||
|
||||
if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
|
||||
ZFCP_LOG_NORMAL("port erp failed (adapter %s, "
|
||||
"port d_id=0x%06x)\n",
|
||||
zfcp_get_busid_by_port(port), port->d_id);
|
||||
dev_err(&port->adapter->ccw_device->dev,
|
||||
"Port ERP failed for WKA port d_id=0x%06x.\n",
|
||||
port->d_id);
|
||||
else
|
||||
ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n",
|
||||
zfcp_get_busid_by_port(port), port->wwpn);
|
||||
dev_err(&port->adapter->ccw_device->dev,
|
||||
"Port ERP failed for port wwpn=0x%016Lx.\n",
|
||||
port->wwpn);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1120,9 +1063,9 @@ zfcp_erp_unit_failed(struct zfcp_unit *unit, u8 id, void *ref)
|
||||
zfcp_erp_modify_unit_status(unit, id, ref,
|
||||
ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
|
||||
|
||||
ZFCP_LOG_NORMAL("unit erp failed on unit 0x%016Lx on port 0x%016Lx "
|
||||
" on adapter %s\n", unit->fcp_lun,
|
||||
unit->port->wwpn, zfcp_get_busid_by_unit(unit));
|
||||
dev_err(&unit->port->adapter->ccw_device->dev,
|
||||
"Unit ERP failed for unit 0x%016Lx on port 0x%016Lx.\n",
|
||||
unit->fcp_lun, unit->port->wwpn);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1336,13 +1279,10 @@ zfcp_erp_schedule_work(struct zfcp_unit *unit)
|
||||
|
||||
p = kzalloc(sizeof(*p), GFP_KERNEL);
|
||||
if (!p) {
|
||||
ZFCP_LOG_NORMAL("error: Out of resources. Could not register "
|
||||
"the FCP-LUN 0x%Lx connected to "
|
||||
"the port with WWPN 0x%Lx connected to "
|
||||
"the adapter %s with the SCSI stack.\n",
|
||||
unit->fcp_lun,
|
||||
unit->port->wwpn,
|
||||
zfcp_get_busid_by_unit(unit));
|
||||
dev_err(&unit->port->adapter->ccw_device->dev,
|
||||
"Out of resources. Could not register unit 0x%016Lx "
|
||||
"on port 0x%016Lx with SCSI stack.\n",
|
||||
unit->fcp_lun, unit->port->wwpn);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1585,7 +1525,6 @@ static int
|
||||
zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action)
|
||||
{
|
||||
int retval;
|
||||
struct zfcp_adapter *adapter = erp_action->adapter;
|
||||
|
||||
retval = zfcp_erp_adapter_strategy_close(erp_action);
|
||||
if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
|
||||
@ -1593,12 +1532,8 @@ zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action)
|
||||
else
|
||||
retval = zfcp_erp_adapter_strategy_open(erp_action);
|
||||
|
||||
if (retval == ZFCP_ERP_FAILED) {
|
||||
ZFCP_LOG_INFO("Waiting to allow the adapter %s "
|
||||
"to recover itself\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
if (retval == ZFCP_ERP_FAILED)
|
||||
ssleep(ZFCP_TYPE2_RECOVERY_TIME);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -1743,19 +1678,13 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
|
||||
for (retries = ZFCP_EXCHANGE_CONFIG_DATA_RETRIES; retries; retries--) {
|
||||
atomic_clear_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
|
||||
&adapter->status);
|
||||
ZFCP_LOG_DEBUG("Doing exchange config data\n");
|
||||
write_lock_irq(&adapter->erp_lock);
|
||||
zfcp_erp_action_to_running(erp_action);
|
||||
write_unlock_irq(&adapter->erp_lock);
|
||||
if (zfcp_fsf_exchange_config_data(erp_action)) {
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
ZFCP_LOG_INFO("error: initiation of exchange of "
|
||||
"configuration data failed for "
|
||||
"adapter %s\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
break;
|
||||
}
|
||||
ZFCP_LOG_DEBUG("Xchange underway\n");
|
||||
|
||||
/*
|
||||
* Why this works:
|
||||
@ -1773,19 +1702,13 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
|
||||
zfcp_rec_dbf_event_thread_lock(6, adapter);
|
||||
down(&adapter->erp_ready_sem);
|
||||
zfcp_rec_dbf_event_thread_lock(7, adapter);
|
||||
if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) {
|
||||
ZFCP_LOG_INFO("error: exchange of configuration data "
|
||||
"for adapter %s timed out\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
|
||||
&adapter->status))
|
||||
break;
|
||||
|
||||
ZFCP_LOG_DEBUG("host connection still initialising... "
|
||||
"waiting and retrying...\n");
|
||||
/* sleep a little bit before retry */
|
||||
ssleep(sleep);
|
||||
sleep *= 2;
|
||||
@ -1795,12 +1718,8 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
|
||||
&adapter->status);
|
||||
|
||||
if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK,
|
||||
&adapter->status)) {
|
||||
ZFCP_LOG_INFO("error: exchange of configuration data for "
|
||||
"adapter %s failed\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
&adapter->status))
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -1829,16 +1748,8 @@ zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action)
|
||||
zfcp_rec_dbf_event_thread_lock(8, adapter);
|
||||
down(&adapter->erp_ready_sem);
|
||||
zfcp_rec_dbf_event_thread_lock(9, adapter);
|
||||
if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) {
|
||||
ZFCP_LOG_INFO("error: exchange port data timed out (adapter "
|
||||
"%s)\n", zfcp_get_busid_by_adapter(adapter));
|
||||
if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
|
||||
ret = ZFCP_ERP_FAILED;
|
||||
}
|
||||
|
||||
/* don't treat as error for the sake of compatibility */
|
||||
if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status))
|
||||
ZFCP_LOG_INFO("warning: exchange port data failed (adapter "
|
||||
"%s\n", zfcp_get_busid_by_adapter(adapter));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1884,8 +1795,6 @@ zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)
|
||||
if (atomic_test_mask((ZFCP_STATUS_PORT_PHYS_OPEN |
|
||||
ZFCP_STATUS_COMMON_OPEN),
|
||||
&port->status)) {
|
||||
ZFCP_LOG_DEBUG("port 0x%016Lx is open -> trying "
|
||||
"close physical\n", port->wwpn);
|
||||
retval =
|
||||
zfcp_erp_port_forced_strategy_close(erp_action);
|
||||
} else
|
||||
@ -1895,8 +1804,6 @@ zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)
|
||||
case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
|
||||
if (atomic_test_mask(ZFCP_STATUS_PORT_PHYS_OPEN,
|
||||
&port->status)) {
|
||||
ZFCP_LOG_DEBUG("close physical failed for port "
|
||||
"0x%016Lx\n", port->wwpn);
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
} else
|
||||
retval = ZFCP_ERP_SUCCEEDED;
|
||||
@ -1930,8 +1837,6 @@ zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action)
|
||||
case ZFCP_ERP_STEP_UNINITIALIZED:
|
||||
zfcp_erp_port_strategy_clearstati(port);
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) {
|
||||
ZFCP_LOG_DEBUG("port 0x%016Lx is open -> trying "
|
||||
"close\n", port->wwpn);
|
||||
retval = zfcp_erp_port_strategy_close(erp_action);
|
||||
goto out;
|
||||
} /* else it's already closed, open it */
|
||||
@ -1939,8 +1844,6 @@ zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action)
|
||||
|
||||
case ZFCP_ERP_STEP_PORT_CLOSING:
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) {
|
||||
ZFCP_LOG_DEBUG("close failed for port 0x%016Lx\n",
|
||||
port->wwpn);
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
goto out;
|
||||
} /* else it's closed now, open it */
|
||||
@ -1983,12 +1886,10 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
|
||||
case ZFCP_ERP_STEP_PORT_CLOSING:
|
||||
if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) {
|
||||
if (port->wwpn != adapter->peer_wwpn) {
|
||||
ZFCP_LOG_NORMAL("Failed to open port 0x%016Lx "
|
||||
"on adapter %s.\nPeer WWPN "
|
||||
"0x%016Lx does not match\n",
|
||||
port->wwpn,
|
||||
zfcp_get_busid_by_adapter(adapter),
|
||||
adapter->peer_wwpn);
|
||||
dev_err(&adapter->ccw_device->dev,
|
||||
"Failed to open port 0x%016Lx, "
|
||||
"Peer WWPN 0x%016Lx does not match.\n",
|
||||
port->wwpn, adapter->peer_wwpn);
|
||||
zfcp_erp_port_failed(port, 25, NULL);
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
break;
|
||||
@ -2001,17 +1902,14 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
|
||||
if (!(adapter->nameserver_port)) {
|
||||
retval = zfcp_nameserver_enqueue(adapter);
|
||||
if (retval != 0) {
|
||||
ZFCP_LOG_NORMAL("error: nameserver port "
|
||||
"unavailable for adapter %s\n",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
dev_err(&adapter->ccw_device->dev,
|
||||
"Nameserver port unavailable.\n");
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
|
||||
&adapter->nameserver_port->status)) {
|
||||
ZFCP_LOG_DEBUG("nameserver port is not open -> open "
|
||||
"nameserver port\n");
|
||||
/* nameserver port may live again */
|
||||
atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING,
|
||||
&adapter->nameserver_port->status);
|
||||
@ -2027,57 +1925,37 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
|
||||
/* else nameserver port is already open, fall through */
|
||||
case ZFCP_ERP_STEP_NAMESERVER_OPEN:
|
||||
if (!atomic_test_mask(ZFCP_STATUS_COMMON_OPEN,
|
||||
&adapter->nameserver_port->status)) {
|
||||
ZFCP_LOG_DEBUG("open failed for nameserver port\n");
|
||||
&adapter->nameserver_port->status))
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
} else {
|
||||
ZFCP_LOG_DEBUG("nameserver port is open -> "
|
||||
"nameserver look-up for port 0x%016Lx\n",
|
||||
port->wwpn);
|
||||
else
|
||||
retval = zfcp_erp_port_strategy_open_common_lookup
|
||||
(erp_action);
|
||||
}
|
||||
break;
|
||||
|
||||
case ZFCP_ERP_STEP_NAMESERVER_LOOKUP:
|
||||
if (!atomic_test_mask(ZFCP_STATUS_PORT_DID_DID, &port->status)) {
|
||||
if (atomic_test_mask
|
||||
(ZFCP_STATUS_PORT_INVALID_WWPN, &port->status)) {
|
||||
ZFCP_LOG_DEBUG("nameserver look-up failed "
|
||||
"for port 0x%016Lx "
|
||||
"(misconfigured WWPN?)\n",
|
||||
port->wwpn);
|
||||
zfcp_erp_port_failed(port, 26, NULL);
|
||||
retval = ZFCP_ERP_EXIT;
|
||||
} else {
|
||||
ZFCP_LOG_DEBUG("nameserver look-up failed for "
|
||||
"port 0x%016Lx\n", port->wwpn);
|
||||
} else
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
}
|
||||
} else {
|
||||
ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> "
|
||||
"trying open\n", port->wwpn, port->d_id);
|
||||
} else
|
||||
retval = zfcp_erp_port_strategy_open_port(erp_action);
|
||||
}
|
||||
break;
|
||||
|
||||
case ZFCP_ERP_STEP_PORT_OPENING:
|
||||
/* D_ID might have changed during open */
|
||||
if (atomic_test_mask((ZFCP_STATUS_COMMON_OPEN |
|
||||
ZFCP_STATUS_PORT_DID_DID),
|
||||
&port->status)) {
|
||||
ZFCP_LOG_DEBUG("port 0x%016Lx is open\n", port->wwpn);
|
||||
&port->status))
|
||||
retval = ZFCP_ERP_SUCCEEDED;
|
||||
} else {
|
||||
ZFCP_LOG_DEBUG("open failed for port 0x%016Lx\n",
|
||||
port->wwpn);
|
||||
else
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ZFCP_LOG_NORMAL("bug: unknown erp step 0x%08x\n",
|
||||
erp_action->step);
|
||||
/* unknown erp step */
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
}
|
||||
|
||||
@ -2095,27 +1973,20 @@ zfcp_erp_port_strategy_open_nameserver(struct zfcp_erp_action *erp_action)
|
||||
case ZFCP_ERP_STEP_UNINITIALIZED:
|
||||
case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
|
||||
case ZFCP_ERP_STEP_PORT_CLOSING:
|
||||
ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> trying open\n",
|
||||
port->wwpn, port->d_id);
|
||||
retval = zfcp_erp_port_strategy_open_port(erp_action);
|
||||
break;
|
||||
|
||||
case ZFCP_ERP_STEP_PORT_OPENING:
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) {
|
||||
ZFCP_LOG_DEBUG("WKA port is open\n");
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status))
|
||||
retval = ZFCP_ERP_SUCCEEDED;
|
||||
} else {
|
||||
ZFCP_LOG_DEBUG("open failed for WKA port\n");
|
||||
else
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
}
|
||||
/* this is needed anyway (dont care for retval of wakeup) */
|
||||
ZFCP_LOG_DEBUG("continue other open port operations\n");
|
||||
zfcp_erp_port_strategy_open_nameserver_wakeup(erp_action);
|
||||
break;
|
||||
|
||||
default:
|
||||
ZFCP_LOG_NORMAL("bug: unknown erp step 0x%08x\n",
|
||||
erp_action->step);
|
||||
/* unknown erp step */
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
}
|
||||
|
||||
@ -2313,39 +2184,26 @@ zfcp_erp_unit_strategy(struct zfcp_erp_action *erp_action)
|
||||
case ZFCP_ERP_STEP_UNINITIALIZED:
|
||||
zfcp_erp_unit_strategy_clearstati(unit);
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) {
|
||||
ZFCP_LOG_DEBUG("unit 0x%016Lx is open -> "
|
||||
"trying close\n", unit->fcp_lun);
|
||||
retval = zfcp_erp_unit_strategy_close(erp_action);
|
||||
break;
|
||||
}
|
||||
/* else it's already closed, fall through */
|
||||
case ZFCP_ERP_STEP_UNIT_CLOSING:
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) {
|
||||
ZFCP_LOG_DEBUG("close failed for unit 0x%016Lx\n",
|
||||
unit->fcp_lun);
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status))
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
} else {
|
||||
else
|
||||
if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
|
||||
retval = ZFCP_ERP_EXIT;
|
||||
else {
|
||||
ZFCP_LOG_DEBUG("unit 0x%016Lx is not open -> "
|
||||
"trying open\n", unit->fcp_lun);
|
||||
else
|
||||
retval =
|
||||
zfcp_erp_unit_strategy_open(erp_action);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ZFCP_ERP_STEP_UNIT_OPENING:
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) {
|
||||
ZFCP_LOG_DEBUG("unit 0x%016Lx is open\n",
|
||||
unit->fcp_lun);
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status))
|
||||
retval = ZFCP_ERP_SUCCEEDED;
|
||||
} else {
|
||||
ZFCP_LOG_DEBUG("open failed for unit 0x%016Lx\n",
|
||||
unit->fcp_lun);
|
||||
else
|
||||
retval = ZFCP_ERP_FAILED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2493,16 +2351,8 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
|
||||
|
||||
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
|
||||
if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE,
|
||||
&port->status)) {
|
||||
if (port->erp_action.action !=
|
||||
ZFCP_ERP_ACTION_REOPEN_PORT_FORCED) {
|
||||
ZFCP_LOG_INFO("dropped erp action %i (port "
|
||||
"0x%016Lx, action in use: %i)\n",
|
||||
want, port->wwpn,
|
||||
port->erp_action.action);
|
||||
}
|
||||
&port->status))
|
||||
goto out;
|
||||
}
|
||||
if (!atomic_test_mask
|
||||
(ZFCP_STATUS_COMMON_RUNNING, &adapter->status) ||
|
||||
atomic_test_mask
|
||||
@ -2522,19 +2372,10 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
|
||||
break;
|
||||
|
||||
default:
|
||||
ZFCP_LOG_NORMAL("bug: unknown erp action requested "
|
||||
"on adapter %s (action=%d)\n",
|
||||
zfcp_get_busid_by_adapter(adapter), want);
|
||||
/* unknown erp action */
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* check whether we need something stronger first */
|
||||
if (need) {
|
||||
ZFCP_LOG_DEBUG("stronger erp action %d needed before "
|
||||
"erp action %d on adapter %s\n",
|
||||
need, want, zfcp_get_busid_by_adapter(adapter));
|
||||
}
|
||||
|
||||
/* mark adapter to have some error recovery pending */
|
||||
atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
|
||||
|
||||
@ -2672,10 +2513,9 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
|
||||
port->rport =
|
||||
fc_remote_port_add(adapter->scsi_host, 0, &ids);
|
||||
if (!port->rport)
|
||||
ZFCP_LOG_NORMAL("failed registration of rport"
|
||||
"(adapter %s, wwpn=0x%016Lx)\n",
|
||||
zfcp_get_busid_by_port(port),
|
||||
port->wwpn);
|
||||
dev_err(&adapter->ccw_device->dev,
|
||||
"Failed registration of rport "
|
||||
"0x%016Lx.\n", port->wwpn);
|
||||
else {
|
||||
scsi_target_unblock(&port->rport->dev);
|
||||
port->rport->maxframe_size = port->maxframe_size;
|
||||
@ -2803,7 +2643,6 @@ void zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter, u8 id,
|
||||
|
||||
void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, void *ref)
|
||||
{
|
||||
struct zfcp_adapter *adapter = port->adapter;
|
||||
struct zfcp_unit *unit;
|
||||
|
||||
if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
|
||||
@ -2816,34 +2655,16 @@ void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, void *ref)
|
||||
return;
|
||||
}
|
||||
|
||||
ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s "
|
||||
"(due to ACT update)\n",
|
||||
port->wwpn, zfcp_get_busid_by_adapter(adapter));
|
||||
if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
|
||||
ZFCP_LOG_NORMAL("failed reopen of port"
|
||||
"(adapter %s, wwpn=0x%016Lx)\n",
|
||||
zfcp_get_busid_by_adapter(adapter), port->wwpn);
|
||||
zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
|
||||
}
|
||||
|
||||
void zfcp_erp_unit_access_changed(struct zfcp_unit *unit, u8 id, void *ref)
|
||||
{
|
||||
struct zfcp_adapter *adapter = unit->port->adapter;
|
||||
|
||||
if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
|
||||
&unit->status) &&
|
||||
!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED,
|
||||
&unit->status))
|
||||
return;
|
||||
|
||||
ZFCP_LOG_NORMAL("reopen of unit 0x%016Lx on port 0x%016Lx "
|
||||
" on adapter %s (due to ACT update)\n",
|
||||
unit->fcp_lun, unit->port->wwpn,
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
|
||||
ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, "
|
||||
"wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
|
||||
zfcp_get_busid_by_adapter(adapter),
|
||||
unit->port->wwpn, unit->fcp_lun);
|
||||
zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
|
||||
}
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
||||
|
@ -1,22 +1,9 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* External function declarations.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
#ifndef ZFCP_EXT_H
|
||||
@ -27,7 +14,6 @@
|
||||
extern struct zfcp_data zfcp_data;
|
||||
|
||||
/******************************** SYSFS *************************************/
|
||||
extern struct attribute_group *zfcp_driver_attr_groups[];
|
||||
extern int zfcp_sysfs_adapter_create_files(struct device *);
|
||||
extern void zfcp_sysfs_adapter_remove_files(struct device *);
|
||||
extern int zfcp_sysfs_port_create_files(struct device *, u32);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,9 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* Interface to the FSF support functions.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
#ifndef FSF_H
|
||||
@ -342,6 +329,7 @@ struct fsf_qual_latency_info {
|
||||
} __attribute__ ((packed));
|
||||
|
||||
union fsf_prot_status_qual {
|
||||
u32 word[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u32)];
|
||||
u64 doubleword[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u64)];
|
||||
struct fsf_qual_version_error version_error;
|
||||
struct fsf_qual_sequence_error sequence_error;
|
||||
|
@ -1,26 +1,11 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* Interface to Linux SCSI midlayer.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_SCSI
|
||||
|
||||
#include "zfcp_ext.h"
|
||||
#include <asm/atomic.h>
|
||||
|
||||
@ -44,7 +29,7 @@ static struct device_attribute *zfcp_a_stats_attrs[];
|
||||
|
||||
struct zfcp_data zfcp_data = {
|
||||
.scsi_host_template = {
|
||||
.name = ZFCP_NAME,
|
||||
.name = "zfcp",
|
||||
.module = THIS_MODULE,
|
||||
.proc_name = "zfcp",
|
||||
.slave_alloc = zfcp_scsi_slave_alloc,
|
||||
@ -64,7 +49,6 @@ struct zfcp_data zfcp_data = {
|
||||
.max_sectors = ZFCP_MAX_SECTORS,
|
||||
.shost_attrs = zfcp_a_stats_attrs,
|
||||
},
|
||||
.driver_version = ZFCP_VERSION,
|
||||
};
|
||||
|
||||
/* Find start of Response Information in FCP response unit*/
|
||||
@ -181,16 +165,14 @@ zfcp_scsi_slave_alloc(struct scsi_device *sdp)
|
||||
static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
|
||||
{
|
||||
struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata;
|
||||
|
||||
WARN_ON(!unit);
|
||||
if (unit) {
|
||||
atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status);
|
||||
sdpnt->hostdata = NULL;
|
||||
unit->device = NULL;
|
||||
zfcp_erp_unit_failed(unit, 12, NULL);
|
||||
zfcp_unit_put(unit);
|
||||
} else
|
||||
ZFCP_LOG_NORMAL("bug: no unit associated with SCSI device at "
|
||||
"address %p\n", sdpnt);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -253,10 +235,6 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit,
|
||||
if (unlikely(
|
||||
atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status) ||
|
||||
!atomic_test_mask(ZFCP_STATUS_COMMON_RUNNING, &unit->status))) {
|
||||
ZFCP_LOG_DEBUG("stopping SCSI I/O on unit 0x%016Lx on port "
|
||||
"0x%016Lx on adapter %s\n",
|
||||
unit->fcp_lun, unit->port->wwpn,
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
zfcp_scsi_command_fail(scpnt, DID_ERROR);
|
||||
goto out;
|
||||
}
|
||||
@ -264,18 +242,12 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit,
|
||||
tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, use_timer,
|
||||
ZFCP_REQ_AUTO_CLEANUP);
|
||||
if (unlikely(tmp == -EBUSY)) {
|
||||
ZFCP_LOG_DEBUG("adapter %s not ready or unit 0x%016Lx "
|
||||
"on port 0x%016Lx in recovery\n",
|
||||
zfcp_get_busid_by_unit(unit),
|
||||
unit->fcp_lun, unit->port->wwpn);
|
||||
zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (unlikely(tmp < 0)) {
|
||||
ZFCP_LOG_DEBUG("error: initiation of Send FCP Cmnd failed\n");
|
||||
if (unlikely(tmp < 0))
|
||||
retval = SCSI_MLQUEUE_HOST_BUSY;
|
||||
}
|
||||
|
||||
out:
|
||||
return retval;
|
||||
@ -394,9 +366,6 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
|
||||
adapter = (struct zfcp_adapter *) scsi_host->hostdata[0];
|
||||
unit = (struct zfcp_unit *) scpnt->device->hostdata;
|
||||
|
||||
ZFCP_LOG_INFO("aborting scsi_cmnd=%p on adapter %s\n",
|
||||
scpnt, zfcp_get_busid_by_adapter(adapter));
|
||||
|
||||
/* avoid race condition between late normal completion and abort */
|
||||
write_lock_irqsave(&adapter->abort_lock, flags);
|
||||
|
||||
@ -420,7 +389,6 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
|
||||
|
||||
fsf_req = zfcp_fsf_abort_fcp_command(old_req_id, adapter, unit, 0);
|
||||
if (!fsf_req) {
|
||||
ZFCP_LOG_INFO("error: initiation of Abort FCP Cmnd failed\n");
|
||||
zfcp_scsi_dbf_event_abort("nres", adapter, scpnt, NULL,
|
||||
old_req_id);
|
||||
retval = FAILED;
|
||||
@ -485,10 +453,6 @@ zfcp_task_management_function(struct zfcp_unit *unit, u8 tm_flags,
|
||||
fsf_req = zfcp_fsf_send_fcp_command_task_management
|
||||
(adapter, unit, tm_flags, 0);
|
||||
if (!fsf_req) {
|
||||
ZFCP_LOG_INFO("error: creation of task management request "
|
||||
"failed for unit 0x%016Lx on port 0x%016Lx on "
|
||||
"adapter %s\n", unit->fcp_lun, unit->port->wwpn,
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
zfcp_scsi_dbf_event_devreset("nres", tm_flags, unit, scpnt);
|
||||
retval = -ENOMEM;
|
||||
goto out;
|
||||
@ -524,12 +488,6 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
|
||||
|
||||
unit = (struct zfcp_unit*) scpnt->device->hostdata;
|
||||
adapter = unit->port->adapter;
|
||||
|
||||
ZFCP_LOG_NORMAL("host reset because of problems with "
|
||||
"unit 0x%016Lx on port 0x%016Lx, adapter %s\n",
|
||||
unit->fcp_lun, unit->port->wwpn,
|
||||
zfcp_get_busid_by_adapter(unit->port->adapter));
|
||||
|
||||
zfcp_erp_adapter_reopen(adapter, 0, 141, scpnt);
|
||||
zfcp_erp_wait(adapter);
|
||||
|
||||
@ -549,13 +507,11 @@ zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
|
||||
adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template,
|
||||
sizeof (struct zfcp_adapter *));
|
||||
if (!adapter->scsi_host) {
|
||||
ZFCP_LOG_NORMAL("error: registration with SCSI stack failed "
|
||||
"for adapter %s ",
|
||||
zfcp_get_busid_by_adapter(adapter));
|
||||
dev_err(&adapter->ccw_device->dev,
|
||||
"registration with SCSI stack failed.");
|
||||
retval = -EIO;
|
||||
goto out;
|
||||
}
|
||||
ZFCP_LOG_DEBUG("host registered, scsi_host=%p\n", adapter->scsi_host);
|
||||
|
||||
/* tell the SCSI stack some characteristics of this adapter */
|
||||
adapter->scsi_host->max_id = 1;
|
||||
@ -987,5 +943,3 @@ static struct device_attribute *zfcp_a_stats_attrs[] = {
|
||||
&dev_attr_seconds_active,
|
||||
NULL
|
||||
};
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
||||
|
@ -1,28 +1,13 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* sysfs attributes for CCW device.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
#include "zfcp_ext.h"
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
|
||||
|
||||
/**
|
||||
* ZFCP_DEFINE_ADAPTER_ATTR
|
||||
* @_name: name of show attribute
|
||||
@ -266,5 +251,3 @@ zfcp_sysfs_adapter_remove_files(struct device *dev)
|
||||
{
|
||||
sysfs_remove_group(&dev->kobj, &zfcp_adapter_attr_group);
|
||||
}
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
||||
|
@ -1,106 +0,0 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "zfcp_ext.h"
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
|
||||
|
||||
/**
|
||||
* ZFCP_DEFINE_DRIVER_ATTR - define for all loglevels sysfs attributes
|
||||
* @_name: name of attribute
|
||||
* @_define: name of ZFCP loglevel define
|
||||
*
|
||||
* Generates store function for a sysfs loglevel attribute of zfcp driver.
|
||||
*/
|
||||
#define ZFCP_DEFINE_DRIVER_ATTR(_name, _define) \
|
||||
static ssize_t zfcp_sysfs_loglevel_##_name##_store(struct device_driver *drv, \
|
||||
const char *buf, \
|
||||
size_t count) \
|
||||
{ \
|
||||
unsigned int loglevel; \
|
||||
unsigned int new_loglevel; \
|
||||
char *endp; \
|
||||
\
|
||||
new_loglevel = simple_strtoul(buf, &endp, 0); \
|
||||
if ((endp + 1) < (buf + count)) \
|
||||
return -EINVAL; \
|
||||
if (new_loglevel > 3) \
|
||||
return -EINVAL; \
|
||||
down(&zfcp_data.config_sema); \
|
||||
loglevel = atomic_read(&zfcp_data.loglevel); \
|
||||
loglevel &= ~((unsigned int) 0xf << (ZFCP_LOG_AREA_##_define << 2)); \
|
||||
loglevel |= new_loglevel << (ZFCP_LOG_AREA_##_define << 2); \
|
||||
atomic_set(&zfcp_data.loglevel, loglevel); \
|
||||
up(&zfcp_data.config_sema); \
|
||||
return count; \
|
||||
} \
|
||||
\
|
||||
static ssize_t zfcp_sysfs_loglevel_##_name##_show(struct device_driver *dev, \
|
||||
char *buf) \
|
||||
{ \
|
||||
return sprintf(buf,"%d\n", (unsigned int) \
|
||||
ZFCP_GET_LOG_VALUE(ZFCP_LOG_AREA_##_define)); \
|
||||
} \
|
||||
\
|
||||
static DRIVER_ATTR(loglevel_##_name, S_IWUSR | S_IRUGO, \
|
||||
zfcp_sysfs_loglevel_##_name##_show, \
|
||||
zfcp_sysfs_loglevel_##_name##_store);
|
||||
|
||||
ZFCP_DEFINE_DRIVER_ATTR(other, OTHER);
|
||||
ZFCP_DEFINE_DRIVER_ATTR(scsi, SCSI);
|
||||
ZFCP_DEFINE_DRIVER_ATTR(fsf, FSF);
|
||||
ZFCP_DEFINE_DRIVER_ATTR(config, CONFIG);
|
||||
ZFCP_DEFINE_DRIVER_ATTR(cio, CIO);
|
||||
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_data.driver_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,
|
||||
&driver_attr_loglevel_fsf.attr,
|
||||
&driver_attr_loglevel_config.attr,
|
||||
&driver_attr_loglevel_cio.attr,
|
||||
&driver_attr_loglevel_qdio.attr,
|
||||
&driver_attr_loglevel_erp.attr,
|
||||
&driver_attr_loglevel_fc.attr,
|
||||
&driver_attr_version.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct attribute_group zfcp_driver_attr_group = {
|
||||
.attrs = zfcp_driver_attrs,
|
||||
};
|
||||
|
||||
struct attribute_group *zfcp_driver_attr_groups[] = {
|
||||
&zfcp_driver_attr_group,
|
||||
NULL,
|
||||
};
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
@ -1,28 +1,13 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* sysfs attributes for zfcp port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
#include "zfcp_ext.h"
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
|
||||
|
||||
/**
|
||||
* zfcp_sysfs_port_release - gets called when a struct device port is released
|
||||
* @dev: pointer to belonging device
|
||||
@ -291,5 +276,3 @@ zfcp_sysfs_port_remove_files(struct device *dev, u32 flags)
|
||||
if (!(flags & ZFCP_STATUS_PORT_WKA))
|
||||
sysfs_remove_group(&dev->kobj, &zfcp_port_no_ns_attr_group);
|
||||
}
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
||||
|
@ -1,28 +1,13 @@
|
||||
/*
|
||||
* This file is part of the zfcp device driver for
|
||||
* FCP adapters for IBM System z9 and zSeries.
|
||||
* zfcp device driver
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2002, 2006
|
||||
* sysfs interface for zfcp unit.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Copyright IBM Corporation 2002, 2008
|
||||
*/
|
||||
|
||||
#include "zfcp_ext.h"
|
||||
|
||||
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
|
||||
|
||||
/**
|
||||
* zfcp_sysfs_unit_release - gets called when a struct device unit is released
|
||||
* @dev: pointer to belonging device
|
||||
@ -163,5 +148,3 @@ zfcp_sysfs_unit_remove_files(struct device *dev)
|
||||
{
|
||||
sysfs_remove_group(&dev->kobj, &zfcp_unit_attr_group);
|
||||
}
|
||||
|
||||
#undef ZFCP_LOG_AREA
|
||||
|
Loading…
Reference in New Issue
Block a user