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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19B88C46CD2 for ; Tue, 2 Jan 2024 20:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ybvwN2z6KU9PO40AI2gUO6WBs9fsS+oV2SdeiavE9UU=; b=g/S1Bac5EDPLKc bUeJfjW7RIthlLLt6yRg75BfHE2KFwui3r1QOdW5DZZXwGrhQKUaedFoWgxctoo680k/VUAlBrKlT 7NL4Wa92DCYMeKMmXHU+hqNGgBKol7XtlPiI26rw5z5rdhCUX2GjiX/1HeYtpHMckjfGHjSgzUkCS ymuBtdAl033jKxscoiZadrcT34dSZDMyhlmChjjTBZX43OMVtwWs3Mm/dsPBIUlhg7UdRwzr/eYP8 AqVxXzZbCRYciFOmK7Otip9mM8WHuhT9kcyZqQ+8j0pyJODSk6OPW09+tVjvairWXPMIgQ6D3ERUe YVhb9Vn1lEYFBTVvkYaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rKlLf-008vrd-0z; Tue, 02 Jan 2024 20:26:51 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rKlLb-008vqB-0l for linux-arm-kernel@lists.infradead.org; Tue, 02 Jan 2024 20:26:49 +0000 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3bbd7d60729so3399983b6e.0 for ; Tue, 02 Jan 2024 12:26:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704227202; x=1704832002; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ND+OLXd8ysMaukWUwVdTBQu9Bq4kTBqMzqgELsTouEM=; b=XnfeBjZBDnuIupc99uFjlOHgGIk7OvaFl1yZsYSk5Pt9zuK3UopUjG9wHx53ZfqAMz QCPQpuX8WEtzsGbUYiJKQ3+7vG+Ard6qqq3e+TpcBfGbstHcQHZ+yDQQIAriZP6/K5b7 okhnJBJxvBm3f6aGU149VsfXUXpajejsr/l/hNKj6Se0GXdn/ieau6zRtb1S/5pacndv /OdJp+Et3mstw8+Z3zrCrCNv/RPUu3spcxrCzCPm7c3FbT/0mE/5y2IdJ8D7hOEM8VYh NlTkP2IeSOh/qwENQo0toeGF/qJU6en9FgfWvd2CWfViGj/Bc+6qHSKw/RQjsmiXC+ix 7SaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704227202; x=1704832002; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ND+OLXd8ysMaukWUwVdTBQu9Bq4kTBqMzqgELsTouEM=; b=gpmd8lWNNo5Fnep4t442mhjsjST0+aZiewqtoME3r7Dxqxk2TwWm/2BZBoQFOU553Q 0J1EexzqvZ7inRVerH35PiBthUyDmyQT6V+GqVAvUp2ibMyTHYutHTs5jcwMTFTdvQgg S/rLjwGz/TWcnCrTGzocty3rE1SLDA2Mf+hliRIJ1W5Alakc3wy2j5HGGceCE7k2hvZn J4QVku71b6AqR6c95ksI/cQkEA/QG2ZAbzqNEMIeYKQLkfzJdxrrIJQbf6UwIurQcD9T lEVQyPEE1zq6bkDil+tmMr+XCh1PfFI6Ec4zgSQIeAiUCJmxV0KuINWi7NUs+p27Ya9w Gdng== X-Gm-Message-State: AOJu0YxOxcpQVHX3QtlLhW0jjJQO+ilbOHNI0pCV3qqgjR4+LG9GelEW E013TYrrfSKK2ECX8izcPBs= X-Google-Smtp-Source: AGHT+IECf2pCqyhQfLb0z19B9usr5kRSPtS6GrVnfDloU3HnQVX6HP0jstc9NMMeueOf/oK5pNIl0A== X-Received: by 2002:a05:6808:18a8:b0:3bc:187b:545c with SMTP id bi40-20020a05680818a800b003bc187b545cmr1915272oib.57.1704227201778; Tue, 02 Jan 2024 12:26:41 -0800 (PST) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id n3-20020ad444a3000000b00680b1090832sm1898429qvt.146.2024.01.02.12.26.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jan 2024 12:26:40 -0800 (PST) Message-ID: Date: Tue, 2 Jan 2024 12:26:36 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v2 1/1] net: stmmac: Prevent DSA tags from breaking COE on stmmac Content-Language: en-US To: Romain Gantois , Alexandre Torgue , Jose Abreu Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Miquel Raynal , Maxime Chevallier , Sylvain Girard , Vladimir Oltean , Andrew Lunn , Pascal EBERHARD , Richard Tresidder , Linus Walleij , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org References: <20240102162718.268271-1-romain.gantois@bootlin.com> <20240102162718.268271-2-romain.gantois@bootlin.com> From: Florian Fainelli In-Reply-To: <20240102162718.268271-2-romain.gantois@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240102_122647_291726_29D19EF8 X-CRM114-Status: GOOD ( 20.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 1/2/24 08:27, Romain Gantois wrote: > Some DSA tagging protocols change the EtherType field in the MAC header > e.g. DSA_TAG_PROTO_(DSA/EDSA/BRCM/MTK/RTL4C_A/SJA1105). On TX these tagged > frames are ignored by the checksum offload engine and IP header checker of > some stmmac cores. > > On RX, the stmmac driver wrongly assumes that checksums have been computed > for these tagged packets, and sets CHECKSUM_UNNECESSARY. > > Add an additional check in the stmmac tx and rx hotpaths so that COE is > deactivated for packets with ethertypes that will not trigger the COE and > ip header checks. > > Fixes: 6b2c6e4a938f ("net: stmmac: propagate feature flags to vlan") > Cc: stable@vger.kernel.org > Reported-by: Richard Tresidder > Closes: https://lore.kernel.org/netdev/e5c6c75f-2dfa-4e50-a1fb-6bf4cdb617c2@electromag.com.au/ > Reported-by: Romain Gantois > Closes: https://lore.kernel.org/netdev/c57283ed-6b9b-b0e6-ee12-5655c1c54495@bootlin.com/ Fairly sure those should be Link: and Closes: should be used for bug tracker entries. > Signed-off-by: Romain Gantois > --- > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 37e64283f910..bb2ae6b32b2f 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -4371,6 +4371,17 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) > return NETDEV_TX_OK; > } > > +/* Check if ethertype will trigger IP > + * header checks/COE in hardware > + */ > +static inline bool stmmac_has_ip_ethertype(struct sk_buff *skb) > +{ > + __be16 proto = eth_header_parse_protocol(skb); > + > + return (proto == htons(ETH_P_IP)) || (proto == htons(ETH_P_IPV6)) || > + (proto == htons(ETH_P_8021Q)); Do you need to include ETH_P_8021AD in that list as well or is not stmmac capable of checksuming beyond a single VLAN tag? Thanks! -- Florian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel