Skip to content

Commit dbf5dfe

Browse files
Christof SchmittJames Bottomley
authored andcommitted
[SCSI] zfcp: Use common code definitions for FC CT structs
Use common code definitions for FC GPN_FT and GID_PN instead of inventing private ones. Move the private structs still required inside zfcp to zfcp_fc header file. Reviewed-by: Swen Schillig <[email protected]> Signed-off-by: Christof Schmitt <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent 9d05ce2 commit dbf5dfe

File tree

5 files changed

+161
-180
lines changed

5 files changed

+161
-180
lines changed

drivers/s390/scsi/zfcp_aux.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/miscdevice.h>
3232
#include <linux/seq_file.h>
3333
#include "zfcp_ext.h"
34+
#include "zfcp_fc.h"
3435

3536
#define ZFCP_BUS_ID_SIZE 20
3637

@@ -159,7 +160,7 @@ static int __init zfcp_module_init(void)
159160
int retval = -ENOMEM;
160161

161162
zfcp_data.gpn_ft_cache = zfcp_cache_hw_align("zfcp_gpn",
162-
sizeof(struct ct_iu_gpn_ft_req));
163+
sizeof(struct zfcp_fc_gpn_ft_req));
163164
if (!zfcp_data.gpn_ft_cache)
164165
goto out;
165166

@@ -174,7 +175,7 @@ static int __init zfcp_module_init(void)
174175
goto out_sr_cache;
175176

176177
zfcp_data.gid_pn_cache = zfcp_cache_hw_align("zfcp_gid",
177-
sizeof(struct zfcp_gid_pn_data));
178+
sizeof(struct zfcp_fc_gid_pn));
178179
if (!zfcp_data.gid_pn_cache)
179180
goto out_gid_cache;
180181

@@ -407,9 +408,9 @@ static int zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter)
407408
if (!adapter->pool.status_read_data)
408409
return -ENOMEM;
409410

410-
adapter->pool.gid_pn_data =
411+
adapter->pool.gid_pn =
411412
mempool_create_slab_pool(1, zfcp_data.gid_pn_cache);
412-
if (!adapter->pool.gid_pn_data)
413+
if (!adapter->pool.gid_pn)
413414
return -ENOMEM;
414415

415416
return 0;
@@ -429,8 +430,8 @@ static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
429430
mempool_destroy(adapter->pool.status_read_req);
430431
if (adapter->pool.status_read_data)
431432
mempool_destroy(adapter->pool.status_read_data);
432-
if (adapter->pool.gid_pn_data)
433-
mempool_destroy(adapter->pool.gid_pn_data);
433+
if (adapter->pool.gid_pn)
434+
mempool_destroy(adapter->pool.gid_pn);
434435
}
435436

436437
/**

drivers/s390/scsi/zfcp_dbf.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req)
684684
struct zfcp_wka_port *wka_port = ct->wka_port;
685685
struct zfcp_adapter *adapter = wka_port->adapter;
686686
struct zfcp_dbf *dbf = adapter->dbf;
687-
struct ct_hdr *hdr = sg_virt(ct->req);
687+
struct fc_ct_hdr *hdr = sg_virt(ct->req);
688688
struct zfcp_dbf_san_record *r = &dbf->san_buf;
689689
struct zfcp_dbf_san_record_ct_request *oct = &r->u.ct_req;
690690
int level = 3;
@@ -697,17 +697,17 @@ void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req)
697697
r->fsf_seqno = fsf_req->seq_no;
698698
r->s_id = fc_host_port_id(adapter->scsi_host);
699699
r->d_id = wka_port->d_id;
700-
oct->cmd_req_code = hdr->cmd_rsp_code;
701-
oct->revision = hdr->revision;
702-
oct->gs_type = hdr->gs_type;
703-
oct->gs_subtype = hdr->gs_subtype;
704-
oct->options = hdr->options;
705-
oct->max_res_size = hdr->max_res_size;
706-
oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr),
700+
oct->cmd_req_code = hdr->ct_cmd;
701+
oct->revision = hdr->ct_rev;
702+
oct->gs_type = hdr->ct_fs_type;
703+
oct->gs_subtype = hdr->ct_fs_subtype;
704+
oct->options = hdr->ct_options;
705+
oct->max_res_size = hdr->ct_mr_size;
706+
oct->len = min((int)ct->req->length - (int)sizeof(struct fc_ct_hdr),
707707
ZFCP_DBF_SAN_MAX_PAYLOAD);
708708
debug_event(dbf->san, level, r, sizeof(*r));
709709
zfcp_dbf_hexdump(dbf->san, r, sizeof(*r), level,
710-
(void *)hdr + sizeof(struct ct_hdr), oct->len);
710+
(void *)hdr + sizeof(struct fc_ct_hdr), oct->len);
711711
spin_unlock_irqrestore(&dbf->san_lock, flags);
712712
}
713713

@@ -720,7 +720,7 @@ void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req)
720720
struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data;
721721
struct zfcp_wka_port *wka_port = ct->wka_port;
722722
struct zfcp_adapter *adapter = wka_port->adapter;
723-
struct ct_hdr *hdr = sg_virt(ct->resp);
723+
struct fc_ct_hdr *hdr = sg_virt(ct->resp);
724724
struct zfcp_dbf *dbf = adapter->dbf;
725725
struct zfcp_dbf_san_record *r = &dbf->san_buf;
726726
struct zfcp_dbf_san_record_ct_response *rct = &r->u.ct_resp;
@@ -734,17 +734,17 @@ void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req)
734734
r->fsf_seqno = fsf_req->seq_no;
735735
r->s_id = wka_port->d_id;
736736
r->d_id = fc_host_port_id(adapter->scsi_host);
737-
rct->cmd_rsp_code = hdr->cmd_rsp_code;
738-
rct->revision = hdr->revision;
739-
rct->reason_code = hdr->reason_code;
740-
rct->expl = hdr->reason_code_expl;
741-
rct->vendor_unique = hdr->vendor_unique;
742-
rct->max_res_size = hdr->max_res_size;
743-
rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr),
737+
rct->cmd_rsp_code = hdr->ct_cmd;
738+
rct->revision = hdr->ct_rev;
739+
rct->reason_code = hdr->ct_reason;
740+
rct->expl = hdr->ct_explan;
741+
rct->vendor_unique = hdr->ct_vendor;
742+
rct->max_res_size = hdr->ct_mr_size;
743+
rct->len = min((int)ct->resp->length - (int)sizeof(struct fc_ct_hdr),
744744
ZFCP_DBF_SAN_MAX_PAYLOAD);
745745
debug_event(dbf->san, level, r, sizeof(*r));
746746
zfcp_dbf_hexdump(dbf->san, r, sizeof(*r), level,
747-
(void *)hdr + sizeof(struct ct_hdr), rct->len);
747+
(void *)hdr + sizeof(struct fc_ct_hdr), rct->len);
748748
spin_unlock_irqrestore(&dbf->san_lock, flags);
749749
}
750750

drivers/s390/scsi/zfcp_def.h

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,6 @@
7575

7676
#define ZFCP_DID_MASK 0x00FFFFFF
7777

78-
/*
79-
* FC-GS-2 stuff
80-
*/
81-
#define ZFCP_CT_REVISION 0x01
82-
#define ZFCP_CT_DIRECTORY_SERVICE 0xFC
83-
#define ZFCP_CT_NAME_SERVER 0x02
84-
#define ZFCP_CT_SYNCHRONOUS 0x00
85-
#define ZFCP_CT_SCSI_FCP 0x08
86-
#define ZFCP_CT_UNABLE_TO_PERFORM_CMD 0x09
87-
#define ZFCP_CT_GID_PN 0x0121
88-
#define ZFCP_CT_GPN_FT 0x0172
89-
#define ZFCP_CT_ACCEPT 0x8002
90-
#define ZFCP_CT_REJECT 0x8001
91-
92-
/*
93-
* FC-GS-4 stuff
94-
*/
95-
#define ZFCP_CT_TIMEOUT (3 * R_A_TOV)
96-
9778
/*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/
9879

9980
/*
@@ -119,9 +100,6 @@
119100
#define ZFCP_STATUS_ADAPTER_ERP_PENDING 0x00000100
120101
#define ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 0x00000200
121102

122-
/* FC-PH/FC-GS well-known address identifiers for generic services */
123-
#define ZFCP_DID_WKA 0xFFFFF0
124-
125103
/* remote port status */
126104
#define ZFCP_STATUS_PORT_PHYS_OPEN 0x00000001
127105
#define ZFCP_STATUS_PORT_LINK_TEST 0x00000002
@@ -162,50 +140,10 @@ struct zfcp_adapter_mempool {
162140
mempool_t *scsi_abort;
163141
mempool_t *status_read_req;
164142
mempool_t *status_read_data;
165-
mempool_t *gid_pn_data;
143+
mempool_t *gid_pn;
166144
mempool_t *qtcb_pool;
167145
};
168146

169-
/*
170-
* header for CT_IU
171-
*/
172-
struct ct_hdr {
173-
u8 revision; // 0x01
174-
u8 in_id[3]; // 0x00
175-
u8 gs_type; // 0xFC Directory Service
176-
u8 gs_subtype; // 0x02 Name Server
177-
u8 options; // 0x00 single bidirectional exchange
178-
u8 reserved0;
179-
u16 cmd_rsp_code; // 0x0121 GID_PN, or 0x0100 GA_NXT
180-
u16 max_res_size; // <= (4096 - 16) / 4
181-
u8 reserved1;
182-
u8 reason_code;
183-
u8 reason_code_expl;
184-
u8 vendor_unique;
185-
} __attribute__ ((packed));
186-
187-
/* nameserver request CT_IU -- for requests where
188-
* a port name is required */
189-
struct ct_iu_gid_pn_req {
190-
struct ct_hdr header;
191-
u64 wwpn;
192-
} __attribute__ ((packed));
193-
194-
/* FS_ACC IU and data unit for GID_PN nameserver request */
195-
struct ct_iu_gid_pn_resp {
196-
struct ct_hdr header;
197-
u32 d_id;
198-
} __attribute__ ((packed));
199-
200-
struct ct_iu_gpn_ft_req {
201-
struct ct_hdr header;
202-
u8 flags;
203-
u8 domain_id_scope;
204-
u8 area_id_scope;
205-
u8 fc4_type;
206-
} __attribute__ ((packed));
207-
208-
209147
/**
210148
* struct zfcp_send_ct - used to pass parameters to function zfcp_fsf_send_ct
211149
* @wka_port: port where the request is sent to
@@ -226,16 +164,6 @@ struct zfcp_send_ct {
226164
int status;
227165
};
228166

229-
/* used for name server requests in error recovery */
230-
struct zfcp_gid_pn_data {
231-
struct zfcp_send_ct ct;
232-
struct scatterlist req;
233-
struct scatterlist resp;
234-
struct ct_iu_gid_pn_req ct_iu_req;
235-
struct ct_iu_gid_pn_resp ct_iu_resp;
236-
struct zfcp_port *port;
237-
};
238-
239167
/**
240168
* struct zfcp_send_els - used to pass parameters to function zfcp_fsf_send_els
241169
* @adapter: adapter where request is sent from

0 commit comments

Comments
 (0)