All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Brice Goglin <brice@myri.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 1/3] myri10ge: fix management of the firmware 4KB boundary crossing restriction
Date: Wed, 11 Apr 2007 11:55:18 -0400	[thread overview]
Message-ID: <461D04E6.5020103@garzik.org> (raw)
In-Reply-To: <461BE3A4.9080205@myri.com>

Brice Goglin wrote:
> Simpler way of dealing with the firmware 4KB boundary crossing
> restriction for rx buffers.  This fixes a variety of memory
> corruption issues when using an "uncommon" MTU with a 16KB
> page size.
> 
> Signed-off-by: Brice Goglin <brice@myri.com>
> ---
>  drivers/net/myri10ge/myri10ge.c |   19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> Index: linux-rc/drivers/net/myri10ge/myri10ge.c
> ===================================================================
> --- linux-rc.orig/drivers/net/myri10ge/myri10ge.c	2007-04-06 09:05:17.000000000 +0200
> +++ linux-rc/drivers/net/myri10ge/myri10ge.c	2007-04-10 21:03:59.000000000 +0200
> @@ -900,19 +900,9 @@
>  	/* try to refill entire ring */
>  	while (rx->fill_cnt != (rx->cnt + rx->mask + 1)) {
>  		idx = rx->fill_cnt & rx->mask;
> -
> -		if ((bytes < MYRI10GE_ALLOC_SIZE / 2) &&
> -		    (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE)) {
> +		if (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE) {
>  			/* we can use part of previous page */
>  			get_page(rx->page);
> -#if MYRI10GE_ALLOC_SIZE > 4096
> -			/* Firmware cannot cross 4K boundary.. */
> -			if ((rx->page_offset >> 12) !=
> -			    ((rx->page_offset + bytes - 1) >> 12)) {
> -				rx->page_offset =
> -				    (rx->page_offset + bytes) & ~4095;
> -			}
> -#endif
>  		} else {
>  			/* we need a new page */
>  			page =
> @@ -941,6 +931,13 @@
>  
>  		/* start next packet on a cacheline boundary */
>  		rx->page_offset += SKB_DATA_ALIGN(bytes);
> +
> +#if MYRI10GE_ALLOC_SIZE > 4096
> +		/* don't cross a 4KB boundary */
> +		if ((rx->page_offset >> 12) !=
> +		    ((rx->page_offset + bytes - 1) >> 12))
> +			rx->page_offset = (rx->page_offset + 4096) & ~4095;
> +#endif
>  		rx->fill_cnt++;
>  
>  		/* copy 8 descriptors to the firmware at a time */
> 

applied 1-3



  reply	other threads:[~2007-04-11 15:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-10 19:20 [PATCH 0/3] last myri10ge updates for 2.6.21 Brice Goglin
2007-04-10 19:21 ` [PATCH 1/3] myri10ge: fix management of the firmware 4KB boundary crossing restriction Brice Goglin
2007-04-11 15:55   ` Jeff Garzik [this message]
2007-04-10 19:21 ` [PATCH 2/3] myri10ge: more Intel chipsets providing aligned PCIe completions Brice Goglin
2007-04-11 15:54   ` Jeff Garzik
2007-04-11 18:39     ` Brice Goglin
2007-04-10 19:22 ` [PATCH 3/3] myri10ge: update driver version to 1.3.0-1.233 Brice Goglin

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=461D04E6.5020103@garzik.org \
    --to=jeff@garzik.org \
    --cc=brice@myri.com \
    --cc=netdev@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 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.