From: Eric Dumazet <eric.dumazet@gmail.com>
To: Arvid Brodin <Arvid.Brodin@xdin.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
Ben Hutchings <bhutchings@solarflare.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: Do I need to skb_put() Ethernet frames to a minimum of 60 bytes?
Date: Tue, 21 Aug 2012 19:42:47 +0200 [thread overview]
Message-ID: <1345570967.5158.541.camel@edumazet-glaptop> (raw)
In-Reply-To: <5033C6B0.4060508@xdin.com>
On Tue, 2012-08-21 at 17:34 +0000, Arvid Brodin wrote:
> Nicolas, can you take a look at this? At the moment I'm using the following change
> in macb.c to avoid TX underruns on short packages:
>
> --- a/drivers/net/ethernet/cadence/macb.c 2012-05-04 19:14:41.927719667 +0200
> +++ b/drivers/net/ethernet/cadence/macb.c 2012-08-21 19:22:40.063739049 +0200
> @@ -618,6 +618,7 @@ static void macb_poll_controller(struct
> }
> #endif
>
> +#define MIN_ETHFRAME_LEN 60
> static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
> {
> struct macb *bp = netdev_priv(dev);
> @@ -635,6 +636,12 @@ static int macb_start_xmit(struct sk_buf
> printk("\n");
> #endif
>
> + if (skb->len < MIN_ETHFRAME_LEN) {
> + /* Pad skb to minium Ethernet frame size */
> + if (skb_tailroom(skb) >= MIN_ETHFRAME_LEN - skb->len)
> + memset(skb_put(skb, MIN_ETHFRAME_LEN - skb->len), 0,
> + MIN_ETHFRAME_LEN - skb->len);
> + }
> len = skb->len;
> spin_lock_irqsave(&bp->lock, flags);
>
>
> ... but as you can see this is limited to linear skbs which has been allocated with
> enough tailroom. Perhaps there are better ways to fix the problem? (Maybe the hardware
> is actually doing the padding already and the problem has to do with the way the DMA
> transfer is set up?)
>
other net drivers use skb_padto() for this ...
next prev parent reply other threads:[~2012-08-21 17:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 18:53 Do I need to skb_put() Ethernet frames to a minimum of 60 bytes? Arvid Brodin
2012-08-14 20:35 ` Ben Hutchings
2012-08-21 17:34 ` Arvid Brodin
2012-08-21 17:42 ` Eric Dumazet [this message]
2012-08-21 18:07 ` Ben Hutchings
2012-12-17 13:43 ` Nicolas Ferre
2012-12-17 15:15 ` Arvid Brodin
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=1345570967.5158.541.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=Arvid.Brodin@xdin.com \
--cc=bhutchings@solarflare.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@atmel.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).