From nobody Thu Sep 18 20:20:42 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CA86C4708E for ; Fri, 2 Dec 2022 16:05:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233405AbiLBQFu (ORCPT ); Fri, 2 Dec 2022 11:05:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232923AbiLBQFe (ORCPT ); Fri, 2 Dec 2022 11:05:34 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66E8328E04; Fri, 2 Dec 2022 08:05:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669997133; x=1701533133; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=auYuIXEr7sx+3hy79Ef3stkh0y1WDVS5g/H3HFAPPmQ=; b=wVVCLd431u+/Vtx6x4cHOGztQAwXnfH80CdcDkHry548rd9fPyp/2l4q 9yWe49hiCVMZuXIiqfVQPdbAWL+spz/o2K767v2UjbQh1PArQYeBmZXDM lHXEFbi0+sNiHY5HQWkrmFf1lFJsmZU7tPWKVZMRQIJre9C9hm5HEqPMZ 2FJ/sMGActbRNFX0OmSTL1u3MMfiAjjP326PKJSaK/3TY5ESg3NDq7kcD ln5vQDytl/nlnCcxuqkri8ZDqLpic4bHdL9B30ZhGXRSXBQaOF/lN+2uu kwxukvchOAFLl5vUOW1xjVBGSDwv2QNoaaTK/nPVn5jeG4yw72pMfg1UQ A==; X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="186280993" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Dec 2022 09:05:32 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 2 Dec 2022 09:05:32 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 2 Dec 2022 09:05:31 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , , , Jerry Ray Subject: [PATCH net-next 1/2] dsa: lan9303: Add port_max_mtu API Date: Fri, 2 Dec 2022 10:05:28 -0600 Message-ID: <20221202160529.30010-2-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221202160529.30010-1-jerry.ray@microchip.com> References: <20221202160529.30010-1-jerry.ray@microchip.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Adding in support for reporting the max mtu for a given port. Signed-off-by: Jerry Ray --- drivers/net/dsa/lan9303-core.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 93c2a3c549cb..ed8f83f3a654 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1328,6 +1328,25 @@ static int lan9303_port_mdb_del(struct dsa_switch *d= s, int port, return 0; } =20 +/* For non-cpu ports, the max frame size is 1518. + * The CPU port supports a max frame size of 1522. + * There is a JUMBO flag to make the max size 2048, but this driver + * presently does not support using it. + */ +static int lan9303_port_max_mtu(struct dsa_switch *ds, int port) +{ + struct net_device *p =3D dsa_port_to_master(dsa_to_port(ds, port)); + struct lan9303 *chip =3D ds->priv; + + dev_dbg(chip->dev, "%s(%d) entered. NET max_mtu is %d", + __func__, port, p->max_mtu); + + if (dsa_port_is_cpu(dsa_to_port(ds, port))) + return 1522; + else + return 1518; +} + static const struct dsa_switch_ops lan9303_switch_ops =3D { .get_tag_protocol =3D lan9303_get_tag_protocol, .setup =3D lan9303_setup, @@ -1348,6 +1367,7 @@ static const struct dsa_switch_ops lan9303_switch_ops= =3D { .port_fdb_dump =3D lan9303_port_fdb_dump, .port_mdb_add =3D lan9303_port_mdb_add, .port_mdb_del =3D lan9303_port_mdb_del, + .port_max_mtu =3D lan9303_port_max_mtu, }; =20 static int lan9303_register_switch(struct lan9303 *chip) --=20 2.17.1