1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * zfcp device driver
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Interface to Linux SCSI midlayer.
6*4882a593Smuzhiyun *
7*4882a593Smuzhiyun * Copyright IBM Corp. 2002, 2020
8*4882a593Smuzhiyun */
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun #define KMSG_COMPONENT "zfcp"
11*4882a593Smuzhiyun #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun #include <linux/module.h>
14*4882a593Smuzhiyun #include <linux/types.h>
15*4882a593Smuzhiyun #include <linux/slab.h>
16*4882a593Smuzhiyun #include <scsi/fc/fc_fcp.h>
17*4882a593Smuzhiyun #include <scsi/scsi_eh.h>
18*4882a593Smuzhiyun #include <linux/atomic.h>
19*4882a593Smuzhiyun #include "zfcp_ext.h"
20*4882a593Smuzhiyun #include "zfcp_dbf.h"
21*4882a593Smuzhiyun #include "zfcp_fc.h"
22*4882a593Smuzhiyun #include "zfcp_reqlist.h"
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun static unsigned int default_depth = 32;
25*4882a593Smuzhiyun module_param_named(queue_depth, default_depth, uint, 0600);
26*4882a593Smuzhiyun MODULE_PARM_DESC(queue_depth, "Default queue depth for new SCSI devices");
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun static bool enable_dif;
29*4882a593Smuzhiyun module_param_named(dif, enable_dif, bool, 0400);
30*4882a593Smuzhiyun MODULE_PARM_DESC(dif, "Enable DIF data integrity support (default off)");
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun bool zfcp_experimental_dix;
33*4882a593Smuzhiyun module_param_named(dix, zfcp_experimental_dix, bool, 0400);
34*4882a593Smuzhiyun MODULE_PARM_DESC(dix, "Enable experimental DIX (data integrity extension) support which implies DIF support (default off)");
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun static bool allow_lun_scan = true;
37*4882a593Smuzhiyun module_param(allow_lun_scan, bool, 0600);
38*4882a593Smuzhiyun MODULE_PARM_DESC(allow_lun_scan, "For NPIV, scan and attach all storage LUNs");
39*4882a593Smuzhiyun
zfcp_scsi_slave_destroy(struct scsi_device * sdev)40*4882a593Smuzhiyun static void zfcp_scsi_slave_destroy(struct scsi_device *sdev)
41*4882a593Smuzhiyun {
42*4882a593Smuzhiyun struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun /* if previous slave_alloc returned early, there is nothing to do */
45*4882a593Smuzhiyun if (!zfcp_sdev->port)
46*4882a593Smuzhiyun return;
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun zfcp_erp_lun_shutdown_wait(sdev, "scssd_1");
49*4882a593Smuzhiyun put_device(&zfcp_sdev->port->dev);
50*4882a593Smuzhiyun }
51*4882a593Smuzhiyun
zfcp_scsi_slave_configure(struct scsi_device * sdp)52*4882a593Smuzhiyun static int zfcp_scsi_slave_configure(struct scsi_device *sdp)
53*4882a593Smuzhiyun {
54*4882a593Smuzhiyun if (sdp->tagged_supported)
55*4882a593Smuzhiyun scsi_change_queue_depth(sdp, default_depth);
56*4882a593Smuzhiyun return 0;
57*4882a593Smuzhiyun }
58*4882a593Smuzhiyun
zfcp_scsi_command_fail(struct scsi_cmnd * scpnt,int result)59*4882a593Smuzhiyun static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
60*4882a593Smuzhiyun {
61*4882a593Smuzhiyun set_host_byte(scpnt, result);
62*4882a593Smuzhiyun zfcp_dbf_scsi_fail_send(scpnt);
63*4882a593Smuzhiyun scpnt->scsi_done(scpnt);
64*4882a593Smuzhiyun }
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun static
zfcp_scsi_queuecommand(struct Scsi_Host * shost,struct scsi_cmnd * scpnt)67*4882a593Smuzhiyun int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt)
68*4882a593Smuzhiyun {
69*4882a593Smuzhiyun struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
70*4882a593Smuzhiyun struct fc_rport *rport = starget_to_rport(scsi_target(scpnt->device));
71*4882a593Smuzhiyun int status, scsi_result, ret;
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun /* reset the status for this request */
74*4882a593Smuzhiyun scpnt->result = 0;
75*4882a593Smuzhiyun scpnt->host_scribble = NULL;
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun scsi_result = fc_remote_port_chkready(rport);
78*4882a593Smuzhiyun if (unlikely(scsi_result)) {
79*4882a593Smuzhiyun scpnt->result = scsi_result;
80*4882a593Smuzhiyun zfcp_dbf_scsi_fail_send(scpnt);
81*4882a593Smuzhiyun scpnt->scsi_done(scpnt);
82*4882a593Smuzhiyun return 0;
83*4882a593Smuzhiyun }
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun status = atomic_read(&zfcp_sdev->status);
86*4882a593Smuzhiyun if (unlikely(status & ZFCP_STATUS_COMMON_ERP_FAILED) &&
87*4882a593Smuzhiyun !(atomic_read(&zfcp_sdev->port->status) &
88*4882a593Smuzhiyun ZFCP_STATUS_COMMON_ERP_FAILED)) {
89*4882a593Smuzhiyun /* only LUN access denied, but port is good
90*4882a593Smuzhiyun * not covered by FC transport, have to fail here */
91*4882a593Smuzhiyun zfcp_scsi_command_fail(scpnt, DID_ERROR);
92*4882a593Smuzhiyun return 0;
93*4882a593Smuzhiyun }
94*4882a593Smuzhiyun
95*4882a593Smuzhiyun if (unlikely(!(status & ZFCP_STATUS_COMMON_UNBLOCKED))) {
96*4882a593Smuzhiyun /* This could be
97*4882a593Smuzhiyun * call to rport_delete pending: mimic retry from
98*4882a593Smuzhiyun * fc_remote_port_chkready until rport is BLOCKED
99*4882a593Smuzhiyun */
100*4882a593Smuzhiyun zfcp_scsi_command_fail(scpnt, DID_IMM_RETRY);
101*4882a593Smuzhiyun return 0;
102*4882a593Smuzhiyun }
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun ret = zfcp_fsf_fcp_cmnd(scpnt);
105*4882a593Smuzhiyun if (unlikely(ret == -EBUSY))
106*4882a593Smuzhiyun return SCSI_MLQUEUE_DEVICE_BUSY;
107*4882a593Smuzhiyun else if (unlikely(ret < 0))
108*4882a593Smuzhiyun return SCSI_MLQUEUE_HOST_BUSY;
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun return ret;
111*4882a593Smuzhiyun }
112*4882a593Smuzhiyun
zfcp_scsi_slave_alloc(struct scsi_device * sdev)113*4882a593Smuzhiyun static int zfcp_scsi_slave_alloc(struct scsi_device *sdev)
114*4882a593Smuzhiyun {
115*4882a593Smuzhiyun struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
116*4882a593Smuzhiyun struct zfcp_adapter *adapter =
117*4882a593Smuzhiyun (struct zfcp_adapter *) sdev->host->hostdata[0];
118*4882a593Smuzhiyun struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
119*4882a593Smuzhiyun struct zfcp_port *port;
120*4882a593Smuzhiyun struct zfcp_unit *unit;
121*4882a593Smuzhiyun int npiv = adapter->connection_features & FSF_FEATURE_NPIV_MODE;
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun zfcp_sdev->erp_action.adapter = adapter;
124*4882a593Smuzhiyun zfcp_sdev->erp_action.sdev = sdev;
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun port = zfcp_get_port_by_wwpn(adapter, rport->port_name);
127*4882a593Smuzhiyun if (!port)
128*4882a593Smuzhiyun return -ENXIO;
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun zfcp_sdev->erp_action.port = port;
131*4882a593Smuzhiyun
132*4882a593Smuzhiyun mutex_lock(&zfcp_sysfs_port_units_mutex);
133*4882a593Smuzhiyun if (zfcp_sysfs_port_is_removing(port)) {
134*4882a593Smuzhiyun /* port is already gone */
135*4882a593Smuzhiyun mutex_unlock(&zfcp_sysfs_port_units_mutex);
136*4882a593Smuzhiyun put_device(&port->dev); /* undo zfcp_get_port_by_wwpn() */
137*4882a593Smuzhiyun return -ENXIO;
138*4882a593Smuzhiyun }
139*4882a593Smuzhiyun mutex_unlock(&zfcp_sysfs_port_units_mutex);
140*4882a593Smuzhiyun
141*4882a593Smuzhiyun unit = zfcp_unit_find(port, zfcp_scsi_dev_lun(sdev));
142*4882a593Smuzhiyun if (unit)
143*4882a593Smuzhiyun put_device(&unit->dev);
144*4882a593Smuzhiyun
145*4882a593Smuzhiyun if (!unit && !(allow_lun_scan && npiv)) {
146*4882a593Smuzhiyun put_device(&port->dev);
147*4882a593Smuzhiyun return -ENXIO;
148*4882a593Smuzhiyun }
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun zfcp_sdev->port = port;
151*4882a593Smuzhiyun zfcp_sdev->latencies.write.channel.min = 0xFFFFFFFF;
152*4882a593Smuzhiyun zfcp_sdev->latencies.write.fabric.min = 0xFFFFFFFF;
153*4882a593Smuzhiyun zfcp_sdev->latencies.read.channel.min = 0xFFFFFFFF;
154*4882a593Smuzhiyun zfcp_sdev->latencies.read.fabric.min = 0xFFFFFFFF;
155*4882a593Smuzhiyun zfcp_sdev->latencies.cmd.channel.min = 0xFFFFFFFF;
156*4882a593Smuzhiyun zfcp_sdev->latencies.cmd.fabric.min = 0xFFFFFFFF;
157*4882a593Smuzhiyun spin_lock_init(&zfcp_sdev->latencies.lock);
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_RUNNING);
160*4882a593Smuzhiyun zfcp_erp_lun_reopen(sdev, 0, "scsla_1");
161*4882a593Smuzhiyun zfcp_erp_wait(port->adapter);
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun return 0;
164*4882a593Smuzhiyun }
165*4882a593Smuzhiyun
zfcp_scsi_eh_abort_handler(struct scsi_cmnd * scpnt)166*4882a593Smuzhiyun static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
167*4882a593Smuzhiyun {
168*4882a593Smuzhiyun struct Scsi_Host *scsi_host = scpnt->device->host;
169*4882a593Smuzhiyun struct zfcp_adapter *adapter =
170*4882a593Smuzhiyun (struct zfcp_adapter *) scsi_host->hostdata[0];
171*4882a593Smuzhiyun struct zfcp_fsf_req *old_req, *abrt_req;
172*4882a593Smuzhiyun unsigned long flags;
173*4882a593Smuzhiyun unsigned long old_reqid = (unsigned long) scpnt->host_scribble;
174*4882a593Smuzhiyun int retval = SUCCESS, ret;
175*4882a593Smuzhiyun int retry = 3;
176*4882a593Smuzhiyun char *dbf_tag;
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun /* avoid race condition between late normal completion and abort */
179*4882a593Smuzhiyun write_lock_irqsave(&adapter->abort_lock, flags);
180*4882a593Smuzhiyun
181*4882a593Smuzhiyun old_req = zfcp_reqlist_find(adapter->req_list, old_reqid);
182*4882a593Smuzhiyun if (!old_req) {
183*4882a593Smuzhiyun write_unlock_irqrestore(&adapter->abort_lock, flags);
184*4882a593Smuzhiyun zfcp_dbf_scsi_abort("abrt_or", scpnt, NULL);
185*4882a593Smuzhiyun return FAILED; /* completion could be in progress */
186*4882a593Smuzhiyun }
187*4882a593Smuzhiyun old_req->data = NULL;
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun /* don't access old fsf_req after releasing the abort_lock */
190*4882a593Smuzhiyun write_unlock_irqrestore(&adapter->abort_lock, flags);
191*4882a593Smuzhiyun
192*4882a593Smuzhiyun while (retry--) {
193*4882a593Smuzhiyun abrt_req = zfcp_fsf_abort_fcp_cmnd(scpnt);
194*4882a593Smuzhiyun if (abrt_req)
195*4882a593Smuzhiyun break;
196*4882a593Smuzhiyun
197*4882a593Smuzhiyun zfcp_dbf_scsi_abort("abrt_wt", scpnt, NULL);
198*4882a593Smuzhiyun zfcp_erp_wait(adapter);
199*4882a593Smuzhiyun ret = fc_block_scsi_eh(scpnt);
200*4882a593Smuzhiyun if (ret) {
201*4882a593Smuzhiyun zfcp_dbf_scsi_abort("abrt_bl", scpnt, NULL);
202*4882a593Smuzhiyun return ret;
203*4882a593Smuzhiyun }
204*4882a593Smuzhiyun if (!(atomic_read(&adapter->status) &
205*4882a593Smuzhiyun ZFCP_STATUS_COMMON_RUNNING)) {
206*4882a593Smuzhiyun zfcp_dbf_scsi_abort("abrt_ru", scpnt, NULL);
207*4882a593Smuzhiyun return SUCCESS;
208*4882a593Smuzhiyun }
209*4882a593Smuzhiyun }
210*4882a593Smuzhiyun if (!abrt_req) {
211*4882a593Smuzhiyun zfcp_dbf_scsi_abort("abrt_ar", scpnt, NULL);
212*4882a593Smuzhiyun return FAILED;
213*4882a593Smuzhiyun }
214*4882a593Smuzhiyun
215*4882a593Smuzhiyun wait_for_completion(&abrt_req->completion);
216*4882a593Smuzhiyun
217*4882a593Smuzhiyun if (abrt_req->status & ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED)
218*4882a593Smuzhiyun dbf_tag = "abrt_ok";
219*4882a593Smuzhiyun else if (abrt_req->status & ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED)
220*4882a593Smuzhiyun dbf_tag = "abrt_nn";
221*4882a593Smuzhiyun else {
222*4882a593Smuzhiyun dbf_tag = "abrt_fa";
223*4882a593Smuzhiyun retval = FAILED;
224*4882a593Smuzhiyun }
225*4882a593Smuzhiyun zfcp_dbf_scsi_abort(dbf_tag, scpnt, abrt_req);
226*4882a593Smuzhiyun zfcp_fsf_req_free(abrt_req);
227*4882a593Smuzhiyun return retval;
228*4882a593Smuzhiyun }
229*4882a593Smuzhiyun
230*4882a593Smuzhiyun struct zfcp_scsi_req_filter {
231*4882a593Smuzhiyun u8 tmf_scope;
232*4882a593Smuzhiyun u32 lun_handle;
233*4882a593Smuzhiyun u32 port_handle;
234*4882a593Smuzhiyun };
235*4882a593Smuzhiyun
zfcp_scsi_forget_cmnd(struct zfcp_fsf_req * old_req,void * data)236*4882a593Smuzhiyun static void zfcp_scsi_forget_cmnd(struct zfcp_fsf_req *old_req, void *data)
237*4882a593Smuzhiyun {
238*4882a593Smuzhiyun struct zfcp_scsi_req_filter *filter =
239*4882a593Smuzhiyun (struct zfcp_scsi_req_filter *)data;
240*4882a593Smuzhiyun
241*4882a593Smuzhiyun /* already aborted - prevent side-effects - or not a SCSI command */
242*4882a593Smuzhiyun if (old_req->data == NULL ||
243*4882a593Smuzhiyun zfcp_fsf_req_is_status_read_buffer(old_req) ||
244*4882a593Smuzhiyun old_req->qtcb->header.fsf_command != FSF_QTCB_FCP_CMND)
245*4882a593Smuzhiyun return;
246*4882a593Smuzhiyun
247*4882a593Smuzhiyun /* (tmf_scope == FCP_TMF_TGT_RESET || tmf_scope == FCP_TMF_LUN_RESET) */
248*4882a593Smuzhiyun if (old_req->qtcb->header.port_handle != filter->port_handle)
249*4882a593Smuzhiyun return;
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun if (filter->tmf_scope == FCP_TMF_LUN_RESET &&
252*4882a593Smuzhiyun old_req->qtcb->header.lun_handle != filter->lun_handle)
253*4882a593Smuzhiyun return;
254*4882a593Smuzhiyun
255*4882a593Smuzhiyun zfcp_dbf_scsi_nullcmnd((struct scsi_cmnd *)old_req->data, old_req);
256*4882a593Smuzhiyun old_req->data = NULL;
257*4882a593Smuzhiyun }
258*4882a593Smuzhiyun
zfcp_scsi_forget_cmnds(struct zfcp_scsi_dev * zsdev,u8 tm_flags)259*4882a593Smuzhiyun static void zfcp_scsi_forget_cmnds(struct zfcp_scsi_dev *zsdev, u8 tm_flags)
260*4882a593Smuzhiyun {
261*4882a593Smuzhiyun struct zfcp_adapter *adapter = zsdev->port->adapter;
262*4882a593Smuzhiyun struct zfcp_scsi_req_filter filter = {
263*4882a593Smuzhiyun .tmf_scope = FCP_TMF_TGT_RESET,
264*4882a593Smuzhiyun .port_handle = zsdev->port->handle,
265*4882a593Smuzhiyun };
266*4882a593Smuzhiyun unsigned long flags;
267*4882a593Smuzhiyun
268*4882a593Smuzhiyun if (tm_flags == FCP_TMF_LUN_RESET) {
269*4882a593Smuzhiyun filter.tmf_scope = FCP_TMF_LUN_RESET;
270*4882a593Smuzhiyun filter.lun_handle = zsdev->lun_handle;
271*4882a593Smuzhiyun }
272*4882a593Smuzhiyun
273*4882a593Smuzhiyun /*
274*4882a593Smuzhiyun * abort_lock secures against other processings - in the abort-function
275*4882a593Smuzhiyun * and normal cmnd-handler - of (struct zfcp_fsf_req *)->data
276*4882a593Smuzhiyun */
277*4882a593Smuzhiyun write_lock_irqsave(&adapter->abort_lock, flags);
278*4882a593Smuzhiyun zfcp_reqlist_apply_for_all(adapter->req_list, zfcp_scsi_forget_cmnd,
279*4882a593Smuzhiyun &filter);
280*4882a593Smuzhiyun write_unlock_irqrestore(&adapter->abort_lock, flags);
281*4882a593Smuzhiyun }
282*4882a593Smuzhiyun
283*4882a593Smuzhiyun /**
284*4882a593Smuzhiyun * zfcp_scsi_task_mgmt_function() - Send a task management function (sync).
285*4882a593Smuzhiyun * @sdev: Pointer to SCSI device to send the task management command to.
286*4882a593Smuzhiyun * @tm_flags: Task management flags,
287*4882a593Smuzhiyun * here we only handle %FCP_TMF_TGT_RESET or %FCP_TMF_LUN_RESET.
288*4882a593Smuzhiyun */
zfcp_scsi_task_mgmt_function(struct scsi_device * sdev,u8 tm_flags)289*4882a593Smuzhiyun static int zfcp_scsi_task_mgmt_function(struct scsi_device *sdev, u8 tm_flags)
290*4882a593Smuzhiyun {
291*4882a593Smuzhiyun struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
292*4882a593Smuzhiyun struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
293*4882a593Smuzhiyun struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
294*4882a593Smuzhiyun struct zfcp_fsf_req *fsf_req = NULL;
295*4882a593Smuzhiyun int retval = SUCCESS, ret;
296*4882a593Smuzhiyun int retry = 3;
297*4882a593Smuzhiyun
298*4882a593Smuzhiyun while (retry--) {
299*4882a593Smuzhiyun fsf_req = zfcp_fsf_fcp_task_mgmt(sdev, tm_flags);
300*4882a593Smuzhiyun if (fsf_req)
301*4882a593Smuzhiyun break;
302*4882a593Smuzhiyun
303*4882a593Smuzhiyun zfcp_dbf_scsi_devreset("wait", sdev, tm_flags, NULL);
304*4882a593Smuzhiyun zfcp_erp_wait(adapter);
305*4882a593Smuzhiyun ret = fc_block_rport(rport);
306*4882a593Smuzhiyun if (ret) {
307*4882a593Smuzhiyun zfcp_dbf_scsi_devreset("fiof", sdev, tm_flags, NULL);
308*4882a593Smuzhiyun return ret;
309*4882a593Smuzhiyun }
310*4882a593Smuzhiyun
311*4882a593Smuzhiyun if (!(atomic_read(&adapter->status) &
312*4882a593Smuzhiyun ZFCP_STATUS_COMMON_RUNNING)) {
313*4882a593Smuzhiyun zfcp_dbf_scsi_devreset("nres", sdev, tm_flags, NULL);
314*4882a593Smuzhiyun return SUCCESS;
315*4882a593Smuzhiyun }
316*4882a593Smuzhiyun }
317*4882a593Smuzhiyun if (!fsf_req) {
318*4882a593Smuzhiyun zfcp_dbf_scsi_devreset("reqf", sdev, tm_flags, NULL);
319*4882a593Smuzhiyun return FAILED;
320*4882a593Smuzhiyun }
321*4882a593Smuzhiyun
322*4882a593Smuzhiyun wait_for_completion(&fsf_req->completion);
323*4882a593Smuzhiyun
324*4882a593Smuzhiyun if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCFAILED) {
325*4882a593Smuzhiyun zfcp_dbf_scsi_devreset("fail", sdev, tm_flags, fsf_req);
326*4882a593Smuzhiyun retval = FAILED;
327*4882a593Smuzhiyun } else {
328*4882a593Smuzhiyun zfcp_dbf_scsi_devreset("okay", sdev, tm_flags, fsf_req);
329*4882a593Smuzhiyun zfcp_scsi_forget_cmnds(zfcp_sdev, tm_flags);
330*4882a593Smuzhiyun }
331*4882a593Smuzhiyun
332*4882a593Smuzhiyun zfcp_fsf_req_free(fsf_req);
333*4882a593Smuzhiyun return retval;
334*4882a593Smuzhiyun }
335*4882a593Smuzhiyun
zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd * scpnt)336*4882a593Smuzhiyun static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
337*4882a593Smuzhiyun {
338*4882a593Smuzhiyun struct scsi_device *sdev = scpnt->device;
339*4882a593Smuzhiyun
340*4882a593Smuzhiyun return zfcp_scsi_task_mgmt_function(sdev, FCP_TMF_LUN_RESET);
341*4882a593Smuzhiyun }
342*4882a593Smuzhiyun
zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd * scpnt)343*4882a593Smuzhiyun static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
344*4882a593Smuzhiyun {
345*4882a593Smuzhiyun struct scsi_target *starget = scsi_target(scpnt->device);
346*4882a593Smuzhiyun struct fc_rport *rport = starget_to_rport(starget);
347*4882a593Smuzhiyun struct Scsi_Host *shost = rport_to_shost(rport);
348*4882a593Smuzhiyun struct scsi_device *sdev = NULL, *tmp_sdev;
349*4882a593Smuzhiyun struct zfcp_adapter *adapter =
350*4882a593Smuzhiyun (struct zfcp_adapter *)shost->hostdata[0];
351*4882a593Smuzhiyun int ret;
352*4882a593Smuzhiyun
353*4882a593Smuzhiyun shost_for_each_device(tmp_sdev, shost) {
354*4882a593Smuzhiyun if (tmp_sdev->id == starget->id) {
355*4882a593Smuzhiyun sdev = tmp_sdev;
356*4882a593Smuzhiyun break;
357*4882a593Smuzhiyun }
358*4882a593Smuzhiyun }
359*4882a593Smuzhiyun if (!sdev) {
360*4882a593Smuzhiyun ret = FAILED;
361*4882a593Smuzhiyun zfcp_dbf_scsi_eh("tr_nosd", adapter, starget->id, ret);
362*4882a593Smuzhiyun return ret;
363*4882a593Smuzhiyun }
364*4882a593Smuzhiyun
365*4882a593Smuzhiyun ret = zfcp_scsi_task_mgmt_function(sdev, FCP_TMF_TGT_RESET);
366*4882a593Smuzhiyun
367*4882a593Smuzhiyun /* release reference from above shost_for_each_device */
368*4882a593Smuzhiyun if (sdev)
369*4882a593Smuzhiyun scsi_device_put(tmp_sdev);
370*4882a593Smuzhiyun
371*4882a593Smuzhiyun return ret;
372*4882a593Smuzhiyun }
373*4882a593Smuzhiyun
zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd * scpnt)374*4882a593Smuzhiyun static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
375*4882a593Smuzhiyun {
376*4882a593Smuzhiyun struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
377*4882a593Smuzhiyun struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
378*4882a593Smuzhiyun int ret = SUCCESS, fc_ret;
379*4882a593Smuzhiyun
380*4882a593Smuzhiyun if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE)) {
381*4882a593Smuzhiyun zfcp_erp_port_forced_reopen_all(adapter, 0, "schrh_p");
382*4882a593Smuzhiyun zfcp_erp_wait(adapter);
383*4882a593Smuzhiyun }
384*4882a593Smuzhiyun zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
385*4882a593Smuzhiyun zfcp_erp_wait(adapter);
386*4882a593Smuzhiyun fc_ret = fc_block_scsi_eh(scpnt);
387*4882a593Smuzhiyun if (fc_ret)
388*4882a593Smuzhiyun ret = fc_ret;
389*4882a593Smuzhiyun
390*4882a593Smuzhiyun zfcp_dbf_scsi_eh("schrh_r", adapter, ~0, ret);
391*4882a593Smuzhiyun return ret;
392*4882a593Smuzhiyun }
393*4882a593Smuzhiyun
394*4882a593Smuzhiyun /**
395*4882a593Smuzhiyun * zfcp_scsi_sysfs_host_reset() - Support scsi_host sysfs attribute host_reset.
396*4882a593Smuzhiyun * @shost: Pointer to Scsi_Host to perform action on.
397*4882a593Smuzhiyun * @reset_type: We support %SCSI_ADAPTER_RESET but not %SCSI_FIRMWARE_RESET.
398*4882a593Smuzhiyun *
399*4882a593Smuzhiyun * Return: 0 on %SCSI_ADAPTER_RESET, -%EOPNOTSUPP otherwise.
400*4882a593Smuzhiyun *
401*4882a593Smuzhiyun * This is similar to zfcp_sysfs_adapter_failed_store().
402*4882a593Smuzhiyun */
zfcp_scsi_sysfs_host_reset(struct Scsi_Host * shost,int reset_type)403*4882a593Smuzhiyun static int zfcp_scsi_sysfs_host_reset(struct Scsi_Host *shost, int reset_type)
404*4882a593Smuzhiyun {
405*4882a593Smuzhiyun struct zfcp_adapter *adapter =
406*4882a593Smuzhiyun (struct zfcp_adapter *)shost->hostdata[0];
407*4882a593Smuzhiyun int ret = 0;
408*4882a593Smuzhiyun
409*4882a593Smuzhiyun if (reset_type != SCSI_ADAPTER_RESET) {
410*4882a593Smuzhiyun ret = -EOPNOTSUPP;
411*4882a593Smuzhiyun zfcp_dbf_scsi_eh("scshr_n", adapter, ~0, ret);
412*4882a593Smuzhiyun return ret;
413*4882a593Smuzhiyun }
414*4882a593Smuzhiyun
415*4882a593Smuzhiyun zfcp_erp_adapter_reset_sync(adapter, "scshr_y");
416*4882a593Smuzhiyun return ret;
417*4882a593Smuzhiyun }
418*4882a593Smuzhiyun
419*4882a593Smuzhiyun struct scsi_transport_template *zfcp_scsi_transport_template;
420*4882a593Smuzhiyun
421*4882a593Smuzhiyun static struct scsi_host_template zfcp_scsi_host_template = {
422*4882a593Smuzhiyun .module = THIS_MODULE,
423*4882a593Smuzhiyun .name = "zfcp",
424*4882a593Smuzhiyun .queuecommand = zfcp_scsi_queuecommand,
425*4882a593Smuzhiyun .eh_timed_out = fc_eh_timed_out,
426*4882a593Smuzhiyun .eh_abort_handler = zfcp_scsi_eh_abort_handler,
427*4882a593Smuzhiyun .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler,
428*4882a593Smuzhiyun .eh_target_reset_handler = zfcp_scsi_eh_target_reset_handler,
429*4882a593Smuzhiyun .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler,
430*4882a593Smuzhiyun .slave_alloc = zfcp_scsi_slave_alloc,
431*4882a593Smuzhiyun .slave_configure = zfcp_scsi_slave_configure,
432*4882a593Smuzhiyun .slave_destroy = zfcp_scsi_slave_destroy,
433*4882a593Smuzhiyun .change_queue_depth = scsi_change_queue_depth,
434*4882a593Smuzhiyun .host_reset = zfcp_scsi_sysfs_host_reset,
435*4882a593Smuzhiyun .proc_name = "zfcp",
436*4882a593Smuzhiyun .can_queue = 4096,
437*4882a593Smuzhiyun .this_id = -1,
438*4882a593Smuzhiyun .sg_tablesize = (((QDIO_MAX_ELEMENTS_PER_BUFFER - 1)
439*4882a593Smuzhiyun * ZFCP_QDIO_MAX_SBALS_PER_REQ) - 2),
440*4882a593Smuzhiyun /* GCD, adjusted later */
441*4882a593Smuzhiyun .max_sectors = (((QDIO_MAX_ELEMENTS_PER_BUFFER - 1)
442*4882a593Smuzhiyun * ZFCP_QDIO_MAX_SBALS_PER_REQ) - 2) * 8,
443*4882a593Smuzhiyun /* GCD, adjusted later */
444*4882a593Smuzhiyun /* report size limit per scatter-gather segment */
445*4882a593Smuzhiyun .max_segment_size = ZFCP_QDIO_SBALE_LEN,
446*4882a593Smuzhiyun .dma_boundary = ZFCP_QDIO_SBALE_LEN - 1,
447*4882a593Smuzhiyun .shost_attrs = zfcp_sysfs_shost_attrs,
448*4882a593Smuzhiyun .sdev_attrs = zfcp_sysfs_sdev_attrs,
449*4882a593Smuzhiyun .track_queue_depth = 1,
450*4882a593Smuzhiyun .supported_mode = MODE_INITIATOR,
451*4882a593Smuzhiyun };
452*4882a593Smuzhiyun
453*4882a593Smuzhiyun /**
454*4882a593Smuzhiyun * zfcp_scsi_adapter_register() - Allocate and register SCSI and FC host with
455*4882a593Smuzhiyun * SCSI midlayer
456*4882a593Smuzhiyun * @adapter: The zfcp adapter to register with the SCSI midlayer
457*4882a593Smuzhiyun *
458*4882a593Smuzhiyun * Allocates the SCSI host object for the given adapter, sets basic properties
459*4882a593Smuzhiyun * (such as the transport template, QDIO limits, ...), and registers it with
460*4882a593Smuzhiyun * the midlayer.
461*4882a593Smuzhiyun *
462*4882a593Smuzhiyun * During registration with the midlayer the corresponding FC host object for
463*4882a593Smuzhiyun * the referenced transport class is also implicitely allocated.
464*4882a593Smuzhiyun *
465*4882a593Smuzhiyun * Upon success adapter->scsi_host is set, and upon failure it remains NULL. If
466*4882a593Smuzhiyun * adapter->scsi_host is already set, nothing is done.
467*4882a593Smuzhiyun *
468*4882a593Smuzhiyun * Return:
469*4882a593Smuzhiyun * * 0 - Allocation and registration was successful
470*4882a593Smuzhiyun * * -EEXIST - SCSI and FC host did already exist, nothing was done, nothing
471*4882a593Smuzhiyun * was changed
472*4882a593Smuzhiyun * * -EIO - Allocation or registration failed
473*4882a593Smuzhiyun */
zfcp_scsi_adapter_register(struct zfcp_adapter * adapter)474*4882a593Smuzhiyun int zfcp_scsi_adapter_register(struct zfcp_adapter *adapter)
475*4882a593Smuzhiyun {
476*4882a593Smuzhiyun struct ccw_dev_id dev_id;
477*4882a593Smuzhiyun
478*4882a593Smuzhiyun if (adapter->scsi_host)
479*4882a593Smuzhiyun return -EEXIST;
480*4882a593Smuzhiyun
481*4882a593Smuzhiyun ccw_device_get_id(adapter->ccw_device, &dev_id);
482*4882a593Smuzhiyun /* register adapter as SCSI host with mid layer of SCSI stack */
483*4882a593Smuzhiyun adapter->scsi_host = scsi_host_alloc(&zfcp_scsi_host_template,
484*4882a593Smuzhiyun sizeof (struct zfcp_adapter *));
485*4882a593Smuzhiyun if (!adapter->scsi_host)
486*4882a593Smuzhiyun goto err_out;
487*4882a593Smuzhiyun
488*4882a593Smuzhiyun /* tell the SCSI stack some characteristics of this adapter */
489*4882a593Smuzhiyun adapter->scsi_host->max_id = 511;
490*4882a593Smuzhiyun adapter->scsi_host->max_lun = 0xFFFFFFFF;
491*4882a593Smuzhiyun adapter->scsi_host->max_channel = 0;
492*4882a593Smuzhiyun adapter->scsi_host->unique_id = dev_id.devno;
493*4882a593Smuzhiyun adapter->scsi_host->max_cmd_len = 16; /* in struct fcp_cmnd */
494*4882a593Smuzhiyun adapter->scsi_host->transportt = zfcp_scsi_transport_template;
495*4882a593Smuzhiyun
496*4882a593Smuzhiyun /* make all basic properties known at registration time */
497*4882a593Smuzhiyun zfcp_qdio_shost_update(adapter, adapter->qdio);
498*4882a593Smuzhiyun zfcp_scsi_set_prot(adapter);
499*4882a593Smuzhiyun
500*4882a593Smuzhiyun adapter->scsi_host->hostdata[0] = (unsigned long) adapter;
501*4882a593Smuzhiyun
502*4882a593Smuzhiyun if (scsi_add_host(adapter->scsi_host, &adapter->ccw_device->dev)) {
503*4882a593Smuzhiyun scsi_host_put(adapter->scsi_host);
504*4882a593Smuzhiyun goto err_out;
505*4882a593Smuzhiyun }
506*4882a593Smuzhiyun
507*4882a593Smuzhiyun return 0;
508*4882a593Smuzhiyun err_out:
509*4882a593Smuzhiyun adapter->scsi_host = NULL;
510*4882a593Smuzhiyun dev_err(&adapter->ccw_device->dev,
511*4882a593Smuzhiyun "Registering the FCP device with the SCSI stack failed\n");
512*4882a593Smuzhiyun return -EIO;
513*4882a593Smuzhiyun }
514*4882a593Smuzhiyun
515*4882a593Smuzhiyun /**
516*4882a593Smuzhiyun * zfcp_scsi_adapter_unregister - Unregister SCSI and FC host from SCSI midlayer
517*4882a593Smuzhiyun * @adapter: The zfcp adapter to unregister.
518*4882a593Smuzhiyun */
zfcp_scsi_adapter_unregister(struct zfcp_adapter * adapter)519*4882a593Smuzhiyun void zfcp_scsi_adapter_unregister(struct zfcp_adapter *adapter)
520*4882a593Smuzhiyun {
521*4882a593Smuzhiyun struct Scsi_Host *shost;
522*4882a593Smuzhiyun struct zfcp_port *port;
523*4882a593Smuzhiyun
524*4882a593Smuzhiyun shost = adapter->scsi_host;
525*4882a593Smuzhiyun if (!shost)
526*4882a593Smuzhiyun return;
527*4882a593Smuzhiyun
528*4882a593Smuzhiyun read_lock_irq(&adapter->port_list_lock);
529*4882a593Smuzhiyun list_for_each_entry(port, &adapter->port_list, list)
530*4882a593Smuzhiyun port->rport = NULL;
531*4882a593Smuzhiyun read_unlock_irq(&adapter->port_list_lock);
532*4882a593Smuzhiyun
533*4882a593Smuzhiyun fc_remove_host(shost);
534*4882a593Smuzhiyun scsi_remove_host(shost);
535*4882a593Smuzhiyun scsi_host_put(shost);
536*4882a593Smuzhiyun adapter->scsi_host = NULL;
537*4882a593Smuzhiyun }
538*4882a593Smuzhiyun
539*4882a593Smuzhiyun static struct fc_host_statistics*
zfcp_scsi_init_fc_host_stats(struct zfcp_adapter * adapter)540*4882a593Smuzhiyun zfcp_scsi_init_fc_host_stats(struct zfcp_adapter *adapter)
541*4882a593Smuzhiyun {
542*4882a593Smuzhiyun struct fc_host_statistics *fc_stats;
543*4882a593Smuzhiyun
544*4882a593Smuzhiyun if (!adapter->fc_stats) {
545*4882a593Smuzhiyun fc_stats = kmalloc(sizeof(*fc_stats), GFP_KERNEL);
546*4882a593Smuzhiyun if (!fc_stats)
547*4882a593Smuzhiyun return NULL;
548*4882a593Smuzhiyun adapter->fc_stats = fc_stats; /* freed in adapter_release */
549*4882a593Smuzhiyun }
550*4882a593Smuzhiyun memset(adapter->fc_stats, 0, sizeof(*adapter->fc_stats));
551*4882a593Smuzhiyun return adapter->fc_stats;
552*4882a593Smuzhiyun }
553*4882a593Smuzhiyun
zfcp_scsi_adjust_fc_host_stats(struct fc_host_statistics * fc_stats,struct fsf_qtcb_bottom_port * data,struct fsf_qtcb_bottom_port * old)554*4882a593Smuzhiyun static void zfcp_scsi_adjust_fc_host_stats(struct fc_host_statistics *fc_stats,
555*4882a593Smuzhiyun struct fsf_qtcb_bottom_port *data,
556*4882a593Smuzhiyun struct fsf_qtcb_bottom_port *old)
557*4882a593Smuzhiyun {
558*4882a593Smuzhiyun fc_stats->seconds_since_last_reset =
559*4882a593Smuzhiyun data->seconds_since_last_reset - old->seconds_since_last_reset;
560*4882a593Smuzhiyun fc_stats->tx_frames = data->tx_frames - old->tx_frames;
561*4882a593Smuzhiyun fc_stats->tx_words = data->tx_words - old->tx_words;
562*4882a593Smuzhiyun fc_stats->rx_frames = data->rx_frames - old->rx_frames;
563*4882a593Smuzhiyun fc_stats->rx_words = data->rx_words - old->rx_words;
564*4882a593Smuzhiyun fc_stats->lip_count = data->lip - old->lip;
565*4882a593Smuzhiyun fc_stats->nos_count = data->nos - old->nos;
566*4882a593Smuzhiyun fc_stats->error_frames = data->error_frames - old->error_frames;
567*4882a593Smuzhiyun fc_stats->dumped_frames = data->dumped_frames - old->dumped_frames;
568*4882a593Smuzhiyun fc_stats->link_failure_count = data->link_failure - old->link_failure;
569*4882a593Smuzhiyun fc_stats->loss_of_sync_count = data->loss_of_sync - old->loss_of_sync;
570*4882a593Smuzhiyun fc_stats->loss_of_signal_count =
571*4882a593Smuzhiyun data->loss_of_signal - old->loss_of_signal;
572*4882a593Smuzhiyun fc_stats->prim_seq_protocol_err_count =
573*4882a593Smuzhiyun data->psp_error_counts - old->psp_error_counts;
574*4882a593Smuzhiyun fc_stats->invalid_tx_word_count =
575*4882a593Smuzhiyun data->invalid_tx_words - old->invalid_tx_words;
576*4882a593Smuzhiyun fc_stats->invalid_crc_count = data->invalid_crcs - old->invalid_crcs;
577*4882a593Smuzhiyun fc_stats->fcp_input_requests =
578*4882a593Smuzhiyun data->input_requests - old->input_requests;
579*4882a593Smuzhiyun fc_stats->fcp_output_requests =
580*4882a593Smuzhiyun data->output_requests - old->output_requests;
581*4882a593Smuzhiyun fc_stats->fcp_control_requests =
582*4882a593Smuzhiyun data->control_requests - old->control_requests;
583*4882a593Smuzhiyun fc_stats->fcp_input_megabytes = data->input_mb - old->input_mb;
584*4882a593Smuzhiyun fc_stats->fcp_output_megabytes = data->output_mb - old->output_mb;
585*4882a593Smuzhiyun }
586*4882a593Smuzhiyun
zfcp_scsi_set_fc_host_stats(struct fc_host_statistics * fc_stats,struct fsf_qtcb_bottom_port * data)587*4882a593Smuzhiyun static void zfcp_scsi_set_fc_host_stats(struct fc_host_statistics *fc_stats,
588*4882a593Smuzhiyun struct fsf_qtcb_bottom_port *data)
589*4882a593Smuzhiyun {
590*4882a593Smuzhiyun fc_stats->seconds_since_last_reset = data->seconds_since_last_reset;
591*4882a593Smuzhiyun fc_stats->tx_frames = data->tx_frames;
592*4882a593Smuzhiyun fc_stats->tx_words = data->tx_words;
593*4882a593Smuzhiyun fc_stats->rx_frames = data->rx_frames;
594*4882a593Smuzhiyun fc_stats->rx_words = data->rx_words;
595*4882a593Smuzhiyun fc_stats->lip_count = data->lip;
596*4882a593Smuzhiyun fc_stats->nos_count = data->nos;
597*4882a593Smuzhiyun fc_stats->error_frames = data->error_frames;
598*4882a593Smuzhiyun fc_stats->dumped_frames = data->dumped_frames;
599*4882a593Smuzhiyun fc_stats->link_failure_count = data->link_failure;
600*4882a593Smuzhiyun fc_stats->loss_of_sync_count = data->loss_of_sync;
601*4882a593Smuzhiyun fc_stats->loss_of_signal_count = data->loss_of_signal;
602*4882a593Smuzhiyun fc_stats->prim_seq_protocol_err_count = data->psp_error_counts;
603*4882a593Smuzhiyun fc_stats->invalid_tx_word_count = data->invalid_tx_words;
604*4882a593Smuzhiyun fc_stats->invalid_crc_count = data->invalid_crcs;
605*4882a593Smuzhiyun fc_stats->fcp_input_requests = data->input_requests;
606*4882a593Smuzhiyun fc_stats->fcp_output_requests = data->output_requests;
607*4882a593Smuzhiyun fc_stats->fcp_control_requests = data->control_requests;
608*4882a593Smuzhiyun fc_stats->fcp_input_megabytes = data->input_mb;
609*4882a593Smuzhiyun fc_stats->fcp_output_megabytes = data->output_mb;
610*4882a593Smuzhiyun }
611*4882a593Smuzhiyun
612*4882a593Smuzhiyun static struct fc_host_statistics *
zfcp_scsi_get_fc_host_stats(struct Scsi_Host * host)613*4882a593Smuzhiyun zfcp_scsi_get_fc_host_stats(struct Scsi_Host *host)
614*4882a593Smuzhiyun {
615*4882a593Smuzhiyun struct zfcp_adapter *adapter;
616*4882a593Smuzhiyun struct fc_host_statistics *fc_stats;
617*4882a593Smuzhiyun struct fsf_qtcb_bottom_port *data;
618*4882a593Smuzhiyun int ret;
619*4882a593Smuzhiyun
620*4882a593Smuzhiyun adapter = (struct zfcp_adapter *)host->hostdata[0];
621*4882a593Smuzhiyun fc_stats = zfcp_scsi_init_fc_host_stats(adapter);
622*4882a593Smuzhiyun if (!fc_stats)
623*4882a593Smuzhiyun return NULL;
624*4882a593Smuzhiyun
625*4882a593Smuzhiyun data = kzalloc(sizeof(*data), GFP_KERNEL);
626*4882a593Smuzhiyun if (!data)
627*4882a593Smuzhiyun return NULL;
628*4882a593Smuzhiyun
629*4882a593Smuzhiyun ret = zfcp_fsf_exchange_port_data_sync(adapter->qdio, data);
630*4882a593Smuzhiyun if (ret != 0 && ret != -EAGAIN) {
631*4882a593Smuzhiyun kfree(data);
632*4882a593Smuzhiyun return NULL;
633*4882a593Smuzhiyun }
634*4882a593Smuzhiyun
635*4882a593Smuzhiyun if (adapter->stats_reset &&
636*4882a593Smuzhiyun ((jiffies/HZ - adapter->stats_reset) <
637*4882a593Smuzhiyun data->seconds_since_last_reset))
638*4882a593Smuzhiyun zfcp_scsi_adjust_fc_host_stats(fc_stats, data,
639*4882a593Smuzhiyun adapter->stats_reset_data);
640*4882a593Smuzhiyun else
641*4882a593Smuzhiyun zfcp_scsi_set_fc_host_stats(fc_stats, data);
642*4882a593Smuzhiyun
643*4882a593Smuzhiyun kfree(data);
644*4882a593Smuzhiyun return fc_stats;
645*4882a593Smuzhiyun }
646*4882a593Smuzhiyun
zfcp_scsi_reset_fc_host_stats(struct Scsi_Host * shost)647*4882a593Smuzhiyun static void zfcp_scsi_reset_fc_host_stats(struct Scsi_Host *shost)
648*4882a593Smuzhiyun {
649*4882a593Smuzhiyun struct zfcp_adapter *adapter;
650*4882a593Smuzhiyun struct fsf_qtcb_bottom_port *data;
651*4882a593Smuzhiyun int ret;
652*4882a593Smuzhiyun
653*4882a593Smuzhiyun adapter = (struct zfcp_adapter *)shost->hostdata[0];
654*4882a593Smuzhiyun data = kzalloc(sizeof(*data), GFP_KERNEL);
655*4882a593Smuzhiyun if (!data)
656*4882a593Smuzhiyun return;
657*4882a593Smuzhiyun
658*4882a593Smuzhiyun ret = zfcp_fsf_exchange_port_data_sync(adapter->qdio, data);
659*4882a593Smuzhiyun if (ret != 0 && ret != -EAGAIN)
660*4882a593Smuzhiyun kfree(data);
661*4882a593Smuzhiyun else {
662*4882a593Smuzhiyun adapter->stats_reset = jiffies/HZ;
663*4882a593Smuzhiyun kfree(adapter->stats_reset_data);
664*4882a593Smuzhiyun adapter->stats_reset_data = data; /* finally freed in
665*4882a593Smuzhiyun adapter_release */
666*4882a593Smuzhiyun }
667*4882a593Smuzhiyun }
668*4882a593Smuzhiyun
zfcp_scsi_get_host_port_state(struct Scsi_Host * shost)669*4882a593Smuzhiyun static void zfcp_scsi_get_host_port_state(struct Scsi_Host *shost)
670*4882a593Smuzhiyun {
671*4882a593Smuzhiyun struct zfcp_adapter *adapter =
672*4882a593Smuzhiyun (struct zfcp_adapter *)shost->hostdata[0];
673*4882a593Smuzhiyun int status = atomic_read(&adapter->status);
674*4882a593Smuzhiyun
675*4882a593Smuzhiyun if ((status & ZFCP_STATUS_COMMON_RUNNING) &&
676*4882a593Smuzhiyun !(status & ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED))
677*4882a593Smuzhiyun fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
678*4882a593Smuzhiyun else if (status & ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED)
679*4882a593Smuzhiyun fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN;
680*4882a593Smuzhiyun else if (status & ZFCP_STATUS_COMMON_ERP_FAILED)
681*4882a593Smuzhiyun fc_host_port_state(shost) = FC_PORTSTATE_ERROR;
682*4882a593Smuzhiyun else
683*4882a593Smuzhiyun fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN;
684*4882a593Smuzhiyun }
685*4882a593Smuzhiyun
zfcp_scsi_set_rport_dev_loss_tmo(struct fc_rport * rport,u32 timeout)686*4882a593Smuzhiyun static void zfcp_scsi_set_rport_dev_loss_tmo(struct fc_rport *rport,
687*4882a593Smuzhiyun u32 timeout)
688*4882a593Smuzhiyun {
689*4882a593Smuzhiyun rport->dev_loss_tmo = timeout;
690*4882a593Smuzhiyun }
691*4882a593Smuzhiyun
692*4882a593Smuzhiyun /**
693*4882a593Smuzhiyun * zfcp_scsi_terminate_rport_io - Terminate all I/O on a rport
694*4882a593Smuzhiyun * @rport: The FC rport where to teminate I/O
695*4882a593Smuzhiyun *
696*4882a593Smuzhiyun * Abort all pending SCSI commands for a port by closing the
697*4882a593Smuzhiyun * port. Using a reopen avoids a conflict with a shutdown
698*4882a593Smuzhiyun * overwriting a reopen. The "forced" ensures that a disappeared port
699*4882a593Smuzhiyun * is not opened again as valid due to the cached plogi data in
700*4882a593Smuzhiyun * non-NPIV mode.
701*4882a593Smuzhiyun */
zfcp_scsi_terminate_rport_io(struct fc_rport * rport)702*4882a593Smuzhiyun static void zfcp_scsi_terminate_rport_io(struct fc_rport *rport)
703*4882a593Smuzhiyun {
704*4882a593Smuzhiyun struct zfcp_port *port;
705*4882a593Smuzhiyun struct Scsi_Host *shost = rport_to_shost(rport);
706*4882a593Smuzhiyun struct zfcp_adapter *adapter =
707*4882a593Smuzhiyun (struct zfcp_adapter *)shost->hostdata[0];
708*4882a593Smuzhiyun
709*4882a593Smuzhiyun port = zfcp_get_port_by_wwpn(adapter, rport->port_name);
710*4882a593Smuzhiyun
711*4882a593Smuzhiyun if (port) {
712*4882a593Smuzhiyun zfcp_erp_port_forced_reopen(port, 0, "sctrpi1");
713*4882a593Smuzhiyun put_device(&port->dev);
714*4882a593Smuzhiyun } else {
715*4882a593Smuzhiyun zfcp_erp_port_forced_no_port_dbf(
716*4882a593Smuzhiyun "sctrpin", adapter,
717*4882a593Smuzhiyun rport->port_name /* zfcp_scsi_rport_register */,
718*4882a593Smuzhiyun rport->port_id /* zfcp_scsi_rport_register */);
719*4882a593Smuzhiyun }
720*4882a593Smuzhiyun }
721*4882a593Smuzhiyun
zfcp_scsi_rport_register(struct zfcp_port * port)722*4882a593Smuzhiyun static void zfcp_scsi_rport_register(struct zfcp_port *port)
723*4882a593Smuzhiyun {
724*4882a593Smuzhiyun struct fc_rport_identifiers ids;
725*4882a593Smuzhiyun struct fc_rport *rport;
726*4882a593Smuzhiyun
727*4882a593Smuzhiyun if (port->rport)
728*4882a593Smuzhiyun return;
729*4882a593Smuzhiyun
730*4882a593Smuzhiyun ids.node_name = port->wwnn;
731*4882a593Smuzhiyun ids.port_name = port->wwpn;
732*4882a593Smuzhiyun ids.port_id = port->d_id;
733*4882a593Smuzhiyun ids.roles = FC_RPORT_ROLE_FCP_TARGET;
734*4882a593Smuzhiyun
735*4882a593Smuzhiyun zfcp_dbf_rec_trig_lock("scpaddy", port->adapter, port, NULL,
736*4882a593Smuzhiyun ZFCP_PSEUDO_ERP_ACTION_RPORT_ADD,
737*4882a593Smuzhiyun ZFCP_PSEUDO_ERP_ACTION_RPORT_ADD);
738*4882a593Smuzhiyun rport = fc_remote_port_add(port->adapter->scsi_host, 0, &ids);
739*4882a593Smuzhiyun if (!rport) {
740*4882a593Smuzhiyun dev_err(&port->adapter->ccw_device->dev,
741*4882a593Smuzhiyun "Registering port 0x%016Lx failed\n",
742*4882a593Smuzhiyun (unsigned long long)port->wwpn);
743*4882a593Smuzhiyun return;
744*4882a593Smuzhiyun }
745*4882a593Smuzhiyun
746*4882a593Smuzhiyun rport->maxframe_size = port->maxframe_size;
747*4882a593Smuzhiyun rport->supported_classes = port->supported_classes;
748*4882a593Smuzhiyun port->rport = rport;
749*4882a593Smuzhiyun port->starget_id = rport->scsi_target_id;
750*4882a593Smuzhiyun
751*4882a593Smuzhiyun zfcp_unit_queue_scsi_scan(port);
752*4882a593Smuzhiyun }
753*4882a593Smuzhiyun
zfcp_scsi_rport_block(struct zfcp_port * port)754*4882a593Smuzhiyun static void zfcp_scsi_rport_block(struct zfcp_port *port)
755*4882a593Smuzhiyun {
756*4882a593Smuzhiyun struct fc_rport *rport = port->rport;
757*4882a593Smuzhiyun
758*4882a593Smuzhiyun if (rport) {
759*4882a593Smuzhiyun zfcp_dbf_rec_trig_lock("scpdely", port->adapter, port, NULL,
760*4882a593Smuzhiyun ZFCP_PSEUDO_ERP_ACTION_RPORT_DEL,
761*4882a593Smuzhiyun ZFCP_PSEUDO_ERP_ACTION_RPORT_DEL);
762*4882a593Smuzhiyun fc_remote_port_delete(rport);
763*4882a593Smuzhiyun port->rport = NULL;
764*4882a593Smuzhiyun }
765*4882a593Smuzhiyun }
766*4882a593Smuzhiyun
zfcp_scsi_schedule_rport_register(struct zfcp_port * port)767*4882a593Smuzhiyun void zfcp_scsi_schedule_rport_register(struct zfcp_port *port)
768*4882a593Smuzhiyun {
769*4882a593Smuzhiyun get_device(&port->dev);
770*4882a593Smuzhiyun port->rport_task = RPORT_ADD;
771*4882a593Smuzhiyun
772*4882a593Smuzhiyun if (!queue_work(port->adapter->work_queue, &port->rport_work))
773*4882a593Smuzhiyun put_device(&port->dev);
774*4882a593Smuzhiyun }
775*4882a593Smuzhiyun
zfcp_scsi_schedule_rport_block(struct zfcp_port * port)776*4882a593Smuzhiyun void zfcp_scsi_schedule_rport_block(struct zfcp_port *port)
777*4882a593Smuzhiyun {
778*4882a593Smuzhiyun get_device(&port->dev);
779*4882a593Smuzhiyun port->rport_task = RPORT_DEL;
780*4882a593Smuzhiyun
781*4882a593Smuzhiyun if (port->rport && queue_work(port->adapter->work_queue,
782*4882a593Smuzhiyun &port->rport_work))
783*4882a593Smuzhiyun return;
784*4882a593Smuzhiyun
785*4882a593Smuzhiyun put_device(&port->dev);
786*4882a593Smuzhiyun }
787*4882a593Smuzhiyun
zfcp_scsi_schedule_rports_block(struct zfcp_adapter * adapter)788*4882a593Smuzhiyun void zfcp_scsi_schedule_rports_block(struct zfcp_adapter *adapter)
789*4882a593Smuzhiyun {
790*4882a593Smuzhiyun unsigned long flags;
791*4882a593Smuzhiyun struct zfcp_port *port;
792*4882a593Smuzhiyun
793*4882a593Smuzhiyun read_lock_irqsave(&adapter->port_list_lock, flags);
794*4882a593Smuzhiyun list_for_each_entry(port, &adapter->port_list, list)
795*4882a593Smuzhiyun zfcp_scsi_schedule_rport_block(port);
796*4882a593Smuzhiyun read_unlock_irqrestore(&adapter->port_list_lock, flags);
797*4882a593Smuzhiyun }
798*4882a593Smuzhiyun
zfcp_scsi_rport_work(struct work_struct * work)799*4882a593Smuzhiyun void zfcp_scsi_rport_work(struct work_struct *work)
800*4882a593Smuzhiyun {
801*4882a593Smuzhiyun struct zfcp_port *port = container_of(work, struct zfcp_port,
802*4882a593Smuzhiyun rport_work);
803*4882a593Smuzhiyun
804*4882a593Smuzhiyun set_worker_desc("zrp%c-%16llx",
805*4882a593Smuzhiyun (port->rport_task == RPORT_ADD) ? 'a' : 'd',
806*4882a593Smuzhiyun port->wwpn); /* < WORKER_DESC_LEN=24 */
807*4882a593Smuzhiyun while (port->rport_task) {
808*4882a593Smuzhiyun if (port->rport_task == RPORT_ADD) {
809*4882a593Smuzhiyun port->rport_task = RPORT_NONE;
810*4882a593Smuzhiyun zfcp_scsi_rport_register(port);
811*4882a593Smuzhiyun } else {
812*4882a593Smuzhiyun port->rport_task = RPORT_NONE;
813*4882a593Smuzhiyun zfcp_scsi_rport_block(port);
814*4882a593Smuzhiyun }
815*4882a593Smuzhiyun }
816*4882a593Smuzhiyun
817*4882a593Smuzhiyun put_device(&port->dev);
818*4882a593Smuzhiyun }
819*4882a593Smuzhiyun
820*4882a593Smuzhiyun /**
821*4882a593Smuzhiyun * zfcp_scsi_set_prot - Configure DIF/DIX support in scsi_host
822*4882a593Smuzhiyun * @adapter: The adapter where to configure DIF/DIX for the SCSI host
823*4882a593Smuzhiyun */
zfcp_scsi_set_prot(struct zfcp_adapter * adapter)824*4882a593Smuzhiyun void zfcp_scsi_set_prot(struct zfcp_adapter *adapter)
825*4882a593Smuzhiyun {
826*4882a593Smuzhiyun unsigned int mask = 0;
827*4882a593Smuzhiyun unsigned int data_div;
828*4882a593Smuzhiyun struct Scsi_Host *shost = adapter->scsi_host;
829*4882a593Smuzhiyun
830*4882a593Smuzhiyun data_div = atomic_read(&adapter->status) &
831*4882a593Smuzhiyun ZFCP_STATUS_ADAPTER_DATA_DIV_ENABLED;
832*4882a593Smuzhiyun
833*4882a593Smuzhiyun if ((enable_dif || zfcp_experimental_dix) &&
834*4882a593Smuzhiyun adapter->adapter_features & FSF_FEATURE_DIF_PROT_TYPE1)
835*4882a593Smuzhiyun mask |= SHOST_DIF_TYPE1_PROTECTION;
836*4882a593Smuzhiyun
837*4882a593Smuzhiyun if (zfcp_experimental_dix && data_div &&
838*4882a593Smuzhiyun adapter->adapter_features & FSF_FEATURE_DIX_PROT_TCPIP) {
839*4882a593Smuzhiyun mask |= SHOST_DIX_TYPE1_PROTECTION;
840*4882a593Smuzhiyun scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP);
841*4882a593Smuzhiyun shost->sg_prot_tablesize = adapter->qdio->max_sbale_per_req / 2;
842*4882a593Smuzhiyun shost->sg_tablesize = adapter->qdio->max_sbale_per_req / 2;
843*4882a593Smuzhiyun shost->max_sectors = shost->sg_tablesize * 8;
844*4882a593Smuzhiyun }
845*4882a593Smuzhiyun
846*4882a593Smuzhiyun scsi_host_set_prot(shost, mask);
847*4882a593Smuzhiyun }
848*4882a593Smuzhiyun
849*4882a593Smuzhiyun /**
850*4882a593Smuzhiyun * zfcp_scsi_dif_sense_error - Report DIF/DIX error as driver sense error
851*4882a593Smuzhiyun * @scmd: The SCSI command to report the error for
852*4882a593Smuzhiyun * @ascq: The ASCQ to put in the sense buffer
853*4882a593Smuzhiyun *
854*4882a593Smuzhiyun * See the error handling in sd_done for the sense codes used here.
855*4882a593Smuzhiyun * Set DID_SOFT_ERROR to retry the request, if possible.
856*4882a593Smuzhiyun */
zfcp_scsi_dif_sense_error(struct scsi_cmnd * scmd,int ascq)857*4882a593Smuzhiyun void zfcp_scsi_dif_sense_error(struct scsi_cmnd *scmd, int ascq)
858*4882a593Smuzhiyun {
859*4882a593Smuzhiyun scsi_build_sense_buffer(1, scmd->sense_buffer,
860*4882a593Smuzhiyun ILLEGAL_REQUEST, 0x10, ascq);
861*4882a593Smuzhiyun set_driver_byte(scmd, DRIVER_SENSE);
862*4882a593Smuzhiyun scmd->result |= SAM_STAT_CHECK_CONDITION;
863*4882a593Smuzhiyun set_host_byte(scmd, DID_SOFT_ERROR);
864*4882a593Smuzhiyun }
865*4882a593Smuzhiyun
zfcp_scsi_shost_update_config_data(struct zfcp_adapter * const adapter,const struct fsf_qtcb_bottom_config * const bottom,const bool bottom_incomplete)866*4882a593Smuzhiyun void zfcp_scsi_shost_update_config_data(
867*4882a593Smuzhiyun struct zfcp_adapter *const adapter,
868*4882a593Smuzhiyun const struct fsf_qtcb_bottom_config *const bottom,
869*4882a593Smuzhiyun const bool bottom_incomplete)
870*4882a593Smuzhiyun {
871*4882a593Smuzhiyun struct Scsi_Host *const shost = adapter->scsi_host;
872*4882a593Smuzhiyun const struct fc_els_flogi *nsp, *plogi;
873*4882a593Smuzhiyun
874*4882a593Smuzhiyun if (shost == NULL)
875*4882a593Smuzhiyun return;
876*4882a593Smuzhiyun
877*4882a593Smuzhiyun snprintf(fc_host_firmware_version(shost), FC_VERSION_STRING_SIZE,
878*4882a593Smuzhiyun "0x%08x", bottom->lic_version);
879*4882a593Smuzhiyun
880*4882a593Smuzhiyun if (adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT) {
881*4882a593Smuzhiyun snprintf(fc_host_hardware_version(shost),
882*4882a593Smuzhiyun FC_VERSION_STRING_SIZE,
883*4882a593Smuzhiyun "0x%08x", bottom->hardware_version);
884*4882a593Smuzhiyun memcpy(fc_host_serial_number(shost), bottom->serial_number,
885*4882a593Smuzhiyun min(FC_SERIAL_NUMBER_SIZE, 17));
886*4882a593Smuzhiyun EBCASC(fc_host_serial_number(shost),
887*4882a593Smuzhiyun min(FC_SERIAL_NUMBER_SIZE, 17));
888*4882a593Smuzhiyun }
889*4882a593Smuzhiyun
890*4882a593Smuzhiyun /* adjust pointers for missing command code */
891*4882a593Smuzhiyun nsp = (struct fc_els_flogi *) ((u8 *)&bottom->nport_serv_param
892*4882a593Smuzhiyun - sizeof(u32));
893*4882a593Smuzhiyun plogi = (struct fc_els_flogi *) ((u8 *)&bottom->plogi_payload
894*4882a593Smuzhiyun - sizeof(u32));
895*4882a593Smuzhiyun
896*4882a593Smuzhiyun snprintf(fc_host_manufacturer(shost), FC_SERIAL_NUMBER_SIZE, "%s",
897*4882a593Smuzhiyun "IBM");
898*4882a593Smuzhiyun fc_host_port_name(shost) = be64_to_cpu(nsp->fl_wwpn);
899*4882a593Smuzhiyun fc_host_node_name(shost) = be64_to_cpu(nsp->fl_wwnn);
900*4882a593Smuzhiyun fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
901*4882a593Smuzhiyun
902*4882a593Smuzhiyun zfcp_scsi_set_prot(adapter);
903*4882a593Smuzhiyun
904*4882a593Smuzhiyun /* do not evaluate invalid fields */
905*4882a593Smuzhiyun if (bottom_incomplete)
906*4882a593Smuzhiyun return;
907*4882a593Smuzhiyun
908*4882a593Smuzhiyun fc_host_port_id(shost) = ntoh24(bottom->s_id);
909*4882a593Smuzhiyun fc_host_speed(shost) =
910*4882a593Smuzhiyun zfcp_fsf_convert_portspeed(bottom->fc_link_speed);
911*4882a593Smuzhiyun
912*4882a593Smuzhiyun snprintf(fc_host_model(shost), FC_SYMBOLIC_NAME_SIZE, "0x%04x",
913*4882a593Smuzhiyun bottom->adapter_type);
914*4882a593Smuzhiyun
915*4882a593Smuzhiyun switch (bottom->fc_topology) {
916*4882a593Smuzhiyun case FSF_TOPO_P2P:
917*4882a593Smuzhiyun fc_host_port_type(shost) = FC_PORTTYPE_PTP;
918*4882a593Smuzhiyun fc_host_fabric_name(shost) = 0;
919*4882a593Smuzhiyun break;
920*4882a593Smuzhiyun case FSF_TOPO_FABRIC:
921*4882a593Smuzhiyun fc_host_fabric_name(shost) = be64_to_cpu(plogi->fl_wwnn);
922*4882a593Smuzhiyun if (bottom->connection_features & FSF_FEATURE_NPIV_MODE)
923*4882a593Smuzhiyun fc_host_port_type(shost) = FC_PORTTYPE_NPIV;
924*4882a593Smuzhiyun else
925*4882a593Smuzhiyun fc_host_port_type(shost) = FC_PORTTYPE_NPORT;
926*4882a593Smuzhiyun break;
927*4882a593Smuzhiyun case FSF_TOPO_AL:
928*4882a593Smuzhiyun fc_host_port_type(shost) = FC_PORTTYPE_NLPORT;
929*4882a593Smuzhiyun fallthrough;
930*4882a593Smuzhiyun default:
931*4882a593Smuzhiyun fc_host_fabric_name(shost) = 0;
932*4882a593Smuzhiyun break;
933*4882a593Smuzhiyun }
934*4882a593Smuzhiyun }
935*4882a593Smuzhiyun
zfcp_scsi_shost_update_port_data(struct zfcp_adapter * const adapter,const struct fsf_qtcb_bottom_port * const bottom)936*4882a593Smuzhiyun void zfcp_scsi_shost_update_port_data(
937*4882a593Smuzhiyun struct zfcp_adapter *const adapter,
938*4882a593Smuzhiyun const struct fsf_qtcb_bottom_port *const bottom)
939*4882a593Smuzhiyun {
940*4882a593Smuzhiyun struct Scsi_Host *const shost = adapter->scsi_host;
941*4882a593Smuzhiyun
942*4882a593Smuzhiyun if (shost == NULL)
943*4882a593Smuzhiyun return;
944*4882a593Smuzhiyun
945*4882a593Smuzhiyun fc_host_permanent_port_name(shost) = bottom->wwpn;
946*4882a593Smuzhiyun fc_host_maxframe_size(shost) = bottom->maximum_frame_size;
947*4882a593Smuzhiyun fc_host_supported_speeds(shost) =
948*4882a593Smuzhiyun zfcp_fsf_convert_portspeed(bottom->supported_speed);
949*4882a593Smuzhiyun memcpy(fc_host_supported_fc4s(shost), bottom->supported_fc4_types,
950*4882a593Smuzhiyun FC_FC4_LIST_SIZE);
951*4882a593Smuzhiyun memcpy(fc_host_active_fc4s(shost), bottom->active_fc4_types,
952*4882a593Smuzhiyun FC_FC4_LIST_SIZE);
953*4882a593Smuzhiyun }
954*4882a593Smuzhiyun
955*4882a593Smuzhiyun struct fc_function_template zfcp_transport_functions = {
956*4882a593Smuzhiyun .show_starget_port_id = 1,
957*4882a593Smuzhiyun .show_starget_port_name = 1,
958*4882a593Smuzhiyun .show_starget_node_name = 1,
959*4882a593Smuzhiyun .show_rport_supported_classes = 1,
960*4882a593Smuzhiyun .show_rport_maxframe_size = 1,
961*4882a593Smuzhiyun .show_rport_dev_loss_tmo = 1,
962*4882a593Smuzhiyun .show_host_node_name = 1,
963*4882a593Smuzhiyun .show_host_port_name = 1,
964*4882a593Smuzhiyun .show_host_permanent_port_name = 1,
965*4882a593Smuzhiyun .show_host_supported_classes = 1,
966*4882a593Smuzhiyun .show_host_supported_fc4s = 1,
967*4882a593Smuzhiyun .show_host_supported_speeds = 1,
968*4882a593Smuzhiyun .show_host_maxframe_size = 1,
969*4882a593Smuzhiyun .show_host_serial_number = 1,
970*4882a593Smuzhiyun .show_host_manufacturer = 1,
971*4882a593Smuzhiyun .show_host_model = 1,
972*4882a593Smuzhiyun .show_host_hardware_version = 1,
973*4882a593Smuzhiyun .show_host_firmware_version = 1,
974*4882a593Smuzhiyun .get_fc_host_stats = zfcp_scsi_get_fc_host_stats,
975*4882a593Smuzhiyun .reset_fc_host_stats = zfcp_scsi_reset_fc_host_stats,
976*4882a593Smuzhiyun .set_rport_dev_loss_tmo = zfcp_scsi_set_rport_dev_loss_tmo,
977*4882a593Smuzhiyun .get_host_port_state = zfcp_scsi_get_host_port_state,
978*4882a593Smuzhiyun .terminate_rport_io = zfcp_scsi_terminate_rport_io,
979*4882a593Smuzhiyun .show_host_port_state = 1,
980*4882a593Smuzhiyun .show_host_active_fc4s = 1,
981*4882a593Smuzhiyun .bsg_request = zfcp_fc_exec_bsg_job,
982*4882a593Smuzhiyun .bsg_timeout = zfcp_fc_timeout_bsg_job,
983*4882a593Smuzhiyun /* no functions registered for following dynamic attributes but
984*4882a593Smuzhiyun directly set by LLDD */
985*4882a593Smuzhiyun .show_host_port_type = 1,
986*4882a593Smuzhiyun .show_host_symbolic_name = 1,
987*4882a593Smuzhiyun .show_host_speed = 1,
988*4882a593Smuzhiyun .show_host_port_id = 1,
989*4882a593Smuzhiyun .show_host_fabric_name = 1,
990*4882a593Smuzhiyun .dd_bsg_size = sizeof(struct zfcp_fsf_ct_els),
991*4882a593Smuzhiyun };
992