From patchwork Thu Oct 29 02:27:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1389806 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=bjt9NNWK; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CM8W4420dz9sTD for ; Thu, 29 Oct 2020 13:28:16 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391138AbgJ2C2N (ORCPT ); Wed, 28 Oct 2020 22:28:13 -0400 Received: from mail-db8eur05on2074.outbound.protection.outlook.com ([40.107.20.74]:10036 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726741AbgJ2C2G (ORCPT ); Wed, 28 Oct 2020 22:28:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D9/aZ1bJgVQoJocJ7ZtaQHDn7xmFhngUQvwzfoMOYG7X960ZTme6OyWqY1Q0NpHRH4zv0xWfidBUrd/wy5COR15CDEknIUDABfB7JTocxk345jNKLrnXrkeHn9wa9qQcbKmhebBM7HzdZVYt2OV0JGnEkukzRsTe+9tclwTFXAWtqszWPztt32mj+kPdvwKluF8CMINmf0yZ5KwEk7rnP8IMej/QEFhpB3rGv1bxB+7oDTDwJ6ZMx/sAedZB8VDlqz8r7X59eov72qbphf6NDvMqTcQpcCwEi9TQKmRt0Om4B0j4X12maA85DbPog7e9AARd3ey5NLIuF4lylYSahg== 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=L+9p/YM5vpoAqsyErAwIAYFREiLWdj2vYdbtu+L/1Tk=; b=BySpaL6B3TS5x8OYSw2Pup3ZJTLAD6gAsxVRu8FDiB4Riw85EHbJhVZI92k76wBP3Q50sPzF3Y+3gE7EHtOqcA+eFYtsqQbp2e359yM84djSwMj48KylBDxMQJ6oxvpuEW73yfsL6BJUHTzxpJFinSgN1Ar7hXnCPILgIxj0SmsRl8eDh4b55QXgIEY6DgiaAXySkaeKmwdmhAqSYXWMtNPfR+H5unJaDnM6PeNjBJ7ZB2lLOp41eL33/U9K6jPOCPc8psYptHgkvMu1i7Fpbu2VtW5zGYZCycAtYCJEG2fPH+YkjIgjlmYg/jpBWk1JKkrT9/eGu0zL7Emce0+8Zg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L+9p/YM5vpoAqsyErAwIAYFREiLWdj2vYdbtu+L/1Tk=; b=bjt9NNWKsaAQdW4ouziy1SExf94DMW6yBsKYosgnGIleBUqGTKBhbVBwITcZKHf/Wu7jGKlik/TZItT2EdZCN+bdJdHHOKEwxtY8RQOe0CeGXK1E1ulUOdFXPvMvM2BjzXyHm/UUa5GrTkcrTCffv5AjqHkj6qGAygteOXGOXV0= Authentication-Results: microchip.com; dkim=none (message not signed) header.d=none;microchip.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR04MB6942.eurprd04.prod.outlook.com (2603:10a6:803:136::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 29 Oct 2020 02:28:00 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.027; Thu, 29 Oct 2020 02:28:00 +0000 From: Vladimir Oltean To: Microchip Linux Driver Support , Claudiu Manoil , Alexandre Belloni , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/5] net: mscc: ocelot: classify L2 mdb entries as LOCKED Date: Thu, 29 Oct 2020 04:27:34 +0200 Message-Id: <20201029022738.722794-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201029022738.722794-1-vladimir.oltean@nxp.com> References: <20201029022738.722794-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 02:27:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 143ed29d-a466-481d-7b29-08d87bb24109 X-MS-TrafficTypeDiagnostic: VI1PR04MB6942: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h0hiwHCdYD4lnDq2Nq+87sfx+j87pxLpThlAPgU1GOyDYBCS8yGCKa4RVdapJBq+ekhgg3IV5tfi88QVw07GtNFNogJiCqvlSG1ATtqIH5TlaXXmb3bzGI+UDH5ddLht7m/uzCwfZ7U2ChiWIsRqKPXuKUrtgsP+tcJMYdOFiJvlGxf/0QhJnyAwf+/+OvtS4gUeHMgtnvpp7z5FygM1l45FIOusEN1eOJTfyLnTpGcReBTVcOb0FI5tzTQzX3fW6vryN0hRGl8Jwe7lV1kAGBjIjCnEsrKSB1jW1c2gtcvHKoXCwzb4djDcM6mHBPVaATjP+Q8vpFCNWEId8yeaTM9D0v3+Q9sN7EEgEb5RrEyESa5tEa9DWZJuHCFHMD5ZwMwrIuyXubBIO5oRhvfczw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5696.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(6486002)(110136005)(186003)(5660300002)(44832011)(83380400001)(1076003)(316002)(6666004)(2906002)(86362001)(69590400008)(26005)(8936002)(16526019)(6506007)(2616005)(66556008)(8676002)(66946007)(52116002)(66476007)(36756003)(4744005)(956004)(6512007)(478600001)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AtKVCuq2+qSjMJxGBGLxqEqcMiEd8oSCY2/+tMTMn7HeBdy6njVBlx/x6TG3F5NFwB//wTAJOYQxX40bn9J2R1WNnxcARxkDsPmgOkZHnGItWBiOC+W8y0fvzSStUtsgJeYq8nil5Py8RaWEX3/OlZaHNm+WBakiGZSfiu5rhDc9eYPskEq3RXX3h7LNCgLisiM5rmV+POXspRiBXHr5mULwLGumcgrRUXnS4LAV8wZ3nDfcJHnsiUeR2f2Egi8tffI7qpNJLyqHUE8rcJC0A/hbgn2uMT+ux/2uunTgynAC8g3e4VWrmGNk85CA8++jxkhLrPwRgw7fvYfg9Mp8WoqTDWFpCuzWb/MBo0SZE1HaZKAb4dNQgKHGoGCzId3vq7VAtQvFQhkGMqt9OPTssylS+lEHDX/nDISVSYLABScPi1JM4tIVBkZQi8ZWR7gyMn7didC5O8YaDCnmOECt+J3CiLqyijgmaM7bbF2VfAHeVcNkY7q91mR/gWW8WeeqPLBPT97o6rkJNdUW7oAjnp6ybflJTPJ03edJmThnjKWVFM40mWe15FQZ6c1lagIR2dBykU73jwXbiZiuMOWb4/iidM1phiYAatrYCtdT6qiHtHRo+ZknXwrTrCHewP9Bgh/+kHc4XzlSBUZxyHxyfA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 143ed29d-a466-481d-7b29-08d87bb24109 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 02:28:00.0139 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: P7nQ+ne6/lq3/pJ0FlhMwO/C/Z1eH9Z4dZwkmG4v0SDletwUzRcSICxQOAmQ8iPOnAfBcfyGccCZA2TYgO22lA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6942 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ocelot.h says: /* MAC table entry types. * ENTRYTYPE_NORMAL is subject to aging. * ENTRYTYPE_LOCKED is not subject to aging. * ENTRYTYPE_MACv4 is not subject to aging. For IPv4 multicast. * ENTRYTYPE_MACv6 is not subject to aging. For IPv6 multicast. */ We don't want the permanent entries added with 'bridge mdb' to be subject to aging. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 70bf8c67d7ef..25152f1f2939 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -958,7 +958,7 @@ static enum macaccess_entry_type ocelot_classify_mdb(const unsigned char *addr) return ENTRYTYPE_MACv4; if (addr[0] == 0x33 && addr[1] == 0x33) return ENTRYTYPE_MACv6; - return ENTRYTYPE_NORMAL; + return ENTRYTYPE_LOCKED; } static int ocelot_mdb_get_pgid(struct ocelot *ocelot, From patchwork Thu Oct 29 02:27:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1389810 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=nGpUuSYU; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CM8WY2JNpz9sTD for ; Thu, 29 Oct 2020 13:28:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391154AbgJ2C2R (ORCPT ); Wed, 28 Oct 2020 22:28:17 -0400 Received: from mail-db8eur05on2074.outbound.protection.outlook.com ([40.107.20.74]:10036 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391116AbgJ2C2O (ORCPT ); Wed, 28 Oct 2020 22:28:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XwqQaU7t5s0Z1gCTV9hzIvOUQZ+BzVgu3L8c3zoaf9OgtjskpcgsiyCDSZlKs+n3HyVeg5y9Wygj6siTsQ/6SyoKoMGmSgbWgIfaWXdkJe40wCI2L6PUh+O6OuiHaZwLaFIzSLtHp+x8VTloXDPHQ7jykFbLu+KjgVk5eTkgtILiQz4mhZD0IN3XrRLm5C072HQjKg7nxcXqaW0jfUqGY8Y8t2wg4XeuAWqy4kti2m/viOBg/B/vvz1EKDi+LbkxbscGanS/ZCXK6S7gCVdiWYKRJlEjuS+Fi7knYA/q9UJRJRpGd+Wxi2SJxJgB+tuz9MSVlSDzoZ97W8a9bPGfvA== 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=nfakWt6AbRiWt5GVH/0WC7bjj5arZFaLMJHVsWw2KB4=; b=BhCZfIUy1VUpkKEeKdqyVDJlVPMfGyNjG/YraPFZqULF+L1KSM7NGBOWOY7fRxiHVHnbpOp3ksCQCebqv7Doaa9nejz/I9u4muUUjn16axay0YZoHnkMBvmgk68PZ3Fn6B2QUyM7kW33qeez0uFwHIQZ81KnEzGABymY9wFFCogo/vNCIhtP9WVml90VjrTq+nZjK6cK6Cmrk3HAey0rD4NdMlWCRDLbcrWWyRQML55bTZRcTPmGZoTAjkKfJ5Mkb5KJwpditxBDyp8UbeXZI9VieyX+OEasx2YfnZQYFxXHut+A4fJvi9uxtjhN9UqsJTBnF87tvyaUUBUaUUOUtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nfakWt6AbRiWt5GVH/0WC7bjj5arZFaLMJHVsWw2KB4=; b=nGpUuSYUHfcuBd2k8mos0o5a+lZ3mPRhabEdA+WEgrtUkl/qHdJryFEczNUy6bxGXi6U50B7IrzmkVmVgltUdwDkE/PyAX0lqTNUli8zhKFhTH+QBwvC5/shXO4MVI3UrDv9oKX8TchBuMdaQdLMk06aOiBkiSmoqHg256bzKVY= Authentication-Results: microchip.com; dkim=none (message not signed) header.d=none;microchip.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR04MB6942.eurprd04.prod.outlook.com (2603:10a6:803:136::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 29 Oct 2020 02:28:00 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.027; Thu, 29 Oct 2020 02:28:00 +0000 From: Vladimir Oltean To: Microchip Linux Driver Support , Claudiu Manoil , Alexandre Belloni , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/5] net: mscc: ocelot: use ether_addr_copy Date: Thu, 29 Oct 2020 04:27:35 +0200 Message-Id: <20201029022738.722794-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201029022738.722794-1-vladimir.oltean@nxp.com> References: <20201029022738.722794-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 02:28:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4303d807-16d4-462f-dcca-08d87bb24169 X-MS-TrafficTypeDiagnostic: VI1PR04MB6942: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +nJ2xK/ML6LRz9SpFMy4JbHR6B9pgVggqR7fM6I5CUZGl4vZpHroanSE5NzbBoCVqV+PpCPLatT1GEk6/NmqiQyRn2gyo5MLL0is9uEF1ZjysSKug9Yihvfa1cU8Fp1quX8+8LPRRJrBXT7Ufn2pV5uvRYt9+WeoJeH5gtr4UAE83DENaHW0NvJGYxDkNbP6bn1cz8+/4egqXktpMfnZvjHqSybtC5tga3BTvyY0Y9wF2QIT9vuRe8fBQ2d4B8IZ2PiIWt4jk6ugwKK95jSYzNzaYC6P/BtD+e+aGHGv1gru6JfeQ7zns4xOXHkD8RLCwzI/ThAqydGr7reU4eAqujN8jqNxkYW0V7pBL+Dw+XTieIeFNEMA0MYq2fqAzOhBcZfCIlPiITbXgUoL6+yvxA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5696.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(6486002)(110136005)(186003)(5660300002)(44832011)(83380400001)(1076003)(316002)(6666004)(2906002)(86362001)(69590400008)(26005)(8936002)(16526019)(6506007)(2616005)(66556008)(8676002)(66946007)(52116002)(66476007)(36756003)(4744005)(956004)(6512007)(478600001)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: DJNlrVZnlqN4D8pnCJZpktgjJDb2qX60nP6KjLBNWRLyMH7WecZ55t6b1/h0vkxkLXhCWqT1zU6H6UyRdt2wx9qyo+ldm0ltV2YJ03hEofdCOlD+ok0Xe3IW2o+ZOIbBtBMpOmSp+9CDP8OlXeDixtlMioFvej18WO/1oqjketzYxe7zu3HF4K2N5zJ+aecHw2B0mmqWm6JBNzhOY0ZbGvcAB1UowthqkMo9FZoKH6PQApYGGoadCXTLXciDIgkIRPNBeX5a92s4mm9nspaigI3YQhiNqEqlUOPsAITlYf24pHl8ec/WGJfh90lkLoblEE5aDvJlgSHm0NDYf9ylXLTHyoPRmZRBAhknjyUNJA3DsqIdL3dsHxdv+p0KLXsqBzD8sw1IQB1hQq0VrKajJmZ0dOuCW3uKv3FFIVn7y0CN/BzPaPoDYX2+EpGF7MTg/LKb4obwy6ZGa4obthbZEyp40TmiERDznb2yShqzlVs3HMgF/2ziBx0b8J524d6/FH5hZ1O6wzBDTxnvUeYzpFQQMdS7zlKxFf9lpMu3oddpyCKpYXgAY5SOCeqBqSMjksoykq4X4HTn5kCqXCdH37O7mxoMQgYrlfZlD2MpYKw0cVBlDrpuhn/lQ9TswhE73gndABWQVZrAbf3MWJn8rw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4303d807-16d4-462f-dcca-08d87bb24169 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 02:28:00.6396 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yzFNtShXgEdBjQT6dwNNwFmCOPUao5TffWS0c+8sIW6ya9+eMavbzHDmfl2Sr6Yhax5XKJrY7/2kELy5CVCgUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6942 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since a helper is available for copying Ethernet addresses, let's use it. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 25152f1f2939..763d0277eeae 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -997,7 +997,7 @@ static void ocelot_encode_ports_to_mdb(unsigned char *addr, struct ocelot_multicast *mc, enum macaccess_entry_type entry_type) { - memcpy(addr, mc->addr, ETH_ALEN); + ether_addr_copy(addr, mc->addr); if (entry_type == ENTRYTYPE_MACv4) { addr[0] = 0; @@ -1042,7 +1042,7 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, if (!mc) return -ENOMEM; - memcpy(mc->addr, mdb->addr, ETH_ALEN); + ether_addr_copy(mc->addr, mdb->addr); mc->vid = vid; mc->pgid = pgid; From patchwork Thu Oct 29 02:27:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1389807 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=MKdlouiW; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CM8WG0sFdz9sTf for ; Thu, 29 Oct 2020 13:28:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391166AbgJ2C2V (ORCPT ); Wed, 28 Oct 2020 22:28:21 -0400 Received: from mail-db8eur05on2074.outbound.protection.outlook.com ([40.107.20.74]:10036 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726741AbgJ2C2R (ORCPT ); Wed, 28 Oct 2020 22:28:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NtDmGs84R3QY5XMikLaG7J1GZLDDNdWGkAeP2UcHJs3G1Wv4r5z2bVWX2GHw+bHFozke+ZOm8hgmCNYulzAZ0vgNmcQ1OdELLjXey/LgiCGytPMEyZCpRG+Svc6XDzbtbCnc3KFRnacZ5aEn4VMG4kDnbHXivS3WiA7AZi0pr/dkGTJleNzXOjl+kMPim/z5sKCrcnRF5j4e4VxMgjus0SGizuRUlAqgLKs2F61ZK9hIG6AxKt5cVFk5a5g8WbtLz47CD/LWqKgmdWTBw1W9FkuIBEtNISmK/u6Zsyuj/IB/bPWZnwqT1+NZaPlBFCSaz6EpMz3G1KkW6ML4ltokmA== 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=vC/teyT3LI4lVg/NApky36sT6UJWtotZHBCKLc1ZyH4=; b=JCq6xFRLZ2AkMwP49zoGepgXVB9DpmsFg+yxqj/hYZq7oae+frWyzbmRQzJbJ1/yeq1WN8oKw6tpSTuQ1PEszlBWG/AHQqJuo2GehZqPaTodEQkdd2A6gqDSYBcDOf45Jd5PaY7lrYvo/RYsKwwKtARBtYvuCPz5B9Op6xR/OWdJGcW5ClwjyxRRtZlcK/VVS6W0g20qIhbRpzW8+84zxah/4X9mIDLMrTp6+0GQI4bDhD+BylnmgqTdRDrWfbgfOkudOzYj/qna0dQJVJeYP4S6FzzmtXYkAyaNsS6sj2AyKaICpKpoezVkzLCJJB9h+X9f3lBDzM0J1NyvkWDs8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vC/teyT3LI4lVg/NApky36sT6UJWtotZHBCKLc1ZyH4=; b=MKdlouiW2UvObm0Q8WOD8hTGmp2C8pJ2JHMIBbcXVB+bEnILvhQzSg7OgiIytF17VTAxznv39CBtvpcGh5GmissM02bwzJ2jQ0qSzL5+wiGqoBKXNyM4+R9JE0UFNCmJmbY9419OrV7QeJx1aqocEyRrapPUfcVgck0rqPI1jCg= Authentication-Results: microchip.com; dkim=none (message not signed) header.d=none;microchip.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR04MB6942.eurprd04.prod.outlook.com (2603:10a6:803:136::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 29 Oct 2020 02:28:01 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.027; Thu, 29 Oct 2020 02:28:01 +0000 From: Vladimir Oltean To: Microchip Linux Driver Support , Claudiu Manoil , Alexandre Belloni , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/5] net: mscc: ocelot: remove the "new" variable in ocelot_port_mdb_add Date: Thu, 29 Oct 2020 04:27:36 +0200 Message-Id: <20201029022738.722794-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201029022738.722794-1-vladimir.oltean@nxp.com> References: <20201029022738.722794-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 02:28:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9adc87bd-c4d2-491e-e38e-08d87bb241c6 X-MS-TrafficTypeDiagnostic: VI1PR04MB6942: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:431; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hpVuoz04Ej1oKNIeWGuswdmzHAqwakV0gd4y1Dwxq4DsyX2AcYyhMLb6LjQtUS1mJPQ8JZ7Tk4vXu4FHiR2/TbXtB0ydRfGKNUrXjZt5eWtd5ORQshXdWY2AW6EDw357bPKfgmemOqKEx5dFRSGGCYuLJ0s2lWZoLEnTxf8vsz8/j/IUntREsLlLstvKwf88eWMpVJdwoutA2Uyq45l0YVfxNykGhIFezeFktzHg1gEV4QiAp/ZvEvdKU1oCEw85U6CZy+uuaAVEzQVVxb1II+0C2wvE5zmjkn/drHIVw2YPvA4gdAIr1hKskf7VA+L0aOot7oixhBUiYYtgkCmxtnV6zeM0+JTUCXromC8plQI9+CGuZ4YkHzIkq8LyYjW+CbnRM1zzrUxhzY8gfMgKXA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5696.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(6486002)(110136005)(186003)(5660300002)(44832011)(83380400001)(1076003)(316002)(6666004)(2906002)(86362001)(69590400008)(26005)(8936002)(16526019)(6506007)(2616005)(66556008)(8676002)(66946007)(52116002)(66476007)(36756003)(956004)(6512007)(478600001)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RHMhFnCd1ilL6DWyNjnU982pkOuOiT/Re/PwJPYS15x/kFfXSTG56j22UqwbltwaJQEOa48Di/aFdP2w4DYYPSFzpJYOxCebzsLY18mb10rR2hw/MhBOl2bY4GGQmLvQSCsa1FC3xjew7DXl3OigjZc9gbVm3Y/V/FpohBN4q4pOCTa4TyJVbN2kdnFLmwrCo5/M32c1ju+SYaOXOIBPFUQOQ2ALGjhzLrZwNzEOagebtm3lptorE/fo8CpU7/9O+b55kLBki/on4i+45c0FxMdSEkoDTzH5/nv4QdZnCEuybnAUJQJRgP9h7zSrt/cPIvdwavaUq4bDoIPC7qXGcD82aHFrQ5BpkzJ7XJytLxackrkAP6gBT2iBeO6acpHV/wugTXgvwwcscrCeZEzu//Lown8/JwQytecoX7lBhUYV7hPZFak6SwfWwLxOukSQ12g/8LXEOaLup9wR2xgTqcGG5NM3jdnQZkpbkJCdizH4guvGB0unoGTzTbY1yP2JKoAA4bAdcdDqOvIAzkfqTHXm0l4kInibkx+GdBCJBCmtme900b7eP3LV3vu3XlfB9FMPoGpfHv/FoJrLmOR3SyW0Od49ltfuRnoOBpjLwCLFZ6sUCIKJc2uBVksr6FwVD7DU4eV4DZiueC60VSlUlw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9adc87bd-c4d2-491e-e38e-08d87bb241c6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 02:28:01.2382 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fUubfzt/8t+lFCTCNkLOYIL3LA7Xhd1CQSxM7H2CjdPvSkh7aCd0K4O2U3rR7xvhLLyC+ofOZOIddJM6I8PqAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6942 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It is Not Needed, a comment will suffice. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 763d0277eeae..ea49d715c9d0 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1017,7 +1017,6 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, unsigned char addr[ETH_ALEN]; struct ocelot_multicast *mc; u16 vid = mdb->vid; - bool new = false; if (port == ocelot->npi) port = ocelot->num_phys_ports; @@ -1029,6 +1028,7 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, mc = ocelot_multicast_get(ocelot, mdb->addr, vid); if (!mc) { + /* New entry */ int pgid = ocelot_mdb_get_pgid(ocelot, entry_type); if (pgid < 0) { @@ -1047,10 +1047,7 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, mc->pgid = pgid; list_add_tail(&mc->list, &ocelot->multicast); - new = true; - } - - if (!new) { + } else { ocelot_encode_ports_to_mdb(addr, mc, entry_type); ocelot_mact_forget(ocelot, addr, vid); } From patchwork Thu Oct 29 02:27:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1389809 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=Lt+o6bfW; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CM8WS56Nfz9sTR for ; Thu, 29 Oct 2020 13:28:36 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391179AbgJ2C21 (ORCPT ); Wed, 28 Oct 2020 22:28:27 -0400 Received: from mail-db8eur05on2074.outbound.protection.outlook.com ([40.107.20.74]:10036 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391116AbgJ2C2W (ORCPT ); Wed, 28 Oct 2020 22:28:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BEknBv6MbNaES3vrF8s+obtQi8W/53n/ochfnem4s/QWthFi6SqJaHNJAhCRJPEEeK9l0OUBbJ6oA8SYyoFL3L9nvj/ZfI5tDPlxAqA07NjdMS5w/YIWwzP/Gre63/im9hnlqTd1lKknwzIJ6q8LFhCFouelxaK3u9Upb5cLpd2WkBVxSBhL0Y88vgxU9RNom3FFTqi6vzH+z+DF2CYVPK6yVwNUNeOrM7GdbTXyEVoVA9GvRfgfZ+hgCwdwO7avYkOKq3FGLzLC67zLNchAv2U7t31lT2k+OqtVNRpEswjmwZI74VlLazzN0jLmyfGH0evrf4EDqUnFd8NGRLyPCw== 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=s2Mr2aiI4Q2i7doUveBWEEcHtRY7Ktj2XVOc+aTzDbU=; b=aFrfEp+r8wvN0Jhs5NzQYp3jMD5ePur6vi5QaRjhyCcoDtpPdKnOGd3zcA1lIgKvGDeWsV7VRSNIxiLrWQhh+nUtpZMaJoW14Mi3IXoU2rzTred+2HtGH23NOnniZR2MYUywZtG8UtaHWqDBv2knT+U/hoGZROLW02gIPdkmGeI/1vw4fEclB2gYhjIwagQ2pWTk2j2fZt0C2vOaCQZVkbDcDquNfTwIN8U/4/teprAUdC8ecXkubTnTgulEAZ8K0lldGZm2GUVlvVaS0WPRuoJLimBL0FZSKDCDTL64cwlze22OmTmxUppNd7R4kU5HIimST45cSUMX9zLcy6J8iA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s2Mr2aiI4Q2i7doUveBWEEcHtRY7Ktj2XVOc+aTzDbU=; b=Lt+o6bfWJON/nICnOnFPDSa3owOeOSNA2VoKggTwr+xkv7JmvNd7ZoqJa2z0AYMRFJDFuy36kE3+prrfYW1kXWHT25Fe7mjYgM9/a83DCr4X7C+180kjpXHOQhh0Gp0Jc3y+41pQ5v5ATDoeklUntb3GNWQh8uR1zjxWcuahIc0= Authentication-Results: microchip.com; dkim=none (message not signed) header.d=none;microchip.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR04MB6942.eurprd04.prod.outlook.com (2603:10a6:803:136::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 29 Oct 2020 02:28:01 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.027; Thu, 29 Oct 2020 02:28:01 +0000 From: Vladimir Oltean To: Microchip Linux Driver Support , Claudiu Manoil , Alexandre Belloni , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/5] net: mscc: ocelot: make entry_type a member of struct ocelot_multicast Date: Thu, 29 Oct 2020 04:27:37 +0200 Message-Id: <20201029022738.722794-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201029022738.722794-1-vladimir.oltean@nxp.com> References: <20201029022738.722794-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 02:28:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 844bb014-1301-4468-45d0-08d87bb2421e X-MS-TrafficTypeDiagnostic: VI1PR04MB6942: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7i1ZFG6MIx02milgMLfF6w1JFevUdnjrf8ETxa2jUNs7JOjVBBHC0HZXv2zNNUcCuf8B5ydL4znZ/8vcdGxXlO8ymbG8Ra8JBogHkpOMQxxm72rI0PhG/EZnEUAgumDHZuEUxUHz/LTYLuunsrWYsn1BmHi4RR164HbkjVwTOKYLK7VbR+v+eiql3qhDxL0bZeIv+ByNU6hSDDbICrWWMZXtE7ROgMT5uPK+Q0XB7YwiToHZoxv78oDjHr0/Z/Pwy3P0TNqEJ8tUr2ncUxfMqjjt85zxe45JjTxRPBoMW6VJrgt7tODdjI6LSYcITuypQh3800ue8593peM/6a5xMHC4t9ANCI9xbVdzXON6ynAicVCmgQzeXWKOHFmQgwPZaXgimYT8mtDnSNyACJZSSw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5696.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(6486002)(110136005)(186003)(5660300002)(44832011)(83380400001)(1076003)(316002)(6666004)(2906002)(86362001)(69590400008)(26005)(8936002)(16526019)(6506007)(2616005)(66556008)(8676002)(66946007)(52116002)(66476007)(36756003)(956004)(6512007)(478600001)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HZPYvR+HeI241BMmBkbcTYpuHD7LukMcsQgbFpNWh4obhNrzUhifc+EAoY1lwJJPN/CQS7JPNNIXQxZGbOWLTPiF5xnufMAxU2vAgmdx9H9Ce4ycjF7ltbtB3aldVeswrfZgmx8hY4NAjEQdzDEYAffCjnnmP8Wp2u8DRk4pZI3/pUhEiLaB78TZKffDRF9BXQCLzRGCh5LTWb/3mkEzp+p74N5s7TNy2TC9/99ks0mSI1QyNwxCDRmX6Du30D0hO4B4nS+rhJzc/pGN/fgBuDepS4eB5w0BcqFnNv/f/ADAPMCNIo1+/qiC4Zzgl9HkMACKAUmNMIBa18O+mAj8i5b6AVW9mvyr1acy+zX01OiFv1hwqldvRwZHh82YuEX87rwLs3GGwBPNw0A0gGJexfHxXEHl44j+/izlPMskgJBafdPEyuDFFkTcMr7WzHvbgbvi652yKT1u2VKk6OdSAVcVBtBhF1huk+nljSRGYxrBAKwOd4eblOKeOK3td0c7scuTX97V7H5FPlHYBozsEYclsZ+SNgFKtktIv1dC/8HMzlwkno/zhi2PAwOeOfmL0F45towaAsqPpipDDILJZdDCE3i3QLldssqm70n5OGIS+r9Q2EEl0qb0FMFsg5HqRlz8S3T+oOVd7PTrbXAUeg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 844bb014-1301-4468-45d0-08d87bb2421e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 02:28:01.8279 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A29SqE5fX2IoeuEq5CkDqf4p+6RReOdpOkw0d96A4AWN5CkR2j71Hylbm47COa/Eg3LQzjAmLT9mF8gG4fpC1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6942 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This saves a re-classification of the MDB address on deletion. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 51 +++++++++++++++--------------- drivers/net/ethernet/mscc/ocelot.h | 17 +++++----- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index ea49d715c9d0..713ab6ec8c8d 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -962,7 +962,7 @@ static enum macaccess_entry_type ocelot_classify_mdb(const unsigned char *addr) } static int ocelot_mdb_get_pgid(struct ocelot *ocelot, - enum macaccess_entry_type entry_type) + const struct ocelot_multicast *mc) { int pgid; @@ -971,8 +971,8 @@ static int ocelot_mdb_get_pgid(struct ocelot *ocelot, * destination mask table (PGID), the destination set is programmed as * part of the entry MAC address.", and the DEST_IDX is set to 0. */ - if (entry_type == ENTRYTYPE_MACv4 || - entry_type == ENTRYTYPE_MACv6) + if (mc->entry_type == ENTRYTYPE_MACv4 || + mc->entry_type == ENTRYTYPE_MACv6) return 0; for_each_nonreserved_multicast_dest_pgid(ocelot, pgid) { @@ -994,16 +994,15 @@ static int ocelot_mdb_get_pgid(struct ocelot *ocelot, } static void ocelot_encode_ports_to_mdb(unsigned char *addr, - struct ocelot_multicast *mc, - enum macaccess_entry_type entry_type) + struct ocelot_multicast *mc) { ether_addr_copy(addr, mc->addr); - if (entry_type == ENTRYTYPE_MACv4) { + if (mc->entry_type == ENTRYTYPE_MACv4) { addr[0] = 0; addr[1] = mc->ports >> 8; addr[2] = mc->ports & 0xff; - } else if (entry_type == ENTRYTYPE_MACv6) { + } else if (mc->entry_type == ENTRYTYPE_MACv6) { addr[0] = mc->ports >> 8; addr[1] = mc->ports & 0xff; } @@ -1013,7 +1012,6 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, const struct switchdev_obj_port_mdb *mdb) { struct ocelot_port *ocelot_port = ocelot->ports[port]; - enum macaccess_entry_type entry_type; unsigned char addr[ETH_ALEN]; struct ocelot_multicast *mc; u16 vid = mdb->vid; @@ -1024,12 +1022,20 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, if (!vid) vid = ocelot_port->pvid; - entry_type = ocelot_classify_mdb(mdb->addr); - mc = ocelot_multicast_get(ocelot, mdb->addr, vid); if (!mc) { /* New entry */ - int pgid = ocelot_mdb_get_pgid(ocelot, entry_type); + int pgid; + + mc = devm_kzalloc(ocelot->dev, sizeof(*mc), GFP_KERNEL); + if (!mc) + return -ENOMEM; + + mc->entry_type = ocelot_classify_mdb(mdb->addr); + ether_addr_copy(mc->addr, mdb->addr); + mc->vid = vid; + + pgid = ocelot_mdb_get_pgid(ocelot, mc); if (pgid < 0) { dev_err(ocelot->dev, @@ -1038,24 +1044,19 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, return -ENOSPC; } - mc = devm_kzalloc(ocelot->dev, sizeof(*mc), GFP_KERNEL); - if (!mc) - return -ENOMEM; - - ether_addr_copy(mc->addr, mdb->addr); - mc->vid = vid; mc->pgid = pgid; list_add_tail(&mc->list, &ocelot->multicast); } else { - ocelot_encode_ports_to_mdb(addr, mc, entry_type); + ocelot_encode_ports_to_mdb(addr, mc); ocelot_mact_forget(ocelot, addr, vid); } mc->ports |= BIT(port); - ocelot_encode_ports_to_mdb(addr, mc, entry_type); + ocelot_encode_ports_to_mdb(addr, mc); - return ocelot_mact_learn(ocelot, mc->pgid, addr, vid, entry_type); + return ocelot_mact_learn(ocelot, mc->pgid, addr, vid, + mc->entry_type); } EXPORT_SYMBOL(ocelot_port_mdb_add); @@ -1063,7 +1064,6 @@ int ocelot_port_mdb_del(struct ocelot *ocelot, int port, const struct switchdev_obj_port_mdb *mdb) { struct ocelot_port *ocelot_port = ocelot->ports[port]; - enum macaccess_entry_type entry_type; unsigned char addr[ETH_ALEN]; struct ocelot_multicast *mc; u16 vid = mdb->vid; @@ -1078,9 +1078,7 @@ int ocelot_port_mdb_del(struct ocelot *ocelot, int port, if (!mc) return -ENOENT; - entry_type = ocelot_classify_mdb(mdb->addr); - - ocelot_encode_ports_to_mdb(addr, mc, entry_type); + ocelot_encode_ports_to_mdb(addr, mc); ocelot_mact_forget(ocelot, addr, vid); mc->ports &= ~BIT(port); @@ -1090,9 +1088,10 @@ int ocelot_port_mdb_del(struct ocelot *ocelot, int port, return 0; } - ocelot_encode_ports_to_mdb(addr, mc, entry_type); + ocelot_encode_ports_to_mdb(addr, mc); - return ocelot_mact_learn(ocelot, mc->pgid, addr, vid, entry_type); + return ocelot_mact_learn(ocelot, mc->pgid, addr, vid, + mc->entry_type); } EXPORT_SYMBOL(ocelot_port_mdb_del); diff --git a/drivers/net/ethernet/mscc/ocelot.h b/drivers/net/ethernet/mscc/ocelot.h index abb407dff93c..7f8b34c49971 100644 --- a/drivers/net/ethernet/mscc/ocelot.h +++ b/drivers/net/ethernet/mscc/ocelot.h @@ -41,14 +41,6 @@ struct frame_info { u32 timestamp; /* rew_val */ }; -struct ocelot_multicast { - struct list_head list; - unsigned char addr[ETH_ALEN]; - u16 vid; - u16 ports; - int pgid; -}; - struct ocelot_port_tc { bool block_shared; unsigned long offload_cnt; @@ -87,6 +79,15 @@ enum macaccess_entry_type { ENTRYTYPE_MACv6, }; +struct ocelot_multicast { + struct list_head list; + enum macaccess_entry_type entry_type; + unsigned char addr[ETH_ALEN]; + u16 vid; + u16 ports; + int pgid; +}; + int ocelot_port_fdb_do_dump(const unsigned char *addr, u16 vid, bool is_static, void *data); int ocelot_mact_learn(struct ocelot *ocelot, int port, From patchwork Thu Oct 29 02:27:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1389808 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=CbSPinVk; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CM8WP09S0z9sTR for ; Thu, 29 Oct 2020 13:28:33 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391189AbgJ2C23 (ORCPT ); Wed, 28 Oct 2020 22:28:29 -0400 Received: from mail-db8eur05on2074.outbound.protection.outlook.com ([40.107.20.74]:10036 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391171AbgJ2C21 (ORCPT ); Wed, 28 Oct 2020 22:28:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bRzYiUGYP5M3dOK94007zUZVGzCR9vnfHjhR3Dvr7bVqlTR0+GbxtpQOq5YtAm1vHN7ORvTA6mTgR/BIjYJRrLK/j2kT+YqgvJAcab0YcwP2mzzXN0LFHYB1dgXnOIRr8U3lJVFDoSv6xwYDeivmvA9aF7BvUhE97RRc9N3sTIgkstoXYlvschJ2nZbF2Ws8Ob834JRxvoN1PtrJWWE+tJKc1CHq3Q2lNBLPJdXbt6oL/Fagc24pNLYSqxcgnmi6L4ysB/hGQWB3retJpfiRyaNIKF5rXfidlVzCqIvCH9cdmlA5/Ml278179dtG322D2gJMxmYeHBs20k37Hkxtjg== 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=YG/JVuBvuhSdmgC07ZidrlXbw0Ov7rxgyIZfES8bmFQ=; b=U5z6EgygxR5C3ZvUG5scsw6bAkYvOHcje5GvsDBbfaL0TTrc3mCz1vDu+Wn3SJb2lKA9s4Wn8E2K9J0BiUWm0sT8PONDQS4qNdaX26CYVFwuCwKdIx3HaacClRKc3fj/Mj87FJ/GbazAowgrZk7OFoq7ZJLTS9NpG1Av6PiI1JPMEx2GL8Oy+rv/Bpnb2EIbnzIpsHYyR6D1mYZY0I7U9GIlp3iTNSyhMrD8fq1CDV7eUMYWlClVOGIooWIMWbCz32QXazmyhEnG5wm/Vs63PlzITiJu6LlQnGsB8zjYvvc/sIBGq0Mgvc2epoVXX0rWepDA5D1PtZLwMrDgykQCdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YG/JVuBvuhSdmgC07ZidrlXbw0Ov7rxgyIZfES8bmFQ=; b=CbSPinVkUTaIu4vC6OONPIfJO8hFNTxIiFkGpxZw2OOlHYNwRTvUkGlg6wTExVhuliBlO6aiDrKYdfs/UDszEzPC+axVr0Z2BJZfylFIjFD1p2b0USA456yyjrZrhrYbYtZISQ7h2CuA01fkbHoXa6551BcFvnqfqpBaNAOZ1BE= Authentication-Results: microchip.com; dkim=none (message not signed) header.d=none;microchip.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR04MB6942.eurprd04.prod.outlook.com (2603:10a6:803:136::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 29 Oct 2020 02:28:02 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.027; Thu, 29 Oct 2020 02:28:02 +0000 From: Vladimir Oltean To: Microchip Linux Driver Support , Claudiu Manoil , Alexandre Belloni , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/5] net: mscc: ocelot: support L2 multicast entries Date: Thu, 29 Oct 2020 04:27:38 +0200 Message-Id: <20201029022738.722794-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201029022738.722794-1-vladimir.oltean@nxp.com> References: <20201029022738.722794-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0101CA0052.eurprd01.prod.exchangelabs.com (2603:10a6:800:1f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 02:28:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cc7a6cf5-3a6c-4967-7816-08d87bb24279 X-MS-TrafficTypeDiagnostic: VI1PR04MB6942: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vynAbtZMavgu2AgH8DoV4pzv9qXai1aga7j2Sbdix2t3LLS7ix6pGN9kKEM+u7LNCXu7aJ25e6LKN7vVMgLURwWEmj9eFcVSJ8Q0pqJtWeVGl8lAz1DpWYP3GdEp7XPPdX2XRZZCN7fGOntVm+tu+2I+BxXzZhQccgmDtqeRc5tbKm/cgVBJmYm7Rkm761CALzmQ2R/4DyIxB4r2UFlQqvVnDwOtSP7Iau5FkhqKUywsY6ZKAjz4huygMEuprgbr6FUbmZLzXgm6w40Xs1r6E6c6MfY3iB6l62TC3yGDTFEn4EVoeOrhyc8RI4okVLLgoOhS3R66xUbh1iJnB9I+zi4mz+rjo7l1IQZzsVY8knOQqsb+OyGRgfyMb6hklhdtwYZU+9WsnD1CxOSCywjfyw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5696.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(6486002)(110136005)(186003)(5660300002)(44832011)(83380400001)(1076003)(316002)(6666004)(2906002)(86362001)(69590400008)(26005)(8936002)(16526019)(6506007)(2616005)(66556008)(8676002)(66946007)(52116002)(66476007)(36756003)(956004)(6512007)(478600001)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: tfMaq9Itv5NEUV6ALF9NhudXfHiBq1QI36aRixuY7Sj9TVhctOVV4eNEljBPCqwD+rzcsYhNyzZACNiw8+nviRtLokbTIgGipdZMvZbR3vb8t72FwNf+qPaocIx+rnqghpZAA14fSsxUtw5Esg45dOl3f+tJCAJin5XL67mCjwlPfIh2huSJh8r3wr+CCcSFJcP8iDubiRF0+DNKAZI5wdfQ7hY++CbVmYrZYSWweaS/IcleOcs+44TTlwrwqya/JWLYoMBKJBMR0LD3zTIzSA/8Blj9Ic70iKwXUS8KeARefcowAUAZi1kWGziQHKdGA84NvsTDVIhljEO4KsV00yIWcDN2V8mEITKLxkDU9cv5uFdKYwZlM+9mhmSJ7th+IO1k+R4Xto5ZPst8hPx43Y4WoNw5PPeCfwxTbnxHiGBPlIXYMceFcKK8gxxFmM2RaBzO5Gp9diHJCESXScwdkYfOGY6Gp9bpAQYStiw1GU+fGtnCDuyoe37QfSCwSoEpfUEsFv9U7RFc7WCYLoHsCGS4ysyzqo+0rgpJ4SmZZruxw1TwlrLzRjNEtu0PCEml5GdCtwDxLp44i35pBXowgBlXgE+WxWsDbEeGAVQmDXo2SzJRq0aO0quMwL7qSL7JltyVdlEw5AcuALrOrDGl+g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc7a6cf5-3a6c-4967-7816-08d87bb24279 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 02:28:02.4326 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VfpxK3aQOkXCfPvAaqlcVkeVukCbf9vP+gs/j3djwCBJn40Iij7V52ps8Y9lZfrj+QkBVKnajgHF4kSO6qcuig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6942 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There is one main difference in mscc_ocelot between IP multicast and L2 multicast. With IP multicast, destination ports are encoded into the upper bytes of the multicast MAC address. Example: to deliver the address 01:00:5E:11:22:33 to ports 3, 8, and 9, one would need to program the address of 00:03:08:11:22:33 into hardware. Whereas for L2 multicast, the MAC table entry points to a Port Group ID (PGID), and that PGID contains the port mask that the packet will be forwarded to. As to why it is this way, no clue. My guess is that not all port combinations can be supported simultaneously with the limited number of PGIDs, and this was somehow an issue for IP multicast but not for L2 multicast. Anyway. Prior to this change, the raw L2 multicast code was bogus, due to the fact that there wasn't really any way to test it using the bridge code. There were 2 issues: - A multicast PGID was allocated for each MDB entry, but it wasn't in fact programmed to hardware. It was dummy. - In fact we don't want to reserve a multicast PGID for every single MDB entry. That would be odd because we can only have ~60 PGIDs, but thousands of MDB entries. So instead, we want to reserve a multicast PGID for every single port combination for multicast traffic. And since we can have 2 (or more) MDB entries delivered to the same port group (and therefore PGID), we need to reference-count the PGIDs. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 109 ++++++++++++++++++++++------- drivers/net/ethernet/mscc/ocelot.h | 16 ++++- include/soc/mscc/ocelot.h | 1 + 3 files changed, 100 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 713ab6ec8c8d..323dbd30661a 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -961,10 +961,37 @@ static enum macaccess_entry_type ocelot_classify_mdb(const unsigned char *addr) return ENTRYTYPE_LOCKED; } -static int ocelot_mdb_get_pgid(struct ocelot *ocelot, - const struct ocelot_multicast *mc) +static struct ocelot_pgid *ocelot_pgid_alloc(struct ocelot *ocelot, int index, + unsigned long ports) { - int pgid; + struct ocelot_pgid *pgid; + + pgid = kzalloc(sizeof(*pgid), GFP_KERNEL); + if (!pgid) + return ERR_PTR(-ENOMEM); + + pgid->ports = ports; + pgid->index = index; + refcount_set(&pgid->refcount, 1); + list_add_tail(&pgid->list, &ocelot->pgids); + + return pgid; +} + +static void ocelot_pgid_free(struct ocelot *ocelot, struct ocelot_pgid *pgid) +{ + if (!refcount_dec_and_test(&pgid->refcount)) + return; + + list_del(&pgid->list); + kfree(pgid); +} + +static struct ocelot_pgid *ocelot_mdb_get_pgid(struct ocelot *ocelot, + const struct ocelot_multicast *mc) +{ + struct ocelot_pgid *pgid; + int index; /* According to VSC7514 datasheet 3.9.1.5 IPv4 Multicast Entries and * 3.9.1.6 IPv6 Multicast Entries, "Instead of a lookup in the @@ -973,24 +1000,34 @@ static int ocelot_mdb_get_pgid(struct ocelot *ocelot, */ if (mc->entry_type == ENTRYTYPE_MACv4 || mc->entry_type == ENTRYTYPE_MACv6) - return 0; + return ocelot_pgid_alloc(ocelot, 0, mc->ports); + + list_for_each_entry(pgid, &ocelot->pgids, list) { + /* When searching for a nonreserved multicast PGID, ignore the + * dummy PGID of zero that we have for MACv4/MACv6 entries + */ + if (pgid->index && pgid->ports == mc->ports) { + refcount_inc(&pgid->refcount); + return pgid; + } + } - for_each_nonreserved_multicast_dest_pgid(ocelot, pgid) { - struct ocelot_multicast *mc; + /* Search for a free index in the nonreserved multicast PGID area */ + for_each_nonreserved_multicast_dest_pgid(ocelot, index) { bool used = false; - list_for_each_entry(mc, &ocelot->multicast, list) { - if (mc->pgid == pgid) { + list_for_each_entry(pgid, &ocelot->pgids, list) { + if (pgid->index == index) { used = true; break; } } if (!used) - return pgid; + return ocelot_pgid_alloc(ocelot, index, mc->ports); } - return -1; + return ERR_PTR(-ENOSPC); } static void ocelot_encode_ports_to_mdb(unsigned char *addr, @@ -1014,6 +1051,7 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, struct ocelot_port *ocelot_port = ocelot->ports[port]; unsigned char addr[ETH_ALEN]; struct ocelot_multicast *mc; + struct ocelot_pgid *pgid; u16 vid = mdb->vid; if (port == ocelot->npi) @@ -1025,8 +1063,6 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, mc = ocelot_multicast_get(ocelot, mdb->addr, vid); if (!mc) { /* New entry */ - int pgid; - mc = devm_kzalloc(ocelot->dev, sizeof(*mc), GFP_KERNEL); if (!mc) return -ENOMEM; @@ -1035,27 +1071,36 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, ether_addr_copy(mc->addr, mdb->addr); mc->vid = vid; - pgid = ocelot_mdb_get_pgid(ocelot, mc); - - if (pgid < 0) { - dev_err(ocelot->dev, - "No more PGIDs available for mdb %pM vid %d\n", - mdb->addr, vid); - return -ENOSPC; - } - - mc->pgid = pgid; - list_add_tail(&mc->list, &ocelot->multicast); } else { + /* Existing entry. Clean up the current port mask from + * hardware now, because we'll be modifying it. + */ + ocelot_pgid_free(ocelot, mc->pgid); ocelot_encode_ports_to_mdb(addr, mc); ocelot_mact_forget(ocelot, addr, vid); } mc->ports |= BIT(port); + + pgid = ocelot_mdb_get_pgid(ocelot, mc); + if (IS_ERR(pgid)) { + dev_err(ocelot->dev, + "Cannot allocate PGID for mdb %pM vid %d\n", + mc->addr, mc->vid); + devm_kfree(ocelot->dev, mc); + return PTR_ERR(pgid); + } + mc->pgid = pgid; + ocelot_encode_ports_to_mdb(addr, mc); - return ocelot_mact_learn(ocelot, mc->pgid, addr, vid, + if (mc->entry_type != ENTRYTYPE_MACv4 && + mc->entry_type != ENTRYTYPE_MACv6) + ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID, + pgid->index); + + return ocelot_mact_learn(ocelot, pgid->index, addr, vid, mc->entry_type); } EXPORT_SYMBOL(ocelot_port_mdb_add); @@ -1066,6 +1111,7 @@ int ocelot_port_mdb_del(struct ocelot *ocelot, int port, struct ocelot_port *ocelot_port = ocelot->ports[port]; unsigned char addr[ETH_ALEN]; struct ocelot_multicast *mc; + struct ocelot_pgid *pgid; u16 vid = mdb->vid; if (port == ocelot->npi) @@ -1081,6 +1127,7 @@ int ocelot_port_mdb_del(struct ocelot *ocelot, int port, ocelot_encode_ports_to_mdb(addr, mc); ocelot_mact_forget(ocelot, addr, vid); + ocelot_pgid_free(ocelot, mc->pgid); mc->ports &= ~BIT(port); if (!mc->ports) { list_del(&mc->list); @@ -1088,9 +1135,20 @@ int ocelot_port_mdb_del(struct ocelot *ocelot, int port, return 0; } + /* We have a PGID with fewer ports now */ + pgid = ocelot_mdb_get_pgid(ocelot, mc); + if (IS_ERR(pgid)) + return PTR_ERR(pgid); + mc->pgid = pgid; + ocelot_encode_ports_to_mdb(addr, mc); - return ocelot_mact_learn(ocelot, mc->pgid, addr, vid, + if (mc->entry_type != ENTRYTYPE_MACv4 && + mc->entry_type != ENTRYTYPE_MACv6) + ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID, + pgid->index); + + return ocelot_mact_learn(ocelot, pgid->index, addr, vid, mc->entry_type); } EXPORT_SYMBOL(ocelot_port_mdb_del); @@ -1449,6 +1507,7 @@ int ocelot_init(struct ocelot *ocelot) return -ENOMEM; INIT_LIST_HEAD(&ocelot->multicast); + INIT_LIST_HEAD(&ocelot->pgids); ocelot_mact_init(ocelot); ocelot_vlan_init(ocelot); ocelot_vcap_init(ocelot); diff --git a/drivers/net/ethernet/mscc/ocelot.h b/drivers/net/ethernet/mscc/ocelot.h index 7f8b34c49971..291d39d49c4e 100644 --- a/drivers/net/ethernet/mscc/ocelot.h +++ b/drivers/net/ethernet/mscc/ocelot.h @@ -79,13 +79,27 @@ enum macaccess_entry_type { ENTRYTYPE_MACv6, }; +/* A (PGID) port mask structure, encoding the 2^ocelot->num_phys_ports + * possibilities of egress port masks for L2 multicast traffic. + * For a switch with 9 user ports, there are 512 possible port masks, but the + * hardware only has 46 individual PGIDs that it can forward multicast traffic + * to. So we need a structure that maps the limited PGID indices to the port + * destinations requested by the user for L2 multicast. + */ +struct ocelot_pgid { + unsigned long ports; + int index; + refcount_t refcount; + struct list_head list; +}; + struct ocelot_multicast { struct list_head list; enum macaccess_entry_type entry_type; unsigned char addr[ETH_ALEN]; u16 vid; u16 ports; - int pgid; + struct ocelot_pgid *pgid; }; int ocelot_port_fdb_do_dump(const unsigned char *addr, u16 vid, diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 1e9db9577441..cc126d1796be 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -632,6 +632,7 @@ struct ocelot { u32 *lags; struct list_head multicast; + struct list_head pgids; struct list_head dummy_rules; struct ocelot_vcap_block block[3];