tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module - enhancements
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module - enhancements
Hello Himanshu and Nicholas,
Enhancements to the tcm_debug code.
Added the possibility of blocking only specific SCSI data movement commands but allowing TUR'S to pass. This has been helpful for debugging many driver/array interoperabilty issues.
Two Patches, The first is to the driver code, second is updating the documentation.
Tested by: Laurence Oberman <[email protected]>
drivers/scsi/qla2xxx/tcm_qla2xxx.c | 7 +++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 2 files changed, 8 insertions(+)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +7 -0
@@ -473,6 +473,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,/* return, and dont run target_submit_cmd,discarding command */ return 0; } +if (unlikely (tpg->tpg_attrib.jam_host && tpg->tpg_attrib.jam_data && (cdb[0 ]==0x08 || cdb[0 ]==0x0A || cdb[0 ]==0x28 || cdb[0 ]==0x2A ))) { +/* return, and dont run target_submit_cmd,discarding command if not TUR*/ +return 0 ; + }#endif cmd->vha->tgt_counters.qla_core_sbt_cmd++;
@@ -827,6 +831,7 @@ DEF_QLA_TPG_ATTRIB(prod_mode_write_protect);DEF_QLA_TPG_ATTRIB (demo_mode_login_only);#ifdef CONFIG_TCM_QLA2XXX_DEBUG DEF_QLA_TPG_ATTRIB (jam_host); +DEF_QLA_TPG_ATTRIB (jam_data);#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = {
@@ -837,6 +842,7 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, #ifdef CONFIG_TCM_QLA2XXX_DEBUG &tcm_qla2xxx_tpg_attrib_attr_jam_host, + &tcm_qla2xxx_tpg_attrib_attr_jam_data, #endif NULL, };
@@ -1011,6 +1017,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.cache_dynamic_acls =1 ; tpg->tpg_attrib.demo_mode_login_only =1 ; tpg->tpg_attrib.jam_host =0 ; + tpg->tpg_attrib.jam_data =0 ; ret =core_tpg_register (wwn, &tpg->se_tpg,SCSI_PROTOCOL_FCP );if (ret <0 ) {
drivers/scsi/qla2xxx/tcm_qla2xxx.h +1 -0
@@ -35,6 +35,7 @@ struct tcm_qla2xxx_tpg_attrib {int demo_mode_login_only;int fabric_prot_type;int jam_host; +int jam_data; };struct tcm_qla2xxx_tpg {
Signature · 6 lines
2.5.5 Documentation/scsi/tcm_qla2xxx.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Documentation/scsi/tcm_qla2xxx.txt +16 -0
@@ -20,3 +20,19 @@ echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib Disable jamming on host 4 echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host + +New feature added with a new attribute called jam_data. + +Setting a boolean of 1 for jam_data as well as setting the boolean of 1 for jam_host will + allow the dropping of data-only SCSI commands but allow TUR commands to pass. + +This has proven very useful for testing Low Level driver response. + +Enable host 4 for only data commands to be jammed +echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_data + +Disable jamming on host 4 +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_data +
Signature · 1 line
2.5.5
----- Original Message -----
Quoted 124 lines
From: "Laurence Oberman" <[email protected]>
To: "himanshu madhani" <[email protected]>, [email protected], "Linux SCSI Mailinglist" <[email protected]>
Sent: Tuesday, August 30, 2016 5:24:19 PM
Subject: [PATCH]tcm_qla2xxxAdd SCSI command jammer/discard capability to thetcm_qla2xxxmodule - enhancementsHello Himanshu and Nicholas,
Enhancements to the
tcm_debugcode.
Added the possibility of blocking only specific SCSI data movement commands but allowing TUR'S to pass.
This has been helpful for debugging many driver/array interoperabilty issues.Two Patches, The first is to the driver code, second is updating the documentation.
Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>drivers/scsi/qla2xxx/tcm_qla2xxx.c | 7 +++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 2 files changed, 8 insertions(+)drivers/scsi/qla2xxx/tcm_qla2xxx.c +2
-0@@ -473,6 +473,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha,struct qla_tgt_cmd *cmd,/* return, and dont run target_submit_cmd,discarding command */ return 0; } +if (unlikely (tpg->tpg_attrib.jam_host && tpg->tpg_attrib.jam_data && (cdb[0 ]==0x08 || cdb[0 ]==0x0A || cdb[0 ]==0x28 || cdb[0 ]==0x2A ))) { +/* return, and dont run target_submit_cmd,discarding command if not TUR*/
drivers/scsi/qla2xxx/tcm_qla2xxx.c +4
-0+ return 0; + }#endif cmd->vha->tgt_counters.qla_core_sbt_cmd++;@@ -827,6 +831,7 @@ DEF_QLA_TPG_ATTRIB(prod_mode_write_protect);DEF_QLA_TPG_ATTRIB (demo_mode_login_only);#ifdef CONFIG_TCM_QLA2XXX_DEBUG DEF_QLA_TPG_ATTRIB (jam_host); +DEF_QLA_TPG_ATTRIB (jam_data);#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = {@@ -837,6 +842,7 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, #ifdef CONFIG_TCM_QLA2XXX_DEBUG &tcm_qla2xxx_tpg_attrib_attr_jam_host, + &tcm_qla2xxx_tpg_attrib_attr_jam_data, #endif NULL,};
drivers/scsi/qla2xxx/tcm_qla2xxx.c +1
-0@@ -1011,6 +1017,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.cache_dynamic_acls =1 ; tpg->tpg_attrib.demo_mode_login_only =1 ; tpg->tpg_attrib.jam_host =0 ; + tpg->tpg_attrib.jam_data =0 ; ret =core_tpg_register (wwn, &tpg->se_tpg,SCSI_PROTOCOL_FCP );if (ret <0 ) {drivers/scsi/qla2xxx/tcm_qla2xxx.h +1
-1@@ -35,6 +35,7 @@ struct tcm_qla2xxx_tpg_attrib {int demo_mode_login_only;int fabric_prot_type;int jam_host; +int jam_data; };struct tcm_qla2xxx_tpg { --2.5.5
Documentation/scsi/tcm_qla2xxx.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)Documentation/scsi/tcm_qla2xxx.txt +0
-0@@ -20,3 +20,19 @@ echo 1 >/sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib
Disable jamming on host 4
echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_hostDocumentation/scsi/tcm_qla2xxx.txt +4
-0+ +New feature added with a new attribute called jam_data. + +Setting a boolean of 1 for jam_data as well as setting the boolean of 1 for
jam_hostwill
+ allow the dropping of data-only SCSI commands but allow TUR commands to pass.Documentation/scsi/tcm_qla2xxx.txt +5
-0+ +This has proven very useful for testing Low Level driver response. + +Enable host 4 for only data commands to be jammed +echo 1 >/sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_data
Documentation/scsi/tcm_qla2xxx.txt +3
-0+ +Disable jamming on host 4 +echo 0 >/sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_data +
--
2.5.5
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Oops
Replying to my own message
I need to send a V2 of this patch, apologies, just realized match on first check of jam_host so 2nd check wont be met. When testing only had 2nd check in code and only just saw it.
Back shortly
Re: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module - enhancements V2 (corrected)
Hello Himanshu and Nicholas,
Enhancements to the tcm_debug code.
This is patch V2 (final) as V1 had issues.
Added the possibility of blocking only specific SCSI data movement commands but allowing TUR'S to pass.
This has been helpful for debugging many driver/array interoperabilty issues.
Folded documentation and code into single patch now
Tested by: Laurence Oberman <[email protected]>
Documentation/scsi/tcm_qla2xxx.txt | 16 ++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 7 +++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 3 files changed, 24 insertions(+)
Documentation/scsi/tcm_qla2xxx.txt +16 -0
@@ -20,3 +20,19 @@ echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib Disable jamming on host 4 echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host + +New feature added with a new attribute called jam_data. + +Setting a boolean of 1 for jam_data will allow the allow the dropping of data-only SCSI + commands but allow TUR commands to pass. +Note that for this to work jam_host needs to be set to 0 + +This has proven very useful for testing Low Level driver response. + +Enable host 4 for only data commands to be jammed +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_data + +Disable jamming on host 4 +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_data
drivers/scsi/qla2xxx/tcm_qla2xxx.c +7 -0
@@ -473,6 +473,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,/* return, and dont run target_submit_cmd,discarding command */ return 0; } +if (unlikely (tpg->tpg_attrib.jam_data && (cdb[0 ]==0x08 || cdb[0 ]==0x0A || cdb[0 ]==0x28 || cdb[0 ]==0x2A ))) { +/* return, and dont run target_submit_cmd,discarding command if not TUR*/ +return 0 ; + }#endif cmd->vha->tgt_counters.qla_core_sbt_cmd++;
@@ -827,6 +831,7 @@ DEF_QLA_TPG_ATTRIB(prod_mode_write_protect);DEF_QLA_TPG_ATTRIB (demo_mode_login_only);#ifdef CONFIG_TCM_QLA2XXX_DEBUG DEF_QLA_TPG_ATTRIB (jam_host); +DEF_QLA_TPG_ATTRIB (jam_data);#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = {
@@ -837,6 +842,7 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, #ifdef CONFIG_TCM_QLA2XXX_DEBUG &tcm_qla2xxx_tpg_attrib_attr_jam_host, + &tcm_qla2xxx_tpg_attrib_attr_jam_data, #endif NULL, };
@@ -1011,6 +1017,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.cache_dynamic_acls =1 ; tpg->tpg_attrib.demo_mode_login_only =1 ; tpg->tpg_attrib.jam_host =0 ; + tpg->tpg_attrib.jam_data =0 ; ret =core_tpg_register (wwn, &tpg->se_tpg,SCSI_PROTOCOL_FCP );if (ret <0 ) {
drivers/scsi/qla2xxx/tcm_qla2xxx.h +1 -0
@@ -35,6 +35,7 @@ struct tcm_qla2xxx_tpg_attrib {int demo_mode_login_only;int fabric_prot_type;int jam_host; +int jam_data; };struct tcm_qla2xxx_tpg {
Signature · 1 line
2.5.5
Himanshu Madhani
Acked-byRe: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module - enhancements V2 (corrected)
Quoted 98 lines · Laurence Oberman
Hello Himanshu and Nicholas,
Enhancements to the
tcm_debugcode.
This is patch V2 (final) as V1 had issues.Added the possibility of blocking only specific SCSI data movement commands but allowing TUR'S to pass.
This has been helpful for debugging many driver/array interoperabilty issues.Folded documentation and code into single patch now
Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>Documentation/scsi/tcm_qla2xxx.txt | 16 ++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 7 +++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 3 files changed, 24 insertions(+)Documentation/scsi/tcm_qla2xxx.txt +0
-0@@ -20,3 +20,19 @@ echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attribDisable jamming on host 4
echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_hostDocumentation/scsi/tcm_qla2xxx.txt +16
-0+ +New feature added with a new attribute called jam_data. + +Setting a boolean of 1 for jam_data will allow the allow the dropping of data-only SCSI + commands but allow TUR commands to pass. +Note that for this to work jam_host needs to be set to 0 + +This has proven very useful for testing Low Level driver response. + +Enable host 4 for only data commands to be jammed +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_data + +Disable jamming on host 4 +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_datadrivers/scsi/qla2xxx/tcm_qla2xxx.c +7
-0@@ -473,6 +473,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,/* return, and dont run target_submit_cmd,discarding command */ return 0; } +if (unlikely (tpg->tpg_attrib.jam_data && (cdb[0 ]==0x08 || cdb[0 ]==0x0A || cdb[0 ]==0x28 || cdb[0 ]==0x2A ))) { +/* return, and dont run target_submit_cmd,discarding command if not TUR*/ +return 0 ; + }#endif cmd->vha->tgt_counters.qla_core_sbt_cmd++;@@ -827,6 +831,7 @@ DEF_QLA_TPG_ATTRIB(prod_mode_write_protect);DEF_QLA_TPG_ATTRIB (demo_mode_login_only);#ifdef CONFIG_TCM_QLA2XXX_DEBUG DEF_QLA_TPG_ATTRIB (jam_host); +DEF_QLA_TPG_ATTRIB (jam_data);#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = {@@ -837,6 +842,7 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, #ifdef CONFIG_TCM_QLA2XXX_DEBUG &tcm_qla2xxx_tpg_attrib_attr_jam_host, + &tcm_qla2xxx_tpg_attrib_attr_jam_data, #endif NULL, };@@ -1011,6 +1017,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.cache_dynamic_acls =1 ; tpg->tpg_attrib.demo_mode_login_only =1 ; tpg->tpg_attrib.jam_host =0 ; + tpg->tpg_attrib.jam_data =0 ; ret =core_tpg_register (wwn, &tpg->se_tpg,SCSI_PROTOCOL_FCP );if (ret <0 ) {drivers/scsi/qla2xxx/tcm_qla2xxx.h +1
-0@@ -35,6 +35,7 @@ struct tcm_qla2xxx_tpg_attrib {int demo_mode_login_only;int fabric_prot_type;int jam_host; +int jam_data; };struct tcm_qla2xxx_tpg {Signature · 1 line
2.5.5
Looks okay.