netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: David Laight <David.Laight@aculab.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [PATCH net-next v4 2/2] net: systemport: pad packets to a minimum of 64 bytes
Date: Wed, 14 May 2014 09:09:05 -0700	[thread overview]
Message-ID: <CAGVrzcb8cOsfR0x7aiEmG1v1Bb067d-_amYQ4X4uqQp62q-q5Q@mail.gmail.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D172442ED@AcuExch.aculab.com>

2014-05-14 1:51 GMT-07:00 David Laight <David.Laight@aculab.com>:
> From: Florian Fainelli
> ...
>> >>> +     if (skb_padto(skb, 64)) {
>> >>
>> >> Shouldn't that be 60?
>> >
>> > It should, absolutely, and that is ETH_ZLEN. Thanks!
>>
>> In fact, no, despite the Ethernet MAC appending the CRC, the minimum
>> packet length from the DMA perspective really needs to be 64, as the
>> hardware inserted CRC is not accounted for to generate the End of
>> Packet signal. That just translates into ETH_ZLEN + ETH_FCS_LEN
>> anyway.
>
> Hmmm.... That really doesn't sound right.
> The CRC can't be replacing the last 4 bytes of the skb - otherwise
> longer packets would be corrupted.
> So I'm sure that you are padding frames to 68 bytes.

Yes that's what I am doing. I was confused because I enabled the
switch tagging, which inserts a 4bytes tag between the Ethernet SA and
the Ethertype field. That specific switch tag length is not taken into
account by the switch to determine if a packet is runt, because the
tag is extracted before the packet enters the parsing logic. The
minimum frame length really needs to be 64 bytes with the FCS, but
without the switch tag inserted, so if we want to be safe, regardless
of the switch tag being inserted or not, the minimum frame length
needs to be 68 bytes with the FCS.

> While a typical IP implementation probably ignores pad bytes after
> any length frame, other protocols will only expect padding on short
> frames - and then only to the minimum frame length.
>
>         David
>



-- 
Florian

  reply	other threads:[~2014-05-14 16:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09 20:16 [PATCH net-next v4 0/2] net: systemport: couple fixes Florian Fainelli
2014-05-09 20:16 ` [PATCH net-next v4 1/2] net: systemport: only update UMAC_CMD if something changed Florian Fainelli
2014-05-09 20:16 ` [PATCH net-next v4 2/2] net: systemport: pad packets to a minimum of 64 bytes Florian Fainelli
2014-05-12 12:45   ` David Laight
2014-05-14  0:18     ` Florian Fainelli
2014-05-14  0:36       ` Florian Fainelli
2014-05-14  8:51         ` David Laight
2014-05-14 16:09           ` Florian Fainelli [this message]
2014-05-13 16:48 ` [PATCH net-next v4 0/2] net: systemport: couple fixes 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=CAGVrzcb8cOsfR0x7aiEmG1v1Bb067d-_amYQ4X4uqQp62q-q5Q@mail.gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=David.Laight@aculab.com \
    --cc=davem@davemloft.net \
    --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).