@@ -0,0 +1,34 @@
+qla2xxx target mode parameters
+------------------------------
+parm: qlini_mode:Determines when initiator mode will be enabled. Possible values: "exclusive" - initiator mode will be enabled on load, disabled on enabling target mode and then on disabling target mode enabled back; "disabled" - initiator mode will never be enabled; "enabled" (default) - initiator mode will always stay enabled. (charp)
+
+Enables qla2xxx target mode by setting to disabled on module load
+
+There is now a new module parameter added to the qla2xxx 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/qla2xxx/parameters/jam_host
+
+Disable jamming on host 6
+echo -1 > /sys/module/qla2xxx/parameters/jam_host
+
+Usage example script:
+
+#!/bin/bash
+sleep_time=120 ### Time to jam for
+echo 6 > /sys/module/qla2xxx/parameters/jam_host
+host=`cat /sys/module/qla2xxx/parameters/jam_host`
+echo "We start to discard commands on SCSI host $host"
+logger "Jammer started"
+sleep $sleep_time
+echo -1 > /sys/module/qla2xxx/parameters/jam_host
+echo "We stopped the jammer"
+logger "Jammer stopped"
@@ -59,6 +59,11 @@ MODULE_PARM_DESC(qlini_mode,
int ql2x_ini_mode = QLA2XXX_INI_MODE_EXCLUSIVE;
+int jam_host = -1;
+module_param(jam_host, int, 0644);
+MODULE_PARM_DESC(jam_host, "Host to jam >=0 Enable jammer");
+
+
static int temp_sam_status = SAM_STAT_BUSY;
/*
@@ -3264,6 +3269,11 @@ static void __qlt_do_work(struct qla_tgt
cmd->cmd_flags |= BIT_1;
if (tgt->tgt_stop)
goto out_term;
+ /*
+ * If jam_host >=0, goto out_term discarding command for matching host
+ */
+ if (unlikely(vha->host_no == jam_host))
+ goto out_term;
cdb = &atio->u.isp24.fcp_cmnd.cdb[0];
cmd->tag = atio->u.isp24.exchange_addr;