All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] net: Checksum offload changes - Part IV
@ 2014-06-11  1:54 Tom Herbert
  2014-06-11 22:46 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Herbert @ 2014-06-11  1:54 UTC (permalink / raw)
  To: davem, netdev

I am working on overhauling RX checksum offload. Goals of this effort
are:

- Specify what exactly it means when driver returns CHECKSUM_UNNECESSARY
- Preserve CHECKSUM_COMPLETE through encapsulation layers
- Don't do skb_checksum more than once per packet
- Unify GRO and non-GRO csum verification as much as possible
- Unify the checksum functions (checksum_init)
- Simply code

What is in this fourth patch set:

- Preserve CHECKSUM_COMPLETE instead of changing it to
  CHECKSUM_UNNECESSARY. This allows correct reuse in validating multiple
  csums in a packet.
- When SW needs to compute the packet checksum, save it as
  CHECKSUM_COMPLETE. Also mark that checksum was compute by SW.
- Add skb_gro_postpull_rcsum to udp and vxlan to make GRO work with
  CHECKSUM_COMPLETE.

v2: Removed patch setting skb_encapsulation when validating checksum
    in tcp_gro_receive

Please review carefully and test if possible, mucking with basic
checksum functions is always a little precarious :-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/4] net: Checksum offload changes - Part IV
  2014-06-11  1:54 [PATCH v2 0/4] net: Checksum offload changes - Part IV Tom Herbert
@ 2014-06-11 22:46 ` David Miller
  2014-07-11  5:40   ` Sharat Masetty
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2014-06-11 22:46 UTC (permalink / raw)
  To: therbert; +Cc: netdev

From: Tom Herbert <therbert@google.com>
Date: Tue, 10 Jun 2014 18:54:03 -0700 (PDT)

> I am working on overhauling RX checksum offload. Goals of this effort
> are:
> 
> - Specify what exactly it means when driver returns CHECKSUM_UNNECESSARY
> - Preserve CHECKSUM_COMPLETE through encapsulation layers
> - Don't do skb_checksum more than once per packet
> - Unify GRO and non-GRO csum verification as much as possible
> - Unify the checksum functions (checksum_init)
> - Simply code
> 
> What is in this fourth patch set:
> 
> - Preserve CHECKSUM_COMPLETE instead of changing it to
>   CHECKSUM_UNNECESSARY. This allows correct reuse in validating multiple
>   csums in a packet.
> - When SW needs to compute the packet checksum, save it as
>   CHECKSUM_COMPLETE. Also mark that checksum was compute by SW.
> - Add skb_gro_postpull_rcsum to udp and vxlan to make GRO work with
>   CHECKSUM_COMPLETE.
> 
> v2: Removed patch setting skb_encapsulation when validating checksum
>     in tcp_gro_receive
> 
> Please review carefully and test if possible, mucking with basic
> checksum functions is always a little precarious :-)

Series applied, thanks Tom.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/4] net: Checksum offload changes - Part IV
  2014-06-11 22:46 ` David Miller
@ 2014-07-11  5:40   ` Sharat Masetty
  2014-07-13 23:01     ` Tom Herbert
  0 siblings, 1 reply; 4+ messages in thread
From: Sharat Masetty @ 2014-07-11  5:40 UTC (permalink / raw)
  To: David Miller; +Cc: Tom Herbert, Linux Netdev List

> Don't do skb_checksum more than once per packet
Was wondering in which cases does the stack perform the checksum more
than once? __skb_checksum_complete_head() already sets the ip_summed
to CHECKSUM_UNNECESSARY, so future checksum calculations are avoided.
What am I missing?

Thanks
Sharat

On Wed, Jun 11, 2014 at 4:46 PM, David Miller <davem@davemloft.net> wrote:
> From: Tom Herbert <therbert@google.com>
> Date: Tue, 10 Jun 2014 18:54:03 -0700 (PDT)
>
>> I am working on overhauling RX checksum offload. Goals of this effort
>> are:
>>
>> - Specify what exactly it means when driver returns CHECKSUM_UNNECESSARY
>> - Preserve CHECKSUM_COMPLETE through encapsulation layers
>> - Don't do skb_checksum more than once per packet
>> - Unify GRO and non-GRO csum verification as much as possible
>> - Unify the checksum functions (checksum_init)
>> - Simply code
>>
>> What is in this fourth patch set:
>>
>> - Preserve CHECKSUM_COMPLETE instead of changing it to
>>   CHECKSUM_UNNECESSARY. This allows correct reuse in validating multiple
>>   csums in a packet.
>> - When SW needs to compute the packet checksum, save it as
>>   CHECKSUM_COMPLETE. Also mark that checksum was compute by SW.
>> - Add skb_gro_postpull_rcsum to udp and vxlan to make GRO work with
>>   CHECKSUM_COMPLETE.
>>
>> v2: Removed patch setting skb_encapsulation when validating checksum
>>     in tcp_gro_receive
>>
>> Please review carefully and test if possible, mucking with basic
>> checksum functions is always a little precarious :-)
>
> Series applied, thanks Tom.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/4] net: Checksum offload changes - Part IV
  2014-07-11  5:40   ` Sharat Masetty
@ 2014-07-13 23:01     ` Tom Herbert
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Herbert @ 2014-07-13 23:01 UTC (permalink / raw)
  To: Sharat Masetty; +Cc: David Miller, Linux Netdev List

On Thu, Jul 10, 2014 at 10:40 PM, Sharat Masetty <sharat04@gmail.com> wrote:
>> Don't do skb_checksum more than once per packet
> Was wondering in which cases does the stack perform the checksum more
> than once? __skb_checksum_complete_head() already sets the ip_summed
> to CHECKSUM_UNNECESSARY, so future checksum calculations are avoided.

Consider the following scenario:

1) VXLAN packet is receive with non-zero UDP checksum and driver did
not set checksum unnecessary.
2) Stack computes and verifies UDP checksum and sets ip_summed to
CHECKSUM_UNNECESSARY.
3) Packet enters UDP tunnel processing, ip_summed is set to
CHECKSUM_NONE since skb->encapsulation == 0
4) Stack will then recompute checksum for an encapsulated TCP packet.

So in this case the bytes in the TCP header and all its data were
checksum twice. To avoid this we don't set CHECKSUM_UNNECESSARY but
keep ip_summed == CHECKSUM_COMPLETE.

There are other cases where the packet can be checksummed twice, for
instance it checksum is bad I believe both GRO and normal path will
compute it (still need to fix this).

Tom

> What am I missing?
>
> Thanks
> Sharat
>
> On Wed, Jun 11, 2014 at 4:46 PM, David Miller <davem@davemloft.net> wrote:
>> From: Tom Herbert <therbert@google.com>
>> Date: Tue, 10 Jun 2014 18:54:03 -0700 (PDT)
>>
>>> I am working on overhauling RX checksum offload. Goals of this effort
>>> are:
>>>
>>> - Specify what exactly it means when driver returns CHECKSUM_UNNECESSARY
>>> - Preserve CHECKSUM_COMPLETE through encapsulation layers
>>> - Don't do skb_checksum more than once per packet
>>> - Unify GRO and non-GRO csum verification as much as possible
>>> - Unify the checksum functions (checksum_init)
>>> - Simply code
>>>
>>> What is in this fourth patch set:
>>>
>>> - Preserve CHECKSUM_COMPLETE instead of changing it to
>>>   CHECKSUM_UNNECESSARY. This allows correct reuse in validating multiple
>>>   csums in a packet.
>>> - When SW needs to compute the packet checksum, save it as
>>>   CHECKSUM_COMPLETE. Also mark that checksum was compute by SW.
>>> - Add skb_gro_postpull_rcsum to udp and vxlan to make GRO work with
>>>   CHECKSUM_COMPLETE.
>>>
>>> v2: Removed patch setting skb_encapsulation when validating checksum
>>>     in tcp_gro_receive
>>>
>>> Please review carefully and test if possible, mucking with basic
>>> checksum functions is always a little precarious :-)
>>
>> Series applied, thanks Tom.
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-13 23:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-11  1:54 [PATCH v2 0/4] net: Checksum offload changes - Part IV Tom Herbert
2014-06-11 22:46 ` David Miller
2014-07-11  5:40   ` Sharat Masetty
2014-07-13 23:01     ` Tom Herbert

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.