public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: "James E.J. Bottomley" <JBottomley@odin.com>,
	"Nicholas A. Bellinger" <nab@linux-iscsi.org>,
	Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH v2] Split SCSI header files
Date: Mon, 6 Apr 2015 17:08:42 +0200	[thread overview]
Message-ID: <20150406150842.GA23569@lst.de> (raw)
In-Reply-To: <55217B00.6030706@sandisk.com>

On Sun, Apr 05, 2015 at 08:12:16PM +0200, Bart Van Assche wrote:
> Move the constants that are used by both initiator and target
> drivers into the new header file <scsi/scsi_proto.h>.

This part looks mostly good, and I would prefer this to be a patch on
it's own. One little nitpick below.

> Move the
> functions that are used by both subsystems into <scsi/scsi_lib.h>.
> Rename drivers/scsi/scsi_lib.c into scsi_ini_lib.c. This change
> will allow to modify the SCSI target code such that the initiator
> SCSI header files are no longer included. Note: the SCSI target
> driver patch is available for review at

I don't really like renaming the file that has most of the initiator side
SCSI code that way.  If we really have to rename it in some way I'd suggest
just merging it into scsi.c as we call forth and back between the two all
the time.

Maybe we can use scsi_common.c/h/.ko to avoid these moves, although I'd
prefer to just duplicate this tiny amount of code.

> +/*
> + * MAX_COMMAND_SIZE is:
> + * The longest fixed-length SCSI CDB as per the SCSI standard.
> + * fixed-length means: commands that their size can be determined
> + * by their opcode and the CDB does not carry a length specifier, (unlike
> + * the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly
> + * true and the SCSI standard also defines extended commands and
> + * vendor specific commands that can be bigger than 16 bytes. The kernel
> + * will support these using the same infrastructure used for VARLEN CDB's.
> + * So in effect MAX_COMMAND_SIZE means the maximum size command scsi-ml
> + * supports without specifying a cmd_len by ULD's
> + */
> +#define MAX_COMMAND_SIZE 16
> +#if (MAX_COMMAND_SIZE > BLK_MAX_CDB)
> +# error MAX_COMMAND_SIZE can not be bigger than BLK_MAX_CDB
> +#endif

This clearly is a limitation of the Linux SCSI initiator, so having it
in the _proto.h header seems like a bad idea.  For now I'd suggest to
keep it where it is, but an additional patch to remove MAX_COMMAND_SIZE
and use BLK_MAX_CDB everywhere would be even better.

> @@ -19,9 +19,8 @@
>  /*
>   * By default we use 32-byte CDBs in TCM Core and subsystem plugin code.
>   *
> - * Note that both include/scsi/scsi_cmnd.h:MAX_COMMAND_SIZE and
> - * include/linux/blkdev.h:BLOCK_MAX_CDB as of v2.6.36-rc4 still use
> - * 16-byte CDBs by default and require an extra allocation for
> + * Note that both MAX_COMMAND_SIZE and BLOCK_MAX_CDB as of v4.0-rc1 still
> + * use 16-byte CDBs by default and require an extra allocation for
>   * 32-byte CDBs to because of legacy issues.

This comment is incorrect.  There aren't any legacy issues, we just decided
to handle > 16 byte CDBs in the slow path.  I'd suggest you remove this
sentence (and the next one) entirely instead of trying to fix it up.

  reply	other threads:[~2015-04-06 15:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-05 18:12 [PATCH v2] Split SCSI header files Bart Van Assche
2015-04-06 15:08 ` Christoph Hellwig [this message]
2015-04-07  9:11   ` Bart Van Assche

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=20150406150842.GA23569@lst.de \
    --to=hch@lst.de \
    --cc=JBottomley@odin.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.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