All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Nixdorf <jnixdorf-oss@avm.de>
To: "David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>, David Ahern <dsahern@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ido Schimmel <idosch@nvidia.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Oleksij Rempel <linux@rempel-privat.de>,
	Paolo Abeni <pabeni@redhat.com>, Roopa Prabhu <roopa@nvidia.com>,
	Shuah Khan <shuah@kernel.org>,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: bridge@lists.linux-foundation.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Johannes Nixdorf <jnixdorf-oss@avm.de>
Subject: [PATCH net-next v4 1/6] net: bridge: Set BR_FDB_ADDED_BY_USER early in fdb_add_entry
Date: Tue, 19 Sep 2023 10:12:48 +0200	[thread overview]
Message-ID: <20230919-fdb_limit-v4-1-39f0293807b8@avm.de> (raw)
In-Reply-To: <20230919-fdb_limit-v4-0-39f0293807b8@avm.de>

In preparation of the following fdb limit for dynamically learned entries,
allow fdb_create to detect that the entry was added by the user. This
way it can skip applying the limit in this case.

Signed-off-by: Johannes Nixdorf <jnixdorf-oss@avm.de>
---
 net/bridge/br_fdb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index e69a872bfc1d..f517ea92132c 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -1056,7 +1056,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
 		if (!(flags & NLM_F_CREATE))
 			return -ENOENT;
 
-		fdb = fdb_create(br, source, addr, vid, 0);
+		fdb = fdb_create(br, source, addr, vid,
+				 BIT(BR_FDB_ADDED_BY_USER));
 		if (!fdb)
 			return -ENOMEM;
 
@@ -1069,6 +1070,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
 			WRITE_ONCE(fdb->dst, source);
 			modified = true;
 		}
+
+		set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags);
 	}
 
 	if (fdb_to_nud(br, fdb) != state) {
@@ -1100,8 +1103,6 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
 	if (fdb_handle_notify(fdb, notify))
 		modified = true;
 
-	set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags);
-
 	fdb->used = jiffies;
 	if (modified) {
 		if (refresh)

-- 
2.42.0


WARNING: multiple messages have this Message-ID (diff)
From: Johannes Nixdorf <jnixdorf-oss@avm.de>
To: "David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>, David Ahern <dsahern@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ido Schimmel <idosch@nvidia.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Oleksij Rempel <linux@rempel-privat.de>,
	Paolo Abeni <pabeni@redhat.com>, Roopa Prabhu <roopa@nvidia.com>,
	Shuah Khan <shuah@kernel.org>,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
	Johannes Nixdorf <jnixdorf-oss@avm.de>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [Bridge] [PATCH net-next v4 1/6] net: bridge: Set BR_FDB_ADDED_BY_USER early in fdb_add_entry
Date: Tue, 19 Sep 2023 10:12:48 +0200	[thread overview]
Message-ID: <20230919-fdb_limit-v4-1-39f0293807b8@avm.de> (raw)
In-Reply-To: <20230919-fdb_limit-v4-0-39f0293807b8@avm.de>

In preparation of the following fdb limit for dynamically learned entries,
allow fdb_create to detect that the entry was added by the user. This
way it can skip applying the limit in this case.

Signed-off-by: Johannes Nixdorf <jnixdorf-oss@avm.de>
---
 net/bridge/br_fdb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index e69a872bfc1d..f517ea92132c 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -1056,7 +1056,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
 		if (!(flags & NLM_F_CREATE))
 			return -ENOENT;
 
-		fdb = fdb_create(br, source, addr, vid, 0);
+		fdb = fdb_create(br, source, addr, vid,
+				 BIT(BR_FDB_ADDED_BY_USER));
 		if (!fdb)
 			return -ENOMEM;
 
@@ -1069,6 +1070,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
 			WRITE_ONCE(fdb->dst, source);
 			modified = true;
 		}
+
+		set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags);
 	}
 
 	if (fdb_to_nud(br, fdb) != state) {
@@ -1100,8 +1103,6 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
 	if (fdb_handle_notify(fdb, notify))
 		modified = true;
 
-	set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags);
-
 	fdb->used = jiffies;
 	if (modified) {
 		if (refresh)

-- 
2.42.0


  reply	other threads:[~2023-09-19 12:17 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19  8:12 [PATCH net-next v4 0/6] bridge: Add a limit on learned FDB entries Johannes Nixdorf
2023-09-19  8:12 ` [Bridge] " Johannes Nixdorf
2023-09-19  8:12 ` Johannes Nixdorf [this message]
2023-09-19  8:12   ` [Bridge] [PATCH net-next v4 1/6] net: bridge: Set BR_FDB_ADDED_BY_USER early in fdb_add_entry Johannes Nixdorf
2023-09-20 10:44   ` Nikolay Aleksandrov
2023-09-20 10:44     ` [Bridge] " Nikolay Aleksandrov
2023-09-21 12:13   ` Ido Schimmel
2023-09-21 12:13     ` [Bridge] " Ido Schimmel
2023-09-19  8:12 ` [PATCH net-next v4 2/6] net: bridge: Set strict_start_type for br_policy Johannes Nixdorf
2023-09-19  8:12   ` [Bridge] " Johannes Nixdorf
2023-09-20 10:46   ` Nikolay Aleksandrov
2023-09-20 10:46     ` [Bridge] " Nikolay Aleksandrov
2023-09-21  7:23     ` Johannes Nixdorf
2023-09-21  7:23       ` [Bridge] " Johannes Nixdorf
2023-09-21 10:14       ` Nikolay Aleksandrov
2023-09-21 10:14         ` [Bridge] " Nikolay Aleksandrov
2023-09-22 12:18         ` Johannes Nixdorf
2023-09-22 12:18           ` [Bridge] " Johannes Nixdorf
2023-09-19  8:12 ` [PATCH net-next v4 3/6] net: bridge: Track and limit dynamically learned FDB entries Johannes Nixdorf
2023-09-19  8:12   ` [Bridge] " Johannes Nixdorf
2023-09-20 10:49   ` Nikolay Aleksandrov
2023-09-20 10:49     ` [Bridge] " Nikolay Aleksandrov
2023-09-26 11:22   ` Ido Schimmel
2023-09-26 11:22     ` [Bridge] " Ido Schimmel
2023-09-19  8:12 ` [PATCH net-next v4 4/6] net: bridge: Add netlink knobs for number / max " Johannes Nixdorf
2023-09-19  8:12   ` [Bridge] " Johannes Nixdorf
2023-09-20 10:50   ` Nikolay Aleksandrov
2023-09-20 10:50     ` [Bridge] " Nikolay Aleksandrov
2023-09-21  7:29     ` Johannes Nixdorf
2023-09-21  7:29       ` [Bridge] " Johannes Nixdorf
2023-09-21 12:41   ` Nikolay Aleksandrov
2023-09-21 12:41     ` [Bridge] " Nikolay Aleksandrov
2023-09-21 12:51     ` Nikolay Aleksandrov
2023-09-21 12:51       ` [Bridge] " Nikolay Aleksandrov
2023-09-19  8:12 ` [PATCH net-next v4 5/6] net: bridge: Add a configurable default FDB learning limit Johannes Nixdorf
2023-09-19  8:12   ` [Bridge] " Johannes Nixdorf
2023-09-20 11:00   ` Nikolay Aleksandrov
2023-09-20 11:00     ` [Bridge] " Nikolay Aleksandrov
2023-09-21  8:06     ` Johannes Nixdorf
2023-09-21  8:06       ` [Bridge] " Johannes Nixdorf
2023-09-21 10:19       ` Nikolay Aleksandrov
2023-09-21 10:19         ` [Bridge] " Nikolay Aleksandrov
2023-09-26 11:42         ` Ido Schimmel
2023-09-26 11:42           ` [Bridge] " Ido Schimmel
2023-09-19  8:12 ` [PATCH net-next v4 6/6] selftests: forwarding: bridge_fdb_learning_limit: Add a new selftest Johannes Nixdorf
2023-09-19  8:12   ` [Bridge] " Johannes Nixdorf
2023-09-20 11:01   ` Nikolay Aleksandrov
2023-09-20 11:01     ` [Bridge] " Nikolay Aleksandrov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230919-fdb_limit-v4-1-39f0293807b8@avm.de \
    --to=jnixdorf-oss@avm.de \
    --cc=andrew@lunn.ch \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux@rempel-privat.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=roopa@nvidia.com \
    --cc=shuah@kernel.org \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.