From: Dmitry Bogdanov <d.bogdanov@yadro.com>
To: Mike Christie <michael.christie@oracle.com>
Cc: Martin Petersen <martin.petersen@oracle.com>,
<target-devel@vger.kernel.org>, <linux-scsi@vger.kernel.org>,
<linux@yadro.com>, Roman Bolshakov <r.bolshakov@yadro.com>
Subject: Re: [PATCH 3/6] scsi: target: core: dynamic opcode support in RSOC
Date: Fri, 12 Aug 2022 14:30:42 +0300 [thread overview]
Message-ID: <20220812113042.GA32459@yadro.com> (raw)
In-Reply-To: <1f72d08c-10e3-e625-0c19-e666fb70e5bb@oracle.com>
On Thu, Aug 11, 2022 at 10:43:05PM -0500, Mike Christie wrote:
> «Внимание! Данное письмо от внешнего адресата!»
>
> On 7/18/22 7:01 AM, Dmitry Bogdanov wrote:
> > Report supported opcodes depending on a dynamic device configuration
> >
> > Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
> > Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
> > ---
> > drivers/target/target_core_spc.c | 118 ++++++++++++++++++++++++++++--
> > include/target/target_core_base.h | 1 +
> > 2 files changed, 114 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
> > index 506e28b14e5a..cf516136b933 100644
> > --- a/drivers/target/target_core_spc.c
> > +++ b/drivers/target/target_core_spc.c
> > @@ -1424,6 +1424,13 @@ static struct target_opcode_descriptor tcm_opcode_xdwriteread32 = {
> > 0xff, 0xff, 0xff, 0xff},
> > };
> >
> > +static bool tcm_is_ws_enabled(struct se_cmd *cmd)
> > +{
> > + struct se_device *dev = cmd->se_dev;
> > +
> > + return dev->dev_attrib.emulate_tpws;
> > +}
> > +
> > static struct target_opcode_descriptor tcm_opcode_write_same32 = {
> > .support = SCSI_SUPPORT_FULL,
> > .serv_action_valid = 1,
> > @@ -1438,8 +1445,16 @@ static struct target_opcode_descriptor tcm_opcode_write_same32 = {
> > 0x00, 0x00, 0x00, 0x00,
> > 0x00, 0x00, 0x00, 0x00,
> > 0xff, 0xff, 0xff, 0xff},
> > + .enabled = tcm_is_ws_enabled,
> > };
>
> I'm not sure what's incorrect. I think your patch is correct but the write
> same code is wrong.
>
> If emulate_tpws is 0, we will still execute the command. We actually only fail
> with TCM_UNSUPPORTED_SCSI_OPCODE if it's a WRITE_SAME with the UNMAP bit = 1
> and emulate_tpws=0.
>
> If it's just a normal WRITE_SAME we maybe go by if by max_write_same_len is
> greater than zero? Maybe that was a mistake and sbc_setup_write_same needs
> a emulate_tpws check.
Looks like emulate_tpws was introduced exaclty for WS+UNMAP bit case
and it can not be used in tcm_is_ws_enabled as only check. Because of
WS is actually two different commands selected by UNMAP bit it is
unable somehow to differentiate them in RSOC. So I will reformulate
the check in tcm_is_ws_enabled to be true if some of cases is
supported by the backstore device.
+ return (dev->dev_attrib.emulate_tpws && !!ops->execute_unmap) ||
+ !!ops->execute_write_same;
>
> > static struct target_opcode_descriptor tcm_opcode_sync_cache = {
> > @@ -1502,6 +1533,14 @@ static struct target_opcode_descriptor tcm_opcode_sync_cache16 = {
> > 0xff, 0xff, SCSI_GROUP_NUMBER_MASK, SCSI_CONTROL_MASK},
> > };
> >
> > +static bool tcm_is_unmap_enabled(struct se_cmd *cmd)
> > +{
> > + struct sbc_ops *ops = cmd->protocol_data;
> > + struct se_device *dev = cmd->se_dev;
> > +
> > + return ops->execute_unmap && dev->dev_attrib.emulate_tpu;
> > +}
>
> Just a trivial nit. You had an extra space there.
yep, will fix
next prev parent reply other threads:[~2022-08-12 11:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 12:01 [PATCH 0/6] add support of RSOC command Dmitry Bogdanov
2022-07-18 12:01 ` [PATCH 1/6] scsi: target: core: " Dmitry Bogdanov
2022-07-19 10:08 ` kernel test robot
2022-07-18 12:01 ` [PATCH 2/6] scsi: target: core: add list of opcodes for RSOC Dmitry Bogdanov
2022-08-12 3:38 ` Mike Christie
2022-08-12 8:03 ` Dmitry Bogdanov
2022-08-13 7:49 ` Christoph Hellwig
2022-08-15 10:59 ` Dmitry Bogdanov
2022-07-18 12:01 ` [PATCH 3/6] scsi: target: core: dynamic opcode support in RSOC Dmitry Bogdanov
2022-07-19 12:40 ` kernel test robot
2022-08-12 3:43 ` Mike Christie
2022-08-12 11:30 ` Dmitry Bogdanov [this message]
2022-07-18 12:01 ` [PATCH 4/6] scsi: target: core: add emulate_rsoc attribute Dmitry Bogdanov
2022-08-12 3:43 ` Mike Christie
2022-08-12 11:34 ` Dmitry Bogdanov
2022-08-12 18:12 ` michael.christie
2022-08-15 6:35 ` Dmitry Bogdanov
2022-08-29 18:13 ` Mike Christie
2022-07-18 12:01 ` [PATCH 5/6] scsi: target: core: dynamicaly set dpofua in usage_bits Dmitry Bogdanov
2022-07-18 12:01 ` [PATCH 6/6] scsi: target: check emulate_3pc for RECEIVE COPY Dmitry Bogdanov
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=20220812113042.GA32459@yadro.com \
--to=d.bogdanov@yadro.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@yadro.com \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=r.bolshakov@yadro.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;
as well as URLs for NNTP newsgroup(s).