linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Tejun Heo <htejun@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-ide@vger.kernel.org
Subject: Re: [PATCH #upstream-fixes] libata: bump transfer chunk size if it's odd
Date: Mon, 26 Nov 2007 11:04:29 -0500	[thread overview]
Message-ID: <474AEE8D.8060500@garzik.org> (raw)
In-Reply-To: <20071126115802.GC9232@htj.dyndns.org>

Tejun Heo wrote:
> None of the drives I have follows what the standard says about
> transfer chunk size.  Of the four SATA and six PATA ATAPI devices
> tested, four ignore transfer chunk size completely and the ones which
> honor it don't behave according to the spec when it's odd.
> 
> According to the spec, transfer chunk size can be odd if the amount of
> data to transfer equals or is smaller than the chunk size and the
> device can indicate the same odd number and transfer the whole thing
> at one go with a pad byte appended.  However, in reality, none of the
> drives I have does that.  They all indicate and transfer even number
> of bytes one byte shorter than the chunk size first; then indicate and
> transfer two bytes, which is clearly out of spec.
> 
> In addition to unnecessary second PIO data phase, this also creates a
> weird problem when combined with SATA controllers which perform PIO
> via DMA.  Some of these controllers use actualy number of bytes
> received to update DMA pointer so chunks which are sized 4n + 2 makes
> DMA pointer off by two bytes.  This causes data corruption and buffer
> overruns.
> 
> This patch rounds nbytes up to the nearest even number such that ATAPI
> devices don't split data transfer for the last odd byte.  This
> shouldn't confuse controllers which depend on transfer chunk size as
> devices will report the rounded-up number, actually transfer that much
> and padding buffer is there to receive them.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>

applied



      reply	other threads:[~2007-11-26 16:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 11:58 [PATCH #upstream-fixes] libata: bump transfer chunk size if it's odd Tejun Heo
2007-11-26 16:04 ` Jeff Garzik [this message]

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=474AEE8D.8060500@garzik.org \
    --to=jeff@garzik.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=htejun@gmail.com \
    --cc=linux-ide@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).