diff options
Diffstat (limited to 'drivers/infiniband/ulp/srpt/ib_srpt.c')
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 49 |
1 files changed, 13 insertions, 36 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 6e0a477681e9..07015389ee5a 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -93,7 +93,7 @@ MODULE_PARM_DESC(srpt_service_guid, | |||
93 | " instead of using the node_guid of the first HCA."); | 93 | " instead of using the node_guid of the first HCA."); |
94 | 94 | ||
95 | static struct ib_client srpt_client; | 95 | static struct ib_client srpt_client; |
96 | static struct target_fabric_configfs *srpt_target; | 96 | static const struct target_core_fabric_ops srpt_template; |
97 | static void srpt_release_channel(struct srpt_rdma_ch *ch); | 97 | static void srpt_release_channel(struct srpt_rdma_ch *ch); |
98 | static int srpt_queue_status(struct se_cmd *cmd); | 98 | static int srpt_queue_status(struct se_cmd *cmd); |
99 | 99 | ||
@@ -3851,7 +3851,7 @@ static struct se_portal_group *srpt_make_tpg(struct se_wwn *wwn, | |||
3851 | int res; | 3851 | int res; |
3852 | 3852 | ||
3853 | /* Initialize sport->port_wwn and sport->port_tpg_1 */ | 3853 | /* Initialize sport->port_wwn and sport->port_tpg_1 */ |
3854 | res = core_tpg_register(&srpt_target->tf_ops, &sport->port_wwn, | 3854 | res = core_tpg_register(&srpt_template, &sport->port_wwn, |
3855 | &sport->port_tpg_1, sport, TRANSPORT_TPG_TYPE_NORMAL); | 3855 | &sport->port_tpg_1, sport, TRANSPORT_TPG_TYPE_NORMAL); |
3856 | if (res) | 3856 | if (res) |
3857 | return ERR_PTR(res); | 3857 | return ERR_PTR(res); |
@@ -3919,7 +3919,9 @@ static struct configfs_attribute *srpt_wwn_attrs[] = { | |||
3919 | NULL, | 3919 | NULL, |
3920 | }; | 3920 | }; |
3921 | 3921 | ||
3922 | static struct target_core_fabric_ops srpt_template = { | 3922 | static const struct target_core_fabric_ops srpt_template = { |
3923 | .module = THIS_MODULE, | ||
3924 | .name = "srpt", | ||
3923 | .get_fabric_name = srpt_get_fabric_name, | 3925 | .get_fabric_name = srpt_get_fabric_name, |
3924 | .get_fabric_proto_ident = srpt_get_fabric_proto_ident, | 3926 | .get_fabric_proto_ident = srpt_get_fabric_proto_ident, |
3925 | .tpg_get_wwn = srpt_get_fabric_wwn, | 3927 | .tpg_get_wwn = srpt_get_fabric_wwn, |
@@ -3964,6 +3966,10 @@ static struct target_core_fabric_ops srpt_template = { | |||
3964 | .fabric_drop_np = NULL, | 3966 | .fabric_drop_np = NULL, |
3965 | .fabric_make_nodeacl = srpt_make_nodeacl, | 3967 | .fabric_make_nodeacl = srpt_make_nodeacl, |
3966 | .fabric_drop_nodeacl = srpt_drop_nodeacl, | 3968 | .fabric_drop_nodeacl = srpt_drop_nodeacl, |
3969 | |||
3970 | .tfc_wwn_attrs = srpt_wwn_attrs, | ||
3971 | .tfc_tpg_base_attrs = srpt_tpg_attrs, | ||
3972 | .tfc_tpg_attrib_attrs = srpt_tpg_attrib_attrs, | ||
3967 | }; | 3973 | }; |
3968 | 3974 | ||
3969 | /** | 3975 | /** |
@@ -3994,33 +4000,9 @@ static int __init srpt_init_module(void) | |||
3994 | goto out; | 4000 | goto out; |
3995 | } | 4001 | } |
3996 | 4002 | ||
3997 | srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt"); | 4003 | ret = target_register_template(&srpt_template); |
3998 | if (IS_ERR(srpt_target)) { | 4004 | if (ret) |
3999 | printk(KERN_ERR "couldn't register\n"); | ||
4000 | ret = PTR_ERR(srpt_target); | ||
4001 | goto out; | 4005 | goto out; |
4002 | } | ||
4003 | |||
4004 | srpt_target->tf_ops = srpt_template; | ||
4005 | |||
4006 | /* | ||
4007 | * Set up default attribute lists. | ||
4008 | */ | ||
4009 | srpt_target->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = srpt_wwn_attrs; | ||
4010 | srpt_target->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = srpt_tpg_attrs; | ||
4011 | srpt_target->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = srpt_tpg_attrib_attrs; | ||
4012 | srpt_target->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL; | ||
4013 | srpt_target->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL; | ||
4014 | srpt_target->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = NULL; | ||
4015 | srpt_target->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = NULL; | ||
4016 | srpt_target->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = NULL; | ||
4017 | srpt_target->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = NULL; | ||
4018 | |||
4019 | ret = target_fabric_configfs_register(srpt_target); | ||
4020 | if (ret < 0) { | ||
4021 | printk(KERN_ERR "couldn't register\n"); | ||
4022 | goto out_free_target; | ||
4023 | } | ||
4024 | 4006 | ||
4025 | ret = ib_register_client(&srpt_client); | 4007 | ret = ib_register_client(&srpt_client); |
4026 | if (ret) { | 4008 | if (ret) { |
@@ -4031,11 +4013,7 @@ static int __init srpt_init_module(void) | |||
4031 | return 0; | 4013 | return 0; |
4032 | 4014 | ||
4033 | out_unregister_target: | 4015 | out_unregister_target: |
4034 | target_fabric_configfs_deregister(srpt_target); | 4016 | target_unregister_template(&srpt_template); |
4035 | srpt_target = NULL; | ||
4036 | out_free_target: | ||
4037 | if (srpt_target) | ||
4038 | target_fabric_configfs_free(srpt_target); | ||
4039 | out: | 4017 | out: |
4040 | return ret; | 4018 | return ret; |
4041 | } | 4019 | } |
@@ -4043,8 +4021,7 @@ out: | |||
4043 | static void __exit srpt_cleanup_module(void) | 4021 | static void __exit srpt_cleanup_module(void) |
4044 | { | 4022 | { |
4045 | ib_unregister_client(&srpt_client); | 4023 | ib_unregister_client(&srpt_client); |
4046 | target_fabric_configfs_deregister(srpt_target); | 4024 | target_unregister_template(&srpt_template); |
4047 | srpt_target = NULL; | ||
4048 | } | 4025 | } |
4049 | 4026 | ||
4050 | module_init(srpt_init_module); | 4027 | module_init(srpt_init_module); |