Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2712595pxu; Sun, 29 Nov 2020 02:32:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyq4Olw9a41D4SD/TUpjf147Z5M2Hf+WgQzNkEFAng1sdJaHzJKZnU3cdyxdKvSY2Rc8daN X-Received: by 2002:a17:906:350f:: with SMTP id r15mr15736721eja.507.1606645935156; Sun, 29 Nov 2020 02:32:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606645935; cv=none; d=google.com; s=arc-20160816; b=t/5MUjbg2k0RrF7qn+Kjp3S96vm9Fd2dgqahYS2Im94uU4MR25B5fGz13UKrkxcqIv 50G4MBM6IFX4tla34+GgpfhPDjUfmL1qr5Aul9Lr2Ndz+oRNPkPVcqAUL1LlQa9+zj/3 lgskuLX8SdrierT4azKsQrtxzRoxR2kTfXXznjIpcPrdoGYS948chvguGexPgpOoDs5t 3y4FE1hlIgS9JNb/b/3/m7jbdu1Q3RdOAnzQsvxiUifWya2mP3dsezIkyWptHgy4ynEG piwp4h4JUQDyfZmVlFXpLHdc7Uj1SKamXD6ws+nj37o9q3LU8ayCLvh8Kn2g2KoCvGIO JIxg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=XfQxuv+mk4On68Z9GyUaCS9f7676/xjDmg+HojCRC94=; b=i8oqOnL8sVCFeOrnud24JN0Mc02ledMexLCEqVr42l3SCzT1aouynl5WM0LZtWSUVU nQuXlV09TVERmdIyYs9SiX62qlbzpxwXMSgF+fxExFKhQf660YaFI37aqjBS4+AL2VNd CEBs3OhDKQnceyLx0jDlitf2X11jQJytTxg3VrxLYAj2ljRUaNyE92oGc3UYCUTcyhv0 5wbYJXc8l/ZsjN+ld2gmp84yqu42hZMEaVP/Y0kS0oLDc3Wgwz6hyPrp8twCLrWVKeSY +gzAK5HnLRic6DhSF9ktIDICnUsFq4AUccxVDHGQFemKqfMw0DCSM92ofgO5JpZ+grpm jd+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@newoldbits-com.20150623.gappssmtp.com header.s=20150623 header.b="JYJ561j/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu25si8696325ejb.703.2020.11.29.02.31.52; Sun, 29 Nov 2020 02:32:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@newoldbits-com.20150623.gappssmtp.com header.s=20150623 header.b="JYJ561j/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727073AbgK2KYw (ORCPT + 99 others); Sun, 29 Nov 2020 05:24:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbgK2KYv (ORCPT ); Sun, 29 Nov 2020 05:24:51 -0500 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 775EDC0613D2 for ; Sun, 29 Nov 2020 02:24:11 -0800 (PST) Received: by mail-ej1-x644.google.com with SMTP id jx16so14429785ejb.10 for ; Sun, 29 Nov 2020 02:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newoldbits-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XfQxuv+mk4On68Z9GyUaCS9f7676/xjDmg+HojCRC94=; b=JYJ561j/wsTKdlH9aN2rEexJtlr/7xBM3z9jiIZ3tCP8MaeKKESMUTI02S62iUqqoV O5dPlx+lYfLpNt8Ia5FoT/gpswGc9qnakRS9UfVaYcLr1pJw7q+0i7VThiyMkFcRAIWZ am6Xk+sj7n3xOTgrFG/BrVqG5m60YFPIeORC7B0lYlBzXVv79pTmj2qeit0AUWuZc2K5 Df7BRQnIsC9z8Xn5I4YqWphGPS2qfHFhcWAjOvDe22fxBBSGiLarNpY7X9Bf5kiq2q2w 95GBlUd/VS3SGnIk1d3esSjgkLMbXJb9jPIxrVjfEnjEIkCC176PfM73Oqh0Jx1nr2mx CBDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XfQxuv+mk4On68Z9GyUaCS9f7676/xjDmg+HojCRC94=; b=Jpj/rrBS3PKgmBkp5Ohc2F+ngL0jXxxMwNqLJMQjM0lxUPkCFSuxs/vbFGKAsw0yOI G7pMM6qVsqAyV1TycCvqX+VrkvOmI6HHRAP9hxg9eAOsnPgx7vmyAQ0aBM3b5TmPRbK0 BVIwLsZuC8OBdY9gYceb7/aLa4/zJWm3a5bT3965viSd4M87erY93h1hrKErPZI7CuF2 MTk+q3xh5uU6tJGtgQDqCi4aWWvdKO5uVvH94S8L9d61FkggBe5Q8sSYEAFv8wj65yRK fpvEDtHdk0hnlEXNVZJfys8fTqJJ11F9ngst9lz1JrjPT8CZurwJ4niJTfDbwrPIU3p7 6JwQ== X-Gm-Message-State: AOAM532x+MqrllvBOAADxcpkbLBOgSz2D+beUuqeq7ABzZ6TJntSXiAN 4LN2ZumHa5la6ab82TVTFmiIPQ== X-Received: by 2002:a17:907:94c6:: with SMTP id dn6mr15932735ejc.13.1606645450218; Sun, 29 Nov 2020 02:24:10 -0800 (PST) Received: from nuc1.lan (208.2-240-81.adsl-dyn.isp.belgacom.be. [81.240.2.208]) by smtp.gmail.com with ESMTPSA id gq19sm4605244ejb.10.2020.11.29.02.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 02:24:09 -0800 (PST) From: Jean Pihet To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ryan Barnett , Conrad Ratschan , Hugo Cornelis , Arnout Vandecappelle , Jean Pihet Subject: [PATCH 1/2] net: dsa: ksz: pad frame to 64 bytes for transmission Date: Sun, 29 Nov 2020 11:23:59 +0100 Message-Id: <20201129102400.157786-1-jean.pihet@newoldbits.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some ethernet controllers (e.g. TI CPSW) pad the frames to a minimum of 64 bytes before the FCS is appended. This causes an issue with the KSZ tail tag which could not be the last byte before the FCS. Solve this by padding the frame to 64 bytes minus the tail tag size, before the tail tag is added and the frame is passed for transmission. Signed-off-by: Jean Pihet --- net/dsa/tag_ksz.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index 0a5aa982c60d..0074702dcbbc 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -19,8 +19,13 @@ static struct sk_buff *ksz_common_xmit(struct sk_buff *skb, { struct sk_buff *nskb; int padlen; + const int min_len = ETH_ZLEN + ETH_FCS_LEN; - padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len; + /* + * Pad to the minimum ethernet frame size, minus the size of the + * tail tag which will be appended at the very end, before the FCS. + */ + padlen = (skb->len >= min_len) ? 0 : min_len - skb->len - len; if (skb_tailroom(skb) >= padlen + len) { /* Let dsa_slave_xmit() free skb */ -- 2.26.2