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: 365008 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+XlE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ant-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 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 --- 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;