From e919c5bb20f203e2b318fc07add2adfc8f7407a7 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 6 May 2015 00:47:22 +0000 Subject: [PATCH 1/5] Cleanup git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6199 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/include/scst.h b/scst/include/scst.h index b0cd1e388..819a77564 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2342,7 +2342,7 @@ struct scst_cmd { /* * Set by SCST if the custom data buffer allocated by the target driver - * or, for internal commands, by SCST core . + * or, for internal commands, by SCST core. */ unsigned int tgt_i_data_buf_alloced:1; From 2a5679df532dcde606145516eedca591769086ec Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 6 May 2015 00:48:42 +0000 Subject: [PATCH 2/5] T10-PI clarifications git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6200 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/README | 6 ++++-- scst/README_in-tree | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scst/README b/scst/README index 544f031f9..5fd03b38a 100644 --- a/scst/README +++ b/scst/README @@ -1028,10 +1028,12 @@ cache. The following parameters possible for vdisk_fileio: * scst - DIF tags are checked inside SCST core - * dev_check - DIF tags are checked inside backend device + * dev_check - DIF tags are checked inside backend device. No DIF + tags storing is required, but optionally possible. * dev_store - DIF tags are stored inside backend device on the WRITE - path and read from it on the READ path + path and read from it on the READ path. No DIF tags checking is + required, but optionally possible. For instance, if only tgt DIF mode specified, then target driver, serving this device, will inside hardware check, then STRIP DIF tags diff --git a/scst/README_in-tree b/scst/README_in-tree index 7f8ff81a7..2f1a0acf6 100644 --- a/scst/README_in-tree +++ b/scst/README_in-tree @@ -900,10 +900,12 @@ cache. The following parameters possible for vdisk_fileio: * scst - DIF tags are checked inside SCST core - * dev_check - DIF tags are checked inside backend device + * dev_check - DIF tags are checked inside backend device. No DIF + tags storing is required, but optionally possible. * dev_store - DIF tags are stored inside backend device on the WRITE - path and read from it on the READ path + path and read from it on the READ path. No DIF tags checking is + required, but optionally possible. For instance, if only tgt DIF mode specified, then target driver, serving this device, will inside hardware check, then STRIP DIF tags From 9b66034f3fe3e452a71bce3c84588c2a630df6be Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 6 May 2015 00:49:13 +0000 Subject: [PATCH 3/5] T10-PI documentation git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6201 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/T10-PI | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 scst/T10-PI diff --git a/scst/T10-PI b/scst/T10-PI new file mode 100644 index 000000000..28c0c8a4c --- /dev/null +++ b/scst/T10-PI @@ -0,0 +1,141 @@ +GENERAL CONSIDERATIONS +====================== + +SCST has almost full features implementation of T10-PI standard +supporting all protection modes. The only missing feature is Application +Tag mode page. A patch implementing it is welcome. + +SCST T10-PI implementation has 2 modes of operations: + +1. Computing. In this mode no protection information (PI) is stored. It +only checked upon arrival (WRITEs) and calculated from the data upon +sending (READs). Goal of this mode to provide protection against uplink, +i.e. path to initiator, corruptions. + +2. Storing. In this mode PI is stored either in a file/device as simple +array with 8 bytes entries, or inside block device using block integrity +extensions. In this mode full end-to-end protection could be +implemented. + +In both "computing" and "storing" modes PI can be checked on any stages +of commands processing: + +1. Target HW + +2. SCST + +3. Backend HW, if it supports block integrity extensions. + +Any of them or all can be independently enabled or disabled depending +from level of performance overhead and required protection. For +instance, the target HW stage is the cheapest from performance +perspective, but doesn't protect against corruptions or misdirections on +PCI bus between the target HW and system. Another example, if backend HW +supports T10-PI, no checks on other stages are generally needed, but can +be used to localize place where corruption happened. Checking on each +stage to be able to localize corruption place is the recommended by T10 +way of processing. + + +USER INTERFACE +============== + +Currently only scst_vdisk handler supports T10-PI. + +See in the main README description of SCST sysfs attributes: +dif_capabilities, dif_checks_failed, dif_mode, dif_type, +dif_static_app_tag and dif_filename. + +Examples: +--------- + +dif_mode=tgt, dif_type=1 - TGT level only check, type 1 + +dif_mode=scst, dif_type=1, dif_static_app_tag=0x4149 - + SCST level only check, type 1, static app tag 0x4149 + +dif_mode=scst|dev_store, dif_type=1, dif_filename=/var/lib/scst/dif_tags/rd1_dif.dif - + SCST level only check and storing PI data in the file + +dif_mode=scst, dif_type=2 - SCST level only check, type 2 (32-byte commands) + +dif_mode=tag|scst|dev_check|dev_store, dif_type=1 - all levels check + storing tags using block integrity extensions, type 1 + + +INTERFACE BETWEEN SCST AND TARGET DRIVERS +========================================= + +To support T10-PI struct scst_tgt_template has several new fields: +supported_dif_block_sizes, dif_supported, hw_dif_type1_supported, +hw_dif_type2_supported, hw_dif_type3_supported, hw_dif_ip_supported, +hw_dif_same_sg_layout_required. See their description in their comments +in scst.h. + +A READ-direction workflow from a target driver perspective should look +like: + +1. No extra actions until xmit_response() stage* + +2. On xmit_response() stage call scst_cmd_get_dif_sg(cmd)**. If returned +value is NULL, no further PI actions are needed. + +3. Otherwise, call scst_get_read_dif_tgt_actions(cmd) to find out what +PI actions are needed. The return value has encoded 2 types of actions: +action itself and tags checks. + +Possible actions, which could be extracted by using scst_get_dif_action(), +are: + + - SCST_DIF_ACTION_STRIP - check, then strip the protection info, if it + is OK + + - SCST_DIF_ACTION_INSERT - insert the protection info + + - SCST_DIF_ACTION_PASS_CHECK - check the protection info, then pass it + to the initiator + + - SCST_DIF_ACTION_PASS - then pass the protection information to the + initiator without checking + +Possible tags checks, which could be extracted by using +scst_get_dif_checks() are: + + - SCST_DIF_CHECK_GUARD_TAG - check the guard tags + + - SCST_DIF_CHECK_REF_TAG - check the reference tags + + - SCST_DIF_CHECK_APP_TAG - check the application tags comparing them to + the static tag set by dif_static_app_tag attribute + +4. Perform the requested PI actions and transfer PI from the returned +dif_sg together with the regular data**. + + +A WRITE-direction workflow from a target driver perspective should look +like: + +1. No extra actions until rdy_to_xfer() stage* + +2. On rdy_to_xfer() stage call scst_cmd_get_dif_sg(cmd)**. If returned +value is NULL, no further PI actions are needed. + +3. Otherwise, call scst_get_write_dif_tgt_actions(cmd) to find out what +PI actions are needed. + +4. Perform the requested PI actions and transfer PI to the returned +dif_sg together with regular data**. + + +(*) If the target driver uses custom data buffer, on this stage it must +together with data sg by scst_cmd_set_tgt_dif_sg() function also set the +corresponding PI sg. + +(**) The PI SG returned by scst_cmd_get_dif_sg() does not have the +corresponding SG-segments counter, because it is strictly bound to +number of blocks in the data SG. + + +You can find full external SCST T10-PI interface if you look in scst.h +functions with "_dif_" string in their name. They are well documented in +comments near them. From 627f79738fb1523c2216aa067083a0d9555bb306 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 6 May 2015 01:02:04 +0000 Subject: [PATCH 4/5] Fix proc build git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6202 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 34508ada0..3436167af 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -1570,6 +1570,7 @@ next: PRINT_WARNING("Device %s: static app tag is ignored for DIF " "mode 2", dev->virt_name); +#ifndef CONFIG_SCST_PROC if (virt_dev->dif_filename != NULL) { res = scst_create_dev_attr(dev, &vdev_dif_filename_attr); if (res != 0) { @@ -1579,6 +1580,7 @@ next: goto out; } } +#endif if (virt_dev->zero_copy && virt_dev->o_direct_flag) { PRINT_ERROR("%s: combining zero_copy with o_direct is not" From e719f0eca531418da5f0d3929394fcbfda5d76cd Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 6 May 2015 02:05:54 +0000 Subject: [PATCH 5/5] ib_srpt: cleanup fixed git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6203 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/srpt/Makefile b/srpt/Makefile index 59f1c26df..68fcfcdbf 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -131,8 +131,10 @@ src/$(MODULE_SYMVERS): $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS) \ fi clean: - $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src clean + $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/gid_change clean + $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/ clean rm -f src/$(MODULE_SYMVERS) src/Module.markers src/modules.order + rm -rf conftest/pre_cflags conftest/kcflags extraclean: clean rm -f *.orig *.rej