tfc_conf.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. /*******************************************************************************
  2. * Filename: tcm_fc.c
  3. *
  4. * This file contains the configfs implementation for TCM_fc fabric node.
  5. * Based on tcm_loop_configfs.c
  6. *
  7. * Copyright (c) 2010 Cisco Systems, Inc.
  8. * Copyright (c) 2009,2010 Rising Tide, Inc.
  9. * Copyright (c) 2009,2010 Linux-iSCSI.org
  10. *
  11. * Copyright (c) 2009,2010 Nicholas A. Bellinger <nab@linux-iscsi.org>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. ****************************************************************************/
  23. #include <linux/module.h>
  24. #include <linux/moduleparam.h>
  25. #include <generated/utsrelease.h>
  26. #include <linux/utsname.h>
  27. #include <linux/init.h>
  28. #include <linux/slab.h>
  29. #include <linux/kthread.h>
  30. #include <linux/types.h>
  31. #include <linux/string.h>
  32. #include <linux/configfs.h>
  33. #include <linux/kernel.h>
  34. #include <linux/ctype.h>
  35. #include <asm/unaligned.h>
  36. #include <scsi/scsi.h>
  37. #include <scsi/scsi_host.h>
  38. #include <scsi/scsi_device.h>
  39. #include <scsi/scsi_cmnd.h>
  40. #include <scsi/libfc.h>
  41. #include <target/target_core_base.h>
  42. #include <target/target_core_fabric.h>
  43. #include <target/target_core_fabric_configfs.h>
  44. #include <target/target_core_configfs.h>
  45. #include <target/configfs_macros.h>
  46. #include "tcm_fc.h"
  47. struct target_fabric_configfs *ft_configfs;
  48. LIST_HEAD(ft_lport_list);
  49. DEFINE_MUTEX(ft_lport_lock);
  50. unsigned int ft_debug_logging;
  51. module_param_named(debug_logging, ft_debug_logging, int, S_IRUGO|S_IWUSR);
  52. MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
  53. /*
  54. * Parse WWN.
  55. * If strict, we require lower-case hex and colon separators to be sure
  56. * the name is the same as what would be generated by ft_format_wwn()
  57. * so the name and wwn are mapped one-to-one.
  58. */
  59. static ssize_t ft_parse_wwn(const char *name, u64 *wwn, int strict)
  60. {
  61. const char *cp;
  62. char c;
  63. u32 byte = 0;
  64. u32 pos = 0;
  65. u32 err;
  66. int val;
  67. *wwn = 0;
  68. for (cp = name; cp < &name[FT_NAMELEN - 1]; cp++) {
  69. c = *cp;
  70. if (c == '\n' && cp[1] == '\0')
  71. continue;
  72. if (strict && pos++ == 2 && byte++ < 7) {
  73. pos = 0;
  74. if (c == ':')
  75. continue;
  76. err = 1;
  77. goto fail;
  78. }
  79. if (c == '\0') {
  80. err = 2;
  81. if (strict && byte != 8)
  82. goto fail;
  83. return cp - name;
  84. }
  85. err = 3;
  86. val = hex_to_bin(c);
  87. if (val < 0 || (strict && isupper(c)))
  88. goto fail;
  89. *wwn = (*wwn << 4) | val;
  90. }
  91. err = 4;
  92. fail:
  93. pr_debug("err %u len %zu pos %u byte %u\n",
  94. err, cp - name, pos, byte);
  95. return -1;
  96. }
  97. ssize_t ft_format_wwn(char *buf, size_t len, u64 wwn)
  98. {
  99. u8 b[8];
  100. put_unaligned_be64(wwn, b);
  101. return snprintf(buf, len,
  102. "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",
  103. b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]);
  104. }
  105. static ssize_t ft_wwn_show(void *arg, char *buf)
  106. {
  107. u64 *wwn = arg;
  108. ssize_t len;
  109. len = ft_format_wwn(buf, PAGE_SIZE - 2, *wwn);
  110. buf[len++] = '\n';
  111. return len;
  112. }
  113. static ssize_t ft_wwn_store(void *arg, const char *buf, size_t len)
  114. {
  115. ssize_t ret;
  116. u64 wwn;
  117. ret = ft_parse_wwn(buf, &wwn, 0);
  118. if (ret > 0)
  119. *(u64 *)arg = wwn;
  120. return ret;
  121. }
  122. /*
  123. * ACL auth ops.
  124. */
  125. static ssize_t ft_nacl_show_port_name(
  126. struct se_node_acl *se_nacl,
  127. char *page)
  128. {
  129. struct ft_node_acl *acl = container_of(se_nacl,
  130. struct ft_node_acl, se_node_acl);
  131. return ft_wwn_show(&acl->node_auth.port_name, page);
  132. }
  133. static ssize_t ft_nacl_store_port_name(
  134. struct se_node_acl *se_nacl,
  135. const char *page,
  136. size_t count)
  137. {
  138. struct ft_node_acl *acl = container_of(se_nacl,
  139. struct ft_node_acl, se_node_acl);
  140. return ft_wwn_store(&acl->node_auth.port_name, page, count);
  141. }
  142. TF_NACL_BASE_ATTR(ft, port_name, S_IRUGO | S_IWUSR);
  143. static ssize_t ft_nacl_show_node_name(
  144. struct se_node_acl *se_nacl,
  145. char *page)
  146. {
  147. struct ft_node_acl *acl = container_of(se_nacl,
  148. struct ft_node_acl, se_node_acl);
  149. return ft_wwn_show(&acl->node_auth.node_name, page);
  150. }
  151. static ssize_t ft_nacl_store_node_name(
  152. struct se_node_acl *se_nacl,
  153. const char *page,
  154. size_t count)
  155. {
  156. struct ft_node_acl *acl = container_of(se_nacl,
  157. struct ft_node_acl, se_node_acl);
  158. return ft_wwn_store(&acl->node_auth.node_name, page, count);
  159. }
  160. TF_NACL_BASE_ATTR(ft, node_name, S_IRUGO | S_IWUSR);
  161. static struct configfs_attribute *ft_nacl_base_attrs[] = {
  162. &ft_nacl_port_name.attr,
  163. &ft_nacl_node_name.attr,
  164. NULL,
  165. };
  166. /*
  167. * ACL ops.
  168. */
  169. /*
  170. * Add ACL for an initiator. The ACL is named arbitrarily.
  171. * The port_name and/or node_name are attributes.
  172. */
  173. static struct se_node_acl *ft_add_acl(
  174. struct se_portal_group *se_tpg,
  175. struct config_group *group,
  176. const char *name)
  177. {
  178. struct ft_node_acl *acl;
  179. struct ft_tpg *tpg;
  180. u64 wwpn;
  181. u32 q_depth;
  182. pr_debug("add acl %s\n", name);
  183. tpg = container_of(se_tpg, struct ft_tpg, se_tpg);
  184. if (ft_parse_wwn(name, &wwpn, 1) < 0)
  185. return ERR_PTR(-EINVAL);
  186. acl = kzalloc(sizeof(struct ft_node_acl), GFP_KERNEL);
  187. if (!acl)
  188. return ERR_PTR(-ENOMEM);
  189. acl->node_auth.port_name = wwpn;
  190. q_depth = 32; /* XXX bogus default - get from tpg? */
  191. return core_tpg_add_initiator_node_acl(&tpg->se_tpg,
  192. &acl->se_node_acl, name, q_depth);
  193. }
  194. static void ft_del_acl(struct se_node_acl *se_acl)
  195. {
  196. struct se_portal_group *se_tpg = se_acl->se_tpg;
  197. struct ft_tpg *tpg;
  198. struct ft_node_acl *acl = container_of(se_acl,
  199. struct ft_node_acl, se_node_acl);
  200. pr_debug("del acl %s\n",
  201. config_item_name(&se_acl->acl_group.cg_item));
  202. tpg = container_of(se_tpg, struct ft_tpg, se_tpg);
  203. pr_debug("del acl %p se_acl %p tpg %p se_tpg %p\n",
  204. acl, se_acl, tpg, &tpg->se_tpg);
  205. core_tpg_del_initiator_node_acl(&tpg->se_tpg, se_acl, 1);
  206. kfree(acl);
  207. }
  208. struct ft_node_acl *ft_acl_get(struct ft_tpg *tpg, struct fc_rport_priv *rdata)
  209. {
  210. struct ft_node_acl *found = NULL;
  211. struct ft_node_acl *acl;
  212. struct se_portal_group *se_tpg = &tpg->se_tpg;
  213. struct se_node_acl *se_acl;
  214. spin_lock_irq(&se_tpg->acl_node_lock);
  215. list_for_each_entry(se_acl, &se_tpg->acl_node_list, acl_list) {
  216. acl = container_of(se_acl, struct ft_node_acl, se_node_acl);
  217. pr_debug("acl %p port_name %llx\n",
  218. acl, (unsigned long long)acl->node_auth.port_name);
  219. if (acl->node_auth.port_name == rdata->ids.port_name ||
  220. acl->node_auth.node_name == rdata->ids.node_name) {
  221. pr_debug("acl %p port_name %llx matched\n", acl,
  222. (unsigned long long)rdata->ids.port_name);
  223. found = acl;
  224. /* XXX need to hold onto ACL */
  225. break;
  226. }
  227. }
  228. spin_unlock_irq(&se_tpg->acl_node_lock);
  229. return found;
  230. }
  231. struct se_node_acl *ft_tpg_alloc_fabric_acl(struct se_portal_group *se_tpg)
  232. {
  233. struct ft_node_acl *acl;
  234. acl = kzalloc(sizeof(*acl), GFP_KERNEL);
  235. if (!acl) {
  236. pr_err("Unable to allocate struct ft_node_acl\n");
  237. return NULL;
  238. }
  239. pr_debug("acl %p\n", acl);
  240. return &acl->se_node_acl;
  241. }
  242. static void ft_tpg_release_fabric_acl(struct se_portal_group *se_tpg,
  243. struct se_node_acl *se_acl)
  244. {
  245. struct ft_node_acl *acl = container_of(se_acl,
  246. struct ft_node_acl, se_node_acl);
  247. pr_debug("acl %p\n", acl);
  248. kfree(acl);
  249. }
  250. /*
  251. * local_port port_group (tpg) ops.
  252. */
  253. static struct se_portal_group *ft_add_tpg(
  254. struct se_wwn *wwn,
  255. struct config_group *group,
  256. const char *name)
  257. {
  258. struct ft_lport_acl *lacl;
  259. struct ft_tpg *tpg;
  260. struct workqueue_struct *wq;
  261. unsigned long index;
  262. int ret;
  263. pr_debug("tcm_fc: add tpg %s\n", name);
  264. /*
  265. * Name must be "tpgt_" followed by the index.
  266. */
  267. if (strstr(name, "tpgt_") != name)
  268. return NULL;
  269. ret = kstrtoul(name + 5, 10, &index);
  270. if (ret)
  271. return NULL;
  272. if (index > UINT_MAX)
  273. return NULL;
  274. lacl = container_of(wwn, struct ft_lport_acl, fc_lport_wwn);
  275. tpg = kzalloc(sizeof(*tpg), GFP_KERNEL);
  276. if (!tpg)
  277. return NULL;
  278. tpg->index = index;
  279. tpg->lport_acl = lacl;
  280. INIT_LIST_HEAD(&tpg->lun_list);
  281. wq = alloc_workqueue("tcm_fc", 0, 1);
  282. if (!wq) {
  283. kfree(tpg);
  284. return NULL;
  285. }
  286. ret = core_tpg_register(&ft_configfs->tf_ops, wwn, &tpg->se_tpg,
  287. tpg, TRANSPORT_TPG_TYPE_NORMAL);
  288. if (ret < 0) {
  289. destroy_workqueue(wq);
  290. kfree(tpg);
  291. return NULL;
  292. }
  293. tpg->workqueue = wq;
  294. mutex_lock(&ft_lport_lock);
  295. list_add_tail(&tpg->list, &lacl->tpg_list);
  296. mutex_unlock(&ft_lport_lock);
  297. return &tpg->se_tpg;
  298. }
  299. static void ft_del_tpg(struct se_portal_group *se_tpg)
  300. {
  301. struct ft_tpg *tpg = container_of(se_tpg, struct ft_tpg, se_tpg);
  302. pr_debug("del tpg %s\n",
  303. config_item_name(&tpg->se_tpg.tpg_group.cg_item));
  304. destroy_workqueue(tpg->workqueue);
  305. /* Wait for sessions to be freed thru RCU, for BUG_ON below */
  306. synchronize_rcu();
  307. mutex_lock(&ft_lport_lock);
  308. list_del(&tpg->list);
  309. if (tpg->tport) {
  310. tpg->tport->tpg = NULL;
  311. tpg->tport = NULL;
  312. }
  313. mutex_unlock(&ft_lport_lock);
  314. core_tpg_deregister(se_tpg);
  315. kfree(tpg);
  316. }
  317. /*
  318. * Verify that an lport is configured to use the tcm_fc module, and return
  319. * the target port group that should be used.
  320. *
  321. * The caller holds ft_lport_lock.
  322. */
  323. struct ft_tpg *ft_lport_find_tpg(struct fc_lport *lport)
  324. {
  325. struct ft_lport_acl *lacl;
  326. struct ft_tpg *tpg;
  327. list_for_each_entry(lacl, &ft_lport_list, list) {
  328. if (lacl->wwpn == lport->wwpn) {
  329. list_for_each_entry(tpg, &lacl->tpg_list, list)
  330. return tpg; /* XXX for now return first entry */
  331. return NULL;
  332. }
  333. }
  334. return NULL;
  335. }
  336. /*
  337. * target config instance ops.
  338. */
  339. /*
  340. * Add lport to allowed config.
  341. * The name is the WWPN in lower-case ASCII, colon-separated bytes.
  342. */
  343. static struct se_wwn *ft_add_lport(
  344. struct target_fabric_configfs *tf,
  345. struct config_group *group,
  346. const char *name)
  347. {
  348. struct ft_lport_acl *lacl;
  349. struct ft_lport_acl *old_lacl;
  350. u64 wwpn;
  351. pr_debug("add lport %s\n", name);
  352. if (ft_parse_wwn(name, &wwpn, 1) < 0)
  353. return NULL;
  354. lacl = kzalloc(sizeof(*lacl), GFP_KERNEL);
  355. if (!lacl)
  356. return NULL;
  357. lacl->wwpn = wwpn;
  358. INIT_LIST_HEAD(&lacl->tpg_list);
  359. mutex_lock(&ft_lport_lock);
  360. list_for_each_entry(old_lacl, &ft_lport_list, list) {
  361. if (old_lacl->wwpn == wwpn) {
  362. mutex_unlock(&ft_lport_lock);
  363. kfree(lacl);
  364. return NULL;
  365. }
  366. }
  367. list_add_tail(&lacl->list, &ft_lport_list);
  368. ft_format_wwn(lacl->name, sizeof(lacl->name), wwpn);
  369. mutex_unlock(&ft_lport_lock);
  370. return &lacl->fc_lport_wwn;
  371. }
  372. static void ft_del_lport(struct se_wwn *wwn)
  373. {
  374. struct ft_lport_acl *lacl = container_of(wwn,
  375. struct ft_lport_acl, fc_lport_wwn);
  376. pr_debug("del lport %s\n", lacl->name);
  377. mutex_lock(&ft_lport_lock);
  378. list_del(&lacl->list);
  379. mutex_unlock(&ft_lport_lock);
  380. kfree(lacl);
  381. }
  382. static ssize_t ft_wwn_show_attr_version(
  383. struct target_fabric_configfs *tf,
  384. char *page)
  385. {
  386. return sprintf(page, "TCM FC " FT_VERSION " on %s/%s on "
  387. ""UTS_RELEASE"\n", utsname()->sysname, utsname()->machine);
  388. }
  389. TF_WWN_ATTR_RO(ft, version);
  390. static struct configfs_attribute *ft_wwn_attrs[] = {
  391. &ft_wwn_version.attr,
  392. NULL,
  393. };
  394. static char *ft_get_fabric_name(void)
  395. {
  396. return "fc";
  397. }
  398. static char *ft_get_fabric_wwn(struct se_portal_group *se_tpg)
  399. {
  400. struct ft_tpg *tpg = se_tpg->se_tpg_fabric_ptr;
  401. return tpg->lport_acl->name;
  402. }
  403. static u16 ft_get_tag(struct se_portal_group *se_tpg)
  404. {
  405. struct ft_tpg *tpg = se_tpg->se_tpg_fabric_ptr;
  406. /*
  407. * This tag is used when forming SCSI Name identifier in EVPD=1 0x83
  408. * to represent the SCSI Target Port.
  409. */
  410. return tpg->index;
  411. }
  412. static u32 ft_get_default_depth(struct se_portal_group *se_tpg)
  413. {
  414. return 1;
  415. }
  416. static int ft_check_false(struct se_portal_group *se_tpg)
  417. {
  418. return 0;
  419. }
  420. static void ft_set_default_node_attr(struct se_node_acl *se_nacl)
  421. {
  422. }
  423. static u32 ft_tpg_get_inst_index(struct se_portal_group *se_tpg)
  424. {
  425. struct ft_tpg *tpg = se_tpg->se_tpg_fabric_ptr;
  426. return tpg->index;
  427. }
  428. static struct target_core_fabric_ops ft_fabric_ops = {
  429. .get_fabric_name = ft_get_fabric_name,
  430. .get_fabric_proto_ident = fc_get_fabric_proto_ident,
  431. .tpg_get_wwn = ft_get_fabric_wwn,
  432. .tpg_get_tag = ft_get_tag,
  433. .tpg_get_default_depth = ft_get_default_depth,
  434. .tpg_get_pr_transport_id = fc_get_pr_transport_id,
  435. .tpg_get_pr_transport_id_len = fc_get_pr_transport_id_len,
  436. .tpg_parse_pr_out_transport_id = fc_parse_pr_out_transport_id,
  437. .tpg_check_demo_mode = ft_check_false,
  438. .tpg_check_demo_mode_cache = ft_check_false,
  439. .tpg_check_demo_mode_write_protect = ft_check_false,
  440. .tpg_check_prod_mode_write_protect = ft_check_false,
  441. .tpg_alloc_fabric_acl = ft_tpg_alloc_fabric_acl,
  442. .tpg_release_fabric_acl = ft_tpg_release_fabric_acl,
  443. .tpg_get_inst_index = ft_tpg_get_inst_index,
  444. .check_stop_free = ft_check_stop_free,
  445. .release_cmd = ft_release_cmd,
  446. .shutdown_session = ft_sess_shutdown,
  447. .close_session = ft_sess_close,
  448. .sess_get_index = ft_sess_get_index,
  449. .sess_get_initiator_sid = NULL,
  450. .write_pending = ft_write_pending,
  451. .write_pending_status = ft_write_pending_status,
  452. .set_default_node_attributes = ft_set_default_node_attr,
  453. .get_task_tag = ft_get_task_tag,
  454. .get_cmd_state = ft_get_cmd_state,
  455. .queue_data_in = ft_queue_data_in,
  456. .queue_status = ft_queue_status,
  457. .queue_tm_rsp = ft_queue_tm_resp,
  458. /*
  459. * Setup function pointers for generic logic in
  460. * target_core_fabric_configfs.c
  461. */
  462. .fabric_make_wwn = &ft_add_lport,
  463. .fabric_drop_wwn = &ft_del_lport,
  464. .fabric_make_tpg = &ft_add_tpg,
  465. .fabric_drop_tpg = &ft_del_tpg,
  466. .fabric_post_link = NULL,
  467. .fabric_pre_unlink = NULL,
  468. .fabric_make_np = NULL,
  469. .fabric_drop_np = NULL,
  470. .fabric_make_nodeacl = &ft_add_acl,
  471. .fabric_drop_nodeacl = &ft_del_acl,
  472. };
  473. int ft_register_configfs(void)
  474. {
  475. struct target_fabric_configfs *fabric;
  476. int ret;
  477. /*
  478. * Register the top level struct config_item_type with TCM core
  479. */
  480. fabric = target_fabric_configfs_init(THIS_MODULE, "fc");
  481. if (IS_ERR(fabric)) {
  482. pr_err("%s: target_fabric_configfs_init() failed!\n",
  483. __func__);
  484. return PTR_ERR(fabric);
  485. }
  486. fabric->tf_ops = ft_fabric_ops;
  487. /*
  488. * Setup default attribute lists for various fabric->tf_cit_tmpl
  489. */
  490. TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = ft_wwn_attrs;
  491. TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = NULL;
  492. TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs = NULL;
  493. TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = NULL;
  494. TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = NULL;
  495. TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs =
  496. ft_nacl_base_attrs;
  497. TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
  498. TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
  499. TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = NULL;
  500. /*
  501. * register the fabric for use within TCM
  502. */
  503. ret = target_fabric_configfs_register(fabric);
  504. if (ret < 0) {
  505. pr_debug("target_fabric_configfs_register() for"
  506. " FC Target failed!\n");
  507. target_fabric_configfs_free(fabric);
  508. return -1;
  509. }
  510. /*
  511. * Setup our local pointer to *fabric.
  512. */
  513. ft_configfs = fabric;
  514. return 0;
  515. }
  516. void ft_deregister_configfs(void)
  517. {
  518. if (!ft_configfs)
  519. return;
  520. target_fabric_configfs_deregister(ft_configfs);
  521. ft_configfs = NULL;
  522. }
  523. static struct notifier_block ft_notifier = {
  524. .notifier_call = ft_lport_notify
  525. };
  526. static int __init ft_init(void)
  527. {
  528. if (ft_register_configfs())
  529. return -1;
  530. if (fc_fc4_register_provider(FC_TYPE_FCP, &ft_prov)) {
  531. ft_deregister_configfs();
  532. return -1;
  533. }
  534. blocking_notifier_chain_register(&fc_lport_notifier_head, &ft_notifier);
  535. fc_lport_iterate(ft_lport_add, NULL);
  536. return 0;
  537. }
  538. static void __exit ft_exit(void)
  539. {
  540. blocking_notifier_chain_unregister(&fc_lport_notifier_head,
  541. &ft_notifier);
  542. fc_fc4_deregister_provider(FC_TYPE_FCP, &ft_prov);
  543. fc_lport_iterate(ft_lport_del, NULL);
  544. ft_deregister_configfs();
  545. synchronize_rcu();
  546. }
  547. MODULE_DESCRIPTION("FC TCM fabric driver " FT_VERSION);
  548. MODULE_LICENSE("GPL");
  549. module_init(ft_init);
  550. module_exit(ft_exit);