Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6237187iob; Tue, 10 May 2022 13:37:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmE1ExKWuLpVIM5bgAY7bLQLalktaFcNseUTPKZF8geDhtW9FQ8Bfe40LWi8hA0qHtaDzy X-Received: by 2002:a17:907:960d:b0:6f4:3b68:8d55 with SMTP id gb13-20020a170907960d00b006f43b688d55mr21320229ejc.105.1652215036826; Tue, 10 May 2022 13:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652215036; cv=none; d=google.com; s=arc-20160816; b=vkHh4Q7H9+hLDv/n9psXsXhL64Dd8azRHiSMBUtkhPCPwf5pCy7vA2DGDBAgPstkpm 0oT1UjUBtoOzlDsFIX0PfnCNi/cSqEC6RIv7D+U3c4Jyul6h/lPtgA+o1DbQdBF3dsfM mWgU+tDPjGd0fhj8e6VZ3uc7Nd2H7uBdkhXc1kqfJgOLMsgPRTXt5Jn19vEPMtdU85M1 yMetb151wqD8EPTy57jX4q3L98vDqr0tTRrQH/uJLma86sp4rz6jXpg0e/rNOGTmhfXc stqcDRQDG4m7JYJEgMd+dy8K2v3H4jbiwus1urvJB4u26DqBj97E5/CQinD+hAKIT40I cH1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cosidqETohHtF0bI5X8WaN3KLjN3jNK+X2ZAPFOKt/o=; b=v4vfkck7gAhwn3e2dyE1dL3z1qeYvw7RMk8RBa0gaEIGmw+zUyC9ucVM9RC3dz/CEd 7mvMa8uqtDPpVchJDVcBEu5styX67kldj808rD2QG+yA4rHmdNluMLiSezZyrsXUWYfv 4oFMAl6juLH4u5W6s1AiN8jxiNX0PRgy2DhIC7If1xsI0qaLGL7CTv9np71F6vaz0czT aSFj1zQo2e2D8DZZGQQH0cvzX0U4LVZAPZAjLrPfckztyB/GbBahc8eM/jrfdbkWsdqo I3sA3pLETs8XyqJ1oP+CMJlRdCLHElgkN9RyoUpwu+eRKKJztBMnjCPgUFhKd+UqkiId CK7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q4WK37dx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u24-20020a056402111800b00427f937dbd5si291443edv.22.2022.05.10.13.36.53; Tue, 10 May 2022 13:37:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q4WK37dx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236963AbiEJMl1 (ORCPT + 99 others); Tue, 10 May 2022 08:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241881AbiEJMl0 (ORCPT ); Tue, 10 May 2022 08:41:26 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0A941E123B; Tue, 10 May 2022 05:37:28 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id n10so32656659ejk.5; Tue, 10 May 2022 05:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cosidqETohHtF0bI5X8WaN3KLjN3jNK+X2ZAPFOKt/o=; b=q4WK37dxm2Rg4AHUGk7Wi4kVtwYOHay21u/XuI4XfzNMEyT71Bvff7CmdlnIImsooi L9KZIsHxZVuWcbld60k2dRE1nqPdvX9iUDQ/esPVHs7fcjwcgF7tkxvdGJpoR7XYudXS muSWsZuXTbqKGCFiSWFmdAHNrCg+ULsFjyrHjBA46B/e3zy9cUsu67O3uGCKSvgG133o 4hrnYv3h1uEIGEvcaT4O2aifRc6c/kxWAjp3TYhEdZLe/7JVVeLFsV+lyb3uIBNdTlUH 0kc5vhNXi72hrStZ8d+wUYkAQooUtteY91qjzO6B48GYNOdakRtplEzhT6qK2XZcu76a nlLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cosidqETohHtF0bI5X8WaN3KLjN3jNK+X2ZAPFOKt/o=; b=On5feP6X8k8BvKNcBy6Ld9fFhkOG1BGTamqu1S1w0MRPKGfgP1yjvT+Kv9Mj+9t0Nu SU5JffuxOUpNFkzYwOocx7Do91bHsiKG0DmsEL4RBuwgK5EkIvORpdUCgbWCP7Pty/b5 g22tTm/5stQAS7I5QV1TF9wsVROfnuwj4QXOgvlPagNm6Blpy4uJAekOvv1CykIddDcB nTLfCP0Q1Oqau81tdJVUeAOgH9Dir0eQF6E5vgrYKor5vc63wCIMs8qWJwxh3OLzY44f XW6F5hbCEJb7ouD4LP5t7n940Y9OdOQlHg95eY1F6G8YcdR5DTg0AmTyrT+GBlunV/XV 2ANw== X-Gm-Message-State: AOAM531/WgVpUGAzAm1Qydmhk5uT3jhsTFTXnu71zlXNsfSNT58yZPQl LlOOlj42uaj+OEOjUfNsc/8= X-Received: by 2002:a17:906:3ce9:b0:6ef:a8aa:ab46 with SMTP id d9-20020a1709063ce900b006efa8aaab46mr19291235ejh.579.1652186247272; Tue, 10 May 2022 05:37:27 -0700 (PDT) Received: from skbuf ([188.25.160.86]) by smtp.gmail.com with ESMTPSA id e15-20020a50e44f000000b0042617ba63c7sm7576578edm.81.2022.05.10.05.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 05:37:26 -0700 (PDT) Date: Tue, 10 May 2022 15:37:24 +0300 From: Vladimir Oltean To: Felix Fietkau Cc: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] net: dsa: tag_mtk: add padding for tx packets Message-ID: <20220510123724.i2xqepc56z4eouh2@skbuf> References: <20220510094014.68440-1-nbd@nbd.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220510094014.68440-1-nbd@nbd.name> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Tue, May 10, 2022 at 11:40:13AM +0200, Felix Fietkau wrote: > Padding for transmitted packets needs to account for the special tag. > With not enough padding, garbage bytes are inserted by the switch at the > end of small packets. I don't think padding bytes are guaranteed to be zeroes. Aren't they discarded? What is the issue? > > Fixes: 5cd8985a1909 ("net-next: dsa: add Mediatek tag RX/TX handler") > Signed-off-by: Felix Fietkau > --- > net/dsa/tag_mtk.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c > index 415d8ece242a..1d1f9dbd9e93 100644 > --- a/net/dsa/tag_mtk.c > +++ b/net/dsa/tag_mtk.c > @@ -25,6 +25,14 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, > u8 xmit_tpid; > u8 *mtk_tag; > > + /* The Ethernet switch we are interfaced with needs packets to be at > + * least 64 bytes (including FCS) otherwise their padding might be > + * corrupted. With tags enabled, we need to make sure that packets are > + * at least 68 bytes (including FCS and tag). > + */ > + if (__skb_put_padto(skb, ETH_ZLEN + MTK_HDR_LEN, false)) > + return NULL; > + > /* Build the special tag after the MAC Source Address. If VLAN header > * is present, it's required that VLAN header and special tag is > * being combined. Only in this way we can allow the switch can parse > -- > 2.36.1 >