Message ID | 20230309125421.3900962-6-lukma@denx.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp272643wrd; Thu, 9 Mar 2023 04:57:23 -0800 (PST) X-Google-Smtp-Source: AK7set/wpeCEG9iajzix0AAjAU64iK2GZUlAoJIewvXeqiX2QHXvbnm/5pFXql4arcelnerGmxtb X-Received: by 2002:a05:6a20:69a3:b0:c7:6f26:c99 with SMTP id t35-20020a056a2069a300b000c76f260c99mr35983000pzk.61.1678366643185; Thu, 09 Mar 2023 04:57:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678366643; cv=none; d=google.com; s=arc-20160816; b=UFTBOojfPR0DDFwTlgxEFlsptkFX2o7gf3JBfYUgpCMD2TJyfBEd3DButvPXt1K0yu lRZE3HayY1U5DXLpmN7M8k5DMyjUJKAvrDtl4Ag21tOwhoaTLahSU/8vdnmvdAg7+nFe PY8brcc52wXk7Gafxnw2Z2eZRvzNHqS9M5EDHAot/P+t53XnoyNMZ0KDZbtjnseefEnS lQaSMeeFg0bZVwODfAh6EDlhFz1kAvLI3M6zUG0Zk1UbLZJLMq70G0718KNJ4lWbWgj9 JTTFH5eFNKK2ZphO6VmlZnF3AMj/YeYGQrQKxhKQcUHNb/+j0PqOkKduj9ZD+crXK8Yl hKqw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dVEgBnkSNnuvOZZ/mAHRR8gLntu/ElXZ1r9lih2XJe8=; b=xEo3VSC6lhaHFgxzvQ7eC7jkQwbPcalgcjctD2bUJg4u0QP5H8XPbPKrLxiqJL1P5U HGGA/DtHCoBRhLZkh7jnmQcJU6RYopPSjIx/ZTNYAQcuE2Tw+xZjEHXvHHmu0+B6XInT d6+9EMsd0ql56GaQS/IeEweYIv/QjJuXfHba9vNPC/0WfqDuuKdTO83OXsx1YbezeH8L ktu9jv7KlZGMDxUqTzm+REcg2zkJWOFu6xqpEIJmdEvg56J56b+gTy8qU6tFinTJyj3x NHBhPG1gXDDCkDOFdrl+UvEr+emfpUH1NSIVFJ5yM6U4vnMnp5WSuzwQE3Yj6npgAEBD UZvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=bg9mVsKN; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c7-20020a056a00008700b00608ab285f1csi17630979pfj.199.2023.03.09.04.57.09; Thu, 09 Mar 2023 04:57:23 -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=@denx.de header.s=phobos-20191101 header.b=bg9mVsKN; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230458AbjCIMz3 (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Thu, 9 Mar 2023 07:55:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbjCIMzL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Mar 2023 07:55:11 -0500 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1433D87DB2; Thu, 9 Mar 2023 04:55:10 -0800 (PST) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 1B73885EA8; Thu, 9 Mar 2023 13:55:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678366506; bh=dVEgBnkSNnuvOZZ/mAHRR8gLntu/ElXZ1r9lih2XJe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bg9mVsKNm4tgsSSTEAdQSzKdlrRTlZiAduKpOP0gHP21Jqa8/Lf2P+8BvQDa16cXw ISyqQstr4tpj7edzzN6FBhEvNn0SflMo9RU9AOgFfFAMx0ORkfUovWDeQRPb9m6bLN qzI0OAGD7mDHcBDyH2B2L08KEMRCOu0UNDE4bZ85Z87KY+gI777TtHSSH9oJyUgYWR o+6k6mSN02oge4gDRSh/YYBX2v/10yExefpVG5tMj3Vv0GAL8uw0Rlr78hY8S1e6d6 XM/Nk+QVIT1HAPQqviVQUva1k8JT6tRO74AiGdqImEhH8MwpaZLPbkYyzClwTXWd2k ZaZaZhMyAcATQ== From: Lukasz Majewski <lukma@denx.de> To: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>, Russell King <linux@armlinux.org.uk> Cc: Eric Dumazet <edumazet@google.com>, Florian Fainelli <f.fainelli@gmail.com>, "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Alexander Duyck <alexander.duyck@gmail.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski <lukma@denx.de> Subject: [PATCH 5/7] dsa: marvell: Add helper function to validate the max_frame_size variable Date: Thu, 9 Mar 2023 13:54:19 +0100 Message-Id: <20230309125421.3900962-6-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309125421.3900962-1-lukma@denx.de> References: <20230309125421.3900962-1-lukma@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759894981180582859?= X-GMAIL-MSGID: =?utf-8?q?1759894981180582859?= |
Series |
dsa: marvell: Add support for mv88e6071 and 6020 switches
|
|
Commit Message
Lukasz Majewski
March 9, 2023, 12:54 p.m. UTC
This commit shall be regarded as a transition one, as this function helps
to validate the correctness of max_frame_size variable added to
mv88e6xxx_info structure.
It is necessary to avoid regressions as manual assessment of this value
turned out to be error prone.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
---
Changes for v5:
- New patch
---
drivers/net/dsa/mv88e6xxx/chip.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
Comments
On Thu, Mar 09, 2023 at 01:54:19PM +0100, Lukasz Majewski wrote: > This commit shall be regarded as a transition one, as this function helps > to validate the correctness of max_frame_size variable added to > mv88e6xxx_info structure. > > It is necessary to avoid regressions as manual assessment of this value > turned out to be error prone. > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk> Shouldn't this be patch 2 - immediately after populating the .max_frame_size members, and before adding any additional devices?
On Thu, Mar 09, 2023 at 01:21:13PM +0000, Russell King (Oracle) wrote: > On Thu, Mar 09, 2023 at 01:54:19PM +0100, Lukasz Majewski wrote: > > This commit shall be regarded as a transition one, as this function helps > > to validate the correctness of max_frame_size variable added to > > mv88e6xxx_info structure. > > > > It is necessary to avoid regressions as manual assessment of this value > > turned out to be error prone. > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk> > > Shouldn't this be patch 2 - immediately after populating the > .max_frame_size members, and before adding any additional devices? Moreover, shouldn't the patch order be: 1, 5, 6 (fixing the entry that needs it), 7 (which then gets the max frame size support in place), 4 (so that .set_max_frame_size for 6250 is in place), 2, 3 ? In other words, get the new infrastructure you need in place first (that being the new .max_frame_size and the .set_max_frame_size function) before then adding the new support.
Hi Russell, > On Thu, Mar 09, 2023 at 01:21:13PM +0000, Russell King (Oracle) wrote: > > On Thu, Mar 09, 2023 at 01:54:19PM +0100, Lukasz Majewski wrote: > > > This commit shall be regarded as a transition one, as this > > > function helps to validate the correctness of max_frame_size > > > variable added to mv88e6xxx_info structure. > > > > > > It is necessary to avoid regressions as manual assessment of this > > > value turned out to be error prone. > > > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > > Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk> > > > > Shouldn't this be patch 2 - immediately after populating the > > .max_frame_size members, and before adding any additional devices? > > Moreover, shouldn't the patch order be: > > 1, 5, 6 (fixing the entry that needs it), 7 (which then gets the > max frame size support in place), 4 (so that .set_max_frame_size for > 6250 is in place), 2, 3 > > ? > > In other words, get the new infrastructure you need in place first > (that being the new .max_frame_size and the .set_max_frame_size > function) before then adding the new support. > Ok, I will reorder those patches and submit v6. Do you have any other comments regarding this patch set? Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
On Thu, Mar 09, 2023 at 02:47:52PM +0100, Lukasz Majewski wrote: > Ok, I will reorder those patches and submit v6. > > Do you have any other comments regarding this patch set? Please allow for at least 24 hours between reposts. I would like to look at this patch set too, later today or tomorrow.
Hi Vladimir, > On Thu, Mar 09, 2023 at 02:47:52PM +0100, Lukasz Majewski wrote: > > Ok, I will reorder those patches and submit v6. > > > > Do you have any other comments regarding this patch set? > > Please allow for at least 24 hours between reposts. I would like to > look at this patch set too, later today or tomorrow. Ok. No problem. Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 9695a1af45a9..af14eb8a1bfd 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -7169,6 +7169,27 @@ static int __maybe_unused mv88e6xxx_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(mv88e6xxx_pm_ops, mv88e6xxx_suspend, mv88e6xxx_resume); +static void mv88e6xxx_validate_frame_size(void) +{ + int max; + int i; + + for (i = 0; i < ARRAY_SIZE(mv88e6xxx_table); i++) { + /* same logic as in mv88e6xxx_get_max_mtu() */ + if (mv88e6xxx_table[i].ops->port_set_jumbo_size) + max = 10240; + else if (mv88e6xxx_table[i].ops->set_max_frame_size) + max = 1632; + else + max = 1522; + + if (mv88e6xxx_table[i].max_frame_size != max) + pr_err("BUG: %s has differing max_frame_size: %d != %d\n", + mv88e6xxx_table[i].name, max, + mv88e6xxx_table[i].max_frame_size); + } +} + static int mv88e6xxx_probe(struct mdio_device *mdiodev) { struct dsa_mv88e6xxx_pdata *pdata = mdiodev->dev.platform_data; @@ -7302,6 +7323,7 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev) if (err) goto out_mdio; + mv88e6xxx_validate_frame_size(); return 0; out_mdio: