From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A479C47E48 for ; Wed, 14 Jul 2021 20:15:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3E83613AB for ; Wed, 14 Jul 2021 20:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236858AbhGNUSX (ORCPT ); Wed, 14 Jul 2021 16:18:23 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:55308 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235375AbhGNUSV (ORCPT ); Wed, 14 Jul 2021 16:18:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=altrnMbv/SB0Yb2YLSOF3NFD8ceIafb8UlwRDHdGk5c=; b=Kf2bamw41gyVk9J93clDShPKGc 7NnRaxZ51iRZoISV69nj9kWVt4wHFdbNTM38lQmeQTWBpYsz8N9t90xMqv4e49tpq6BK1MXXpei/n g2+IGvtR4t5ZmqWRupR2aoiFiWwU2cOZ4zublW+95owFClINB5E8ct9TVd1EIsq+E3Oc=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1m3lHs-00DOVJ-87; Wed, 14 Jul 2021 22:15:20 +0200 Date: Wed, 14 Jul 2021 22:15:20 +0200 From: Andrew Lunn To: Vladimir Oltean Cc: Lino Sanfilippo , woojung.huh@microchip.com, UNGLinuxDriver@microchip.com, vivien.didelot@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] net: dsa: tag_ksz: dont let the hardware process the layer 4 checksum Message-ID: References: <20210714191723.31294-1-LinoSanfilippo@gmx.de> <20210714191723.31294-3-LinoSanfilippo@gmx.de> <20210714194812.stay3oqyw3ogshhj@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210714194812.stay3oqyw3ogshhj@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 14, 2021 at 10:48:12PM +0300, Vladimir Oltean wrote: > Hi Lino, > > On Wed, Jul 14, 2021 at 09:17:23PM +0200, Lino Sanfilippo wrote: > > If the checksum calculation is offloaded to the network device (e.g due to > > NETIF_F_HW_CSUM inherited from the DSA master device), the calculated > > layer 4 checksum is incorrect. This is since the DSA tag which is placed > > after the layer 4 data is seen as a part of the data portion and thus > > errorneously included into the checksum calculation. > > To avoid this, always calculate the layer 4 checksum in software. > > > > Signed-off-by: Lino Sanfilippo > > --- > > This needs to be solved more generically for all tail taggers. Let me > try out a few things tomorrow and come with a proposal. Maybe the skb_linearize() is also a generic problem, since many of the tag drivers are using skb_put()? It looks like skb_linearize() is cheap because checking if the skb is already linear is cheap. So maybe we want to do it unconditionally? Andrew