Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4372154ioa; Wed, 27 Apr 2022 02:15:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+E1r2KD7koSScQZyND28YQWNVk/PtBLMXOXJmJ7iBveCylRiEJ2rHuQXF/4kbCXTJU/Fs X-Received: by 2002:a17:902:ecc1:b0:15d:242c:477f with SMTP id a1-20020a170902ecc100b0015d242c477fmr11520554plh.62.1651050901020; Wed, 27 Apr 2022 02:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651050901; cv=none; d=google.com; s=arc-20160816; b=fnZA4vpzi2WRiUdMoIcSIoR8VDx3YrK/l5Wy+/pg0D5iOFPkpFOQbCCbTTRkSSd3Ld HfrgvbVLAovCurKzxmulaG6YqCEDBT08UsHP6VlQOp6kupVSg7Gd981aNJ+ZcRKrV4nh 8YmtMsLW+aUoOzzPHSEf/DOLzqas0GPNAXdoeaFewS5u3KU5f7ToOhLy0+gLRq29/njU /wRy84Z0pmmUnRVXD+lD3pEgHbkOSh4sxzYt6Fwh9PM18+x6225Nk5AYeXpGcKeluOz9 7nWFTDq7ZeXJDxYZmVWmwTLMftpR3ORLpdYmv//2vJGFjmjRqnBg0QwgWvG1gk7If8Rt OLiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hk27Yu0f5Fss1mA6gU809G9taU3mvBAt1ENpKOCwg0A=; b=EEps+1NJmORY1GEY5xnOHX2ACOF4FE+1BPdUjWhs67/EpbbBmfc4lXhvxOx1a++BLC PeHsHbBK/6f2OdpeCeuqMEfRc5nlkIILbI+cLTjHsVS8aJvvfN3QrQE0UiyX+Fj6llih lNWuN8OisFTwekluf9GPKTT9frCFAF7PXOsWSOYn/bNLYaLaA8LF95kY5GwBOVdTjAEs CnQEJMes6AcIrbvO3LvYR5/K1rY9sVxbszJOmFb8Nt2ZM/0Bz0GDewa6RntaNhbQArTj 8LsKkhkVglJD/EQWoHYGxyoe1OULYWu38Wtm8AjMN+MgJT87/+keX56+jSabVuWAe7Rg Plbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=unAd7+PU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ju10-20020a17090b20ca00b001d285255f40si4873931pjb.32.2022.04.27.02.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 02:15:01 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=unAd7+PU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B91C1111; Wed, 27 Apr 2022 02:04:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347578AbiDZJOi (ORCPT + 99 others); Tue, 26 Apr 2022 05:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347252AbiDZIvP (ORCPT ); Tue, 26 Apr 2022 04:51:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E8DC29C; Tue, 26 Apr 2022 01:40:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B62BCB81CF0; Tue, 26 Apr 2022 08:40:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07FE9C385A4; Tue, 26 Apr 2022 08:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962399; bh=c4tV8qVMiEPhY0Aru+SR6B5J65uqhDU1LrLy5WMOB+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=unAd7+PUnXCNRyJHnoJ43UxmaFQvXPXCD3Ff3TE+fGRp66ruMKWJf/D7S80TwlzZ5 S9CHkY2h3GtrilQvBBPEjw35B6JLpIEAHsHnLvNrvDOoWqhBcJ4D/rWFSkMChM6KO2 HQP8WuicPCt9ca0M0ahelca8sJ2qDHS0TUaGvY8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kurt Kanzenbach , Florian Fainelli , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 043/124] net: dsa: hellcreek: Calculate checksums in tagger Date: Tue, 26 Apr 2022 10:20:44 +0200 Message-Id: <20220426081748.526546166@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kurt Kanzenbach [ Upstream commit 0763120b090418a5257402754e22a34227ae5f12 ] In case the checksum calculation is offloaded to the DSA master network interface, it will include the switch trailing tag. As soon as the switch strips that tag on egress, the calculated checksum is wrong. Therefore, add the checksum calculation to the tagger (if required) before adding the switch tag. This way, the hellcreek code works with all DSA master interfaces regardless of their declared feature set. Fixes: 01ef09caad66 ("net: dsa: Add tag handling for Hirschmann Hellcreek switches") Signed-off-by: Kurt Kanzenbach Reviewed-by: Florian Fainelli Link: https://lore.kernel.org/r/20220415103320.90657-1-kurt@linutronix.de Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/dsa/tag_hellcreek.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/dsa/tag_hellcreek.c b/net/dsa/tag_hellcreek.c index f64b805303cd..eb204ad36eee 100644 --- a/net/dsa/tag_hellcreek.c +++ b/net/dsa/tag_hellcreek.c @@ -21,6 +21,14 @@ static struct sk_buff *hellcreek_xmit(struct sk_buff *skb, struct dsa_port *dp = dsa_slave_to_port(dev); u8 *tag; + /* Calculate checksums (if required) before adding the trailer tag to + * avoid including it in calculations. That would lead to wrong + * checksums after the switch strips the tag. + */ + if (skb->ip_summed == CHECKSUM_PARTIAL && + skb_checksum_help(skb)) + return NULL; + /* Tag encoding */ tag = skb_put(skb, HELLCREEK_TAG_LEN); *tag = BIT(dp->index); -- 2.35.1