From: Nikolay Aleksandrov <razor@blackwall.org>
To: netdev@vger.kernel.org
Cc: roopa@nvidia.com, kuba@kernel.org, davem@davemloft.net,
bridge@lists.linux-foundation.org,
Nikolay Aleksandrov <razor@blackwall.org>
Subject: [PATCH net-next 5/6] net: bridge: fdb: add support for flush filtering based on ifindex
Date: Sat, 9 Apr 2022 13:58:56 +0300 [thread overview]
Message-ID: <20220409105857.803667-6-razor@blackwall.org> (raw)
In-Reply-To: <20220409105857.803667-1-razor@blackwall.org>
Add support for fdb flush filtering based on destination ifindex. The
ifindex must either match a port's device ifindex or the bridge's.
Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
---
include/uapi/linux/if_bridge.h | 1 +
net/bridge/br_fdb.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index 4638d7e39f2a..67ee12586844 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -819,6 +819,7 @@ enum {
FDB_FLUSH_NDM_STATE_MASK,
FDB_FLUSH_NDM_FLAGS,
FDB_FLUSH_NDM_FLAGS_MASK,
+ FDB_FLUSH_PORT_IFINDEX,
__FDB_FLUSH_MAX
};
#define FDB_FLUSH_MAX (__FDB_FLUSH_MAX - 1)
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 340a2ace1d5e..53208adf7474 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -628,6 +628,7 @@ static const struct nla_policy br_fdb_flush_policy[FDB_FLUSH_MAX + 1] = {
[FDB_FLUSH_NDM_FLAGS] = { .type = NLA_U16 },
[FDB_FLUSH_NDM_STATE_MASK] = { .type = NLA_U16 },
[FDB_FLUSH_NDM_FLAGS_MASK] = { .type = NLA_U16 },
+ [FDB_FLUSH_PORT_IFINDEX] = { .type = NLA_S32 },
};
int br_fdb_flush_nlattr(struct net_bridge *br, struct nlattr *fdb_flush_attr,
@@ -664,6 +665,12 @@ int br_fdb_flush_nlattr(struct net_bridge *br, struct nlattr *fdb_flush_attr,
ndm_flags_mask = nla_get_u16(fdb_flush_tb[FDB_FLUSH_NDM_FLAGS_MASK]);
desc.flags_mask |= __ndm_flags_to_fdb_flags(ndm_flags_mask);
}
+ if (fdb_flush_tb[FDB_FLUSH_PORT_IFINDEX]) {
+ int port_ifidx;
+
+ port_ifidx = nla_get_u32(fdb_flush_tb[FDB_FLUSH_PORT_IFINDEX]);
+ desc.port_ifindex = port_ifidx;
+ }
br_debug(br, "flushing port ifindex: %d vlan id: %u flags: 0x%lx flags mask: 0x%lx\n",
desc.port_ifindex, desc.vlan_id, desc.flags, desc.flags_mask);
--
2.35.1
next prev parent reply other threads:[~2022-04-09 11:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-09 10:58 [PATCH net-next 0/6] net: bridge: add flush filtering support Nikolay Aleksandrov
2022-04-09 10:58 ` [PATCH net-next 1/6] net: bridge: add a generic flush operation Nikolay Aleksandrov
2022-04-09 10:58 ` [PATCH net-next 2/6] net: bridge: fdb: add support for fine-grained flushing Nikolay Aleksandrov
2022-04-11 8:20 ` Ido Schimmel
2022-04-11 8:54 ` Nikolay Aleksandrov
2022-04-09 10:58 ` [PATCH net-next 3/6] net: bridge: fdb: add new nl attribute-based flush call Nikolay Aleksandrov
2022-04-11 8:33 ` Ido Schimmel
2022-04-11 9:01 ` Nikolay Aleksandrov
2022-04-11 8:41 ` Ido Schimmel
2022-04-11 9:05 ` Nikolay Aleksandrov
2022-04-09 10:58 ` [PATCH net-next 4/6] net: bridge: fdb: add support for flush filtering based on ndm flags and state Nikolay Aleksandrov
2022-04-11 8:47 ` Ido Schimmel
2022-04-11 9:07 ` Nikolay Aleksandrov
2022-04-09 10:58 ` Nikolay Aleksandrov [this message]
2022-04-11 8:57 ` [PATCH net-next 5/6] net: bridge: fdb: add support for flush filtering based on ifindex Ido Schimmel
2022-04-11 9:03 ` Nikolay Aleksandrov
2022-04-09 10:58 ` [PATCH net-next 6/6] net: bridge: fdb: add support for flush filtering based on vlan id Nikolay Aleksandrov
2022-04-09 12:36 ` [PATCH net-next 0/6] net: bridge: add flush filtering support Nikolay Aleksandrov
2022-04-10 20:43 ` Nikolay Aleksandrov
2022-04-11 7:47 ` Ido Schimmel
2022-04-11 8:53 ` Nikolay Aleksandrov
2022-04-11 8:54 ` Ido Schimmel
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=20220409105857.803667-6-razor@blackwall.org \
--to=razor@blackwall.org \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roopa@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).