[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <061C8A8601E8EE4CA8D8FD6990CEA89130DC3631@ORSMSX102.amr.corp.intel.com>
Date: Mon, 17 Sep 2012 07:33:12 +0000
From: "Dave, Tushar N" <tushar.n.dave@...el.com>
To: "Fastabend, John R" <john.r.fastabend@...el.com>
CC: Michal Miroslaw <mirqus@...il.com>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"gospo@...hat.com" <gospo@...hat.com>,
"sassmann@...hat.com" <sassmann@...hat.com>
Subject: RE: [net] e1000: Small packets may get corrupted during padding by
HW
>-----Original Message-----
>From: netdev-owner@...r.kernel.org [mailto:netdev-owner@...r.kernel.org]
>On Behalf Of John Fastabend
>Sent: Saturday, September 15, 2012 6:49 PM
>To: Dave, Tushar N
>Cc: Michal Miroslaw; Kirsher, Jeffrey T; davem@...emloft.net;
>netdev@...r.kernel.org; gospo@...hat.com; sassmann@...hat.com
>Subject: Re: [net] e1000: Small packets may get corrupted during padding
>by HW
>
>On 9/15/2012 6:25 PM, Dave, Tushar N wrote:
>>> -----Original Message-----
>>> From: Michał Mirosław [mailto:mirqus@...il.com]
>>> Sent: Saturday, September 15, 2012 1:45 PM
>>> To: Kirsher, Jeffrey T
>>> Cc: davem@...emloft.net; Dave, Tushar N; netdev@...r.kernel.org;
>>> gospo@...hat.com; sassmann@...hat.com
>>> Subject: Re: [net] e1000: Small packets may get corrupted during
>>> padding by HW
>>>
>>> 2012/9/15 Jeff Kirsher <jeffrey.t.kirsher@...el.com>:
>>>> From: Tushar Dave <tushar.n.dave@...el.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@...el.com>
>>>> Tested-by: Aaron Brown <aaron.f.brown@...el.com>
>>>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.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?
No because it is quite normal to have packet < ETH_ZLEN. e.g. ARP packets.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists