Skip to contentSkip to conversation

Add generic >= SPC-3 and legacy SPC-2 infrastructure

PATCH In review Nicholas A. Bellinger 1 participant 1 message Jan 22, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 Add generic >= SPC-3 and legacy SPC-2 infrastructure

Quoted 1 line

From ed2ddd0dac75734bb48c9429ec7d6c75d1d1d93a Mon Sep 17 00:00:00 2001

From: Nicholas Bellinger <[email protected]>
Date: Wed, 21 Jan 2009 22:20:20 -0800
Subject: [PATCH 3/4] [Target_Core_Mod] Add generic >= SPC-3 and legacy SPC-2 infrastructure

This patch adds target_core_pr.[c,h] and core_setup_reservations() for an associated se_device_t / se_subsystem_dev_t and se_cmd_t via $FABRIC_MOD and Target_Core_Mod/Passthrough ops.

It currently forces Target_Core_Mod/PSCSI to SPC_PASSTHROUGH (no emulation) and SPC2_RESERVATIONS based on se_subsystem_api_t->get_device_rev() return values using linux/include/scsi/scsi.h:SCSI_[1,2,3] defines.

The logic for core_scsi3_pr_seq_non_holder() is based on spc4r17 for controlling access of CDB execution for SCSI Initiator Ports not holding the SPC-3 compliant reservation.

This code is a WIP for >= SPC-3 Persistent Rervations across Target_Core_Mod/ConfigFS

---
 drivers/lio-core/Makefile         |    1 +
 drivers/lio-core/target_core_pr.c |  427 +++++++++++++++++++++++++++++++++++++
 drivers/lio-core/target_core_pr.h |   25 +++
 3 files changed, 453 insertions(+), 0 deletions(-)
 create mode 100644 drivers/lio-core/target_core_pr.c
 create mode 100644 drivers/lio-core/target_core_pr.h
drivers/lio-core/Makefile +1 -0
index 7605add..98a5ef3 100644
@@ -33,6 +33,7 @@ target_core_mod-objs			:=	target_core_configfs.o \
 						target_core_device.o \
 						target_core_hba.o \
 						target_core_plugin.o \
+						target_core_pr.o \
 						target_core_scdb.o \
 						target_core_seobj.o \
 						target_core_tpg.o \
drivers/lio-core/target_core_pr.c new file +427 -0

427 lines not on this page · raw message

drivers/lio-core/target_core_pr.h new file +25 -0
new file mode 100644
index 0000000..d32bbdd
@@ -0,0 +1,25 @@
+/*
+ * PERSISTENT_RESERVE_OUT service action codes
+ *
+ * spc4r17 section 6.14.2 Table 171
+ */
+#define PRO_REGISTER				0x00
+#define PRO_RESERVE				0x01
+#define PRO_RELEASE				0x02
+#define PRO_CLEAR				0x03
+#define PRO_PREEMPT				0x04
+#define PRO_PREEMPT_AND_ABORT			0x05
+#define PRO_REGISTER_AND_IGNORE_EXISTING_KEY	0x06
+#define PRO_REGISTER_AND_MOVE			0x07
+/*
+ * PERSISTENT_RESERVE_IN service action codes
+ *
+ * spc4r17 section 6.13.1 Table 159
+ */
+#define PRI_READ_KEYS				0x00
+#define PRI_READ_RESERVATION			0x01
+#define PRI_REPORT_CAPABILITIES			0x02
+#define PRI_READ_FULL_STATUS			0x03
+
+extern int core_scsi3_emulate_pr (struct se_cmd_s *);
+extern int core_setup_reservations (struct se_device_s *);
Signature · 1 line
1.5.4.1