From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933126AbcKON0j (ORCPT ); Tue, 15 Nov 2016 08:26:39 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36520 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754172AbcKON0M (ORCPT ); Tue, 15 Nov 2016 08:26:12 -0500 Message-ID: <1479215490.8455.122.camel@edumazet-glaptop3.roam.corp.google.com> Subject: Re: [PATCH net-next v5] cadence: Add LSO support. From: Eric Dumazet To: Rafal Ozieblo Cc: David Miller , "nicolas.ferre@atmel.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Date: Tue, 15 Nov 2016 05:11:30 -0800 In-Reply-To: References: <20161114.123038.1075174354580074536.davem@davemloft.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2016-11-15 at 07:07 +0000, Rafal Ozieblo wrote: > > > > If UFO is in use it should not silently disable UDP checksums. > > > > > > > > If you cannot support UFO with proper checksumming, then you cannot enable support for that feature. > > > > > > According Cadence Gigabit Ethernet MAC documentation: > > > > > > "Hardware will not calculate the UDP checksum or modify the UDP > > > checksum field. Therefore software must set a value of zero in the > > > checksum field in the UDP header (in the first payload buffer) to indicate to the receiver that the UDP datagram does not include a checksum." > > > > > > It is hardware requirement. > > > > I do not doubt that it is a hardware restriction. > > > > But I am saying that you cannot enable this feature under Linux if this is how it operates on your hardware. > > Would it be good to enable UFO conditionally with some internal define? Ex.: > > +#ifdef MACB_ENABLE_UFO > +#define MACB_NETIF_LSO (NETIF_F_TSO | NETIF_F_UFO) > +#else > +#define MACB_NETIF_LSO (NETIF_F_TSO) > +#endif > > I could add precise comment here that ufo is possible only without checksum. > > Or maybe I could enable it from module_params or device-tree (like: drivers/net/ethernet/neterion/s2io.c). No you can not do that. 1) That would violate UDP specs. 2) Module params are no longer accepted. 3) Comments in a driver source code would only help the driver maintainer, not users to make their mind. Only way would be to propagate the intent of the sender. Only the sender application can decide to generate UDP checksums or not. Your driver ndo_features_check() could then force software segmentation fallback if the user did not asked to disable UDP checksums, and packet is UFO. (look for UDP_NO_CHECK6_TX, and SO_NO_CHECK ) Problem is complex, because the skb has no marker, only the socket has. And socket state could change between packets, and packets can stay in an intermediate qdisc before hitting device driver. So looking at skb->sk from your ndo_features_check() would be racy. What use case would you have precisely ?