On Sun, 2016-04-03 at 09:57 -0400, Laurence Oberman wrote:
> 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]>
> 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(-)
>
> diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig
> index 10aa18b..5110fab 100644
> --- a/drivers/scsi/qla2xxx/Kconfig
> +++ b/drivers/scsi/qla2xxx/Kconfig
> @@ -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
> +
Instead of duplicating the 'depends' here for TCM_QLA2XXX, just do a:
if TCM_QLA2XXX
config TCM_QLA2XXX_DEBUG
...
...
endif
> diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> index 1808a01..411a450 100644
> --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> @@ -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.
> 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
Whitespace instead of TABs here too.
>
> 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,
> };
Whitespace instead of TABs here too.
--
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