diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2009-11-24 10:54:10 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:02:13 -0500 |
commit | dbf5dfe9dbcecf159139eec25ad256738cbc3715 (patch) | |
tree | 1f1703cf4a270beb3e7046244123e62188de53f4 /drivers/s390 | |
parent | 9d05ce2c0a6704ff84df02cbb3baef94fcac4f5d (diff) |
[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 <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 13 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 36 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_def.h | 74 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fc.c | 138 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fc.h | 80 |
5 files changed, 161 insertions, 180 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 107d3f2b6e94..58bb17732f56 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/miscdevice.h> | 31 | #include <linux/miscdevice.h> |
32 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
33 | #include "zfcp_ext.h" | 33 | #include "zfcp_ext.h" |
34 | #include "zfcp_fc.h" | ||
34 | 35 | ||
35 | #define ZFCP_BUS_ID_SIZE 20 | 36 | #define ZFCP_BUS_ID_SIZE 20 |
36 | 37 | ||
@@ -159,7 +160,7 @@ static int __init zfcp_module_init(void) | |||
159 | int retval = -ENOMEM; | 160 | int retval = -ENOMEM; |
160 | 161 | ||
161 | zfcp_data.gpn_ft_cache = zfcp_cache_hw_align("zfcp_gpn", | 162 | 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)); |
163 | if (!zfcp_data.gpn_ft_cache) | 164 | if (!zfcp_data.gpn_ft_cache) |
164 | goto out; | 165 | goto out; |
165 | 166 | ||
@@ -174,7 +175,7 @@ static int __init zfcp_module_init(void) | |||
174 | goto out_sr_cache; | 175 | goto out_sr_cache; |
175 | 176 | ||
176 | zfcp_data.gid_pn_cache = zfcp_cache_hw_align("zfcp_gid", | 177 | 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)); |
178 | if (!zfcp_data.gid_pn_cache) | 179 | if (!zfcp_data.gid_pn_cache) |
179 | goto out_gid_cache; | 180 | goto out_gid_cache; |
180 | 181 | ||
@@ -407,9 +408,9 @@ static int zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter) | |||
407 | if (!adapter->pool.status_read_data) | 408 | if (!adapter->pool.status_read_data) |
408 | return -ENOMEM; | 409 | return -ENOMEM; |
409 | 410 | ||
410 | adapter->pool.gid_pn_data = | 411 | adapter->pool.gid_pn = |
411 | mempool_create_slab_pool(1, zfcp_data.gid_pn_cache); | 412 | mempool_create_slab_pool(1, zfcp_data.gid_pn_cache); |
412 | if (!adapter->pool.gid_pn_data) | 413 | if (!adapter->pool.gid_pn) |
413 | return -ENOMEM; | 414 | return -ENOMEM; |
414 | 415 | ||
415 | return 0; | 416 | return 0; |
@@ -429,8 +430,8 @@ static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter) | |||
429 | mempool_destroy(adapter->pool.status_read_req); | 430 | mempool_destroy(adapter->pool.status_read_req); |
430 | if (adapter->pool.status_read_data) | 431 | if (adapter->pool.status_read_data) |
431 | mempool_destroy(adapter->pool.status_read_data); | 432 | mempool_destroy(adapter->pool.status_read_data); |
432 | if (adapter->pool.gid_pn_data) | 433 | if (adapter->pool.gid_pn) |
433 | mempool_destroy(adapter->pool.gid_pn_data); | 434 | mempool_destroy(adapter->pool.gid_pn); |
434 | } | 435 | } |
435 | 436 | ||
436 | /** | 437 | /** |
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 21e5316e5003..d7a550af4a25 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -684,7 +684,7 @@ void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req) | |||
684 | struct zfcp_wka_port *wka_port = ct->wka_port; | 684 | struct zfcp_wka_port *wka_port = ct->wka_port; |
685 | struct zfcp_adapter *adapter = wka_port->adapter; | 685 | struct zfcp_adapter *adapter = wka_port->adapter; |
686 | struct zfcp_dbf *dbf = adapter->dbf; | 686 | 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); |
688 | struct zfcp_dbf_san_record *r = &dbf->san_buf; | 688 | struct zfcp_dbf_san_record *r = &dbf->san_buf; |
689 | struct zfcp_dbf_san_record_ct_request *oct = &r->u.ct_req; | 689 | struct zfcp_dbf_san_record_ct_request *oct = &r->u.ct_req; |
690 | int level = 3; | 690 | int level = 3; |
@@ -697,17 +697,17 @@ void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req) | |||
697 | r->fsf_seqno = fsf_req->seq_no; | 697 | r->fsf_seqno = fsf_req->seq_no; |
698 | r->s_id = fc_host_port_id(adapter->scsi_host); | 698 | r->s_id = fc_host_port_id(adapter->scsi_host); |
699 | r->d_id = wka_port->d_id; | 699 | r->d_id = wka_port->d_id; |
700 | oct->cmd_req_code = hdr->cmd_rsp_code; | 700 | oct->cmd_req_code = hdr->ct_cmd; |
701 | oct->revision = hdr->revision; | 701 | oct->revision = hdr->ct_rev; |
702 | oct->gs_type = hdr->gs_type; | 702 | oct->gs_type = hdr->ct_fs_type; |
703 | oct->gs_subtype = hdr->gs_subtype; | 703 | oct->gs_subtype = hdr->ct_fs_subtype; |
704 | oct->options = hdr->options; | 704 | oct->options = hdr->ct_options; |
705 | oct->max_res_size = hdr->max_res_size; | 705 | oct->max_res_size = hdr->ct_mr_size; |
706 | oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr), | 706 | oct->len = min((int)ct->req->length - (int)sizeof(struct fc_ct_hdr), |
707 | ZFCP_DBF_SAN_MAX_PAYLOAD); | 707 | ZFCP_DBF_SAN_MAX_PAYLOAD); |
708 | debug_event(dbf->san, level, r, sizeof(*r)); | 708 | debug_event(dbf->san, level, r, sizeof(*r)); |
709 | zfcp_dbf_hexdump(dbf->san, r, sizeof(*r), level, | 709 | 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); |
711 | spin_unlock_irqrestore(&dbf->san_lock, flags); | 711 | spin_unlock_irqrestore(&dbf->san_lock, flags); |
712 | } | 712 | } |
713 | 713 | ||
@@ -720,7 +720,7 @@ void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req) | |||
720 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; | 720 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; |
721 | struct zfcp_wka_port *wka_port = ct->wka_port; | 721 | struct zfcp_wka_port *wka_port = ct->wka_port; |
722 | struct zfcp_adapter *adapter = wka_port->adapter; | 722 | 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); |
724 | struct zfcp_dbf *dbf = adapter->dbf; | 724 | struct zfcp_dbf *dbf = adapter->dbf; |
725 | struct zfcp_dbf_san_record *r = &dbf->san_buf; | 725 | struct zfcp_dbf_san_record *r = &dbf->san_buf; |
726 | struct zfcp_dbf_san_record_ct_response *rct = &r->u.ct_resp; | 726 | 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) | |||
734 | r->fsf_seqno = fsf_req->seq_no; | 734 | r->fsf_seqno = fsf_req->seq_no; |
735 | r->s_id = wka_port->d_id; | 735 | r->s_id = wka_port->d_id; |
736 | r->d_id = fc_host_port_id(adapter->scsi_host); | 736 | r->d_id = fc_host_port_id(adapter->scsi_host); |
737 | rct->cmd_rsp_code = hdr->cmd_rsp_code; | 737 | rct->cmd_rsp_code = hdr->ct_cmd; |
738 | rct->revision = hdr->revision; | 738 | rct->revision = hdr->ct_rev; |
739 | rct->reason_code = hdr->reason_code; | 739 | rct->reason_code = hdr->ct_reason; |
740 | rct->expl = hdr->reason_code_expl; | 740 | rct->expl = hdr->ct_explan; |
741 | rct->vendor_unique = hdr->vendor_unique; | 741 | rct->vendor_unique = hdr->ct_vendor; |
742 | rct->max_res_size = hdr->max_res_size; | 742 | rct->max_res_size = hdr->ct_mr_size; |
743 | rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr), | 743 | rct->len = min((int)ct->resp->length - (int)sizeof(struct fc_ct_hdr), |
744 | ZFCP_DBF_SAN_MAX_PAYLOAD); | 744 | ZFCP_DBF_SAN_MAX_PAYLOAD); |
745 | debug_event(dbf->san, level, r, sizeof(*r)); | 745 | debug_event(dbf->san, level, r, sizeof(*r)); |
746 | zfcp_dbf_hexdump(dbf->san, r, sizeof(*r), level, | 746 | 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); |
748 | spin_unlock_irqrestore(&dbf->san_lock, flags); | 748 | spin_unlock_irqrestore(&dbf->san_lock, flags); |
749 | } | 749 | } |
750 | 750 | ||
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index fae8f2ebd43f..c64821145475 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -75,25 +75,6 @@ | |||
75 | 75 | ||
76 | #define ZFCP_DID_MASK 0x00FFFFFF | 76 | #define ZFCP_DID_MASK 0x00FFFFFF |
77 | 77 | ||
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 | |||
97 | /*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/ | 78 | /*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/ |
98 | 79 | ||
99 | /* | 80 | /* |
@@ -119,9 +100,6 @@ | |||
119 | #define ZFCP_STATUS_ADAPTER_ERP_PENDING 0x00000100 | 100 | #define ZFCP_STATUS_ADAPTER_ERP_PENDING 0x00000100 |
120 | #define ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 0x00000200 | 101 | #define ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 0x00000200 |
121 | 102 | ||
122 | /* FC-PH/FC-GS well-known address identifiers for generic services */ | ||
123 | #define ZFCP_DID_WKA 0xFFFFF0 | ||
124 | |||
125 | /* remote port status */ | 103 | /* remote port status */ |
126 | #define ZFCP_STATUS_PORT_PHYS_OPEN 0x00000001 | 104 | #define ZFCP_STATUS_PORT_PHYS_OPEN 0x00000001 |
127 | #define ZFCP_STATUS_PORT_LINK_TEST 0x00000002 | 105 | #define ZFCP_STATUS_PORT_LINK_TEST 0x00000002 |
@@ -162,50 +140,10 @@ struct zfcp_adapter_mempool { | |||
162 | mempool_t *scsi_abort; | 140 | mempool_t *scsi_abort; |
163 | mempool_t *status_read_req; | 141 | mempool_t *status_read_req; |
164 | mempool_t *status_read_data; | 142 | mempool_t *status_read_data; |
165 | mempool_t *gid_pn_data; | 143 | mempool_t *gid_pn; |
166 | mempool_t *qtcb_pool; | 144 | mempool_t *qtcb_pool; |
167 | }; | 145 | }; |
168 | 146 | ||
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 | |||
209 | /** | 147 | /** |
210 | * struct zfcp_send_ct - used to pass parameters to function zfcp_fsf_send_ct | 148 | * struct zfcp_send_ct - used to pass parameters to function zfcp_fsf_send_ct |
211 | * @wka_port: port where the request is sent to | 149 | * @wka_port: port where the request is sent to |
@@ -226,16 +164,6 @@ struct zfcp_send_ct { | |||
226 | int status; | 164 | int status; |
227 | }; | 165 | }; |
228 | 166 | ||
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 | |||
239 | /** | 167 | /** |
240 | * struct zfcp_send_els - used to pass parameters to function zfcp_fsf_send_els | 168 | * struct zfcp_send_els - used to pass parameters to function zfcp_fsf_send_els |
241 | * @adapter: adapter where request is sent from | 169 | * @adapter: adapter where request is sent from |
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index e03410043cd7..7c306a5ef4dd 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c | |||
@@ -22,32 +22,6 @@ static u32 zfcp_fc_rscn_range_mask[] = { | |||
22 | [ELS_ADDR_FMT_FAB] = 0x000000, | 22 | [ELS_ADDR_FMT_FAB] = 0x000000, |
23 | }; | 23 | }; |
24 | 24 | ||
25 | struct gpn_ft_resp_acc { | ||
26 | u8 control; | ||
27 | u8 port_id[3]; | ||
28 | u8 reserved[4]; | ||
29 | u64 wwpn; | ||
30 | } __attribute__ ((packed)); | ||
31 | |||
32 | #define ZFCP_CT_SIZE_ONE_PAGE (PAGE_SIZE - sizeof(struct ct_hdr)) | ||
33 | #define ZFCP_GPN_FT_ENTRIES (ZFCP_CT_SIZE_ONE_PAGE \ | ||
34 | / sizeof(struct gpn_ft_resp_acc)) | ||
35 | #define ZFCP_GPN_FT_BUFFERS 4 | ||
36 | #define ZFCP_GPN_FT_MAX_SIZE (ZFCP_GPN_FT_BUFFERS * PAGE_SIZE \ | ||
37 | - sizeof(struct ct_hdr)) | ||
38 | #define ZFCP_GPN_FT_MAX_ENTRIES ZFCP_GPN_FT_BUFFERS * (ZFCP_GPN_FT_ENTRIES + 1) | ||
39 | |||
40 | struct ct_iu_gpn_ft_resp { | ||
41 | struct ct_hdr header; | ||
42 | struct gpn_ft_resp_acc accept[ZFCP_GPN_FT_ENTRIES]; | ||
43 | } __attribute__ ((packed)); | ||
44 | |||
45 | struct zfcp_gpn_ft { | ||
46 | struct zfcp_send_ct ct; | ||
47 | struct scatterlist sg_req; | ||
48 | struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS]; | ||
49 | }; | ||
50 | |||
51 | struct zfcp_fc_ns_handler_data { | 25 | struct zfcp_fc_ns_handler_data { |
52 | struct completion done; | 26 | struct completion done; |
53 | void (*handler)(unsigned long); | 27 | void (*handler)(unsigned long); |
@@ -251,26 +225,26 @@ static void zfcp_fc_ns_handler(unsigned long data) | |||
251 | 225 | ||
252 | static void zfcp_fc_ns_gid_pn_eval(unsigned long data) | 226 | static void zfcp_fc_ns_gid_pn_eval(unsigned long data) |
253 | { | 227 | { |
254 | struct zfcp_gid_pn_data *gid_pn = (struct zfcp_gid_pn_data *) data; | 228 | struct zfcp_fc_gid_pn *gid_pn = (struct zfcp_fc_gid_pn *) data; |
255 | struct zfcp_send_ct *ct = &gid_pn->ct; | 229 | struct zfcp_send_ct *ct = &gid_pn->ct; |
256 | struct ct_iu_gid_pn_req *ct_iu_req = sg_virt(ct->req); | 230 | struct zfcp_fc_gid_pn_req *gid_pn_req = sg_virt(ct->req); |
257 | struct ct_iu_gid_pn_resp *ct_iu_resp = sg_virt(ct->resp); | 231 | struct zfcp_fc_gid_pn_resp *gid_pn_resp = sg_virt(ct->resp); |
258 | struct zfcp_port *port = gid_pn->port; | 232 | struct zfcp_port *port = gid_pn->port; |
259 | 233 | ||
260 | if (ct->status) | 234 | if (ct->status) |
261 | return; | 235 | return; |
262 | if (ct_iu_resp->header.cmd_rsp_code != ZFCP_CT_ACCEPT) | 236 | if (gid_pn_resp->ct_hdr.ct_cmd != FC_FS_ACC) |
263 | return; | 237 | return; |
264 | 238 | ||
265 | /* paranoia */ | 239 | /* paranoia */ |
266 | if (ct_iu_req->wwpn != port->wwpn) | 240 | if (gid_pn_req->gid_pn.fn_wwpn != port->wwpn) |
267 | return; | 241 | return; |
268 | /* looks like a valid d_id */ | 242 | /* looks like a valid d_id */ |
269 | port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK; | 243 | port->d_id = ntoh24(gid_pn_resp->gid_pn.fp_fid); |
270 | } | 244 | } |
271 | 245 | ||
272 | static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port, | 246 | static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port, |
273 | struct zfcp_gid_pn_data *gid_pn) | 247 | struct zfcp_fc_gid_pn *gid_pn) |
274 | { | 248 | { |
275 | struct zfcp_adapter *adapter = port->adapter; | 249 | struct zfcp_adapter *adapter = port->adapter; |
276 | struct zfcp_fc_ns_handler_data compl_rec; | 250 | struct zfcp_fc_ns_handler_data compl_rec; |
@@ -281,21 +255,21 @@ static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port, | |||
281 | gid_pn->ct.wka_port = &adapter->gs->ds; | 255 | gid_pn->ct.wka_port = &adapter->gs->ds; |
282 | gid_pn->ct.handler = zfcp_fc_ns_handler; | 256 | gid_pn->ct.handler = zfcp_fc_ns_handler; |
283 | gid_pn->ct.handler_data = (unsigned long) &compl_rec; | 257 | gid_pn->ct.handler_data = (unsigned long) &compl_rec; |
284 | gid_pn->ct.req = &gid_pn->req; | 258 | gid_pn->ct.req = &gid_pn->sg_req; |
285 | gid_pn->ct.resp = &gid_pn->resp; | 259 | gid_pn->ct.resp = &gid_pn->sg_resp; |
286 | sg_init_one(&gid_pn->req, &gid_pn->ct_iu_req, | 260 | sg_init_one(&gid_pn->sg_req, &gid_pn->gid_pn_req, |
287 | sizeof(struct ct_iu_gid_pn_req)); | 261 | sizeof(struct zfcp_fc_gid_pn_req)); |
288 | sg_init_one(&gid_pn->resp, &gid_pn->ct_iu_resp, | 262 | sg_init_one(&gid_pn->sg_resp, &gid_pn->gid_pn_resp, |
289 | sizeof(struct ct_iu_gid_pn_resp)); | 263 | sizeof(struct zfcp_fc_gid_pn_resp)); |
290 | 264 | ||
291 | /* setup nameserver request */ | 265 | /* setup nameserver request */ |
292 | gid_pn->ct_iu_req.header.revision = ZFCP_CT_REVISION; | 266 | gid_pn->gid_pn_req.ct_hdr.ct_rev = FC_CT_REV; |
293 | gid_pn->ct_iu_req.header.gs_type = ZFCP_CT_DIRECTORY_SERVICE; | 267 | gid_pn->gid_pn_req.ct_hdr.ct_fs_type = FC_FST_DIR; |
294 | gid_pn->ct_iu_req.header.gs_subtype = ZFCP_CT_NAME_SERVER; | 268 | gid_pn->gid_pn_req.ct_hdr.ct_fs_subtype = FC_NS_SUBTYPE; |
295 | gid_pn->ct_iu_req.header.options = ZFCP_CT_SYNCHRONOUS; | 269 | gid_pn->gid_pn_req.ct_hdr.ct_options = 0; |
296 | gid_pn->ct_iu_req.header.cmd_rsp_code = ZFCP_CT_GID_PN; | 270 | gid_pn->gid_pn_req.ct_hdr.ct_cmd = FC_NS_GID_PN; |
297 | gid_pn->ct_iu_req.header.max_res_size = ZFCP_CT_SIZE_ONE_PAGE / 4; | 271 | gid_pn->gid_pn_req.ct_hdr.ct_mr_size = ZFCP_FC_CT_SIZE_PAGE / 4; |
298 | gid_pn->ct_iu_req.wwpn = port->wwpn; | 272 | gid_pn->gid_pn_req.gid_pn.fn_wwpn = port->wwpn; |
299 | 273 | ||
300 | init_completion(&compl_rec.done); | 274 | init_completion(&compl_rec.done); |
301 | compl_rec.handler = zfcp_fc_ns_gid_pn_eval; | 275 | compl_rec.handler = zfcp_fc_ns_gid_pn_eval; |
@@ -314,10 +288,10 @@ static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port, | |||
314 | static int zfcp_fc_ns_gid_pn(struct zfcp_port *port) | 288 | static int zfcp_fc_ns_gid_pn(struct zfcp_port *port) |
315 | { | 289 | { |
316 | int ret; | 290 | int ret; |
317 | struct zfcp_gid_pn_data *gid_pn; | 291 | struct zfcp_fc_gid_pn *gid_pn; |
318 | struct zfcp_adapter *adapter = port->adapter; | 292 | struct zfcp_adapter *adapter = port->adapter; |
319 | 293 | ||
320 | gid_pn = mempool_alloc(adapter->pool.gid_pn_data, GFP_ATOMIC); | 294 | gid_pn = mempool_alloc(adapter->pool.gid_pn, GFP_ATOMIC); |
321 | if (!gid_pn) | 295 | if (!gid_pn) |
322 | return -ENOMEM; | 296 | return -ENOMEM; |
323 | 297 | ||
@@ -331,7 +305,7 @@ static int zfcp_fc_ns_gid_pn(struct zfcp_port *port) | |||
331 | 305 | ||
332 | zfcp_fc_wka_port_put(&adapter->gs->ds); | 306 | zfcp_fc_wka_port_put(&adapter->gs->ds); |
333 | out: | 307 | out: |
334 | mempool_free(gid_pn, adapter->pool.gid_pn_data); | 308 | mempool_free(gid_pn, adapter->pool.gid_pn); |
335 | return ret; | 309 | return ret; |
336 | } | 310 | } |
337 | 311 | ||
@@ -508,7 +482,7 @@ void zfcp_fc_test_link(struct zfcp_port *port) | |||
508 | put_device(&port->sysfs_device); | 482 | put_device(&port->sysfs_device); |
509 | } | 483 | } |
510 | 484 | ||
511 | static void zfcp_free_sg_env(struct zfcp_gpn_ft *gpn_ft, int buf_num) | 485 | static void zfcp_free_sg_env(struct zfcp_fc_gpn_ft *gpn_ft, int buf_num) |
512 | { | 486 | { |
513 | struct scatterlist *sg = &gpn_ft->sg_req; | 487 | struct scatterlist *sg = &gpn_ft->sg_req; |
514 | 488 | ||
@@ -518,10 +492,10 @@ static void zfcp_free_sg_env(struct zfcp_gpn_ft *gpn_ft, int buf_num) | |||
518 | kfree(gpn_ft); | 492 | kfree(gpn_ft); |
519 | } | 493 | } |
520 | 494 | ||
521 | static struct zfcp_gpn_ft *zfcp_alloc_sg_env(int buf_num) | 495 | static struct zfcp_fc_gpn_ft *zfcp_alloc_sg_env(int buf_num) |
522 | { | 496 | { |
523 | struct zfcp_gpn_ft *gpn_ft; | 497 | struct zfcp_fc_gpn_ft *gpn_ft; |
524 | struct ct_iu_gpn_ft_req *req; | 498 | struct zfcp_fc_gpn_ft_req *req; |
525 | 499 | ||
526 | gpn_ft = kzalloc(sizeof(*gpn_ft), GFP_KERNEL); | 500 | gpn_ft = kzalloc(sizeof(*gpn_ft), GFP_KERNEL); |
527 | if (!gpn_ft) | 501 | if (!gpn_ft) |
@@ -544,25 +518,24 @@ out: | |||
544 | } | 518 | } |
545 | 519 | ||
546 | 520 | ||
547 | static int zfcp_fc_send_gpn_ft(struct zfcp_gpn_ft *gpn_ft, | 521 | static int zfcp_fc_send_gpn_ft(struct zfcp_fc_gpn_ft *gpn_ft, |
548 | struct zfcp_adapter *adapter, int max_bytes) | 522 | struct zfcp_adapter *adapter, int max_bytes) |
549 | { | 523 | { |
550 | struct zfcp_send_ct *ct = &gpn_ft->ct; | 524 | struct zfcp_send_ct *ct = &gpn_ft->ct; |
551 | struct ct_iu_gpn_ft_req *req = sg_virt(&gpn_ft->sg_req); | 525 | struct zfcp_fc_gpn_ft_req *req = sg_virt(&gpn_ft->sg_req); |
552 | struct zfcp_fc_ns_handler_data compl_rec; | 526 | struct zfcp_fc_ns_handler_data compl_rec; |
553 | int ret; | 527 | int ret; |
554 | 528 | ||
555 | /* prepare CT IU for GPN_FT */ | 529 | /* prepare CT IU for GPN_FT */ |
556 | req->header.revision = ZFCP_CT_REVISION; | 530 | req->ct_hdr.ct_rev = FC_CT_REV; |
557 | req->header.gs_type = ZFCP_CT_DIRECTORY_SERVICE; | 531 | req->ct_hdr.ct_fs_type = FC_FST_DIR; |
558 | req->header.gs_subtype = ZFCP_CT_NAME_SERVER; | 532 | req->ct_hdr.ct_fs_subtype = FC_NS_SUBTYPE; |
559 | req->header.options = ZFCP_CT_SYNCHRONOUS; | 533 | req->ct_hdr.ct_options = 0; |
560 | req->header.cmd_rsp_code = ZFCP_CT_GPN_FT; | 534 | req->ct_hdr.ct_cmd = FC_NS_GPN_FT; |
561 | req->header.max_res_size = max_bytes / 4; | 535 | req->ct_hdr.ct_mr_size = max_bytes / 4; |
562 | req->flags = 0; | 536 | req->gpn_ft.fn_domain_id_scope = 0; |
563 | req->domain_id_scope = 0; | 537 | req->gpn_ft.fn_area_id_scope = 0; |
564 | req->area_id_scope = 0; | 538 | req->gpn_ft.fn_fc4_type = FC_TYPE_FCP; |
565 | req->fc4_type = ZFCP_CT_SCSI_FCP; | ||
566 | 539 | ||
567 | /* prepare zfcp_send_ct */ | 540 | /* prepare zfcp_send_ct */ |
568 | ct->wka_port = &adapter->gs->ds; | 541 | ct->wka_port = &adapter->gs->ds; |
@@ -593,12 +566,12 @@ static void zfcp_fc_validate_port(struct zfcp_port *port, struct list_head *lh) | |||
593 | list_move_tail(&port->list, lh); | 566 | list_move_tail(&port->list, lh); |
594 | } | 567 | } |
595 | 568 | ||
596 | static int zfcp_fc_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft, int max_entries) | 569 | static int zfcp_fc_eval_gpn_ft(struct zfcp_fc_gpn_ft *gpn_ft, int max_entries) |
597 | { | 570 | { |
598 | struct zfcp_send_ct *ct = &gpn_ft->ct; | 571 | struct zfcp_send_ct *ct = &gpn_ft->ct; |
599 | struct scatterlist *sg = gpn_ft->sg_resp; | 572 | struct scatterlist *sg = gpn_ft->sg_resp; |
600 | struct ct_hdr *hdr = sg_virt(sg); | 573 | struct fc_ct_hdr *hdr = sg_virt(sg); |
601 | struct gpn_ft_resp_acc *acc = sg_virt(sg); | 574 | struct fc_gpn_ft_resp *acc = sg_virt(sg); |
602 | struct zfcp_adapter *adapter = ct->wka_port->adapter; | 575 | struct zfcp_adapter *adapter = ct->wka_port->adapter; |
603 | struct zfcp_port *port, *tmp; | 576 | struct zfcp_port *port, *tmp; |
604 | unsigned long flags; | 577 | unsigned long flags; |
@@ -609,38 +582,37 @@ static int zfcp_fc_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft, int max_entries) | |||
609 | if (ct->status) | 582 | if (ct->status) |
610 | return -EIO; | 583 | return -EIO; |
611 | 584 | ||
612 | if (hdr->cmd_rsp_code != ZFCP_CT_ACCEPT) { | 585 | if (hdr->ct_cmd != FC_FS_ACC) { |
613 | if (hdr->reason_code == ZFCP_CT_UNABLE_TO_PERFORM_CMD) | 586 | if (hdr->ct_reason == FC_BA_RJT_UNABLE) |
614 | return -EAGAIN; /* might be a temporary condition */ | 587 | return -EAGAIN; /* might be a temporary condition */ |
615 | return -EIO; | 588 | return -EIO; |
616 | } | 589 | } |
617 | 590 | ||
618 | if (hdr->max_res_size) { | 591 | if (hdr->ct_mr_size) { |
619 | dev_warn(&adapter->ccw_device->dev, | 592 | dev_warn(&adapter->ccw_device->dev, |
620 | "The name server reported %d words residual data\n", | 593 | "The name server reported %d words residual data\n", |
621 | hdr->max_res_size); | 594 | hdr->ct_mr_size); |
622 | return -E2BIG; | 595 | return -E2BIG; |
623 | } | 596 | } |
624 | 597 | ||
625 | /* first entry is the header */ | 598 | /* first entry is the header */ |
626 | for (x = 1; x < max_entries && !last; x++) { | 599 | for (x = 1; x < max_entries && !last; x++) { |
627 | if (x % (ZFCP_GPN_FT_ENTRIES + 1)) | 600 | if (x % (ZFCP_FC_GPN_FT_ENT_PAGE + 1)) |
628 | acc++; | 601 | acc++; |
629 | else | 602 | else |
630 | acc = sg_virt(++sg); | 603 | acc = sg_virt(++sg); |
631 | 604 | ||
632 | last = acc->control & 0x80; | 605 | last = acc->fp_flags & FC_NS_FID_LAST; |
633 | d_id = acc->port_id[0] << 16 | acc->port_id[1] << 8 | | 606 | d_id = ntoh24(acc->fp_fid); |
634 | acc->port_id[2]; | ||
635 | 607 | ||
636 | /* don't attach ports with a well known address */ | 608 | /* don't attach ports with a well known address */ |
637 | if ((d_id & ZFCP_DID_WKA) == ZFCP_DID_WKA) | 609 | if (d_id >= FC_FID_WELL_KNOWN_BASE) |
638 | continue; | 610 | continue; |
639 | /* skip the adapter's port and known remote ports */ | 611 | /* skip the adapter's port and known remote ports */ |
640 | if (acc->wwpn == fc_host_port_name(adapter->scsi_host)) | 612 | if (acc->fp_wwpn == fc_host_port_name(adapter->scsi_host)) |
641 | continue; | 613 | continue; |
642 | 614 | ||
643 | port = zfcp_port_enqueue(adapter, acc->wwpn, | 615 | port = zfcp_port_enqueue(adapter, acc->fp_wwpn, |
644 | ZFCP_STATUS_COMMON_NOESC, d_id); | 616 | ZFCP_STATUS_COMMON_NOESC, d_id); |
645 | if (!IS_ERR(port)) | 617 | if (!IS_ERR(port)) |
646 | zfcp_erp_port_reopen(port, 0, "fcegpf1", NULL); | 618 | zfcp_erp_port_reopen(port, 0, "fcegpf1", NULL); |
@@ -672,13 +644,13 @@ void zfcp_fc_scan_ports(struct work_struct *work) | |||
672 | struct zfcp_adapter *adapter = container_of(work, struct zfcp_adapter, | 644 | struct zfcp_adapter *adapter = container_of(work, struct zfcp_adapter, |
673 | scan_work); | 645 | scan_work); |
674 | int ret, i; | 646 | int ret, i; |
675 | struct zfcp_gpn_ft *gpn_ft; | 647 | struct zfcp_fc_gpn_ft *gpn_ft; |
676 | int chain, max_entries, buf_num, max_bytes; | 648 | int chain, max_entries, buf_num, max_bytes; |
677 | 649 | ||
678 | chain = adapter->adapter_features & FSF_FEATURE_ELS_CT_CHAINED_SBALS; | 650 | chain = adapter->adapter_features & FSF_FEATURE_ELS_CT_CHAINED_SBALS; |
679 | buf_num = chain ? ZFCP_GPN_FT_BUFFERS : 1; | 651 | buf_num = chain ? ZFCP_FC_GPN_FT_NUM_BUFS : 1; |
680 | max_entries = chain ? ZFCP_GPN_FT_MAX_ENTRIES : ZFCP_GPN_FT_ENTRIES; | 652 | max_entries = chain ? ZFCP_FC_GPN_FT_MAX_ENT : ZFCP_FC_GPN_FT_ENT_PAGE; |
681 | max_bytes = chain ? ZFCP_GPN_FT_MAX_SIZE : ZFCP_CT_SIZE_ONE_PAGE; | 653 | max_bytes = chain ? ZFCP_FC_GPN_FT_MAX_SIZE : ZFCP_FC_CT_SIZE_PAGE; |
682 | 654 | ||
683 | if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT && | 655 | if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT && |
684 | fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPIV) | 656 | fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPIV) |
diff --git a/drivers/s390/scsi/zfcp_fc.h b/drivers/s390/scsi/zfcp_fc.h index 231e231b7fd7..12fc6ebbc244 100644 --- a/drivers/s390/scsi/zfcp_fc.h +++ b/drivers/s390/scsi/zfcp_fc.h | |||
@@ -12,9 +12,89 @@ | |||
12 | 12 | ||
13 | #include <scsi/fc/fc_els.h> | 13 | #include <scsi/fc/fc_els.h> |
14 | #include <scsi/fc/fc_fcp.h> | 14 | #include <scsi/fc/fc_fcp.h> |
15 | #include <scsi/fc/fc_ns.h> | ||
15 | #include <scsi/scsi_cmnd.h> | 16 | #include <scsi/scsi_cmnd.h> |
16 | #include <scsi/scsi_tcq.h> | 17 | #include <scsi/scsi_tcq.h> |
17 | 18 | ||
19 | #define ZFCP_FC_CT_SIZE_PAGE (PAGE_SIZE - sizeof(struct fc_ct_hdr)) | ||
20 | #define ZFCP_FC_GPN_FT_ENT_PAGE (ZFCP_FC_CT_SIZE_PAGE \ | ||
21 | / sizeof(struct fc_gpn_ft_resp)) | ||
22 | #define ZFCP_FC_GPN_FT_NUM_BUFS 4 /* memory pages */ | ||
23 | |||
24 | #define ZFCP_FC_GPN_FT_MAX_SIZE (ZFCP_FC_GPN_FT_NUM_BUFS * PAGE_SIZE \ | ||
25 | - sizeof(struct fc_ct_hdr)) | ||
26 | #define ZFCP_FC_GPN_FT_MAX_ENT (ZFCP_FC_GPN_FT_NUM_BUFS * \ | ||
27 | (ZFCP_FC_GPN_FT_ENT_PAGE + 1)) | ||
28 | |||
29 | /** | ||
30 | * struct zfcp_fc_gid_pn_req - container for ct header plus gid_pn request | ||
31 | * @ct_hdr: FC GS common transport header | ||
32 | * @gid_pn: GID_PN request | ||
33 | */ | ||
34 | struct zfcp_fc_gid_pn_req { | ||
35 | struct fc_ct_hdr ct_hdr; | ||
36 | struct fc_ns_gid_pn gid_pn; | ||
37 | } __packed; | ||
38 | |||
39 | /** | ||
40 | * struct zfcp_fc_gid_pn_resp - container for ct header plus gid_pn response | ||
41 | * @ct_hdr: FC GS common transport header | ||
42 | * @gid_pn: GID_PN response | ||
43 | */ | ||
44 | struct zfcp_fc_gid_pn_resp { | ||
45 | struct fc_ct_hdr ct_hdr; | ||
46 | struct fc_gid_pn_resp gid_pn; | ||
47 | } __packed; | ||
48 | |||
49 | /** | ||
50 | * struct zfcp_fc_gid_pn - everything required in zfcp for gid_pn request | ||
51 | * @ct: data passed to zfcp_fsf for issuing fsf request | ||
52 | * @sg_req: scatterlist entry for request data | ||
53 | * @sg_resp: scatterlist entry for response data | ||
54 | * @gid_pn_req: GID_PN request data | ||
55 | * @gid_pn_resp: GID_PN response data | ||
56 | */ | ||
57 | struct zfcp_fc_gid_pn { | ||
58 | struct zfcp_send_ct ct; | ||
59 | struct scatterlist sg_req; | ||
60 | struct scatterlist sg_resp; | ||
61 | struct zfcp_fc_gid_pn_req gid_pn_req; | ||
62 | struct zfcp_fc_gid_pn_resp gid_pn_resp; | ||
63 | struct zfcp_port *port; | ||
64 | }; | ||
65 | |||
66 | /** | ||
67 | * struct zfcp_fc_gpn_ft - container for ct header plus gpn_ft request | ||
68 | * @ct_hdr: FC GS common transport header | ||
69 | * @gpn_ft: GPN_FT request | ||
70 | */ | ||
71 | struct zfcp_fc_gpn_ft_req { | ||
72 | struct fc_ct_hdr ct_hdr; | ||
73 | struct fc_ns_gid_ft gpn_ft; | ||
74 | } __packed; | ||
75 | |||
76 | /** | ||
77 | * struct zfcp_fc_gpn_ft_resp - container for ct header plus gpn_ft response | ||
78 | * @ct_hdr: FC GS common transport header | ||
79 | * @gpn_ft: Array of gpn_ft response data to fill one memory page | ||
80 | */ | ||
81 | struct zfcp_fc_gpn_ft_resp { | ||
82 | struct fc_ct_hdr ct_hdr; | ||
83 | struct fc_gpn_ft_resp gpn_ft[ZFCP_FC_GPN_FT_ENT_PAGE]; | ||
84 | } __packed; | ||
85 | |||
86 | /** | ||
87 | * struct zfcp_fc_gpn_ft - zfcp data for gpn_ft request | ||
88 | * @ct: data passed to zfcp_fsf for issuing fsf request | ||
89 | * @sg_req: scatter list entry for gpn_ft request | ||
90 | * @sg_resp: scatter list entries for gpn_ft responses (per memory page) | ||
91 | */ | ||
92 | struct zfcp_fc_gpn_ft { | ||
93 | struct zfcp_send_ct ct; | ||
94 | struct scatterlist sg_req; | ||
95 | struct scatterlist sg_resp[ZFCP_FC_GPN_FT_NUM_BUFS]; | ||
96 | }; | ||
97 | |||
18 | /** | 98 | /** |
19 | * struct zfcp_fc_els_adisc - everything required in zfcp for issuing ELS ADISC | 99 | * struct zfcp_fc_els_adisc - everything required in zfcp for issuing ELS ADISC |
20 | * @els: data required for issuing els fsf command | 100 | * @els: data required for issuing els fsf command |