Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3959454pxb; Mon, 4 Oct 2021 13:43:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWzsw7qGg7ZW1ObwegmzV1o35QenmpYfF1VDQ1cnY2NjAzcKtHhFHlUWl5wNwUDpzXtjRr X-Received: by 2002:a17:906:7007:: with SMTP id n7mr19184296ejj.275.1633380202037; Mon, 04 Oct 2021 13:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633380202; cv=none; d=google.com; s=arc-20160816; b=Pc+4WYnABAq9W/nyZ4goc8D9qwUzx0nzdt5fx6inw+hVWa08YwocaY2kbLuCkeNOHH SPm1GDpDxevWZwxgc7nyFyAcA8iPAYxZ6aGqZXcWNrYCRTsMSR+KnjO0XszcvvaUbnFe Djeq38xlSTLGmwblu00dhxKNnhzI2zaQntSdsJdrlJEE/mlYnQQvB7aJbN6hiL/OZIbv ossrZkY66GFdSFm52v2rReV1PUJCYHfe3ACWyIPF2p90AndlYRPj53FK9/hp2AmkUVyC uZxsa9MhP1LQzaWkin14lFt0arHshrI8wPeEtR94C1QZMY3IM6N0crLWWQ4/gGr4GFTl 3ECg== 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=jisrI0LDJUw6XHCM2FHfBaiWEmSti4Z4eAykOsvTgvs=; b=dfYww+EHk1a5BzvPcioJWJz2rcenn5Ujo06Z6lb9VO0CXfA8W65X5xNV9zRhTepQv8 FsGW55oBsVJsooxnHTJfQVq4kG5GQ4BRe3g/ebQbkJeIGiRmOqE2Z5kg1fDYtqDm4ib0 sWnrLBQfqdphqPAAQQG3MyO9enOGGw/61pfqAWelWkRHGz3gS6fp9rlrOL0fx4e1r+Vg W4KPyLy76Yy69jEKCwwozwBGt6ZW3hCUAhiAK7E17rVzt16kOiX0L3fkyDu/PkKXs+OC 89+u1t2PDSej2ynL0YBa4mS2UQo4HUdjNrTy5NZEhhxdDu6e1Fy8IrB5Ab5VbMQzW8gI oJTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="c/lPyX1q"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si24162924edp.348.2021.10.04.13.42.56; Mon, 04 Oct 2021 13:43:22 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b="c/lPyX1q"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237767AbhJDNiB (ORCPT + 99 others); Mon, 4 Oct 2021 09:38:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:48814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237986AbhJDNfq (ORCPT ); Mon, 4 Oct 2021 09:35:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6275961BA8; Mon, 4 Oct 2021 13:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353383; bh=YjiCTESwpqcDToF41uSRlXF7ZBEfd7NrEwTMAzHJm7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c/lPyX1qRnMxoCwG2iFL2+iYtSXd1XQAf0iXQRUcMyPj++3aIHgEGMMftUWP/P4g8 CjcSEhPqqtolUosteBgNai7sePwbfPkboaoyDym2ojjnkgeuMgQOqSx0LO8Tt2/9dQ jj8ZZwRFNd2wMVRv8RMRL6+MotWVWpyCpdLwcZPI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Lunn , "David S. Miller" , Sasha Levin Subject: [PATCH 5.14 108/172] dsa: mv88e6xxx: Include tagger overhead when setting MTU for DSA and CPU ports Date: Mon, 4 Oct 2021 14:52:38 +0200 Message-Id: <20211004125048.470198628@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Lunn [ Upstream commit b9c587fed61cf88bd45822c3159644445f6d5aa6 ] Same members of the Marvell Ethernet switches impose MTU restrictions on ports used for connecting to the CPU or another switch for DSA. If the MTU is set too low, tagged frames will be discarded. Ensure the worst case tagger overhead is included in setting the MTU for DSA and CPU ports. Fixes: 1baf0fac10fb ("net: dsa: mv88e6xxx: Use chip-wide max frame size for MTU") Reported by: 曹煜 Signed-off-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/dsa/mv88e6xxx/chip.c | 9 ++++++--- drivers/net/dsa/mv88e6xxx/chip.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 014950a343f4..66b4f4a9832a 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -2885,10 +2885,10 @@ static int mv88e6xxx_get_max_mtu(struct dsa_switch *ds, int port) struct mv88e6xxx_chip *chip = ds->priv; if (chip->info->ops->port_set_jumbo_size) - return 10240 - VLAN_ETH_HLEN - ETH_FCS_LEN; + return 10240 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; else if (chip->info->ops->set_max_frame_size) - return 1632 - VLAN_ETH_HLEN - ETH_FCS_LEN; - return 1522 - VLAN_ETH_HLEN - ETH_FCS_LEN; + return 1632 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; + return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; } static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu) @@ -2896,6 +2896,9 @@ static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu) struct mv88e6xxx_chip *chip = ds->priv; int ret = 0; + if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) + new_mtu += EDSA_HLEN; + mv88e6xxx_reg_lock(chip); if (chip->info->ops->port_set_jumbo_size) ret = chip->info->ops->port_set_jumbo_size(chip, port, new_mtu); diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index 675b1f3e43b7..59f316cc8583 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -18,6 +18,7 @@ #include #include +#define EDSA_HLEN 8 #define MV88E6XXX_N_FID 4096 /* PVT limits for 4-bit port and 5-bit switch */ -- 2.33.0