lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 5 Oct 2015 16:39:21 -0700
From:	Tom Herbert <tom@...bertland.com>
To:	<davem@...emloft.net>, <netdev@...r.kernel.org>
CC:	<kernel-team@...com>, <dwmw2@...radead.org>,
	<ogerlitz@...lanox.com>
Subject: [PATCH RFC 0/3] net: Add driver helper function to determine if checksum is offloadable

When drivers have support for offloading transport IP checksums, they
will indicate this in the features for the device. As described in
skbuff.h, a driver will usually advertise NETIF_F_HW_CSUM,
NETIF_F_IP_CSUM, and/or NETIF_F_IPV6_CSUM. The first of these
(NETIF_F_HW_CSUM) is the preferred method since this implies that the
device has implemented a generic checksum offload feature that should
work under arbitrary scenarios (e.g. for different protocols, with or
without encapsulation).

For narrow features support (NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM
for offload of TCP/UDP), the features flags may not be sufficient to
deduce whether a packet may be offloaded. Some devices will not be able
to offload encapsulated checksums, some cannot offload transport
checksums in packet with IPv6 extension headers, etc. In these cases
a driver will need to perform additional packet inspection to determine
if a packet's checksum can be offloaded to a device.

This patch defines a helper function that drivers can call to check if
it is able to offload the checksum for a particular packet. In an
argument to the function, the driver specifies what type of packets it
is able to offload to a device. The function is intended to check for
the most common restrictions of devices (like by IP version, transport
protocol, encapsulation, extension headers). Since the function includes
checks for IP version and transport protocol, the driver is able
to advertise NETIF_F_HW_CSUM instead of protocol specific support.
This should put us on a path to deprecate NETIF_F_IP_CSUM and
NETIF_F_IPV6_CSUM.

The helper function may be called from ndo_features_check or the xmit
routine of the driver. The csum_help argument does not need to be set
when the function is called from ndo_features_check.

Note that the helper function is intended to verify checksum
offloadability in the non-LSO case. Checksum offload as part of LSO
should be validated as part of GSO offload checks (through NETIF_F_GSO_*
flags and work done in ndo_features_check).

In this patch set:
- Added skb_csum_offload_chk function
- Call skb_csum_offload_chk from mlx4

Testing:

Ran 200 netperf TCP_RR to see impact of calling skb_csum_offload_chk
for every packet. Did not observe any noticeable regression. Perf shows
that the function was 0.20% utilization which puts it pretty far down
the list.

Tom Herbert (3):
  net: Add skb_inner_transport_offset function
  net: Add driver helper function to determine checksum offloadability
  mlx4: Call skb_csum_offload_check to check offloadability

 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |   6 +-
 drivers/net/ethernet/mellanox/mlx4/en_tx.c     |  20 +++-
 include/linux/netdevice.h                      |  47 +++++++++
 include/linux/skbuff.h                         |   5 +
 net/core/dev.c                                 | 129 +++++++++++++++++++++++++
 5 files changed, 199 insertions(+), 8 deletions(-)

-- 
2.4.6

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ