Commit | Line | Data |
---|---|---|
24073b47 CS |
1 | /* |
2 | * zfcp device driver | |
3 | * | |
4 | * Fibre Channel related functions for the zfcp device driver. | |
5 | * | |
a2fa0aed | 6 | * Copyright IBM Corporation 2008, 2009 |
24073b47 CS |
7 | */ |
8 | ||
ecf39d42 CS |
9 | #define KMSG_COMPONENT "zfcp" |
10 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | |
11 | ||
24073b47 CS |
12 | #include "zfcp_ext.h" |
13 | ||
e0d7fcb5 CS |
14 | enum rscn_address_format { |
15 | RSCN_PORT_ADDRESS = 0x0, | |
16 | RSCN_AREA_ADDRESS = 0x1, | |
17 | RSCN_DOMAIN_ADDRESS = 0x2, | |
18 | RSCN_FABRIC_ADDRESS = 0x3, | |
19 | }; | |
20 | ||
21 | static u32 rscn_range_mask[] = { | |
22 | [RSCN_PORT_ADDRESS] = 0xFFFFFF, | |
23 | [RSCN_AREA_ADDRESS] = 0xFFFF00, | |
24 | [RSCN_DOMAIN_ADDRESS] = 0xFF0000, | |
25 | [RSCN_FABRIC_ADDRESS] = 0x000000, | |
26 | }; | |
27 | ||
cc8c2829 SS |
28 | struct gpn_ft_resp_acc { |
29 | u8 control; | |
30 | u8 port_id[3]; | |
31 | u8 reserved[4]; | |
32 | u64 wwpn; | |
33 | } __attribute__ ((packed)); | |
34 | ||
39eb7e9a CS |
35 | #define ZFCP_CT_SIZE_ONE_PAGE (PAGE_SIZE - sizeof(struct ct_hdr)) |
36 | #define ZFCP_GPN_FT_ENTRIES (ZFCP_CT_SIZE_ONE_PAGE \ | |
37 | / sizeof(struct gpn_ft_resp_acc)) | |
cc8c2829 | 38 | #define ZFCP_GPN_FT_BUFFERS 4 |
39eb7e9a CS |
39 | #define ZFCP_GPN_FT_MAX_SIZE (ZFCP_GPN_FT_BUFFERS * PAGE_SIZE \ |
40 | - sizeof(struct ct_hdr)) | |
cc8c2829 SS |
41 | #define ZFCP_GPN_FT_MAX_ENTRIES ZFCP_GPN_FT_BUFFERS * (ZFCP_GPN_FT_ENTRIES + 1) |
42 | ||
43 | struct ct_iu_gpn_ft_resp { | |
44 | struct ct_hdr header; | |
45 | struct gpn_ft_resp_acc accept[ZFCP_GPN_FT_ENTRIES]; | |
46 | } __attribute__ ((packed)); | |
47 | ||
48 | struct zfcp_gpn_ft { | |
49 | struct zfcp_send_ct ct; | |
50 | struct scatterlist sg_req; | |
51 | struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS]; | |
52 | }; | |
53 | ||
5ab944f9 SS |
54 | struct zfcp_fc_ns_handler_data { |
55 | struct completion done; | |
56 | void (*handler)(unsigned long); | |
57 | unsigned long handler_data; | |
58 | }; | |
59 | ||
6f53a2d2 | 60 | static int zfcp_fc_wka_port_get(struct zfcp_wka_port *wka_port) |
5ab944f9 SS |
61 | { |
62 | if (mutex_lock_interruptible(&wka_port->mutex)) | |
63 | return -ERESTARTSYS; | |
64 | ||
1c1cba17 CS |
65 | if (wka_port->status == ZFCP_WKA_PORT_OFFLINE || |
66 | wka_port->status == ZFCP_WKA_PORT_CLOSING) { | |
5ab944f9 SS |
67 | wka_port->status = ZFCP_WKA_PORT_OPENING; |
68 | if (zfcp_fsf_open_wka_port(wka_port)) | |
69 | wka_port->status = ZFCP_WKA_PORT_OFFLINE; | |
70 | } | |
71 | ||
72 | mutex_unlock(&wka_port->mutex); | |
73 | ||
27f492cc SS |
74 | wait_event(wka_port->completion_wq, |
75 | wka_port->status == ZFCP_WKA_PORT_ONLINE || | |
76 | wka_port->status == ZFCP_WKA_PORT_OFFLINE); | |
5ab944f9 SS |
77 | |
78 | if (wka_port->status == ZFCP_WKA_PORT_ONLINE) { | |
79 | atomic_inc(&wka_port->refcount); | |
80 | return 0; | |
81 | } | |
82 | return -EIO; | |
83 | } | |
84 | ||
6f53a2d2 | 85 | static void zfcp_fc_wka_port_offline(struct work_struct *work) |
5ab944f9 | 86 | { |
bf6aede7 | 87 | struct delayed_work *dw = to_delayed_work(work); |
5ab944f9 SS |
88 | struct zfcp_wka_port *wka_port = |
89 | container_of(dw, struct zfcp_wka_port, work); | |
90 | ||
5ab944f9 SS |
91 | mutex_lock(&wka_port->mutex); |
92 | if ((atomic_read(&wka_port->refcount) != 0) || | |
93 | (wka_port->status != ZFCP_WKA_PORT_ONLINE)) | |
94 | goto out; | |
95 | ||
96 | wka_port->status = ZFCP_WKA_PORT_CLOSING; | |
97 | if (zfcp_fsf_close_wka_port(wka_port)) { | |
98 | wka_port->status = ZFCP_WKA_PORT_OFFLINE; | |
99 | wake_up(&wka_port->completion_wq); | |
100 | } | |
101 | out: | |
102 | mutex_unlock(&wka_port->mutex); | |
103 | } | |
104 | ||
6f53a2d2 | 105 | static void zfcp_fc_wka_port_put(struct zfcp_wka_port *wka_port) |
5ab944f9 SS |
106 | { |
107 | if (atomic_dec_return(&wka_port->refcount) != 0) | |
108 | return; | |
19af5cdb | 109 | /* wait 10 milliseconds, other reqs might pop in */ |
5ab944f9 SS |
110 | schedule_delayed_work(&wka_port->work, HZ / 100); |
111 | } | |
112 | ||
9d544f2b SS |
113 | static void zfcp_fc_wka_port_init(struct zfcp_wka_port *wka_port, u32 d_id, |
114 | struct zfcp_adapter *adapter) | |
5ab944f9 | 115 | { |
5ab944f9 SS |
116 | init_waitqueue_head(&wka_port->completion_wq); |
117 | ||
118 | wka_port->adapter = adapter; | |
9d544f2b | 119 | wka_port->d_id = d_id; |
5ab944f9 SS |
120 | |
121 | wka_port->status = ZFCP_WKA_PORT_OFFLINE; | |
122 | atomic_set(&wka_port->refcount, 0); | |
123 | mutex_init(&wka_port->mutex); | |
6f53a2d2 | 124 | INIT_DELAYED_WORK(&wka_port->work, zfcp_fc_wka_port_offline); |
5ab944f9 SS |
125 | } |
126 | ||
55c770fa | 127 | static void zfcp_fc_wka_port_force_offline(struct zfcp_wka_port *wka) |
828bc121 SS |
128 | { |
129 | cancel_delayed_work_sync(&wka->work); | |
130 | mutex_lock(&wka->mutex); | |
131 | wka->status = ZFCP_WKA_PORT_OFFLINE; | |
132 | mutex_unlock(&wka->mutex); | |
133 | } | |
134 | ||
55c770fa CS |
135 | void zfcp_fc_wka_ports_force_offline(struct zfcp_wka_ports *gs) |
136 | { | |
f3450c7b SS |
137 | if (!gs) |
138 | return; | |
55c770fa CS |
139 | zfcp_fc_wka_port_force_offline(&gs->ms); |
140 | zfcp_fc_wka_port_force_offline(&gs->ts); | |
141 | zfcp_fc_wka_port_force_offline(&gs->ds); | |
142 | zfcp_fc_wka_port_force_offline(&gs->as); | |
143 | zfcp_fc_wka_port_force_offline(&gs->ks); | |
144 | } | |
145 | ||
24073b47 CS |
146 | static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, |
147 | struct fcp_rscn_element *elem) | |
148 | { | |
149 | unsigned long flags; | |
ecf0c772 | 150 | struct zfcp_adapter *adapter = fsf_req->adapter; |
24073b47 CS |
151 | struct zfcp_port *port; |
152 | ||
ecf0c772 SS |
153 | read_lock_irqsave(&adapter->port_list_lock, flags); |
154 | list_for_each_entry(port, &adapter->port_list, list) { | |
24095490 | 155 | if ((port->d_id & range) == (elem->nport_did & range)) |
6f53a2d2 | 156 | zfcp_fc_test_link(port); |
ea460a81 SS |
157 | if (!port->d_id) |
158 | zfcp_erp_port_reopen(port, | |
159 | ZFCP_STATUS_COMMON_ERP_FAILED, | |
160 | "fcrscn1", NULL); | |
161 | } | |
ecf0c772 | 162 | read_unlock_irqrestore(&adapter->port_list_lock, flags); |
24073b47 CS |
163 | } |
164 | ||
165 | static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req) | |
166 | { | |
167 | struct fsf_status_read_buffer *status_buffer = (void *)fsf_req->data; | |
168 | struct fcp_rscn_head *fcp_rscn_head; | |
169 | struct fcp_rscn_element *fcp_rscn_element; | |
170 | u16 i; | |
171 | u16 no_entries; | |
172 | u32 range_mask; | |
173 | ||
c41f8cbd SS |
174 | fcp_rscn_head = (struct fcp_rscn_head *) status_buffer->payload.data; |
175 | fcp_rscn_element = (struct fcp_rscn_element *) fcp_rscn_head; | |
24073b47 CS |
176 | |
177 | /* see FC-FS */ | |
178 | no_entries = fcp_rscn_head->payload_len / | |
179 | sizeof(struct fcp_rscn_element); | |
180 | ||
181 | for (i = 1; i < no_entries; i++) { | |
182 | /* skip head and start with 1st element */ | |
183 | fcp_rscn_element++; | |
e0d7fcb5 | 184 | range_mask = rscn_range_mask[fcp_rscn_element->addr_format]; |
24073b47 CS |
185 | _zfcp_fc_incoming_rscn(fsf_req, range_mask, fcp_rscn_element); |
186 | } | |
cc8c2829 | 187 | schedule_work(&fsf_req->adapter->scan_work); |
24073b47 CS |
188 | } |
189 | ||
7ba58c9c | 190 | static void zfcp_fc_incoming_wwpn(struct zfcp_fsf_req *req, u64 wwpn) |
24073b47 | 191 | { |
ecf0c772 | 192 | unsigned long flags; |
24073b47 CS |
193 | struct zfcp_adapter *adapter = req->adapter; |
194 | struct zfcp_port *port; | |
24073b47 | 195 | |
ecf0c772 SS |
196 | read_lock_irqsave(&adapter->port_list_lock, flags); |
197 | list_for_each_entry(port, &adapter->port_list, list) | |
198 | if (port->wwpn == wwpn) { | |
199 | zfcp_erp_port_forced_reopen(port, 0, "fciwwp1", req); | |
24073b47 | 200 | break; |
ecf0c772 SS |
201 | } |
202 | read_unlock_irqrestore(&adapter->port_list_lock, flags); | |
24073b47 CS |
203 | } |
204 | ||
205 | static void zfcp_fc_incoming_plogi(struct zfcp_fsf_req *req) | |
206 | { | |
207 | struct fsf_status_read_buffer *status_buffer = | |
208 | (struct fsf_status_read_buffer *)req->data; | |
209 | struct fsf_plogi *els_plogi = | |
c41f8cbd | 210 | (struct fsf_plogi *) status_buffer->payload.data; |
24073b47 CS |
211 | |
212 | zfcp_fc_incoming_wwpn(req, els_plogi->serv_param.wwpn); | |
213 | } | |
214 | ||
215 | static void zfcp_fc_incoming_logo(struct zfcp_fsf_req *req) | |
216 | { | |
217 | struct fsf_status_read_buffer *status_buffer = | |
218 | (struct fsf_status_read_buffer *)req->data; | |
c41f8cbd SS |
219 | struct fcp_logo *els_logo = |
220 | (struct fcp_logo *) status_buffer->payload.data; | |
24073b47 CS |
221 | |
222 | zfcp_fc_incoming_wwpn(req, els_logo->nport_wwpn); | |
223 | } | |
224 | ||
225 | /** | |
226 | * zfcp_fc_incoming_els - handle incoming ELS | |
227 | * @fsf_req - request which contains incoming ELS | |
228 | */ | |
229 | void zfcp_fc_incoming_els(struct zfcp_fsf_req *fsf_req) | |
230 | { | |
231 | struct fsf_status_read_buffer *status_buffer = | |
232 | (struct fsf_status_read_buffer *) fsf_req->data; | |
c41f8cbd | 233 | unsigned int els_type = status_buffer->payload.data[0]; |
24073b47 | 234 | |
5771710b | 235 | zfcp_dbf_san_incoming_els(fsf_req); |
24073b47 CS |
236 | if (els_type == LS_PLOGI) |
237 | zfcp_fc_incoming_plogi(fsf_req); | |
238 | else if (els_type == LS_LOGO) | |
239 | zfcp_fc_incoming_logo(fsf_req); | |
240 | else if (els_type == LS_RSCN) | |
241 | zfcp_fc_incoming_rscn(fsf_req); | |
242 | } | |
243 | ||
5ab944f9 SS |
244 | static void zfcp_fc_ns_handler(unsigned long data) |
245 | { | |
246 | struct zfcp_fc_ns_handler_data *compl_rec = | |
247 | (struct zfcp_fc_ns_handler_data *) data; | |
248 | ||
249 | if (compl_rec->handler) | |
250 | compl_rec->handler(compl_rec->handler_data); | |
251 | ||
252 | complete(&compl_rec->done); | |
253 | } | |
254 | ||
255 | static void zfcp_fc_ns_gid_pn_eval(unsigned long data) | |
24073b47 CS |
256 | { |
257 | struct zfcp_gid_pn_data *gid_pn = (struct zfcp_gid_pn_data *) data; | |
258 | struct zfcp_send_ct *ct = &gid_pn->ct; | |
259 | struct ct_iu_gid_pn_req *ct_iu_req = sg_virt(ct->req); | |
260 | struct ct_iu_gid_pn_resp *ct_iu_resp = sg_virt(ct->resp); | |
261 | struct zfcp_port *port = gid_pn->port; | |
262 | ||
263 | if (ct->status) | |
5ab944f9 | 264 | return; |
a5b11dda | 265 | if (ct_iu_resp->header.cmd_rsp_code != ZFCP_CT_ACCEPT) |
5ab944f9 | 266 | return; |
a5b11dda | 267 | |
24073b47 CS |
268 | /* paranoia */ |
269 | if (ct_iu_req->wwpn != port->wwpn) | |
5ab944f9 | 270 | return; |
24073b47 CS |
271 | /* looks like a valid d_id */ |
272 | port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK; | |
24073b47 CS |
273 | } |
274 | ||
799b76d0 | 275 | static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port, |
5ab944f9 | 276 | struct zfcp_gid_pn_data *gid_pn) |
24073b47 | 277 | { |
799b76d0 | 278 | struct zfcp_adapter *adapter = port->adapter; |
5ab944f9 SS |
279 | struct zfcp_fc_ns_handler_data compl_rec; |
280 | int ret; | |
24073b47 CS |
281 | |
282 | /* setup parameters for send generic command */ | |
799b76d0 | 283 | gid_pn->port = port; |
9d544f2b | 284 | gid_pn->ct.wka_port = &adapter->gs->ds; |
5ab944f9 SS |
285 | gid_pn->ct.handler = zfcp_fc_ns_handler; |
286 | gid_pn->ct.handler_data = (unsigned long) &compl_rec; | |
24073b47 CS |
287 | gid_pn->ct.req = &gid_pn->req; |
288 | gid_pn->ct.resp = &gid_pn->resp; | |
24073b47 CS |
289 | sg_init_one(&gid_pn->req, &gid_pn->ct_iu_req, |
290 | sizeof(struct ct_iu_gid_pn_req)); | |
291 | sg_init_one(&gid_pn->resp, &gid_pn->ct_iu_resp, | |
292 | sizeof(struct ct_iu_gid_pn_resp)); | |
293 | ||
294 | /* setup nameserver request */ | |
295 | gid_pn->ct_iu_req.header.revision = ZFCP_CT_REVISION; | |
296 | gid_pn->ct_iu_req.header.gs_type = ZFCP_CT_DIRECTORY_SERVICE; | |
297 | gid_pn->ct_iu_req.header.gs_subtype = ZFCP_CT_NAME_SERVER; | |
298 | gid_pn->ct_iu_req.header.options = ZFCP_CT_SYNCHRONOUS; | |
299 | gid_pn->ct_iu_req.header.cmd_rsp_code = ZFCP_CT_GID_PN; | |
39eb7e9a | 300 | gid_pn->ct_iu_req.header.max_res_size = ZFCP_CT_SIZE_ONE_PAGE / 4; |
799b76d0 | 301 | gid_pn->ct_iu_req.wwpn = port->wwpn; |
24073b47 | 302 | |
5ab944f9 SS |
303 | init_completion(&compl_rec.done); |
304 | compl_rec.handler = zfcp_fc_ns_gid_pn_eval; | |
305 | compl_rec.handler_data = (unsigned long) gid_pn; | |
799b76d0 | 306 | ret = zfcp_fsf_send_ct(&gid_pn->ct, adapter->pool.gid_pn_req); |
5ab944f9 SS |
307 | if (!ret) |
308 | wait_for_completion(&compl_rec.done); | |
309 | return ret; | |
310 | } | |
311 | ||
312 | /** | |
313 | * zfcp_fc_ns_gid_pn_request - initiate GID_PN nameserver request | |
799b76d0 | 314 | * @port: port where GID_PN request is needed |
5ab944f9 SS |
315 | * return: -ENOMEM on error, 0 otherwise |
316 | */ | |
799b76d0 | 317 | static int zfcp_fc_ns_gid_pn(struct zfcp_port *port) |
5ab944f9 SS |
318 | { |
319 | int ret; | |
320 | struct zfcp_gid_pn_data *gid_pn; | |
799b76d0 | 321 | struct zfcp_adapter *adapter = port->adapter; |
5ab944f9 | 322 | |
a4623c46 | 323 | gid_pn = mempool_alloc(adapter->pool.gid_pn_data, GFP_ATOMIC); |
5ab944f9 SS |
324 | if (!gid_pn) |
325 | return -ENOMEM; | |
326 | ||
327 | memset(gid_pn, 0, sizeof(*gid_pn)); | |
328 | ||
6f53a2d2 | 329 | ret = zfcp_fc_wka_port_get(&adapter->gs->ds); |
24073b47 | 330 | if (ret) |
5ab944f9 SS |
331 | goto out; |
332 | ||
799b76d0 | 333 | ret = zfcp_fc_ns_gid_pn_request(port, gid_pn); |
5ab944f9 | 334 | |
6f53a2d2 | 335 | zfcp_fc_wka_port_put(&adapter->gs->ds); |
5ab944f9 | 336 | out: |
a4623c46 | 337 | mempool_free(gid_pn, adapter->pool.gid_pn_data); |
24073b47 CS |
338 | return ret; |
339 | } | |
340 | ||
799b76d0 CS |
341 | void zfcp_fc_port_did_lookup(struct work_struct *work) |
342 | { | |
343 | int ret; | |
344 | struct zfcp_port *port = container_of(work, struct zfcp_port, | |
345 | gid_pn_work); | |
346 | ||
347 | ret = zfcp_fc_ns_gid_pn(port); | |
348 | if (ret) { | |
349 | /* could not issue gid_pn for some reason */ | |
350 | zfcp_erp_adapter_reopen(port->adapter, 0, "fcgpn_1", NULL); | |
351 | goto out; | |
352 | } | |
353 | ||
354 | if (!port->d_id) { | |
355 | zfcp_erp_port_failed(port, "fcgpn_2", NULL); | |
356 | goto out; | |
357 | } | |
358 | ||
359 | zfcp_erp_port_reopen(port, 0, "fcgpn_3", NULL); | |
360 | out: | |
f3450c7b | 361 | put_device(&port->sysfs_device); |
799b76d0 CS |
362 | } |
363 | ||
934aeb58 CS |
364 | /** |
365 | * zfcp_fc_trigger_did_lookup - trigger the d_id lookup using a GID_PN request | |
366 | * @port: The zfcp_port to lookup the d_id for. | |
367 | */ | |
368 | void zfcp_fc_trigger_did_lookup(struct zfcp_port *port) | |
369 | { | |
f3450c7b | 370 | get_device(&port->sysfs_device); |
934aeb58 | 371 | if (!queue_work(port->adapter->work_queue, &port->gid_pn_work)) |
f3450c7b | 372 | put_device(&port->sysfs_device); |
934aeb58 CS |
373 | } |
374 | ||
24073b47 CS |
375 | /** |
376 | * zfcp_fc_plogi_evaluate - evaluate PLOGI playload | |
377 | * @port: zfcp_port structure | |
378 | * @plogi: plogi payload | |
379 | * | |
380 | * Evaluate PLOGI playload and copy important fields into zfcp_port structure | |
381 | */ | |
382 | void zfcp_fc_plogi_evaluate(struct zfcp_port *port, struct fsf_plogi *plogi) | |
383 | { | |
384 | port->maxframe_size = plogi->serv_param.common_serv_param[7] | | |
385 | ((plogi->serv_param.common_serv_param[6] & 0x0F) << 8); | |
386 | if (plogi->serv_param.class1_serv_param[0] & 0x80) | |
387 | port->supported_classes |= FC_COS_CLASS1; | |
388 | if (plogi->serv_param.class2_serv_param[0] & 0x80) | |
389 | port->supported_classes |= FC_COS_CLASS2; | |
390 | if (plogi->serv_param.class3_serv_param[0] & 0x80) | |
391 | port->supported_classes |= FC_COS_CLASS3; | |
392 | if (plogi->serv_param.class4_serv_param[0] & 0x80) | |
393 | port->supported_classes |= FC_COS_CLASS4; | |
394 | } | |
395 | ||
396 | struct zfcp_els_adisc { | |
397 | struct zfcp_send_els els; | |
398 | struct scatterlist req; | |
399 | struct scatterlist resp; | |
400 | struct zfcp_ls_adisc ls_adisc; | |
44cc76f2 | 401 | struct zfcp_ls_adisc ls_adisc_acc; |
24073b47 CS |
402 | }; |
403 | ||
404 | static void zfcp_fc_adisc_handler(unsigned long data) | |
405 | { | |
406 | struct zfcp_els_adisc *adisc = (struct zfcp_els_adisc *) data; | |
407 | struct zfcp_port *port = adisc->els.port; | |
44cc76f2 | 408 | struct zfcp_ls_adisc *ls_adisc = &adisc->ls_adisc_acc; |
24073b47 | 409 | |
3968ce80 | 410 | if (adisc->els.status) { |
24073b47 | 411 | /* request rejected or timed out */ |
5b43e719 SS |
412 | zfcp_erp_port_forced_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, |
413 | "fcadh_1", NULL); | |
24073b47 CS |
414 | goto out; |
415 | } | |
416 | ||
417 | if (!port->wwnn) | |
418 | port->wwnn = ls_adisc->wwnn; | |
419 | ||
24095490 | 420 | if ((port->wwpn != ls_adisc->wwpn) || |
a2fa0aed | 421 | !(atomic_read(&port->status) & ZFCP_STATUS_COMMON_OPEN)) { |
24095490 SS |
422 | zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, |
423 | "fcadh_2", NULL); | |
a2fa0aed CS |
424 | goto out; |
425 | } | |
24073b47 | 426 | |
a2fa0aed CS |
427 | /* port is good, unblock rport without going through erp */ |
428 | zfcp_scsi_schedule_rport_register(port); | |
24073b47 | 429 | out: |
14e242ea | 430 | atomic_clear_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status); |
f3450c7b | 431 | put_device(&port->sysfs_device); |
24073b47 CS |
432 | kfree(adisc); |
433 | } | |
434 | ||
435 | static int zfcp_fc_adisc(struct zfcp_port *port) | |
436 | { | |
437 | struct zfcp_els_adisc *adisc; | |
438 | struct zfcp_adapter *adapter = port->adapter; | |
439 | ||
440 | adisc = kzalloc(sizeof(struct zfcp_els_adisc), GFP_ATOMIC); | |
441 | if (!adisc) | |
442 | return -ENOMEM; | |
443 | ||
444 | adisc->els.req = &adisc->req; | |
445 | adisc->els.resp = &adisc->resp; | |
446 | sg_init_one(adisc->els.req, &adisc->ls_adisc, | |
447 | sizeof(struct zfcp_ls_adisc)); | |
448 | sg_init_one(adisc->els.resp, &adisc->ls_adisc_acc, | |
44cc76f2 | 449 | sizeof(struct zfcp_ls_adisc)); |
24073b47 | 450 | |
24073b47 CS |
451 | adisc->els.adapter = adapter; |
452 | adisc->els.port = port; | |
453 | adisc->els.d_id = port->d_id; | |
454 | adisc->els.handler = zfcp_fc_adisc_handler; | |
455 | adisc->els.handler_data = (unsigned long) adisc; | |
456 | adisc->els.ls_code = adisc->ls_adisc.code = ZFCP_LS_ADISC; | |
457 | ||
458 | /* acc. to FC-FS, hard_nport_id in ADISC should not be set for ports | |
459 | without FC-AL-2 capability, so we don't set it */ | |
460 | adisc->ls_adisc.wwpn = fc_host_port_name(adapter->scsi_host); | |
461 | adisc->ls_adisc.wwnn = fc_host_node_name(adapter->scsi_host); | |
462 | adisc->ls_adisc.nport_id = fc_host_port_id(adapter->scsi_host); | |
463 | ||
464 | return zfcp_fsf_send_els(&adisc->els); | |
465 | } | |
466 | ||
8fdf30d5 | 467 | void zfcp_fc_link_test_work(struct work_struct *work) |
24073b47 | 468 | { |
8fdf30d5 CS |
469 | struct zfcp_port *port = |
470 | container_of(work, struct zfcp_port, test_link_work); | |
24073b47 CS |
471 | int retval; |
472 | ||
f3450c7b | 473 | get_device(&port->sysfs_device); |
a2fa0aed CS |
474 | port->rport_task = RPORT_DEL; |
475 | zfcp_scsi_rport_work(&port->rport_work); | |
476 | ||
14e242ea CS |
477 | /* only issue one test command at one time per port */ |
478 | if (atomic_read(&port->status) & ZFCP_STATUS_PORT_LINK_TEST) | |
479 | goto out; | |
480 | ||
481 | atomic_set_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status); | |
482 | ||
24073b47 | 483 | retval = zfcp_fc_adisc(port); |
9528539c | 484 | if (retval == 0) |
24073b47 CS |
485 | return; |
486 | ||
487 | /* send of ADISC was not possible */ | |
14e242ea | 488 | atomic_clear_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status); |
a2fa0aed CS |
489 | zfcp_erp_port_forced_reopen(port, 0, "fcltwk1", NULL); |
490 | ||
14e242ea | 491 | out: |
f3450c7b | 492 | put_device(&port->sysfs_device); |
24073b47 | 493 | } |
cc8c2829 | 494 | |
8fdf30d5 | 495 | /** |
6f53a2d2 | 496 | * zfcp_fc_test_link - lightweight link test procedure |
8fdf30d5 CS |
497 | * @port: port to be tested |
498 | * | |
499 | * Test status of a link to a remote port using the ELS command ADISC. | |
500 | * If there is a problem with the remote port, error recovery steps | |
501 | * will be triggered. | |
502 | */ | |
6f53a2d2 | 503 | void zfcp_fc_test_link(struct zfcp_port *port) |
8fdf30d5 | 504 | { |
f3450c7b | 505 | get_device(&port->sysfs_device); |
4544683a | 506 | if (!queue_work(port->adapter->work_queue, &port->test_link_work)) |
f3450c7b | 507 | put_device(&port->sysfs_device); |
8fdf30d5 CS |
508 | } |
509 | ||
39eb7e9a | 510 | static void zfcp_free_sg_env(struct zfcp_gpn_ft *gpn_ft, int buf_num) |
cc8c2829 SS |
511 | { |
512 | struct scatterlist *sg = &gpn_ft->sg_req; | |
513 | ||
a4623c46 | 514 | kmem_cache_free(zfcp_data.gpn_ft_cache, sg_virt(sg)); |
39eb7e9a | 515 | zfcp_sg_free_table(gpn_ft->sg_resp, buf_num); |
cc8c2829 SS |
516 | |
517 | kfree(gpn_ft); | |
518 | } | |
519 | ||
39eb7e9a | 520 | static struct zfcp_gpn_ft *zfcp_alloc_sg_env(int buf_num) |
cc8c2829 SS |
521 | { |
522 | struct zfcp_gpn_ft *gpn_ft; | |
523 | struct ct_iu_gpn_ft_req *req; | |
524 | ||
525 | gpn_ft = kzalloc(sizeof(*gpn_ft), GFP_KERNEL); | |
526 | if (!gpn_ft) | |
527 | return NULL; | |
528 | ||
a4623c46 | 529 | req = kmem_cache_alloc(zfcp_data.gpn_ft_cache, GFP_KERNEL); |
cc8c2829 SS |
530 | if (!req) { |
531 | kfree(gpn_ft); | |
532 | gpn_ft = NULL; | |
533 | goto out; | |
534 | } | |
535 | sg_init_one(&gpn_ft->sg_req, req, sizeof(*req)); | |
536 | ||
39eb7e9a CS |
537 | if (zfcp_sg_setup_table(gpn_ft->sg_resp, buf_num)) { |
538 | zfcp_free_sg_env(gpn_ft, buf_num); | |
cc8c2829 SS |
539 | gpn_ft = NULL; |
540 | } | |
541 | out: | |
542 | return gpn_ft; | |
543 | } | |
544 | ||
545 | ||
6f53a2d2 SS |
546 | static int zfcp_fc_send_gpn_ft(struct zfcp_gpn_ft *gpn_ft, |
547 | struct zfcp_adapter *adapter, int max_bytes) | |
cc8c2829 SS |
548 | { |
549 | struct zfcp_send_ct *ct = &gpn_ft->ct; | |
550 | struct ct_iu_gpn_ft_req *req = sg_virt(&gpn_ft->sg_req); | |
5ab944f9 | 551 | struct zfcp_fc_ns_handler_data compl_rec; |
cc8c2829 SS |
552 | int ret; |
553 | ||
554 | /* prepare CT IU for GPN_FT */ | |
555 | req->header.revision = ZFCP_CT_REVISION; | |
556 | req->header.gs_type = ZFCP_CT_DIRECTORY_SERVICE; | |
557 | req->header.gs_subtype = ZFCP_CT_NAME_SERVER; | |
558 | req->header.options = ZFCP_CT_SYNCHRONOUS; | |
559 | req->header.cmd_rsp_code = ZFCP_CT_GPN_FT; | |
39eb7e9a | 560 | req->header.max_res_size = max_bytes / 4; |
cc8c2829 SS |
561 | req->flags = 0; |
562 | req->domain_id_scope = 0; | |
563 | req->area_id_scope = 0; | |
564 | req->fc4_type = ZFCP_CT_SCSI_FCP; | |
565 | ||
566 | /* prepare zfcp_send_ct */ | |
9d544f2b | 567 | ct->wka_port = &adapter->gs->ds; |
5ab944f9 SS |
568 | ct->handler = zfcp_fc_ns_handler; |
569 | ct->handler_data = (unsigned long)&compl_rec; | |
cc8c2829 SS |
570 | ct->req = &gpn_ft->sg_req; |
571 | ct->resp = gpn_ft->sg_resp; | |
cc8c2829 | 572 | |
5ab944f9 SS |
573 | init_completion(&compl_rec.done); |
574 | compl_rec.handler = NULL; | |
799b76d0 | 575 | ret = zfcp_fsf_send_ct(ct, NULL); |
cc8c2829 | 576 | if (!ret) |
5ab944f9 | 577 | wait_for_completion(&compl_rec.done); |
cc8c2829 SS |
578 | return ret; |
579 | } | |
580 | ||
f3450c7b | 581 | static void zfcp_fc_validate_port(struct zfcp_port *port, struct list_head *lh) |
cc8c2829 | 582 | { |
6ab35c07 MP |
583 | if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_NOESC)) |
584 | return; | |
585 | ||
cc8c2829 SS |
586 | atomic_clear_mask(ZFCP_STATUS_COMMON_NOESC, &port->status); |
587 | ||
0406289e | 588 | if ((port->supported_classes != 0) || |
f3450c7b | 589 | !list_empty(&port->unit_list)) |
cc8c2829 | 590 | return; |
f3450c7b | 591 | |
f3450c7b | 592 | list_move_tail(&port->list, lh); |
cc8c2829 SS |
593 | } |
594 | ||
6f53a2d2 | 595 | static int zfcp_fc_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft, int max_entries) |
cc8c2829 SS |
596 | { |
597 | struct zfcp_send_ct *ct = &gpn_ft->ct; | |
598 | struct scatterlist *sg = gpn_ft->sg_resp; | |
599 | struct ct_hdr *hdr = sg_virt(sg); | |
600 | struct gpn_ft_resp_acc *acc = sg_virt(sg); | |
5ab944f9 | 601 | struct zfcp_adapter *adapter = ct->wka_port->adapter; |
cc8c2829 | 602 | struct zfcp_port *port, *tmp; |
ecf0c772 | 603 | unsigned long flags; |
f3450c7b | 604 | LIST_HEAD(remove_lh); |
cc8c2829 | 605 | u32 d_id; |
47f7bba5 | 606 | int ret = 0, x, last = 0; |
cc8c2829 SS |
607 | |
608 | if (ct->status) | |
609 | return -EIO; | |
610 | ||
611 | if (hdr->cmd_rsp_code != ZFCP_CT_ACCEPT) { | |
612 | if (hdr->reason_code == ZFCP_CT_UNABLE_TO_PERFORM_CMD) | |
613 | return -EAGAIN; /* might be a temporary condition */ | |
614 | return -EIO; | |
615 | } | |
616 | ||
39eb7e9a CS |
617 | if (hdr->max_res_size) { |
618 | dev_warn(&adapter->ccw_device->dev, | |
619 | "The name server reported %d words residual data\n", | |
620 | hdr->max_res_size); | |
cc8c2829 | 621 | return -E2BIG; |
39eb7e9a | 622 | } |
cc8c2829 | 623 | |
cc8c2829 | 624 | /* first entry is the header */ |
39eb7e9a | 625 | for (x = 1; x < max_entries && !last; x++) { |
cc8c2829 SS |
626 | if (x % (ZFCP_GPN_FT_ENTRIES + 1)) |
627 | acc++; | |
628 | else | |
629 | acc = sg_virt(++sg); | |
630 | ||
47f7bba5 | 631 | last = acc->control & 0x80; |
cc8c2829 SS |
632 | d_id = acc->port_id[0] << 16 | acc->port_id[1] << 8 | |
633 | acc->port_id[2]; | |
634 | ||
5ab944f9 SS |
635 | /* don't attach ports with a well known address */ |
636 | if ((d_id & ZFCP_DID_WKA) == ZFCP_DID_WKA) | |
637 | continue; | |
cc8c2829 | 638 | /* skip the adapter's port and known remote ports */ |
9528539c | 639 | if (acc->wwpn == fc_host_port_name(adapter->scsi_host)) |
cc8c2829 SS |
640 | continue; |
641 | ||
642 | port = zfcp_port_enqueue(adapter, acc->wwpn, | |
cc8c2829 | 643 | ZFCP_STATUS_COMMON_NOESC, d_id); |
ecf0c772 | 644 | if (!IS_ERR(port)) |
5ffd51a5 | 645 | zfcp_erp_port_reopen(port, 0, "fcegpf1", NULL); |
ecf0c772 SS |
646 | else if (PTR_ERR(port) != -EEXIST) |
647 | ret = PTR_ERR(port); | |
cc8c2829 SS |
648 | } |
649 | ||
650 | zfcp_erp_wait(adapter); | |
ecf0c772 SS |
651 | write_lock_irqsave(&adapter->port_list_lock, flags); |
652 | list_for_each_entry_safe(port, tmp, &adapter->port_list, list) | |
f3450c7b | 653 | zfcp_fc_validate_port(port, &remove_lh); |
ecf0c772 | 654 | write_unlock_irqrestore(&adapter->port_list_lock, flags); |
f3450c7b SS |
655 | |
656 | list_for_each_entry_safe(port, tmp, &remove_lh, list) { | |
657 | zfcp_erp_port_shutdown(port, 0, "fcegpf2", NULL); | |
658 | zfcp_device_unregister(&port->sysfs_device, | |
659 | &zfcp_sysfs_port_attrs); | |
660 | } | |
661 | ||
cc8c2829 SS |
662 | return ret; |
663 | } | |
664 | ||
665 | /** | |
6f53a2d2 | 666 | * zfcp_fc_scan_ports - scan remote ports and attach new ports |
cc8c2829 SS |
667 | * @adapter: pointer to struct zfcp_adapter |
668 | */ | |
6f53a2d2 | 669 | int zfcp_fc_scan_ports(struct zfcp_adapter *adapter) |
cc8c2829 SS |
670 | { |
671 | int ret, i; | |
672 | struct zfcp_gpn_ft *gpn_ft; | |
39eb7e9a CS |
673 | int chain, max_entries, buf_num, max_bytes; |
674 | ||
675 | chain = adapter->adapter_features & FSF_FEATURE_ELS_CT_CHAINED_SBALS; | |
676 | buf_num = chain ? ZFCP_GPN_FT_BUFFERS : 1; | |
677 | max_entries = chain ? ZFCP_GPN_FT_MAX_ENTRIES : ZFCP_GPN_FT_ENTRIES; | |
678 | max_bytes = chain ? ZFCP_GPN_FT_MAX_SIZE : ZFCP_CT_SIZE_ONE_PAGE; | |
cc8c2829 | 679 | |
306b6edc SS |
680 | if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT && |
681 | fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPIV) | |
cc8c2829 SS |
682 | return 0; |
683 | ||
6f53a2d2 | 684 | ret = zfcp_fc_wka_port_get(&adapter->gs->ds); |
cc8c2829 SS |
685 | if (ret) |
686 | return ret; | |
687 | ||
39eb7e9a | 688 | gpn_ft = zfcp_alloc_sg_env(buf_num); |
5ab944f9 SS |
689 | if (!gpn_ft) { |
690 | ret = -ENOMEM; | |
691 | goto out; | |
692 | } | |
cc8c2829 SS |
693 | |
694 | for (i = 0; i < 3; i++) { | |
6f53a2d2 | 695 | ret = zfcp_fc_send_gpn_ft(gpn_ft, adapter, max_bytes); |
cc8c2829 | 696 | if (!ret) { |
6f53a2d2 | 697 | ret = zfcp_fc_eval_gpn_ft(gpn_ft, max_entries); |
cc8c2829 SS |
698 | if (ret == -EAGAIN) |
699 | ssleep(1); | |
700 | else | |
701 | break; | |
702 | } | |
703 | } | |
39eb7e9a | 704 | zfcp_free_sg_env(gpn_ft, buf_num); |
5ab944f9 | 705 | out: |
6f53a2d2 | 706 | zfcp_fc_wka_port_put(&adapter->gs->ds); |
cc8c2829 SS |
707 | return ret; |
708 | } | |
709 | ||
710 | ||
6f53a2d2 | 711 | void _zfcp_fc_scan_ports_later(struct work_struct *work) |
cc8c2829 | 712 | { |
6f53a2d2 | 713 | zfcp_fc_scan_ports(container_of(work, struct zfcp_adapter, scan_work)); |
cc8c2829 | 714 | } |
9d544f2b SS |
715 | |
716 | struct zfcp_els_fc_job { | |
717 | struct zfcp_send_els els; | |
718 | struct fc_bsg_job *job; | |
719 | }; | |
720 | ||
721 | static void zfcp_fc_generic_els_handler(unsigned long data) | |
722 | { | |
723 | struct zfcp_els_fc_job *els_fc_job = (struct zfcp_els_fc_job *) data; | |
724 | struct fc_bsg_job *job = els_fc_job->job; | |
725 | struct fc_bsg_reply *reply = job->reply; | |
726 | ||
727 | if (els_fc_job->els.status) { | |
728 | /* request rejected or timed out */ | |
729 | reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_REJECT; | |
730 | goto out; | |
731 | } | |
732 | ||
733 | reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK; | |
dc577d55 | 734 | reply->reply_payload_rcv_len = job->reply_payload.payload_len; |
9d544f2b SS |
735 | |
736 | out: | |
737 | job->state_flags = FC_RQST_STATE_DONE; | |
738 | job->job_done(job); | |
739 | kfree(els_fc_job); | |
740 | } | |
741 | ||
742 | int zfcp_fc_execute_els_fc_job(struct fc_bsg_job *job) | |
743 | { | |
744 | struct zfcp_els_fc_job *els_fc_job; | |
745 | struct fc_rport *rport = job->rport; | |
746 | struct Scsi_Host *shost; | |
747 | struct zfcp_adapter *adapter; | |
748 | struct zfcp_port *port; | |
749 | u8 *port_did; | |
750 | ||
751 | shost = rport ? rport_to_shost(rport) : job->shost; | |
752 | adapter = (struct zfcp_adapter *)shost->hostdata[0]; | |
753 | ||
754 | if (!(atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_OPEN)) | |
755 | return -EINVAL; | |
756 | ||
757 | els_fc_job = kzalloc(sizeof(struct zfcp_els_fc_job), GFP_KERNEL); | |
758 | if (!els_fc_job) | |
759 | return -ENOMEM; | |
760 | ||
761 | els_fc_job->els.adapter = adapter; | |
762 | if (rport) { | |
ea945ff8 | 763 | port = zfcp_get_port_by_wwpn(adapter, rport->port_name); |
9d544f2b SS |
764 | if (!port) { |
765 | kfree(els_fc_job); | |
766 | return -EINVAL; | |
767 | } | |
ecf0c772 SS |
768 | |
769 | els_fc_job->els.d_id = port->d_id; | |
f3450c7b | 770 | put_device(&port->sysfs_device); |
9d544f2b SS |
771 | } else { |
772 | port_did = job->request->rqst_data.h_els.port_id; | |
773 | els_fc_job->els.d_id = (port_did[0] << 16) + | |
774 | (port_did[1] << 8) + port_did[2]; | |
775 | } | |
776 | ||
777 | els_fc_job->els.req = job->request_payload.sg_list; | |
778 | els_fc_job->els.resp = job->reply_payload.sg_list; | |
779 | els_fc_job->els.handler = zfcp_fc_generic_els_handler; | |
780 | els_fc_job->els.handler_data = (unsigned long) els_fc_job; | |
781 | els_fc_job->job = job; | |
782 | ||
783 | return zfcp_fsf_send_els(&els_fc_job->els); | |
784 | } | |
785 | ||
786 | struct zfcp_ct_fc_job { | |
787 | struct zfcp_send_ct ct; | |
788 | struct fc_bsg_job *job; | |
789 | }; | |
790 | ||
791 | static void zfcp_fc_generic_ct_handler(unsigned long data) | |
792 | { | |
793 | struct zfcp_ct_fc_job *ct_fc_job = (struct zfcp_ct_fc_job *) data; | |
794 | struct fc_bsg_job *job = ct_fc_job->job; | |
795 | ||
796 | job->reply->reply_data.ctels_reply.status = ct_fc_job->ct.status ? | |
797 | FC_CTELS_STATUS_REJECT : FC_CTELS_STATUS_OK; | |
dc577d55 | 798 | job->reply->reply_payload_rcv_len = job->reply_payload.payload_len; |
9d544f2b | 799 | job->state_flags = FC_RQST_STATE_DONE; |
9d544f2b SS |
800 | job->job_done(job); |
801 | ||
6f53a2d2 | 802 | zfcp_fc_wka_port_put(ct_fc_job->ct.wka_port); |
9d544f2b SS |
803 | |
804 | kfree(ct_fc_job); | |
805 | } | |
806 | ||
807 | int zfcp_fc_execute_ct_fc_job(struct fc_bsg_job *job) | |
808 | { | |
809 | int ret; | |
810 | u8 gs_type; | |
811 | struct fc_rport *rport = job->rport; | |
812 | struct Scsi_Host *shost; | |
813 | struct zfcp_adapter *adapter; | |
814 | struct zfcp_ct_fc_job *ct_fc_job; | |
815 | u32 preamble_word1; | |
816 | ||
817 | shost = rport ? rport_to_shost(rport) : job->shost; | |
818 | ||
819 | adapter = (struct zfcp_adapter *)shost->hostdata[0]; | |
820 | if (!(atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_OPEN)) | |
821 | return -EINVAL; | |
822 | ||
823 | ct_fc_job = kzalloc(sizeof(struct zfcp_ct_fc_job), GFP_KERNEL); | |
824 | if (!ct_fc_job) | |
825 | return -ENOMEM; | |
826 | ||
827 | preamble_word1 = job->request->rqst_data.r_ct.preamble_word1; | |
828 | gs_type = (preamble_word1 & 0xff000000) >> 24; | |
829 | ||
830 | switch (gs_type) { | |
831 | case FC_FST_ALIAS: | |
832 | ct_fc_job->ct.wka_port = &adapter->gs->as; | |
833 | break; | |
834 | case FC_FST_MGMT: | |
835 | ct_fc_job->ct.wka_port = &adapter->gs->ms; | |
836 | break; | |
837 | case FC_FST_TIME: | |
838 | ct_fc_job->ct.wka_port = &adapter->gs->ts; | |
839 | break; | |
840 | case FC_FST_DIR: | |
841 | ct_fc_job->ct.wka_port = &adapter->gs->ds; | |
842 | break; | |
843 | default: | |
844 | kfree(ct_fc_job); | |
845 | return -EINVAL; /* no such service */ | |
846 | } | |
847 | ||
6f53a2d2 | 848 | ret = zfcp_fc_wka_port_get(ct_fc_job->ct.wka_port); |
9d544f2b SS |
849 | if (ret) { |
850 | kfree(ct_fc_job); | |
851 | return ret; | |
852 | } | |
853 | ||
854 | ct_fc_job->ct.req = job->request_payload.sg_list; | |
855 | ct_fc_job->ct.resp = job->reply_payload.sg_list; | |
9d544f2b SS |
856 | ct_fc_job->ct.handler = zfcp_fc_generic_ct_handler; |
857 | ct_fc_job->ct.handler_data = (unsigned long) ct_fc_job; | |
858 | ct_fc_job->ct.completion = NULL; | |
859 | ct_fc_job->job = job; | |
860 | ||
799b76d0 | 861 | ret = zfcp_fsf_send_ct(&ct_fc_job->ct, NULL); |
9d544f2b SS |
862 | if (ret) { |
863 | kfree(ct_fc_job); | |
6f53a2d2 | 864 | zfcp_fc_wka_port_put(ct_fc_job->ct.wka_port); |
9d544f2b SS |
865 | } |
866 | return ret; | |
867 | } | |
d5a282a1 SS |
868 | |
869 | int zfcp_fc_gs_setup(struct zfcp_adapter *adapter) | |
870 | { | |
871 | struct zfcp_wka_ports *wka_ports; | |
872 | ||
873 | wka_ports = kzalloc(sizeof(struct zfcp_wka_ports), GFP_KERNEL); | |
874 | if (!wka_ports) | |
875 | return -ENOMEM; | |
876 | ||
877 | adapter->gs = wka_ports; | |
878 | zfcp_fc_wka_port_init(&wka_ports->ms, FC_FID_MGMT_SERV, adapter); | |
879 | zfcp_fc_wka_port_init(&wka_ports->ts, FC_FID_TIME_SERV, adapter); | |
880 | zfcp_fc_wka_port_init(&wka_ports->ds, FC_FID_DIR_SERV, adapter); | |
881 | zfcp_fc_wka_port_init(&wka_ports->as, FC_FID_ALIASES, adapter); | |
882 | zfcp_fc_wka_port_init(&wka_ports->ks, FC_FID_SEC_KEY, adapter); | |
883 | ||
884 | return 0; | |
885 | } | |
886 | ||
887 | void zfcp_fc_gs_destroy(struct zfcp_adapter *adapter) | |
888 | { | |
889 | kfree(adapter->gs); | |
890 | adapter->gs = NULL; | |
891 | } | |
892 |