Skip to content

Commit

Permalink
[SCSI] zfcp: zfcp_fsf cleanup.
Browse files Browse the repository at this point in the history
Code cleanup for the zfcp_fsf.c file.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
Swen Schillig authored and James Bottomley committed Jul 12, 2008
1 parent 6022192 commit c41f8cb
Show file tree
Hide file tree
Showing 9 changed files with 1,585 additions and 2,652 deletions.
4 changes: 2 additions & 2 deletions drivers/s390/scsi/zfcp_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static void zfcp_dummy_release(struct device *dev)
int zfcp_status_read_refill(struct zfcp_adapter *adapter)
{
while (atomic_read(&adapter->stat_miss) > 0)
if (zfcp_fsf_status_read(adapter, ZFCP_WAIT_FOR_SBAL)) {
if (zfcp_fsf_status_read(adapter)) {
if (atomic_read(&adapter->stat_miss) >= 16) {
zfcp_erp_adapter_reopen(adapter, 0, 103, NULL);
return 1;
Expand Down Expand Up @@ -518,10 +518,10 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
spin_lock_init(&adapter->san_dbf_lock);
spin_lock_init(&adapter->scsi_dbf_lock);
spin_lock_init(&adapter->rec_dbf_lock);
spin_lock_init(&adapter->req_q.lock);

rwlock_init(&adapter->erp_lock);
rwlock_init(&adapter->abort_lock);
rwlock_init(&adapter->req_q.lock);

sema_init(&adapter->erp_ready_sem, 0);

Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/scsi/zfcp_dbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *fsf_req)

zfcp_san_dbf_event_els("iels", 1, fsf_req, buf->d_id,
fc_host_port_id(adapter->scsi_host),
*(u8 *)buf->payload, (void *)buf->payload,
buf->payload.data[0], (void *)buf->payload.data,
length);
}

Expand Down
31 changes: 4 additions & 27 deletions drivers/s390/scsi/zfcp_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ zfcp_address_to_sg(void *address, struct scatterlist *list, unsigned int size)
#define ZFCP_DEVICE_MODEL 0x03
#define ZFCP_DEVICE_MODEL_PRIV 0x04

/* allow as many chained SBALs as are supported by hardware */
#define ZFCP_MAX_SBALS_PER_REQ FSF_MAX_SBALS_PER_REQ
#define ZFCP_MAX_SBALS_PER_CT_REQ FSF_MAX_SBALS_PER_REQ
#define ZFCP_MAX_SBALS_PER_ELS_REQ FSF_MAX_SBALS_PER_ELS_REQ

/* DMQ bug workaround: don't use last SBALE */
#define ZFCP_MAX_SBALES_PER_SBAL (QDIO_MAX_ELEMENTS_PER_BUFFER - 1)

Expand All @@ -89,21 +84,17 @@ zfcp_address_to_sg(void *address, struct scatterlist *list, unsigned int size)

/* max. number of (data buffer) SBALEs in largest SBAL chain */
#define ZFCP_MAX_SBALES_PER_REQ \
(ZFCP_MAX_SBALS_PER_REQ * ZFCP_MAX_SBALES_PER_SBAL - 2)
(FSF_MAX_SBALS_PER_REQ * ZFCP_MAX_SBALES_PER_SBAL - 2)
/* request ID + QTCB in SBALE 0 + 1 of first SBAL in chain */

#define ZFCP_MAX_SECTORS (ZFCP_MAX_SBALES_PER_REQ * 8)
/* max. number of (data buffer) SBALEs in largest SBAL chain
multiplied with number of sectors per 4k block */

#define ZFCP_SBAL_TIMEOUT (5*HZ)

#define ZFCP_TYPE2_RECOVERY_TIME 8 /* seconds */

/********************* FSF SPECIFIC DEFINES *********************************/

#define ZFCP_ULP_INFO_VERSION 26
#define ZFCP_QTCB_VERSION FSF_QTCB_CURRENT_VERSION
/* ATTENTION: value must not be used by hardware */
#define FSF_QTCB_UNSOLICITED_STATUS 0x6305

Expand All @@ -121,8 +112,6 @@ typedef unsigned long long fcp_lun_t;
/* data length field may be at variable position in FCP-2 FCP_CMND IU */
typedef unsigned int fcp_dl_t;

#define ZFCP_FC_SERVICE_CLASS_DEFAULT FSF_CLASS_3

/* timeout for name-server lookup (in seconds) */
#define ZFCP_NS_GID_PN_TIMEOUT 10

Expand Down Expand Up @@ -228,7 +217,6 @@ struct fcp_logo {
* FC-FS stuff
*/
#define R_A_TOV 10 /* seconds */
#define ZFCP_ELS_TIMEOUT (2 * R_A_TOV)

#define ZFCP_LS_RLS 0x0f
#define ZFCP_LS_ADISC 0x52
Expand Down Expand Up @@ -521,7 +509,7 @@ struct zfcp_qdio_queue {
in queue (free_count>0) */
atomic_t count; /* number of free buffers
in queue */
rwlock_t lock; /* lock for operations on queue */
spinlock_t lock; /* lock for operations on queue */
int pci_batch; /* SBALs since PCI indication
was last set */
};
Expand Down Expand Up @@ -686,18 +674,17 @@ struct zfcp_fsf_req {
u32 fsf_command; /* FSF Command copy */
struct fsf_qtcb *qtcb; /* address of associated QTCB */
u32 seq_no; /* Sequence number of request */
unsigned long data; /* private data of request */
void *data; /* private data of request */
struct timer_list timer; /* used for erp or scsi er */
struct zfcp_erp_action *erp_action; /* used if this request is
issued on behalf of erp */
mempool_t *pool; /* used if request was alloacted
from emergency pool */
unsigned long long issued; /* request sent time (STCK) */
struct zfcp_unit *unit;
void (*handler)(struct zfcp_fsf_req *);
};

typedef void zfcp_fsf_req_handler_t(struct zfcp_fsf_req*);

/* driver data */
struct zfcp_data {
struct scsi_host_template scsi_host_template;
Expand Down Expand Up @@ -730,7 +717,6 @@ struct zfcp_fsf_req_qtcb {
/********************** ZFCP SPECIFIC DEFINES ********************************/

#define ZFCP_REQ_AUTO_CLEANUP 0x00000002
#define ZFCP_WAIT_FOR_SBAL 0x00000004
#define ZFCP_REQ_NO_QTCB 0x00000008

#define ZFCP_SET 0x00000100
Expand All @@ -753,15 +739,6 @@ static inline int zfcp_reqlist_hash(unsigned long req_id)
return req_id % REQUEST_LIST_SIZE;
}

static inline void zfcp_reqlist_add(struct zfcp_adapter *adapter,
struct zfcp_fsf_req *fsf_req)
{
unsigned int idx;

idx = zfcp_reqlist_hash(fsf_req->req_id);
list_add_tail(&fsf_req->list, &adapter->req_list[idx]);
}

static inline void zfcp_reqlist_remove(struct zfcp_adapter *adapter,
struct zfcp_fsf_req *fsf_req)
{
Expand Down
12 changes: 5 additions & 7 deletions drivers/s390/scsi/zfcp_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,19 @@ extern struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
extern void zfcp_fsf_start_timer(struct zfcp_fsf_req *, unsigned long);
extern void zfcp_erp_start_timer(struct zfcp_fsf_req *);
extern void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *);
extern int zfcp_fsf_status_read(struct zfcp_adapter *, int);
extern int zfcp_fsf_status_read(struct zfcp_adapter *);
extern int zfcp_status_read_refill(struct zfcp_adapter *adapter);
extern int zfcp_fsf_req_create(struct zfcp_adapter *, u32, int, mempool_t *,
unsigned long *, struct zfcp_fsf_req **)
__acquires(adapter->req_q.lock);
extern int zfcp_fsf_send_ct(struct zfcp_send_ct *, mempool_t *,
struct zfcp_erp_action *);
extern int zfcp_fsf_send_els(struct zfcp_send_els *);
extern int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *,
struct zfcp_unit *,
struct scsi_cmnd *, int, int);
extern int zfcp_fsf_req_complete(struct zfcp_fsf_req *);
extern void zfcp_fsf_req_complete(struct zfcp_fsf_req *);
extern void zfcp_fsf_req_free(struct zfcp_fsf_req *);
extern struct zfcp_fsf_req *zfcp_fsf_send_fcp_command_task_management(
struct zfcp_adapter *, struct zfcp_unit *, u8, int);
extern struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_adapter *,
struct zfcp_unit *, u8,
int);
extern struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(
unsigned long, struct zfcp_adapter *, struct zfcp_unit *, int);

Expand Down
11 changes: 6 additions & 5 deletions drivers/s390/scsi/zfcp_fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req)
u16 no_entries;
u32 range_mask;

fcp_rscn_head = (struct fcp_rscn_head *) status_buffer->payload;
fcp_rscn_element = (struct fcp_rscn_element *) status_buffer->payload;
fcp_rscn_head = (struct fcp_rscn_head *) status_buffer->payload.data;
fcp_rscn_element = (struct fcp_rscn_element *) fcp_rscn_head;

/* see FC-FS */
no_entries = fcp_rscn_head->payload_len /
Expand Down Expand Up @@ -135,7 +135,7 @@ static void zfcp_fc_incoming_plogi(struct zfcp_fsf_req *req)
struct fsf_status_read_buffer *status_buffer =
(struct fsf_status_read_buffer *)req->data;
struct fsf_plogi *els_plogi =
(struct fsf_plogi *) status_buffer->payload;
(struct fsf_plogi *) status_buffer->payload.data;

zfcp_fc_incoming_wwpn(req, els_plogi->serv_param.wwpn);
}
Expand All @@ -144,7 +144,8 @@ static void zfcp_fc_incoming_logo(struct zfcp_fsf_req *req)
{
struct fsf_status_read_buffer *status_buffer =
(struct fsf_status_read_buffer *)req->data;
struct fcp_logo *els_logo = (struct fcp_logo *) status_buffer->payload;
struct fcp_logo *els_logo =
(struct fcp_logo *) status_buffer->payload.data;

zfcp_fc_incoming_wwpn(req, els_logo->nport_wwpn);
}
Expand All @@ -157,7 +158,7 @@ void zfcp_fc_incoming_els(struct zfcp_fsf_req *fsf_req)
{
struct fsf_status_read_buffer *status_buffer =
(struct fsf_status_read_buffer *) fsf_req->data;
unsigned int els_type = status_buffer->payload[0];
unsigned int els_type = status_buffer->payload.data[0];

zfcp_san_dbf_event_incoming_els(fsf_req);
if (els_type == LS_PLOGI)
Expand Down
Loading

0 comments on commit c41f8cb

Please sign in to comment.