netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, alexander.duyck@gmail.com,
	dmichail@google.com, Willem de Bruijn <willemb@google.com>
Subject: [PATCH net-next 00/10] udp gso
Date: Wed, 25 Apr 2018 14:55:51 -0400	[thread overview]
Message-ID: <20180425185601.55511-1-willemdebruijn.kernel@gmail.com> (raw)

From: Willem de Bruijn <willemb@google.com>

Segmentation offload reduces cycles/byte for large packets by
amortizing the cost of protocol stack traversal.

This patchset implements GSO for UDP. A process can concatenate and
submit multiple datagrams to the same destination in one send call
by setting socket option SOL_UDP/UDP_SEGMENT with the segment size,
or passing an analogous cmsg at send time.

The stack will send the entire large (up to network layer max size)
datagram through the protocol layer. At the GSO layer, it is broken
up in individual segments. All receive the same network layer header
and UDP src and dst port. All but the last segment have the same UDP
header, but the last may differ in length and checksum.

Initial results show a significant reduction in UDP cycles/byte.
See the main patch for more details and benchmark results.

        udp
          876 MB/s 14873 msg/s 624666 calls/s
            11,205,777,429      cycles
    
        udp gso
         2139 MB/s 36282 msg/s 36282 calls/s
            11,204,374,561      cycles

The patch set is broken down as follows:
- patch 1 is a prerequisite: code rearrangement, noop otherwise
- patch 2 is the core feature
- patch 3,4,6 are refinements
- patch 5 adds the cmsg interface
- patch 7..10 are tests

This idea was presented previously at netconf 2017-2
http://vger.kernel.org/netconf2017_files/rx_hardening_and_udp_gso.pdf

Changes RFC -> v1
  - MSG_MORE:
      fixed, by allowing checksum offload with corking if gso
  - SKB_GSO_UDP_L4:
      made independent from SKB_GSO_UDP
      and removed skb_is_ufo() wrapper
  - NETIF_F_GSO_UDP_L4:
      add to netdev_features_string
      and to netdev-features.txt
      add BUILD_BUG_ON to match SKB_GSO_UDP_L4 value
  - UDP_MAX_SEGMENTS:
      introduce limit on number of segments per gso skb
      to avoid extreme cases like IP_MAX_MTU/IPV4_MIN_MTU
  - CHECKSUM_PARTIAL:
      test against missing feature after ndo_features_check
      if not supported return error, analogous to udp_send_check
  - MSG_ZEROCOPY: removed, deferred for now

Willem de Bruijn (11):
  udp: expose inet cork to udp
  udp: add gso
  udp: better wmem accounting on gso
  udp: paged allocation with gso
  udp: add gso segment cmsg
  udp: add gso support to virtual devices
  selftests: udp gso
  selftests: udp gso with connected sockets
  selftests: udp gso with corking
  selftests: udp gso benchmark

 Documentation/networking/netdev-features.txt  |   7 +
 include/linux/netdev_features.h               |   5 +-
 include/linux/netdevice.h                     |   1 +
 include/linux/skbuff.h                        |   2 +
 include/linux/udp.h                           |   3 +
 include/net/inet_sock.h                       |   1 +
 include/net/ip.h                              |   3 +-
 include/net/ipv6.h                            |   2 +
 include/net/udp.h                             |   5 +
 include/uapi/linux/udp.h                      |   1 +
 net/core/ethtool.c                            |   1 +
 net/core/skbuff.c                             |   2 +
 net/ipv4/ip_output.c                          |  41 +-
 net/ipv4/udp.c                                |  80 ++-
 net/ipv4/udp_offload.c                        |  68 +-
 net/ipv6/ip6_offload.c                        |   6 +-
 net/ipv6/ip6_output.c                         |  45 +-
 net/ipv6/udp.c                                |  31 +-
 net/ipv6/udp_offload.c                        |  19 +-
 tools/testing/selftests/net/.gitignore        |   3 +
 tools/testing/selftests/net/Makefile          |   4 +-
 tools/testing/selftests/net/udpgso.c          | 621 ++++++++++++++++++
 tools/testing/selftests/net/udpgso.sh         |  29 +
 tools/testing/selftests/net/udpgso_bench.sh   |  74 +++
 tools/testing/selftests/net/udpgso_bench_rx.c | 265 ++++++++
 tools/testing/selftests/net/udpgso_bench_tx.c | 420 ++++++++++++
 26 files changed, 1688 insertions(+), 51 deletions(-)
 create mode 100644 tools/testing/selftests/net/udpgso.c
 create mode 100755 tools/testing/selftests/net/udpgso.sh
 create mode 100755 tools/testing/selftests/net/udpgso_bench.sh
 create mode 100644 tools/testing/selftests/net/udpgso_bench_rx.c
 create mode 100644 tools/testing/selftests/net/udpgso_bench_tx.c

-- 
2.17.0.441.gb46fe60e1d-goog

             reply	other threads:[~2018-04-25 18:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 18:55 Willem de Bruijn [this message]
2018-04-25 18:55 ` [PATCH net-next 01/10] udp: expose inet cork to udp Willem de Bruijn
2018-04-25 18:55 ` [PATCH net-next 02/10] udp: add gso Willem de Bruijn
2018-04-25 20:38   ` Alexander Duyck
2018-04-25 20:51     ` Willem de Bruijn
2018-04-25 20:54       ` David Miller
2018-04-25 21:02       ` Alexander Duyck
2018-04-26 17:49         ` Willem de Bruijn
2018-04-26 17:48     ` Willem de Bruijn
2018-04-25 18:55 ` [PATCH net-next 03/10] udp: better wmem accounting on gso Willem de Bruijn
2018-04-25 18:55 ` [PATCH net-next 04/10] udp: paged allocation with gso Willem de Bruijn
2018-04-25 18:55 ` [PATCH net-next 05/10] udp: add gso segment cmsg Willem de Bruijn
2018-04-25 18:55 ` [PATCH net-next 06/10] udp: add gso support to virtual devices Willem de Bruijn
2018-04-25 18:55 ` [PATCH net-next 07/10] selftests: udp gso Willem de Bruijn
2018-04-25 18:55 ` [PATCH net-next 08/10] selftests: udp gso with connected sockets Willem de Bruijn
2018-04-25 18:56 ` [PATCH net-next 09/10] selftests: udp gso with corking Willem de Bruijn
2018-04-25 18:56 ` [PATCH net-next 10/10] selftests: udp gso benchmark Willem de Bruijn

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=20180425185601.55511-1-willemdebruijn.kernel@gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dmichail@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.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 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).