[v1,02/26] net: dsa: microchip: ksz8: ksz8_fdb_dump: fix port validation and VID information
Message ID | 20221128120034.4075562-3-o.rempel@pengutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5609967wrr; Mon, 28 Nov 2022 04:04:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf6paT2nw8sdtTmq0ufKG3ZpYFAMrGYtFfINJ9Ce4esvZZC/nU+3C9DTAhg8CPI3aoksPz0M X-Received: by 2002:a63:f012:0:b0:477:b658:c2ea with SMTP id k18-20020a63f012000000b00477b658c2eamr23771473pgh.598.1669637056780; Mon, 28 Nov 2022 04:04:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669637056; cv=none; d=google.com; s=arc-20160816; b=y/x3HsEMhzzZCwYv01K9uE+ylRiY+9eiWKvfDEztmUGtcnjcRHmASDaPeJUF7BlXZG KeRsivTPz0qXl3l8tmFEPh/3CurW6uH5kBZm59CS9U9IotwqC5Ktz7KAUdnA1F9pAATz DBkfMLEKPm3Pzw2xNEKvBpI0g3tCWMsCQR+wHi9ExpTXmE+E0mb3H+isXLUPDsl3aqpK eUqtvAu66+BREwzMnHT60pP3xQE5vmcrXqo8WE/Xm49Hxma1/oQBBoHoE1KJ4qQei/VH +KiuzPPgxc6XR0A5xid0kg67ui2MdyYEIGipgv5Tl9lVW5yz5BoKrXo+K3UrQshKUxqJ cMeg== 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; bh=V7A/yZarYQrJDVgs5eaUveDaSQ6jZ9XmNPmfNl5ykjs=; b=geo+ob+wjYHrbol0eV0eVE/vipTFSbjmUiwYfOrrOc+80tCeY56Hc2ZXLAySRY2Dya cRhV6vQEy5u+f2N2OghCoXq6PRCrvzFuKztyN5S6oiA32nwUIFGQBSDdLgEf2qxMd/oT y8Z2d8HrluafQyKIcWdnyALDuq4cGf+NrjRtSyIWFAOldsICwwdIySVfTN9iN/I8b9Nj o2XDM7b32GcDa2rrbWH5UdMydmeQOp++KAFgaFyE7Dc2t7wKdwBDMUs5GBq/lKkYDEeF up+dOoMfg36wjg5WWeqyLvV11dSCBx+HPlFo6jK9Zpe1xq/l3unKbXT5GnIYk4l9eYoj siBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 y20-20020a170902b49400b0017f75654a51si10699478plr.245.2022.11.28.04.03.57; Mon, 28 Nov 2022 04:04:16 -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; 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 S231544AbiK1MCo (ORCPT <rfc822;gah0developer@gmail.com> + 99 others); Mon, 28 Nov 2022 07:02:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231477AbiK1MAn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 28 Nov 2022 07:00:43 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB7FA18E1E for <linux-kernel@vger.kernel.org>; Mon, 28 Nov 2022 04:00:42 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <ore@pengutronix.de>) id 1ozcoO-0005FY-Js; Mon, 28 Nov 2022 13:00:36 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from <ore@pengutronix.de>) id 1ozcoN-000oAQ-4c; Mon, 28 Nov 2022 13:00:35 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from <ore@pengutronix.de>) id 1ozcoN-00H6Lt-2S; Mon, 28 Nov 2022 13:00:35 +0100 From: Oleksij Rempel <o.rempel@pengutronix.de> To: Woojung Huh <woojung.huh@microchip.com>, UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>, Vivien Didelot <vivien.didelot@gmail.com>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: Oleksij Rempel <o.rempel@pengutronix.de>, kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com Subject: [PATCH v1 02/26] net: dsa: microchip: ksz8: ksz8_fdb_dump: fix port validation and VID information Date: Mon, 28 Nov 2022 13:00:10 +0100 Message-Id: <20221128120034.4075562-3-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221128120034.4075562-1-o.rempel@pengutronix.de> References: <20221128120034.4075562-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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?1750741346592994590?= X-GMAIL-MSGID: =?utf-8?q?1750741346592994590?= |
Series |
net: dsa: microchip: stats64, fdb, error
|
|
Commit Message
Oleksij Rempel
Nov. 28, 2022, noon UTC
The ksz8_fdb_dump() has multiple issues:
- struct alu_struct was used only to store MAC address.
- port value was misinterpreted as a bit mask
- Filter ID was attempted to use as VID. FID can be used to get VID, but
currently it is not supported.
- by the attempt to use FID, was used not initialized alu.fid...
Before this patch, "bridge fdb" command was providing random results,
which are fixed by this patch:
- random vid information
- assignment to wrong port
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8795.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index 003b0ac2854c..e0530bc3bec0 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -958,15 +958,14 @@ int ksz8_fdb_dump(struct ksz_device *dev, int port, u16 entries = 0; u8 timestamp = 0; u8 fid; - u8 member; - struct alu_struct alu; + u8 src_port; + u8 mac[ETH_ALEN]; do { - alu.is_static = false; - ret = ksz8_r_dyn_mac_table(dev, i, alu.mac, &fid, &member, + ret = ksz8_r_dyn_mac_table(dev, i, mac, &fid, &src_port, ×tamp, &entries); - if (!ret && (member & BIT(port))) { - ret = cb(alu.mac, alu.fid, alu.is_static, data); + if (!ret && port == src_port) { + ret = cb(mac, 0, false, data); if (ret) break; }