blob: 771cc536a989f7a72578a80bd1cd078775408567 [file] [log] [blame]
Swen Schillig41fa2ad2007-09-07 09:15:31 +02001/*
Christof Schmitt553448f2008-06-10 18:20:58 +02002 * zfcp device driver
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
Christof Schmitt553448f2008-06-10 18:20:58 +02004 * Interface to Linux SCSI midlayer.
Swen Schillig41fa2ad2007-09-07 09:15:31 +02005 *
Christof Schmitta2fa0ae2009-03-02 13:09:08 +01006 * Copyright IBM Corporation 2002, 2009
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 */
8
Christof Schmittecf39d42008-12-25 13:39:53 +01009#define KMSG_COMPONENT "zfcp"
10#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
11
Christof Schmitt4318e082009-11-24 16:54:08 +010012#include <linux/types.h>
13#include <scsi/fc/fc_fcp.h>
Christof Schmitt5f852be2007-05-08 11:16:52 +020014#include <asm/atomic.h>
Christof Schmittdcd20e22009-08-18 15:43:08 +020015#include "zfcp_ext.h"
16#include "zfcp_dbf.h"
Christof Schmitt7c7dc192009-11-24 16:54:13 +010017#include "zfcp_fc.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Christof Schmitta40a1ba2009-05-15 13:18:16 +020019static unsigned int default_depth = 32;
20module_param_named(queue_depth, default_depth, uint, 0600);
21MODULE_PARM_DESC(queue_depth, "Default queue depth for new SCSI devices");
22
Mike Christiee881a172009-10-15 17:46:39 -070023static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
24 int reason)
Christof Schmitta40a1ba2009-05-15 13:18:16 +020025{
Christof Schmitt42e62a72009-10-15 17:47:11 -070026 switch (reason) {
27 case SCSI_QDEPTH_DEFAULT:
28 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
29 break;
30 case SCSI_QDEPTH_QFULL:
31 scsi_track_queue_full(sdev, depth);
32 break;
33 case SCSI_QDEPTH_RAMP_UP:
34 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
35 break;
36 default:
Mike Christiee881a172009-10-15 17:46:39 -070037 return -EOPNOTSUPP;
Christof Schmitt42e62a72009-10-15 17:47:11 -070038 }
Christof Schmitta40a1ba2009-05-15 13:18:16 +020039 return sdev->queue_depth;
40}
41
Andreas Herrmannf6c0e7a2006-08-02 11:05:52 +020042static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -070043{
44 struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata;
Christof Schmitt26816f12008-11-04 16:35:05 +010045 unit->device = NULL;
Swen Schilligf3450c72009-11-24 16:53:59 +010046 put_device(&unit->sysfs_device);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047}
48
Martin Petermannf76af7d2008-07-02 10:56:36 +020049static int zfcp_scsi_slave_configure(struct scsi_device *sdp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070050{
51 if (sdp->tagged_supported)
Christof Schmitta40a1ba2009-05-15 13:18:16 +020052 scsi_adjust_queue_depth(sdp, MSG_SIMPLE_TAG, default_depth);
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 else
54 scsi_adjust_queue_depth(sdp, 0, 1);
55 return 0;
56}
57
Martin Petermannf76af7d2008-07-02 10:56:36 +020058static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
Linus Torvalds1da177e2005-04-16 15:20:36 -070059{
Swen Schillig57717102009-08-18 15:43:21 +020060 struct zfcp_adapter *adapter =
61 (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
Martin Petermannfeac6a02008-07-02 10:56:35 +020062 set_host_byte(scpnt, result);
Maxim Shchetynin8a36e452005-09-13 21:50:38 +020063 if ((scpnt->device != NULL) && (scpnt->device->host != NULL))
Swen Schillig57717102009-08-18 15:43:21 +020064 zfcp_dbf_scsi_result("fail", 4, adapter->dbf, scpnt, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 /* return directly */
66 scpnt->scsi_done(scpnt);
67}
68
Martin Petermannf76af7d2008-07-02 10:56:36 +020069static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt,
70 void (*done) (struct scsi_cmnd *))
Linus Torvalds1da177e2005-04-16 15:20:36 -070071{
72 struct zfcp_unit *unit;
73 struct zfcp_adapter *adapter;
Christof Schmitta2fa0ae2009-03-02 13:09:08 +010074 int status, scsi_result, ret;
75 struct fc_rport *rport = starget_to_rport(scsi_target(scpnt->device));
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
77 /* reset the status for this request */
78 scpnt->result = 0;
79 scpnt->host_scribble = NULL;
80 scpnt->scsi_done = done;
81
82 /*
83 * figure out adapter and target device
84 * (stored there by zfcp_scsi_slave_alloc)
85 */
86 adapter = (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
Martin Petermannf76af7d2008-07-02 10:56:36 +020087 unit = scpnt->device->hostdata;
Linus Torvalds1da177e2005-04-16 15:20:36 -070088
Martin Petermannf76af7d2008-07-02 10:56:36 +020089 BUG_ON(!adapter || (adapter != unit->port->adapter));
90 BUG_ON(!scpnt->scsi_done);
91
92 if (unlikely(!unit)) {
93 zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
94 return 0;
95 }
96
Christof Schmitta2fa0ae2009-03-02 13:09:08 +010097 scsi_result = fc_remote_port_chkready(rport);
98 if (unlikely(scsi_result)) {
99 scpnt->result = scsi_result;
Swen Schillig57717102009-08-18 15:43:21 +0200100 zfcp_dbf_scsi_result("fail", 4, adapter->dbf, scpnt, NULL);
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100101 scpnt->scsi_done(scpnt);
102 return 0;
103 }
104
Martin Petermannf76af7d2008-07-02 10:56:36 +0200105 status = atomic_read(&unit->status);
Christof Schmitt88302712009-11-24 16:54:07 +0100106 if (unlikely(status & ZFCP_STATUS_COMMON_ERP_FAILED) &&
107 !(atomic_read(&unit->port->status) &
108 ZFCP_STATUS_COMMON_ERP_FAILED)) {
109 /* only unit access denied, but port is good
110 * not covered by FC transport, have to fail here */
Martin Petermannf76af7d2008-07-02 10:56:36 +0200111 zfcp_scsi_command_fail(scpnt, DID_ERROR);
Joe Perchesa419aef2009-08-18 11:18:35 -0700112 return 0;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200113 }
114
Christof Schmitt88302712009-11-24 16:54:07 +0100115 if (unlikely(!(status & ZFCP_STATUS_COMMON_UNBLOCKED))) {
116 /* This could be either
117 * open unit pending: this is temporary, will result in
118 * open unit or ERP_FAILED, so retry command
119 * call to rport_delete pending: mimic retry from
120 * fc_remote_port_chkready until rport is BLOCKED
121 */
122 zfcp_scsi_command_fail(scpnt, DID_IMM_RETRY);
123 return 0;
124 }
125
Christof Schmitt63caf362009-03-02 13:09:00 +0100126 ret = zfcp_fsf_send_fcp_command_task(unit, scpnt);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200127 if (unlikely(ret == -EBUSY))
Swen Schilligf7a65e92008-11-27 11:44:07 +0100128 return SCSI_MLQUEUE_DEVICE_BUSY;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200129 else if (unlikely(ret < 0))
130 return SCSI_MLQUEUE_HOST_BUSY;
131
132 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133}
134
Martin Petermannf76af7d2008-07-02 10:56:36 +0200135static struct zfcp_unit *zfcp_unit_lookup(struct zfcp_adapter *adapter,
Swen Schilligecf0c772009-11-24 16:53:58 +0100136 unsigned int id, u64 lun)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137{
Swen Schilligecf0c772009-11-24 16:53:58 +0100138 unsigned long flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 struct zfcp_port *port;
Swen Schilligecf0c772009-11-24 16:53:58 +0100140 struct zfcp_unit *unit = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
Swen Schilligecf0c772009-11-24 16:53:58 +0100142 read_lock_irqsave(&adapter->port_list_lock, flags);
143 list_for_each_entry(port, &adapter->port_list, list) {
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700144 if (!port->rport || (id != port->rport->scsi_target_id))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 continue;
Swen Schilligecf0c772009-11-24 16:53:58 +0100146 unit = zfcp_get_unit_by_lun(port, lun);
147 if (unit)
148 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149 }
Swen Schilligecf0c772009-11-24 16:53:58 +0100150 read_unlock_irqrestore(&adapter->port_list_lock, flags);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200151
Swen Schilligecf0c772009-11-24 16:53:58 +0100152 return unit;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200153}
154
155static int zfcp_scsi_slave_alloc(struct scsi_device *sdp)
156{
157 struct zfcp_adapter *adapter;
158 struct zfcp_unit *unit;
Swen Schilligecf0c772009-11-24 16:53:58 +0100159 u64 lun;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200160
161 adapter = (struct zfcp_adapter *) sdp->host->hostdata[0];
162 if (!adapter)
163 goto out;
164
Swen Schilligecf0c772009-11-24 16:53:58 +0100165 int_to_scsilun(sdp->lun, (struct scsi_lun *)&lun);
166 unit = zfcp_unit_lookup(adapter, sdp->id, lun);
Christof Schmitt86f8a1b2009-03-02 13:08:55 +0100167 if (unit) {
Martin Petermannf76af7d2008-07-02 10:56:36 +0200168 sdp->hostdata = unit;
169 unit->device = sdp;
Swen Schilligecf0c772009-11-24 16:53:58 +0100170 return 0;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200171 }
Martin Petermannf76af7d2008-07-02 10:56:36 +0200172out:
Swen Schilligecf0c772009-11-24 16:53:58 +0100173 return -ENXIO;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174}
175
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100176static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177{
Christof Schmitt63caf362009-03-02 13:09:00 +0100178 struct Scsi_Host *scsi_host = scpnt->device->host;
179 struct zfcp_adapter *adapter =
180 (struct zfcp_adapter *) scsi_host->hostdata[0];
181 struct zfcp_unit *unit = scpnt->device->hostdata;
182 struct zfcp_fsf_req *old_req, *abrt_req;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 unsigned long flags;
Christof Schmitta11a52b2009-07-13 15:06:14 +0200184 unsigned long old_reqid = (unsigned long) scpnt->host_scribble;
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200185 int retval = SUCCESS;
Christof Schmitt63caf362009-03-02 13:09:00 +0100186 int retry = 3;
Christof Schmitta11a52b2009-07-13 15:06:14 +0200187 char *dbf_tag;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188
Andreas Herrmann059c97d2005-09-13 21:47:52 +0200189 /* avoid race condition between late normal completion and abort */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190 write_lock_irqsave(&adapter->abort_lock, flags);
191
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200192 spin_lock(&adapter->req_list_lock);
Christof Schmitta11a52b2009-07-13 15:06:14 +0200193 old_req = zfcp_reqlist_find(adapter, old_reqid);
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200194 spin_unlock(&adapter->req_list_lock);
Christof Schmitt63caf362009-03-02 13:09:00 +0100195 if (!old_req) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 write_unlock_irqrestore(&adapter->abort_lock, flags);
Swen Schillig57717102009-08-18 15:43:21 +0200197 zfcp_dbf_scsi_abort("lte1", adapter->dbf, scpnt, NULL,
198 old_reqid);
Christof Schmittc6936e72009-04-17 15:08:11 +0200199 return FAILED; /* completion could be in progress */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 }
Christof Schmitt63caf362009-03-02 13:09:00 +0100201 old_req->data = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200203 /* don't access old fsf_req after releasing the abort_lock */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204 write_unlock_irqrestore(&adapter->abort_lock, flags);
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200205
Christof Schmitt63caf362009-03-02 13:09:00 +0100206 while (retry--) {
Christof Schmitta11a52b2009-07-13 15:06:14 +0200207 abrt_req = zfcp_fsf_abort_fcp_command(old_reqid, unit);
Christof Schmitt63caf362009-03-02 13:09:00 +0100208 if (abrt_req)
209 break;
210
211 zfcp_erp_wait(adapter);
Christof Schmittaf4de362009-11-24 16:54:16 +0100212 fc_block_scsi_eh(scpnt);
Christof Schmitt63caf362009-03-02 13:09:00 +0100213 if (!(atomic_read(&adapter->status) &
214 ZFCP_STATUS_COMMON_RUNNING)) {
Swen Schillig57717102009-08-18 15:43:21 +0200215 zfcp_dbf_scsi_abort("nres", adapter->dbf, scpnt, NULL,
216 old_reqid);
Christof Schmitt63caf362009-03-02 13:09:00 +0100217 return SUCCESS;
218 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 }
Christof Schmitt63caf362009-03-02 13:09:00 +0100220 if (!abrt_req)
221 return FAILED;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222
Swen Schillig058b8642009-08-18 15:43:14 +0200223 wait_for_completion(&abrt_req->completion);
Andreas Herrmann059c97d2005-09-13 21:47:52 +0200224
Christof Schmitt63caf362009-03-02 13:09:00 +0100225 if (abrt_req->status & ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED)
Christof Schmitta11a52b2009-07-13 15:06:14 +0200226 dbf_tag = "okay";
Christof Schmitt63caf362009-03-02 13:09:00 +0100227 else if (abrt_req->status & ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED)
Christof Schmitta11a52b2009-07-13 15:06:14 +0200228 dbf_tag = "lte2";
Christof Schmitt63caf362009-03-02 13:09:00 +0100229 else {
Christof Schmitta11a52b2009-07-13 15:06:14 +0200230 dbf_tag = "fail";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 retval = FAILED;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 }
Swen Schillig57717102009-08-18 15:43:21 +0200233 zfcp_dbf_scsi_abort(dbf_tag, adapter->dbf, scpnt, abrt_req, old_reqid);
Christof Schmitt63caf362009-03-02 13:09:00 +0100234 zfcp_fsf_req_free(abrt_req);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 return retval;
236}
237
Christof Schmitt63caf362009-03-02 13:09:00 +0100238static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239{
Christof Schmitt63caf362009-03-02 13:09:00 +0100240 struct zfcp_unit *unit = scpnt->device->hostdata;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 struct zfcp_adapter *adapter = unit->port->adapter;
Swen Schillig564e1c82009-08-18 15:43:19 +0200242 struct zfcp_fsf_req *fsf_req = NULL;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200243 int retval = SUCCESS;
Christof Schmitt63caf362009-03-02 13:09:00 +0100244 int retry = 3;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245
Christof Schmitt63caf362009-03-02 13:09:00 +0100246 while (retry--) {
247 fsf_req = zfcp_fsf_send_fcp_ctm(unit, tm_flags);
248 if (fsf_req)
249 break;
250
251 zfcp_erp_wait(adapter);
Christof Schmittaf4de362009-11-24 16:54:16 +0100252 fc_block_scsi_eh(scpnt);
Christof Schmitt63caf362009-03-02 13:09:00 +0100253 if (!(atomic_read(&adapter->status) &
254 ZFCP_STATUS_COMMON_RUNNING)) {
Swen Schillig57717102009-08-18 15:43:21 +0200255 zfcp_dbf_scsi_devreset("nres", tm_flags, unit, scpnt);
Christof Schmitt63caf362009-03-02 13:09:00 +0100256 return SUCCESS;
257 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 }
Christof Schmitt63caf362009-03-02 13:09:00 +0100259 if (!fsf_req)
260 return FAILED;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261
Swen Schillig058b8642009-08-18 15:43:14 +0200262 wait_for_completion(&fsf_req->completion);
Andreas Herrmann77eb1692005-09-13 21:48:33 +0200263
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200264 if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCFAILED) {
Swen Schillig57717102009-08-18 15:43:21 +0200265 zfcp_dbf_scsi_devreset("fail", tm_flags, unit, scpnt);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200266 retval = FAILED;
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200267 } else
Swen Schillig57717102009-08-18 15:43:21 +0200268 zfcp_dbf_scsi_devreset("okay", tm_flags, unit, scpnt);
Andreas Herrmann77eb1692005-09-13 21:48:33 +0200269
270 zfcp_fsf_req_free(fsf_req);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 return retval;
272}
273
Martin Petermannf76af7d2008-07-02 10:56:36 +0200274static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
275{
Christof Schmitt4318e082009-11-24 16:54:08 +0100276 return zfcp_task_mgmt_function(scpnt, FCP_TMF_LUN_RESET);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200277}
278
279static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
280{
Christof Schmitt4318e082009-11-24 16:54:08 +0100281 return zfcp_task_mgmt_function(scpnt, FCP_TMF_TGT_RESET);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200282}
283
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100284static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285{
Christof Schmitt63caf362009-03-02 13:09:00 +0100286 struct zfcp_unit *unit = scpnt->device->hostdata;
287 struct zfcp_adapter *adapter = unit->port->adapter;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288
Swen Schillig5ffd51a2009-03-02 13:09:04 +0100289 zfcp_erp_adapter_reopen(adapter, 0, "schrh_1", scpnt);
Andreas Herrmann81654282006-09-18 22:30:36 +0200290 zfcp_erp_wait(adapter);
Christof Schmittaf4de362009-11-24 16:54:16 +0100291 fc_block_scsi_eh(scpnt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292
Andreas Herrmann810f1e3e2005-09-13 21:49:52 +0200293 return SUCCESS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294}
295
Martin Petermannf76af7d2008-07-02 10:56:36 +0200296int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297{
Martin Petermannf76af7d2008-07-02 10:56:36 +0200298 struct ccw_dev_id dev_id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299
Michael Loehr9f287452007-05-09 11:01:24 +0200300 if (adapter->scsi_host)
Martin Petermannf76af7d2008-07-02 10:56:36 +0200301 return 0;
Michael Loehr9f287452007-05-09 11:01:24 +0200302
Martin Petermannf76af7d2008-07-02 10:56:36 +0200303 ccw_device_get_id(adapter->ccw_device, &dev_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304 /* register adapter as SCSI host with mid layer of SCSI stack */
305 adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template,
306 sizeof (struct zfcp_adapter *));
307 if (!adapter->scsi_host) {
Christof Schmitt553448f2008-06-10 18:20:58 +0200308 dev_err(&adapter->ccw_device->dev,
Christof Schmittff3b24f2008-10-01 12:42:15 +0200309 "Registering the FCP device with the "
310 "SCSI stack failed\n");
Martin Petermannf76af7d2008-07-02 10:56:36 +0200311 return -EIO;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313
314 /* tell the SCSI stack some characteristics of this adapter */
315 adapter->scsi_host->max_id = 1;
316 adapter->scsi_host->max_lun = 1;
317 adapter->scsi_host->max_channel = 0;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200318 adapter->scsi_host->unique_id = dev_id.devno;
Christof Schmitt4318e082009-11-24 16:54:08 +0100319 adapter->scsi_host->max_cmd_len = 16; /* in struct fcp_cmnd */
Heiko Carstensdd52e0e2006-09-18 22:28:49 +0200320 adapter->scsi_host->transportt = zfcp_data.scsi_transport_template;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 adapter->scsi_host->hostdata[0] = (unsigned long) adapter;
323
324 if (scsi_add_host(adapter->scsi_host, &adapter->ccw_device->dev)) {
325 scsi_host_put(adapter->scsi_host);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200326 return -EIO;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327 }
Martin Petermannf76af7d2008-07-02 10:56:36 +0200328
329 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330}
331
Martin Petermannf76af7d2008-07-02 10:56:36 +0200332void zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333{
334 struct Scsi_Host *shost;
Andreas Herrmann13e1e1f2005-09-19 16:56:17 +0200335 struct zfcp_port *port;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336
337 shost = adapter->scsi_host;
338 if (!shost)
339 return;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200340
Swen Schilligecf0c772009-11-24 16:53:58 +0100341 read_lock_irq(&adapter->port_list_lock);
342 list_for_each_entry(port, &adapter->port_list, list)
Swen Schilligf3450c72009-11-24 16:53:59 +0100343 port->rport = NULL;
Swen Schilligecf0c772009-11-24 16:53:58 +0100344 read_unlock_irq(&adapter->port_list_lock);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200345
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700346 fc_remove_host(shost);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 scsi_remove_host(shost);
348 scsi_host_put(shost);
349 adapter->scsi_host = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350
351 return;
352}
353
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100354static struct fc_host_statistics*
355zfcp_init_fc_host_stats(struct zfcp_adapter *adapter)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356{
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100357 struct fc_host_statistics *fc_stats;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100359 if (!adapter->fc_stats) {
360 fc_stats = kmalloc(sizeof(*fc_stats), GFP_KERNEL);
361 if (!fc_stats)
362 return NULL;
Swen Schilligf3450c72009-11-24 16:53:59 +0100363 adapter->fc_stats = fc_stats; /* freed in adapter_release */
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100364 }
365 memset(adapter->fc_stats, 0, sizeof(*adapter->fc_stats));
366 return adapter->fc_stats;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367}
368
Martin Petermannf76af7d2008-07-02 10:56:36 +0200369static void zfcp_adjust_fc_host_stats(struct fc_host_statistics *fc_stats,
370 struct fsf_qtcb_bottom_port *data,
371 struct fsf_qtcb_bottom_port *old)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372{
Martin Petermannf76af7d2008-07-02 10:56:36 +0200373 fc_stats->seconds_since_last_reset =
374 data->seconds_since_last_reset - old->seconds_since_last_reset;
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100375 fc_stats->tx_frames = data->tx_frames - old->tx_frames;
376 fc_stats->tx_words = data->tx_words - old->tx_words;
377 fc_stats->rx_frames = data->rx_frames - old->rx_frames;
378 fc_stats->rx_words = data->rx_words - old->rx_words;
379 fc_stats->lip_count = data->lip - old->lip;
380 fc_stats->nos_count = data->nos - old->nos;
381 fc_stats->error_frames = data->error_frames - old->error_frames;
382 fc_stats->dumped_frames = data->dumped_frames - old->dumped_frames;
383 fc_stats->link_failure_count = data->link_failure - old->link_failure;
384 fc_stats->loss_of_sync_count = data->loss_of_sync - old->loss_of_sync;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200385 fc_stats->loss_of_signal_count =
386 data->loss_of_signal - old->loss_of_signal;
387 fc_stats->prim_seq_protocol_err_count =
388 data->psp_error_counts - old->psp_error_counts;
389 fc_stats->invalid_tx_word_count =
390 data->invalid_tx_words - old->invalid_tx_words;
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100391 fc_stats->invalid_crc_count = data->invalid_crcs - old->invalid_crcs;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200392 fc_stats->fcp_input_requests =
393 data->input_requests - old->input_requests;
394 fc_stats->fcp_output_requests =
395 data->output_requests - old->output_requests;
396 fc_stats->fcp_control_requests =
397 data->control_requests - old->control_requests;
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100398 fc_stats->fcp_input_megabytes = data->input_mb - old->input_mb;
399 fc_stats->fcp_output_megabytes = data->output_mb - old->output_mb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400}
401
Martin Petermannf76af7d2008-07-02 10:56:36 +0200402static void zfcp_set_fc_host_stats(struct fc_host_statistics *fc_stats,
403 struct fsf_qtcb_bottom_port *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404{
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100405 fc_stats->seconds_since_last_reset = data->seconds_since_last_reset;
406 fc_stats->tx_frames = data->tx_frames;
407 fc_stats->tx_words = data->tx_words;
408 fc_stats->rx_frames = data->rx_frames;
409 fc_stats->rx_words = data->rx_words;
410 fc_stats->lip_count = data->lip;
411 fc_stats->nos_count = data->nos;
412 fc_stats->error_frames = data->error_frames;
413 fc_stats->dumped_frames = data->dumped_frames;
414 fc_stats->link_failure_count = data->link_failure;
415 fc_stats->loss_of_sync_count = data->loss_of_sync;
416 fc_stats->loss_of_signal_count = data->loss_of_signal;
417 fc_stats->prim_seq_protocol_err_count = data->psp_error_counts;
418 fc_stats->invalid_tx_word_count = data->invalid_tx_words;
419 fc_stats->invalid_crc_count = data->invalid_crcs;
420 fc_stats->fcp_input_requests = data->input_requests;
421 fc_stats->fcp_output_requests = data->output_requests;
422 fc_stats->fcp_control_requests = data->control_requests;
423 fc_stats->fcp_input_megabytes = data->input_mb;
424 fc_stats->fcp_output_megabytes = data->output_mb;
425}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426
Martin Petermannf76af7d2008-07-02 10:56:36 +0200427static struct fc_host_statistics *zfcp_get_fc_host_stats(struct Scsi_Host *host)
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100428{
429 struct zfcp_adapter *adapter;
430 struct fc_host_statistics *fc_stats;
431 struct fsf_qtcb_bottom_port *data;
432 int ret;
433
Martin Petermannf76af7d2008-07-02 10:56:36 +0200434 adapter = (struct zfcp_adapter *)host->hostdata[0];
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100435 fc_stats = zfcp_init_fc_host_stats(adapter);
436 if (!fc_stats)
437 return NULL;
438
Andreas Herrmannec4081c2006-05-22 18:17:30 +0200439 data = kzalloc(sizeof(*data), GFP_KERNEL);
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100440 if (!data)
441 return NULL;
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100442
Swen Schillig564e1c82009-08-18 15:43:19 +0200443 ret = zfcp_fsf_exchange_port_data_sync(adapter->qdio, data);
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100444 if (ret) {
445 kfree(data);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200446 return NULL;
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100447 }
448
449 if (adapter->stats_reset &&
450 ((jiffies/HZ - adapter->stats_reset) <
Martin Petermannf76af7d2008-07-02 10:56:36 +0200451 data->seconds_since_last_reset))
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100452 zfcp_adjust_fc_host_stats(fc_stats, data,
453 adapter->stats_reset_data);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200454 else
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100455 zfcp_set_fc_host_stats(fc_stats, data);
456
457 kfree(data);
458 return fc_stats;
459}
460
Martin Petermannf76af7d2008-07-02 10:56:36 +0200461static void zfcp_reset_fc_host_stats(struct Scsi_Host *shost)
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100462{
463 struct zfcp_adapter *adapter;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200464 struct fsf_qtcb_bottom_port *data;
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100465 int ret;
466
467 adapter = (struct zfcp_adapter *)shost->hostdata[0];
Andreas Herrmannec4081c2006-05-22 18:17:30 +0200468 data = kzalloc(sizeof(*data), GFP_KERNEL);
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100469 if (!data)
470 return;
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100471
Swen Schillig564e1c82009-08-18 15:43:19 +0200472 ret = zfcp_fsf_exchange_port_data_sync(adapter->qdio, data);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200473 if (ret)
Heiko Carstens83f6d6d2007-08-08 10:47:02 +0200474 kfree(data);
Martin Petermannf76af7d2008-07-02 10:56:36 +0200475 else {
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100476 adapter->stats_reset = jiffies/HZ;
Martin Petermannf76af7d2008-07-02 10:56:36 +0200477 kfree(adapter->stats_reset_data);
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100478 adapter->stats_reset_data = data; /* finally freed in
Swen Schilligf3450c72009-11-24 16:53:59 +0100479 adapter_release */
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100480 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481}
482
Sven Schuetz85a82392008-06-10 18:20:59 +0200483static void zfcp_get_host_port_state(struct Scsi_Host *shost)
484{
485 struct zfcp_adapter *adapter =
486 (struct zfcp_adapter *)shost->hostdata[0];
487 int status = atomic_read(&adapter->status);
488
489 if ((status & ZFCP_STATUS_COMMON_RUNNING) &&
490 !(status & ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED))
491 fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
492 else if (status & ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED)
493 fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN;
494 else if (status & ZFCP_STATUS_COMMON_ERP_FAILED)
495 fc_host_port_state(shost) = FC_PORTSTATE_ERROR;
496 else
497 fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN;
498}
499
Andreas Herrmann338151e2006-05-22 18:25:56 +0200500static void zfcp_set_rport_dev_loss_tmo(struct fc_rport *rport, u32 timeout)
501{
502 rport->dev_loss_tmo = timeout;
503}
504
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100505/**
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100506 * zfcp_scsi_terminate_rport_io - Terminate all I/O on a rport
507 * @rport: The FC rport where to teminate I/O
508 *
509 * Abort all pending SCSI commands for a port by closing the
Swen Schilligecf0c772009-11-24 16:53:58 +0100510 * port. Using a reopen avoiding a conflict with a shutdown
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100511 * overwriting a reopen.
512 */
513static void zfcp_scsi_terminate_rport_io(struct fc_rport *rport)
514{
Christof Schmitt70932932009-04-17 15:08:15 +0200515 struct zfcp_port *port;
Swen Schilligea945ff2009-08-18 15:43:24 +0200516 struct Scsi_Host *shost = rport_to_shost(rport);
517 struct zfcp_adapter *adapter =
518 (struct zfcp_adapter *)shost->hostdata[0];
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100519
Swen Schilligea945ff2009-08-18 15:43:24 +0200520 port = zfcp_get_port_by_wwpn(adapter, rport->port_name);
Christof Schmitt70932932009-04-17 15:08:15 +0200521
522 if (port) {
523 zfcp_erp_port_reopen(port, 0, "sctrpi1", NULL);
Swen Schilligf3450c72009-11-24 16:53:59 +0100524 put_device(&port->sysfs_device);
Christof Schmitt70932932009-04-17 15:08:15 +0200525 }
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100526}
527
528static void zfcp_scsi_rport_register(struct zfcp_port *port)
529{
530 struct fc_rport_identifiers ids;
531 struct fc_rport *rport;
532
Christof Schmitt379d6bf2009-07-13 15:06:11 +0200533 if (port->rport)
534 return;
535
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100536 ids.node_name = port->wwnn;
537 ids.port_name = port->wwpn;
538 ids.port_id = port->d_id;
539 ids.roles = FC_RPORT_ROLE_FCP_TARGET;
540
541 rport = fc_remote_port_add(port->adapter->scsi_host, 0, &ids);
542 if (!rport) {
543 dev_err(&port->adapter->ccw_device->dev,
544 "Registering port 0x%016Lx failed\n",
545 (unsigned long long)port->wwpn);
546 return;
547 }
548
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100549 rport->maxframe_size = port->maxframe_size;
550 rport->supported_classes = port->supported_classes;
551 port->rport = rport;
552}
553
554static void zfcp_scsi_rport_block(struct zfcp_port *port)
555{
Christof Schmitt70932932009-04-17 15:08:15 +0200556 struct fc_rport *rport = port->rport;
557
Christof Schmitt379d6bf2009-07-13 15:06:11 +0200558 if (rport) {
Christof Schmitt70932932009-04-17 15:08:15 +0200559 fc_remote_port_delete(rport);
Christof Schmitt379d6bf2009-07-13 15:06:11 +0200560 port->rport = NULL;
561 }
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100562}
563
564void zfcp_scsi_schedule_rport_register(struct zfcp_port *port)
565{
Swen Schilligf3450c72009-11-24 16:53:59 +0100566 get_device(&port->sysfs_device);
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100567 port->rport_task = RPORT_ADD;
568
Swen Schillig45446832009-08-18 15:43:17 +0200569 if (!queue_work(port->adapter->work_queue, &port->rport_work))
Swen Schilligf3450c72009-11-24 16:53:59 +0100570 put_device(&port->sysfs_device);
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100571}
572
573void zfcp_scsi_schedule_rport_block(struct zfcp_port *port)
574{
Swen Schilligf3450c72009-11-24 16:53:59 +0100575 get_device(&port->sysfs_device);
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100576 port->rport_task = RPORT_DEL;
577
Swen Schillig45446832009-08-18 15:43:17 +0200578 if (port->rport && queue_work(port->adapter->work_queue,
579 &port->rport_work))
Swen Schilliga67417a2009-08-18 15:43:06 +0200580 return;
581
Swen Schilligf3450c72009-11-24 16:53:59 +0100582 put_device(&port->sysfs_device);
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100583}
584
585void zfcp_scsi_schedule_rports_block(struct zfcp_adapter *adapter)
586{
Swen Schilligecf0c772009-11-24 16:53:58 +0100587 unsigned long flags;
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100588 struct zfcp_port *port;
589
Swen Schilligecf0c772009-11-24 16:53:58 +0100590 read_lock_irqsave(&adapter->port_list_lock, flags);
591 list_for_each_entry(port, &adapter->port_list, list)
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100592 zfcp_scsi_schedule_rport_block(port);
Swen Schilligecf0c772009-11-24 16:53:58 +0100593 read_unlock_irqrestore(&adapter->port_list_lock, flags);
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100594}
595
596void zfcp_scsi_rport_work(struct work_struct *work)
597{
598 struct zfcp_port *port = container_of(work, struct zfcp_port,
599 rport_work);
600
601 while (port->rport_task) {
602 if (port->rport_task == RPORT_ADD) {
603 port->rport_task = RPORT_NONE;
604 zfcp_scsi_rport_register(port);
605 } else {
606 port->rport_task = RPORT_NONE;
607 zfcp_scsi_rport_block(port);
608 }
609 }
610
Swen Schilligf3450c72009-11-24 16:53:59 +0100611 put_device(&port->sysfs_device);
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100612}
613
614
Swen Schillig92d51932009-04-17 15:08:04 +0200615void zfcp_scsi_scan(struct work_struct *work)
616{
617 struct zfcp_unit *unit = container_of(work, struct zfcp_unit,
618 scsi_work);
619 struct fc_rport *rport;
620
621 flush_work(&unit->port->rport_work);
622 rport = unit->port->rport;
623
624 if (rport && rport->port_state == FC_PORTSTATE_ONLINE)
625 scsi_scan_target(&rport->dev, 0, rport->scsi_target_id,
626 scsilun_to_int((struct scsi_lun *)
627 &unit->fcp_lun), 0);
628
Swen Schilligf3450c72009-11-24 16:53:59 +0100629 put_device(&unit->sysfs_device);
Swen Schillig92d51932009-04-17 15:08:04 +0200630}
631
Linus Torvalds1da177e2005-04-16 15:20:36 -0700632struct fc_function_template zfcp_transport_functions = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 .show_starget_port_id = 1,
634 .show_starget_port_name = 1,
635 .show_starget_node_name = 1,
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700636 .show_rport_supported_classes = 1,
Ralph Wuerthner75bfc282006-05-22 18:24:33 +0200637 .show_rport_maxframe_size = 1,
Andreas Herrmann338151e2006-05-22 18:25:56 +0200638 .show_rport_dev_loss_tmo = 1,
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700639 .show_host_node_name = 1,
640 .show_host_port_name = 1,
Andreas Herrmannad757cd2006-01-13 02:26:11 +0100641 .show_host_permanent_port_name = 1,
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700642 .show_host_supported_classes = 1,
Christof Schmitt0fdd2132009-11-24 16:54:17 +0100643 .show_host_supported_fc4s = 1,
Andreas Herrmannad757cd2006-01-13 02:26:11 +0100644 .show_host_supported_speeds = 1,
Andreas Herrmann13e1e1f2005-09-19 16:56:17 +0200645 .show_host_maxframe_size = 1,
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700646 .show_host_serial_number = 1,
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100647 .get_fc_host_stats = zfcp_get_fc_host_stats,
648 .reset_fc_host_stats = zfcp_reset_fc_host_stats,
Andreas Herrmann338151e2006-05-22 18:25:56 +0200649 .set_rport_dev_loss_tmo = zfcp_set_rport_dev_loss_tmo,
Sven Schuetz85a82392008-06-10 18:20:59 +0200650 .get_host_port_state = zfcp_get_host_port_state,
Christof Schmitta2fa0ae2009-03-02 13:09:08 +0100651 .terminate_rport_io = zfcp_scsi_terminate_rport_io,
Sven Schuetz85a82392008-06-10 18:20:59 +0200652 .show_host_port_state = 1,
Christof Schmitt0fdd2132009-11-24 16:54:17 +0100653 .show_host_active_fc4s = 1,
Christof Schmitt7c7dc192009-11-24 16:54:13 +0100654 .bsg_request = zfcp_fc_exec_bsg_job,
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100655 /* no functions registered for following dynamic attributes but
656 directly set by LLDD */
Andreas Herrmannad757cd2006-01-13 02:26:11 +0100657 .show_host_port_type = 1,
Andreas Herrmann13e1e1f2005-09-19 16:56:17 +0200658 .show_host_speed = 1,
659 .show_host_port_id = 1,
Swen Schillig52ef11a2007-08-28 09:31:09 +0200660 .disable_target_scan = 1,
Christof Schmitt7c7dc192009-11-24 16:54:13 +0100661 .dd_bsg_size = sizeof(struct zfcp_fsf_ct_els),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700662};
663
Martin Petermannf76af7d2008-07-02 10:56:36 +0200664struct zfcp_data zfcp_data = {
665 .scsi_host_template = {
666 .name = "zfcp",
667 .module = THIS_MODULE,
668 .proc_name = "zfcp",
Christof Schmitta40a1ba2009-05-15 13:18:16 +0200669 .change_queue_depth = zfcp_scsi_change_queue_depth,
Martin Petermannf76af7d2008-07-02 10:56:36 +0200670 .slave_alloc = zfcp_scsi_slave_alloc,
671 .slave_configure = zfcp_scsi_slave_configure,
672 .slave_destroy = zfcp_scsi_slave_destroy,
673 .queuecommand = zfcp_scsi_queuecommand,
674 .eh_abort_handler = zfcp_scsi_eh_abort_handler,
675 .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler,
676 .eh_target_reset_handler = zfcp_scsi_eh_target_reset_handler,
677 .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler,
678 .can_queue = 4096,
679 .this_id = -1,
680 .sg_tablesize = ZFCP_MAX_SBALES_PER_REQ,
681 .cmd_per_lun = 1,
682 .use_clustering = 1,
683 .sdev_attrs = zfcp_sysfs_sdev_attrs,
684 .max_sectors = (ZFCP_MAX_SBALES_PER_REQ * 8),
Swen Schillig60221922008-07-02 10:56:38 +0200685 .shost_attrs = zfcp_sysfs_shost_attrs,
Martin Petermannf76af7d2008-07-02 10:56:36 +0200686 },
687};