: Initial code for tcm_lpfc module using v4 configfs fabric infrastructure
Subsystems (2)
PATCH 1/1 : Initial code for tcm_lpfc module using v4 configfs fabric infrastructure
From: Nicholas Bellinger <[email protected]>
Greetings,
This commit adds initial support for a tcm_lpfc fabric module using the new TCM v4 generic configfs fabric infrastructure. This includes the main struct target_core_fabric_ops API callers mapped to the following tcm_lpfc_configfs.c code and structures:
.fabric_make_wwn -> tcm_lpfc_make_lport() with struct tcm_lpfc_lport .fabric_drop_wwn -> tcm_lpfc_drop_lport() with struct tcm_lpfc_lport .fabric_make_tpg -> tcm_lpfc_make_tpg() with struct tcm_lpfc_tpg .fabric_drop_tpg -> tcm_lpfc_drop_tpg() with struct tcm_lpfc_tpg .fabric_make_nodeacl -> tcm_lpfc_make_nodeacl() with struct tcm_lpfc_nacl .fabric_drop_nodeacl -> tcm_lpfc_drop_nodeacl() with struct tcm_lpfc_nacl
All of the generic configfs fabric intrastructure is up and running. Below is an example of tcm_lpfc demonstrating the control plane on a single TCM target port LUN.
Note that the I_T Nexus and I/O related fabric API functions have been added as NOPs for the moment, and will be added following existing out of tree LPFC TM API logic as this patch for upstream drivers/scsi/lpfc/ is added into lio-core-2.6.git/tcm_lpfc
Here is how is how a single LUN setup on target lport WWPN 20:00:12:34:56:78:90:00 using an TCM/IBLOCK backstore will look for a 20:00:00:09:87:65:43:21 Initiator Nport WWPN with MappedLUN=0:
target:/mnt/sdb/lio-core-2.6.git# insmod drivers/target/tcm_lpfc/tcm_lpfc.ko target:/mnt/sdb/lio-core-2.6.git# mkdir -p /sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1 target:/mnt/sdb/lio-core-2.6.git# cd /sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1 target:/sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1# mkdir lun/lun_0 target:/sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1# cd lun/lun_0/ target:/sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1/lun/lun_0# ln -s /sys/kernel/config/target/core/iblock_0/lvm_test0 tcm_lpfc_port target:/sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1/lun/lun_0# cd ../../acls/ target:/sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1/acls# mkdir -p 20:00:00:09:87:65:43:21/lun_0 target:/sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1/acls# cd 20\:00\:00\:09\:87\:65\:43\:21/lun_0/ target:/sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1/acls/20:00:00:09:87:65:43:21/lun_0# ln -s /sys/kernel/config/target/lpfc/20\:00\:12\:34\:56\:78\:90\:00/tpgt_1/lun/lun_0/ lun_0 target:/sys/kernel/config/target/lpfc/20:00:12:34:56:78:90:00/tpgt_1/acls/20:00:00:09:87:65:43:21/lun_0# tree /sys/kernel/config/target/lpfc/
and the usual lsmod and tree output.. Notice the complete SPC-4 ALUA TG_PT attributes are automatically enabled for all TCM v4 fabric modules.
Module Size Used by tcm_lpfc 4188 6 target_core_mod 250831 31 tcm_lpfc scsi_tgt 8650 1 target_core_mod configfs 20620 2 target_core_mod sg 16603 0
/sys/kernel/config/target/lpfc/
|-- 20:00:12:34:56:78:90:00 | `-- tpgt_1 | |-- acls | | `-- 20:00:00:09:87:65:43:21 | | |-- attrib | | |-- auth | | |-- lun_0 | | | |-- lun_0 -> ../../../../../../../target/lpfc/20:00:12:34:56:78:90:00/tpgt_1/lun/lun_0 | | | `-- write_protect | | `-- param | |-- attrib | |-- lun | | `-- lun_0 | | |-- alua_tg_pt_gp | | |-- alua_tg_pt_offline | | |-- alua_tg_pt_status | | |-- alua_tg_pt_write_md | | `-- tcm_lpfc_port -> ../../../../../../target/core/iblock_0/lvm_test0 | |-- np | `-- param |-- discovery_auth
`-- version
16 directories, 6 files
and the ring buffer output:
TCM EMULEX LPFC fabric module v0.1 on Linux/i686 on 2.6.34
Setup generic discovery
Setup generic wwn
Setup generic tpg
Setup generic tpg_base
Setup generic tpg_port
Setup generic tpg_lun
Setup generic tpg_np
Setup generic tpg_np_base
Setup generic tpg_attrib
Setup generic tpg_param
Setup generic tpg_nacl
Setup generic tpg_nacl_base
Setup generic tpg_nacl_attrib
Setup generic tpg_nacl_auth
Setup generic tpg_nacl_param
Setup generic tpg_mappedlun
<<<<<<<<<<<<<<<<<<<<<< BEGIN FABRIC API >>>>>>>>>>>>>>>>>>>>>>
Initialized struct target_fabric_configfs: df99ac58 for lpfc
<<<<<<<<<<<<<<<<<<<<<< END FABRIC API >>>>>>>>>>>>>>>>>>>>>>
TCM_LPFC[0] - Set fabric -> tcm_lpfc_fabric_configfsTarget_Core_ConfigFS: REGISTER -> group: e128f000 name: lpfcTarget_Core_ConfigFS: REGISTER -> Located fabric: lpfcTarget_Core_ConfigFS: REGISTER tfc_wwn_cit -> df99ae00Target_Core_ConfigFS: REGISTER -> Allocated Fabric: lpfcTarget_Core_ConfigFS: REGISTER -> Set tf->tf_fabric for lpfc
TARGET_CORE[lpfc]: Allocated Normal se_portal_group_t for endpoint: 20:00:12:34:56:78:90:00, Portal Tag: 1 iblock/lpfc: Adding to default ALUA Target Port Group: alua/default_tg_pt_gp lpfc_TPG[1]_LUN[0] - Activated lpfc Logical Unit from CORE HBA: 4
lpfc_TPG[1] - Added ACL with TCQ Depth: 1 for lpfc Initiator Node: 20:00:00:09:87:65:43:21 lpfc_TPG[1]_LUN[0->0] - Added RW ACL for InitiatorNode: 20:00:00:09:87:65:43:21
--- drivers/target/Kbuild | 1 + drivers/target/Kconfig | 1 + drivers/target/tcm_lpfc/Kbuild | 6 + drivers/target/tcm_lpfc/Kconfig | 6 + drivers/target/tcm_lpfc/tcm_lpfc_base.h | 32 +++ drivers/target/tcm_lpfc/tcm_lpfc_configfs.c | 330 ++++++++++++++++++++++++ drivers/target/tcm_lpfc/tcm_lpfc_fabric.c | 368 +++++++++++++++++++++++++++ drivers/target/tcm_lpfc/tcm_lpfc_fabric.h | 42 +++ 8 files changed, 786 insertions(+), 0 deletions(-) create mode 100644 drivers/target/tcm_lpfc/Kbuild create mode 100644 drivers/target/tcm_lpfc/Kconfig create mode 100644 drivers/target/tcm_lpfc/tcm_lpfc_base.h create mode 100644 drivers/target/tcm_lpfc/tcm_lpfc_configfs.c create mode 100644 drivers/target/tcm_lpfc/tcm_lpfc_fabric.c create mode 100644 drivers/target/tcm_lpfc/tcm_lpfc_fabric.h
drivers/target/Kbuild +1 -0
@@ -59,3 +59,4 @@ obj-$(CONFIG_LIO_TARGET) += lio-target/ obj-$(CONFIG_TCM_LOOP_FABRIC) += tcm_loop/ obj-$(CONFIG_TCM_FC) += tcm_fc/ +obj-$(CONFIG_TCM_LPFC) += tcm_lpfc/
drivers/target/Kconfig +1 -0
@@ -65,3 +65,4 @@ config TCM_DEBUG_DEV source "drivers/target/tcm_loop/Kconfig" source "drivers/target/lio-target/Kconfig" source "drivers/target/tcm_fc/Kconfig" +source "drivers/target/tcm_lpfc/Kconfig"
drivers/target/tcm_lpfc/Kbuild new file +6 -0
@@ -0,0 +1,6 @@ +EXTRA_CFLAGS += -I$(srctree)/drivers/target/ -I$(srctree)/drivers/scsi/ -I$(srctree)/include/scsi/ -I$(srctree)/drivers/target/tcm_lpfc + +tcm_lpfc-objs := tcm_lpfc_fabric.o \ + tcm_lpfc_configfs.o \ + +obj-$(CONFIG_TCM_LPFC) += tcm_lpfc.o
drivers/target/tcm_lpfc/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +config TCM_LPFC + tristate "TCM LPFC fabric module for Emulex target mode HBAs" + depends on TARGET_CORE && CONFIGFS_FS + default n + ---help--- + Say Y here to enable the TCM LPFC fabric module for Emulex target mode HBAs
drivers/target/tcm_lpfc/tcm_lpfc_base.h new file +32 -0
@@ -0,0 +1,32 @@ +#define TCM_LPFC_VERSION "v0.1" +/* length of ASCII WWPNs including pad */ +#define TCM_LPFC_NAMELEN 32 + +struct tcm_lpfc_nacl { +/* Binary World Wide unique Port Name for FC Initiator Nport */ +u64 nport_wwpn; +/* ASCII formatted WWPN for FC Initiator Nport */ +char nport_name[TCM_LPFC_NAMELEN ]; +/* Returned by tcm_lpfc_make_nodeacl() */ +struct se_node_acl_s se_node_acl; +}; + +struct tcm_lpfc_tpg { +/* FC lport target portal group tag for TCM */ +u16 lport_tpgt; +/* Pointer back to tcm_lpfc_lport */ +struct tcm_lpfc_lport *lport; +/* Returned by tcm_lpfc_make_tpg() */ +struct se_portal_group_s se_tpg; +}; + +struct tcm_lpfc_lport { +/* SCSI protocol the lport is providing */ +u8 lport_proto_id; +/* Binary World Wide unique Port Name for FC Target Lport */ +u64 lport_wwpn; +/* ASCII formatted WWPN for FC Target Lport */ +char lport_name[TCM_LPFC_NAMELEN ]; +/* Returned by tcm_lpfc_make_lport() */ +struct se_wwn_s lport_wwn; +};
drivers/target/tcm_lpfc/tcm_lpfc_configfs.c new file +330 -0
330 lines not on this page · raw message
drivers/target/tcm_lpfc/tcm_lpfc_fabric.c new file +368 -0
368 lines not on this page · raw message
drivers/target/tcm_lpfc/tcm_lpfc_fabric.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.5.6.5