On Tue, Sep 29, 2015 at 12:12 AM, David Woodhouse <dw...@infradead.org> wrote: > On Mon, 2015-09-28 at 20:04 -0700, Tom Herbert wrote: >> >> > I've been pondering a bit of a redesign in this space. I think the >> > skb struct should be explicit in its instructions to hardware for >> > which offloads to do for each packet. >> > >> > In this way, the stack would be *directly* telling the drivers what to >> > do (and what not to do), solving all sorts of bugs and really improving >> > driver reliability and implementation. >> > >> Doesn't CHECKSUM_PARTIAL with csum_offset and csum_start already tell >> the driver unambiguously what to do wrt checksum offload? > > Right. That's precisely what we *do* have. But as things stand, we > can't *use* it to its full capability. > > It's fine for decent devices which can handle such explicit > instructions (advertised by the NETIF_F_HW_CSUM feature). > > The problem is the crappy devices that can *only* checksum UDP and TCP > frames, advertised with the NETIF_F_IP{V6,}_CSUM features. We make a > primitive attempt *not* to feed arbitrary checksum requests to such > hardware. But we fail — we end up feeding *all* Legacy IP packets to a > NETIF_F_IP_CSUM device, and *all* IPv6 packets to a NETIF_F_IPV6_CSUM > device, regardless of whether they're *actually* TCP or UDP packets. > Please look at ixgbe_tx_csum in ixgbe driver. This one example of how a driver can determine whether the checksum being offloaded is TCP or UDP. The bug in this driver is that skb_checksum_help is not called for a protocol the driver isn't looking for. In particular, I believe this driver will probably send packets with invalid checksums when TCP/UDP is used with IPv6 packets that contain extension headers.
Tom > That's the problem I'm trying to solve. And then we *can* make full use > of the generic checksum offload (I had it working for ICMPv6 at one > point: http://lists.openwall.net/netdev/2013/01/14/38 ). > > -- > David Woodhouse Open Source Technology Centre > david.woodho...@intel.com Intel Corporation > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html