From: Will Deacon <will.deacon@arm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Steve Glendinning <steve.glendinning@smsc.com>
Subject: Re: [PATCH] net: smsc911x: fix RX FIFO fastforwarding when dropping packets
Date: Thu, 12 Apr 2012 14:47:57 +0100 [thread overview]
Message-ID: <20120412134757.GH16025@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <1334235963.5300.6361.camel@edumazet-glaptop>
On Thu, Apr 12, 2012 at 02:06:03PM +0100, Eric Dumazet wrote:
> On Thu, 2012-04-12 at 13:53 +0100, Will Deacon wrote:
> > diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
> > index 4a69710..3f43c24 100644
> > --- a/drivers/net/ethernet/smsc/smsc911x.c
> > +++ b/drivers/net/ethernet/smsc/smsc911x.c
> > @@ -1166,10 +1166,8 @@ smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat)
[...]
> > - skb->data = skb->head;
> > - skb_reset_tail_pointer(skb);
> > -
> > - /* Align IP on 16B boundary */
> > - skb_reserve(skb, NET_IP_ALIGN);
> > - skb_put(skb, pktlength - 4);
> > + skb_put(skb, pktwords << 2);
>
> You could remove this line and do it after skb_reserve() ?
>
> > pdata->ops->rx_readfifo(pdata,
> > - (unsigned int *)skb->head, pktwords);
> > + (unsigned int *)skb->data, pktwords);
> > + skb_pull(skb, NET_IP_ALIGN);
>
> skb_reserve(skb, NET_IP_ALIGN);
I don't think we want an skb_reserve at all, since the hardware shifts the
data in the RX FIFO, meaning that we will read two bytes of 0 anyway before
valid data.
> skb_put(skb, pktlength - 4);
I can move the put here if you like, but we need to use pktwords << 2 to
make sure that we read the leading and trailing zeroes inserted by the
hardware.
> > + skb_trim(skb, pktlength);
>
> and remove this skb_trim()
Can do, just thought it might help illustrate that we might have some padding
at the end.
> > /* Update counters */
> > dev->stats.rx_packets++;
> > - dev->stats.rx_bytes += (pktlength - 4);
> > + dev->stats.rx_bytes += pktlength;
>
> Some drivers account for the FCS, some dont, I guess you can leave the
> line as is
Sure.
Thanks for the comments,
Will
next prev parent reply other threads:[~2012-04-12 13:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-12 9:07 [PATCH] net: smsc911x: fix RX FIFO fastforwarding when dropping packets Will Deacon
2012-04-12 9:20 ` Eric Dumazet
2012-04-12 12:53 ` Will Deacon
2012-04-12 13:06 ` Eric Dumazet
2012-04-12 13:47 ` Will Deacon [this message]
2012-04-12 14:01 ` Eric Dumazet
2012-04-12 15:54 ` Will Deacon
2012-04-12 16:08 ` Eric Dumazet
2012-04-12 17:03 ` Will Deacon
2012-04-12 17:41 ` Eric Dumazet
2012-04-13 18:08 ` David Miller
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=20120412134757.GH16025@mudshark.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=steve.glendinning@smsc.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).