netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philip Craig <philipc@snapgear.com>
To: Florian Fainelli <florian.fainelli@telecomint.eu>
Cc: netdev@vger.kernel.org, Francois Romieu <romieu@fr.zoreil.com>
Subject: Re: [PATCH] Fix kernel unaligned access with r8169 on sparc64
Date: Tue, 10 Jul 2007 11:39:19 +1000	[thread overview]
Message-ID: <4692E347.3060200@snapgear.com> (raw)
In-Reply-To: <200707061502.49146.florian.fainelli@telecomint.eu>

Florian Fainelli wrote:
> Hi all,
> 
> When using the r8169 gigabit ethernet network driver under a Sun Entreprise 
> 450, you will encounter a lot of kernel unaligned access on ip_rcv and 
> ip_fast_csum. The full report is available here : 
> http://www.mail-archive.com/debian-bugs-dist%40lists.debian.org/msg363433.htm

Try the patches at http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.22-rc6/
I think patches 0012 and/or 0017 will fix this.


> The following patch against 2.6.22-rc6 will fix this problem.
> 
> Signed-off-by: Florian Fainelli <florian.fainelli@telecomint.eu>
> 
> 
> ------------------------------------------------------------------------
> 
> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
> index 5ec7752..5095dbe 100644
> --- a/drivers/net/r8169.c
> +++ b/drivers/net/r8169.c
> @@ -69,6 +69,7 @@ VERSION 2.2LK	<2005/01/25>
>  #include <asm/system.h>
>  #include <asm/io.h>
>  #include <asm/irq.h>
> +#include <asm/unaligned.h>
>  
>  #ifdef CONFIG_R8169_NAPI
>  #define NAPI_SUFFIX	"-NAPI"
> @@ -224,7 +225,9 @@ static struct pci_device_id rtl8169_pci_tbl[] = {
>  
>  MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl);
>  
> +#if !defined(__sparc__)
>  static int rx_copybreak = 200;
> +#endif
>  static int use_dac;
>  static struct {
>  	u32 msg_enable;
> @@ -465,8 +468,10 @@ MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>");
>  MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver");
>  module_param_array(media, int, &num_media, 0);
>  MODULE_PARM_DESC(media, "force phy operation. Deprecated by ethtool (8).");
> +#if !defined(__sparc__)
>  module_param(rx_copybreak, int, 0);
>  MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
> +#endif
>  module_param(use_dac, int, 0);
>  MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot.");
>  module_param_named(debug, debug.msg_enable, int, 0);
> @@ -2486,10 +2491,25 @@ static inline int rtl8169_try_rx_copy(struct sk_buff **sk_buff, int pkt_size,
>  {
>  	int ret = -1;
>  
> -	if (pkt_size < rx_copybreak) {
> +#if defined(__sparc__)
> +	if (pkt_size) {
>  		struct sk_buff *skb;
> +		int i;
> +
> +		skb = dev_alloc_skb(pkt_size + 4);
> +
> +		/* align the data to the ip header - should be faster than copying the entire packet to the stack */
> +		for (i = pkt_size - (pkt_size % 4); i >= 0; i -= 4) {
> +			put_unaligned(*((u32 *) (skb->data + i)), (u32 *) (skb->data + i + 2));
> +		}
> +		skb->data += 2;
> +		skb->tail += 2;
> +#else
> +	if (pkt_size < rx_copybreak) {
> +                struct sk_buff *skb;
>  
>  		skb = dev_alloc_skb(pkt_size + align);
> +#endif
>  		if (skb) {
>  			skb_reserve(skb, (align - 1) & (unsigned long)skb->data);
>  			eth_copy_and_sum(skb, sk_buff[0]->data, pkt_size, 0);


  parent reply	other threads:[~2007-07-10  2:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-06 13:02 [PATCH] Fix kernel unaligned access with r8169 on sparc64 Florian Fainelli
2007-07-09 12:57 ` Florian Fainelli
2007-07-10  1:39 ` Philip Craig [this message]
2007-07-10 20:59   ` Francois Romieu
2007-07-10 22:02     ` Francois Romieu

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=4692E347.3060200@snapgear.com \
    --to=philipc@snapgear.com \
    --cc=florian.fainelli@telecomint.eu \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    /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).