Commit 6da0044c authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Linus Torvalds

[PATCH] s390: zfcp host adapater

zfcp host adapater changes:
 - Add ability to enqueue other WKA ports besides the nameserver port.
 - Document and cleanup sg_list functions.
 - Add get_port_by_did/get_adapater_by_busid functions.
 - Improve documentation of some functions and structures.
 - Fix error handling for nameserver requests.
 - Correct size check in zfcp_sg_list_copy_to_user.
 - Correct parameter description for loglevel parameter.
 - Remove unsused code, types and definitions.
 - Add support for exchange_port_data command.
 - Add infrastructure to set timers for ELS and SCSI commands.
 - Avoid adapter shutdown after receiving FSF_SQ_ULP_PROGRAMMING_ERROR.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ce1cd4f3
This diff is collapsed.
......@@ -33,7 +33,7 @@
#define ZFCP_DEF_H
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_DEF_REVISION "$Revision: 1.83 $"
#define ZFCP_DEF_REVISION "$Revision: 1.91 $"
/*************************** INCLUDES *****************************************/
......@@ -43,6 +43,7 @@
#include <linux/major.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <scsi/scsi.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_cmnd.h>
......@@ -72,12 +73,22 @@
/* zfcp version number, it consists of major, minor, and patch-level number */
#define ZFCP_VERSION "4.1.3"
/**
* zfcp_sg_to_address - determine kernel address from struct scatterlist
* @list: struct scatterlist
* Return: kernel address
*/
static inline void *
zfcp_sg_to_address(struct scatterlist *list)
{
return (void *) (page_address(list->page) + list->offset);
}
/**
* zfcp_address_to_sg - set up struct scatterlist from kernel address
* @address: kernel address
* @list: struct scatterlist
*/
static inline void
zfcp_address_to_sg(void *address, struct scatterlist *list)
{
......@@ -146,6 +157,9 @@ typedef u32 scsi_lun_t;
#define ZFCP_EXCHANGE_CONFIG_DATA_RETRIES 6
#define ZFCP_EXCHANGE_CONFIG_DATA_SLEEP 50
/* timeout value for "default timer" for fsf requests */
#define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ);
/*************** FIBRE CHANNEL PROTOCOL SPECIFIC DEFINES ********************/
typedef unsigned long long wwn_t;
......@@ -158,7 +172,6 @@ typedef unsigned int fcp_dl_t;
/* timeout for name-server lookup (in seconds) */
#define ZFCP_NS_GID_PN_TIMEOUT 10
#define ZFCP_NS_GA_NXT_TIMEOUT 120
/* largest SCSI command we can process */
/* FCP-2 (FCP_CMND IU) allows up to (255-3+16) */
......@@ -276,26 +289,12 @@ struct fcp_logo {
#define R_A_TOV 10 /* seconds */
#define ZFCP_ELS_TIMEOUT (2 * R_A_TOV)
#define ZFCP_LS_RJT 0x01
#define ZFCP_LS_ACC 0x02
#define ZFCP_LS_RTV 0x0E
#define ZFCP_LS_RLS 0x0F
#define ZFCP_LS_PDISC 0x50
#define ZFCP_LS_ADISC 0x52
#define ZFCP_LS_RSCN 0x61
#define ZFCP_LS_RNID 0x78
#define ZFCP_LS_RLIR 0x7A
#define ZFCP_LS_RTV_E_D_TOV_FLAG 0x04000000
/* LS_ACC Reason Codes */
#define ZFCP_LS_RJT_INVALID_COMMAND_CODE 0x01
#define ZFCP_LS_RJT_LOGICAL_ERROR 0x03
#define ZFCP_LS_RJT_LOGICAL_BUSY 0x05
#define ZFCP_LS_RJT_PROTOCOL_ERROR 0x07
#define ZFCP_LS_RJT_UNABLE_TO_PERFORM 0x09
#define ZFCP_LS_RJT_COMMAND_NOT_SUPPORTED 0x0B
#define ZFCP_LS_RJT_VENDOR_UNIQUE_ERROR 0xFF
struct zfcp_ls_rjt_par {
u8 action;
u8 reason_code;
......@@ -381,46 +380,6 @@ struct zfcp_ls_adisc_acc {
fc_id_t nport_id;
} __attribute__ ((packed));
struct zfcp_ls_rnid {
u8 code;
u8 field[3];
u8 node_id_format;
u8 reserved[3];
} __attribute__((packed));
/* common identification data */
struct zfcp_ls_rnid_common_id {
u64 n_port_name;
u64 node_name;
} __attribute__((packed));
/* general topology specific identification data */
struct zfcp_ls_rnid_general_topology_id {
u8 vendor_unique[16];
u32 associated_type;
u32 physical_port_number;
u32 nr_attached_nodes;
u8 node_management;
u8 ip_version;
u16 port_number;
u8 ip_address[16];
u8 reserved[2];
u16 vendor_specific;
} __attribute__((packed));
struct zfcp_ls_rnid_acc {
u8 code;
u8 field[3];
u8 node_id_format;
u8 common_id_length;
u8 reserved;
u8 specific_id_length;
struct zfcp_ls_rnid_common_id
common_id;
struct zfcp_ls_rnid_general_topology_id
specific_id;
} __attribute__((packed));
struct zfcp_rc_entry {
u8 code;
const char *description;
......@@ -533,23 +492,29 @@ struct zfcp_rc_entry {
__LINE__ , ##args);
#define ZFCP_LOG(level, fmt, args...) \
do { \
if (ZFCP_LOG_CHECK(level)) \
_ZFCP_LOG(fmt , ##args)
_ZFCP_LOG(fmt, ##args); \
} while (0)
#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_NORMAL
# define ZFCP_LOG_NORMAL(fmt, args...)
#else
# define ZFCP_LOG_NORMAL(fmt, args...) \
do { \
if (ZFCP_LOG_CHECK(ZFCP_LOG_LEVEL_NORMAL)) \
printk(KERN_ERR ZFCP_NAME": " fmt , ##args);
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...)
#else
# define ZFCP_LOG_INFO(fmt, args...) \
do { \
if (ZFCP_LOG_CHECK(ZFCP_LOG_LEVEL_INFO)) \
printk(KERN_ERR ZFCP_NAME": " fmt , ##args);
printk(KERN_ERR ZFCP_NAME": " fmt, ##args); \
} while (0)
#endif
#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_DEBUG
......@@ -571,8 +536,10 @@ struct zfcp_rc_entry {
#else
extern u32 flags_dump;
# define ZFCP_LOG_FLAGS(level, fmt, args...) \
do { \
if (level <= flags_dump) \
_ZFCP_LOG(fmt , ##args)
_ZFCP_LOG(fmt, ##args); \
} while (0)
#endif
/*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/
......@@ -609,7 +576,12 @@ extern u32 flags_dump;
ZFCP_STATUS_ADAPTER_REGISTERED)
#define ZFCP_DID_NAMESERVER 0xFFFFFC
/* FC-PH/FC-GS well-known address identifiers for generic services */
#define ZFCP_DID_MANAGEMENT_SERVICE 0xFFFFFA
#define ZFCP_DID_TIME_SERVICE 0xFFFFFB
#define ZFCP_DID_DIRECTORY_SERVICE 0xFFFFFC
#define ZFCP_DID_ALIAS_SERVICE 0xFFFFF8
#define ZFCP_DID_KEY_DISTRIBUTION_SERVICE 0xFFFFF7
/* remote port status */
#define ZFCP_STATUS_PORT_PHYS_OPEN 0x00000001
......@@ -619,7 +591,8 @@ extern u32 flags_dump;
#define ZFCP_STATUS_PORT_NO_SCSI_ID 0x00000010
#define ZFCP_STATUS_PORT_INVALID_WWPN 0x00000020
#define ZFCP_STATUS_PORT_NAMESERVER \
/* for ports with well known addresses */
#define ZFCP_STATUS_PORT_WKA \
(ZFCP_STATUS_PORT_NO_WWPN | \
ZFCP_STATUS_PORT_NO_SCSI_ID)
......@@ -792,43 +765,29 @@ struct ct_iu_gid_pn_req {
wwn_t wwpn;
} __attribute__ ((packed));
/* nameserver request CT_IU -- for requests where
* a port identifier is required */
struct ct_iu_ga_nxt_req {
struct ct_hdr header;
fc_id_t d_id;
} __attribute__ ((packed));
/* FS_ACC IU and data unit for GID_PN nameserver request */
struct ct_iu_gid_pn_resp {
struct ct_hdr header;
fc_id_t d_id;
} __attribute__ ((packed));
/* FS_ACC IU and data unit for GA_NXT nameserver request */
struct ct_iu_ga_nxt_resp {
struct ct_hdr header;
u8 port_type;
u8 port_id[3];
u64 port_wwn;
u8 port_symbolic_name_length;
u8 port_symbolic_name[255];
u64 node_wwn;
u8 node_symbolic_name_length;
u8 node_symbolic_name[255];
u64 initial_process_associator;
u8 node_ip[16];
u32 cos;
u8 fc4_types[32];
u8 port_ip[16];
u64 fabric_wwn;
u8 reserved;
u8 hard_address[3];
} __attribute__ ((packed));
typedef void (*zfcp_send_ct_handler_t)(unsigned long);
/* used to pass parameters to zfcp_send_ct() */
/**
* struct zfcp_send_ct - used to pass parameters to function zfcp_fsf_send_ct
* @port: port where the request is sent to
* @req: scatter-gather list for request
* @resp: scatter-gather list for response
* @req_count: number of elements in request scatter-gather list
* @resp_count: number of elements in response scatter-gather list
* @handler: handler function (called for response to the request)
* @handler_data: data passed to handler function
* @pool: pointer to memory pool for ct request structure
* @timeout: FSF timeout for this request
* @timer: timer (e.g. for request initiated by erp)
* @completion: completion for synchronization purposes
* @status: used to pass error status to calling function
*/
struct zfcp_send_ct {
struct zfcp_port *port;
struct scatterlist *req;
......@@ -837,7 +796,7 @@ struct zfcp_send_ct {
unsigned int resp_count;
zfcp_send_ct_handler_t handler;
unsigned long handler_data;
mempool_t *pool; /* mempool for ct not for fsf_req */
mempool_t *pool;
int timeout;
struct timer_list *timer;
struct completion *completion;
......@@ -856,8 +815,20 @@ struct zfcp_gid_pn_data {
typedef void (*zfcp_send_els_handler_t)(unsigned long);
/* used to pass parameters to zfcp_send_els() */
/* ToDo merge send_ct() and send_els() and corresponding structs */
/**
* struct zfcp_send_els - used to pass parameters to function zfcp_fsf_send_els
* @port: port where the request is sent to
* @req: scatter-gather list for request
* @resp: scatter-gather list for response
* @req_count: number of elements in request scatter-gather list
* @resp_count: number of elements in response scatter-gather list
* @handler: handler function (called for response to the request)
* @handler_data: data passed to handler function
* @timer: timer (e.g. for request initiated by erp)
* @completion: completion for synchronization purposes
* @ls_code: hex code of ELS command
* @status: used to pass error status to calling function
*/
struct zfcp_send_els {
struct zfcp_port *port;
struct scatterlist *req;
......@@ -866,6 +837,7 @@ struct zfcp_send_els {
unsigned int resp_count;
zfcp_send_els_handler_t handler;
unsigned long handler_data;
struct timer_list *timer;
struct completion *completion;
int ls_code;
int status;
......@@ -895,6 +867,7 @@ union zfcp_req_data {
struct zfcp_send_ct *send_ct;
struct zfcp_send_els *send_els;
struct zfcp_status_read status_read;
struct fsf_qtcb_bottom_port *port_data;
};
struct zfcp_qdio_queue {
......@@ -982,6 +955,7 @@ struct zfcp_adapter {
rwlock_t cmd_dbf_lock;
struct zfcp_adapter_mempool pool; /* Adapter memory pools */
struct qdio_initialize qdio_init_data; /* for qdio_establish */
struct device generic_services; /* directory for WKA ports */
};
/*
......@@ -1083,6 +1057,11 @@ struct zfcp_data {
fcp_lun_t init_fcp_lun;
};
/**
* struct zfcp_sg_list - struct describing a scatter-gather list
* @sg: pointer to array of (struct scatterlist)
* @count: number of elements in scatter-gather list
*/
struct zfcp_sg_list {
struct scatterlist *sg;
unsigned int count;
......
......@@ -31,7 +31,7 @@
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_ERP_REVISION "$Revision: 1.62 $"
#define ZFCP_ERP_REVISION "$Revision: 1.65 $"
#include "zfcp_ext.h"
......@@ -126,6 +126,25 @@ static void zfcp_erp_memwait_handler(unsigned long);
static void zfcp_erp_timeout_handler(unsigned long);
static inline void zfcp_erp_timeout_init(struct zfcp_erp_action *);
/**
* zfcp_fsf_request_timeout_handler - called if a request timed out
* @data: pointer to adapter for handler function
*
* This function needs to be called if requests (ELS, Generic Service,
* or SCSI commands) exceed a certain time limit. The assumption is
* that after the time limit the adapter get stuck. So we trigger a reopen of
* the adapter. This should not be used for error recovery, SCSI abort
* commands and SCSI requests from SCSI mid-layer.
*/
void
zfcp_fsf_request_timeout_handler(unsigned long data)
{
struct zfcp_adapter *adapter;
adapter = (struct zfcp_adapter *) data;
zfcp_erp_adapter_reopen(adapter, 0);
}
/*
* function: zfcp_fsf_scsi_er_timeout_handler
......@@ -650,14 +669,15 @@ zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask)
return retval;
}
/*
* function:
*
* purpose: Wrappper for zfcp_erp_port_reopen_internal
* used to ensure the correct locking
/**
* zfcp_erp_port_reopen - initiate reopen of a remote port
* @port: port to be reopened
* @clear_mask: specifies flags in port status to be cleared
* Return: 0 on success, < 0 on error
*
* returns: 0 - initiated action succesfully
* <0 - failed to initiate action
* This is a wrappper function for zfcp_erp_port_reopen_internal. It ensures
* correct locking. An error recovery task is initiated to do the reopen.
* To wait for the completion of the reopen zfcp_erp_wait should be used.
*/
int
zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask)
......@@ -717,14 +737,15 @@ zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask)
return retval;
}
/*
* function:
*
* purpose: Wrappper for zfcp_erp_unit_reopen_internal
* used to ensure the correct locking
/**
* zfcp_erp_unit_reopen - initiate reopen of a unit
* @unit: unit to be reopened
* @clear_mask: specifies flags in unit status to be cleared
* Return: 0 on success, < 0 on error
*
* returns: 0 - initiated action succesfully
* <0 - failed to initiate action
* This is a wrappper for zfcp_erp_unit_reopen_internal. It ensures correct
* locking. An error recovery task is initiated to do the reopen.
* To wait for the completion of the reopen zfcp_erp_wait should be used.
*/
int
zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask)
......@@ -1902,12 +1923,10 @@ zfcp_erp_strategy_check_queues(struct zfcp_adapter *adapter)
return retval;
}
/*
* function:
*
* purpose:
*
* returns:
/**
* zfcp_erp_wait - wait for completion of error recovery on an adapter
* @adapter: adapter for which to wait for completion of its error recovery
* Return: 0
*/
int
zfcp_erp_wait(struct zfcp_adapter *adapter)
......@@ -2045,7 +2064,7 @@ zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter, int clear_mask)
struct zfcp_port *port;
list_for_each_entry(port, &adapter->port_list_head, list)
if (!atomic_test_mask(ZFCP_STATUS_PORT_NAMESERVER, &port->status))
if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
zfcp_erp_port_reopen_internal(port, clear_mask);
return retval;
......@@ -2640,7 +2659,7 @@ zfcp_erp_port_strategy_open(struct zfcp_erp_action *erp_action)
{
int retval;
if (atomic_test_mask(ZFCP_STATUS_PORT_NAMESERVER,
if (atomic_test_mask(ZFCP_STATUS_PORT_WKA,
&erp_action->port->status))
retval = zfcp_erp_port_strategy_open_nameserver(erp_action);
else
......@@ -2778,10 +2797,10 @@ zfcp_erp_port_strategy_open_nameserver(struct zfcp_erp_action *erp_action)
case ZFCP_ERP_STEP_PORT_OPENING:
if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) {
ZFCP_LOG_DEBUG("nameserver port is open\n");
ZFCP_LOG_DEBUG("WKA port is open\n");
retval = ZFCP_ERP_SUCCEEDED;
} else {
ZFCP_LOG_DEBUG("open failed for nameserver port\n");
ZFCP_LOG_DEBUG("open failed for WKA port\n");
retval = ZFCP_ERP_FAILED;
}
/* this is needed anyway (dont care for retval of wakeup) */
......
......@@ -31,7 +31,7 @@
#ifndef ZFCP_EXT_H
#define ZFCP_EXT_H
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_EXT_REVISION "$Revision: 1.53 $"
#define ZFCP_EXT_REVISION "$Revision: 1.57 $"
#include "zfcp_def.h"
......@@ -50,15 +50,16 @@ extern void zfcp_sysfs_port_release(struct device *);
extern void zfcp_sysfs_unit_release(struct device *);
/**************************** CONFIGURATION *********************************/
extern struct zfcp_unit *zfcp_get_unit_by_lun(struct zfcp_port *,
fcp_lun_t fcp_lun);
extern struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *,
wwn_t wwpn);
extern struct zfcp_unit *zfcp_get_unit_by_lun(struct zfcp_port *, fcp_lun_t);
extern struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *, wwn_t);
extern struct zfcp_port *zfcp_get_port_by_did(struct zfcp_adapter *, u32);
struct zfcp_adapter *zfcp_get_adapter_by_busid(char *);
extern struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *);
extern int zfcp_adapter_debug_register(struct zfcp_adapter *);
extern void zfcp_adapter_dequeue(struct zfcp_adapter *);
extern void zfcp_adapter_debug_unregister(struct zfcp_adapter *);
extern struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *, wwn_t, u32);
extern struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *, wwn_t,
u32, u32);
extern void zfcp_port_dequeue(struct zfcp_port *);
extern struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *, fcp_lun_t);
extern void zfcp_unit_dequeue(struct zfcp_unit *);
......@@ -94,8 +95,11 @@ extern int zfcp_fsf_open_unit(struct zfcp_erp_action *);
extern int zfcp_fsf_close_unit(struct zfcp_erp_action *);
extern int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *);
extern int zfcp_fsf_exchange_port_data(struct zfcp_adapter *,
struct fsf_qtcb_bottom_port *);
extern int zfcp_fsf_control_file(struct zfcp_adapter *, struct zfcp_fsf_req **,
u32, u32, struct zfcp_sg_list *);
extern void zfcp_fsf_request_timeout_handler(unsigned long);
extern void zfcp_fsf_scsi_er_timeout_handler(unsigned long);
extern int zfcp_fsf_req_dismiss_all(struct zfcp_adapter *);
extern int zfcp_fsf_status_read(struct zfcp_adapter *, int);
......@@ -108,7 +112,7 @@ extern int zfcp_fsf_req_wait_and_cleanup(struct zfcp_fsf_req *, int, u32 *);
extern int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *,
struct zfcp_unit *,
struct scsi_cmnd *,
int);
struct timer_list*, int);
extern int zfcp_fsf_req_complete(struct zfcp_fsf_req *);
extern void zfcp_fsf_incoming_els(struct zfcp_fsf_req *);
extern void zfcp_fsf_req_cleanup(struct zfcp_fsf_req *);
......@@ -134,10 +138,10 @@ extern char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *);
extern void zfcp_fsf_start_scsi_er_timer(struct zfcp_adapter *);
extern fcp_dl_t zfcp_get_fcp_dl(struct fcp_cmnd_iu *);
extern int zfcp_scsi_command_async(struct zfcp_adapter *,struct zfcp_unit *unit,
struct scsi_cmnd *scsi_cmnd);
extern int zfcp_scsi_command_sync(struct zfcp_unit *unit,
struct scsi_cmnd *scsi_cmnd);
extern int zfcp_scsi_command_async(struct zfcp_adapter *,struct zfcp_unit *,
struct scsi_cmnd *, struct timer_list *);
extern int zfcp_scsi_command_sync(struct zfcp_unit *, struct scsi_cmnd *,
struct timer_list *);
extern struct scsi_transport_template *zfcp_transport_template;
extern struct fc_function_template zfcp_transport_functions;
......
This diff is collapsed.
......@@ -84,19 +84,12 @@
#define FSF_SERVICE_CLASS_NOT_SUPPORTED 0x00000006
#define FSF_FCPLUN_NOT_VALID 0x00000009
#define FSF_ACCESS_DENIED 0x00000010
#define FSF_ACCESS_TYPE_NOT_VALID 0x00000011
#define FSF_LUN_SHARING_VIOLATION 0x00000012
#define FSF_COMMAND_ABORTED_ULP 0x00000020
#define FSF_COMMAND_ABORTED_ADAPTER 0x00000021
#define FSF_FCP_COMMAND_DOES_NOT_EXIST 0x00000022
#define FSF_DIRECTION_INDICATOR_NOT_VALID 0x00000030
#define FSF_INBOUND_DATA_LENGTH_NOT_VALID 0x00000031 /* FIX: obsolete? */
#define FSF_OUTBOUND_DATA_LENGTH_NOT_VALID 0x00000032 /* FIX: obsolete? */
#define FSF_CMND_LENGTH_NOT_VALID 0x00000033
#define FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED 0x00000040
#define FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED 0x00000041
#define FSF_REQUEST_BUF_NOT_VALID 0x00000042
#define FSF_RESPONSE_BUF_NOT_VALID 0x00000043
#define FSF_ELS_COMMAND_REJECTED 0x00000050
#define FSF_GENERIC_COMMAND_REJECTED 0x00000051
#define FSF_OPERATION_PARTIALLY_SUCCESSFUL 0x00000052
......
......@@ -31,7 +31,7 @@
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_SCSI
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_SCSI_REVISION "$Revision: 1.66 $"
#define ZFCP_SCSI_REVISION "$Revision: 1.68 $"
#include "zfcp_ext.h"
......@@ -247,15 +247,16 @@ zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
/**
* zfcp_scsi_command_async - worker for zfcp_scsi_queuecommand and
* zfcp_scsi_command_sync
* @adapter: adapter for where scsi command is issued
* @adapter: adapter where scsi command is issued
* @unit: unit to which scsi command is sent
* @scpnt: scsi command to be sent
* @timer: timer to be started if request is successfully initiated
*
* Note: In scsi_done function must be set in scpnt.
*/
int
zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit,
struct scsi_cmnd *scpnt)
struct scsi_cmnd *scpnt, struct timer_list *timer)
{
int tmp;
int retval;
......@@ -291,7 +292,7 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit,
goto out;
}
tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt,
tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, timer,
ZFCP_REQ_AUTO_CLEANUP);
if (unlikely(tmp < 0)) {
......@@ -313,18 +314,28 @@ zfcp_scsi_command_sync_handler(struct scsi_cmnd *scpnt)
/**
* zfcp_scsi_command_sync - send a SCSI command and wait for completion
* returns 0, errors are indicated by scsi_cmnd->result
* @unit: unit where command is sent to
* @scpnt: scsi command to be sent
* @timer: timer to be started if request is successfully initiated
* Return: 0
*
* Errors are indicated in scpnt->result
*/
int
zfcp_scsi_command_sync(struct zfcp_unit *unit, struct scsi_cmnd *scpnt)
zfcp_scsi_command_sync(struct zfcp_unit *unit, struct scsi_cmnd *scpnt,
struct timer_list *timer)
{
int ret;
DECLARE_COMPLETION(wait);
scpnt->SCp.ptr = (void *) &wait; /* silent re-use */
scpnt->done = zfcp_scsi_command_sync_handler;
zfcp_scsi_command_async(unit->port->adapter, unit, scpnt);
scpnt->scsi_done = zfcp_scsi_command_sync_handler;
ret = zfcp_scsi_command_async(unit->port->adapter, unit, scpnt, timer);
if ((ret == 0) && (scpnt->result == 0))
wait_for_completion(&wait);
scpnt->SCp.ptr = NULL;
return 0;
}
......@@ -355,7 +366,7 @@ zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt,
adapter = (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
unit = (struct zfcp_unit *) scpnt->device->hostdata;
return zfcp_scsi_command_async(adapter, unit, scpnt);
return zfcp_scsi_command_async(adapter, unit, scpnt, NULL);
}
/*
......
......@@ -26,7 +26,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.36 $"
#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.37 $"
#include "zfcp_ext.h"
......@@ -106,7 +106,7 @@ zfcp_sysfs_port_add_store(struct device *dev, const char *buf, size_t count)
if ((endp + 1) < (buf + count))
goto out;
port = zfcp_port_enqueue(adapter, wwpn, 0);
port = zfcp_port_enqueue(adapter, wwpn, 0, 0);
if (!port)
goto out;
......
......@@ -26,7 +26,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.43 $"
#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.44 $"
#include "zfcp_ext.h"
......@@ -279,7 +279,7 @@ zfcp_sysfs_port_create_files(struct device *dev, u32 flags)
retval = sysfs_create_group(&dev->kobj, &zfcp_port_common_attr_group);
if ((flags & ZFCP_STATUS_PORT_NAMESERVER) || retval)
if ((flags & ZFCP_STATUS_PORT_WKA) || retval)
return retval;
retval = sysfs_create_group(&dev->kobj, &zfcp_port_no_ns_attr_group);
......@@ -299,7 +299,7 @@ void
zfcp_sysfs_port_remove_files(struct device *dev, u32 flags)
{
sysfs_remove_group(&dev->kobj, &zfcp_port_common_attr_group);
if (!(flags & ZFCP_STATUS_PORT_NAMESERVER))
if (!(flags & ZFCP_STATUS_PORT_WKA))
sysfs_remove_group(&dev->kobj, &zfcp_port_no_ns_attr_group);
}
......
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