public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagig@dev.mellanox.co.il>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Sagi Grimberg <sagig@mellanox.com>
Cc: nab@linux-iscsi.org, michaelc@cs.wisc.edu,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	linux-rdma@vger.kernel.org, oren@mellanox.com
Subject: Re: [PATCH 2/2] TARGET/sbc,loopback: Adjust command data length in case pi exists on the wire
Date: Thu, 05 Jun 2014 20:22:15 +0300	[thread overview]
Message-ID: <5390A747.5020506@dev.mellanox.co.il> (raw)
In-Reply-To: <yq1fvjn9rqs.fsf@sermon.lab.mkp.net>

On 6/2/2014 7:54 PM, Martin K. Petersen wrote:
>>>>>> "Sagi" == Sagi Grimberg <sagig@mellanox.com> writes:
> Sagi,
>
> Sagi> In various areas of the code, it is assumed that
> Sagi> se_cmd-> data_length describes pure data. In case
> Sagi> that protection information exists over the wire (protect bits is
> Sagi> are on) the target core decrease the protection length from the
> Sagi> data length (instead of each transport peeking in the cdb).
>
> I completely agree with the notion of including PI in the transport byte
> count.
>
> Why do you open code the transfer length adjustment below?

Can't say I have a good reason for that.
I'll move this logic to scsi_cmnd.h.

>
> +			/**
> +			 * Adjust data_length to include
> +			 * protection information
> +			 **/
> +			switch (sc->device->sector_size) {
> +			case 512:
> +				data_len += (data_len >> 9) * 8;
> +				break;
> +			case 1024:
> +				data_len += (data_len >> 10) * 8;
> +				break;
> +			case 2048:
> +				data_len += (data_len >> 11) * 8;
> +				break;
> +			case 4096:
> +				data_len += (data_len >> 12) * 8;
> +				break;
> +			default:
> +				data_len +=
> +				(data_len >> ilog2(sc->device->sector_size)) * 8;
> +			}
>


  reply	other threads:[~2014-06-05 17:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-01 16:19 [PATCH 0/2] Include protection information in iscsi header Sagi Grimberg
2014-06-01 16:19 ` [PATCH 1/2] libiscsi, iser: Adjust data_length to include protection information Sagi Grimberg
     [not found]   ` <1401639581-20111-2-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-06-03 16:06     ` Mike Christie
     [not found]       ` <538DF27F.50903-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2014-06-03 22:18         ` Martin K. Petersen
     [not found]           ` <yq1wqcx3act.fsf-+q57XtR/GgMb6DWv4sQWN6xOck334EZe@public.gmane.org>
2014-06-05 17:29             ` Sagi Grimberg
2014-06-03 16:11     ` Mike Christie
2014-06-05 17:26       ` Sagi Grimberg
2014-06-01 16:19 ` [PATCH 2/2] TARGET/sbc,loopback: Adjust command data length in case pi exists on the wire Sagi Grimberg
2014-06-02 16:54   ` Martin K. Petersen
2014-06-05 17:22     ` Sagi Grimberg [this message]
2014-06-03  6:16 ` [PATCH 0/2] Include protection information in iscsi header Roland Dreier
2014-06-03  7:56   ` Or Gerlitz
2014-06-05 17:25   ` Sagi Grimberg

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=5390A747.5020506@dev.mellanox.co.il \
    --to=sagig@dev.mellanox.co.il \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michaelc@cs.wisc.edu \
    --cc=nab@linux-iscsi.org \
    --cc=oren@mellanox.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