netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Andrew Victor <andrew@sanpeople.com>
Cc: netdev@vger.kernel.org, jgarzik@pobox.com
Subject: Re: [PATCH 2.6.19] AT91RM9200 Ethernet update 3
Date: Mon, 4 Dec 2006 10:08:31 -0800	[thread overview]
Message-ID: <20061204100831.0af6790f@freekitty> (raw)
In-Reply-To: <1165236624.4606.111.camel@fuzzie.sanpeople.com>

On 04 Dec 2006 14:50:24 +0200
Andrew Victor <andrew@sanpeople.com> wrote:

> A minor fix to the Atmel AT91RM9200 Ethernet driver.
> 
> 1. Use dev_alloc_skb() instead of alloc_skb().
> 2. It is not necessary to adjust skb->len manually.
> 
> 
> Signed-off-by: Andrew Victor <andrew@sanpeople.com>
> 
> 
> diff -urN linux-2.6.19-final.orig/drivers/net/arm/at91_ether.c linux-2.6.19-final/drivers/net/arm/at91_ether.c
> --- linux-2.6.19-final.orig/drivers/net/arm/at91_ether.c	Mon Dec  4 14:42:05 2006
> +++ linux-2.6.19-final/drivers/net/arm/at91_ether.c	Mon Dec  4 14:43:57 2006
> @@ -855,14 +855,13 @@
>  	while (dlist->descriptors[lp->rxBuffIndex].addr & EMAC_DESC_DONE) {
>  		p_recv = dlist->recv_buf[lp->rxBuffIndex];
>  		pktlen = dlist->descriptors[lp->rxBuffIndex].size & 0x7ff;	/* Length of frame including FCS */
> -		skb = alloc_skb(pktlen + 2, GFP_ATOMIC);
> +		skb = dev_alloc_skb(pktlen + 2);
>  		if (skb != NULL) {
>  			skb_reserve(skb, 2);
>  			memcpy(skb_put(skb, pktlen), p_recv, pktlen);
>  
>  			skb->dev = dev;
>  			skb->protocol = eth_type_trans(skb, dev);
> -			skb->len = pktlen;
>  			dev->last_rx = jiffies;
>  			lp->stats.rx_bytes += pktlen;
>  			netif_rx(skb);
>

Use netdev_alloc_skb instead. It sets skb->dev so you don't have to.
Setting skb->len is redundant since that is what skb_put() does.

It would be best if you didn't have to copy data at all and could
receive directly into the skb.

If you have to copy received data, it is better to implement NAPI since that
allows you to copy data in soft irq. The existing code will cause poor realtime
performance since the driver is copying received data with IRQ's disabled.

-- 
Stephen Hemminger <shemminger@osdl.org>

  reply	other threads:[~2006-12-04 18:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-04 12:50 [PATCH 2.6.19] AT91RM9200 Ethernet update 3 Andrew Victor
2006-12-04 18:08 ` Stephen Hemminger [this message]
2006-12-05  7:29   ` Andrew Victor
2006-12-07 17:19     ` Stephen Hemminger
2006-12-04 23:42 ` Jeff Garzik

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=20061204100831.0af6790f@freekitty \
    --to=shemminger@osdl.org \
    --cc=andrew@sanpeople.com \
    --cc=jgarzik@pobox.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 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).