Skip to contentSkip to conversation

: Convert layout to use generic configfs struct config_item_types

PATCH New Nicholas A. Bellinger 1 participant 1 message Apr 13, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Convert layout to use generic configfs struct config_item_types

From: Nicholas Bellinger <[email protected]>

Greetings SCSI and Open-FCoE.org folks,

Attached is a patch to lio-core-2.6.git/lio-4.0 to convert the TCM-FC / Open-FCoE.org fabric code in drivers/target/tcm_fc/tfc_conf.c to TCM 4.0 using the new fabric independent configfs infrastructure in drivers/target/target_core_fabric_configfs.c.

Information about the TCM 4.0 configfs code can be found here along with links to the two previous patch series implementing core 4.0 functionalty and conversion of existing LIO-Target and TCM_Loop fabric modules to use the new infrastructure.

http://groups.google.com/group/linux-iscsi-target-dev/browse_thread/thread/f3391e9bb0fefcd9

With this patch tfc_conf.c no longer defines it's own static struct config_item_type's, and uses the generic 'cits' hanging off struct target_fabric_configfs->tf_cit_tmpl. The following changes in struct ft_fabric_ops and ft_register_configfs() shows the adapted fabric API functions, and how local static attribute structures are setup to hang off the generic fabric cits..

Quoted 1 line

From struct target_core_fabric_ops ft_fabric_ops:

/*
* Setup function pointers for generic logic in target_core_fabric_configfs.c */
.fabric_make_wwn = &ft_add_lport,
.fabric_drop_wwn = &ft_del_lport,
.fabric_make_tpg = &ft_add_tpg,
.fabric_drop_tpg = &ft_del_tpg,
.fabric_post_link = NULL,
.fabric_pre_unlink = NULL,
.fabric_make_np = NULL,
.fabric_drop_np = NULL,
.fabric_make_nodeacl = &ft_add_acl,
.fabric_drop_nodeacl = &ft_del_acl,

and from ft_register_configfs()

       /*
        * Setup default attribute lists for various fabric->tf_cit_tmpl
        */
       TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = ft_wwn_attrs;
       TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = NULL;
       TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs = NULL;
       TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = NULL;
       TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = NULL;
       TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs = ft_nacl_base_attrs;
       TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
       TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
       TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = NULL;

The existing TCM_FC fabric layout of /sys/kernel/config/target/fc/$LPORT_WWN/tpgt_$TPGT is up and running with this patch. Here is how it looks using TCM v4.0 fabric independent configfs infrastructure:

target:~# tree /sys/kernel/config/target/fc/
	/sys/kernel/config/target/fc/
	|-- 20:00:00:0c:29:43:d5:7b
	|   `-- tpgt_1
	|       |-- acls
	|       |   `-- 20:00:00:0c:29:43:d5:ff
	|       |       |-- attrib
	|       |       |-- auth
	|       |       |-- node_name
	|       |       |-- param
	|       |       `-- port_name
	|       |-- attrib
	|       |-- lun
	|       |   `-- lun_0
	|       |       |-- alua_tg_pt_gp
	|       |       |-- alua_tg_pt_offline
	|       |       |-- alua_tg_pt_status
	|       |       |-- alua_tg_pt_write_md
	|       |       `-- tcm_fc_port -> ../../../../../../target/core/iblock_0/lvm_test0
	|       |-- np
	|       `-- param
	|-- discovery_auth
	`-- version
target:~# dmesg  | tail -n 15
<<<<<<<<<<<<<<<<<<<<<< BEGIN FABRIC API >>>>>>>>>>>>>>>>>>>>>>
Initialized struct target_fabric_configfs: c895a850 for fc
<<<<<<<<<<<<<<<<<<<<<< END FABRIC API >>>>>>>>>>>>>>>>>>>>>>
Target_Core_ConfigFS: REGISTER -> group: e121cb80 name: fc
Target_Core_ConfigFS: REGISTER -> Located fabric: fc
Target_Core_ConfigFS: REGISTER tfc_wwn_cit -> c895a9f8
Target_Core_ConfigFS: REGISTER -> Allocated Fabric: fc
Target_Core_ConfigFS: REGISTER -> Set tf->tf_fabric for fc
tcm_fc: ft_add_lport: add lport 20:00:00:0c:29:43:d5:7b
tcm_fc: ft_add_tpg: tcm_fc: add tpg tpgt_1
TARGET_CORE[fc]: Allocated Normal se_portal_group_t for endpoint: 20:00:00:0c:29:43:d5:7b, Portal Tag: 1
tcm_fc: ft_add_acl: add acl 20:00:00:0c:29:43:d5:ff
fc_TPG[1] - Added ACL with TCQ Depth: 32 for fc Initiator Node: 20:00:00:0c:29:43:d5:ff
iblock/fc: Adding to default ALUA Target Port Group: alua/default_tg_pt_gp
fc_TPG[1]_LUN[0] - Activated fc Logical Unit from CORE HBA: 4
target:~# cat /sys/kernel/config/target/fc/version
TCM FC 0.2 on Linux/i686 on 2.6.34-rc3
target:~# lsmod
Module                  Size  Used by
tcm_fc                 16300  5
libfc                  70996  1 tcm_fc
target_core_mod       247964  30 tcm_fc
scsi_tgt                8646  1 target_core_mod
configfs               20504  2 target_core_mod
---
 drivers/target/tcm_fc/tcm_fc.h   |   13 +-
 drivers/target/tcm_fc/tfc_conf.c |  784 +++++++-------------------------------
 drivers/target/tcm_fc/tfc_sess.c |    3 +-
 3 files changed, 134 insertions(+), 666 deletions(-)
drivers/target/tcm_fc/tcm_fc.h +3 -10
index bef518c..f7400e9 100644
@@ -104,10 +104,7 @@ struct ft_node_auth {
  */
 struct ft_node_acl {
 	struct ft_node_auth node_auth;
-	struct se_node_acl_s *se_node_acl;
-
-	struct config_group auth_group;
-	struct config_group *groups[2];	/* NULL-terminator pointers to above */
+	struct se_node_acl_s se_node_acl;
 };
 
 struct ft_lun {
@@ -124,11 +121,7 @@ struct ft_tpg {
 	struct ft_tport *tport;		/* active tport or NULL */
 	struct list_head list;		/* linkage in ft_lport_acl tpg_list */
 	struct list_head lun_list;	/* head of LUNs */
-	struct se_portal_group_s *se_tpg;
-	struct config_group lun_group;	/* lun subdir */
-	struct config_group acl_group;	/* acl subdir */
-	struct config_group *groups[3];	/* pointers to subdirs, NULL-term */
-
+	struct se_portal_group_s se_tpg;
 	struct task_struct *thread;	/* processing thread */
 	struct se_queue_obj_s qobj;	/* queue for processing thread */
 };
@@ -138,7 +131,7 @@ struct ft_lport_acl {
 	char name[FT_NAMELEN];
 	struct list_head list;
 	struct list_head tpg_list;
-	struct config_group group;
+	struct se_wwn_s fc_lport_wwn;
 };
 
 enum ft_cmd_state {
drivers/target/tcm_fc/tfc_conf.c +130 -654

986 lines not on this page · raw message

drivers/target/tcm_fc/tfc_sess.c +1 -2
index b3d9383..8074d85 100644
@@ -243,8 +243,7 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id,
 
 	FT_SESS_DBG("port_id %x sess %p\n", port_id, sess);
 
-	sess->se_sess->se_node_acl = acl->se_node_acl;
-	transport_register_session(tport->tpg->se_tpg, acl->se_node_acl,
+	__transport_register_session(&tport->tpg->se_tpg, &acl->se_node_acl,
 				   sess->se_sess, sess);
 	return sess;
 }
Signature · 1 line
1.5.6.5