Skip to content

net: Checksum offload changes - Part VI

Tom Herbert netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6net: Support for csum_bad in skbuffinclude/linux/netdevice.h include/linux/skbuff.h net/core/dev.c+24 -30 replies
2/6net: Infrastructure for checksum unnecessary conversionsinclude/linux/netdevice.h include/linux/skbuff.h+40 -00 replies
3/6udp: Add support for doing checksum unnecessary conversioninclude/linux/udp.h net/ipv4/udp.c net/ipv4/udp_offload.c +2 more+57 -160 replies
4/6gre: Add support for checksum unnecessary conversionsnet/ipv4/gre_demux.c net/ipv4/gre_offload.c+10 -20 replies
5/6vxlan: Enable checksum unnecessary conversions for vxlan/UDP socketsdrivers/net/vxlan.c+2 -00 replies
6/6l2tp: Enable checksum unnecessary conversions for l2tp/UDP socketsnet/l2tp/l2tp_core.c+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 0/6] net: Checksum offload changes - Part VI

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)
- Simplify code

What is in this seventh patch set:

- Add skb->csum. This allows a device or GRO to indicate that an invalid checksum was detected.
- Checksum unncessary to checksum complete conversions.

With these changes, I believe that the third goal of the overhaul is now mostly achieved. In the case of no encapsulation or one layer of encapsulation, there should only be at most one skb_checksum over each packet (between GRO and normal path). In the case of two layers of encapsulation, it is still possible with the right combination of non-zero and zero UDP checksums to have >1 skb_checksum. For instance:
IP>GRE(with csum)>IP>UDP(zero csum)>VXLAN>IP>UDP(non-zero csum), would likely necessiate an skb_checksum in GRO and normal path. This doesn't seem like a common scenario at all so I'm inclined to not address this now, if multiple layers of encapsulation becomes popular we can reassess.

Note that checksum conversion shows a nice improvement for RX VXLAN when outer UDP checksum is enabled (12.65% CPU compared to 20.94%). This is not only from the fact that we don't need checksum calculation on the host, but also allows GRO for VXLAN in this case. Checksum conversion does not help send side (which still needs to perform a checksum on host). For that we will implement remote checksum offload in a later patch
(http://tools.ietf.org/html/draft-herbert-remotecsumoffload-00).

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

----

Test results with this patch set are below. I did not see any obvious performace regression.

Tests run:
TCP_STREAM: super_netperf with 200 streams

Device bnx2x (10Gbps):
VXLAN UDP RSS port hashing enabled, UDP RX checksum offload supported.

* VXLAN with checksum
With fix:

    TCP_STREAM
        12.65% CPU utilization
        9093.81 Mbps
  Without fix:
    TCP_STREAM
        20.94% CPU utilization
        9094.21 Mbps

* VXLAN without checksum
With fix:

    TCP_STREAM
        24.59% CPU utilization
        9080.96 Mbps
  Without fix:
    TCP_STREAM
        24.69% CPU utilization
        9081.39 Mbps

Tom Herbert (6):
net: Support for csum_bad in skbuff
net: Infrastructure for checksum unnecessary conversions
udp: Add support for doing checksum unnecessary conversion
gre: Add support for checksum unnecessary conversions
vxlan: Enable checksum unnecessary conversions for vxlan/UDP sockets
l2tp: Enable checksum unnecessary conversions for l2tp/UDP sockets

 drivers/net/vxlan.c       |  2 ++
 include/linux/netdevice.h | 24 +++++++++++++++++++++++-
 include/linux/skbuff.h    | 41 ++++++++++++++++++++++++++++++++++++++++-
 include/linux/udp.h       | 16 +++++++++++++++-
 net/core/dev.c            |  2 +-
 net/ipv4/gre_demux.c      |  4 ++++
 net/ipv4/gre_offload.c    |  8 ++++++--
 net/ipv4/udp.c            |  4 ++++
 net/ipv4/udp_offload.c    | 25 +++++++++++++++++--------
 net/ipv6/udp.c            |  4 ++++
 net/ipv6/udp_offload.c    | 24 +++++++++++++++++-------
 net/l2tp/l2tp_core.c      |  2 ++
 12 files changed, 135 insertions(+), 21 deletions(-)
Signature · 1 line
2.1.0.rc2.206.gedb03e5