Commit 553448f6 authored by Christof Schmitt's avatar Christof Schmitt Committed by James Bottomley

[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: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarSwen Schillig <swen@vnet.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 00bab910
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
zfcp-objs := zfcp_aux.o zfcp_ccw.o zfcp_scsi.o zfcp_erp.o zfcp_qdio.o \ 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_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 obj-$(CONFIG_ZFCP) += zfcp.o
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries.
* *
* (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 * Copyright IBM Corporation 2002, 2008
* 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.
*/ */
/* /*
...@@ -31,13 +18,16 @@ ...@@ -31,13 +18,16 @@
* Maxim Shchetynin * Maxim Shchetynin
* Volker Sameske * Volker Sameske
* Ralph Wuerthner * Ralph Wuerthner
* Michael Loehr
* Swen Schillig
* Christof Schmitt
* Martin Petermann
* Sven Schuetz
*/ */
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include "zfcp_ext.h" #include "zfcp_ext.h"
/* accumulated log level (module parameter) */
static u32 loglevel = ZFCP_LOG_LEVEL_DEFAULTS;
static char *device; static char *device;
/*********************** FUNCTION PROTOTYPES *********************************/ /*********************** FUNCTION PROTOTYPES *********************************/
...@@ -57,12 +47,6 @@ MODULE_LICENSE("GPL"); ...@@ -57,12 +47,6 @@ MODULE_LICENSE("GPL");
module_param(device, charp, 0400); module_param(device, charp, 0400);
MODULE_PARM_DESC(device, "specify initial device"); 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 ***********************/ /************** Functions without logging ***********************/
/****************************************************************/ /****************************************************************/
...@@ -87,8 +71,6 @@ _zfcp_hex_dump(char *addr, int count) ...@@ -87,8 +71,6 @@ _zfcp_hex_dump(char *addr, int count)
/****** Functions to handle the request ID hash table ********/ /****** 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) static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter)
{ {
int idx; int idx;
...@@ -118,14 +100,10 @@ int zfcp_reqlist_isempty(struct zfcp_adapter *adapter) ...@@ -118,14 +100,10 @@ int zfcp_reqlist_isempty(struct zfcp_adapter *adapter)
return 1; return 1;
} }
#undef ZFCP_LOG_AREA
/****************************************************************/ /****************************************************************/
/************** Uncategorised Functions *************************/ /************** Uncategorised Functions *************************/
/****************************************************************/ /****************************************************************/
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER
/** /**
* zfcp_device_setup - setup function * zfcp_device_setup - setup function
* @str: pointer to parameter string * @str: pointer to parameter string
...@@ -143,8 +121,11 @@ zfcp_device_setup(char *devstr) ...@@ -143,8 +121,11 @@ zfcp_device_setup(char *devstr)
len = strlen(devstr) + 1; len = strlen(devstr) + 1;
str = kmalloc(len, GFP_KERNEL); str = kmalloc(len, GFP_KERNEL);
if (!str) if (!str) {
goto err_out; pr_err("zfcp: Could not allocate memory for "
"device parameter string, device not attached.\n");
return 0;
}
memcpy(str, devstr, len); memcpy(str, devstr, len);
tmp = strchr(str, ','); tmp = strchr(str, ',');
...@@ -167,7 +148,8 @@ zfcp_device_setup(char *devstr) ...@@ -167,7 +148,8 @@ zfcp_device_setup(char *devstr)
return 1; return 1;
err_out: 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); kfree(str);
return 0; return 0;
} }
...@@ -248,8 +230,6 @@ zfcp_module_init(void) ...@@ -248,8 +230,6 @@ zfcp_module_init(void)
if (!zfcp_data.gid_pn_cache) if (!zfcp_data.gid_pn_cache)
goto out_gid_cache; goto out_gid_cache;
atomic_set(&zfcp_data.loglevel, loglevel);
/* initialize adapter list */ /* initialize adapter list */
INIT_LIST_HEAD(&zfcp_data.adapter_list_head); INIT_LIST_HEAD(&zfcp_data.adapter_list_head);
...@@ -263,8 +243,7 @@ zfcp_module_init(void) ...@@ -263,8 +243,7 @@ zfcp_module_init(void)
retval = misc_register(&zfcp_cfdc_misc); retval = misc_register(&zfcp_cfdc_misc);
if (retval != 0) { if (retval != 0) {
ZFCP_LOG_INFO("registration of misc device " pr_err("zfcp: registration of misc device zfcp_cfdc failed\n");
"zfcp_cfdc failed\n");
goto out_misc; goto out_misc;
} }
...@@ -277,7 +256,7 @@ zfcp_module_init(void) ...@@ -277,7 +256,7 @@ zfcp_module_init(void)
/* setup dynamic I/O */ /* setup dynamic I/O */
retval = zfcp_ccw_register(); retval = zfcp_ccw_register();
if (retval) { 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; goto out_ccw_register;
} }
...@@ -300,14 +279,10 @@ zfcp_module_init(void) ...@@ -300,14 +279,10 @@ zfcp_module_init(void)
return retval; return retval;
} }
#undef ZFCP_LOG_AREA
/****************************************************************/ /****************************************************************/
/****** Functions for configuration/set-up of structures ********/ /****** 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 * zfcp_get_unit_by_lun - find unit in unit list of port by FCP LUN
* @port: pointer to port to search for unit * @port: pointer to port to search for unit
...@@ -598,6 +573,8 @@ static void _zfcp_status_read_scheduler(struct work_struct *work) ...@@ -598,6 +573,8 @@ static void _zfcp_status_read_scheduler(struct work_struct *work)
* All adapter internal structures are set up. * All adapter internal structures are set up.
* Proc-fs entries are also created. * Proc-fs entries are also created.
* *
* FIXME: Use -ENOMEM as return code for allocation failures
*
* returns: 0 if a new adapter was successfully enqueued * returns: 0 if a new adapter was successfully enqueued
* ZFCP_KNOWN if an adapter with this devno was already present * ZFCP_KNOWN if an adapter with this devno was already present
* -ENOMEM if alloc failed * -ENOMEM if alloc failed
...@@ -615,11 +592,8 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) ...@@ -615,11 +592,8 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
/* try to allocate new adapter data structure (zeroed) */ /* try to allocate new adapter data structure (zeroed) */
adapter = kzalloc(sizeof (struct zfcp_adapter), GFP_KERNEL); adapter = kzalloc(sizeof (struct zfcp_adapter), GFP_KERNEL);
if (!adapter) { if (!adapter)
ZFCP_LOG_INFO("error: allocation of base adapter "
"structure failed\n");
goto out; goto out;
}
ccw_device->handler = NULL; ccw_device->handler = NULL;
...@@ -760,7 +734,6 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter) ...@@ -760,7 +734,6 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
zfcp_reqlist_free(adapter); zfcp_reqlist_free(adapter);
kfree(adapter->fc_stats); kfree(adapter->fc_stats);
kfree(adapter->stats_reset_data); kfree(adapter->stats_reset_data);
ZFCP_LOG_TRACE("freeing adapter structure\n");
kfree(adapter); kfree(adapter);
out: out:
return; return;
...@@ -908,12 +881,8 @@ zfcp_nameserver_enqueue(struct zfcp_adapter *adapter) ...@@ -908,12 +881,8 @@ zfcp_nameserver_enqueue(struct zfcp_adapter *adapter)
port = zfcp_port_enqueue(adapter, 0, ZFCP_STATUS_PORT_WKA, port = zfcp_port_enqueue(adapter, 0, ZFCP_STATUS_PORT_WKA,
ZFCP_DID_DIRECTORY_SERVICE); ZFCP_DID_DIRECTORY_SERVICE);
if (!port) { if (!port)
ZFCP_LOG_INFO("error: enqueue of nameserver port for "
"adapter %s failed\n",
zfcp_get_busid_by_adapter(adapter));
return -ENXIO; return -ENXIO;
}
zfcp_port_put(port); zfcp_port_put(port);
return 0; return 0;
...@@ -946,5 +915,3 @@ int zfcp_sg_setup_table(struct scatterlist *sg, int count) ...@@ -946,5 +915,3 @@ int zfcp_sg_setup_table(struct scatterlist *sg, int count)
} }
return 0; return 0;
} }
#undef ZFCP_LOG_AREA
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries.
* *
* (C) Copyright IBM Corp. 2002, 2006 * Debug traces for zfcp.
* *
* This program is free software; you can redistribute it and/or modify * Copyright IBM Corporation 2002, 2008
* 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 <linux/ctype.h> #include <linux/ctype.h>
...@@ -29,8 +16,6 @@ module_param(dbfsize, uint, 0400); ...@@ -29,8 +16,6 @@ module_param(dbfsize, uint, 0400);
MODULE_PARM_DESC(dbfsize, MODULE_PARM_DESC(dbfsize,
"number of pages for each debug feature area (default 4)"); "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, static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len,
int level, char *from, int from_len) int level, char *from, int from_len)
{ {
...@@ -515,13 +500,13 @@ static const char *zfcp_rec_dbf_ids[] = { ...@@ -515,13 +500,13 @@ static const char *zfcp_rec_dbf_ids[] = {
[52] = "port boxed close unit", [52] = "port boxed close unit",
[53] = "port boxed fcp", [53] = "port boxed fcp",
[54] = "unit boxed fcp", [54] = "unit boxed fcp",
[55] = "port access denied ct", [55] = "port access denied",
[56] = "port access denied els", [56] = "",
[57] = "port access denied open port", [57] = "",
[58] = "port access denied close physical", [58] = "",
[59] = "unit access denied open unit", [59] = "unit access denied",
[60] = "shared unit access denied open unit", [60] = "shared unit access denied open unit",
[61] = "unit access denied fcp", [61] = "",
[62] = "request timeout", [62] = "request timeout",
[63] = "adisc link test reject or timeout", [63] = "adisc link test reject or timeout",
[64] = "adisc link test d_id changed", [64] = "adisc link test d_id changed",
...@@ -586,8 +571,8 @@ static const char *zfcp_rec_dbf_ids[] = { ...@@ -586,8 +571,8 @@ static const char *zfcp_rec_dbf_ids[] = {
[120] = "unknown fsf command", [120] = "unknown fsf command",
[121] = "no recommendation for status qualifier", [121] = "no recommendation for status qualifier",
[122] = "status read physical port closed in error", [122] = "status read physical port closed in error",
[123] = "fc service class not supported ct", [123] = "fc service class not supported",
[124] = "fc service class not supported els", [124] = "",
[125] = "need newer zfcp", [125] = "need newer zfcp",
[126] = "need newer microcode", [126] = "need newer microcode",
[127] = "arbitrated loop not supported", [127] = "arbitrated loop not supported",
...@@ -595,7 +580,7 @@ static const char *zfcp_rec_dbf_ids[] = { ...@@ -595,7 +580,7 @@ static const char *zfcp_rec_dbf_ids[] = {
[129] = "qtcb size mismatch", [129] = "qtcb size mismatch",
[130] = "unknown fsf status ecd", [130] = "unknown fsf status ecd",
[131] = "fcp request too big", [131] = "fcp request too big",
[132] = "fc service class not supported fcp", [132] = "",
[133] = "data direction not valid fcp", [133] = "data direction not valid fcp",
[134] = "command length not valid fcp", [134] = "command length not valid fcp",
[135] = "status read act update", [135] = "status read act update",
...@@ -1291,5 +1276,3 @@ void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter) ...@@ -1291,5 +1276,3 @@ void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter)
adapter->hba_dbf = NULL; adapter->hba_dbf = NULL;
adapter->rec_dbf = NULL; adapter->rec_dbf = NULL;
} }
#undef ZFCP_LOG_AREA
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries.
* *
* (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 * Copyright IBM Corporation 2002, 2008
* 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.
*/ */
#ifndef ZFCP_DEF_H #ifndef ZFCP_DEF_H
...@@ -52,9 +39,6 @@ ...@@ -52,9 +39,6 @@
/********************* GENERAL DEFINES *********************************/ /********************* 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 * zfcp_sg_to_address - determine kernel address from struct scatterlist
* @list: struct scatterlist * @list: struct scatterlist
...@@ -308,107 +292,6 @@ struct zfcp_rc_entry { ...@@ -308,107 +292,6 @@ struct zfcp_rc_entry {
*/ */
#define ZFCP_CT_TIMEOUT (3 * R_A_TOV) #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 ******************/ /*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/
/* /*
...@@ -846,7 +729,6 @@ struct zfcp_data { ...@@ -846,7 +729,6 @@ struct zfcp_data {
char init_busid[BUS_ID_SIZE]; char init_busid[BUS_ID_SIZE];
wwn_t init_wwpn; wwn_t init_wwpn;
fcp_lun_t init_fcp_lun; fcp_lun_t init_fcp_lun;
char *driver_version;
struct kmem_cache *fsf_req_qtcb_cache; struct kmem_cache *fsf_req_qtcb_cache;
struct kmem_cache *sr_buffer_cache; struct kmem_cache *sr_buffer_cache;
struct kmem_cache *gid_pn_cache; struct kmem_cache *gid_pn_cache;
......
This diff is collapsed.
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries.
* *
* (C) Copyright IBM Corp. 2002, 2006 * External function declarations.
* *
* This program is free software; you can redistribute it and/or modify * Copyright IBM Corporation 2002, 2008
* 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.
*/ */
#ifndef ZFCP_EXT_H #ifndef ZFCP_EXT_H
...@@ -27,7 +14,6 @@ ...@@ -27,7 +14,6 @@
extern struct zfcp_data zfcp_data; extern struct zfcp_data zfcp_data;
/******************************** SYSFS *************************************/ /******************************** SYSFS *************************************/
extern struct attribute_group *zfcp_driver_attr_groups[];
extern int zfcp_sysfs_adapter_create_files(struct device *); extern int zfcp_sysfs_adapter_create_files(struct device *);
extern void zfcp_sysfs_adapter_remove_files(struct device *); extern void zfcp_sysfs_adapter_remove_files(struct device *);
extern int zfcp_sysfs_port_create_files(struct device *, u32); extern int zfcp_sysfs_port_create_files(struct device *, u32);
......
This diff is collapsed.
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries.
* *
* (C) Copyright IBM Corp. 2002, 2006 * Interface to the FSF support functions.
* *
* This program is free software; you can redistribute it and/or modify * Copyright IBM Corporation 2002, 2008
* 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.
*/ */
#ifndef FSF_H #ifndef FSF_H
...@@ -342,6 +329,7 @@ struct fsf_qual_latency_info { ...@@ -342,6 +329,7 @@ struct fsf_qual_latency_info {
} __attribute__ ((packed)); } __attribute__ ((packed));
union fsf_prot_status_qual { union fsf_prot_status_qual {
u32 word[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u32)];
u64 doubleword[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u64)]; u64 doubleword[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u64)];
struct fsf_qual_version_error version_error; struct fsf_qual_version_error version_error;
struct fsf_qual_sequence_error sequence_error; struct fsf_qual_sequence_error sequence_error;
......
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries.
* *
* (C) Copyright IBM Corp. 2002, 2006 * Interface to Linux SCSI midlayer.
* *
* This program is free software; you can redistribute it and/or modify * Copyright IBM Corporation 2002, 2008
* 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.
*/ */
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_SCSI
#include "zfcp_ext.h" #include "zfcp_ext.h"
#include <asm/atomic.h> #include <asm/atomic.h>
...@@ -44,7 +29,7 @@ static struct device_attribute *zfcp_a_stats_attrs[]; ...@@ -44,7 +29,7 @@ static struct device_attribute *zfcp_a_stats_attrs[];
struct zfcp_data zfcp_data = { struct zfcp_data zfcp_data = {
.scsi_host_template = { .scsi_host_template = {
.name = ZFCP_NAME, .name = "zfcp",
.module = THIS_MODULE, .module = THIS_MODULE,
.proc_name = "zfcp", .proc_name = "zfcp",
.slave_alloc = zfcp_scsi_slave_alloc, .slave_alloc = zfcp_scsi_slave_alloc,
...@@ -64,7 +49,6 @@ struct zfcp_data zfcp_data = { ...@@ -64,7 +49,6 @@ struct zfcp_data zfcp_data = {
.max_sectors = ZFCP_MAX_SECTORS, .max_sectors = ZFCP_MAX_SECTORS,
.shost_attrs = zfcp_a_stats_attrs, .shost_attrs = zfcp_a_stats_attrs,
}, },
.driver_version = ZFCP_VERSION,
}; };
/* Find start of Response Information in FCP response unit*/ /* Find start of Response Information in FCP response unit*/
...@@ -181,16 +165,14 @@ zfcp_scsi_slave_alloc(struct scsi_device *sdp) ...@@ -181,16 +165,14 @@ zfcp_scsi_slave_alloc(struct scsi_device *sdp)
static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt) static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
{ {
struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata; struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata;
WARN_ON(!unit);
if (unit) { if (unit) {
atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status); atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status);
sdpnt->hostdata = NULL; sdpnt->hostdata = NULL;
unit->device = NULL; unit->device = NULL;
zfcp_erp_unit_failed(unit, 12, NULL); zfcp_erp_unit_failed(unit, 12, NULL);
zfcp_unit_put(unit); 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, ...@@ -253,10 +235,6 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit,
if (unlikely( if (unlikely(
atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status) || atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status) ||
!atomic_test_mask(ZFCP_STATUS_COMMON_RUNNING, &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); zfcp_scsi_command_fail(scpnt, DID_ERROR);
goto out; goto out;
} }
...@@ -264,18 +242,12 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit, ...@@ -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, tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, use_timer,
ZFCP_REQ_AUTO_CLEANUP); ZFCP_REQ_AUTO_CLEANUP);
if (unlikely(tmp == -EBUSY)) { 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); zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
goto out; goto out;
} }
if (unlikely(tmp < 0)) { if (unlikely(tmp < 0))
ZFCP_LOG_DEBUG("error: initiation of Send FCP Cmnd failed\n");
retval = SCSI_MLQUEUE_HOST_BUSY; retval = SCSI_MLQUEUE_HOST_BUSY;
}
out: out:
return retval; return retval;
...@@ -394,9 +366,6 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt) ...@@ -394,9 +366,6 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
adapter = (struct zfcp_adapter *) scsi_host->hostdata[0]; adapter = (struct zfcp_adapter *) scsi_host->hostdata[0];
unit = (struct zfcp_unit *) scpnt->device->hostdata; 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 */ /* avoid race condition between late normal completion and abort */
write_lock_irqsave(&adapter->abort_lock, flags); write_lock_irqsave(&adapter->abort_lock, flags);
...@@ -420,7 +389,6 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt) ...@@ -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); fsf_req = zfcp_fsf_abort_fcp_command(old_req_id, adapter, unit, 0);
if (!fsf_req) { if (!fsf_req) {
ZFCP_LOG_INFO("error: initiation of Abort FCP Cmnd failed\n");
zfcp_scsi_dbf_event_abort("nres", adapter, scpnt, NULL, zfcp_scsi_dbf_event_abort("nres", adapter, scpnt, NULL,
old_req_id); old_req_id);
retval = FAILED; retval = FAILED;
...@@ -485,10 +453,6 @@ zfcp_task_management_function(struct zfcp_unit *unit, u8 tm_flags, ...@@ -485,10 +453,6 @@ zfcp_task_management_function(struct zfcp_unit *unit, u8 tm_flags,
fsf_req = zfcp_fsf_send_fcp_command_task_management fsf_req = zfcp_fsf_send_fcp_command_task_management
(adapter, unit, tm_flags, 0); (adapter, unit, tm_flags, 0);
if (!fsf_req) { 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); zfcp_scsi_dbf_event_devreset("nres", tm_flags, unit, scpnt);
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
...@@ -524,12 +488,6 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt) ...@@ -524,12 +488,6 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
unit = (struct zfcp_unit*) scpnt->device->hostdata; unit = (struct zfcp_unit*) scpnt->device->hostdata;
adapter = unit->port->adapter; 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_adapter_reopen(adapter, 0, 141, scpnt);
zfcp_erp_wait(adapter); zfcp_erp_wait(adapter);
...@@ -549,13 +507,11 @@ zfcp_adapter_scsi_register(struct zfcp_adapter *adapter) ...@@ -549,13 +507,11 @@ zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template, adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template,
sizeof (struct zfcp_adapter *)); sizeof (struct zfcp_adapter *));
if (!adapter->scsi_host) { if (!adapter->scsi_host) {
ZFCP_LOG_NORMAL("error: registration with SCSI stack failed " dev_err(&adapter->ccw_device->dev,
"for adapter %s ", "registration with SCSI stack failed.");
zfcp_get_busid_by_adapter(adapter));
retval = -EIO; retval = -EIO;
goto out; goto out;
} }
ZFCP_LOG_DEBUG("host registered, scsi_host=%p\n", adapter->scsi_host);
/* tell the SCSI stack some characteristics of this adapter */ /* tell the SCSI stack some characteristics of this adapter */
adapter->scsi_host->max_id = 1; adapter->scsi_host->max_id = 1;
...@@ -987,5 +943,3 @@ static struct device_attribute *zfcp_a_stats_attrs[] = { ...@@ -987,5 +943,3 @@ static struct device_attribute *zfcp_a_stats_attrs[] = {
&dev_attr_seconds_active, &dev_attr_seconds_active,
NULL NULL
}; };
#undef ZFCP_LOG_AREA
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries.
* *
* (C) Copyright IBM Corp. 2002, 2006 * sysfs attributes for CCW device.
* *
* This program is free software; you can redistribute it and/or modify * Copyright IBM Corporation 2002, 2008
* 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" #include "zfcp_ext.h"
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
/** /**
* ZFCP_DEFINE_ADAPTER_ATTR * ZFCP_DEFINE_ADAPTER_ATTR
* @_name: name of show attribute * @_name: name of show attribute
...@@ -266,5 +251,3 @@ zfcp_sysfs_adapter_remove_files(struct device *dev) ...@@ -266,5 +251,3 @@ zfcp_sysfs_adapter_remove_files(struct device *dev)
{ {
sysfs_remove_group(&dev->kobj, &zfcp_adapter_attr_group); sysfs_remove_group(&dev->kobj, &zfcp_adapter_attr_group);
} }
#undef ZFCP_LOG_AREA
/*
* 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
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries.
* *
* (C) Copyright IBM Corp. 2002, 2006 * sysfs attributes for zfcp port.
* *
* This program is free software; you can redistribute it and/or modify * Copyright IBM Corporation 2002, 2008
* 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" #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 * zfcp_sysfs_port_release - gets called when a struct device port is released
* @dev: pointer to belonging device * @dev: pointer to belonging device
...@@ -291,5 +276,3 @@ zfcp_sysfs_port_remove_files(struct device *dev, u32 flags) ...@@ -291,5 +276,3 @@ zfcp_sysfs_port_remove_files(struct device *dev, u32 flags)
if (!(flags & ZFCP_STATUS_PORT_WKA)) if (!(flags & ZFCP_STATUS_PORT_WKA))
sysfs_remove_group(&dev->kobj, &zfcp_port_no_ns_attr_group); sysfs_remove_group(&dev->kobj, &zfcp_port_no_ns_attr_group);
} }
#undef ZFCP_LOG_AREA
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries.
* *
* (C) Copyright IBM Corp. 2002, 2006 * sysfs interface for zfcp unit.
* *
* This program is free software; you can redistribute it and/or modify * Copyright IBM Corporation 2002, 2008
* 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" #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 * zfcp_sysfs_unit_release - gets called when a struct device unit is released
* @dev: pointer to belonging device * @dev: pointer to belonging device
...@@ -163,5 +148,3 @@ zfcp_sysfs_unit_remove_files(struct device *dev) ...@@ -163,5 +148,3 @@ zfcp_sysfs_unit_remove_files(struct device *dev)
{ {
sysfs_remove_group(&dev->kobj, &zfcp_unit_attr_group); sysfs_remove_group(&dev->kobj, &zfcp_unit_attr_group);
} }
#undef ZFCP_LOG_AREA
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