From: John Fastabend <john.r.fastabend@intel.com>
To: "Dave, Tushar N" <tushar.n.dave@intel.com>
Cc: Michal Miroslaw <mirqus@gmail.com>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@intel.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"gospo@redhat.com" <gospo@redhat.com>,
"sassmann@redhat.com" <sassmann@redhat.com>
Subject: Re: [net] e1000: Small packets may get corrupted during padding by HW
Date: Sat, 15 Sep 2012 18:48:33 -0700 [thread overview]
Message-ID: <50552FF1.5030708@intel.com> (raw)
In-Reply-To: <061C8A8601E8EE4CA8D8FD6990CEA89130DC20AA@ORSMSX102.amr.corp.intel.com>
On 9/15/2012 6:25 PM, Dave, Tushar N wrote:
>> -----Original Message-----
>> From: Michał Mirosław [mailto:mirqus@gmail.com]
>> Sent: Saturday, September 15, 2012 1:45 PM
>> To: Kirsher, Jeffrey T
>> Cc: davem@davemloft.net; Dave, Tushar N; netdev@vger.kernel.org;
>> gospo@redhat.com; sassmann@redhat.com
>> Subject: Re: [net] e1000: Small packets may get corrupted during padding
>> by HW
>>
>> 2012/9/15 Jeff Kirsher <jeffrey.t.kirsher@intel.com>:
>>> From: Tushar Dave <tushar.n.dave@intel.com>
>>>
>>> On PCI/PCI-X HW, if packet size is less than ETH_ZLEN, packets may get
>>> corrupted during padding by HW.
>>> To WA this issue, pad all small packets manually.
>>>
>>> Signed-off-by: Tushar Dave <tushar.n.dave@intel.com>
>>> Tested-by: Aaron Brown <aaron.f.brown@intel.com>
>>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>>> ---
>>> drivers/net/ethernet/intel/e1000/e1000_main.c | 11 +++++++++++
>>> 1 file changed, 11 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c
>>> b/drivers/net/ethernet/intel/e1000/e1000_main.c
>>> index 3bfbb8d..bde337e 100644
>>> --- a/drivers/net/ethernet/intel/e1000/e1000_main.c
>>> +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
>>> @@ -3149,6 +3149,17 @@ static netdev_tx_t e1000_xmit_frame(struct
>> sk_buff *skb,
>>> return NETDEV_TX_OK;
>>> }
>>>
>>> + /* On PCI/PCI-X HW, if packet size is less than ETH_ZLEN,
>>> + * packets may get corrupted during padding by HW.
>>> + * To WA this issue, pad all small packets manually.
>>> + */
>>> + if (skb->len < ETH_ZLEN) {
>>> + if (skb_pad(skb, ETH_ZLEN - skb->len))
>>> + return NETDEV_TX_OK;
>>> + skb->len = ETH_ZLEN;
>>> + skb_set_tail_pointer(skb, ETH_ZLEN);
>>> + }
>>> +
>>
>> Isn't there a skb_padto() that does just this?
>
> Skb_padto calls skb_pad(). Calling skb_pad directly saves some cycles.
>
How/where?
static inline int skb_padto(struct sk_buff *skb, unsigned int len)
{
unsigned int size = skb->len;
if (likely(size >= len))
return 0;
return skb_pad(skb, len - size);
}
Also wouldn't you want an unlikely() in your patch?
.John
next prev parent reply other threads:[~2012-09-16 1:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-15 20:16 [net] e1000: Small packets may get corrupted during padding by HW Jeff Kirsher
2012-09-15 20:44 ` Michał Mirosław
2012-09-16 1:25 ` Dave, Tushar N
2012-09-16 1:48 ` John Fastabend [this message]
2012-09-16 2:30 ` John Fastabend
2012-09-17 7:33 ` Dave, Tushar N
2012-09-17 7:58 ` Eric Dumazet
2012-09-17 20:53 ` Alexander Duyck
2012-09-17 21:02 ` Eric Dumazet
2012-09-18 3:01 ` Alexander Duyck
2012-09-18 3:03 ` David Miller
2012-09-18 3:27 ` Alexander Duyck
2012-09-18 5:45 ` Eric Dumazet
2012-09-18 5:55 ` Alexander Duyck
2012-09-17 16:31 ` David Miller
2012-09-17 16:39 ` Dave, Tushar N
2012-09-17 19:40 ` Alexander Duyck
2012-09-18 20:33 ` 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=50552FF1.5030708@intel.com \
--to=john.r.fastabend@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=mirqus@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.com \
--cc=tushar.n.dave@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.