All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/9] net: rtl8169: Properly align buffers
Date: Fri, 22 Aug 2014 11:15:27 +0200	[thread overview]
Message-ID: <20140822091521.GD24156@ulmo> (raw)
In-Reply-To: <53F4F735.90302@wwwdotorg.org>

On Wed, Aug 20, 2014 at 01:29:57PM -0600, Stephen Warren wrote:
> On 08/18/2014 02:00 AM, Thierry Reding wrote:
> >From: Thierry Reding <treding@nvidia.com>
> >
> >RX and TX descriptor rings should be aligned to 256 byte boundaries. Use
> >the DEFINE_ALIGN_BUFFER() macro to define the buffers so that they don't
> >have to be manually aligned later on. Also make sure that the buffers do
> >align to cache-line boundaries in case the cache-line is higher than the
> >256 byte alignment requirements of the NIC.
> >
> >Also add a warning if the cache-line size is larger than the descriptor
> >size, because the driver may discard changes to descriptors made by the
> >hardware when requeuing RX buffers.
> 
> >@@ -909,6 +899,18 @@ static int rtl_init(struct eth_device *dev, bd_t *bis)
> 
> >+	/*
> >+	 * Warn if the cache-line size is larger than the descriptor size. In
> >+	 * such cases the driver will likely fail because the CPU needs to
> >+	 * flush the cache when requeuing RX buffers, therefore descriptors
> >+	 * written by the hardware may be discarded.
> >+	 */
> >+	if (ARCH_DMA_MINALIGN > sizeof(struct RxDesc))
> >+		printf("WARNING: cache-line size is larger than descriptor size\n");
> 
> I'd be tempted to make that a compile-time #error (or perhaps just a
> #warning) Perhaps #error would break compilation of existing boards though?

There are two SH4 boards that use the rtl8169 (r7780mp and sh7785lcr)
for which this condition is true, so #error would break them (well,
technically not r7780mp since it comments out CONFIG_RTL8169 in the
configuration). I'll make it a #warning instead.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140822/adc7ab70/attachment.pgp>

  reply	other threads:[~2014-08-22  9:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18  8:00 [U-Boot] [PATCH 0/9] net: rtl8169: Fix cache maintenance issues Thierry Reding
2014-08-18  8:00 ` [U-Boot] [PATCH 1/9] ARM: cache_v7: Various minor cleanups Thierry Reding
2014-08-18  8:00 ` [U-Boot] [PATCH 2/9] ARM: cache-cp15: Use unsigned long for address and size Thierry Reding
2014-08-20 19:15   ` Stephen Warren
2014-08-22  8:29     ` Thierry Reding
2014-08-18  8:00 ` [U-Boot] [PATCH 3/9] malloc: Output region when debugging Thierry Reding
2014-08-18  8:00 ` [U-Boot] [PATCH 4/9] ARM: Implement non-cached memory support Thierry Reding
2014-08-20 19:23   ` Stephen Warren
2014-08-21 15:31     ` Thierry Reding
2014-08-22  8:31     ` Thierry Reding
2014-08-18  8:00 ` [U-Boot] [PATCH 5/9] ARM: tegra: Enable non-cached memory Thierry Reding
2014-08-20 19:24   ` Stephen Warren
2014-08-18  8:00 ` [U-Boot] [PATCH 6/9] net: rtl8169: Honor CONFIG_SYS_RX_ETH_BUFFER Thierry Reding
2014-08-18  8:00 ` [U-Boot] [PATCH 7/9] net: rtl8169: Properly align buffers Thierry Reding
2014-08-20 19:29   ` Stephen Warren
2014-08-22  9:15     ` Thierry Reding [this message]
2014-11-12 16:23       ` Simon Glass
2014-11-12 23:38         ` Nobuhiro Iwamatsu
2014-11-13  1:22           ` Simon Glass
2014-08-18  8:00 ` [U-Boot] [PATCH 8/9] net: rtl8169: Use non-cached memory if available Thierry Reding
2014-08-20 19:33   ` Stephen Warren
2014-08-22  9:29     ` Thierry Reding
2014-08-18  8:00 ` [U-Boot] [PATCH 9/9] net: rtl8169: Add support for RTL-8168/8111g Thierry Reding
2014-08-20 19:12 ` [U-Boot] [PATCH 0/9] net: rtl8169: Fix cache maintenance issues Stephen Warren
2014-08-21 14:11   ` Thierry Reding

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=20140822091521.GD24156@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.