From patchwork Sat Jan 16 02:39:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12024553 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68FBFC433E9 for ; Sat, 16 Jan 2021 02:41:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 412DB238D6 for ; Sat, 16 Jan 2021 02:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729258AbhAPClX (ORCPT ); Fri, 15 Jan 2021 21:41:23 -0500 Received: from mail-eopbgr30103.outbound.protection.outlook.com ([40.107.3.103]:6278 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725601AbhAPClW (ORCPT ); Fri, 15 Jan 2021 21:41:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cA8hRMXzqv1rmJJ41PiDEq0HZrkJC43DAzy26k5Cz1V/kGBQ35bGfDJyxQNYaHcUSxN5DiqSoFfC/QA9KoX58uLblh9X+ZKnD1cJjyzTVNRn1rJEmBPd19YQNYD1xpIKbo1qExU46BmFDbv12+zQVPnbK+xSci/R32VH8Y1r26JnIE3MwWglazrvDs6PCnKw4CPMJoB3sKxk6XYBoCWLfD3it1R5nbZ9memBC50NvgZRo838o1z8FGBtS85kTZdySvi34s7vYdKf/9TFwhtSxm/NX/qcCFfUXuCSdVfpS4iV88sbxjw3YUfS6+KQJUfky0K1QuOF++x1m7D+03ftQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=glc8duWmUvoDE7rEKyfuYLOTiPMe1wYXWVMfIlfmiyM=; b=nVG2nrH6gkklbA93ORF3EqG9VRv+QstTgvpIbcC9TC7zz2mB8UXHNj6dqaSJsEmKpmlu2GamL9E+T9Y7cjwyi5WBi9Ezdv5R9GVfq0Xbp86KRVEIO7vWfTldEtd1iQxDjfCM5s4yLxCxG3Yoi0vDNtGZ4q99s3oNFxsd6KgFO9FWr7nF7I4iNS0NyBrmh3RIkcmy+WMPBVvzydDtavtk1q9AKSRlQRQkImDm+O8kmlOB9ditEkOuBaP0QwLtoIYVSDzk1XXQyxbNQuT3JQOuuOk7TcHk+1xGRLUq3GKRxyo9kBOySs1UiqwZzZHfVeALGUplrp73qemxmd4NDFbJBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=glc8duWmUvoDE7rEKyfuYLOTiPMe1wYXWVMfIlfmiyM=; b=g00ezDZA3bGDnb656YNFFbaot8GPk1jsc/KlyQWA/yvYMN0LxlYUwp7r5IlsDzoG1X8Yh89niFWTJ8Q638afGX3a5Me8FJOYc3zGbRH/LE+3XxdkaVnQVGGZNZ9ueJ9gYJQWamdwQq7gv8KwqEf6THi/i0zLu2/qEgCgESi+n2s= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB2674.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:12a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Sat, 16 Jan 2021 02:40:02 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.012; Sat, 16 Jan 2021 02:40:02 +0000 From: Rasmus Villemoes To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Tobias Waldekranz Cc: Rasmus Villemoes , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 1/2] net: dsa: mv88e6xxx: also read STU state in mv88e6250_g1_vtu_getnext Date: Sat, 16 Jan 2021 03:39:35 +0100 Message-Id: <20210116023937.6225-2-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210116023937.6225-1-rasmus.villemoes@prevas.dk> References: <20210116023937.6225-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM5PR0601CA0025.eurprd06.prod.outlook.com (2603:10a6:203:68::11) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM5PR0601CA0025.eurprd06.prod.outlook.com (2603:10a6:203:68::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10 via Frontend Transport; Sat, 16 Jan 2021 02:40:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82457ffd-2641-41ea-9643-08d8b9c80633 X-MS-TrafficTypeDiagnostic: AM0PR10MB2674: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:862; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mHmXdr22hn+bGbe5sFdCHa6lR2Snvd4qWsSj3lmV3mGhwWzJ3wBRxUgJTC5qzNQ1LpzrO9KgTV2d1rN6yLN2hB7lz+CI5KJhliPXSCwwUs8sLofoRSnJapAyn/jDBtJ/yzNmgiLOMiW2YtHxcf3IteVRB9acGNi491kcZNwDSuV8BdWOnmfgzsOEWzm4ywhPA+eeRFLAj60RLY5FFQUWa5MK2KBELki5t565XwxDrZLNI27iFB1IoJulTLvHhurodB4Jy54bGX8D8MqBGWFtAzjUHR/XPtKwsp3hHYuEfZ4kXfNHIETy/sLJ398RuElpEzXIvMUQpnXF8FzAmn5n5Y80eBIoU0127l4prxy7n5dgl0z1/pUo4+NCsTYK7MZ369P7WN1KK5P4/LSEYMlSXQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(136003)(376002)(39830400003)(346002)(396003)(66476007)(66556008)(66946007)(6666004)(4326008)(5660300002)(36756003)(26005)(52116002)(6506007)(8976002)(956004)(478600001)(2906002)(44832011)(8936002)(6486002)(110136005)(86362001)(83380400001)(1076003)(6512007)(2616005)(16526019)(186003)(316002)(8676002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: zxzR4chSl1YauXZFJXO9eCLtzcZ6xLOg01kLd51lRj03wezylCOR0PIMoFHvvX3H2NGDlQsp6ZmE6H6Q5nEM16lBs8KIvSKyPk27n76Z8e1DcuMygbjpU3TSUhZkrdJKh6bw4Lr7AFdJDYF8UUnyKt9zFeRzYMvZSXkJtPjeH77ArUiBVWLXBu4651qxfFdcWvgt76hcO8+iHlokpw4cz+iVvuSFDUtjDnvfaCG7r7PUKU+NUYwJ1IITRPffcuxf4EIc99sFM46jKjPl/kOExc9llv0h5YlammCPrzAfgQfgQrzThSK+Os1esaT86Q5mq6TJ2Db0tMM4VagWARm6ZfqyWbiyax+LZva3mQmPjwnGeoPLNCSC9smE5xcm7u9aUbHxOyK8QGekmcKI13wtQNzLEI5ggcqEDmqx8UxjnARaryxa0h76/uGvrpZyHMjYZ8czS1tqiOGIyPKA3/j+UVNscqgVQBXwWX3fUN1r5VjFQS5nbxBgRp3ww51sC6+NOiK3ZUiS+TS0MWjC+XHbVpoP4QXc5UWqS2K11xGtOGAwQ//kk4wNQb0+z+Dw8k15si6ZBa2SrBj6rVF8A33tXfIofukNh7RntJf9ozsKyexyBt12jc5LEb3/0LVTOwag+xlBTyx1p9sWy6u6/VfbG9f17rq+0nIHjS05q7kYfgCpM43LLAC6GX20GmB9nb9Phrs7tYfCmdZvwhNAfkWyFP6oEbqO2ibCzU8SkYtCCi49d1VJhYgW9PhZUFOStYSbM4h6FuFBifiLR7kJ5/SL0t1KQuglZGJJYlOB89IMNIxVdKFonG5AwzdnMrFcUHQgSQm92KIAcZwuQteGZOdQe8aRI/aV8BSHMg2KgKJn0Cef+mDya5zS9lNE19QuiUCFT3GYhrl1FsdGTv2sWy+t8pScHuX+tn3WRICjxwFZTtk39lK4Xy2WwsJBtijzYqH+2kwfn/zQ90a1MpnM8lIYEzuHLgpYAyeW3jfnh3Pho288z9h07h09K4P25JPbhQ0s X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 82457ffd-2641-41ea-9643-08d8b9c80633 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2021 02:40:02.3745 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zL/W7/tDUtmArr/3BG43i0ZGcjgUTZQDPcw42G6X91HuN1wWR3YJNW+DncvN7lpb8XXwsSaJj89rGxbaHElrACuP6tEHz6XkvUZtoYSLu4g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB2674 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org mv88e6xxx_port_vlan_join checks whether the VTU already contains an entry for the given vid (via mv88e6xxx_vtu_getnext), and if so, merely changes the relevant .member[] element and loads the updated entry into the VTU. However, at least for the mv88e6250, the on-stack struct mv88e6xxx_vtu_entry vlan never has its .state[] array explicitly initialized, neither in mv88e6xxx_port_vlan_join() nor inside the getnext implementation. So the new entry has random garbage for the STU bits, breaking VLAN filtering. When the VTU entry is initially created, those bits are all zero, and we should make sure to keep them that way when the entry is updated. Fixes: 92307069a96c (net: dsa: mv88e6xxx: Avoid VTU corruption on 6097) Signed-off-by: Rasmus Villemoes Reviewed-by: Florian Fainelli Reviewed-by: Tobias Waldekranz Tested-by: Tobias Waldekranz --- drivers/net/dsa/mv88e6xxx/global1_vtu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/global1_vtu.c b/drivers/net/dsa/mv88e6xxx/global1_vtu.c index 66ddf67b8737..7b96396be609 100644 --- a/drivers/net/dsa/mv88e6xxx/global1_vtu.c +++ b/drivers/net/dsa/mv88e6xxx/global1_vtu.c @@ -351,6 +351,10 @@ int mv88e6250_g1_vtu_getnext(struct mv88e6xxx_chip *chip, if (err) return err; + err = mv88e6185_g1_stu_data_read(chip, entry); + if (err) + return err; + /* VTU DBNum[3:0] are located in VTU Operation 3:0 * VTU DBNum[5:4] are located in VTU Operation 9:8 */ From patchwork Sat Jan 16 02:39:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12024551 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F660C433E0 for ; Sat, 16 Jan 2021 02:41:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B176238E7 for ; Sat, 16 Jan 2021 02:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729075AbhAPClQ (ORCPT ); Fri, 15 Jan 2021 21:41:16 -0500 Received: from mail-eopbgr40114.outbound.protection.outlook.com ([40.107.4.114]:48708 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725601AbhAPClP (ORCPT ); Fri, 15 Jan 2021 21:41:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g3q20/Yb+CeyjrXr2GCF2/VncxJbJw1HeWaYX7yoidaMSpwRzsKK4GifXboCHiXGvsh4dWR6wIt/8wl9/2UP8MUM5gBNj1ds1e7tmznQg1VjKekvGJ1YnDfr8hPJ3mUnwXQjYo9ShhkwA8MyBFT+KR13ePYZvYZi1JuUo2csa8B9QeL9NnMZMqXUyqO7KMi89futfR6gsYRqudIzFDRtxtwZlfKH5iTFs32kx2KZWE7kASoy52wqWdsD1uuSCjvNOW3cJcrxmNWzOq2XKcMD/jXy3d6BbeePTsv1OVbTN11zoZ9BJ40XhjB4hJwjgGabXMnyteNzHbDN52GfotJtFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Cjqi7e0bg1AbzISssH2R14XYsZJAShrHQj9Y0LBKqCc=; b=dslZ1Kca1kR5Kv0gB7flIzN375lAB7xxcZ38mqNUs0RsRHYJ3hunuVr74rlMsZi8mwbiU/4JxcYkXGV9+CM3CNxsky+j1gojmjxFq19hoa7JgcNngZeb78MLtFg5FUIPt2W/w1jlA7eSDs91HKHZYqDykQeXxUttiYoGi1PNC9kwtyJB4Wwhh12iRCZIp2CvB1pZVr4jrOD8WFppWoxOhXQJ+t9RFX0zFF5yt4WUHGcmjR7yM03nY4y6AUVsa55Z8tRskRY1xyEAse6XiTLG9L5+lMiyBelm01oXbeogfUZOqDXPzeldtxhFSCQ5i2NM13Y/Qg3Q2wWHOo7tORMjLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Cjqi7e0bg1AbzISssH2R14XYsZJAShrHQj9Y0LBKqCc=; b=FuvMJak8xt/a5XkO6AQfzytyAPEKhYg8OtchnDdLK7LJyS5t8avsOUEwSTKvWoUp4qUubFLwDuowTzT3n9TlGCqgoen95qd7TOWjtxSu8A0JEYTljClfhbw7e0dVrScqzj0yikC907Pd4RNZxy/rAGPam0HHtDnCZ6EFUZyp/Yo= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB2674.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:12a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Sat, 16 Jan 2021 02:40:03 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.012; Sat, 16 Jan 2021 02:40:03 +0000 From: Rasmus Villemoes To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski Cc: Tobias Waldekranz , Rasmus Villemoes , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/2] net: dsa: mv88e6xxx: use mv88e6185_g1_vtu_getnext() for the 6250 Date: Sat, 16 Jan 2021 03:39:36 +0100 Message-Id: <20210116023937.6225-3-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210116023937.6225-1-rasmus.villemoes@prevas.dk> References: <20210116023937.6225-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM5PR0601CA0025.eurprd06.prod.outlook.com (2603:10a6:203:68::11) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM5PR0601CA0025.eurprd06.prod.outlook.com (2603:10a6:203:68::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10 via Frontend Transport; Sat, 16 Jan 2021 02:40:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 338c34fb-7fb6-48c0-bbbb-08d8b9c80705 X-MS-TrafficTypeDiagnostic: AM0PR10MB2674: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:590; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RD45UtQcrO1rxC6iDmF3YizMaWfPPcPJcMJwqIY/Zl7gGP836E4F8l9k2ov+kAmg5giidHK0rqP91O1IapIiXqW7mLrQBAANfN36fhtl9ooPrf+qyuTe3hFmUYN0wSIP9W8Va+9G2OFcqdnqEWxUgqiqob2njs1oFvuBSVBqjny+CwoE4ruYaui3OoMkVYRvnWex2Iy3UddqUtgh5nd0ql+k/9q9eT5Un8n1FYbmb66AkK/QEbP24ZHjAgORbX6gixDDNJpo2XqX131LodszBsMb+z5RXur3Wxwx4dOeC3vjPPfXnPz6aLAPn5glPthu9CiR/nOzgFYxWROIz0Wgd+Pw3CliCP7zLHV/Bf2IeheaXHjFrc+PWm8jJ7VD/YGwvv/hZiQc6vKzRTemOSYA0A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(136003)(376002)(39830400003)(346002)(396003)(66476007)(66556008)(66946007)(6666004)(4326008)(5660300002)(36756003)(26005)(52116002)(6506007)(8976002)(956004)(478600001)(2906002)(44832011)(8936002)(6486002)(110136005)(86362001)(83380400001)(1076003)(6512007)(2616005)(54906003)(16526019)(186003)(316002)(8676002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: rMYq16XvhYtwOnD5WlBGSbfM3ZDfkRspmA0WhWRc1Pzb55/1Ff+XlE5ryr5kYnHJXQkVZj4hQuFaQjIfyFNEzPtQQpIHUzoS4Ahj9470XTB9iGDlZGSxaxsHbSW2u+5S8dx8rK3FoVJjhWGKGJxHteFYcb3ilG3Cn1P2woUnmdnd9OUiCv16g2PAVmjIV0YjuWECRXJtiERUhabEZBTg14qMcjOI3fPSVnHlk0bilmjBTRlD9ExXlSZq6eb2PIqgjtJWfwmqQ+EtnaPK9jUjy+TqlzmIsYAKAih1YyDH4cx2pE0FKO3wVvJt7AFrC99A+VfG7tZA/XmPae1liAP4LIP7eyAG0bliky05Z9LDts/NfjdhN3ul3M+Mm7whXm67Xvy/NHpZPSe/pkYy8I7JLfeOc5oEIk3TnsVEDz/nzTG+M+2I4ztiXg0xP9sDa/Q8XQZo1cxUTpMgzKWWB8dNNQS0CM1bpmyqOJp2h+AdCWSJtUNwr4AN7O9eYEYnjXLQ0VBr/sx1Ns7Kxczk0vV8LZ9KrdP6I2MrUNsB5jlBKnNNjXxUjw1h69ysZ/QSdGwgKJDeUVgRVywET+pu/+sKoIJsTkGdz4oH4V3JV3HERveKre6Hh5bFOulGDVYna4NcKUiXL2CawET7gLOAc+G5ytMA0ZGex+mzZOdsaPoIvZJGyEzv4cmy9jLRIXKaKwGOZcn7tDBVIlZSwUnsi+3Nu3v99unbOgwka8zHmJvrOnyRahq5IxyHC0lhVSmCom9SoDA9WNPDH/AbzCtDVtA9wW6qoahUIttgjIpU8wqww9s3laKfwuA9q7LhMcbsmmrtD9D0hnKNBd27CoqC5eGsKlJ7BvMDTktcfbxo4SAh3aCiKlSKiRzmCWEwREtS6A28kqEF4jtqwFCp9JQfVn7RI1KGzjsgfowGm489gQxZ3nPdpgzjsTgdJYOiDTJGp0EHt+wG6gygSoOEv2SE09KzBxjuYAmy9fq+5aoTRp58ArWzBRH1xgraxfKVrtQ/0IGz X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 338c34fb-7fb6-48c0-bbbb-08d8b9c80705 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2021 02:40:03.8347 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Nf3OU4aPW/rSmCwsgNY+GjlsMbc0nGFhvxwCPsm7Nl6rhZrfFKjdFN4NY/QsVzQKg89LCSqCnrhXUVaXKYd8BHL/1lfskzLDzsBgoNKUkqs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB2674 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org mv88e6250_g1_vtu_getnext is almost identical to mv88e6185_g1_vtu_getnext, except for the 6250 only having 64 databases instead of 256. We can reduce code duplication by simply masking off the extra two garbage bits when assembling the fid from VTU op [3:0] and [11:8]. Signed-off-by: Rasmus Villemoes Reviewed-by: Florian Fainelli Reviewed-by: Tobias Waldekranz Tested-by: Tobias Waldekranz --- drivers/net/dsa/mv88e6xxx/chip.c | 2 +- drivers/net/dsa/mv88e6xxx/global1.h | 2 -- drivers/net/dsa/mv88e6xxx/global1_vtu.c | 36 ++----------------------- 3 files changed, 3 insertions(+), 37 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 5cc1465fd635..8a0df1e903bf 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -4023,7 +4023,7 @@ static const struct mv88e6xxx_ops mv88e6250_ops = { .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, .pot_clear = mv88e6xxx_g2_pot_clear, .reset = mv88e6250_g1_reset, - .vtu_getnext = mv88e6250_g1_vtu_getnext, + .vtu_getnext = mv88e6185_g1_vtu_getnext, .vtu_loadpurge = mv88e6250_g1_vtu_loadpurge, .avb_ops = &mv88e6352_avb_ops, .ptp_ops = &mv88e6250_ptp_ops, diff --git a/drivers/net/dsa/mv88e6xxx/global1.h b/drivers/net/dsa/mv88e6xxx/global1.h index 80a182c5b98a..d2dd2f4e4730 100644 --- a/drivers/net/dsa/mv88e6xxx/global1.h +++ b/drivers/net/dsa/mv88e6xxx/global1.h @@ -336,8 +336,6 @@ int mv88e6185_g1_vtu_getnext(struct mv88e6xxx_chip *chip, struct mv88e6xxx_vtu_entry *entry); int mv88e6185_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip, struct mv88e6xxx_vtu_entry *entry); -int mv88e6250_g1_vtu_getnext(struct mv88e6xxx_chip *chip, - struct mv88e6xxx_vtu_entry *entry); int mv88e6250_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip, struct mv88e6xxx_vtu_entry *entry); int mv88e6352_g1_vtu_getnext(struct mv88e6xxx_chip *chip, diff --git a/drivers/net/dsa/mv88e6xxx/global1_vtu.c b/drivers/net/dsa/mv88e6xxx/global1_vtu.c index 7b96396be609..519ae48ba96e 100644 --- a/drivers/net/dsa/mv88e6xxx/global1_vtu.c +++ b/drivers/net/dsa/mv88e6xxx/global1_vtu.c @@ -336,39 +336,6 @@ int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip, return mv88e6xxx_g1_vtu_vid_read(chip, entry); } -int mv88e6250_g1_vtu_getnext(struct mv88e6xxx_chip *chip, - struct mv88e6xxx_vtu_entry *entry) -{ - u16 val; - int err; - - err = mv88e6xxx_g1_vtu_getnext(chip, entry); - if (err) - return err; - - if (entry->valid) { - err = mv88e6185_g1_vtu_data_read(chip, entry); - if (err) - return err; - - err = mv88e6185_g1_stu_data_read(chip, entry); - if (err) - return err; - - /* VTU DBNum[3:0] are located in VTU Operation 3:0 - * VTU DBNum[5:4] are located in VTU Operation 9:8 - */ - err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_OP, &val); - if (err) - return err; - - entry->fid = val & 0x000f; - entry->fid |= (val & 0x0300) >> 4; - } - - return 0; -} - int mv88e6185_g1_vtu_getnext(struct mv88e6xxx_chip *chip, struct mv88e6xxx_vtu_entry *entry) { @@ -389,7 +356,7 @@ int mv88e6185_g1_vtu_getnext(struct mv88e6xxx_chip *chip, return err; /* VTU DBNum[3:0] are located in VTU Operation 3:0 - * VTU DBNum[7:4] are located in VTU Operation 11:8 + * VTU DBNum[7:4] ([5:4] for 6250) are located in VTU Operation 11:8 (9:8) */ err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_OP, &val); if (err) @@ -397,6 +364,7 @@ int mv88e6185_g1_vtu_getnext(struct mv88e6xxx_chip *chip, entry->fid = val & 0x000f; entry->fid |= (val & 0x0f00) >> 4; + entry->fid &= mv88e6xxx_num_databases(chip) - 1; } return 0;