zfcp_fc.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /*
  2. * zfcp device driver
  3. *
  4. * Fibre Channel related functions for the zfcp device driver.
  5. *
  6. * Copyright IBM Corporation 2008
  7. */
  8. #include "zfcp_ext.h"
  9. struct ct_iu_gpn_ft_req {
  10. struct ct_hdr header;
  11. u8 flags;
  12. u8 domain_id_scope;
  13. u8 area_id_scope;
  14. u8 fc4_type;
  15. } __attribute__ ((packed));
  16. struct gpn_ft_resp_acc {
  17. u8 control;
  18. u8 port_id[3];
  19. u8 reserved[4];
  20. u64 wwpn;
  21. } __attribute__ ((packed));
  22. #define ZFCP_GPN_FT_ENTRIES ((PAGE_SIZE - sizeof(struct ct_hdr)) \
  23. / sizeof(struct gpn_ft_resp_acc))
  24. #define ZFCP_GPN_FT_BUFFERS 4
  25. #define ZFCP_GPN_FT_MAX_ENTRIES ZFCP_GPN_FT_BUFFERS * (ZFCP_GPN_FT_ENTRIES + 1)
  26. struct ct_iu_gpn_ft_resp {
  27. struct ct_hdr header;
  28. struct gpn_ft_resp_acc accept[ZFCP_GPN_FT_ENTRIES];
  29. } __attribute__ ((packed));
  30. struct zfcp_gpn_ft {
  31. struct zfcp_send_ct ct;
  32. struct scatterlist sg_req;
  33. struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS];
  34. };
  35. static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
  36. struct fcp_rscn_element *elem)
  37. {
  38. unsigned long flags;
  39. struct zfcp_port *port;
  40. read_lock_irqsave(&zfcp_data.config_lock, flags);
  41. list_for_each_entry(port, &fsf_req->adapter->port_list_head, list) {
  42. if ((atomic_read(&port->status) & ZFCP_STATUS_PORT_WKA) ==
  43. ZFCP_STATUS_PORT_WKA)
  44. continue;
  45. /* FIXME: ZFCP_STATUS_PORT_DID_DID check is racy */
  46. if (!(atomic_read(&port->status) & ZFCP_STATUS_PORT_DID_DID))
  47. /* Try to connect to unused ports anyway. */
  48. zfcp_erp_port_reopen(port,
  49. ZFCP_STATUS_COMMON_ERP_FAILED,
  50. 82, fsf_req);
  51. else if ((port->d_id & range) == (elem->nport_did & range))
  52. /* Check connection status for connected ports */
  53. zfcp_test_link(port);
  54. }
  55. read_unlock_irqrestore(&zfcp_data.config_lock, flags);
  56. }
  57. static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req)
  58. {
  59. struct fsf_status_read_buffer *status_buffer = (void *)fsf_req->data;
  60. struct fcp_rscn_head *fcp_rscn_head;
  61. struct fcp_rscn_element *fcp_rscn_element;
  62. u16 i;
  63. u16 no_entries;
  64. u32 range_mask;
  65. fcp_rscn_head = (struct fcp_rscn_head *) status_buffer->payload.data;
  66. fcp_rscn_element = (struct fcp_rscn_element *) fcp_rscn_head;
  67. /* see FC-FS */
  68. no_entries = fcp_rscn_head->payload_len /
  69. sizeof(struct fcp_rscn_element);
  70. for (i = 1; i < no_entries; i++) {
  71. /* skip head and start with 1st element */
  72. fcp_rscn_element++;
  73. switch (fcp_rscn_element->addr_format) {
  74. case ZFCP_PORT_ADDRESS:
  75. range_mask = ZFCP_PORTS_RANGE_PORT;
  76. break;
  77. case ZFCP_AREA_ADDRESS:
  78. range_mask = ZFCP_PORTS_RANGE_AREA;
  79. break;
  80. case ZFCP_DOMAIN_ADDRESS:
  81. range_mask = ZFCP_PORTS_RANGE_DOMAIN;
  82. break;
  83. case ZFCP_FABRIC_ADDRESS:
  84. range_mask = ZFCP_PORTS_RANGE_FABRIC;
  85. break;
  86. default:
  87. continue;
  88. }
  89. _zfcp_fc_incoming_rscn(fsf_req, range_mask, fcp_rscn_element);
  90. }
  91. schedule_work(&fsf_req->adapter->scan_work);
  92. }
  93. static void zfcp_fc_incoming_wwpn(struct zfcp_fsf_req *req, wwn_t wwpn)
  94. {
  95. struct zfcp_adapter *adapter = req->adapter;
  96. struct zfcp_port *port;
  97. unsigned long flags;
  98. read_lock_irqsave(&zfcp_data.config_lock, flags);
  99. list_for_each_entry(port, &adapter->port_list_head, list)
  100. if (port->wwpn == wwpn)
  101. break;
  102. read_unlock_irqrestore(&zfcp_data.config_lock, flags);
  103. if (port && (port->wwpn == wwpn))
  104. zfcp_erp_port_forced_reopen(port, 0, 83, req);
  105. }
  106. static void zfcp_fc_incoming_plogi(struct zfcp_fsf_req *req)
  107. {
  108. struct fsf_status_read_buffer *status_buffer =
  109. (struct fsf_status_read_buffer *)req->data;
  110. struct fsf_plogi *els_plogi =
  111. (struct fsf_plogi *) status_buffer->payload.data;
  112. zfcp_fc_incoming_wwpn(req, els_plogi->serv_param.wwpn);
  113. }
  114. static void zfcp_fc_incoming_logo(struct zfcp_fsf_req *req)
  115. {
  116. struct fsf_status_read_buffer *status_buffer =
  117. (struct fsf_status_read_buffer *)req->data;
  118. struct fcp_logo *els_logo =
  119. (struct fcp_logo *) status_buffer->payload.data;
  120. zfcp_fc_incoming_wwpn(req, els_logo->nport_wwpn);
  121. }
  122. /**
  123. * zfcp_fc_incoming_els - handle incoming ELS
  124. * @fsf_req - request which contains incoming ELS
  125. */
  126. void zfcp_fc_incoming_els(struct zfcp_fsf_req *fsf_req)
  127. {
  128. struct fsf_status_read_buffer *status_buffer =
  129. (struct fsf_status_read_buffer *) fsf_req->data;
  130. unsigned int els_type = status_buffer->payload.data[0];
  131. zfcp_san_dbf_event_incoming_els(fsf_req);
  132. if (els_type == LS_PLOGI)
  133. zfcp_fc_incoming_plogi(fsf_req);
  134. else if (els_type == LS_LOGO)
  135. zfcp_fc_incoming_logo(fsf_req);
  136. else if (els_type == LS_RSCN)
  137. zfcp_fc_incoming_rscn(fsf_req);
  138. }
  139. static void zfcp_ns_gid_pn_handler(unsigned long data)
  140. {
  141. struct zfcp_gid_pn_data *gid_pn = (struct zfcp_gid_pn_data *) data;
  142. struct zfcp_send_ct *ct = &gid_pn->ct;
  143. struct ct_iu_gid_pn_req *ct_iu_req = sg_virt(ct->req);
  144. struct ct_iu_gid_pn_resp *ct_iu_resp = sg_virt(ct->resp);
  145. struct zfcp_port *port = gid_pn->port;
  146. if (ct->status)
  147. goto out;
  148. if (ct_iu_resp->header.cmd_rsp_code != ZFCP_CT_ACCEPT) {
  149. atomic_set_mask(ZFCP_STATUS_PORT_INVALID_WWPN, &port->status);
  150. goto out;
  151. }
  152. /* paranoia */
  153. if (ct_iu_req->wwpn != port->wwpn)
  154. goto out;
  155. /* looks like a valid d_id */
  156. port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK;
  157. atomic_set_mask(ZFCP_STATUS_PORT_DID_DID, &port->status);
  158. out:
  159. mempool_free(gid_pn, port->adapter->pool.data_gid_pn);
  160. }
  161. /**
  162. * zfcp_fc_ns_gid_pn_request - initiate GID_PN nameserver request
  163. * @erp_action: pointer to zfcp_erp_action where GID_PN request is needed
  164. * return: -ENOMEM on error, 0 otherwise
  165. */
  166. int zfcp_fc_ns_gid_pn_request(struct zfcp_erp_action *erp_action)
  167. {
  168. int ret;
  169. struct zfcp_gid_pn_data *gid_pn;
  170. struct zfcp_adapter *adapter = erp_action->adapter;
  171. gid_pn = mempool_alloc(adapter->pool.data_gid_pn, GFP_ATOMIC);
  172. if (!gid_pn)
  173. return -ENOMEM;
  174. memset(gid_pn, 0, sizeof(*gid_pn));
  175. /* setup parameters for send generic command */
  176. gid_pn->port = erp_action->port;
  177. gid_pn->ct.port = adapter->nameserver_port;
  178. gid_pn->ct.handler = zfcp_ns_gid_pn_handler;
  179. gid_pn->ct.handler_data = (unsigned long) gid_pn;
  180. gid_pn->ct.timeout = ZFCP_NS_GID_PN_TIMEOUT;
  181. gid_pn->ct.req = &gid_pn->req;
  182. gid_pn->ct.resp = &gid_pn->resp;
  183. gid_pn->ct.req_count = 1;
  184. gid_pn->ct.resp_count = 1;
  185. sg_init_one(&gid_pn->req, &gid_pn->ct_iu_req,
  186. sizeof(struct ct_iu_gid_pn_req));
  187. sg_init_one(&gid_pn->resp, &gid_pn->ct_iu_resp,
  188. sizeof(struct ct_iu_gid_pn_resp));
  189. /* setup nameserver request */
  190. gid_pn->ct_iu_req.header.revision = ZFCP_CT_REVISION;
  191. gid_pn->ct_iu_req.header.gs_type = ZFCP_CT_DIRECTORY_SERVICE;
  192. gid_pn->ct_iu_req.header.gs_subtype = ZFCP_CT_NAME_SERVER;
  193. gid_pn->ct_iu_req.header.options = ZFCP_CT_SYNCHRONOUS;
  194. gid_pn->ct_iu_req.header.cmd_rsp_code = ZFCP_CT_GID_PN;
  195. gid_pn->ct_iu_req.header.max_res_size = ZFCP_CT_MAX_SIZE;
  196. gid_pn->ct_iu_req.wwpn = erp_action->port->wwpn;
  197. ret = zfcp_fsf_send_ct(&gid_pn->ct, adapter->pool.fsf_req_erp,
  198. erp_action);
  199. if (ret)
  200. mempool_free(gid_pn, adapter->pool.data_gid_pn);
  201. return ret;
  202. }
  203. /**
  204. * zfcp_fc_plogi_evaluate - evaluate PLOGI playload
  205. * @port: zfcp_port structure
  206. * @plogi: plogi payload
  207. *
  208. * Evaluate PLOGI playload and copy important fields into zfcp_port structure
  209. */
  210. void zfcp_fc_plogi_evaluate(struct zfcp_port *port, struct fsf_plogi *plogi)
  211. {
  212. port->maxframe_size = plogi->serv_param.common_serv_param[7] |
  213. ((plogi->serv_param.common_serv_param[6] & 0x0F) << 8);
  214. if (plogi->serv_param.class1_serv_param[0] & 0x80)
  215. port->supported_classes |= FC_COS_CLASS1;
  216. if (plogi->serv_param.class2_serv_param[0] & 0x80)
  217. port->supported_classes |= FC_COS_CLASS2;
  218. if (plogi->serv_param.class3_serv_param[0] & 0x80)
  219. port->supported_classes |= FC_COS_CLASS3;
  220. if (plogi->serv_param.class4_serv_param[0] & 0x80)
  221. port->supported_classes |= FC_COS_CLASS4;
  222. }
  223. struct zfcp_els_adisc {
  224. struct zfcp_send_els els;
  225. struct scatterlist req;
  226. struct scatterlist resp;
  227. struct zfcp_ls_adisc ls_adisc;
  228. struct zfcp_ls_adisc ls_adisc_acc;
  229. };
  230. static void zfcp_fc_adisc_handler(unsigned long data)
  231. {
  232. struct zfcp_els_adisc *adisc = (struct zfcp_els_adisc *) data;
  233. struct zfcp_port *port = adisc->els.port;
  234. struct zfcp_ls_adisc *ls_adisc = &adisc->ls_adisc_acc;
  235. if (adisc->els.status) {
  236. /* request rejected or timed out */
  237. zfcp_erp_port_forced_reopen(port, 0, 63, NULL);
  238. goto out;
  239. }
  240. if (!port->wwnn)
  241. port->wwnn = ls_adisc->wwnn;
  242. if (port->wwpn != ls_adisc->wwpn)
  243. zfcp_erp_port_reopen(port, 0, 64, NULL);
  244. out:
  245. zfcp_port_put(port);
  246. kfree(adisc);
  247. }
  248. static int zfcp_fc_adisc(struct zfcp_port *port)
  249. {
  250. struct zfcp_els_adisc *adisc;
  251. struct zfcp_adapter *adapter = port->adapter;
  252. adisc = kzalloc(sizeof(struct zfcp_els_adisc), GFP_ATOMIC);
  253. if (!adisc)
  254. return -ENOMEM;
  255. adisc->els.req = &adisc->req;
  256. adisc->els.resp = &adisc->resp;
  257. sg_init_one(adisc->els.req, &adisc->ls_adisc,
  258. sizeof(struct zfcp_ls_adisc));
  259. sg_init_one(adisc->els.resp, &adisc->ls_adisc_acc,
  260. sizeof(struct zfcp_ls_adisc));
  261. adisc->els.req_count = 1;
  262. adisc->els.resp_count = 1;
  263. adisc->els.adapter = adapter;
  264. adisc->els.port = port;
  265. adisc->els.d_id = port->d_id;
  266. adisc->els.handler = zfcp_fc_adisc_handler;
  267. adisc->els.handler_data = (unsigned long) adisc;
  268. adisc->els.ls_code = adisc->ls_adisc.code = ZFCP_LS_ADISC;
  269. /* acc. to FC-FS, hard_nport_id in ADISC should not be set for ports
  270. without FC-AL-2 capability, so we don't set it */
  271. adisc->ls_adisc.wwpn = fc_host_port_name(adapter->scsi_host);
  272. adisc->ls_adisc.wwnn = fc_host_node_name(adapter->scsi_host);
  273. adisc->ls_adisc.nport_id = fc_host_port_id(adapter->scsi_host);
  274. return zfcp_fsf_send_els(&adisc->els);
  275. }
  276. /**
  277. * zfcp_test_link - lightweight link test procedure
  278. * @port: port to be tested
  279. *
  280. * Test status of a link to a remote port using the ELS command ADISC.
  281. * If there is a problem with the remote port, error recovery steps
  282. * will be triggered.
  283. */
  284. void zfcp_test_link(struct zfcp_port *port)
  285. {
  286. int retval;
  287. zfcp_port_get(port);
  288. retval = zfcp_fc_adisc(port);
  289. if (retval == 0)
  290. return;
  291. /* send of ADISC was not possible */
  292. zfcp_port_put(port);
  293. if (retval != -EBUSY)
  294. zfcp_erp_port_forced_reopen(port, 0, 65, NULL);
  295. }
  296. static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter)
  297. {
  298. int ret;
  299. if (!adapter->nameserver_port)
  300. return -EINTR;
  301. if (!(atomic_read(&adapter->nameserver_port->status) &
  302. ZFCP_STATUS_COMMON_UNBLOCKED)) {
  303. ret = zfcp_erp_port_reopen(adapter->nameserver_port, 0, 148,
  304. NULL);
  305. if (ret)
  306. return ret;
  307. zfcp_erp_wait(adapter);
  308. }
  309. return !(atomic_read(&adapter->nameserver_port->status) &
  310. ZFCP_STATUS_COMMON_UNBLOCKED);
  311. }
  312. static void zfcp_gpn_ft_handler(unsigned long _done)
  313. {
  314. complete((struct completion *)_done);
  315. }
  316. static void zfcp_free_sg_env(struct zfcp_gpn_ft *gpn_ft)
  317. {
  318. struct scatterlist *sg = &gpn_ft->sg_req;
  319. kfree(sg_virt(sg)); /* free request buffer */
  320. zfcp_sg_free_table(gpn_ft->sg_resp, ZFCP_GPN_FT_BUFFERS);
  321. kfree(gpn_ft);
  322. }
  323. static struct zfcp_gpn_ft *zfcp_alloc_sg_env(void)
  324. {
  325. struct zfcp_gpn_ft *gpn_ft;
  326. struct ct_iu_gpn_ft_req *req;
  327. gpn_ft = kzalloc(sizeof(*gpn_ft), GFP_KERNEL);
  328. if (!gpn_ft)
  329. return NULL;
  330. req = kzalloc(sizeof(struct ct_iu_gpn_ft_req), GFP_KERNEL);
  331. if (!req) {
  332. kfree(gpn_ft);
  333. gpn_ft = NULL;
  334. goto out;
  335. }
  336. sg_init_one(&gpn_ft->sg_req, req, sizeof(*req));
  337. if (zfcp_sg_setup_table(gpn_ft->sg_resp, ZFCP_GPN_FT_BUFFERS)) {
  338. zfcp_free_sg_env(gpn_ft);
  339. gpn_ft = NULL;
  340. }
  341. out:
  342. return gpn_ft;
  343. }
  344. static int zfcp_scan_issue_gpn_ft(struct zfcp_gpn_ft *gpn_ft,
  345. struct zfcp_adapter *adapter)
  346. {
  347. struct zfcp_send_ct *ct = &gpn_ft->ct;
  348. struct ct_iu_gpn_ft_req *req = sg_virt(&gpn_ft->sg_req);
  349. struct completion done;
  350. int ret;
  351. /* prepare CT IU for GPN_FT */
  352. req->header.revision = ZFCP_CT_REVISION;
  353. req->header.gs_type = ZFCP_CT_DIRECTORY_SERVICE;
  354. req->header.gs_subtype = ZFCP_CT_NAME_SERVER;
  355. req->header.options = ZFCP_CT_SYNCHRONOUS;
  356. req->header.cmd_rsp_code = ZFCP_CT_GPN_FT;
  357. req->header.max_res_size = (sizeof(struct gpn_ft_resp_acc) *
  358. (ZFCP_GPN_FT_MAX_ENTRIES - 1)) >> 2;
  359. req->flags = 0;
  360. req->domain_id_scope = 0;
  361. req->area_id_scope = 0;
  362. req->fc4_type = ZFCP_CT_SCSI_FCP;
  363. /* prepare zfcp_send_ct */
  364. ct->port = adapter->nameserver_port;
  365. ct->handler = zfcp_gpn_ft_handler;
  366. ct->handler_data = (unsigned long)&done;
  367. ct->timeout = 10;
  368. ct->req = &gpn_ft->sg_req;
  369. ct->resp = gpn_ft->sg_resp;
  370. ct->req_count = 1;
  371. ct->resp_count = ZFCP_GPN_FT_BUFFERS;
  372. init_completion(&done);
  373. ret = zfcp_fsf_send_ct(ct, NULL, NULL);
  374. if (!ret)
  375. wait_for_completion(&done);
  376. return ret;
  377. }
  378. static void zfcp_validate_port(struct zfcp_port *port)
  379. {
  380. struct zfcp_adapter *adapter = port->adapter;
  381. atomic_clear_mask(ZFCP_STATUS_COMMON_NOESC, &port->status);
  382. if (port == adapter->nameserver_port)
  383. return;
  384. if ((port->supported_classes != 0) || (port->units != 0)) {
  385. zfcp_port_put(port);
  386. return;
  387. }
  388. zfcp_erp_port_shutdown(port, 0, 151, NULL);
  389. zfcp_erp_wait(adapter);
  390. zfcp_port_put(port);
  391. zfcp_port_dequeue(port);
  392. }
  393. static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft)
  394. {
  395. struct zfcp_send_ct *ct = &gpn_ft->ct;
  396. struct scatterlist *sg = gpn_ft->sg_resp;
  397. struct ct_hdr *hdr = sg_virt(sg);
  398. struct gpn_ft_resp_acc *acc = sg_virt(sg);
  399. struct zfcp_adapter *adapter = ct->port->adapter;
  400. struct zfcp_port *port, *tmp;
  401. u32 d_id;
  402. int ret = 0, x, last = 0;
  403. if (ct->status)
  404. return -EIO;
  405. if (hdr->cmd_rsp_code != ZFCP_CT_ACCEPT) {
  406. if (hdr->reason_code == ZFCP_CT_UNABLE_TO_PERFORM_CMD)
  407. return -EAGAIN; /* might be a temporary condition */
  408. return -EIO;
  409. }
  410. if (hdr->max_res_size)
  411. return -E2BIG;
  412. down(&zfcp_data.config_sema);
  413. /* first entry is the header */
  414. for (x = 1; x < ZFCP_GPN_FT_MAX_ENTRIES && !last; x++) {
  415. if (x % (ZFCP_GPN_FT_ENTRIES + 1))
  416. acc++;
  417. else
  418. acc = sg_virt(++sg);
  419. last = acc->control & 0x80;
  420. d_id = acc->port_id[0] << 16 | acc->port_id[1] << 8 |
  421. acc->port_id[2];
  422. /* skip the adapter's port and known remote ports */
  423. if (acc->wwpn == fc_host_port_name(adapter->scsi_host))
  424. continue;
  425. port = zfcp_get_port_by_wwpn(adapter, acc->wwpn);
  426. if (port) {
  427. zfcp_port_get(port);
  428. continue;
  429. }
  430. port = zfcp_port_enqueue(adapter, acc->wwpn,
  431. ZFCP_STATUS_PORT_DID_DID |
  432. ZFCP_STATUS_COMMON_NOESC, d_id);
  433. if (IS_ERR(port))
  434. ret = PTR_ERR(port);
  435. else
  436. zfcp_erp_port_reopen(port, 0, 149, NULL);
  437. }
  438. zfcp_erp_wait(adapter);
  439. list_for_each_entry_safe(port, tmp, &adapter->port_list_head, list)
  440. zfcp_validate_port(port);
  441. up(&zfcp_data.config_sema);
  442. return ret;
  443. }
  444. /**
  445. * zfcp_scan_ports - scan remote ports and attach new ports
  446. * @adapter: pointer to struct zfcp_adapter
  447. */
  448. int zfcp_scan_ports(struct zfcp_adapter *adapter)
  449. {
  450. int ret, i;
  451. struct zfcp_gpn_ft *gpn_ft;
  452. zfcp_erp_wait(adapter); /* wait until adapter is finished with ERP */
  453. if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT)
  454. return 0;
  455. ret = zfcp_scan_get_nameserver(adapter);
  456. if (ret)
  457. return ret;
  458. gpn_ft = zfcp_alloc_sg_env();
  459. if (!gpn_ft)
  460. return -ENOMEM;
  461. for (i = 0; i < 3; i++) {
  462. ret = zfcp_scan_issue_gpn_ft(gpn_ft, adapter);
  463. if (!ret) {
  464. ret = zfcp_scan_eval_gpn_ft(gpn_ft);
  465. if (ret == -EAGAIN)
  466. ssleep(1);
  467. else
  468. break;
  469. }
  470. }
  471. zfcp_free_sg_env(gpn_ft);
  472. return ret;
  473. }
  474. void _zfcp_scan_ports_later(struct work_struct *work)
  475. {
  476. zfcp_scan_ports(container_of(work, struct zfcp_adapter, scan_work));
  477. }