: Initial commit for tcm_mvsas module using v4 configfs fabric infrastructure
Subsystems (2)
PATCH 1/1 : Initial commit for tcm_mvsas module using v4 configfs fabric infrastructure
From: Nicholas Bellinger <[email protected]>
This commit adds initial support for a tcm_mvsas fabric module using the new TCM v4 generic configfs fabric infrastructure and high level SCSI_PROTOCOL_SAS fabric ops. This includes the main struct target_core_fabric_ops API callers mapped to the following tcm_mvsas_configfs.c code and structures:
.fabric_make_wwn -> tcm_mvsas_make_port() with struct tcm_mvsas_port .fabric_drop_wwn -> tcm_mvsas_drop_port() with struct tcm_mvsas_port .fabric_make_tpg -> tcm_mvsas_make_tpg() with struct tcm_mvsas_tpg .fabric_drop_tpg -> tcm_mvsas_drop_tpg() with struct tcm_mvsas_tpg .fabric_make_nodeacl -> tcm_mvsas_make_nodeacl() with struct tcm_mvsas_nacl .fabric_drop_nodeacl -> tcm_mvsas_drop_nodeacl() with struct tcm_mvsas_nacl
All of the generic configfs fabric intrastructure is up and running.
Note that the I_T Nexus and I/O related fabric API functions have been added as NOPs for the moment, and this code is intended to be a starting point for the bringup of MVSAS series HBAs with TCM v4. Eventually the patch for enabling this upstream drivers/scsi/mvsas/ will be added into lio-core-2.6.git/tcm_mvsas as community interest dictates.
Here is how is how a single LUN setup on target SAS port 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 SAS port WWPN with MappedLUN=0:
target:~# mkdir -p /sys/kernel/config/target/mvsas/naa.600156789ffffffe/tpgt_1/lun/lun_0/ target:~# cd /sys/kernel/config/target/mvsas/naa.600156789ffffffe/tpgt_1/lun/lun_0/ target:/sys/kernel/config/target/mvsas/naa.600156789ffffffe/tpgt_1/lun/lun_0# ln -s /sys/kernel/config/target/core/iblock_0/lvm_test0 tcm_mvsas_port target:/sys/kernel/config/target/mvsas/naa.600156789ffffffe/tpgt_1/lun/lun_0# mkdir -p ../../acls/naa.600234567eeeeeef/lun_0 target:/sys/kernel/config/target/mvsas/naa.600156789ffffffe/tpgt_1/lun/lun_0# cd ../../acls/naa.600234567eeeeeef/lun_0 target:/sys/kernel/config/target/mvsas/naa.600156789ffffffe/tpgt_1/acls/naa.600234567eeeeeef/lun_0# ln -s /sys/kernel/config/target/mvsas/naa.600156789ffffffe/tpgt_1/lun/lun_0/ lun_0 target:/sys/kernel/config/target/mvsas/naa.600156789ffffffe/tpgt_1/acls/naa.600234567eeeeeef/lun_0# tree /sys/kernel/config/target/mvsas/ /sys/kernel/config/target/mvsas/ |-- discovery_auth |-- naa.600156789ffffffe | `-- tpgt_1 | |-- acls | | `-- naa.600234567eeeeeef | | |-- attrib | | |-- auth | | |-- lun_0 | | | |-- lun_0 -> ../../../../../../../target/mvsas/naa.600156789ffffffe/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_mvsas_port -> ../../../../../../target/core/iblock_0/lvm_test0 | |-- np | `-- param `-- version
All tcm_mvsas ports for TCM backstores using SPC-3 ALUA emulation:
target:/sys/kernel/config/target/mvsas/naa.600156789ffffffe/tpgt_1/acls/naa.600234567eeeeeef/lun_0# tcm_node --listaluatpg iblock_0/lvm_test0 default_tg_pt_gp
\------> default_tg_pt_gp Target Port Group ID: 0
Active ALUA Access Type(s): Implict and Explict
Primary Access State: Active/Optimized
Primary Access Status: Altered by Implict ALUA
Preferred Bit: 0
Active/NonOptimized Delay in milliseconds: 100
Transition Delay in milliseconds: 0
\------> TG Port Group Members
mvsas/naa.600156789ffffffe/tpgt_1/lun_0and the (hopefully) now fimilar v4 initialization and configuration messages:
TCM MARVELL MVSAS 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: de5bb060 for mvsas
<<<<<<<<<<<<<<<<<<<<<< END FABRIC API >>>>>>>>>>>>>>>>>>>>>>
TCM_MVSAS[0] - Set fabric -> tcm_mvsas_fabric_configfsTarget_Core_ConfigFS: REGISTER -> group: e128f000 name: mvsasTarget_Core_ConfigFS: REGISTER -> Located fabric: mvsasTarget_Core_ConfigFS: REGISTER tfc_wwn_cit -> de5bb208Target_Core_ConfigFS: REGISTER -> Allocated Fabric: mvsasTarget_Core_ConfigFS: REGISTER -> Set tf->tf_fabric for mvsas
TARGET_CORE[mvsas]: Allocated Normal se_portal_group_t for endpoint: naa.600156789ffffffe, Portal Tag: 1 iblock/mvsas: Adding to default ALUA Target Port Group: alua/default_tg_pt_gp mvsas_TPG[1]_LUN[0] - Activated mvsas Logical Unit from CORE HBA: 4
mvsas_TPG[1] - Added ACL with TCQ Depth: 1 for mvsas Initiator Node: naa.600234567eeeeeef mvsas_TPG[1]_LUN[0->0] - Added RW ACL for InitiatorNode: naa.600234567eeeeeef
--- drivers/target/Kbuild | 1 + drivers/target/Kconfig | 1 + drivers/target/tcm_mvsas/Kbuild | 6 + drivers/target/tcm_mvsas/Kconfig | 6 + drivers/target/tcm_mvsas/tcm_mvsas_base.h | 32 +++ drivers/target/tcm_mvsas/tcm_mvsas_configfs.c | 332 +++++++++++++++++++++++ drivers/target/tcm_mvsas/tcm_mvsas_fabric.c | 362 +++++++++++++++++++++++++ drivers/target/tcm_mvsas/tcm_mvsas_fabric.h | 42 +++ 8 files changed, 782 insertions(+), 0 deletions(-) create mode 100644 drivers/target/tcm_mvsas/Kbuild create mode 100644 drivers/target/tcm_mvsas/Kconfig create mode 100644 drivers/target/tcm_mvsas/tcm_mvsas_base.h create mode 100644 drivers/target/tcm_mvsas/tcm_mvsas_configfs.c create mode 100644 drivers/target/tcm_mvsas/tcm_mvsas_fabric.c create mode 100644 drivers/target/tcm_mvsas/tcm_mvsas_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_MVSAS) += tcm_mvsas/
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_mvsas/Kconfig"
drivers/target/tcm_mvsas/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_mvsas + +tcm_mvsas-objs := tcm_mvsas_fabric.o \ + tcm_mvsas_configfs.o \ + +obj-$(CONFIG_TCM_MVSAS) += tcm_mvsas.o
drivers/target/tcm_mvsas/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +config TCM_MVSAS + tristate "TCM MVSAS fabric module for Marvell SAS target mode HBAs" + depends on TARGET_CORE && CONFIGFS_FS + default n + ---help--- + Say Y here to enable the TCM MVSAS fabric module for Marvell SAS target mode HBAs
drivers/target/tcm_mvsas/tcm_mvsas_base.h new file +32 -0
@@ -0,0 +1,32 @@ +#define TCM_MVSAS_VERSION "v0.1" +/* length of ASCII WWPNs including pad */ +#define TCM_MVSAS_NAMELEN 32 + +struct tcm_mvsas_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_MVSAS_NAMELEN ]; +/* Returned by tcm_mvsas_make_nodeacl() */ +struct se_node_acl_s se_node_acl; +}; + +struct tcm_mvsas_tpg { +/* SAS port target portal group tag for TCM */ +u16 port_tpgt; +/* Pointer back to tcm_mvsas_port */ +struct tcm_mvsas_port *port; +/* Returned by tcm_mvsas_make_tpg() */ +struct se_portal_group_s se_tpg; +}; + +struct tcm_mvsas_port { +/* SCSI protocol the port is providing */ +u8 port_proto_id; +/* Binary World Wide unique Port Name for FC Target Lport */ +u64 port_wwpn; +/* ASCII formatted WWPN for FC Target Lport */ +char port_name[TCM_MVSAS_NAMELEN ]; +/* Returned by tcm_mvsas_make_port() */ +struct se_wwn_s port_wwn; +};
drivers/target/tcm_mvsas/tcm_mvsas_configfs.c new file +332 -0
332 lines not on this page · raw message
drivers/target/tcm_mvsas/tcm_mvsas_fabric.c new file +362 -0
362 lines not on this page · raw message
drivers/target/tcm_mvsas/tcm_mvsas_fabric.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.5.6.5