From patchwork Tue Dec 6 18:34:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 30473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2989905wrr; Tue, 6 Dec 2022 10:44:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf6CR3lcipDR9U4UWoZQmFtiNAmRSPAxB5PxsFcKzWi7VTxPRxIL3KZe/U4oL78guUrNv3hv X-Received: by 2002:a17:906:bcc1:b0:73d:715c:5730 with SMTP id lw1-20020a170906bcc100b0073d715c5730mr73213613ejb.293.1670352254524; Tue, 06 Dec 2022 10:44:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670352254; cv=none; d=google.com; s=arc-20160816; b=J97FGriCRv+5LcPZwz05ED3ow3IhU+OJsGpkh5obV0gK9eAVtNUj7991jyAUVh5qLE lImA6CmY5+wCUAVq8gFxdKncH4lZ86wubmvU1d/mJiEspavB8v+6xv2+vcaJl3SCyrlh akDX+W2+aFk54pcNQnUWAsGUZMv6d9m8NlXcP++Oj235F/agGGKQua/huimL1bCWksBx Pj473VYpSEUkcH7UX2oDYWEHBjmyUizxkH3JG0J1rLk7qKutiaIpvZ1s/38ERgEMXTm1 C/1LRo1aZLI/9+ShzcFB3CsW+gxjH3nCqYFPXkj+Sd+H6Y0bgqPY6pt/rfRVeaqlH3ls PceA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=XAvfTE/X5jTdSo741I1LW8L/pDYinrX48JwqxPrK/sQ=; b=T3sURptWTeARMkokhoIXM5Gmh7+e3DzIIKONUAmZ/urzrnZfcZ+UMAOgzSV+vvwg5S Dv9EXL2M34Gjr5x+M2whFLRijZUW4NbaWxcSADRzdAzR/4CNP2Pw1Uvy1xHlemd74aXZ UsipuBAIzYoOCxUbE4j8vDarTdvRmwjpvvUJJKvx/ddQp1MUneXNk1e4KdJE9ZUPvMRd IxkYhDjpYMSpq7jwq6wdO4oV0QUnTIVWhshLX2Mvd/K3cmTU/GDAeOi0F2UuceuBaauv WZijF0EDNyINkk6ooxppm7/FLk2fyNZFRQY6L7xUnN+V8asQrLXtcRMfOSwU36ApN8kI 87sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=yyX2q3uG; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r21-20020a056402019500b004699e89601dsi2259446edv.588.2022.12.06.10.43.52; Tue, 06 Dec 2022 10:44:14 -0800 (PST) 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=@microchip.com header.s=mchp header.b=yyX2q3uG; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbiLFSfo (ORCPT + 99 others); Tue, 6 Dec 2022 13:35:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbiLFSfV (ORCPT ); Tue, 6 Dec 2022 13:35:21 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ABAD6349; Tue, 6 Dec 2022 10:35:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670351706; x=1701887706; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=A5PoAKCak51gwau3gk4Z68MLvJ/ijOTtPKUqHzhQ844=; b=yyX2q3uG9h0PsCQ0VdOZlJRgVAKgL1PyJh3H/YgdI4C2wJ4aqTOj27+Q xZItiOy3iZrEy+Eh1zque79eQVbYw1VMxXPIG6I5ZiHKHKikzrIEW5/hX /JwNaOqYZCtxECmG4g2dIGmS6KWMQXSXjZOHSp+pTEdTHRdYYTdEOSEW7 ryFyKw2RQN6Wwa0+LEVsiqLvVw/j6GRybGx4k538RqYfjAmLiCFXM+VQV r7ejqXNJWzclAh0HH7mUsbBbaLJlhcEZSejPA5VVJSHUToCaHVtkSn590 uoQkISNBD3e7kwdKh+/Thyq8DSmhXd+iXdvnFV+lHxpTK7bnhKwLU5SBI w==; X-IronPort-AV: E=Sophos;i="5.96,223,1665471600"; d="scan'208";a="126791961" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Dec 2022 11:35:05 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 6 Dec 2022 11:35:05 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 6 Dec 2022 11:35:03 -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 v3 1/2] dsa: lan9303: Add port_max_mtu API Date: Tue, 6 Dec 2022 12:34:59 -0600 Message-ID: <20221206183500.6898-2-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221206183500.6898-1-jerry.ray@microchip.com> References: <20221206183500.6898-1-jerry.ray@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751491285594707223?= X-GMAIL-MSGID: =?utf-8?q?1751491285594707223?= 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 80f07bd20593..baa336bb9d15 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1279,6 +1279,25 @@ static int lan9303_port_mdb_del(struct dsa_switch *ds, int port, return 0; } +/* 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 = dsa_port_to_master(dsa_to_port(ds, port)); + struct lan9303 *chip = 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 - ETH_HLEN - ETH_FCS_LEN; + else + return 1518 - ETH_HLEN - ETH_FCS_LEN; +} + static const struct dsa_switch_ops lan9303_switch_ops = { .get_tag_protocol = lan9303_get_tag_protocol, .setup = lan9303_setup, @@ -1299,6 +1318,7 @@ static const struct dsa_switch_ops lan9303_switch_ops = { .port_fdb_dump = lan9303_port_fdb_dump, .port_mdb_add = lan9303_port_mdb_add, .port_mdb_del = lan9303_port_mdb_del, + .port_max_mtu = lan9303_port_max_mtu, }; static int lan9303_register_switch(struct lan9303 *chip)