aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/tcm_fc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-24 13:22:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-24 13:22:09 -0400
commitc6668726d2c2c581e6c417448c472c994d026f5f (patch)
treeccbc5a73b9dfe09a065cb5d8627aa2297e730ec0 /drivers/target/tcm_fc
parent06b45f2aa703837163496f5db6a53575665cc6b4 (diff)
parent68d4cef3bab3fb9bb0dbac690ba35a96cb5a16d9 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "Lots of activity in target land the last months. The highlights include: - Convert fabric drivers tree-wide to target_register_template() (hch + bart) - iser-target hardening fixes + v1.0 improvements (sagi) - Convert iscsi_thread_set usage to kthread.h + kill iscsi_target_tq.c (sagi + nab) - Add support for T10-PI WRITE_STRIP + READ_INSERT operation (mkp + sagi + nab) - DIF fixes for CONFIG_DEBUG_SG=y + UNMAP file emulation (akinobu + sagi + mkp) - Extended TCMU ABI v2 for future BIDI + DIF support (andy + ilias) - Fix COMPARE_AND_WRITE handling for NO_ALLLOC drivers (hch + nab) Thanks to everyone who contributed this round with new features, bug-reports, fixes, cleanups and improvements. Looking forward, it's currently shaping up to be a busy v4.2 as well" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (69 commits) target: Put TCMU under a new config option target: Version 2 of TCMU ABI target: fix tcm_mod_builder.py target/file: Fix UNMAP with DIF protection support target/file: Fix SG table for prot_buf initialization target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled target: Make core_tmr_abort_task() skip TMFs target/sbc: Update sbc_dif_generate pr_debug output target/sbc: Make internal DIF emulation honor ->prot_checks target/sbc: Return INVALID_CDB_FIELD if DIF + sess_prot_type disabled target: Ensure sess_prot_type is saved across session restart target/rd: Don't pass incomplete scatterlist entries to sbc_dif_verify_* target: Remove the unused flag SCF_ACK_KREF target: Fix two sparse warnings target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling target: simplify the target template registration API target: simplify target_xcopy_init_pt_lun target: remove the unused SCF_CMD_XCOPY_PASSTHROUGH flag target/rd: reduce code duplication in rd_execute_rw() tcm_loop: fixup tpgt string to integer conversion ...
Diffstat (limited to 'drivers/target/tcm_fc')
-rw-r--r--drivers/target/tcm_fc/tcm_fc.h1
-rw-r--r--drivers/target/tcm_fc/tfc_conf.c89
2 files changed, 24 insertions, 66 deletions
diff --git a/drivers/target/tcm_fc/tcm_fc.h b/drivers/target/tcm_fc/tcm_fc.h
index a0bcfd3e7e7d..881deb3d499a 100644
--- a/drivers/target/tcm_fc/tcm_fc.h
+++ b/drivers/target/tcm_fc/tcm_fc.h
@@ -129,7 +129,6 @@ struct ft_cmd {
129 129
130extern struct mutex ft_lport_lock; 130extern struct mutex ft_lport_lock;
131extern struct fc4_prov ft_prov; 131extern struct fc4_prov ft_prov;
132extern struct target_fabric_configfs *ft_configfs;
133extern unsigned int ft_debug_logging; 132extern unsigned int ft_debug_logging;
134 133
135/* 134/*
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c
index efdcb9663a1a..65dce1345966 100644
--- a/drivers/target/tcm_fc/tfc_conf.c
+++ b/drivers/target/tcm_fc/tfc_conf.c
@@ -48,7 +48,7 @@
48 48
49#include "tcm_fc.h" 49#include "tcm_fc.h"
50 50
51struct target_fabric_configfs *ft_configfs; 51static const struct target_core_fabric_ops ft_fabric_ops;
52 52
53static LIST_HEAD(ft_wwn_list); 53static LIST_HEAD(ft_wwn_list);
54DEFINE_MUTEX(ft_lport_lock); 54DEFINE_MUTEX(ft_lport_lock);
@@ -337,7 +337,7 @@ static struct se_portal_group *ft_add_tpg(
337 return NULL; 337 return NULL;
338 } 338 }
339 339
340 ret = core_tpg_register(&ft_configfs->tf_ops, wwn, &tpg->se_tpg, 340 ret = core_tpg_register(&ft_fabric_ops, wwn, &tpg->se_tpg,
341 tpg, TRANSPORT_TPG_TYPE_NORMAL); 341 tpg, TRANSPORT_TPG_TYPE_NORMAL);
342 if (ret < 0) { 342 if (ret < 0) {
343 destroy_workqueue(wq); 343 destroy_workqueue(wq);
@@ -507,7 +507,9 @@ static u32 ft_tpg_get_inst_index(struct se_portal_group *se_tpg)
507 return tpg->index; 507 return tpg->index;
508} 508}
509 509
510static struct target_core_fabric_ops ft_fabric_ops = { 510static const struct target_core_fabric_ops ft_fabric_ops = {
511 .module = THIS_MODULE,
512 .name = "fc",
511 .get_fabric_name = ft_get_fabric_name, 513 .get_fabric_name = ft_get_fabric_name,
512 .get_fabric_proto_ident = fc_get_fabric_proto_ident, 514 .get_fabric_proto_ident = fc_get_fabric_proto_ident,
513 .tpg_get_wwn = ft_get_fabric_wwn, 515 .tpg_get_wwn = ft_get_fabric_wwn,
@@ -552,62 +554,10 @@ static struct target_core_fabric_ops ft_fabric_ops = {
552 .fabric_drop_np = NULL, 554 .fabric_drop_np = NULL,
553 .fabric_make_nodeacl = &ft_add_acl, 555 .fabric_make_nodeacl = &ft_add_acl,
554 .fabric_drop_nodeacl = &ft_del_acl, 556 .fabric_drop_nodeacl = &ft_del_acl,
555};
556
557static int ft_register_configfs(void)
558{
559 struct target_fabric_configfs *fabric;
560 int ret;
561
562 /*
563 * Register the top level struct config_item_type with TCM core
564 */
565 fabric = target_fabric_configfs_init(THIS_MODULE, "fc");
566 if (IS_ERR(fabric)) {
567 pr_err("%s: target_fabric_configfs_init() failed!\n",
568 __func__);
569 return PTR_ERR(fabric);
570 }
571 fabric->tf_ops = ft_fabric_ops;
572
573 /*
574 * Setup default attribute lists for various fabric->tf_cit_tmpl
575 */
576 fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = ft_wwn_attrs;
577 fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = NULL;
578 fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL;
579 fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL;
580 fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL;
581 fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs =
582 ft_nacl_base_attrs;
583 fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
584 fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
585 fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = NULL;
586 /*
587 * register the fabric for use within TCM
588 */
589 ret = target_fabric_configfs_register(fabric);
590 if (ret < 0) {
591 pr_debug("target_fabric_configfs_register() for"
592 " FC Target failed!\n");
593 target_fabric_configfs_free(fabric);
594 return -1;
595 }
596
597 /*
598 * Setup our local pointer to *fabric.
599 */
600 ft_configfs = fabric;
601 return 0;
602}
603 557
604static void ft_deregister_configfs(void) 558 .tfc_wwn_attrs = ft_wwn_attrs,
605{ 559 .tfc_tpg_nacl_base_attrs = ft_nacl_base_attrs,
606 if (!ft_configfs) 560};
607 return;
608 target_fabric_configfs_deregister(ft_configfs);
609 ft_configfs = NULL;
610}
611 561
612static struct notifier_block ft_notifier = { 562static struct notifier_block ft_notifier = {
613 .notifier_call = ft_lport_notify 563 .notifier_call = ft_lport_notify
@@ -615,15 +565,24 @@ static struct notifier_block ft_notifier = {
615 565
616static int __init ft_init(void) 566static int __init ft_init(void)
617{ 567{
618 if (ft_register_configfs()) 568 int ret;
619 return -1; 569
620 if (fc_fc4_register_provider(FC_TYPE_FCP, &ft_prov)) { 570 ret = target_register_template(&ft_fabric_ops);
621 ft_deregister_configfs(); 571 if (ret)
622 return -1; 572 goto out;
623 } 573
574 ret = fc_fc4_register_provider(FC_TYPE_FCP, &ft_prov);
575 if (ret)
576 goto out_unregister_template;
577
624 blocking_notifier_chain_register(&fc_lport_notifier_head, &ft_notifier); 578 blocking_notifier_chain_register(&fc_lport_notifier_head, &ft_notifier);
625 fc_lport_iterate(ft_lport_add, NULL); 579 fc_lport_iterate(ft_lport_add, NULL);
626 return 0; 580 return 0;
581
582out_unregister_template:
583 target_unregister_template(&ft_fabric_ops);
584out:
585 return ret;
627} 586}
628 587
629static void __exit ft_exit(void) 588static void __exit ft_exit(void)
@@ -632,7 +591,7 @@ static void __exit ft_exit(void)
632 &ft_notifier); 591 &ft_notifier);
633 fc_fc4_deregister_provider(FC_TYPE_FCP, &ft_prov); 592 fc_fc4_deregister_provider(FC_TYPE_FCP, &ft_prov);
634 fc_lport_iterate(ft_lport_del, NULL); 593 fc_lport_iterate(ft_lport_del, NULL);
635 ft_deregister_configfs(); 594 target_unregister_template(&ft_fabric_ops);
636 synchronize_rcu(); 595 synchronize_rcu();
637} 596}
638 597