From patchwork Sun Dec 13 14:07:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11970793 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=ham 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 941C2C4361B for ; Sun, 13 Dec 2020 14:09:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E70A216FD for ; Sun, 13 Dec 2020 14:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395297AbgLMOIk (ORCPT ); Sun, 13 Dec 2020 09:08:40 -0500 Received: from mail-am6eur05on2041.outbound.protection.outlook.com ([40.107.22.41]:10034 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726723AbgLMOIb (ORCPT ); Sun, 13 Dec 2020 09:08:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KgOFAbf0fG8DkGXJy8TYjmg5YPRd1n/D+KabK9S/yLN5o1tcru/aT1xtMz+FDFw264AO0r1fhtFtweVG1O4guT9uAzmE7GkKW/xvvf81VpHXz8tg6AfX/pvftgBvCREp2aWIr+MgGnQNkBx8/WkBL/99fnYIPGHFqM7lVQa/MZMU7xluSVyJgpkotArnpEcSbelisf6t+y5T0K63VCiX6I3vg/ituFeCKYre2rO9KYMfeOEsjNcykABLt34Vohcrv6MTv5AV2I8OIekxiMdLOdX4Z+/wsm/fZarPvZ+6JnCRgwjJuWSn4hraeVesxAgkZ/MxFqkpuTLTaLZsyt43ZQ== 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=ylaZDEo7pj/8yP1z7Gk7Po/YAjQTTxVqHWZyOAEa3Lg=; b=IK6vHITCQxVvR2g6RIAL4cJRgtIfyYeXytrXcoDQn/9yP9f16zDyf5efafZGPWf6TSgPG0Rr/pS9RntSxzmOV2E8WEV14txoG3wOUVgbavaPaF8YrMEZPsKgqz6Axb5DjAcROMDrrYuXU/i14KMv8hsKY0tSrDpaYYeeuG5C61bH3zzL3kdD0dYnwEagq2jvXDW9GB/+hPpfTxTI0LVXyAdYgKuoQvQwCB42kyAFaz6UF/Un160ZaPPYYe9YqY313bc36kPG24xo39h4uwHjrLYJaTFNlOLe/Myx2vDq2NhSmsFPsdEHtA18yhb2fd0XMkw+VjLXiwBQF6PykR63Rg== 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=ylaZDEo7pj/8yP1z7Gk7Po/YAjQTTxVqHWZyOAEa3Lg=; b=F5VcbLlBiwgglydu3hHcW4arJiQeJh4LFSIRZL127Q618WDTbc4EfFPZu3jbsNfpxwKD7iIi1ZyuoO4+W74IRtNgkBfIHZGPr7Jg6AVEsdIMTRz2pbDeketOAiaLt+PDu7g+fC4+PBRUCoGHxr6gDLVb3VvaSK5exWsGGzHiduM= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VE1PR04MB7341.eurprd04.prod.outlook.com (2603:10a6:800:1a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Sun, 13 Dec 2020 14:07:37 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.020; Sun, 13 Dec 2020 14:07:37 +0000 From: Vladimir Oltean To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" Cc: DENG Qingfang , Tobias Waldekranz , Marek Behun , Russell King - ARM Linux admin , Alexandra Winter , Jiri Pirko , Ido Schimmel , Claudiu Manoil , UNGLinuxDriver@microchip.com Subject: [PATCH v3 net-next 1/7] net: bridge: notify switchdev of disappearance of old FDB entry upon migration Date: Sun, 13 Dec 2020 16:07:04 +0200 Message-Id: <20201213140710.1198050-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201213140710.1198050-1-vladimir.oltean@nxp.com> References: <20201213140710.1198050-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) 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.120) by VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Sun, 13 Dec 2020 14:07:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c592c9d2-5c6d-4d98-0ca6-08d89f707211 X-MS-TrafficTypeDiagnostic: VE1PR04MB7341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PW5GE1bXdXbFuj8ZUB5M7sO+69wmJM8MAMFtVEv7OfcJzHITWi0QNEKmi+In60qDEbMwMvXgbjkoK5zMEob8xpt5FADnQjys6lbn/xQBdHMzpX3/I6TXqTvJmKPqpJuwDCN7b7acGZHilzFdwTOTeF5kq6D5SqLM7SLXuPoRFn40birZ9s1/4u5py4tZbewLP5gxDY5RHlqJzyXKRr2QYAgVd5Mvlkb+RH88lD+1iGPJ0hY3q42pdCIPHQKOcvCOwpW+UXFsaFiGZzQuoyQLQ3FaYxdjwD1uNGvRDUb3DAeQDB1gwZClB5jIBsXzusidlIyscfSg1YtAUF9+qLLXmm+jImLWcBQZQFDT7JbbfoF5i1cypy80aq5tY85gJRcqOFE37TZWQQjoiCWcK7yFvA== 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)(366004)(346002)(396003)(136003)(376002)(39850400004)(478600001)(52116002)(7416002)(5660300002)(1076003)(6666004)(316002)(16526019)(186003)(86362001)(83380400001)(8676002)(26005)(6506007)(44832011)(2616005)(956004)(69590400008)(2906002)(4326008)(8936002)(921005)(66556008)(66946007)(66476007)(54906003)(6486002)(110136005)(36756003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: QaIiJ64A2+L1LUgfTX9p91vylcQC6ds1ARiXV8b/Ums+8uOAEsYAEkB/46d9j8gkjlk92bUiBWtEdus7ezQ3IkEfwT9nkU+NPlq66ghjwXloTxtvvDWk/ALNIv+NwVTMRitl3wdPVh7YbiJODChN1wKb3Jot9Ieq7iphNQqQMeLLF8ymUobkVDYC+uDJgmUvCO4aRy6GhXK8QUK577w1CHFzak0c8YP1aQlUzCOs9SgLLzRyJ74mdEQTfRhCBOmeEU4J627GWciIely5HLZkrSNjNnB5+MTVDrOOGX8s+b/0pLU8jrYeKPQRE19J5DSM+0Ii7RnswZ5RQYRDCcmdhqxVtS7qyT8HkzJAondrdyya9RjJGjH1kZb8aGhv3nAu2509hbhVqLdSRKtwz8nn8ybWmRMJx+a/+T6xuo6iRUw8SUtIGQ5ELlGG57tEb98F5pYGqnO92liE2PVRFpqLgvzsau5laEDhO6gqpvXlra3PixvhZrFX05ZUC9ZvVTarsS9g+BobUT4rtw3tJXItpaiJdxFiCjaJShnF5pKzhLvbscg4Cr+VZ/td4f+BTFdo6BSf9uyv9Cio3R4KzvIgZ/AGNmn/o8i6sPzRx93c5QFxf1+iNufq+FQl8O26TiG1MeBnk8Uvm5M5q56uKtKlWNe6TjuhgHtdiKtAnbgExQzgvvt2A/1xesfiE252TPthFc8V/XWHH+SJodtYhYNMMC3tfOuoRTpXMs/U0Jk5teJ5HJVT08zqCutcJ05MK2WT50P12197pupnjeBqUXZMD5c8NqoYOP/8l95qNiI865VYdFc+Ig2uw2tOes6fAOwE/vyIAVlFhV0aut4pEAbBfDTifYaq6dg/4W8CRkaPP2wKfhNHNaw62PEAZCPZcZdzUUdRG3WzGhxuOeVhe4INitouCMRaHOWGAtpZxBiF30UkyeYZ5l+VSbmatHnco+dRHqsrmpVlgVRsZYHQTKGtnkvAcXD1XEgOqM5693ZBgL4cpOnPl0+AjV+BuWYGV4fr X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2020 14:07:37.0559 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: c592c9d2-5c6d-4d98-0ca6-08d89f707211 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WSGLMW/84DcJmm6g1x1ZTLdy6UToRLOLaR+TNPQhJefo/EQm7JUVzaOXBYSt3b1udA590ZVqPbKKw7mUlraMGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7341 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently the bridge emits atomic switchdev notifications for dynamically learnt FDB entries. Monitoring these notifications works wonders for switchdev drivers that want to keep their hardware FDB in sync with the bridge's FDB. For example station A wants to talk to station B in the diagram below, and we are concerned with the behavior of the bridge on the DUT device: DUT +-------------------------------------+ | br0 | | +------+ +------+ +------+ +------+ | | | | | | | | | | | | | swp0 | | swp1 | | swp2 | | eth0 | | +-------------------------------------+ | | | Station A | | | | +--+------+--+ +--+------+--+ | | | | | | | | | | swp0 | | | | swp0 | | Another | +------+ | | +------+ | Another switch | br0 | | br0 | switch | +------+ | | +------+ | | | | | | | | | | | swp1 | | | | swp1 | | +--+------+--+ +--+------+--+ | Station B Interfaces swp0, swp1, swp2 are handled by a switchdev driver that has the following property: frames injected from its control interface bypass the internal address analyzer logic, and therefore, this hardware does not learn from the source address of packets transmitted by the network stack through it. So, since bridging between eth0 (where Station B is attached) and swp0 (where Station A is attached) is done in software, the switchdev hardware will never learn the source address of Station B. So the traffic towards that destination will be treated as unknown, i.e. flooded. This is where the bridge notifications come in handy. When br0 on the DUT sees frames with Station B's MAC address on eth0, the switchdev driver gets these notifications and can install a rule to send frames towards Station B's address that are incoming from swp0, swp1, swp2, only towards the control interface. This is all switchdev driver private business, which the notification makes possible. All is fine until someone unplugs Station B's cable and moves it to the other switch: DUT +-------------------------------------+ | br0 | | +------+ +------+ +------+ +------+ | | | | | | | | | | | | | swp0 | | swp1 | | swp2 | | eth0 | | +-------------------------------------+ | | | Station A | | | | +--+------+--+ +--+------+--+ | | | | | | | | | | swp0 | | | | swp0 | | Another | +------+ | | +------+ | Another switch | br0 | | br0 | switch | +------+ | | +------+ | | | | | | | | | | | swp1 | | | | swp1 | | +--+------+--+ +--+------+--+ | Station B Luckily for the use cases we care about, Station B is noisy enough that the DUT hears it (on swp1 this time). swp1 receives the frames and delivers them to the bridge, who enters the unlikely path in br_fdb_update of updating an existing entry. It moves the entry in the software bridge to swp1 and emits an addition notification towards that. As far as the switchdev driver is concerned, all that it needs to ensure is that traffic between Station A and Station B is not forever broken. If it does nothing, then the stale rule to send frames for Station B towards the control interface remains in place. But Station B is no longer reachable via the control interface, but via a port that can offload the bridge port learning attribute. It's just that the port is prevented from learning this address, since the rule overrides FDB updates. So the rule needs to go. The question is via what mechanism. It sure would be possible for this switchdev driver to keep track of all addresses which are sent to the control interface, and then also listen for bridge notifier events on its own ports, searching for the ones that have a MAC address which was previously sent to the control interface. But this is cumbersome and inefficient. Instead, with one small change, the bridge could notify of the address deletion from the old port, in a symmetrical manner with how it did for the insertion. Then the switchdev driver would not be required to monitor learn/forget events for its own ports. It could just delete the rule towards the control interface upon bridge entry migration. This would make hardware address learning be possible again. Then it would take a few more packets until the hardware and software FDB would be in sync again. Signed-off-by: Vladimir Oltean Acked-by: Nikolay Aleksandrov Reviewed-by: Ido Schimmel Reviewed-by: Andrew Lunn --- Changes in v3: None. Changes in v2: Patch is new. net/bridge/br_fdb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 32ac8343b0ba..b7490237f3fc 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -602,6 +602,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source, /* fastpath: update of existing entry */ if (unlikely(source != fdb->dst && !test_bit(BR_FDB_STICKY, &fdb->flags))) { + br_switchdev_fdb_notify(fdb, RTM_DELNEIGH); fdb->dst = source; fdb_modified = true; /* Take over HW learned entry */ From patchwork Sun Dec 13 14:07:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11970805 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 D4514C1B0E3 for ; Sun, 13 Dec 2020 14:12:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FDF622D2C for ; Sun, 13 Dec 2020 14:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395505AbgLMOJa (ORCPT ); Sun, 13 Dec 2020 09:09:30 -0500 Received: from mail-am6eur05on2065.outbound.protection.outlook.com ([40.107.22.65]:33084 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2395337AbgLMOJA (ORCPT ); Sun, 13 Dec 2020 09:09:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BlTVdD1d4kJ8eAhtTZR8fCTiQPH90VuAxFH4i4qP4APCjxaLkrxsKqhHoapsBeKF3sVHr/jI5Obfho04rgx0up5uw76aukZfklRHI/YsRjraromOfYlYo595ylqc8X55WWi3zyKCUmbMsjeJ4HeHHaBdM9sg2MeSfkas5XX+A3wMpw8480qmZyw83l67CjQUsVYA7+ovBiFkgv9Pb9kgx5+Vv9YQanuTW9XT/RlRs9RsPRDfqBEINinVfBFEaTvYtzlilNgK5ghRkBy/solBiD/VSMYcafRVx2vbIOgCyIlaF6InvVfkRdIx+PTB2dYXgOvYTlAyRFvgywDO83O/hA== 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=Fp5VKzBanPZiLMF4KMu2uBH38U+PHeRxncpXAVmPHw4=; b=FhMqQAtyyjiOHrGe5JuAj1KiYTaGqVCPzBqxtJ7cCnUJuZk/CA7gQUo9Xb0Om9JD6G2q7NG+oNFfSlsBKA18RBkd92diWY+I1jAMADJTyxQ60g9iHPM97U96MBD/veW+WUAHUaZ0E18xKt+A2RTwG+l0xTQTLInPXS2hMH6WFMKqaFOtcgBoYGKOl2eisXxmQLzqydNRZoCyRFYqX+kKHEO7abKvjHzwYyZ6MZYwXnCwV74MSfT8VdtRz050WjQ6t9K+Pof9yqpjv393F86kuqjPeMmH9EFc50iNI8spUWSxSVGE+RFrllGaLqIGln3iz1fWRU0XuU5oDg3ODk7bIA== 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=Fp5VKzBanPZiLMF4KMu2uBH38U+PHeRxncpXAVmPHw4=; b=dpFZ7L17oVirKNnds8so1Fhkhjzu2yHQceR7WOUWYpZyF8CbXSSWK5v8g/vDpDFvnz09MU1qrpBwj4T+TisCzwsszzCdgiiT/GXyZQE/4WY+SusvlJGWxIpMohhjx3VdjEwSpRwqrQiuWyckLX93ft9uWzD9onAgIbRn6V1d0M4= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VE1PR04MB7341.eurprd04.prod.outlook.com (2603:10a6:800:1a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Sun, 13 Dec 2020 14:07:37 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.020; Sun, 13 Dec 2020 14:07:37 +0000 From: Vladimir Oltean To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" Cc: DENG Qingfang , Tobias Waldekranz , Marek Behun , Russell King - ARM Linux admin , Alexandra Winter , Jiri Pirko , Ido Schimmel , Claudiu Manoil , UNGLinuxDriver@microchip.com Subject: [PATCH v3 net-next 2/7] net: dsa: be louder when a non-legacy FDB operation fails Date: Sun, 13 Dec 2020 16:07:05 +0200 Message-Id: <20201213140710.1198050-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201213140710.1198050-1-vladimir.oltean@nxp.com> References: <20201213140710.1198050-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) 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.120) by VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Sun, 13 Dec 2020 14:07:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e4de9cc3-5feb-47ef-4186-08d89f707285 X-MS-TrafficTypeDiagnostic: VE1PR04MB7341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MMvV0nDcvEJGt9ePdfWtF/zItHY4PrJQLzlIB9K2O2oughnUHvtC8lgPrxb3Dq0XE3y+KDCk8XvCCWp/JGK88eqJ5R22YyJlNJOegwlvR81G0j79Nnr2DOdTein8Nix1Ovysmmt8TZhWmoiYHyXa92SLvGUtNUU7wOvLdfP2afahmVuOgSxRfEWp699/Yzq4bWnDtGVOsJtvXy8QdlUT8tQx2Vp+L7J5Inns3YQb9d0rVG2QLMwP/e8ApZXLXZcI0zWWXtzNmWQ4w9/hMhv/LsJ2NbASlRU21i1jUEQggvGK1TIZ+VF6yGOlgtLCZJ0NInrPCten+EWCYUnNHI+lCA5sJr6ZoaeTH6ZgIXnb6J3+VuU9EyghLDYVPEjqgCh+vXfAKWIW+IiSY3n6RysghA== 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)(366004)(346002)(396003)(136003)(376002)(39850400004)(478600001)(52116002)(7416002)(5660300002)(1076003)(6666004)(316002)(16526019)(186003)(86362001)(83380400001)(8676002)(26005)(6506007)(44832011)(2616005)(956004)(69590400008)(2906002)(4326008)(8936002)(921005)(66556008)(66946007)(66476007)(54906003)(6486002)(110136005)(36756003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: DD3zvcUmQgzBjPx4b4W8ElApbKcKc1ere/1YaA7PXi7eRiX579qegr9dO1trOQ63i8NlSonEH1rF6h24s8QCaaJ0gy1LmAsZAe/ma3d8RAU71Bg2P5RU6Lsbh5YTjrsqbLZsnlCwwCSLSldFduGZx86G161rUPCkw6TXC5PvaDYc97awZ1Cpp2fXDafNQAWSmU6RZTDwD/5ZKl0tb4MSq0Nfwy2xJ7JpJNqN3RBLCgsSIA7dzHDhtZeENC0WkSqbiD9ujj8xmeNbkOYuT0NEsZYnClCHYVqk0elofO24FiJWH6Rv4j8/yQuz3jcQsaszRgM9GkcoygdTYQwXQQjK/jpsgc4D4sCQGcMbLP7DgEhTuptIgrIj6e0/rmHnFsrMwXGeKZLGqm3UF2ud+dIyoOJuP0IbHoV57u8vQ+DztSPKOd+x0inVrh3U/fdyDNUhyBO3fgOT2MNl7hh+bLAURm4y6VBQ1rgK7VMGE16qNB/E3SIQ7jz3NX2ymkrJkj1Lw7KxBMhlxB7oKnO0QOAabMiiRILAAyN/TtyynbsZNnP/CjpQHjIYn2ZZo4gk/xGFkxpMGlL8X/mj5yzCF7QvSC6ZVEk3bFlJGer7wkfUfJX0tNtpQaUV9PR7/Y3nMqbUPEaNLc/eCQfCuiXYCVftif+vJ4lqp2kERlmPJWKmKgG/s4WJEVZaWCjl1+2TSQdtSshqzXeyjBfATYfQLEV/gGLTVnhwYfyv5JXN/EFV99eHYu/I4F2x3hrpUKD+ydNNHPGPUm+F5pNqrtsD4RIGiWF5VlGzQZ4AxPR6D0JLzj809L4pI2lwUzIQ7AhODuVf1od8gQdJoCBRt0FFkXuE3hlScotj4m6hCFIuZJd+93D9mN1NYjUSih2xQQO+jiQM8TxJvPeUxMBC3m3Hi8HL82b6fHeeSU8Wg9NF9ig2QqkhuywoDZ7uBewOQ0sGtnPZTVM1YN8GUaGBB3Oxsp1Eh39PLsT1tOOZt1quWSOEryVlt6QdiWtJRiuSRAtTXopL X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2020 14:07:37.8554 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: e4de9cc3-5feb-47ef-4186-08d89f707285 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TNc9YrK6C/Wg0XcdMghzgLNKPiw/h1y1Kqv3Wy37tzXJ0hT6gkNukdv9wVm5DuouLFaAUi5Fpd6K5wP551BrEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7341 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The dev_close() call was added in commit c9eb3e0f8701 ("net: dsa: Add support for learning FDB through notification") "to indicate inconsistent situation" when we could not delete an FDB entry from the port. bridge fdb del d8:58:d7:00:ca:6d dev swp0 self master It is a bit drastic and at the same time not helpful if the above fails to only print with netdev_dbg log level, but on the other hand to bring the interface down. So increase the verbosity of the error message, and drop dev_close(). Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn --- Changes in v3: Patch is new. net/dsa/slave.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 4a0498bf6c65..d5d389300124 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2072,7 +2072,9 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work) err = dsa_port_fdb_add(dp, fdb_info->addr, fdb_info->vid); if (err) { - netdev_dbg(dev, "fdb add failed err=%d\n", err); + netdev_err(dev, + "failed to add %pM vid %d to fdb: %d\n", + fdb_info->addr, fdb_info->vid, err); break; } fdb_info->offloaded = true; @@ -2087,9 +2089,11 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work) err = dsa_port_fdb_del(dp, fdb_info->addr, fdb_info->vid); if (err) { - netdev_dbg(dev, "fdb del failed err=%d\n", err); - dev_close(dev); + netdev_err(dev, + "failed to delete %pM vid %d from fdb: %d\n", + fdb_info->addr, fdb_info->vid, err); } + break; } rtnl_unlock(); From patchwork Sun Dec 13 14:07:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11970795 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=ham 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 A1294C433FE for ; Sun, 13 Dec 2020 14:09:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68FB822D2B for ; Sun, 13 Dec 2020 14:09:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395358AbgLMOJH (ORCPT ); Sun, 13 Dec 2020 09:09:07 -0500 Received: from mail-am6eur05on2086.outbound.protection.outlook.com ([40.107.22.86]:11936 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2395308AbgLMOIt (ORCPT ); Sun, 13 Dec 2020 09:08:49 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bam/ivUqwGwPpgszYUFanqukUmJC5zz38iRGhkr3T+57vgWN+5shS2sBabziiEmHw8N0RR1EPUwqVe86w4fFV5cn3Lweh6Wevh3+ceQqbug0myMSopgQD5O1doWh5AEfh+Zm429ightjKwzNczAlbeh1bJ3ovkglA0EfKDRz/8+smNpXrDDqVIuvfUkHbiYICAmXCOonZ4jbu3pdUX4As53ANZ3Kbn3m3ZxcPqFSDBmqksaGeKfP1OkJAKrGSEgXGwNats+bgWRByvQiYNDBVhMDf+0HRhR9wM4W43eU159NewNvHtPqJMhqRlYvmYHmwpCQ6vPQq6cO4qIapXksGQ== 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=KFJ2F2SqWd6Ad9BOGo+vZKjbtma93kif/ZXBlDu+9zk=; b=Msuxxr4rzJRYX5myIlnvvGCljciw/uFcuvsexDjhg61met7PBzKDBkhCP0jtheFr4/gxijs/WsktIP5IfpnPl5mtVVlwWcCKS+gmXQvbtPKNvvvz2wAgOQXk9I27K9z8q2I3kgr11/7CVwW8zxw2I/lCTBBREVJtvpU1Si9mXO8fiUSsZHzouERfgBTMyX+Xia3zUFFWM6PHvAlTmOeDQ0xSBe1M5KBg0ckBVuGG5QQMPuQfrxDbtDlH3rF3qmmPtLaPpxDmXdbMIhEPH0sem21AHBsOZg8D8OUh9k0jeZS1mPy+lfT+G0qHWHunxkoBMFli7Ys4DuaxsX8/Lif2Zw== 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=KFJ2F2SqWd6Ad9BOGo+vZKjbtma93kif/ZXBlDu+9zk=; b=RLpSQ84ymlidZ39Xfsh/kEWJs5+n62gRr4sSh1Lt0I4K95kb+73omCaACESrr6O2gacehTe/0RPknQp9Kzm38paBevws8hbYHKxCf7gso3NcF3MU0Z8/IDTxnSwKj3omEqhblEW+qx8b2+GMFx3D5RzhPNvHzxRrPiyB0Hq7ZLw= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VE1PR04MB7341.eurprd04.prod.outlook.com (2603:10a6:800:1a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Sun, 13 Dec 2020 14:07:38 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.020; Sun, 13 Dec 2020 14:07:38 +0000 From: Vladimir Oltean To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" Cc: DENG Qingfang , Tobias Waldekranz , Marek Behun , Russell King - ARM Linux admin , Alexandra Winter , Jiri Pirko , Ido Schimmel , Claudiu Manoil , UNGLinuxDriver@microchip.com Subject: [PATCH v3 net-next 3/7] net: dsa: don't use switchdev_notifier_fdb_info in dsa_switchdev_event_work Date: Sun, 13 Dec 2020 16:07:06 +0200 Message-Id: <20201213140710.1198050-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201213140710.1198050-1-vladimir.oltean@nxp.com> References: <20201213140710.1198050-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) 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.120) by VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Sun, 13 Dec 2020 14:07:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8db55726-b693-4177-eb87-08d89f7072f9 X-MS-TrafficTypeDiagnostic: VE1PR04MB7341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 245nLSN3BGKJduCiHDJNunRdm9v0S5dZGyFgOKxH82Vmz3cre8CQVO2q6etE6J4SAKlwqOwUYB0sQF18+yUHaZjG7hgdoRjLH8spqRxFnpP2vq5bRtGnTloVz3D1caocKJb6T4fBIQ1GOwB0Pod9E3OtlDtUS/Ya6bFBX+e/kdAGUAVerHULwhcTFwQusDTtk8BiUio1tCFFqo+gSgO5a2yXJhcecJ74rSxo+1WM4WYfTrrGPyvbrhSdGSmHlswt8oWcjSm6FgRxLKbzX645Rq7zSffwtOD6qxEA6/bmnPgIfE+G1WMfI8ThT4fHmdZrcKyqFR36ZdxZwpYAoaZUDJN7zktTM1ydYDgVSHlDv0PZDTZbrQE+5I/1syyCKxZpbhI4AUXD7H02AuF0R1TIWA== 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)(366004)(346002)(396003)(136003)(376002)(39850400004)(478600001)(52116002)(7416002)(5660300002)(1076003)(6666004)(316002)(16526019)(186003)(86362001)(83380400001)(8676002)(26005)(6506007)(44832011)(2616005)(956004)(69590400008)(2906002)(4326008)(8936002)(921005)(66556008)(66946007)(66476007)(54906003)(6486002)(110136005)(36756003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: xRdg9DIxwPzBDPBCHCnoPbgZ4qjymg7j8+pHqVLpW9Pm7b+/Nuc9gpmqxnAqsWnwiXbvynZrqC1tth3mIOrXSANRbRIGVNrqSJ+zsboVGA0sYmGpxRcHw3NtzzsW+JPrHMwgFMKVJPx71wlfBzGfTx42OpGSNNWuHoEi+plI8EEQOV8sHwgKrg+7RmU8MNrAKZamvx/s7WtwqUYQcj3PIalGUz6n28XBmFk49o4s0afayZycWcJu0ZtQEEIvU/RhcR3AJ/LQ4CGUjqDWj9r9OCLQUnm8oMrTmja3C3eVh9abJZbogOOHnqMjpfe0HDVuhLbjCaD8FXEn1X+BxglUMBywHUbvlYkFli64qkoC/v+4KGSP91nYwFDbaxUoQ4uMuRwWrfEr+IKemieOlzZnKqemPyVSd80QATeQ50N/VnSDthlhRTmJNlanAs3DDAZ1uAO6d5tXSKG5ef20wlav1w/bxRyCFYc9AKBGcgccQ+xIPY+SyX/wBQASruHm/erV6fA8k86ryaIOLHICbh3KYnU02e4IA9him1PteHQMGVhcix6kEObLUc5v1tjuyFwwl957LJ3fc9XuOo+HwP9Ouxf3YJlEBbovAR/Lg3zqnADMp7TiQTBz1Pjo4mu0uhr7N8CtxlrCYP3+7D0WbeAUQN5vXTyYj2AiBJGgmtmbjMr0pPerG0psG2vflHOP338I+Q8yjk8BBWePDMyVmiYfko16p5fRy21i1SqmshB9HPs7zP3jtWefvfPnrHfhkEEyL91aIvvKoZHnx7G2T372SND8P2SzyB89KQmSS7Y3g8ELQOnIz4TbAh9ZNYvi2lpLnRpFvC597jvUF83h+IhjUuX+q/XbPpAd5FKDLJjjzpHgkAty3QudeKqWpICTfdQAnDGQt1WCuUIKZh881Iy2Cs7jdf57MF71nZl9QMUMWEHyd9AJg9Y7DkEz63ApnPhhLQlA1UuF3N8mQbGSjJc0gmUPJ1N//GuOIMRPZ+RdeAjZx9GHerksnVpUs32aEsZp X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2020 14:07:38.6790 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: 8db55726-b693-4177-eb87-08d89f7072f9 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: p9ALrobDFCmWr/XDJntiEL0spqFwNzmvQmq9KBPqvQ7cG8rLDL7qNAq4CZ0Dve+ecknJ+dFUb8OEkRhO2zO/vg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7341 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently DSA doesn't add FDB entries on the CPU port, because it only does so through switchdev, which is associated with a net_device, and there are none of those for the CPU port. But actually FDB addresses on the CPU port have some use cases of their own, if the switchdev operations are initiated from within the DSA layer. There is just one problem with the existing code: it passes a structure in dsa_switchdev_event_work which was retrieved directly from switchdev, so it contains a net_device. We need to generalize the contents to something that covers the CPU port as well: the "ds, port" tuple is fine for that. Note that the new procedure for notifying the successful FDB offload is inspired from the rocker model. Also, nothing was being done if added_by_user was false. Let's check for that a lot earlier, and don't actually bother to schedule the worker for nothing. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- Changes in v3: None. Changes in v2: Small cosmetic changes (reverse Christmas notation) net/dsa/dsa_priv.h | 12 +++++ net/dsa/slave.c | 106 ++++++++++++++++++++++----------------------- 2 files changed, 65 insertions(+), 53 deletions(-) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 7c96aae9062c..c04225f74929 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -73,6 +73,18 @@ struct dsa_notifier_mtu_info { int mtu; }; +struct dsa_switchdev_event_work { + struct dsa_switch *ds; + int port; + struct work_struct work; + unsigned long event; + /* Specific for SWITCHDEV_FDB_ADD_TO_DEVICE and + * SWITCHDEV_FDB_DEL_TO_DEVICE + */ + unsigned char addr[ETH_ALEN]; + u16 vid; +}; + struct dsa_slave_priv { /* Copy of CPU port xmit for faster access in slave transmit hot path */ struct sk_buff * (*xmit)(struct sk_buff *skb, diff --git a/net/dsa/slave.c b/net/dsa/slave.c index d5d389300124..5e4fb44c2820 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2047,76 +2047,66 @@ static int dsa_slave_netdevice_event(struct notifier_block *nb, return NOTIFY_DONE; } -struct dsa_switchdev_event_work { - struct work_struct work; - struct switchdev_notifier_fdb_info fdb_info; - struct net_device *dev; - unsigned long event; -}; +static void +dsa_fdb_offload_notify(struct dsa_switchdev_event_work *switchdev_work) +{ + struct dsa_switch *ds = switchdev_work->ds; + struct switchdev_notifier_fdb_info info; + struct dsa_port *dp; + + if (!dsa_is_user_port(ds, switchdev_work->port)) + return; + + info.addr = switchdev_work->addr; + info.vid = switchdev_work->vid; + info.offloaded = true; + dp = dsa_to_port(ds, switchdev_work->port); + call_switchdev_notifiers(SWITCHDEV_FDB_OFFLOADED, + dp->slave, &info.info, NULL); +} static void dsa_slave_switchdev_event_work(struct work_struct *work) { struct dsa_switchdev_event_work *switchdev_work = container_of(work, struct dsa_switchdev_event_work, work); - struct net_device *dev = switchdev_work->dev; - struct switchdev_notifier_fdb_info *fdb_info; - struct dsa_port *dp = dsa_slave_to_port(dev); + struct dsa_switch *ds = switchdev_work->ds; + struct dsa_port *dp; int err; + dp = dsa_to_port(ds, switchdev_work->port); + rtnl_lock(); switch (switchdev_work->event) { case SWITCHDEV_FDB_ADD_TO_DEVICE: - fdb_info = &switchdev_work->fdb_info; - if (!fdb_info->added_by_user) - break; - - err = dsa_port_fdb_add(dp, fdb_info->addr, fdb_info->vid); + err = dsa_port_fdb_add(dp, switchdev_work->addr, + switchdev_work->vid); if (err) { - netdev_err(dev, - "failed to add %pM vid %d to fdb: %d\n", - fdb_info->addr, fdb_info->vid, err); + dev_err(ds->dev, + "port %d failed to add %pM vid %d to fdb: %d\n", + dp->index, switchdev_work->addr, + switchdev_work->vid, err); break; } - fdb_info->offloaded = true; - call_switchdev_notifiers(SWITCHDEV_FDB_OFFLOADED, dev, - &fdb_info->info, NULL); + dsa_fdb_offload_notify(switchdev_work); break; case SWITCHDEV_FDB_DEL_TO_DEVICE: - fdb_info = &switchdev_work->fdb_info; - if (!fdb_info->added_by_user) - break; - - err = dsa_port_fdb_del(dp, fdb_info->addr, fdb_info->vid); + err = dsa_port_fdb_del(dp, switchdev_work->addr, + switchdev_work->vid); if (err) { - netdev_err(dev, - "failed to delete %pM vid %d from fdb: %d\n", - fdb_info->addr, fdb_info->vid, err); + dev_err(ds->dev, + "port %d failed to delete %pM vid %d from fdb: %d\n", + dp->index, switchdev_work->addr, + switchdev_work->vid, err); } break; } rtnl_unlock(); - kfree(switchdev_work->fdb_info.addr); kfree(switchdev_work); - dev_put(dev); -} - -static int -dsa_slave_switchdev_fdb_work_init(struct dsa_switchdev_event_work * - switchdev_work, - const struct switchdev_notifier_fdb_info * - fdb_info) -{ - memcpy(&switchdev_work->fdb_info, fdb_info, - sizeof(switchdev_work->fdb_info)); - switchdev_work->fdb_info.addr = kzalloc(ETH_ALEN, GFP_ATOMIC); - if (!switchdev_work->fdb_info.addr) - return -ENOMEM; - ether_addr_copy((u8 *)switchdev_work->fdb_info.addr, - fdb_info->addr); - return 0; + if (dsa_is_user_port(ds, dp->index)) + dev_put(dp->slave); } /* Called under rcu_read_lock() */ @@ -2124,7 +2114,9 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, unsigned long event, void *ptr) { struct net_device *dev = switchdev_notifier_info_to_dev(ptr); + const struct switchdev_notifier_fdb_info *fdb_info; struct dsa_switchdev_event_work *switchdev_work; + struct dsa_port *dp; int err; if (event == SWITCHDEV_PORT_ATTR_SET) { @@ -2137,20 +2129,32 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, if (!dsa_slave_dev_check(dev)) return NOTIFY_DONE; + dp = dsa_slave_to_port(dev); + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (!switchdev_work) return NOTIFY_BAD; INIT_WORK(&switchdev_work->work, dsa_slave_switchdev_event_work); - switchdev_work->dev = dev; + switchdev_work->ds = dp->ds; + switchdev_work->port = dp->index; switchdev_work->event = event; switch (event) { case SWITCHDEV_FDB_ADD_TO_DEVICE: case SWITCHDEV_FDB_DEL_TO_DEVICE: - if (dsa_slave_switchdev_fdb_work_init(switchdev_work, ptr)) - goto err_fdb_work_init; + fdb_info = ptr; + + if (!fdb_info->added_by_user) { + kfree(switchdev_work); + return NOTIFY_OK; + } + + ether_addr_copy(switchdev_work->addr, + fdb_info->addr); + switchdev_work->vid = fdb_info->vid; + dev_hold(dev); break; default: @@ -2160,10 +2164,6 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, dsa_schedule_work(&switchdev_work->work); return NOTIFY_OK; - -err_fdb_work_init: - kfree(switchdev_work); - return NOTIFY_BAD; } static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, From patchwork Sun Dec 13 14:07:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11970797 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=ham 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 AD956C0018C for ; Sun, 13 Dec 2020 14:09:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 846BC22D57 for ; Sun, 13 Dec 2020 14:09:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395308AbgLMOJP (ORCPT ); Sun, 13 Dec 2020 09:09:15 -0500 Received: from mail-am6eur05on2041.outbound.protection.outlook.com ([40.107.22.41]:10034 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2395330AbgLMOIy (ORCPT ); Sun, 13 Dec 2020 09:08:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ie4gIcAVuZMpqw5pLT2g3Me1ZCMjpdK5XFmAARHCiKpRYaO+O5V5TxoZnqki/B6ZklvSPpsvTdRSpbdBDAGxVLFinwzMNXyIFo6cZf9o1ARcvZrUzHHTPkJei1SjLR6Q3QpZPR2BOnSvTpQkFWyML2jgBz5PIBYYuh5N8H5Nfw3mPVmP3VTchn7qBRzL+Ttt/SLq0opJGuSKbofsn2+yJe9sC/06LW2Y2BQhc8xMgOwF3uh6VJ3gqhNWIWNgXwsXe5cnoaryF+QLXlzmi8wvl+kTbOZL0i5n8cpyW+a3DNHPnsTpqKRDTyCv9H2fdpUQ183lYJFiD+ndCgUiqJjHaA== 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=WbIUbKJWWRf5XUw3Hxats9n5FRteTaPmQ+RwhMXIO/k=; b=HHlH3efhcD460JlvQshEsoOIvd6wM4LRwrZ5UpjERoFZn8CJZB72NLZgUYluB8TxCD18OB0yMhQO3yJ7UStFBcf0LODvOaR1D70HsWJtdkWO43EaCthD8hP4eWDqfN71Hc3h8BV4ii+SdXklFAGtMiwK9Gh+pIkfbjCMnEjBP/gmivuol/FTXsBXSYR+oCDDLX4gYCj4kiGWhgf8cuSYa3MhogVbjtXYSReqdLwyHFjpc1iw2R0Oq8iBRsjDE9P/iniNvU/JbKBjqHAX1IiEDPkafZ/MQq7S6f3d4h1yaWmhWqzlx0zVCFJ6Q91CKs+mg0k/LQUdINJ34IWgreCxeA== 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=WbIUbKJWWRf5XUw3Hxats9n5FRteTaPmQ+RwhMXIO/k=; b=WDTzTrhHPBK77ufWvJA6WVKgQaxVg+e6ToLApaKJj3rztSTwgjLa6FYpsVC0iIS5a8LKYag88yGzEPTWVra1qmBTXRYjzZcdi69zcgaRKDtAECgZTY2rnZAHzKrRfu+gxzONKCXNAutuM0Z4GDA+q0IOZabL1YeyrMX7OpFahgg= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VE1PR04MB7341.eurprd04.prod.outlook.com (2603:10a6:800:1a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Sun, 13 Dec 2020 14:07:39 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.020; Sun, 13 Dec 2020 14:07:39 +0000 From: Vladimir Oltean To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" Cc: DENG Qingfang , Tobias Waldekranz , Marek Behun , Russell King - ARM Linux admin , Alexandra Winter , Jiri Pirko , Ido Schimmel , Claudiu Manoil , UNGLinuxDriver@microchip.com Subject: [PATCH v3 net-next 4/7] net: dsa: move switchdev event implementation under the same switch/case statement Date: Sun, 13 Dec 2020 16:07:07 +0200 Message-Id: <20201213140710.1198050-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201213140710.1198050-1-vladimir.oltean@nxp.com> References: <20201213140710.1198050-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) 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.120) by VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Sun, 13 Dec 2020 14:07:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8549c190-2426-42c5-94e6-08d89f707377 X-MS-TrafficTypeDiagnostic: VE1PR04MB7341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +bQRsEs2c+SUPZXWtbK9TsRpSm56NUZ4glACTgt7sRGQDuwAVVBqmofIPhL2RCwkdsnIhv2A8UKTqAEKJOI6K04VYJoYv+62OXv7MwGlOwtWrJ5pHpOpbgA2kxBWeaA6y7Ka7KKK3PpaxuKKDt3/IHfKok0YGHuZ0WoAkI9FhFBTY/RJHPo76Y/6MsdcOBAah8JA6S3UMeBUcDdMVvcasrU5g2rOXYHF/QYNHjToza8oDJ4hY+DNoLVl9p32wv1cYVhM5wZMGypvf+ATC+XcgVWV1tF4QPh3G7C8yskH3qSZw26sF21/Pvqq0cSosMtJkXpOj529fkKIDoNJl6YZaZWCe9zKjaWKpRCSbtbOZpYBIvVmO/fX88uY9xAum9YrPoyXBOoByA+s71RdCTCF+Q== 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)(366004)(346002)(396003)(136003)(376002)(39850400004)(478600001)(52116002)(7416002)(5660300002)(1076003)(6666004)(316002)(16526019)(186003)(86362001)(83380400001)(8676002)(26005)(6506007)(44832011)(2616005)(956004)(69590400008)(2906002)(4326008)(8936002)(921005)(66556008)(66946007)(66476007)(54906003)(6486002)(110136005)(36756003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qFNdPqEw9rDr8SxidOldkP6y493uI7W+eG2+Tkv9PEiUD2UukFqB8/rG4oZvUfALNL0aX+6zRDMcpNgh5/KRtGZPMBf/M8vmmKoL2C+xb6Qsm/Rg+24i3CNa+HlJWId2jEkuZZnIK9A6fDVkOf0dhKQQpMNqfNav3uFCYNBvppbLzmeVkJA7ntAcHANuxyz4S0XjnHbtRP6dRI0fOJAaW1oFrJzl+qh4w6/DupyljTMMJ2OXSQZOQFza1cEH35xLw3ZI4eb60AbMYEoWhYTqU7EDwmsNUasAVNIGAAg/3dlFIO22c73o0SXWmlvHA22BTscKmwet+6XNecm/syQInTdQSZwYwZjkBvX2q3J3CW3t4QXbwH+xt/bRzC+H5TY4kAHaShthSMd6dNh0nKlyXqfXfYq/MJ5LxsprLqxSzbQca5+xQQOUUHDeV7IsAtQXPFZzhnlOW4rNExA5/1Q0CDI8qDySZ62emfAwwCDozUKXUPlmI4CBzF8JHVBovJLxBqA73T4BxQCG0nS394j9lM0RMdJw8HLggqcipteiVrw5CHtaq/Rnn+2sWSzzDpmZLYkhJFYOlJBvh7hUH66YGewQyEIM4e95hQrqRJAvfhg8MKTvoePV5fKb3O5I7WxmZGe7XB2Ib+mQGqKP6QzbPe4DBQ38mVUjKPPrST6C8Mkr4jYu6CkO1TLrg2uUVMWNB+hEPkoyOr254UClb6Ns4Ldw1gjy0Mvd5lFx9lCQmiLG8H9Gj48CKT4pLsssUvb6Hzn03GRuA8h9dVOOEc/6MgOxYagGhagLm/6pw1zsclKjBl+pBsU55c95srmgH98aP3ZMX1CoGd3dzbh/z0su2avKioAn8QkC/E3obq7pHwu0as+2NPzQd7Xkrb1MW1zyDoNXvNufph928FkOa8rk21egKZLmw8pGBCDmK7xs6cZxqF4xq7l7keCaj2tXM+8ennl35ldNg7jwfHQJVw7la4Oe72xdhvGSKG82ucVUcU478WPb/+bj+GTVEomml9rQ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2020 14:07:39.4785 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: 8549c190-2426-42c5-94e6-08d89f707377 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: G3YkDUoLPB3Qj4dJV3qtyw70Vh+or8Q8ynw7rEsXhlUicWSXTEglR9/4fut/66ENMShRXh28Gr1DpPMR4pS9cA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7341 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We'll need to start listening to SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE events even for interfaces where dsa_slave_dev_check returns false, so we need that check inside the switch-case statement for SWITCHDEV_FDB_*. This movement also avoids a useless allocation / free of switchdev_work on the untreated "default event" case. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- Changes in v3: None. Changes in v2: None. net/dsa/slave.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 5e4fb44c2820..42ec18a4c7ba 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2119,31 +2119,29 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, struct dsa_port *dp; int err; - if (event == SWITCHDEV_PORT_ATTR_SET) { + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: err = switchdev_handle_port_attr_set(dev, ptr, dsa_slave_dev_check, dsa_slave_port_attr_set); return notifier_from_errno(err); - } - - if (!dsa_slave_dev_check(dev)) - return NOTIFY_DONE; + case SWITCHDEV_FDB_ADD_TO_DEVICE: + case SWITCHDEV_FDB_DEL_TO_DEVICE: + if (!dsa_slave_dev_check(dev)) + return NOTIFY_DONE; - dp = dsa_slave_to_port(dev); + dp = dsa_slave_to_port(dev); - switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); - if (!switchdev_work) - return NOTIFY_BAD; + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); + if (!switchdev_work) + return NOTIFY_BAD; - INIT_WORK(&switchdev_work->work, - dsa_slave_switchdev_event_work); - switchdev_work->ds = dp->ds; - switchdev_work->port = dp->index; - switchdev_work->event = event; + INIT_WORK(&switchdev_work->work, + dsa_slave_switchdev_event_work); + switchdev_work->ds = dp->ds; + switchdev_work->port = dp->index; + switchdev_work->event = event; - switch (event) { - case SWITCHDEV_FDB_ADD_TO_DEVICE: - case SWITCHDEV_FDB_DEL_TO_DEVICE: fdb_info = ptr; if (!fdb_info->added_by_user) { @@ -2156,13 +2154,12 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, switchdev_work->vid = fdb_info->vid; dev_hold(dev); + dsa_schedule_work(&switchdev_work->work); break; default: - kfree(switchdev_work); return NOTIFY_DONE; } - dsa_schedule_work(&switchdev_work->work); return NOTIFY_OK; } From patchwork Sun Dec 13 14:07:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11970803 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 6A0A2C4361B for ; Sun, 13 Dec 2020 14:11:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 39D0722D57 for ; Sun, 13 Dec 2020 14:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405772AbgLMOLN (ORCPT ); Sun, 13 Dec 2020 09:11:13 -0500 Received: from mail-am6eur05on2086.outbound.protection.outlook.com ([40.107.22.86]:11936 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2395383AbgLMOJs (ORCPT ); Sun, 13 Dec 2020 09:09:48 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k/U5lzPG1KyXTaeRKACIppTrzFvSusrFTK8qILET02v0W0H0689I48R/RvqlN6gkoaSzCTdkc9t4hVm6uf5PaIMVF9F1i2EJXasTI+PtfBHOEeJU6EYOjvZ2h7upm2KzOQrAypuSwo5anfZ5PKOhvNvkYgbjBCrd2p7cYTtTXRnn+UsD8X4la/53tjt0IShmwLnSvMv4BgalLJSeCwXoKnfKnyMI27DlytMf7WP3irS5ot1zL1wMVSfMDf8nhfObNT7s88vjQJeu/foHAM1ogPf8qEdJMgJVKa+qGjMeZGoH6JGoRXgVga1UAPqGw+E8+1e/JJ647xRMbs1AeetyWg== 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=s2bs6wjP01PW5Fad76RKvfY026BE7RB8NdqhFE9PvJo=; b=O3b3m1BQmTfp8fHqgtQzwBxoyxgiun+gP5EzCOkuuyUz96OoquUNlPtbm8pXJ55Y9uSlHB6pLu+oiT5vmt4vjYAtCBSu0b4/WW92Dmxj3+pJnLBfBw13dG3EAuva2EYQR+ZAeZKVTF5dFXumsP66iq4IhGxN/jp+YMcKgrjp+hdnKs8vYj8u25Zfbz0rnsddloqnXHfDf91mC+uyHRiFSmqvYhbOqv0/DkBmMFXUeIEnEI0YBWCUIxGCnbkPoAUM3nk8n/6UKCRlldZwufZ0hBit0gOa4gvXA9hYfruL1sGCWlRx7j2scTJanJjtKM57NT6qsnGxpd0WOAFG28yLAQ== 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=s2bs6wjP01PW5Fad76RKvfY026BE7RB8NdqhFE9PvJo=; b=JSJI5e1ft4noqga99M3i+wQXi4obZApCNUKG792R+RWIQ2IGQk+i1al/Km2BhSAtOFbIFRWg4Y1nVhTIc4BONjj2Kfwo4wbZg5soQBEKeGADWc5VyHdDFOPM/A3unmEXJD6J1vzpnKgQUkDz4nr3TnJsmLPuhjaSYxzWquW+8cE= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VE1PR04MB7341.eurprd04.prod.outlook.com (2603:10a6:800:1a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Sun, 13 Dec 2020 14:07:40 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.020; Sun, 13 Dec 2020 14:07:40 +0000 From: Vladimir Oltean To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" Cc: DENG Qingfang , Tobias Waldekranz , Marek Behun , Russell King - ARM Linux admin , Alexandra Winter , Jiri Pirko , Ido Schimmel , Claudiu Manoil , UNGLinuxDriver@microchip.com Subject: [PATCH v3 net-next 5/7] net: dsa: exit early in dsa_slave_switchdev_event if we can't program the FDB Date: Sun, 13 Dec 2020 16:07:08 +0200 Message-Id: <20201213140710.1198050-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201213140710.1198050-1-vladimir.oltean@nxp.com> References: <20201213140710.1198050-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) 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.120) by VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Sun, 13 Dec 2020 14:07:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3f7d4ec3-7128-498c-a5fe-08d89f7073fb X-MS-TrafficTypeDiagnostic: VE1PR04MB7341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WNc12Jsfx6PewFes+2XWv+Qx2hbpDvZ4vr3fXmEVHYd5gMjeem12T3oRmvBytvmhUfKOJU38GKIqcpKoLnCIabNRGH04/eZQDpRMeZfSy1IFuieWacQHqtJWS2wDs+SQRUJ9902gVsPoKr7oBKOI7m2nnfMOTvWLXQKm7N9FNaPMa6kXGLOtN5DiWTJedz8v2dOL+coX1ZOfWHMYgUyiAeYYHC4CcZH3ZcoVuACNliZt2g13NsXwOAjaErdSGLs3qrsnteY9B+7/nHDgDjv2SfILe16+mAeSVfXhtrONJljuqrVRzwZCLyt2tnzymgVuDLI6nuUKlWkZz8vpz0UMmvluzc0U5E/U0jjy3+v/ATSEC+drw5pooI2gtUYUIXDY7zKMlBeftGM0/Qh31N8lPA== 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)(366004)(346002)(396003)(136003)(376002)(39850400004)(478600001)(52116002)(7416002)(5660300002)(1076003)(6666004)(316002)(16526019)(186003)(86362001)(83380400001)(8676002)(26005)(6506007)(44832011)(2616005)(956004)(69590400008)(2906002)(4326008)(8936002)(921005)(66556008)(66946007)(66476007)(54906003)(6486002)(110136005)(36756003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 8coaiFf8TonLyBW2r4355HcG2ulUQh9uNv6onI6fj65PTTCZRZVTgvCqcAJXuPUQYS/xKmNYxmqLq4N+G8sYynNooXeiKRP0XMMrlK8Xc2oEtu4KIMQv125u9heeUU/t0sM3hnIQHtscVerbsWqPYAU/21hAIz+QUWE0AiLPo7iibAm/ETTLBQlIj9FdN6MXOws56shYCUHm/LWClLaD9UTzhcYmF6PJ7XOyRXBPXmJ+R7OW07lxhzvLAiTj1T9eYQMPcmP9bzpYcZa5iiQa0WPG+rZcKzqVGjHwfEZlQjV3CAzIAw2qdq9TWyYi9AhbbdHnV488Sdg2U0cs1yHCfdN7zcENcnBfFK5sfwAz+Rdw7H6SujXgVCv+EDu8gZykrhXNBWHWk+QGAre5tdRD6MC1OnMzeKj5UWOQd4AtAHqEXM01ZaJOuRXf/G1zKpl/uL4SjL1pN0RAcRkkH6plYipv+qDec1VhWDYAKtpR3CmekIboa3IkbXo6CoX3x8N6qXE7cBwiNYs20Sf3YKd+snBR5qfrTVPg5e2Fshfe4HmqhazT/jcg5PiCgiY1QZrixnWM2V71LoL0da1AlK89a8ImBbiu72Fs/ho2C3IVkzfmzX20U6TiJuH/7qZnNxDGTSeop6h1MWUvGqnO2M+ZT4CsfUtuU9YhS+PbMrEDXaGdx/THt+O20FtWFeAfTlz22dhKUnIt0S0OhSQrWaKG1+N3UlqoYiPKMcV4Y9cOGsv5yGBsC4TxVzmCUooEsHCWh1YxZLbUl0fuSxmN1dlw9fc1FLyTH/O+Q/A47Gft/kQ/aBCUUKCFRG1mh4Rafe2gz1k2nUiWIESGYBhjtPQZ1KaIzn8yWcVN4AU+poKP9CLdsRrge3AA4UhSNgSoOpwZxyRo/DtHXUTcKyQDIIfECa37tupnv0P80T8vNz43pZNfDNZ0dRfoHwsm1S53TDH8yqcqFZmkEsISm0L/PSmtNm9YkkvYhH+czfWZkZuzoAV0SuAsbo8E0+qYGf1nkCQU X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2020 14:07:40.3440 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: 3f7d4ec3-7128-498c-a5fe-08d89f7073fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QXHTc5z1kA50dSujjzPfxrRtfKoeX1KEyZI+P35NaQ2CRp8CLq8wk5Eo5tEQNmQph2XUWzFg/jRDFc+m9I72/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7341 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Right now, the following would happen for a switch driver that does not implement .port_fdb_add or .port_fdb_del. dsa_slave_switchdev_event returns NOTIFY_OK and schedules: -> dsa_slave_switchdev_event_work -> dsa_port_fdb_add -> dsa_port_notify(DSA_NOTIFIER_FDB_ADD) -> dsa_switch_fdb_add -> if (!ds->ops->port_fdb_add) return -EOPNOTSUPP; -> an error is printed with dev_dbg, and dsa_fdb_offload_notify(switchdev_work) is not called. We can avoid scheduling the worker for nothing and say NOTIFY_DONE. Because we don't call dsa_fdb_offload_notify, the static FDB entry will remain just in the software bridge. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Reviewed-by: Andrew Lunn --- Changes in v3: s/NOTIFY_OK/NOTIFY_DONE/ in commit description. Changes in v2: Patch is new. net/dsa/slave.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 42ec18a4c7ba..37dffe5bc46f 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2132,6 +2132,9 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, dp = dsa_slave_to_port(dev); + if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del) + return NOTIFY_DONE; + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (!switchdev_work) return NOTIFY_BAD; From patchwork Sun Dec 13 14:07:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11970801 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=ham 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 22A9AC433FE for ; Sun, 13 Dec 2020 14:10:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D876C22D2B for ; Sun, 13 Dec 2020 14:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436925AbgLMOJt (ORCPT ); Sun, 13 Dec 2020 09:09:49 -0500 Received: from mail-am6eur05on2041.outbound.protection.outlook.com ([40.107.22.41]:10034 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2395437AbgLMOJ0 (ORCPT ); Sun, 13 Dec 2020 09:09:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bb6LLGFusdX+2iPQp81Hfm3HBunW6KRPdZjnwthEUt8H5xKixVGU+X/ZstSsoVqg7/fnuoxSByWb80MqH7f2kKly+/IMPGxugQdsVRA555hR1fsNxFNAerhRnYcg9MHN9SuWdD+y/lUeoK+SIPms/sMz1YM83a+SLbc5qmY8vOkxPxQUThd+bLyAjh3OFyUh4UzBlfc8IowNmMQ4CTC5lUJ5aw3wC302h3AC5CRSNT95CncgNUzkIKJ+BpnquEvlbQ7QGxrsNVtPXtPiAMHqsOgakdkbw1KnVth3Np7IZ6gQ+VzHOjk3uj3PZBI71DMyd+S1cXAS3cOQQ318uS3Z0w== 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=Kqx5kkoU3w/rJEMD08teRsTlHKpapMIVEIsnIze7Njw=; b=imwbNmt59v4g0yBRTORXa9cHkqq1xTmXodaq/uuFFHQWzrXwMm8xQ6L4IpA5M6luFo/ASj6B993WJZ3g/ah8rkmg476vHU6xku4aBjmUFFZ9kuV/QpOCMmeKeF0Ht0tRR7l9okrk+q3foekJxJ52ds/uCOoWhLa8tGziGTxHqhH+nxHOALNg6NUCS1eZyXf92K1XHIf92SHSpESNpcKkYoXKooob5FDPOKTjnDqiIxOCRLeWS72Y00wsIYU++wXvU2xpuQkXILBQP/ZhMf+DAQKV9S3u3Y7n2Oq9AF8itZlVd0+1hejiIXA4rjeWm6CGZz9TRpO0lSmFNuRUl+gFvg== 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=Kqx5kkoU3w/rJEMD08teRsTlHKpapMIVEIsnIze7Njw=; b=FxTQ26MNhlolR1kH5/sJuX/xoLNvVSifTPfz9icPtBux5ewN9C7sRHPbK8HXgapa6eaeEKqhzkp5dkLHM7EJtcnEcK718g8aZGLxbMye22tzctx0/GaexQxUI+gi/swdP/W7VLJqApF9fV9pm7UG2Dy3SGShHpQFjpF+tWBv9m4= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VE1PR04MB7341.eurprd04.prod.outlook.com (2603:10a6:800:1a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Sun, 13 Dec 2020 14:07:41 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.020; Sun, 13 Dec 2020 14:07:41 +0000 From: Vladimir Oltean To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" Cc: DENG Qingfang , Tobias Waldekranz , Marek Behun , Russell King - ARM Linux admin , Alexandra Winter , Jiri Pirko , Ido Schimmel , Claudiu Manoil , UNGLinuxDriver@microchip.com Subject: [PATCH v3 net-next 6/7] net: dsa: listen for SWITCHDEV_{FDB,DEL}_ADD_TO_DEVICE on foreign bridge neighbors Date: Sun, 13 Dec 2020 16:07:09 +0200 Message-Id: <20201213140710.1198050-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201213140710.1198050-1-vladimir.oltean@nxp.com> References: <20201213140710.1198050-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) 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.120) by VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Sun, 13 Dec 2020 14:07:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9f3ff13a-e01a-4bcb-1ae7-08d89f70747f X-MS-TrafficTypeDiagnostic: VE1PR04MB7341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ed5OHNmWgCHtfGWypNGiWS+blaRGOCPQAEf1fOcxauvHDiGUEbgjpXZUzN7bxnR1FoLCmClkj0GKv9Z7vT0aazifem/7K6qQrZU8V2wjoHc6SuzHZeXxL2hSzIgevyQBnYNor+95xuv5ujEbZ63eB4MzV4Z4sgm/3avHjk2tgTFMBp1py77ETJiutqW1rCcfAZsPezOR89VaMSgS3qdX+kx+eIs11X808IotfFOAbY+FaSF8QrM0mly23qtkeLGJ7Yg6fStH2JRtUl8stKSn9HNy0tXiZ4TNp/T7ObM9NMs7uHe5ilfePwnTtrHULWiZQqRJhS+5MrwlYW6o6w4u1lNHbdmt9tdwhdhu3Abze62adRAIk5Zb/DN6xFzUf7s7sWtDFOH27ApwmRcgIUxqMQ== 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)(366004)(346002)(396003)(136003)(376002)(39850400004)(478600001)(52116002)(7416002)(5660300002)(1076003)(6666004)(316002)(16526019)(186003)(86362001)(83380400001)(8676002)(26005)(6506007)(44832011)(2616005)(956004)(69590400008)(2906002)(4326008)(8936002)(921005)(66556008)(66946007)(66476007)(54906003)(6486002)(110136005)(36756003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ODF06xMcneK5yPjymUWghCYoiApD28wqZSuNdTGf93Ml51de1u0uudH/t40OiVvKgNWa/pOEH+dlPt2ToYp8vGCTPiXK+HeNFjtu4VqKhsDcWW0j6gsLMy2yknSggAVS+a/BlGQWgtgskzT5YWxP8C7/ahDxaDdto78s1QBMPyRF8TokhLzGugtGVufCDPs0CebU789YartLykmnhU/OrRY4dMk/gml7QKwjt1qTiOPQTwpVoENvBBmiyqGYJDFkyJIlxg9b5D+6x4GOh+OZAB4JGHqfusOOq2uiyWZOvqxnt7WAjzNcXZFhLa62RuErfP8whRUfXD5OF0F1Wtne6CyfZesumXvfb8JDGyTVm53xXhqmYMZTC9vUWlGzoF3sxHsPM49KZ6tBndzSOQHoa9t6o/UDNPPADJbGniCCky0dr7BFeKcm9Wd4EtyQog7BFyRU4rK52EQ5gC4qYSB0XfEWxRcJoOEWCqkoWa7fF5eEAk2KUdfF96lsgfcrMtT/0pNyXwgoZonGR4HIGbztr+JjEiUIYiGd83ue60RDBRHHfCo13TlI4YXCAyfcv4hdO4b9xWPjIfFquHpowq44RNoGWnb+LkQcIL0J8a2ChCL1ppImp3H1mEfJk/yrEGcc6vOp4WPD776ss7gf97qw9OHFIncqTKMSKO+l/wEXO5xKz7Z4xA9IC2AbSuA4FWPgXCJSytcqoCi/zNwTBOFn9T7zE+mNBcqZ8fNMAiQNyuCbmA0r2L3oMe7w2dW9QxO/r/nRGywUnmsQlbsxkAQO7nUCU5KWpDBJVKPG+6zllgoq8Gj6+Cdu+v9JB6Mhsjb9NWCMsfOLsfxTq68H7uKpgvOZs66lJWRAi11QPxZc4qXa5X1WhUDGHIz2zydYLuS8rl4utnkqPc5ovNRJ5lngtbcasVpQcc50SbS8wYliulKtn7XLrnBE+DULa/hVTDc4bU+NKF33iTKtj58e2zcETCi0ryZvnJ9xTvY68qwFRqkiF/h0cX/j7d32pdmJb6Hr X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2020 14:07:41.1686 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: 9f3ff13a-e01a-4bcb-1ae7-08d89f70747f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /judV4ibc7Nc01OvDWnBP7AYp3LjK/Ewceh+UM2UIBPcMf5DSA3b7VsdF3N/r2GVD+/ZGqnYBMHwinDN1JM7Og== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7341 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Some DSA switches (and not only) cannot learn source MAC addresses from packets injected from the CPU. They only perform hardware address learning from inbound traffic. This can be problematic when we have a bridge spanning some DSA switch ports and some non-DSA ports (which we'll call "foreign interfaces" from DSA's perspective). There are 2 classes of problems created by the lack of learning on CPU-injected traffic: - excessive flooding, due to the fact that DSA treats those addresses as unknown - the risk of stale routes, which can lead to temporary packet loss To illustrate the second class, consider the following situation, which is common in production equipment (wireless access points, where there is a WLAN interface and an Ethernet switch, and these form a single bridging domain). AP 1: +------------------------------------------------------------------------+ | br0 | +------------------------------------------------------------------------+ +------------+ +------------+ +------------+ +------------+ +------------+ | swp0 | | swp1 | | swp2 | | swp3 | | wlan0 | +------------+ +------------+ +------------+ +------------+ +------------+ | ^ ^ | | | | | | | Client A Client B | | | +------------+ +------------+ +------------+ +------------+ +------------+ | swp0 | | swp1 | | swp2 | | swp3 | | wlan0 | +------------+ +------------+ +------------+ +------------+ +------------+ +------------------------------------------------------------------------+ | br0 | +------------------------------------------------------------------------+ AP 2 - br0 of AP 1 will know that Clients A and B are reachable via wlan0 - the hardware fdb of a DSA switch driver today is not kept in sync with the software entries on other bridge ports, so it will not know that clients A and B are reachable via the CPU port UNLESS the hardware switch itself performs SA learning from traffic injected from the CPU. Nonetheless, a substantial number of switches don't. - the hardware fdb of the DSA switch on AP 2 may autonomously learn that Client A and B are reachable through swp0. Therefore, the software br0 of AP 2 also may or may not learn this. In the example we're illustrating, some Ethernet traffic has been going on, and br0 from AP 2 has indeed learnt that it can reach Client B through swp0. One of the wireless clients, say Client B, disconnects from AP 1 and roams to AP 2. The topology now looks like this: AP 1: +------------------------------------------------------------------------+ | br0 | +------------------------------------------------------------------------+ +------------+ +------------+ +------------+ +------------+ +------------+ | swp0 | | swp1 | | swp2 | | swp3 | | wlan0 | +------------+ +------------+ +------------+ +------------+ +------------+ | ^ | | | Client A | | | Client B | | | v +------------+ +------------+ +------------+ +------------+ +------------+ | swp0 | | swp1 | | swp2 | | swp3 | | wlan0 | +------------+ +------------+ +------------+ +------------+ +------------+ +------------------------------------------------------------------------+ | br0 | +------------------------------------------------------------------------+ AP 2 - br0 of AP 1 still knows that Client A is reachable via wlan0 (no change) - br0 of AP 1 will (possibly) know that Client B has left wlan0. There are cases where it might never find out though. Either way, DSA today does not process that notification in any way. - the hardware FDB of the DSA switch on AP 1 may learn autonomously that Client B can be reached via swp0, if it receives any packet with Client 1's source MAC address over Ethernet. - the hardware FDB of the DSA switch on AP 2 still thinks that Client B can be reached via swp0. It does not know that it has roamed to wlan0, because it doesn't perform SA learning from the CPU port. Now Client A contacts Client B. AP 1 routes the packet fine towards swp0 and delivers it on the Ethernet segment. AP 2 sees a frame on swp0 and its fdb says that the destination is swp0. Hairpinning is disabled => drop. This problem comes from the fact that these switches have a 'blind spot' for addresses coming from software bridging. The generic solution is not to assume that hardware learning can be enabled somehow, but to listen to more bridge learning events. It turns out that the bridge driver does learn in software from all inbound frames, in __br_handle_local_finish. A proper SWITCHDEV_FDB_ADD_TO_DEVICE notification is emitted for the addresses serviced by the bridge on 'foreign' interfaces. The software bridge also does the right thing on migration, by notifying that the old entry is deleted, so that does not need to be special-cased in DSA. When it is deleted, we just need to delete our static FDB entry towards the CPU too, and wait. The problem is that DSA currently only cares about SWITCHDEV_FDB_ADD_TO_DEVICE events received on its own interfaces, such as static FDB entries. Luckily we can change that, and DSA can listen to all switchdev FDB add/del events in the system and figure out if those events were emitted by a bridge that spans at least one of DSA's own ports. In case that is true, DSA will also offload that address towards its own CPU port, in the eventuality that there might be bridge clients attached to the DSA switch who want to talk to the station connected to the foreign interface. In terms of implementation, we need to keep the fdb_info->added_by_user check for the case where the switchdev event was targeted directly at a DSA switch port. But we don't need to look at that flag for snooped events. So the check is currently too late, we need to move it earlier. This also simplifies the code a bit, since we avoid uselessly allocating and freeing switchdev_work. We could probably do some improvements in the future. For example, multi-bridge support is rudimentary at the moment. If there are two bridges spanning a DSA switch's ports, and both of them need to service the same MAC address, then what will happen is that the migration of one of those stations will trigger the deletion of the FDB entry from the CPU port while it is still used by other bridge. That could be improved with reference counting but is left for another time. This behavior needs to be enabled at driver level by setting ds->assisted_learning_on_cpu_port = true. This is because we don't want to inflict a potential performance penalty (accesses through MDIO/I2C/SPI are expensive) to hardware that really doesn't need it because address learning on the CPU port works there. Reported-by: DENG Qingfang Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Reviewed-by: Andrew Lunn --- Changes in v3: - s/learning_broken/assisted_learning/ - don't call dev_hold unless it's a DSA slave interface, to avoid broken refcounting Changes in v2: Made the behavior conditional. include/net/dsa.h | 5 ++++ net/dsa/slave.c | 66 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index 4e60d2610f20..6b74690bd8d4 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -319,6 +319,11 @@ struct dsa_switch { */ bool untag_bridge_pvid; + /* Let DSA manage the FDB entries towards the CPU, based on the + * software bridge database. + */ + bool assisted_learning_on_cpu_port; + /* In case vlan_filtering_is_global is set, the VLAN awareness state * should be retrieved from here and not from the per-port settings. */ diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 37dffe5bc46f..456576f75a50 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2109,6 +2109,28 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work) dev_put(dp->slave); } +static int dsa_lower_dev_walk(struct net_device *lower_dev, + struct netdev_nested_priv *priv) +{ + if (dsa_slave_dev_check(lower_dev)) { + priv->data = (void *)netdev_priv(lower_dev); + return 1; + } + + return 0; +} + +static struct dsa_slave_priv *dsa_slave_dev_lower_find(struct net_device *dev) +{ + struct netdev_nested_priv priv = { + .data = NULL, + }; + + netdev_walk_all_lower_dev_rcu(dev, dsa_lower_dev_walk, &priv); + + return (struct dsa_slave_priv *)priv.data; +} + /* Called under rcu_read_lock() */ static int dsa_slave_switchdev_event(struct notifier_block *unused, unsigned long event, void *ptr) @@ -2127,10 +2149,37 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, return notifier_from_errno(err); case SWITCHDEV_FDB_ADD_TO_DEVICE: case SWITCHDEV_FDB_DEL_TO_DEVICE: - if (!dsa_slave_dev_check(dev)) - return NOTIFY_DONE; + fdb_info = ptr; - dp = dsa_slave_to_port(dev); + if (dsa_slave_dev_check(dev)) { + if (!fdb_info->added_by_user) + return NOTIFY_OK; + + dp = dsa_slave_to_port(dev); + } else { + /* Snoop addresses learnt on foreign interfaces + * bridged with us, for switches that don't + * automatically learn SA from CPU-injected traffic + */ + struct net_device *br_dev; + struct dsa_slave_priv *p; + + br_dev = netdev_master_upper_dev_get_rcu(dev); + if (!br_dev) + return NOTIFY_DONE; + + if (!netif_is_bridge_master(br_dev)) + return NOTIFY_DONE; + + p = dsa_slave_dev_lower_find(br_dev); + if (!p) + return NOTIFY_DONE; + + dp = p->dp->cpu_dp; + + if (!dp->ds->assisted_learning_on_cpu_port) + return NOTIFY_DONE; + } if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del) return NOTIFY_DONE; @@ -2145,18 +2194,13 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, switchdev_work->port = dp->index; switchdev_work->event = event; - fdb_info = ptr; - - if (!fdb_info->added_by_user) { - kfree(switchdev_work); - return NOTIFY_OK; - } - ether_addr_copy(switchdev_work->addr, fdb_info->addr); switchdev_work->vid = fdb_info->vid; - dev_hold(dev); + /* Hold a reference on the slave for dsa_fdb_offload_notify */ + if (dsa_is_user_port(dp->ds, dp->index)) + dev_hold(dev); dsa_schedule_work(&switchdev_work->work); break; default: From patchwork Sun Dec 13 14:07:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11970799 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=ham 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 2E284C4361B for ; Sun, 13 Dec 2020 14:09:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F197F22D2C for ; Sun, 13 Dec 2020 14:09:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436635AbgLMOJo (ORCPT ); Sun, 13 Dec 2020 09:09:44 -0500 Received: from mail-am6eur05on2065.outbound.protection.outlook.com ([40.107.22.65]:33084 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2395465AbgLMOJY (ORCPT ); Sun, 13 Dec 2020 09:09:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HOll8Y78N1nV/bSK0vnatohme858dRQ7pdiiJS19pMjuATe1cTBBvRquRzHn7W6vxP5vMZMLT5uGrYvCV5FgA8u0QCkPVwemNpJhPxVpGa2i7xebZgZRAqiokc1inT6pQCHnNwvZMRSQMMBbPIMxku7ijKirCcnkqgV0os3OtTrhVI0qIeSftYVljjvhgMX/U87oDKkiTYa0/7I4kXopzskj8kFZRHDFLfqyX4Bnw42mwFImt1tPmYIpcjIP0RhrSUD+xtn0MIosMD7noBZpvDF/EluueTZz6H0sOYDu38Rk/u9ddQfupXJMuZKCQTeG/Ta3/kiQruozOa1BjWk0kw== 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=cmHYirXK33GyxusjLAaD8CyLjHaTwwDweljcY6s/nYw=; b=gjhjhBslIkepOwOFJRUhsyu6ebsOGSbP8Jm+OFZhTMcfZoUlx8rdS7m+e8KOrBB4Drge3MgpKT0Wqf3MElMvMqmi3CIq5HlPJJj3I4VvYV4jIN0tb/S99i02e29S1cY5xhVxTcSdn1SX4X7toGozkwLiPE+mj0EzXVOXZXRaF9PiQ2yAdsSlGjCCJBfsjxIfwPORVkdWHNqeGfG+0R8UeQe17on3HA5sltRCMYJGSkrxai1lAHeWnKvIS53fUWpbuLsEorDM+yPQ73A22fV1gG3Q31WYJvmFOuRKtoM2gxOPE9LGZw99pjAgkHMpjgPPTi2x7PohEd0jKs9rr1nhnw== 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=cmHYirXK33GyxusjLAaD8CyLjHaTwwDweljcY6s/nYw=; b=NWU9FYIBOlr8HosUEyCeWaRYAFEnlA9Wxx53utxOGglrR2gfsIrAUnBBPzUo28kEcNBprOUyQomcmkkd26ZKaN7TGU4e0HiLCY9nTWERgDxMvQ7aUto9Kek8cNAv5hlJkAfqAWYp/nLfDDv7EGOyQgKL4F+ZTaGn+4Awrf3jJqw= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VE1PR04MB7341.eurprd04.prod.outlook.com (2603:10a6:800:1a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Sun, 13 Dec 2020 14:07:42 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.020; Sun, 13 Dec 2020 14:07:42 +0000 From: Vladimir Oltean To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" Cc: DENG Qingfang , Tobias Waldekranz , Marek Behun , Russell King - ARM Linux admin , Alexandra Winter , Jiri Pirko , Ido Schimmel , Claudiu Manoil , UNGLinuxDriver@microchip.com Subject: [PATCH v3 net-next 7/7] net: dsa: ocelot: request DSA to fix up lack of address learning on CPU port Date: Sun, 13 Dec 2020 16:07:10 +0200 Message-Id: <20201213140710.1198050-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201213140710.1198050-1-vladimir.oltean@nxp.com> References: <20201213140710.1198050-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) 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.120) by VI1PR08CA0235.eurprd08.prod.outlook.com (2603:10a6:802:15::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Sun, 13 Dec 2020 14:07:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 56f6a446-2f8f-4835-af2a-08d89f7074f4 X-MS-TrafficTypeDiagnostic: VE1PR04MB7341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U7VL1hFXPddt26sHBvvP2GTaadOsS8Cj76iqwY81dCW7pHvlzcTnNaeiaFr+A4VwOFYbI9J/H6CDZ+A+HewDUOVl1gV0+NFqu+WCBDmTLo7rcfb+TwpoN4gBrcn2Mij9znnngzGs++wv5Obdi1ab6+bjhD790HrXVoNF0Y5ZNDKudX5xXPvb9eT0db9jd7rPetmMf59OGpeZb+CQ5lQssAmsRtB9lxBoNoIL2ZP3LAgqc/VmeOzSXQqY1HuAePfbfDEWxeyxbqnbHYeD05j4jNbSlVxgMIxqcqUxvqZmqti20yAxZcFyt1Yx0AQgIkaVSocCXprQQvvXeBp9pWyts2QjVzAcvhkteDVr1C3Nteb7n+M2cd0LXHXbg4M12VFZDPGo9b7bYZwKUMPtRVX5zw== 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)(366004)(346002)(396003)(136003)(376002)(39850400004)(478600001)(52116002)(7416002)(5660300002)(1076003)(6666004)(316002)(16526019)(186003)(86362001)(83380400001)(8676002)(26005)(6506007)(44832011)(2616005)(956004)(69590400008)(2906002)(4326008)(8936002)(921005)(66556008)(66946007)(66476007)(54906003)(6486002)(110136005)(36756003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 98KSCJtOD4TNjTYwG8YeWjl27qQjtwDCS2Pu/OByUHi7a93KBcgq9Rr8cXxjyBx/6Nc4kc8f5AbXkaWfnYZ/y6Nw1oEc6SnZCFPv5vi7a79FW94af48Bg46DsXRmTouz8t8Anw/K7Afr6XDdbAWIoouEh5LGg53NuFkFUogMfDL5dggelKsXNEnr6qeZxvT2c+FjWGThIvtTxUp7pmdMCe+KJYR/GDuaMgQByKqK1lIisZZvacsvBH1C9I33FPnuNPbjflCI++Chby8J7k9b5049gEbEdW3suDE/5awBzzRfVom4/x9cb6S8lV/bHtRn6PJDd5qDMTHAWj2tpJKMwIF0lu183WOF1u4Udha1F6AvymTMlxDYviMex929vpxE97rbh35WOgQoSxMTFT9r713hw9x/jWGaKyn0K3pBjE/nSFpMmvDRh1+fyP6lKiUH/qaYfJaEUEGMk4rApokkrzcPmAQEXURWPNRggQPrzeH+vbLoSng43EWyedHis/x6063OGSnpOQyyJPiaWJJq6SaxXdrzwoWY5x0OFU+SY7zlT1AOTfAhU9FdkixmgoMyQi8aXG7ZFZhDWRnMEPSa7uFUukmcys2VY60oeLDAyu6ddOiVmlH2Gjf6aMDJXxR8gme79AX7UvapdQmKPj/0ss1lZ1bJIC0/wxZ4j4ZFTCjminru2eZNBDN5cAxlew/athryBWyLPCF3twFUJgs4p49pVuDQQlaPBytK27lHi/DCkG8/dlVf0ptPlqqI2G+r7yC4hNkZuJFQTJm2gYmbmYgcincz5QTkdpgoviHpzYeSJWevOZBDn6nSyZdY204H7Hz8JqTzEp7h+WaIkpLJmTJhuLUtOSspYcLlq6tGmeDHGWJ6SV3J4DY6s8TtBLxY+5ruQBfzz/0skogfLGicAGqcBpdsjA1BXsz4KJcce2DAn+pQBkowXXEqpzWP/CyeWVYZRCPH/hhnRWuGHNf+qK632NmdCymR+CgAPrkcJRxnPnu3RNCx9ey0SgAH33xp X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2020 14:07:41.9861 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: 56f6a446-2f8f-4835-af2a-08d89f7074f4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: N3Cyh6/wghJoMnvfdmg4Fuu7pEWl58uZGGTbHwpP5Fym527TICZ6eTtUh/L5iZzngpMuKFw7t7iapNXxluy15Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7341 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Given the following setup: ip link add br0 type bridge ip link set eno0 master br0 ip link set swp0 master br0 ip link set swp1 master br0 ip link set swp2 master br0 ip link set swp3 master br0 Currently, packets received on a DSA slave interface (such as swp0) which should be routed by the software bridge towards a non-switch port (such as eno0) are also flooded towards the other switch ports (swp1, swp2, swp3) because the destination is unknown to the hardware switch. This patch addresses the issue by monitoring the addresses learnt by the software bridge on eno0, and adding/deleting them as static FDB entries on the CPU port accordingly. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Reviewed-by: Andrew Lunn --- Changes in v2: s/learning_broken/assisted_learning/ Changes in v2: Patch is new. drivers/net/dsa/ocelot/felix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 7dc230677b78..90c3c76f21b2 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -629,6 +629,7 @@ static int felix_setup(struct dsa_switch *ds) ds->mtu_enforcement_ingress = true; ds->configure_vlan_while_not_filtering = true; + ds->assisted_learning_on_cpu_port = true; return 0; }