From patchwork Tue Aug 30 21:24:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurence Oberman X-Patchwork-Id: 9306105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C2EB60756 for ; Tue, 30 Aug 2016 21:24:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A37E28D7B for ; Tue, 30 Aug 2016 21:24:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EFE928D7E; Tue, 30 Aug 2016 21:24:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B540228D7B for ; Tue, 30 Aug 2016 21:24:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751729AbcH3VYZ (ORCPT ); Tue, 30 Aug 2016 17:24:25 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:54606 "EHLO mx3-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbcH3VYY (ORCPT ); Tue, 30 Aug 2016 17:24:24 -0400 Received: from zmail22.collab.prod.int.phx2.redhat.com (zmail22.collab.prod.int.phx2.redhat.com [10.5.83.26]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u7ULOJud010303; Tue, 30 Aug 2016 17:24:20 -0400 Date: Tue, 30 Aug 2016 17:24:19 -0400 (EDT) From: Laurence Oberman To: himanshu madhani , nab@linux-iscsi.org, Linux SCSI Mailinglist Message-ID: <2049960802.3555391.1472592259703.JavaMail.zimbra@redhat.com> In-Reply-To: <1282069955.3554059.1472591770771.JavaMail.zimbra@redhat.com> Subject: [PATCH] tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module - enhancements MIME-Version: 1.0 X-Originating-IP: [10.18.49.33] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF38 (Linux)/8.0.6_GA_5922) Thread-Topic: tcm_qla2xxx Add SCSI command jammer/discard capability to the tcm_qla2xxx module - enhancements Thread-Index: s0yPVgYopx8K8dVv3u8APJX7YxRokw== Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello Himanshu and Nicholas, Enhancements to the tcm_debug code. Added the possibility of blocking only specific SCSI data movement commands but allowing TUR'S to pass. This has been helpful for debugging many driver/array interoperabilty issues. Two Patches, The first is to the driver code, second is updating the documentation. Tested by: Laurence Oberman Signed-off-by: Laurence Oberman drivers/scsi/qla2xxx/tcm_qla2xxx.c | 7 +++++++ drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 6643f6f..d620a77 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -473,6 +473,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, /* return, and dont run target_submit_cmd,discarding command */ return 0; } + if (unlikely(tpg->tpg_attrib.jam_host && tpg->tpg_attrib.jam_data && (cdb[0]==0x08 || cdb[0]==0x0A || cdb[0]==0x28 || cdb[0]==0x2A))) { + /* return, and dont run target_submit_cmd,discarding command if not TUR*/ + return 0; + } #endif cmd->vha->tgt_counters.qla_core_sbt_cmd++; @@ -827,6 +831,7 @@ DEF_QLA_TPG_ATTRIB(prod_mode_write_protect); DEF_QLA_TPG_ATTRIB(demo_mode_login_only); #ifdef CONFIG_TCM_QLA2XXX_DEBUG DEF_QLA_TPG_ATTRIB(jam_host); +DEF_QLA_TPG_ATTRIB(jam_data); #endif static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { @@ -837,6 +842,7 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, #ifdef CONFIG_TCM_QLA2XXX_DEBUG &tcm_qla2xxx_tpg_attrib_attr_jam_host, + &tcm_qla2xxx_tpg_attrib_attr_jam_data, #endif NULL, }; @@ -1011,6 +1017,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg( tpg->tpg_attrib.cache_dynamic_acls = 1; tpg->tpg_attrib.demo_mode_login_only = 1; tpg->tpg_attrib.jam_host = 0; + tpg->tpg_attrib.jam_data = 0; ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_FCP); if (ret < 0) { diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.h b/drivers/scsi/qla2xxx/tcm_qla2xxx.h index 37e026a..789bdeb 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.h +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.h @@ -35,6 +35,7 @@ struct tcm_qla2xxx_tpg_attrib { int demo_mode_login_only; int fabric_prot_type; int jam_host; + int jam_data; }; struct tcm_qla2xxx_tpg { -- 2.5.5 Documentation/scsi/tcm_qla2xxx.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/scsi/tcm_qla2xxx.txt b/Documentation/scsi/tcm_qla2xxx.txt index c3a670a..4a8706c 100644 --- a/Documentation/scsi/tcm_qla2xxx.txt +++ b/Documentation/scsi/tcm_qla2xxx.txt @@ -20,3 +20,19 @@ echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib Disable jamming on host 4 echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host + +New feature added with a new attribute called jam_data. + +Setting a boolean of 1 for jam_data as well as setting the boolean of 1 for jam_host will + allow the dropping of data-only SCSI commands but allow TUR commands to pass. + +This has proven very useful for testing Low Level driver response. + +Enable host 4 for only data commands to be jammed +echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 1 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_data + +Disable jamming on host 4 +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_host +echo 0 > /sys/kernel/config/target/qla2xxx/21:00:00:24:ff:27:8f:ae/tpgt_1/attrib/jam_data +