tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision3
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hello Bart,
I have been using this jammer functionality to continue testing the SCSI F/C drivers and recovery for over a year now. Any chance you would agree to ack this so I can get it in now.
I last posted to the list last March and it was not picked up.
I did look into moving this to upper layers but I find I use it primarily for fiber channel target testing. Attempting to add this functionality to upper layers led to complexities and this is very solid.
This Patch diff against 4.5
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior
in the Emulex, Qlogic and other F/C drivers.
Works by checking new parameter jam_host if its >= 0 and matches vha->host_no , jamming is enabled when jam_host >=0 If parameter set to -1 (default) no jamming is enabled.
Tested by: Laurence Oberman <[email protected]>
Documentation/scsi/tcm_qla2xxx.txt +31 -0
@@ -0,0 +1,31 @@ +tcm_qla2xxx jammer parameter usage +---------------------------------- +There is now a new module parameter added to the tcm_qla2xx module +parm: jam_host:Host to jam >=0 Enable jammer (int) + +Use this parameter to control the discarding of SCSI commands to a selected +host. +This may be useful for testing error handling and simulating slow drain +and other fabric issues. + +Any value >=0 that matches a fc_host # will discard the commands for that host. +Reset back to -1 to stop the jamming. + +Enable host 6 to be jammed +echo 6 > /sys/module/tcm_qla2xxx/parameters/jam_host + +Disable jamming on host 6 +echo -1 > /sys/module/tcm_qla2xxx/parameters/jam_host + +Usage example script: + +#!/bin/bash +sleep_time=120 ### Time to jam for +echo 6 > /sys/module/tcm_qla2xxx/parameters/jam_host +host=`cat /sys/module/tcm_qla2xxx/parameters/jam_host` +echo "We start to discard commands on SCSI host $host" +logger "Jammer started" +sleep $sleep_time +echo -1 > /sys/module/tcm_qla2xxx/parameters/jam_host +echo "We stopped the jammer" +logger "Jammer stopped"
drivers/scsi/qla2xxx/tcm_qla2xxx.c +10 -0
@@ -48,6 +48,10 @@#include "qla_target.h" #include "tcm_qla2xxx.h" +int jam_host =-1 ; +module_param (jam_host, int,0644 ); +MODULE_PARM_DESC (jam_host,"Host to jam >=0 Enable jammer" ); +static struct workqueue_struct *tcm_qla2xxx_free_wq;static struct workqueue_struct *tcm_qla2xxx_cmd_wq;
@@ -477,6 +481,11 @@ static int tcm_qla2xxx_handle_cmd(scsi_qreturn -EINVAL ; } +if (unlikely (vha->host_no == jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } + cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], cmd->unpacked_lun, data_length, fcp_task_attr,
@@ -1967,6 +1976,7 @@ static void tcm_qla2xxx_deregister_confistatic int __init tcm_qla2xxx_init (void ) {int ret; + jam_host =-1 ; ret =tcm_qla2xxx_register_configfs ();if (ret <0 )
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services
Quoted 9 lines · Laurence Oberman
I have been using this jammer functionality to continue testing the SCSI F/C drivers and recovery for over a year now. Any chance you would agree to ack this so I can get it in now.
I last posted to the list last March and it was not picked up.I did look into moving this to upper layers but I find I use it primarily for fiber channel target testing. Attempting to add this functionality to upper layers led to complexities and this is very solid.
This Patch diff against 4.5
Quoted 8 lines
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior
in the Emulex, Qlogic and other F/C drivers.Works by checking new parameter
jam_hostif its >= 0 and matchesvha->host_no, jamming is enabled whenjam_host>=0 If parameter set to -1 (default) no jamming is enabled.
Hello Laurence,
Nic Bellinger is the maintainer of LIO so my recommendation is to ask Nic first about his opinion (I have CC'd Nic). I'm not sure what Nic thinks about this but in my opinion such functionality belongs in the target core instead of in a target driver. But please wait until Nic has provided his opinion before spending more time on this. The mailing list for SCSI target patches is [email protected].
Bart.
(Adding target-devel + Qlogic target folks)
Quoted 19 lines · Bart Van Assche
Quoted 9 lines · Laurence Oberman
I have been using this jammer functionality to continue testing the SCSI F/C drivers and recovery for over a year now. Any chance you would agree to ack this so I can get it in now.
I last posted to the list last March and it was not picked up.I did look into moving this to upper layers but I find I use it primarily for fiber channel target testing. Attempting to add this functionality to upper layers led to complexities and this is very solid.
This Patch diff against 4.5
Quoted 8 lines
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior
in the Emulex, Qlogic and other F/C drivers.Works by checking new parameter
jam_hostif its >= 0 and matchesvha->host_no, jamming is enabled whenjam_host>=0 If parameter set to -1 (default) no jamming is enabled.
Quoted 9 lines
Hello Laurence,
Nic Bellinger is the maintainer of LIO so my recommendation is to ask Nic first about his opinion (I have CC'd Nic). I'm not sure what Nic thinks about this but in my opinion such functionality belongs in the target core instead of in a target driver. But please wait until Nic has provided his opinion before spending more time on this. The mailing list for SCSI target patches is [email protected].
So really it's Himanshu's + Quinn's call if they would like to include something like this in mainline.
If so, then I'd prefer to do it with a per tcm_qla2xxx_tpg endpoint attribute instead a new module parameter, and add a new kernel config option (CONFIG_TCM_QLA2XXX_DEBUG) to disable (by default) so end users don't inadvertently play with it via targetcli + friends.
Hi Nic, Laurence,
Quoted 32 lines · Nicholas A. Bellinger
(Adding target-devel + Qlogic target folks)
Quoted 19 lines · Bart Van Assche
Quoted 9 lines · Laurence Oberman
I have been using this jammer functionality to continue testing the SCSI F/C drivers and recovery for over a year now. Any chance you would agree to ack this so I can get it in now.
I last posted to the list last March and it was not picked up.I did look into moving this to upper layers but I find I use it primarily for fiber channel target testing. Attempting to add this functionality to upper layers led to complexities and this is very solid.
This Patch diff against 4.5
Quoted 8 lines
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior
in the Emulex, Qlogic and other F/C drivers.Works by checking new parameter
jam_hostif its >= 0 and matchesvha->host_no, jamming is enabled whenjam_host>=0 If parameter set to -1 (default) no jamming is enabled.Quoted 9 lines
Hello Laurence,
Nic Bellinger is the maintainer of LIO so my recommendation is to ask Nic first about his opinion (I have CC'd Nic). I'm not sure what Nic thinks about this but in my opinion such functionality belongs in the target core instead of in a target driver. But please wait until Nic has provided his opinion before spending more time on this. The mailing list for SCSI target patches is [email protected].
Quoted 8 lines
So really it's Himanshu's + Quinn's call if they would like to include something like this in mainline.
If so, then I'd prefer to do it with a per
tcm_qla2xxx_tpgendpoint attribute instead a new module parameter, and add a new kernel config option (CONFIG_TCM_QLA2XXX_DEBUG) to disable (by default) so end users don't inadvertently play with it via targetcli + friends.
I agree here with Nic. The patch does provides benefit and is good addition, but we don’t want to enable it by default.
Laurence,
Would you be kind to rework patch with suggested changes from Nic and post it.
Thanks,
Himanshu
Hello Himanshu
Thanks, I will rework and post back to the thread.
Thank you
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services
----- Original Message -----
From: "Himanshu Madhani" <[email protected]>
To: "Nicholas A. Bellinger" <[email protected]>, "Bart Van Assche" <[email protected]>
Cc: "Laurence Oberman" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Thursday, March 31, 2016 8:20:56 PM
Subject: Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision3
Hi Nic, Laurence,
Quoted 32 lines · Nicholas A. Bellinger
(Adding target-devel + Qlogic target folks)
Quoted 19 lines · Bart Van Assche
Quoted 9 lines · Laurence Oberman
I have been using this jammer functionality to continue testing the SCSI F/C drivers and recovery for over a year now. Any chance you would agree to ack this so I can get it in now.
I last posted to the list last March and it was not picked up.I did look into moving this to upper layers but I find I use it primarily for fiber channel target testing. Attempting to add this functionality to upper layers led to complexities and this is very solid.
This Patch diff against 4.5
Quoted 8 lines
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior
in the Emulex, Qlogic and other F/C drivers.Works by checking new parameter
jam_hostif its >= 0 and matchesvha->host_no, jamming is enabled whenjam_host>=0 If parameter set to -1 (default) no jamming is enabled.Quoted 9 lines
Hello Laurence,
Nic Bellinger is the maintainer of LIO so my recommendation is to ask Nic first about his opinion (I have CC'd Nic). I'm not sure what Nic thinks about this but in my opinion such functionality belongs in the target core instead of in a target driver. But please wait until Nic has provided his opinion before spending more time on this. The mailing list for SCSI target patches is [email protected].
Quoted 8 lines
So really it's Himanshu's + Quinn's call if they would like to include something like this in mainline.
If so, then I'd prefer to do it with a per
tcm_qla2xxx_tpgendpoint attribute instead a new module parameter, and add a new kernel config option (CONFIG_TCM_QLA2XXX_DEBUG) to disable (by default) so end users don't inadvertently play with it via targetcli + friends.
I agree here with Nic. The patch does provides benefit and is good addition, but we don’t want to enable it by default.
Laurence,
Would you be kind to rework patch with suggested changes from Nic and post it.
Thanks,
Himanshu
--
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
Himanshu
I looked at using the attribute for this but because of where I have to discard the command I dont want to have to go fetch the attribute each time in the same code path. Its significant overhead to have to go fetch the attribute value each time as I allow for a dynamic on off via the module parameter so I have to check it each command. With the module parameter its a simple compare and by having this as a module parameter its globally accessible and imposes virtually no overhead.
Are you OK with me using #ifdef on the CONFIG_TCM_QLA2XXX_DEBUG .config parameter I will add here to include the module parameter and code only if set to "yes" The default unless expicitly set will be no change.
Thanks
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services
----- Original Message -----
From: "Himanshu Madhani" <[email protected]>
To: "Nicholas A. Bellinger" <[email protected]>, "Bart Van Assche" <[email protected]>
Cc: "Laurence Oberman" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Thursday, March 31, 2016 8:20:56 PM
Subject: Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision3
Hi Nic, Laurence,
Quoted 32 lines · Nicholas A. Bellinger
(Adding target-devel + Qlogic target folks)
Quoted 19 lines · Bart Van Assche
Quoted 9 lines · Laurence Oberman
I have been using this jammer functionality to continue testing the SCSI F/C drivers and recovery for over a year now. Any chance you would agree to ack this so I can get it in now.
I last posted to the list last March and it was not picked up.I did look into moving this to upper layers but I find I use it primarily for fiber channel target testing. Attempting to add this functionality to upper layers led to complexities and this is very solid.
This Patch diff against 4.5
Quoted 8 lines
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior
in the Emulex, Qlogic and other F/C drivers.Works by checking new parameter
jam_hostif its >= 0 and matchesvha->host_no, jamming is enabled whenjam_host>=0 If parameter set to -1 (default) no jamming is enabled.Quoted 9 lines
Hello Laurence,
Nic Bellinger is the maintainer of LIO so my recommendation is to ask Nic first about his opinion (I have CC'd Nic). I'm not sure what Nic thinks about this but in my opinion such functionality belongs in the target core instead of in a target driver. But please wait until Nic has provided his opinion before spending more time on this. The mailing list for SCSI target patches is [email protected].
Quoted 8 lines
So really it's Himanshu's + Quinn's call if they would like to include something like this in mainline.
If so, then I'd prefer to do it with a per
tcm_qla2xxx_tpgendpoint attribute instead a new module parameter, and add a new kernel config option (CONFIG_TCM_QLA2XXX_DEBUG) to disable (by default) so end users don't inadvertently play with it via targetcli + friends.
I agree here with Nic. The patch does provides benefit and is good addition, but we don’t want to enable it by default.
Laurence,
Would you be kind to rework patch with suggested changes from Nic and post it.
Thanks,
Himanshu N�����r��y���b�X��ǧv�^�){.n�+����{���"�{ay�ʇڙ�,j��f���h���z��w������j:+v���w�j�m��������zZ+��ݢj"��
Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision4
Hello Himanshu
This patch was reworked to only include the jammer code if the parameter TCM_QLA2XXX_DEBUG=Y is set. The default is to not provide this functionality at all.
I looked at using attributes but this code is in the fastpath and the overhead or fetching the attribute each time is not a good idea.
Control of this needs to be dynamic and the module parameter allows a simple compare in the fastpath.
Patch notes
------------
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior in the Emulex, Qlogic and other F/C drivers.
Works by checking new parameter jam_host if its >= 0 and matches vha->host_no , jamming is enabled when jam_host >=0 If parameter set to -1 (default) no jamming is enabled.
Tested by: Laurence Oberman <[email protected]>
Documentation/scsi/tcm_qla2xxx.txt +34 -0
@@ -0,0 +1,34 @@ +tcm_qla2xxx jammer parameter usage +---------------------------------- +There is now a new module parameter added to the tcm_qla2xx module +parm: jam_host:Host to jam >=0 Enable jammer (int) +This parameter and accompanying code is only included if the +Kconfig parameter TCM_QLA2XXX_DEBUG is set to Y +By default this jammer code and functionality is disabled + +Use this parameter to control the discarding of SCSI commands to a selected +host. +This may be useful for testing error handling and simulating slow drain +and other fabric issues. + +Any value >=0 that matches a fc_host # will discard the commands for that host. +Reset back to -1 to stop the jamming. + +Enable host 6 to be jammed +echo 6 > /sys/module/tcm_qla2xxx/parameters/jam_host + +Disable jamming on host 6 +echo -1 > /sys/module/tcm_qla2xxx/parameters/jam_host + +Usage example script: + +#!/bin/bash +sleep_time=120 ### Time to jam for +echo 6 > /sys/module/tcm_qla2xxx/parameters/jam_host +host=`cat /sys/module/tcm_qla2xxx/parameters/jam_host` +echo "We start to discard commands on SCSI host $host" +logger "Jammer started" +sleep $sleep_time +echo -1 > /sys/module/tcm_qla2xxx/parameters/jam_host +echo "We stopped the jammer" +logger "Jammer stopped"
drivers/scsi/qla2xxx/Kconfig +10 -0
@@ -36,3 +36,13 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series target mode HBAs" + depends on SCSI_QLA_FC && TARGET_CORE + depends on LIBFC + select BTREE + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+ series target mode HBAs + This will include code to enable the SCSI command jammer
drivers/scsi/qla2xxx/tcm_qla2xxx.c +16 -0
@@ -48,6 +48,12 @@#include "qla_target.h" #include "tcm_qla2xxx.h" +#ifdef TCM_QLA2XXX_DEBUG +int jam_host =-1 ; +module_param (jam_host, int,0644 ); +MODULE_PARM_DESC (jam_host,"Host to jam >=0 Enable jammer" ); +#endif +static struct workqueue_struct *tcm_qla2xxx_free_wq;static struct workqueue_struct *tcm_qla2xxx_cmd_wq;
@@ -477,6 +483,13 @@ static int tcm_qla2xxx_handle_cmd(scsi_qreturn -EINVAL ; } +#ifdef TCM_QLA2XXX_DEBUG +if (unlikely (vha->host_no == jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif + cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], cmd->unpacked_lun, data_length, fcp_task_attr,
@@ -1967,6 +1980,9 @@ static void tcm_qla2xxx_deregister_confistatic int __init tcm_qla2xxx_init (void ) {int ret; +#ifdef TCM_QLA2XXX_DEBUG + jam_host =-1 ; +#endif ret =tcm_qla2xxx_register_configfs ();if (ret <0 )
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services
----- Original Message -----
From: "Laurence Oberman" <[email protected]>
To: "Himanshu Madhani" <[email protected]>
Cc: "Nicholas A. Bellinger" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Friday, April 1, 2016 2:15:25 PM
Subject: Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision3
Himanshu
I looked at using the attribute for this but because of where I have to discard the command I dont want to have to go fetch the attribute each time in the same code path. Its significant overhead to have to go fetch the attribute value each time as I allow for a dynamic on off via the module parameter so I have to check it each command. With the module parameter its a simple compare and by having this as a module parameter its globally accessible and imposes virtually no overhead.
Are you OK with me using #ifdef on the CONFIG_TCM_QLA2XXX_DEBUG .config parameter I will add here to include the module parameter and code only if set to "yes" The default unless expicitly set will be no change.
Thanks
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services
----- Original Message -----
From: "Himanshu Madhani" <[email protected]>
To: "Nicholas A. Bellinger" <[email protected]>, "Bart Van Assche" <[email protected]>
Cc: "Laurence Oberman" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Thursday, March 31, 2016 8:20:56 PM
Subject: Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision3
Hi Nic, Laurence,
Quoted 32 lines · Nicholas A. Bellinger
(Adding target-devel + Qlogic target folks)
Quoted 19 lines · Bart Van Assche
Quoted 9 lines · Laurence Oberman
I have been using this jammer functionality to continue testing the SCSI F/C drivers and recovery for over a year now. Any chance you would agree to ack this so I can get it in now.
I last posted to the list last March and it was not picked up.I did look into moving this to upper layers but I find I use it primarily for fiber channel target testing. Attempting to add this functionality to upper layers led to complexities and this is very solid.
This Patch diff against 4.5
Quoted 8 lines
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior
in the Emulex, Qlogic and other F/C drivers.Works by checking new parameter
jam_hostif its >= 0 and matchesvha->host_no, jamming is enabled whenjam_host>=0 If parameter set to -1 (default) no jamming is enabled.Quoted 9 lines
Hello Laurence,
Nic Bellinger is the maintainer of LIO so my recommendation is to ask Nic first about his opinion (I have CC'd Nic). I'm not sure what Nic thinks about this but in my opinion such functionality belongs in the target core instead of in a target driver. But please wait until Nic has provided his opinion before spending more time on this. The mailing list for SCSI target patches is [email protected].
Quoted 8 lines
So really it's Himanshu's + Quinn's call if they would like to include something like this in mainline.
If so, then I'd prefer to do it with a per
tcm_qla2xxx_tpgendpoint attribute instead a new module parameter, and add a new kernel config option (CONFIG_TCM_QLA2XXX_DEBUG) to disable (by default) so end users don't inadvertently play with it via targetcli + friends.
I agree here with Nic. The patch does provides benefit and is good addition, but we don’t want to enable it by default.
Laurence,
Would you be kind to rework patch with suggested changes from Nic and post it.
Thanks,
Himanshu N�����r��y���b�X��ǧv�^�){.n�+����{���"�{ay�ʇڙ�,j��f���h���z��w������j:+v���w�j�m��������zZ+��ݢj"�� --
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
--
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
Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision4
Hello Himanshu
I noticed a typo in the patch I submitted here is the corrected patch. Please ignore the prior patch
I was missing the full CONFIG name in the #ifdef check
Corrected Patch
[root@localhost home]# linux-4.5/scripts/checkpatch.pl jammer_patch.v4
total: 0 errors, 0 warnings, 81 lines checked
jammer_patch.v4 has no obvious style problems and is ready for submission.
This patch was reworked to only include the jammer code if the parameter TCM_QLA2XXX_DEBUG=Y is set. The default is to not provide this functionality at all.
I looked at using attributes but this code is in the fastpath and the overhead or fetching the attribute each time is not a good idea.
Control of this needs to be dynamic and the module parameter allows a simple compare in the fastpath.
Patch notes
------------
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior in the Emulex, Qlogic and other F/C drivers.
Works by checking new parameter jam_host if its >= 0 and matches vha->host_no , jamming is enabled when jam_host >=0 If parameter set to -1 (default) no jamming is enabled.
Tested by: Laurence Oberman <[email protected]>
Documentation/scsi/tcm_qla2xxx.txt +34 -0
@@ -0,0 +1,34 @@ +tcm_qla2xxx jammer parameter usage +---------------------------------- +There is now a new module parameter added to the tcm_qla2xx module +parm: jam_host:Host to jam >=0 Enable jammer (int) +This parameter and accompanying code is only included if the +Kconfig parameter TCM_QLA2XXX_DEBUG is set to Y +By default this jammer code and functionality is disabled + +Use this parameter to control the discarding of SCSI commands to a selected +host. +This may be useful for testing error handling and simulating slow drain +and other fabric issues. + +Any value >=0 that matches a fc_host # will discard the commands for that host. +Reset back to -1 to stop the jamming. + +Enable host 6 to be jammed +echo 6 > /sys/module/tcm_qla2xxx/parameters/jam_host + +Disable jamming on host 6 +echo -1 > /sys/module/tcm_qla2xxx/parameters/jam_host + +Usage example script: + +#!/bin/bash +sleep_time=120 ### Time to jam for +echo 6 > /sys/module/tcm_qla2xxx/parameters/jam_host +host=`cat /sys/module/tcm_qla2xxx/parameters/jam_host` +echo "We start to discard commands on SCSI host $host" +logger "Jammer started" +sleep $sleep_time +echo -1 > /sys/module/tcm_qla2xxx/parameters/jam_host +echo "We stopped the jammer" +logger "Jammer stopped"
drivers/scsi/qla2xxx/Kconfig +10 -0
@@ -36,3 +36,13 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series target mode HBAs" + depends on SCSI_QLA_FC && TARGET_CORE + depends on LIBFC + select BTREE + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+ series target mode HBAs + This will include code to enable the SCSI command jammer
drivers/scsi/qla2xxx/tcm_qla2xxx.c +16 -0
@@ -48,6 +48,12 @@#include "qla_target.h" #include "tcm_qla2xxx.h" +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +int jam_host =-1 ; +module_param (jam_host, int,0644 ); +MODULE_PARM_DESC (jam_host,"Host to jam >=0 Enable jammer" ); +#endif +static struct workqueue_struct *tcm_qla2xxx_free_wq;static struct workqueue_struct *tcm_qla2xxx_cmd_wq;
@@ -477,6 +483,13 @@ static int tcm_qla2xxx_handle_cmd(scsi_qreturn -EINVAL ; } +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +if (unlikely (vha->host_no == jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif + cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], cmd->unpacked_lun, data_length, fcp_task_attr,
@@ -1967,6 +1980,9 @@ static void tcm_qla2xxx_deregister_confistatic int __init tcm_qla2xxx_init (void ) {int ret; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + jam_host =-1 ; +#endif ret =tcm_qla2xxx_register_configfs ();if (ret <0 )
----- Original Message -----
From: "Laurence Oberman" <[email protected]>
To: "Himanshu Madhani" <[email protected]>
Cc: "Nicholas A. Bellinger" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Saturday, April 2, 2016 12:04:54 PM
Subject: Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision4
Hello Himanshu
This patch was reworked to only include the jammer code if the parameter TCM_QLA2XXX_DEBUG=Y is set. The default is to not provide this functionality at all.
I looked at using attributes but this code is in the fastpath and the overhead or fetching the attribute each time is not a good idea.
Control of this needs to be dynamic and the module parameter allows a simple compare in the fastpath.
Patch notes
------------
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior in the Emulex, Qlogic and other F/C drivers.
Works by checking new parameter jam_host if its >= 0 and matches vha->host_no , jamming is enabled when jam_host >=0 If parameter set to -1 (default) no jamming is enabled.
Tested by: Laurence Oberman <[email protected]>
Documentation/scsi/tcm_qla2xxx.txt +34 -0
@@ -0,0 +1,34 @@ +tcm_qla2xxx jammer parameter usage +---------------------------------- +There is now a new module parameter added to the tcm_qla2xx module +parm: jam_host:Host to jam >=0 Enable jammer (int) +This parameter and accompanying code is only included if the +Kconfig parameter TCM_QLA2XXX_DEBUG is set to Y +By default this jammer code and functionality is disabled + +Use this parameter to control the discarding of SCSI commands to a selected +host. +This may be useful for testing error handling and simulating slow drain +and other fabric issues. + +Any value >=0 that matches a fc_host # will discard the commands for that host. +Reset back to -1 to stop the jamming. + +Enable host 6 to be jammed +echo 6 > /sys/module/tcm_qla2xxx/parameters/jam_host + +Disable jamming on host 6 +echo -1 > /sys/module/tcm_qla2xxx/parameters/jam_host + +Usage example script: + +#!/bin/bash +sleep_time=120 ### Time to jam for +echo 6 > /sys/module/tcm_qla2xxx/parameters/jam_host +host=`cat /sys/module/tcm_qla2xxx/parameters/jam_host` +echo "We start to discard commands on SCSI host $host" +logger "Jammer started" +sleep $sleep_time +echo -1 > /sys/module/tcm_qla2xxx/parameters/jam_host +echo "We stopped the jammer" +logger "Jammer stopped"
drivers/scsi/qla2xxx/Kconfig +10 -0
@@ -36,3 +36,13 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series target mode HBAs" + depends on SCSI_QLA_FC && TARGET_CORE + depends on LIBFC + select BTREE + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+ series target mode HBAs + This will include code to enable the SCSI command jammer
drivers/scsi/qla2xxx/tcm_qla2xxx.c +16 -0
@@ -48,6 +48,12 @@#include "qla_target.h" #include "tcm_qla2xxx.h" +#ifdef TCM_QLA2XXX_DEBUG +int jam_host =-1 ; +module_param (jam_host, int,0644 ); +MODULE_PARM_DESC (jam_host,"Host to jam >=0 Enable jammer" ); +#endif +static struct workqueue_struct *tcm_qla2xxx_free_wq;static struct workqueue_struct *tcm_qla2xxx_cmd_wq;
@@ -477,6 +483,13 @@ static int tcm_qla2xxx_handle_cmd(scsi_qreturn -EINVAL ; } +#ifdef TCM_QLA2XXX_DEBUG +if (unlikely (vha->host_no == jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif + cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], cmd->unpacked_lun, data_length, fcp_task_attr,
@@ -1967,6 +1980,9 @@ static void tcm_qla2xxx_deregister_confistatic int __init tcm_qla2xxx_init (void ) {int ret; +#ifdef TCM_QLA2XXX_DEBUG + jam_host =-1 ; +#endif ret =tcm_qla2xxx_register_configfs ();if (ret <0 )
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services
----- Original Message -----
From: "Laurence Oberman" <[email protected]>
To: "Himanshu Madhani" <[email protected]>
Cc: "Nicholas A. Bellinger" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Friday, April 1, 2016 2:15:25 PM
Subject: Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision3
Himanshu
I looked at using the attribute for this but because of where I have to discard the command I dont want to have to go fetch the attribute each time in the same code path. Its significant overhead to have to go fetch the attribute value each time as I allow for a dynamic on off via the module parameter so I have to check it each command. With the module parameter its a simple compare and by having this as a module parameter its globally accessible and imposes virtually no overhead.
Are you OK with me using #ifdef on the CONFIG_TCM_QLA2XXX_DEBUG .config parameter I will add here to include the module parameter and code only if set to "yes" The default unless expicitly set will be no change.
Thanks
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services
----- Original Message -----
From: "Himanshu Madhani" <[email protected]>
To: "Nicholas A. Bellinger" <[email protected]>, "Bart Van Assche" <[email protected]>
Cc: "Laurence Oberman" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Thursday, March 31, 2016 8:20:56 PM
Subject: Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision3
Hi Nic, Laurence,
Quoted 32 lines · Nicholas A. Bellinger
(Adding target-devel + Qlogic target folks)
Quoted 19 lines · Bart Van Assche
Quoted 9 lines · Laurence Oberman
I have been using this jammer functionality to continue testing the SCSI F/C drivers and recovery for over a year now. Any chance you would agree to ack this so I can get it in now.
I last posted to the list last March and it was not picked up.I did look into moving this to upper layers but I find I use it primarily for fiber channel target testing. Attempting to add this functionality to upper layers led to complexities and this is very solid.
This Patch diff against 4.5
Quoted 8 lines
I use target LIO for all my storage array test targets and customer problem resolution here at Red Hat. This patch resulted from a requirement to mimic behavior of an expensive hardware jammer for a customer. I have used this for some time with good success to simulate and reproduce latency and slow drain fabric issues and for testing and validating error handling behavior
in the Emulex, Qlogic and other F/C drivers.Works by checking new parameter
jam_hostif its >= 0 and matchesvha->host_no, jamming is enabled whenjam_host>=0 If parameter set to -1 (default) no jamming is enabled.Quoted 9 lines
Hello Laurence,
Nic Bellinger is the maintainer of LIO so my recommendation is to ask Nic first about his opinion (I have CC'd Nic). I'm not sure what Nic thinks about this but in my opinion such functionality belongs in the target core instead of in a target driver. But please wait until Nic has provided his opinion before spending more time on this. The mailing list for SCSI target patches is [email protected].
Quoted 8 lines
So really it's Himanshu's + Quinn's call if they would like to include something like this in mainline.
If so, then I'd prefer to do it with a per
tcm_qla2xxx_tpgendpoint attribute instead a new module parameter, and add a new kernel config option (CONFIG_TCM_QLA2XXX_DEBUG) to disable (by default) so end users don't inadvertently play with it via targetcli + friends.
I agree here with Nic. The patch does provides benefit and is good addition, but we don’t want to enable it by default.
Laurence,
Would you be kind to rework patch with suggested changes from Nic and post it.
Thanks,
Himanshu N�����r��y���b�X��ǧv�^�){.n�+����{���"�{ay�ʇڙ�,j��f���h���z��w������j:+v���w�j�m��������zZ+��ݢj"�� --
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
--
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
Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision4
Hi Laurence,
Quoted 8 lines · Laurence Oberman
Hello Himanshu
I noticed a typo in the patch I submitted here is the corrected patch. Please ignore the prior patch
I was missing the full CONFIG name in the #ifdef check
Corrected Patch
Two quick process related comments:
Please avoid top-posting responses, as it makes the thread more difficult for others to follow.
Also, please send out kernel patches for list review using git-format-patch + git-send-email tools, instead of responding with new versions in the original email thread.
Quoted 4 lines
[root@localhost home]#
linux-4.5/scripts/checkpatch.pljammer_patch.v4
total: 0 errors, 0 warnings, 81 lines checked
Quoted 9 lines
jammer_patch.v4 has no obvious style problems and is ready for submission.
This patch was reworked to only include the jammer code if the parameter TCM_QLA2XXX_DEBUG=Y is set. The default is to not provide this functionality at all.
I looked at using attributes but this code is in the fastpath and the overhead or fetching the attribute each time is not a good idea.
Control of this needs to be dynamic and the module parameter allows a simple compare in the fastpath.
I don't see how a per tcm_qla2xxx (scsi_qla_host) TPG endpoint attribute has any noticeable performance impact with TCM_QLA2XXX_DEBUG=y vs. a global module parameter doing scsi_qla_host->host_no comparison.
Eg, have you tried something like the following..?
drivers/scsi/qla2xxx/tcm_qla2xxx.c +18 -0
@@ -477,6 +477,17 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_creturn -EINVAL ; } +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + { +struct se_portal_group *se_tpg = se_sess->se_tpg; +struct tcm_qla2xxx_tpg *tpg =container_of (se_tpg, + struct tcm_qla2xxx_tpg, se_tpg); + +if (tpg->tpg_attrib.jam_host) +return 0 ; + + } +#endif cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], cmd->unpacked_lun, data_length, fcp_task_attr,
@@ -845,12 +856,19 @@ DEF_QLA_TPG_ATTRIB(demo_mode_write_protect);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); +#endif +static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls, &tcm_qla2xxx_tpg_attrib_attr_cache_dynamic_acls, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endifNULL , };
drivers/scsi/qla2xxx/tcm_qla2xxx.h +1 -0
@@ -34,6 +34,7 @@ struct tcm_qla2xxx_tpg_attrib {int prod_mode_write_protect;int demo_mode_login_only;int fabric_prot_type; +int jam_host; };struct tcm_qla2xxx_tpg {
PATCH 1/1 tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module
Hi Nicholas
Apologies for the top posting, that was in my haste to correct the prior patch that had the typo.
When I investigated the attributes it looked like I would have had to create a store and a check function and call the check function each time. That was my lack of understanding of the functionality.
I also looked at your example and in my case I needed a way to set the attribute to a number matching the host#. When I tested this I was only able to set boolean values of 1 or 0 for the attributes and the definition of tcm_qla2xxx_tpg_attrib_##name##_store validates that only booleans of 1 or 0 are supported.
However after your email I then realized using a boolean on the endpoints below will work here. Thank you for taking the time to show me, it was very helpful.
sys]# find . -name jam_host ./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host ./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:af/tpgt_1/attrib/jam_host
I tested this and here are the patches in the format you require. Hopefully this new functionality will be useful for others. I am not set for emailing directly from git.
Tested by: Laurence Oberman <[email protected]>
--- drivers/scsi/qla2xxx/Kconfig | 11 +++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 3 files changed, 32 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/Kconfig +11 -0
@@ -36,3 +36,14 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series target mode HBAs" + depends on SCSI_QLA_FC && TARGET_CORE + depends on LIBFC + select BTREE + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+ series target mode HBAs + This will include code to enable the SCSI command jammer +
drivers/scsi/qla2xxx/tcm_qla2xxx.c +20 -0
@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif int flags =TARGET_SCF_ACK_KREF ;if (bidi)
@@ -476,6 +480,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,pr_err ("Unable to locate active struct se_session\n" );return -EINVAL ; } + +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg,struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],
@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,
@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };
@@ -1023,6 +1042,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.demo_mode_write_protect =1 ; tpg->tpg_attrib.cache_dynamic_acls =1 ; tpg->tpg_attrib.demo_mode_login_only =1 ; + tpg->tpg_attrib.jam_host =0 ; ret =core_tpg_register (wwn, &tpg->se_tpg,SCSI_PROTOCOL_FCP );if (ret <0 ) {
drivers/scsi/qla2xxx/tcm_qla2xxx.h +1 -0
@@ -34,6 +34,7 @@ struct tcm_qla2xxx_tpg_attrib {int prod_mode_write_protect;int demo_mode_login_only;int fabric_prot_type; +int jam_host; };struct tcm_qla2xxx_tpg {
Signature · 8 lines
1.7.1 Tested by: Laurence Oberman <[email protected]> Signed-off-by: Laurence Oberman <[email protected]> --- Documentation/scsi/tcm_qla2xxx.txt | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 Documentation/scsi/tcm_qla2xxx.txt
Documentation/scsi/tcm_qla2xxx.txt new file +22 -0
@@ -0,0 +1,22 @@ +tcm_qla2xxx jam_host attribute +------------------------------ +There is now a new module endpoint atribute called jam_host +attribute: jam_host: boolean=0/1 +This attribute and accompanying code is only included if the +Kconfig parameter TCM_QLA2XXX_DEBUG is set to Y +By default this jammer code and functionality is disabled + +Use this attribute to control the discarding of SCSI commands to a +selected host. +This may be useful for testing error handling and simulating slow drain +and other fabric issues. + +Setting a boolean of 1 for the jam_host attribute for a particular host + will discard the commands for that host. +Reset back to 0 to stop the jamming. + +Enable host 4 to be jammed +echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host + +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
Signature · 14 lines
1.7.1 Laurence Oberman Principal Software Maintenance Engineer Red Hat Global Support Services ----- Original Message ----- From: "Nicholas A. Bellinger" <[email protected]> To: "Laurence Oberman" <[email protected]> Cc: "Himanshu Madhani" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]> Sent: Saturday, April 2, 2016 7:39:35 PM Subject: Re: tcm_qla2xxx Add SCSI command jammer/discard capabilty to the tcm_qla2xxx module - revision4 Hi Laurence,
Quoted 8 lines · Laurence Oberman
Hello Himanshu
I noticed a typo in the patch I submitted here is the corrected patch. Please ignore the prior patch
I was missing the full CONFIG name in the #ifdef check
Corrected Patch
Two quick process related comments:
Please avoid top-posting responses, as it makes the thread more difficult for others to follow.
Also, please send out kernel patches for list review using git-format-patch + git-send-email tools, instead of responding with new versions in the original email thread.
Quoted 4 lines
[root@localhost home]#
linux-4.5/scripts/checkpatch.pljammer_patch.v4
total: 0 errors, 0 warnings, 81 lines checked
Quoted 9 lines
jammer_patch.v4 has no obvious style problems and is ready for submission.
This patch was reworked to only include the jammer code if the parameter TCM_QLA2XXX_DEBUG=Y is set. The default is to not provide this functionality at all.
I looked at using attributes but this code is in the fastpath and the overhead or fetching the attribute each time is not a good idea.
Control of this needs to be dynamic and the module parameter allows a simple compare in the fastpath.
I don't see how a per tcm_qla2xxx (scsi_qla_host) TPG endpoint attribute has any noticeable performance impact with TCM_QLA2XXX_DEBUG=y vs. a global module parameter doing scsi_qla_host->host_no comparison.
Eg, have you tried something like the following..?
drivers/scsi/qla2xxx/tcm_qla2xxx.c +18 -0
@@ -477,6 +477,17 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_creturn -EINVAL ; } +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + { +struct se_portal_group *se_tpg = se_sess->se_tpg; +struct tcm_qla2xxx_tpg *tpg =container_of (se_tpg, + struct tcm_qla2xxx_tpg, se_tpg); + +if (tpg->tpg_attrib.jam_host) +return 0 ; + + } +#endif cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], cmd->unpacked_lun, data_length, fcp_task_attr,
@@ -845,12 +856,19 @@ DEF_QLA_TPG_ATTRIB(demo_mode_write_protect);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); +#endif +static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls, &tcm_qla2xxx_tpg_attrib_attr_cache_dynamic_acls, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endifNULL , };
drivers/scsi/qla2xxx/tcm_qla2xxx.h +1 -0
@@ -34,6 +34,7 @@ struct tcm_qla2xxx_tpg_attrib {int prod_mode_write_protect;int demo_mode_login_only;int fabric_prot_type; +int jam_host; };struct tcm_qla2xxx_tpg {
--
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
Re: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module
Quoted 38 lines · Laurence Oberman
Hi Nicholas
Apologies for the top posting, that was in my haste to correct the prior patch that had the typo.
When I investigated the attributes it looked like I would have had to create a store and a check function and call the check function each time. That was my lack of understanding of the functionality.I also looked at your example and in my case I needed a way to set the attribute to a number matching the host#. When I tested this I was only able to set boolean values of 1 or 0 for the attributes and the definition of tcm_qla2xxx_tpg_attrib_##name##_store validates that only booleans of 1 or 0 are supported.
However after your email I then realized using a boolean on the endpoints below will work here. Thank you for taking the time to show me, it was very helpful.
sys]# find . -name
jam_host./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host ./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:af/tpgt_1/attrib/jam_hostI tested this and here are the patches in the format you require. Hopefully this new functionality will be useful for others. I am not set for emailing directly from git.
Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>--- drivers/scsi/qla2xxx/Kconfig | 11 +++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 3 files changed, 32 insertions(+), 0 deletions(-)drivers/scsi/qla2xxx/Kconfig +1
-0@@ -36,3 +36,14 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs +
drivers/scsi/qla2xxx/Kconfig config TCM_QLA2XXX · line 49
Quoted 10 lines
drivers/scsi/qla2xxx/Kconfig +10
-0+config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series target mode HBAs" + depends on SCSI_QLA_FC && TARGET_CORE + depends on LIBFC + select BTREE + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+ series target mode HBAs + This will include code to enable the SCSI command jammer +
Instead of duplicating the 'depends' here for TCM_QLA2XXX, just do a:
if TCM_QLA2XXX
config TCM_QLA2XXX_DEBUG
...
...
endif
drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, · line 463
Quoted 12 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +4
-0@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif
Whitespace instead of TAB here.
Quoted 6 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0int flags =TARGET_SCF_ACK_KREF ;if (bidi)@@ -476,6 +480,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,pr_err ("Unable to locate active struct se_session\n" );return -EINVAL ;
drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, · line 491
Quoted 10 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +9
-0} + +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg,struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif
Whitespace instead of TABs here too.
Quoted 14 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,
drivers/scsi/qla2xxx/tcm_qla2xxx.c static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { · line 874
Quoted 8 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };
Whitespace instead of TABs here too.
Re: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module
Hello Nicholas
Its fixed now.
Many Thanks.
$ scripts/checkpatch.pl 0001-tcm_qla2xxx-Add-SCSI-command-jammer-discard-capabili.patch WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #12: new file mode 100644
total: 0 errors, 1 warnings, 91 lines checked
0001-tcm_qla2xxx-Add-SCSI-command-jammer-discard-capabili.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Tested by: Laurence Oberman <[email protected]>
--- Documentation/scsi/tcm_qla2xxx.txt | 22 ++++++++++++++++++++++ drivers/scsi/qla2xxx/Kconfig | 9 +++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 4 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 Documentation/scsi/tcm_qla2xxx.txt
Documentation/scsi/tcm_qla2xxx.txt new file +22 -0
@@ -0,0 +1,22 @@ +tcm_qla2xxx jam_host attribute +------------------------------ +There is now a new module endpoint atribute called jam_host +attribute: jam_host: boolean=0/1 +This attribute and accompanying code is only included if the +Kconfig parameter TCM_QLA2XXX_DEBUG is set to Y +By default this jammer code and functionality is disabled + +Use this attribute to control the discarding of SCSI commands to a +selected host. +This may be useful for testing error handling and simulating slow drain +and other fabric issues. + +Setting a boolean of 1 for the jam_host attribute for a particular host + will discard the commands for that host. +Reset back to 0 to stop the jamming. + +Enable host 4 to be jammed +echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host + +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
drivers/scsi/qla2xxx/Kconfig +9 -0
@@ -36,3 +36,12 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +if TCM_QLA2XXX +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series target mode HBAs" + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+ series target mode HBAs + This will include code to enable the SCSI command jammer +endif
drivers/scsi/qla2xxx/tcm_qla2xxx.c +20 -0
@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif int flags =TARGET_SCF_ACK_KREF ;if (bidi)
@@ -477,6 +481,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,return -EINVAL ; } +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif + cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], cmd->unpacked_lun, data_length, fcp_task_attr,
@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,
@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };
@@ -1023,6 +1042,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.demo_mode_write_protect =1 ; tpg->tpg_attrib.cache_dynamic_acls =1 ; tpg->tpg_attrib.demo_mode_login_only =1 ; + tpg->tpg_attrib.jam_host =0 ; ret =core_tpg_register (wwn, &tpg->se_tpg,SCSI_PROTOCOL_FCP );if (ret <0 ) {
drivers/scsi/qla2xxx/tcm_qla2xxx.h +1 -0
@@ -34,6 +34,7 @@ struct tcm_qla2xxx_tpg_attrib {int prod_mode_write_protect;int demo_mode_login_only;int fabric_prot_type; +int jam_host; };struct tcm_qla2xxx_tpg {
Signature · 13 lines
1.7.1 Laurence Oberman Principal Software Maintenance Engineer Red Hat Global Support Services ----- Original Message ----- From: "Nicholas A. Bellinger" <[email protected]> To: "Laurence Oberman" <[email protected]> Cc: "Himanshu Madhani" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]> Sent: Monday, April 4, 2016 4:54:11 PM Subject: Re: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module
Quoted 38 lines · Laurence Oberman
Hi Nicholas
Apologies for the top posting, that was in my haste to correct the prior patch that had the typo.
When I investigated the attributes it looked like I would have had to create a store and a check function and call the check function each time. That was my lack of understanding of the functionality.I also looked at your example and in my case I needed a way to set the attribute to a number matching the host#. When I tested this I was only able to set boolean values of 1 or 0 for the attributes and the definition of tcm_qla2xxx_tpg_attrib_##name##_store validates that only booleans of 1 or 0 are supported.
However after your email I then realized using a boolean on the endpoints below will work here. Thank you for taking the time to show me, it was very helpful.
sys]# find . -name
jam_host./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host ./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:af/tpgt_1/attrib/jam_hostI tested this and here are the patches in the format you require. Hopefully this new functionality will be useful for others. I am not set for emailing directly from git.
Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>--- drivers/scsi/qla2xxx/Kconfig | 11 +++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 3 files changed, 32 insertions(+), 0 deletions(-)drivers/scsi/qla2xxx/Kconfig +1
-0@@ -36,3 +36,14 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs +
drivers/scsi/qla2xxx/Kconfig config TCM_QLA2XXX · line 49
Quoted 10 lines
drivers/scsi/qla2xxx/Kconfig +10
-0+config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series target mode HBAs" + depends on SCSI_QLA_FC && TARGET_CORE + depends on LIBFC + select BTREE + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+ series target mode HBAs + This will include code to enable the SCSI command jammer +
Instead of duplicating the 'depends' here for TCM_QLA2XXX, just do a:
if TCM_QLA2XXX
config TCM_QLA2XXX_DEBUG
...
...
endif
drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, · line 463
Quoted 12 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +4
-0@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif
Whitespace instead of TAB here.
Quoted 6 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0int flags =TARGET_SCF_ACK_KREF ;if (bidi)@@ -476,6 +480,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,pr_err ("Unable to locate active struct se_session\n" );return -EINVAL ;
drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, · line 491
Quoted 10 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +9
-0} + +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg,struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif
Whitespace instead of TABs here too.
Quoted 14 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,
drivers/scsi/qla2xxx/tcm_qla2xxx.c static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { · line 874
Quoted 8 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };
Whitespace instead of TABs here too.
Re: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module
----- Original Message -----
Quoted 317 lines
From: "Laurence Oberman" <[email protected]>
To: "Nicholas A. Bellinger" <[email protected]>
Cc: "Himanshu Madhani" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Monday, April 4, 2016 6:50:03 PM
Subject: Re: [PATCH]tcm_qla2xxxAdd SCSI command jammer/discard capability to thetcm_qla2xxxmoduleHello Nicholas
Its fixed now.
Many Thanks.$ scripts/checkpatch.pl 0001-tcm_qla2xxx-Add-SCSI-command-jammer-discard-capabili.patch WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #12: new file mode 100644total: 0 errors, 1 warnings, 91 lines checked
0001-tcm_qla2xxx-Add-SCSI-command-jammer-discard-capabili.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>--- Documentation/scsi/tcm_qla2xxx.txt | 22 ++++++++++++++++++++++ drivers/scsi/qla2xxx/Kconfig | 9 +++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 4 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 Documentation/scsi/tcm_qla2xxx.txtDocumentation/scsi/tcm_qla2xxx.txt new file +19
-0@@ -0,0 +1,22 @@ +tcm_qla2xxx jam_host attribute +------------------------------ +There is now a new module endpoint atribute called jam_host +attribute: jam_host: boolean=0/1 +This attribute and accompanying code is only included if the +Kconfig parameter TCM_QLA2XXX_DEBUG is set to Y +By default this jammer code and functionality is disabled + +Use this attribute to control the discarding of SCSI commands to a +selected host. +This may be useful for testing error handling and simulating slow drain +and other fabric issues. + +Setting a boolean of 1 for the jam_host attribute for a particular host + will discard the commands for that host. +Reset back to 0 to stop the jamming. + +Enable host 4 to be jammed +echo 1 >/sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host
Documentation/scsi/tcm_qla2xxx.txt new file +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
drivers/scsi/qla2xxx/Kconfig +4
-0@@ -36,3 +36,12 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +if TCM_QLA2XXX +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series targetmode HBAs"
drivers/scsi/qla2xxx/Kconfig +3
-0+ default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+series target mode HBAs
drivers/scsi/qla2xxx/Kconfig +2
-0+ This will include code to enable the SCSI command jammer +endifdrivers/scsi/qla2xxx/tcm_qla2xxx.c +4
-0@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha,struct qla_tgt_cmd *cmd, struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif int flags =TARGET_SCF_ACK_KREF ;drivers/scsi/qla2xxx/tcm_qla2xxx.c +9
-0if (bidi)@@ -477,6 +481,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha,struct qla_tgt_cmd *cmd, return -EINVAL; } +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif + cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],drivers/scsi/qla2xxx/tcm_qla2xxx.c +7
-0cmd->unpacked_lun, data_length, fcp_task_attr,@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };@@ -1023,6 +1042,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.demo_mode_write_protect =1 ; tpg->tpg_attrib.cache_dynamic_acls =1 ; tpg->tpg_attrib.demo_mode_login_only =1 ; + tpg->tpg_attrib.jam_host =0 ; ret =core_tpg_register (wwn, &tpg->se_tpg,SCSI_PROTOCOL_FCP );if (ret <0 ) {drivers/scsi/qla2xxx/tcm_qla2xxx.h +1
-1@@ -34,6 +34,7 @@ struct tcm_qla2xxx_tpg_attrib {int prod_mode_write_protect;int demo_mode_login_only;int fabric_prot_type; +int jam_host; };struct tcm_qla2xxx_tpg { --1.7.1
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services----- Original Message -----
From: "Nicholas A. Bellinger" <[email protected]>
To: "Laurence Oberman" <[email protected]>
Cc: "Himanshu Madhani" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Monday, April 4, 2016 4:54:11 PM
Subject: Re: [PATCH]tcm_qla2xxxAdd SCSI command jammer/discard capability to thetcm_qla2xxxmoduleQuoted 55 lines · Laurence Oberman
Hi Nicholas
Apologies for the top posting, that was in my haste to correct the prior patch that had the typo.
When I investigated the attributes it looked like I would have had to create a store and a check function and call the check function each time. That was my lack of understanding of the functionality.I also looked at your example and in my case I needed a way to set the attribute to a number matching the host#.
When I tested this I was only able to set boolean values of 1 or 0 for the attributes and the definition of tcm_qla2xxx_tpg_attrib_##name##_store validates that only booleans of 1 or 0 are supported.However after your email I then realized using a boolean on the endpoints below will work here.
Thank you for taking the time to show me, it was very helpful.sys]# find . -name
jam_host./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host ./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:af/tpgt_1/attrib/jam_hostI tested this and here are the patches in the format you require. Hopefully this new functionality will be useful for others. I am not set for emailing directly from git.
Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>--- drivers/scsi/qla2xxx/Kconfig | 11 +++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 3 files changed, 32 insertions(+), 0 deletions(-)drivers/scsi/qla2xxx/Kconfig +3
-0@@ -36,3 +36,14 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series targetmode HBAs"
drivers/scsi/qla2xxx/Kconfig +6
-0+ depends on SCSI_QLA_FC && TARGET_CORE + depends on LIBFC + select BTREE + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+series target mode HBAs
drivers/scsi/qla2xxx/Kconfig
Quoted 2 lines
drivers/scsi/qla2xxx/Kconfig +2
-0+ This will include code to enable the SCSI command jammer +Instead of duplicating the 'depends' here for
TCM_QLA2XXX, just do a:if
TCM_QLA2XXXconfig
TCM_QLA2XXX_DEBUG
...
...endif
Quoted 6 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t · line 464
Quoted 8 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +4
-0@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif Whitespace instead of TAB here.
Quoted 7 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0int flags =TARGET_SCF_ACK_KREF ;drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0if (bidi)@@ -476,6 +480,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,pr_err ("Unable to locate active struct se_session\n" );return -EINVAL ;drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t · line 492
Quoted 10 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +9
-0} + +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg,struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif Whitespace instead of TABs here too.
Quoted 14 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,drivers/scsi/qla2xxx/tcm_qla2xxx.c static struct configfs_attribute · line 875
Quoted 9 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };Whitespace instead of TABs here too.
Quoted 9 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
--
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
Hello Himanshu, Quinn
Is this patch good now to be taken.
Thanks
Laurence
Himanshu Madhani
Acked-byRe: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module
Quoted 330 lines · Laurence Oberman
----- Original Message -----
Quoted 317 lines
From: "Laurence Oberman" <[email protected]>
To: "Nicholas A. Bellinger" <[email protected]>
Cc: "Himanshu Madhani" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Monday, April 4, 2016 6:50:03 PM
Subject: Re: [PATCH]tcm_qla2xxxAdd SCSI command jammer/discard capability to thetcm_qla2xxxmoduleHello Nicholas
Its fixed now.
Many Thanks.$ scripts/checkpatch.pl 0001-tcm_qla2xxx-Add-SCSI-command-jammer-discard-capabili.patch WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #12: new file mode 100644total: 0 errors, 1 warnings, 91 lines checked
0001-tcm_qla2xxx-Add-SCSI-command-jammer-discard-capabili.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>--- Documentation/scsi/tcm_qla2xxx.txt | 22 ++++++++++++++++++++++ drivers/scsi/qla2xxx/Kconfig | 9 +++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 4 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 Documentation/scsi/tcm_qla2xxx.txtDocumentation/scsi/tcm_qla2xxx.txt new file +19
-0@@ -0,0 +1,22 @@ +tcm_qla2xxx jam_host attribute +------------------------------ +There is now a new module endpoint atribute called jam_host +attribute: jam_host: boolean=0/1 +This attribute and accompanying code is only included if the +Kconfig parameter TCM_QLA2XXX_DEBUG is set to Y +By default this jammer code and functionality is disabled + +Use this attribute to control the discarding of SCSI commands to a +selected host. +This may be useful for testing error handling and simulating slow drain +and other fabric issues. + +Setting a boolean of 1 for the jam_host attribute for a particular host + will discard the commands for that host. +Reset back to 0 to stop the jamming. + +Enable host 4 to be jammed +echo 1 >/sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host
Documentation/scsi/tcm_qla2xxx.txt new file +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
drivers/scsi/qla2xxx/Kconfig +4
-0@@ -36,3 +36,12 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +if TCM_QLA2XXX +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series targetmode HBAs"
drivers/scsi/qla2xxx/Kconfig +3
-0+ default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+series target mode HBAs
drivers/scsi/qla2xxx/Kconfig +2
-0+ This will include code to enable the SCSI command jammer +endifdrivers/scsi/qla2xxx/tcm_qla2xxx.c +4
-0@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha,struct qla_tgt_cmd *cmd, struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif int flags =TARGET_SCF_ACK_KREF ;drivers/scsi/qla2xxx/tcm_qla2xxx.c +9
-0if (bidi)@@ -477,6 +481,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha,struct qla_tgt_cmd *cmd, return -EINVAL; } +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif + cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],drivers/scsi/qla2xxx/tcm_qla2xxx.c +7
-0cmd->unpacked_lun, data_length, fcp_task_attr,@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };@@ -1023,6 +1042,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.demo_mode_write_protect =1 ; tpg->tpg_attrib.cache_dynamic_acls =1 ; tpg->tpg_attrib.demo_mode_login_only =1 ; + tpg->tpg_attrib.jam_host =0 ; ret =core_tpg_register (wwn, &tpg->se_tpg,SCSI_PROTOCOL_FCP );if (ret <0 ) {drivers/scsi/qla2xxx/tcm_qla2xxx.h +1
-1@@ -34,6 +34,7 @@ struct tcm_qla2xxx_tpg_attrib {int prod_mode_write_protect;int demo_mode_login_only;int fabric_prot_type; +int jam_host; };struct tcm_qla2xxx_tpg { --1.7.1
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services----- Original Message -----
From: "Nicholas A. Bellinger" <[email protected]>
To: "Laurence Oberman" <[email protected]>
Cc: "Himanshu Madhani" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Monday, April 4, 2016 4:54:11 PM
Subject: Re: [PATCH]tcm_qla2xxxAdd SCSI command jammer/discard capability to thetcm_qla2xxxmoduleQuoted 55 lines · Laurence Oberman
Hi Nicholas
Apologies for the top posting, that was in my haste to correct the prior patch that had the typo.
When I investigated the attributes it looked like I would have had to create a store and a check function and call the check function each time. That was my lack of understanding of the functionality.I also looked at your example and in my case I needed a way to set the attribute to a number matching the host#.
When I tested this I was only able to set boolean values of 1 or 0 for the attributes and the definition of tcm_qla2xxx_tpg_attrib_##name##_store validates that only booleans of 1 or 0 are supported.However after your email I then realized using a boolean on the endpoints below will work here.
Thank you for taking the time to show me, it was very helpful.sys]# find . -name
jam_host./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host ./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:af/tpgt_1/attrib/jam_hostI tested this and here are the patches in the format you require. Hopefully this new functionality will be useful for others. I am not set for emailing directly from git.
Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>--- drivers/scsi/qla2xxx/Kconfig | 11 +++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 3 files changed, 32 insertions(+), 0 deletions(-)drivers/scsi/qla2xxx/Kconfig +3
-0@@ -36,3 +36,14 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ series targetmode HBAs"
drivers/scsi/qla2xxx/Kconfig +6
-0+ depends on SCSI_QLA_FC && TARGET_CORE + depends on LIBFC + select BTREE + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic 24xx+series target mode HBAs
drivers/scsi/qla2xxx/Kconfig
Quoted 2 lines
drivers/scsi/qla2xxx/Kconfig +2
-0+ This will include code to enable the SCSI command jammer +Instead of duplicating the 'depends' here for
TCM_QLA2XXX, just do a:if
TCM_QLA2XXXconfig
TCM_QLA2XXX_DEBUG
...
...endif
Quoted 6 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t · line 464
Quoted 8 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +4
-0@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif Whitespace instead of TAB here.
Quoted 7 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0int flags =TARGET_SCF_ACK_KREF ;drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0if (bidi)@@ -476,6 +480,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,pr_err ("Unable to locate active struct se_session\n" );return -EINVAL ;drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t · line 492
Quoted 10 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +9
-0} + +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg,struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif Whitespace instead of TABs here too.
Quoted 14 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,drivers/scsi/qla2xxx/tcm_qla2xxx.c static struct configfs_attribute · line 875
Quoted 9 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };Whitespace instead of TABs here too.
Quoted 9 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
--
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
Quoted 7 lines
Hello Himanshu, Quinn
Is this patch good now to be taken.
Thanks
Laurence
Looks Good.
Quoted 1 line
Re: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module
----- Original Message -----
Quoted 364 lines
From: "Himanshu Madhani" <[email protected]>
To: "Laurence Oberman" <[email protected]>, "Nicholas A. Bellinger" <[email protected]>
Cc: "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Monday, May 9, 2016 1:08:36 PM
Subject: Re: [PATCH]tcm_qla2xxxAdd SCSI command jammer/discard capability to thetcm_qla2xxxmoduleQuoted 345 lines · Laurence Oberman
----- Original Message -----
Quoted 332 lines
From: "Laurence Oberman" <[email protected]>
To: "Nicholas A. Bellinger" <[email protected]>
Cc: "Himanshu Madhani" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Monday, April 4, 2016 6:50:03 PM
Subject: Re: [PATCH]tcm_qla2xxxAdd SCSI command jammer/discard capability to thetcm_qla2xxxmoduleHello Nicholas
Its fixed now.
Many Thanks.$ scripts/checkpatch.pl 0001-tcm_qla2xxx-Add-SCSI-command-jammer-discard-capabili.patch WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #12: new file mode 100644total: 0 errors, 1 warnings, 91 lines checked
0001-tcm_qla2xxx-Add-SCSI-command-jammer-discard-capabili.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>--- Documentation/scsi/tcm_qla2xxx.txt | 22 ++++++++++++++++++++++ drivers/scsi/qla2xxx/Kconfig | 9 +++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 4 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 Documentation/scsi/tcm_qla2xxx.txtDocumentation/scsi/tcm_qla2xxx.txt new file +19
-0@@ -0,0 +1,22 @@ +tcm_qla2xxx jam_host attribute +------------------------------ +There is now a new module endpoint atribute called jam_host +attribute: jam_host: boolean=0/1 +This attribute and accompanying code is only included if the +Kconfig parameter TCM_QLA2XXX_DEBUG is set to Y +By default this jammer code and functionality is disabled + +Use this attribute to control the discarding of SCSI commands to a +selected host. +This may be useful for testing error handling and simulating slow drain +and other fabric issues. + +Setting a boolean of 1 for the jam_host attribute for a particular host + will discard the commands for that host. +Reset back to 0 to stop the jamming. + +Enable host 4 to be jammed +echo 1 >/sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host
Documentation/scsi/tcm_qla2xxx.txt new file +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
drivers/scsi/qla2xxx/Kconfig +4
-0@@ -36,3 +36,12 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +if TCM_QLA2XXX +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ seriestarget
mode HBAs"drivers/scsi/qla2xxx/Kconfig +3
-0+ default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic24xx+
series target mode HBAsdrivers/scsi/qla2xxx/Kconfig +2
-0+ This will include code to enable the SCSI command jammer +endifdrivers/scsi/qla2xxx/tcm_qla2xxx.c +4
-0@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif int flags =TARGET_SCF_ACK_KREF ;drivers/scsi/qla2xxx/tcm_qla2xxx.c +9
-0if (bidi)@@ -477,6 +481,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, return -EINVAL ; } +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif + cmd->vha->tgt_counters.qla_core_sbt_cmd++;drivers/scsi/qla2xxx/tcm_qla2xxx.c +7
-0return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], cmd->unpacked_lun, data_length, fcp_task_attr,@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };@@ -1023,6 +1042,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.demo_mode_write_protect =1 ; tpg->tpg_attrib.cache_dynamic_acls =1 ; tpg->tpg_attrib.demo_mode_login_only =1 ; + tpg->tpg_attrib.jam_host =0 ; ret =core_tpg_register (wwn, &tpg->se_tpg,SCSI_PROTOCOL_FCP );if (ret <0 ) {drivers/scsi/qla2xxx/tcm_qla2xxx.h +1
-1@@ -34,6 +34,7 @@ struct tcm_qla2xxx_tpg_attrib {int prod_mode_write_protect;int demo_mode_login_only;int fabric_prot_type; +int jam_host; };struct tcm_qla2xxx_tpg { --1.7.1
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services----- Original Message -----
From: "Nicholas A. Bellinger" <[email protected]>
To: "Laurence Oberman" <[email protected]>
Cc: "Himanshu Madhani" <[email protected]>, "Bart Van Assche" <[email protected]>, "linux-scsi" <[email protected]>, "target-devel" <[email protected]>, "Quinn Tran" <[email protected]>
Sent: Monday, April 4, 2016 4:54:11 PM
Subject: Re: [PATCH]tcm_qla2xxxAdd SCSI command jammer/discard capability
to thetcm_qla2xxxmoduleQuoted 61 lines · Laurence Oberman
Hi Nicholas
Apologies for the top posting, that was in my haste to correct the prior patch that had the typo.
When I investigated the attributes it looked like I would have had to create a store and a check function and call the check function each time.
That was my lack of understanding of the functionality.I also looked at your example and in my case I needed a way to set the attribute to a number matching the host#.
When I tested this I was only able to set boolean values of 1 or 0 for the
attributes and the definition of tcm_qla2xxx_tpg_attrib_##name##_store validates that only booleans of 1 or
0 are supported.However after your email I then realized using a boolean on the endpoints
below will work here.
Thank you for taking the time to show me, it was very helpful.sys]# find . -name
jam_host./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host ./kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:af/tpgt_1/attrib/jam_hostI tested this and here are the patches in the format you require. Hopefully this new functionality will be useful for others. I am not set for emailing directly from git.
Tested by: Laurence Oberman <[email protected]>
Signed-off-by Laurence Oberman <[email protected]>--- drivers/scsi/qla2xxx/Kconfig | 11 +++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++++++++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 3 files changed, 32 insertions(+), 0 deletions(-)drivers/scsi/qla2xxx/Kconfig +3
-0@@ -36,3 +36,14 @@ config TCM_QLA2XXX default n ---help--- Say Y here to enable the TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs + +config TCM_QLA2XXX_DEBUG + bool "TCM_QLA2XXX fabric module DEBUG mode for QLogic 24xx+ seriestarget
mode HBAs"drivers/scsi/qla2xxx/Kconfig +6
-0+ depends on SCSI_QLA_FC && TARGET_CORE + depends on LIBFC + select BTREE + default n + ---help--- + Say Y here to enable the TCM_QLA2XXX fabric module DEBUG for QLogic24xx+
series target mode HBAsdrivers/scsi/qla2xxx/Kconfig
Quoted 2 lines
drivers/scsi/qla2xxx/Kconfig +2
-0+ This will include code to enable the SCSI command jammer +Instead of duplicating the 'depends' here for
TCM_QLA2XXX, just do a:if
TCM_QLA2XXXconfig
TCM_QLA2XXX_DEBUG
...
...endif
Quoted 6 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t · line 464
Quoted 8 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +4
-0@@ -457,6 +457,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, struct se_cmd *se_cmd = &cmd->se_cmd;struct se_session *se_sess;struct qla_tgt_sess *sess; +#ifdef CONFIG_TCM_QLA2XXX_DEBUG +struct se_portal_group *se_tpg; +struct tcm_qla2xxx_tpg *tpg; +#endif Whitespace instead of TAB here.
Quoted 7 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0int flags =TARGET_SCF_ACK_KREF ;drivers/scsi/qla2xxx/tcm_qla2xxx.c +0
-0if (bidi)@@ -476,6 +480,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,pr_err ("Unable to locate active struct se_session\n" );return -EINVAL ;drivers/scsi/qla2xxx/tcm_qla2xxx.c static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t · line 492
Quoted 10 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +9
-0} + +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + se_tpg = se_sess->se_tpg; + tpg = container_of(se_tpg,struct tcm_qla2xxx_tpg, se_tpg); +if (unlikely (tpg->tpg_attrib.jam_host)) { +/* return, and dont run target_submit_cmd,discarding command */ +return 0 ; + } +#endif Whitespace instead of TABs here too.
Quoted 14 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0cmd->vha->tgt_counters.qla_core_sbt_cmd++; return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],@@ -844,6 +857,9 @@ DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);DEF_QLA_TPG_ATTRIB (demo_mode_write_protect);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); +#endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,drivers/scsi/qla2xxx/tcm_qla2xxx.c static struct configfs_attribute · line 875
Quoted 9 lines
drivers/scsi/qla2xxx/tcm_qla2xxx.c +3
-0@@ -851,6 +867,9 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, +#ifdef CONFIG_TCM_QLA2XXX_DEBUG + &tcm_qla2xxx_tpg_attrib_attr_jam_host, +#endif NULL, };Whitespace instead of TABs here too.
Quoted 9 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
--
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.htmlQuoted 7 lines
Hello Himanshu, Quinn
Is this patch good now to be taken.
Thanks
Laurence
Quoted 6 lines
Looks Good.
Acked-by Himanshu Madhani <[email protected]>Quoted 1 line
N�����r��y���b�X��ǧv�^�){.n�+����{���"�{ay�ʇڙ�,j��f���h���z��w������j:+v���w�j�m��������zZ+��ݢj"��
Hi Nicholas,
Can we pull this one in for submission now that its been acked'd by Himanshu. Thanks
Laurence
--
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
Re: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module
Quoted 1 line · Laurence Oberman
<SNIP>
Quoted 5 lines
Hi Nicholas,
Can we pull this one in for submission now that its been acked'd by Himanshu. Thanks
Laurence
This patch has been queued in target-pending/for-next for the last weeks, and will be included in the v4.7-rc1 PULL request.