From patchwork Sat Jan 16 01:25:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 365012 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, 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 00845C433DB for ; Sat, 16 Jan 2021 01:26:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C2375207B6 for ; Sat, 16 Jan 2021 01:26:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729117AbhAPB0f (ORCPT ); Fri, 15 Jan 2021 20:26:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726103AbhAPB0b (ORCPT ); Fri, 15 Jan 2021 20:26:31 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C02D0C0613D3 for ; Fri, 15 Jan 2021 17:25:50 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id b26so15901824lff.9 for ; Fri, 15 Jan 2021 17:25:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :organization; bh=VnbZUGhcOcO+Dyfe5nmSkUdTecUEO+CYWc9F7HJm+xQ=; b=u/xiGqHASyNi6U+TBBRafbPtnLFhXjnF0x+VbB3jgdto3KayHnuBpzeNesKRLdObqy v78R/tEYUViGBV2XFwgKkt5U3/33httFfl9+HO/3q32A+qLLcjwU89rciQ31FkQ/LZ3R SY7svvUc5AY2UeV5DO/0wYxogEFB8oOh6B1qbnJbSgKjDt/FDVeJQA3NM+9YEEzrTirv lV2vB4PO+LE5/Q2LXQwPtf50xp4Ow2HFuSzE6YiSsotK0kASCBYJSId9voVeUMqlEK7W zxt764aFW5bfqie8YGt1TNhrbX1YoJwCOhS0bIhmTl57j/fajEKv+tz522YCF3Hmr80f XR6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:organization; bh=VnbZUGhcOcO+Dyfe5nmSkUdTecUEO+CYWc9F7HJm+xQ=; b=oOEEedlBC6d4t5OHg7E1INB5hC3RPnKVB9gRNbwm4ZOAqakw1te1OZiQaEVIa6wrUc 6rqu2kAgTd+yxBm7dQ0ckodb8riL8Sadr97uPfm1DTIKthfKoxbUVD1qmZl5TfJ9qwsl yVvPF5UCis2SvoE4I05DuCLqYgjJUjE8BKQ5T/Ygm67Qc3lx1Mj/Sy0+x6FYRD9dJy5j zHQWoQyxTLmH2aXyiZ6CGSI9lnanx62h2zQwEltwZuWwtJVqWYAJmdBu1qeUSGJDAWer 6ye9mxFR+hb0SZkkhn1rCevFSHkG8vzV4XAEZSaJRccBPihE3LJN3ZMb2G2yk8eRZvaw BupA== X-Gm-Message-State: AOAM530Bx5r5oPD/UoqzNaQh11t3vrMKoQoQ8XNVuB0EhRsOy6fGWtaY v60TiKrMBkFaKQQ/rx4rRnYyMQ== X-Google-Smtp-Source: ABdhPJw05sk3dyqgdQE5pDNJcrQThTU1InkB3d1RJhppXUi8Qng5snESj4eiJeexejwPtZZutIeYUQ== X-Received: by 2002:a19:430f:: with SMTP id q15mr6699770lfa.6.1610760349226; Fri, 15 Jan 2021 17:25:49 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id 198sm1085686lfn.51.2021.01.15.17.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 17:25:48 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, roopa@nvidia.com, nikolay@nvidia.com, netdev@vger.kernel.org Subject: [RFC net-next 1/7] net: bridge: switchdev: Refactor br_switchdev_fdb_notify Date: Sat, 16 Jan 2021 02:25:09 +0100 Message-Id: <20210116012515.3152-2-tobias@waldekranz.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210116012515.3152-1-tobias@waldekranz.com> References: <20210116012515.3152-1-tobias@waldekranz.com> Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Instead of having to add more and more arguments to br_switchdev_fdb_call_notifiers, get rid of it and build the info struct directly in br_switchdev_fdb_notify. Signed-off-by: Tobias Waldekranz Reviewed-by: Vladimir Oltean --- net/bridge/br_switchdev.c | 41 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index a9c23ef83443..ff470add8e52 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -102,46 +102,27 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, return 0; } -static void -br_switchdev_fdb_call_notifiers(bool adding, const unsigned char *mac, - u16 vid, struct net_device *dev, - bool added_by_user, bool offloaded) -{ - struct switchdev_notifier_fdb_info info; - unsigned long notifier_type; - - info.addr = mac; - info.vid = vid; - info.added_by_user = added_by_user; - info.offloaded = offloaded; - notifier_type = adding ? SWITCHDEV_FDB_ADD_TO_DEVICE : SWITCHDEV_FDB_DEL_TO_DEVICE; - call_switchdev_notifiers(notifier_type, dev, &info.info, NULL); -} - void br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) { + struct switchdev_notifier_fdb_info info = { + .addr = fdb->key.addr.addr, + .vid = fdb->key.vlan_id, + .added_by_user = test_bit(BR_FDB_ADDED_BY_USER, &fdb->flags), + .offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags), + }; + if (!fdb->dst) return; switch (type) { case RTM_DELNEIGH: - br_switchdev_fdb_call_notifiers(false, fdb->key.addr.addr, - fdb->key.vlan_id, - fdb->dst->dev, - test_bit(BR_FDB_ADDED_BY_USER, - &fdb->flags), - test_bit(BR_FDB_OFFLOADED, - &fdb->flags)); + call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_DEVICE, + fdb->dst->dev, &info.info, NULL); break; case RTM_NEWNEIGH: - br_switchdev_fdb_call_notifiers(true, fdb->key.addr.addr, - fdb->key.vlan_id, - fdb->dst->dev, - test_bit(BR_FDB_ADDED_BY_USER, - &fdb->flags), - test_bit(BR_FDB_OFFLOADED, - &fdb->flags)); + call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_DEVICE, + fdb->dst->dev, &info.info, NULL); break; } } From patchwork Sat Jan 16 01:25:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 365010 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 225B9C43381 for ; Sat, 16 Jan 2021 01:26:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E985823A50 for ; Sat, 16 Jan 2021 01:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729204AbhAPB0j (ORCPT ); Fri, 15 Jan 2021 20:26:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728207AbhAPB0c (ORCPT ); Fri, 15 Jan 2021 20:26:32 -0500 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 678B9C061794 for ; Fri, 15 Jan 2021 17:25:52 -0800 (PST) Received: by mail-lj1-x22d.google.com with SMTP id f11so12325731ljm.8 for ; Fri, 15 Jan 2021 17:25:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :organization; bh=2xklk+27VAAFpVpQgpop1ZiuvGBkQ/u8wQJHoD1ON9U=; b=1euKXar5RHqzp2K5q4LATijjO+bJkp7TqSoAlb2DoA/oP/S1NP5kMUw5y7O441F5fP ofdcyhMzhW6p3nom3IWSmRGH+TDuuEtGr7fTS8Pm+3I9620WkZpO8Jmq5YlxRk8bDDww gnRpG0QIGd9TeVAVfHF544eowOxZ6/yCksMaw9fKmFeAA6TkbjmKjv11uoqYNZgxKrAC eFLd1kDZ5gjBOfR+aJPmK/QGZtnb4r/9B4GJ05wMryxZTZZehpwVQiys/MZhfGvVvmkd dS3ZoMFxO/G17dK0eNPP/3XYksDQ21GZat/9uyPe6m8iY6X0g9hw4BNBV7KLQIDJyQS3 v1lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:organization; bh=2xklk+27VAAFpVpQgpop1ZiuvGBkQ/u8wQJHoD1ON9U=; b=D9gGPHFJGEZ8oIIF4yn29Vu6tasRXpeqSAODyP1RMMkESlqhTv8XlKKBF2ZwPxmH9T icnWgXMM/U7IkP9WvBp0gm0Ci8uSAMlej2iaJAhM9UnCoitlXmPNdmZHwyUgCTKaQ2ht 9D4hIYo+bz2prcqBL5kS36+tmm3qEYAL8+jlIimIBkGQOZwhwms6mbyOr+Iw6hRLBns5 0lNIDbBsZfEKQRt+4aImzADlWXitKYfQSsrvWB/BwWeQrTWqwMfm7iatVzBSeQk8FtLj qjKRq3d4FqIaCkaNL/DuJN8Pcwwj8m9KV+9m1+IOqdECwAx17IA6KHXN+ZDZiJ/Sku8y VJpQ== X-Gm-Message-State: AOAM533u4WjOZ6kAk6sScsoNQyzhzfcdNzW6Uycbq/EBfb6Bft/hh3J5 ewcByV4BaG0FMSiDK4KDjWd3Zw== X-Google-Smtp-Source: ABdhPJwF0zl66EmQ37uEkXc0LBNwp6N71nHZbIVEn71igezqOhtyIKPAl1eabZSwP/bnoq656P5RAA== X-Received: by 2002:a2e:8557:: with SMTP id u23mr6259825ljj.287.1610760349961; Fri, 15 Jan 2021 17:25:49 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id 198sm1085686lfn.51.2021.01.15.17.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 17:25:49 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, roopa@nvidia.com, nikolay@nvidia.com, netdev@vger.kernel.org Subject: [RFC net-next 2/7] net: bridge: switchdev: Include local flag in FDB notifications Date: Sat, 16 Jan 2021 02:25:10 +0100 Message-Id: <20210116012515.3152-3-tobias@waldekranz.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210116012515.3152-1-tobias@waldekranz.com> References: <20210116012515.3152-1-tobias@waldekranz.com> Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Some switchdev drivers, notably DSA, ignore all dynamically learned address notifications (!added_by_user) as these are autonomously added by the switch. Previously, such a notification was indistinguishable from a local address notification. Include a local bit in the notification so that the two classes can be discriminated. This allows DSA-like devices to add local addresses to the hardware FDB (with the CPU as the destination), thereby avoiding flows towards the CPU being flooded by the switch as unknown unicast. Signed-off-by: Tobias Waldekranz --- include/net/switchdev.h | 1 + net/bridge/br_switchdev.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 88fcac140966..43e4469a17b1 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -213,6 +213,7 @@ struct switchdev_notifier_fdb_info { const unsigned char *addr; u16 vid; u8 added_by_user:1, + local:1, offloaded:1; }; diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index ff470add8e52..1090bb3d4ee0 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -109,6 +109,7 @@ br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) .addr = fdb->key.addr.addr, .vid = fdb->key.vlan_id, .added_by_user = test_bit(BR_FDB_ADDED_BY_USER, &fdb->flags), + .local = test_bit(BR_FDB_LOCAL, &fdb->flags), .offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags), }; From patchwork Sat Jan 16 01:25:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 365011 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, 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 D72CFC433DB for ; Sat, 16 Jan 2021 01:26:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A378D229F0 for ; Sat, 16 Jan 2021 01:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729147AbhAPB0g (ORCPT ); Fri, 15 Jan 2021 20:26:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726662AbhAPB0c (ORCPT ); Fri, 15 Jan 2021 20:26:32 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24791C061793 for ; Fri, 15 Jan 2021 17:25:52 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id m25so15857544lfc.11 for ; Fri, 15 Jan 2021 17:25:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :organization; bh=OE5CJwn57ipw41wtwse27GpaDkZuxirGNUKQQ0a4wSQ=; b=Qwyt/WKje2ETDP4sm0EHQYHJ+79MvPV6f3PfrUF87ccl8s0pt/lWYHKqzLymgcN0gl ZEjLWS0meuGjGq5gfbwGcr9cIj72+AlavZghbA9N858dzO80qSDc+bWhaAml3J9yenSc WnG2mXdERa8Uz056M7DUXpm7oeHF0zJTJAtPREVeai3REdx17cLYdmFK6hotnAeThIux 3yR4QkEETyVu+ODS0e9/Yii4jlUWaIpoZfkUaWL/vD2wBEUio2yBts9KKPCqCnIGPSWA 5MJhwpe4EDJcLSTyH98TTJPOjGjPLkiZVIIetLD1sJYbt5Ctt5EEj55vYnE5DfNoCSlv 0ldw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:organization; bh=OE5CJwn57ipw41wtwse27GpaDkZuxirGNUKQQ0a4wSQ=; b=ffady0+yI7pzqqUHuA44HmWnezBAnTbnIKcZ0WM9V5rTbZoRLxlL6A/1PTkWNWngF/ 0JR/CV9sdr6wb6TSU3EfgqaR6r8vwaaYtxyeYh2XtK7lSNcFRYjWRaXRWImM+XC4dPQn ol94y7Up7bFgAxsIq5fvuQp6TSxbIfz+DYuFZzH2SZ157GuEqG3HCtGnDVXJ7y3MeiP6 cVxFT7MNcryNUSw6aXd3ckMEto7k1BBgNrofzSIA5pb14Hifzp8qHk9UcGHmkE+2cwJs FtJiPATNDIpLU98hFhewkRFxWWGZpFMtW0stfUMHuGfpi2JLlIHCtwobOY+aPuMFfoxB XyRw== X-Gm-Message-State: AOAM531z3kNqE6EHtOlf31zyeH/bG8szTg63CRRjAM1s2c0g0s9TXI3t CfLnmjTOuiYRUV99HzKZ4sJCNA== X-Google-Smtp-Source: ABdhPJxNIwEpwd/Agg85tr6juLOZIu3q0dwi8m5mInqQu5pC0onEBRo0ivCvJHvcMPHj4f2z/btqGg== X-Received: by 2002:a05:6512:30a:: with SMTP id t10mr6429086lfp.124.1610760350689; Fri, 15 Jan 2021 17:25:50 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id 198sm1085686lfn.51.2021.01.15.17.25.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 17:25:50 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, roopa@nvidia.com, nikolay@nvidia.com, netdev@vger.kernel.org Subject: [RFC net-next 3/7] net: bridge: switchdev: Send FDB notifications for host addresses Date: Sat, 16 Jan 2021 02:25:11 +0100 Message-Id: <20210116012515.3152-4-tobias@waldekranz.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210116012515.3152-1-tobias@waldekranz.com> References: <20210116012515.3152-1-tobias@waldekranz.com> Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Treat addresses added to the bridge itself in the same way as regular ports and send out a notification so that drivers may sync it down to the hardware FDB. Signed-off-by: Tobias Waldekranz --- net/bridge/br_fdb.c | 4 ++-- net/bridge/br_private.h | 7 ++++--- net/bridge/br_switchdev.c | 11 +++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index b7490237f3fc..1d54ae0f58fb 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -602,7 +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); + br_switchdev_fdb_notify(br, fdb, RTM_DELNEIGH); fdb->dst = source; fdb_modified = true; /* Take over HW learned entry */ @@ -735,7 +735,7 @@ static void fdb_notify(struct net_bridge *br, int err = -ENOBUFS; if (swdev_notify) - br_switchdev_fdb_notify(fdb, type); + br_switchdev_fdb_notify(br, fdb, type); skb = nlmsg_new(fdb_nlmsg_size(), GFP_ATOMIC); if (skb == NULL) diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index d62c6e1af64a..a3e20b747eca 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -1568,8 +1568,8 @@ bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p, int br_switchdev_set_port_flag(struct net_bridge_port *p, unsigned long flags, unsigned long mask); -void br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, - int type); +void br_switchdev_fdb_notify(struct net_bridge *br, + const struct net_bridge_fdb_entry *fdb, int type); int br_switchdev_port_vlan_add(struct net_device *dev, u16 vid, u16 flags, struct netlink_ext_ack *extack); int br_switchdev_port_vlan_del(struct net_device *dev, u16 vid); @@ -1615,7 +1615,8 @@ static inline int br_switchdev_port_vlan_del(struct net_device *dev, u16 vid) } static inline void -br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) +br_switchdev_fdb_notify(struct net_bridge *br, + const struct net_bridge_fdb_entry *fdb, int type) { } diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index 1090bb3d4ee0..125637c34f14 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -103,7 +103,8 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, } void -br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) +br_switchdev_fdb_notify(struct net_bridge *br, + const struct net_bridge_fdb_entry *fdb, int type) { struct switchdev_notifier_fdb_info info = { .addr = fdb->key.addr.addr, @@ -112,18 +113,16 @@ br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) .local = test_bit(BR_FDB_LOCAL, &fdb->flags), .offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags), }; - - if (!fdb->dst) - return; + struct net_device *dev = fdb->dst ? fdb->dst->dev : br->dev; switch (type) { case RTM_DELNEIGH: call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_DEVICE, - fdb->dst->dev, &info.info, NULL); + dev, &info.info, NULL); break; case RTM_NEWNEIGH: call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_DEVICE, - fdb->dst->dev, &info.info, NULL); + dev, &info.info, NULL); break; } } From patchwork Sat Jan 16 01:25:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 365426 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, 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 199FDC433E6 for ; Sat, 16 Jan 2021 01:26:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D24F523A58 for ; Sat, 16 Jan 2021 01:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729176AbhAPB0j (ORCPT ); Fri, 15 Jan 2021 20:26:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729073AbhAPB0d (ORCPT ); Fri, 15 Jan 2021 20:26:33 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE9E3C061795 for ; Fri, 15 Jan 2021 17:25:52 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id v24so9247713lfr.7 for ; Fri, 15 Jan 2021 17:25:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :organization; bh=I2MDp2bsfstQYUyH+t/jAMlPvFO7J70eM+caStL93S4=; b=HgCm51uOmmKcMOOzJyPBW8W9pzpFlPTbTuuWJbZtclF+6wZNy4ioleqYqSKb32bTsY 6IpECem7J/FBbSsNy6YmZZSyfx4yrzvaoMxQ8veLuC1qBpUOqLLwt2OnPLZTusS5Y1ec AyTYnpIxSPChZirGJ02qDjZy5FbFFzqcl8Eg5ASV1ZrPCxbzC8fe5z7tBBoX39/Z4U4F JIGxyZru5sZPAWPiKr7xcRSWd7NBY5KtxeCdwZALYA6+l3/wDMEZt2rEBKwcM/6XOE6L kB0NvpUVs5saKxchAhDsWhg/EuatJM7xrGZlVERyJE51IcV7hb2pnxDgNM9S8n2hD0ng jVcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:organization; bh=I2MDp2bsfstQYUyH+t/jAMlPvFO7J70eM+caStL93S4=; b=jbOpnWlmy5cxTDwhvHiG3C5sSI3fn/v8q4RJUI4waW3gkWSJktRrsjLSoBPGNs3JR4 vj1hn8SfPfuh+NWtekDUe+Llbcb+xXecb/vtaJjDq1yMLEU4wTRiQcWc13gKNMvWRmxV 5JxA26pColYLVAeUChwGI242ccFoG6mfuQsK19ue26IUNbqh6odWxCiXYznL+acvX/YD tjxyraLasZnynqJaMtjRxjkpBswaW3HyWdZR9dcleVqH8y7U4OOuptxt8rbYH/Gkcow5 9sqhTkACqafDUXEi2PbkpqLBFQvBGl2NbE28re1TSYO6pAhtWHbPubCw5ztADJ9gi+cJ E/9Q== X-Gm-Message-State: AOAM533YkVOSY91uRluWTNhHfl7qUgiN6s32foduS+w+NkhVwl4SDLY8 oGfBb/CDDZI77ts4ePAgxr/dNw== X-Google-Smtp-Source: ABdhPJyq5hlVxENQf/30b+v+mSkh9rTkO1S8RYxQPbKcmvvqHb6cGZypqpXOUpJ1mIbDQW5GWwLUyg== X-Received: by 2002:a19:4813:: with SMTP id v19mr7237054lfa.655.1610760351421; Fri, 15 Jan 2021 17:25:51 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id 198sm1085686lfn.51.2021.01.15.17.25.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 17:25:50 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, roopa@nvidia.com, nikolay@nvidia.com, netdev@vger.kernel.org Subject: [RFC net-next 4/7] net: dsa: Include local addresses in assisted CPU port learning Date: Sat, 16 Jan 2021 02:25:12 +0100 Message-Id: <20210116012515.3152-5-tobias@waldekranz.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210116012515.3152-1-tobias@waldekranz.com> References: <20210116012515.3152-1-tobias@waldekranz.com> Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add local addresses (i.e. the ports' MAC addresses) to the hardware FDB when assisted CPU port learning is enabled. NOTE: The bridge's own MAC address is also "local". If that address is not shared with any port, the bridge's MAC is not be added by this functionality - but the following commit takes care of that case. Signed-off-by: Tobias Waldekranz --- net/dsa/slave.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index c5c81cba8259..dca393e45547 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2174,10 +2174,12 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, fdb_info = ptr; if (dsa_slave_dev_check(dev)) { - if (!fdb_info->added_by_user) - return NOTIFY_OK; - dp = dsa_slave_to_port(dev); + + if (fdb_info->local && dp->ds->assisted_learning_on_cpu_port) + dp = dp->cpu_dp; + else if (!fdb_info->added_by_user) + return NOTIFY_OK; } else { /* Snoop addresses learnt on foreign interfaces * bridged with us, for switches that don't From patchwork Sat Jan 16 01:25:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 365425 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 28F45C433E0 for ; Sat, 16 Jan 2021 01:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9DB323A3C for ; Sat, 16 Jan 2021 01:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729318AbhAPB1O (ORCPT ); Fri, 15 Jan 2021 20:27:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726720AbhAPB1M (ORCPT ); Fri, 15 Jan 2021 20:27:12 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B43CC061796 for ; Fri, 15 Jan 2021 17:25:53 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id u25so15909476lfc.2 for ; Fri, 15 Jan 2021 17:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :organization; bh=4rDudkueB+J/rIldFghOHcw9v72dbdm42Obo+Ici9oM=; b=ZFhv6LPZepr53zK5PFNp/7F7jEvImHKGLn9Xj1hBMHImn7FFLM8yx6obegfINua2fY D84luhW8jKnabInRsw+uxqsHrQk/VOzHh/GQgmvFSPo1toLAEOQiZQcSYwPhLtQdI7Pg KKiCkTWDmQO0Jv7NNX0QWiEvCzLIZUzHqGRedAzsOQUvZGtvouOFJPCI5k3SxyfljmUn 1Z197CnBoTrQJGSISwep/7X+Hs77FR7cfaHQYuFvKc2zXvvzb6wL7UaFMWQXVO4ihhnw K8Dvzm1ENRN+u9FfjMMzOmQbbK2dQz2n24cI2wL7DKkCNv7ljJh7GBMsuZCdptDG/3Jl Bvsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:organization; bh=4rDudkueB+J/rIldFghOHcw9v72dbdm42Obo+Ici9oM=; b=M/rod+xn+u+McdzyHH6lOL3ePAw/4lJhJouRY7Ve1iQN/CqNpOxZLI1T7UeybOABbN GC2yhwKp0iMQw0uT1ifMM3eEhUuAIJLRi/FvBqf2jFlpdFxiCIF0B7MWhjmo051/3snj z+Vvtt6NNxnn6Ff5LVRrmYR16FEtdekrnGj1MaqE5s49XcyE6QeK7gjEVBob6ewtuse2 SlUNjARD5eFVx9BFINvjYXkkgQFrwXO1fKaSSITIgOt1owrD1Iu7XYw8crGw2zFe7eD8 WzHOxZDvTMDE8jPzcwwmMVDd/Mmhg6FM1Lg5Q1xjgsOq8/2B8qaV1a+kDKL4U1tY4M11 DIhA== X-Gm-Message-State: AOAM532epdYf2kL3J/wIItYl7P5k0Xt7jFOQfWUtVtubV5ywfVpgijC2 EyKM9+Qm1EG2RnIuutfHNUpD6g== X-Google-Smtp-Source: ABdhPJy2LlIdwdu0VWicofDcfmHvFAqrAl2dOjHU2G5z5xxHluhxsrQWurEsQeuife0GPoAARk1wwg== X-Received: by 2002:a19:8149:: with SMTP id c70mr6505366lfd.502.1610760352151; Fri, 15 Jan 2021 17:25:52 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id 198sm1085686lfn.51.2021.01.15.17.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 17:25:51 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, roopa@nvidia.com, nikolay@nvidia.com, netdev@vger.kernel.org Subject: [RFC net-next 5/7] net: dsa: Include bridge addresses in assisted CPU port learning Date: Sat, 16 Jan 2021 02:25:13 +0100 Message-Id: <20210116012515.3152-6-tobias@waldekranz.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210116012515.3152-1-tobias@waldekranz.com> References: <20210116012515.3152-1-tobias@waldekranz.com> Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that notifications are sent out for addresses added to the bridge itself, extend DSA to include those addresses in the hardware FDB when assisted CPU port learning is enabled. Signed-off-by: Tobias Waldekranz --- net/dsa/slave.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index dca393e45547..1ac46ad4a846 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2188,7 +2188,11 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, struct net_device *br_dev; struct dsa_slave_priv *p; - br_dev = netdev_master_upper_dev_get_rcu(dev); + if (netif_is_bridge_master(dev)) + br_dev = dev; + else + br_dev = netdev_master_upper_dev_get_rcu(dev); + if (!br_dev) return NOTIFY_DONE; From patchwork Sat Jan 16 01:25:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 365009 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 5B046C433E9 for ; Sat, 16 Jan 2021 01:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A66723A55 for ; Sat, 16 Jan 2021 01:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729341AbhAPB1O (ORCPT ); Fri, 15 Jan 2021 20:27:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728181AbhAPB1M (ORCPT ); Fri, 15 Jan 2021 20:27:12 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E6F2C061798 for ; Fri, 15 Jan 2021 17:25:54 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id b26so15901954lff.9 for ; Fri, 15 Jan 2021 17:25:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :organization; bh=UdHEWyruKeLwhur2IPon0E2SQ67SwSzgz0jmbjT0WV0=; b=Q0zC83esqBajHjZTq2YfJrbzN7uPnJH+0UO7AXZBnM5gJya1TABSJgZ5XG6gYGdvfT STUbJhIfwa3ZwtRyYm3nXALsrYfgfHh/oNq3oWcDU45QdPOYfztmd/Z4oQhwG7mWiShh p+9QvDBt0+QFqZHvQr33ZJtxq1m3DM/x7mdv/W2UGvODcpIR6yijQXOanmud4YBuJHLD Lc0Xyn1Yi9cSsKRLYjgvTEJZAblpJk8vJaCGXfKzbUdY8adcSDLnjOjlIInmv/gbMcEg nbOfSaisOleFXD2yEkUm5Zn/fWgX8Hr8Th63UAVGEOw1LnKNhPvwXp6Y2kMcNuJ0n/nf 9GGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:organization; bh=UdHEWyruKeLwhur2IPon0E2SQ67SwSzgz0jmbjT0WV0=; b=f+poB78N/cBgYV8MW+cVf6sl/3Ulv8nEbweBTAwIkIi7m05KrSlhZC85+H2Z0nVFpF 7ScLXziE0M5/oNrZ3bPuAnFoyLgyqZU6rbpfQkrFHbzEPeISSQ7pQpLAZ3d/CviskN47 guJGStkmX9Gj+Xcs7xDCfoGazGL+KQmzoX/X8Yi9eP7PUz5l1HX4iPfxPW+lJoMJqWY2 ED6IfBAjGLW67CIPbT4cIUn+ZJJCMBPj+LZlkQYq22rJmtCGktsgc5mOrG1dlzgSKJYT 28CJ74uIx+p9LPtFWfX67350OTihcG2ed2bWFcpwe+IY8VOy/BmZ114SNz4MgPPpPa5b 99wQ== X-Gm-Message-State: AOAM5317uHacNtFTSUqVJFMrxruIvDyxc1b9oPLWSEh6xGKlukjvHzEp mOnDAcSMC0zEXxxbhEEZTd7UNA== X-Google-Smtp-Source: ABdhPJwI6WlAeciwO+KLLF3mxaeKfOwhTg4LTvuP2qdfdrpS9QjYm+XuCWC81lu50Y4pXCZ2xjyB7w== X-Received: by 2002:a19:e8a:: with SMTP id 132mr6335019lfo.108.1610760352872; Fri, 15 Jan 2021 17:25:52 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id 198sm1085686lfn.51.2021.01.15.17.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 17:25:52 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, roopa@nvidia.com, nikolay@nvidia.com, netdev@vger.kernel.org Subject: [RFC net-next 6/7] net: dsa: Sync static FDB entries on foreign interfaces to hardware Date: Sat, 16 Jan 2021 02:25:14 +0100 Message-Id: <20210116012515.3152-7-tobias@waldekranz.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210116012515.3152-1-tobias@waldekranz.com> References: <20210116012515.3152-1-tobias@waldekranz.com> Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Reuse the "assisted_learning_on_cpu_port" functionality to always add entries for user-configured entries on foreign interfaces, even if assisted_learning_on_cpu_port is not enabled. E.g. in this situation: br0 / \ swp0 dummy0 $ bridge fdb add 02:00:de:ad:00:01 dev dummy0 vlan 1 master Results in DSA adding an entry in the hardware FDB, pointing this address towards the CPU port. The same is true for entries added to the bridge itself, e.g: $ bridge fdb add 02:00:de:ad:00:01 dev br0 vlan 1 self Signed-off-by: Tobias Waldekranz --- net/dsa/slave.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 1ac46ad4a846..f89b5eb4d2d6 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2181,9 +2181,12 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, else if (!fdb_info->added_by_user) return NOTIFY_OK; } else { - /* Snoop addresses learnt on foreign interfaces - * bridged with us, for switches that don't - * automatically learn SA from CPU-injected traffic + /* Snoop addresses added to foreign interfaces + * bridged with us, or the bridge + * itself. Dynamically learned addresses can + * also be added for switches that don't + * automatically learn SA from CPU-injected + * traffic. */ struct net_device *br_dev; struct dsa_slave_priv *p; @@ -2205,7 +2208,8 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, dp = p->dp->cpu_dp; - if (!dp->ds->assisted_learning_on_cpu_port) + if (!fdb_info->added_by_user && + !dp->ds->assisted_learning_on_cpu_port) return NOTIFY_DONE; } From patchwork Sat Jan 16 01:25:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 365424 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 440E8C433E6 for ; Sat, 16 Jan 2021 01:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F10C23A40 for ; Sat, 16 Jan 2021 01:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729370AbhAPB1P (ORCPT ); Fri, 15 Jan 2021 20:27:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728332AbhAPB1N (ORCPT ); Fri, 15 Jan 2021 20:27:13 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DA10C061799 for ; Fri, 15 Jan 2021 17:25:55 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id v67so15915396lfa.0 for ; Fri, 15 Jan 2021 17:25:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :organization; bh=YgILgnfGDXDr3Bs2noKI3QGJ52/I6ya9VHtgK0INKrc=; b=cVLdWT8THBRWHKWVeDmNkGTAE+33Yx5BfLFjd2hoGpZcV5lZ3VoYcrJVjCXLgnMyi+ zDuorD76jgOywJQ1VbEVo1Y5ycVjpfqUbsZVT4Ed/lo5fdLqu0BbvoKdwc5EwsoglXWB 7gb1nii5b5+2zTXVITbix5UK3BgHrxRDGTZJIUURMbPoJDwlidkkMsNF39rblMiLvKad PBKc39LHf4lSwWVnXrvYB+GhJF0ApLbVtuFjjm5XVX9WxtcoMfg/mE/udm8hxKn613ua gsEDYt2Zrwy8a4/DsSW/pSdcW2u1uP7kG/rY6OeOG19DVWMIqzTQ+7ZUYM44NwjDJ0cG nUwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:organization; bh=YgILgnfGDXDr3Bs2noKI3QGJ52/I6ya9VHtgK0INKrc=; b=OLRVILbkWAK/6nNNbYxHNc21PacursPET9814/XKSLYGa+MF846AFipcNR4oonrTJi /qoktKAzgevQtbW1zA9qicUskXDh9qWZ9LT+87jLohhHQqowZ1LaYDZG2tjr8bKptKdF 5sKPjXkn6DWVbTMV7AgpnMe1yftBq2kVuE02hVHqoCYSV9TZ4cj9ydgEwGP8Z+nFUItn 4+VlVgTmvNmPjoclOjUu9iofsYuXwCW+vXNyh7rcas9aw0UOB5LsGC9vLWJfeYF+H7yl pl4oeNEQLY07V7+xaZYFSoImoLi4VhrPv7JLuESH6KSkkwazXTHHpWlXcN1rWQ/XLN4p 0uuA== X-Gm-Message-State: AOAM532fO296hiAhIhdalep1DH6dWNkSQF/TlOBPyLHYPhEdkUFdScoO PdhqeVMGtrrDqpokzzd61xZWrA== X-Google-Smtp-Source: ABdhPJy+825u06x4iRA9xOMt7MEfSea9Q6eYth4MIMAaK4761a2DGEE3q9PERdYOMmrzQ+M7PNtpYw== X-Received: by 2002:a05:6512:21d:: with SMTP id a29mr6731931lfo.444.1610760353603; Fri, 15 Jan 2021 17:25:53 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id 198sm1085686lfn.51.2021.01.15.17.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 17:25:53 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, roopa@nvidia.com, nikolay@nvidia.com, netdev@vger.kernel.org Subject: [RFC net-next 7/7] net: dsa: mv88e6xxx: Request assisted learning on CPU port Date: Sat, 16 Jan 2021 02:25:15 +0100 Message-Id: <20210116012515.3152-8-tobias@waldekranz.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210116012515.3152-1-tobias@waldekranz.com> References: <20210116012515.3152-1-tobias@waldekranz.com> Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org While the hardware is capable of performing learning on the CPU port, it requires alot of additions to the bridge's forwarding path in order to handle multi-destination traffic correctly. Until that is in place, opt for the next best thing and let DSA sync the relevant addresses down to the hardware FDB. Signed-off-by: Tobias Waldekranz --- drivers/net/dsa/mv88e6xxx/chip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 91286d7b12c7..398f3cc8d2f3 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -5726,6 +5726,7 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip) ds->ops = &mv88e6xxx_switch_ops; ds->ageing_time_min = chip->info->age_time_coeff; ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; + ds->assisted_learning_on_cpu_port = true; /* Some chips support up to 32, but that requires enabling the * 5-bit port mode, which we do not support. 640k^W16 ought to