From: Sagi Grimberg <sagig@dev.mellanox.co.il>
To: "Nicholas A. Bellinger" <nab@daterainc.com>,
target-devel <target-devel@vger.kernel.org>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Sagi Grimberg <sagig@mellanox.com>,
Or Gerlitz <ogerlitz@mellanox.com>,
Quinn Tran <quinn.tran@qlogic.com>,
Giridhar Malavali <giridhar.malavali@qlogic.com>,
Nicholas Bellinger <nab@linux-iscsi.org>
Subject: Re: [PATCH 4/9] target/spc: Only expose PI mode page bits when supported by fabric
Date: Mon, 07 Apr 2014 10:31:23 +0300 [thread overview]
Message-ID: <5342544B.1080204@dev.mellanox.co.il> (raw)
In-Reply-To: <1396517753-23546-5-git-send-email-nab@daterainc.com>
On 4/3/2014 12:35 PM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> Only expose the control modepage bit for Application Tag Owner (ATO)
> if the session + fabric support DIX PASS operations.
>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Or Gerlitz <ogerlitz@mellanox.com>
> Cc: Quinn Tran <quinn.tran@qlogic.com>
> Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
> drivers/target/target_core_spc.c | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
> index d4c6a31..8653666 100644
> --- a/drivers/target/target_core_spc.c
> +++ b/drivers/target/target_core_spc.c
> @@ -769,7 +769,7 @@ out:
> return ret;
> }
>
> -static int spc_modesense_rwrecovery(struct se_device *dev, u8 pc, u8 *p)
> +static int spc_modesense_rwrecovery(struct se_cmd *cmd, u8 pc, u8 *p)
> {
> p[0] = 0x01;
> p[1] = 0x0a;
> @@ -782,8 +782,11 @@ out:
> return 12;
> }
>
> -static int spc_modesense_control(struct se_device *dev, u8 pc, u8 *p)
> +static int spc_modesense_control(struct se_cmd *cmd, u8 pc, u8 *p)
> {
> + struct se_device *dev = cmd->se_dev;
> + struct se_session *sess = cmd->se_sess;
> +
> p[0] = 0x0a;
> p[1] = 0x0a;
>
> @@ -875,8 +878,10 @@ static int spc_modesense_control(struct se_device *dev, u8 pc, u8 *p)
> * type, shall not modify the contents of the LOGICAL BLOCK REFERENCE
> * TAG field.
> */
> - if (dev->dev_attrib.pi_prot_type)
> - p[5] |= 0x80;
> + if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) {
> + if (dev->dev_attrib.pi_prot_type)
> + p[5] |= 0x80;
> + }
>
> p[8] = 0xff;
> p[9] = 0xff;
> @@ -886,8 +891,10 @@ out:
> return 12;
> }
>
> -static int spc_modesense_caching(struct se_device *dev, u8 pc, u8 *p)
> +static int spc_modesense_caching(struct se_cmd *cmd, u8 pc, u8 *p)
> {
> + struct se_device *dev = cmd->se_dev;
> +
> p[0] = 0x08;
> p[1] = 0x12;
>
> @@ -903,7 +910,7 @@ out:
> return 20;
> }
>
> -static int spc_modesense_informational_exceptions(struct se_device *dev, u8 pc, unsigned char *p)
> +static int spc_modesense_informational_exceptions(struct se_cmd *cmd, u8 pc, unsigned char *p)
> {
> p[0] = 0x1c;
> p[1] = 0x0a;
> @@ -919,7 +926,7 @@ out:
> static struct {
> uint8_t page;
> uint8_t subpage;
> - int (*emulate)(struct se_device *, u8, unsigned char *);
> + int (*emulate)(struct se_cmd *, u8, unsigned char *);
> } modesense_handlers[] = {
> { .page = 0x01, .subpage = 0x00, .emulate = spc_modesense_rwrecovery },
> { .page = 0x08, .subpage = 0x00, .emulate = spc_modesense_caching },
> @@ -1057,7 +1064,7 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd)
> * the only two possibilities).
> */
> if ((modesense_handlers[i].subpage & ~subpage) == 0) {
> - ret = modesense_handlers[i].emulate(dev, pc, &buf[length]);
> + ret = modesense_handlers[i].emulate(cmd, pc, &buf[length]);
> if (!ten && length + ret >= 255)
> break;
> length += ret;
> @@ -1070,7 +1077,7 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd)
> for (i = 0; i < ARRAY_SIZE(modesense_handlers); ++i)
> if (modesense_handlers[i].page == page &&
> modesense_handlers[i].subpage == subpage) {
> - length += modesense_handlers[i].emulate(dev, pc, &buf[length]);
> + length += modesense_handlers[i].emulate(cmd, pc, &buf[length]);
> goto set_length;
> }
>
> @@ -1102,7 +1109,6 @@ set_length:
>
> static sense_reason_t spc_emulate_modeselect(struct se_cmd *cmd)
> {
> - struct se_device *dev = cmd->se_dev;
> char *cdb = cmd->t_task_cdb;
> bool ten = cdb[0] == MODE_SELECT_10;
> int off = ten ? 8 : 4;
> @@ -1138,7 +1144,7 @@ static sense_reason_t spc_emulate_modeselect(struct se_cmd *cmd)
> if (modesense_handlers[i].page == page &&
> modesense_handlers[i].subpage == subpage) {
> memset(tbuf, 0, SE_MODE_PAGE_BUF);
> - length = modesense_handlers[i].emulate(dev, 0, tbuf);
> + length = modesense_handlers[i].emulate(cmd, 0, tbuf);
> goto check_contents;
> }
>
Looks good to me.
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
next prev parent reply other threads:[~2014-04-07 7:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-03 9:35 [PATCH 0/9] target: Allow fabric to expose PI + add WRITE_INSERT/READ_STRIP Nicholas A. Bellinger
2014-04-03 9:35 ` [PATCH 1/9] target/iblock: Fix double bioset_integrity_free bug Nicholas A. Bellinger
2014-04-07 7:19 ` Sagi Grimberg
2014-04-03 9:35 ` [PATCH 2/9] target: Pass in transport supported PI at session initialization Nicholas A. Bellinger
2014-04-07 7:28 ` Sagi Grimberg
2014-04-07 8:01 ` Nicholas A. Bellinger
2014-04-03 9:35 ` [PATCH 3/9] target/spc: Only expose PI inquiry bits when supported by fabric Nicholas A. Bellinger
2014-04-07 7:30 ` Sagi Grimberg
2014-04-03 9:35 ` [PATCH 4/9] target/spc: Only expose PI mode page " Nicholas A. Bellinger
2014-04-07 7:31 ` Sagi Grimberg [this message]
2014-04-03 9:35 ` [PATCH 5/9] target/sbc: Only expose PI read_cap16 " Nicholas A. Bellinger
2014-04-07 7:32 ` Sagi Grimberg
2014-04-03 9:35 ` [PATCH 6/9] target/sbc: Add sbc_dif_write_insert software emulation Nicholas A. Bellinger
2014-04-07 7:36 ` Sagi Grimberg
2014-04-07 8:07 ` Nicholas A. Bellinger
2014-04-03 9:35 ` [PATCH 7/9] target: Enable WRITE_INSERT emulation in target_execute_cmd Nicholas A. Bellinger
2014-04-07 7:39 ` Sagi Grimberg
2014-04-07 8:11 ` Nicholas A. Bellinger
2014-04-07 8:13 ` sagi grimberg
2014-04-03 9:35 ` [PATCH 8/9] target/sbc: Add sbc_dif_read_strip software emulation Nicholas A. Bellinger
2014-04-07 7:44 ` Sagi Grimberg
2014-04-03 9:35 ` [PATCH 9/9] target: Enable READ_STRIP emulation in target_complete_ok_work Nicholas A. Bellinger
2014-04-07 7:49 ` Sagi Grimberg
2014-04-07 8:15 ` Nicholas A. Bellinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5342544B.1080204@dev.mellanox.co.il \
--to=sagig@dev.mellanox.co.il \
--cc=giridhar.malavali@qlogic.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nab@daterainc.com \
--cc=nab@linux-iscsi.org \
--cc=ogerlitz@mellanox.com \
--cc=quinn.tran@qlogic.com \
--cc=sagig@mellanox.com \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox