From: Nikolay Aleksandrov <razor@blackwall.org>
To: netdev@vger.kernel.org
Cc: roopa@nvidia.com, Joachim Wiberg <troglobit@gmail.com>,
dsahern@gmail.com, Nikolay Aleksandrov <nikolay@nvidia.com>
Subject: [PATCH iproute2-next 01/17] ip: bridge: add support for mcast_vlan_snooping
Date: Thu, 26 Aug 2021 16:05:17 +0300 [thread overview]
Message-ID: <20210826130533.149111-2-razor@blackwall.org> (raw)
In-Reply-To: <20210826130533.149111-1-razor@blackwall.org>
From: Nikolay Aleksandrov <nikolay@nvidia.com>
Add support for mcast_vlan_snooping option which controls per-vlan
multicast snooping, also update the man page.
Syntax: $ ip link set dev bridge type bridge mcast_vlan_snooping 0/1
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
---
ip/iplink_bridge.c | 29 +++++++++++++++++++++++++++++
man/man8/ip-link.8.in | 8 ++++++++
2 files changed, 37 insertions(+)
diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
index d12fd0558f7d..0f96b77ec3e1 100644
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -43,6 +43,7 @@ static void print_explain(FILE *f)
" [ vlan_stats_enabled VLAN_STATS_ENABLED ]\n"
" [ vlan_stats_per_port VLAN_STATS_PER_PORT ]\n"
" [ mcast_snooping MULTICAST_SNOOPING ]\n"
+ " [ mcast_vlan_snooping MULTICAST_VLAN_SNOOPING ]\n"
" [ mcast_router MULTICAST_ROUTER ]\n"
" [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n"
" [ mcast_querier MULTICAST_QUERIER ]\n"
@@ -83,6 +84,7 @@ void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len)
static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
+ struct br_boolopt_multi bm = {};
__u32 val;
while (argc > 0) {
@@ -200,6 +202,18 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
invarg("invalid mcast_snooping", *argv);
addattr8(n, 1024, IFLA_BR_MCAST_SNOOPING, mcast_snoop);
+ } else if (matches(*argv, "mcast_vlan_snooping") == 0) {
+ __u32 mcvl_bit = 1 << BR_BOOLOPT_MCAST_VLAN_SNOOPING;
+ __u8 mcast_vlan_snooping;
+
+ NEXT_ARG();
+ if (get_u8(&mcast_vlan_snooping, *argv, 0))
+ invarg("invalid mcast_vlan_snooping", *argv);
+ bm.optmask |= 1 << BR_BOOLOPT_MCAST_VLAN_SNOOPING;
+ if (mcast_vlan_snooping)
+ bm.optval |= mcvl_bit;
+ else
+ bm.optval &= ~mcvl_bit;
} else if (matches(*argv, "mcast_query_use_ifaddr") == 0) {
__u8 mcast_qui;
@@ -379,6 +393,9 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
argc--, argv++;
}
+ if (bm.optmask)
+ addattr_l(n, 1024, IFLA_BR_MULTI_BOOLOPT,
+ &bm, sizeof(bm));
return 0;
}
@@ -559,6 +576,18 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
"mcast_snooping %u ",
rta_getattr_u8(tb[IFLA_BR_MCAST_SNOOPING]));
+ if (tb[IFLA_BR_MULTI_BOOLOPT]) {
+ __u32 mcvl_bit = 1 << BR_BOOLOPT_MCAST_VLAN_SNOOPING;
+ struct br_boolopt_multi *bm;
+
+ bm = RTA_DATA(tb[IFLA_BR_MULTI_BOOLOPT]);
+ if (bm->optmask & mcvl_bit)
+ print_uint(PRINT_ANY,
+ "mcast_vlan_snooping",
+ "mcast_vlan_snooping %u ",
+ !!(bm->optval & mcvl_bit));
+ }
+
if (tb[IFLA_BR_MCAST_ROUTER])
print_uint(PRINT_ANY,
"mcast_router",
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 572bed872eed..2c278d53c050 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -1492,6 +1492,8 @@ the following additional arguments are supported:
] [
.BI mcast_snooping " MULTICAST_SNOOPING "
] [
+.BI mcast_vlan_snooping " MULTICAST_VLAN_SNOOPING "
+] [
.BI mcast_router " MULTICAST_ROUTER "
] [
.BI mcast_query_use_ifaddr " MCAST_QUERY_USE_IFADDR "
@@ -1614,6 +1616,12 @@ per-VLAN per-port stats accounting. Can be changed only when there are no port V
or off
.RI ( MULTICAST_SNOOPING " == 0). "
+.BI mcast_vlan_snooping " MULTICAST_VLAN_SNOOPING "
+- turn multicast VLAN snooping on
+.RI ( MULTICAST_VLAN_SNOOPING " > 0) "
+or off
+.RI ( MULTICAST_VLAN_SNOOPING " == 0). "
+
.BI mcast_router " MULTICAST_ROUTER "
- set bridge's multicast router if IGMP snooping is enabled.
.I MULTICAST_ROUTER
--
2.31.1
next prev parent reply other threads:[~2021-08-26 13:09 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 13:05 [PATCH iproute2-next 00/17] bridge: vlan: add global multicast options Nikolay Aleksandrov
2021-08-26 13:05 ` Nikolay Aleksandrov [this message]
2021-08-26 15:08 ` [PATCH iproute2-next 01/17] ip: bridge: add support for mcast_vlan_snooping Stephen Hemminger
2021-08-26 15:11 ` Nikolay Aleksandrov
2021-08-27 17:01 ` David Ahern
2021-08-26 13:05 ` [PATCH iproute2-next 02/17] bridge: vlan: add support to show global vlan options Nikolay Aleksandrov
2021-08-27 17:10 ` David Ahern
2021-08-26 13:05 ` [PATCH iproute2-next 03/17] bridge: vlan: add support for vlan filtering when dumping options Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 04/17] bridge: vlan: add support to set global vlan options Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 05/17] bridge: vlan: add global mcast_snooping option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 06/17] bridge: vlan: add global mcast_igmp_version option Nikolay Aleksandrov
2021-08-31 9:02 ` Joachim Wiberg
2021-08-31 9:04 ` Nikolay Aleksandrov
2021-08-31 9:10 ` Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 07/17] bridge: vlan: add global mcast_mld_version option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 08/17] bridge: vlan: add global mcast_last_member_count option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 09/17] bridge: vlan: add global mcast_startup_query_count option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 10/17] bridge: vlan: add global mcast_last_member_interval option Nikolay Aleksandrov
2021-08-27 17:15 ` David Ahern
[not found] ` <DM4PR12MB5278D58FD0768A3005F95804DFC89@DM4PR12MB5278.namprd12.prod.outlook.com>
2021-08-27 18:21 ` David Ahern
2021-08-26 13:05 ` [PATCH iproute2-next 11/17] bridge: vlan: add global mcast_membership_interval option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 12/17] bridge: vlan: add global mcast_querier_interval option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 13/17] bridge: vlan: add global mcast_query_interval option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 14/17] bridge: vlan: add global mcast_query_response_interval option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 15/17] bridge: vlan: add global mcast_startup_query_interval option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 16/17] bridge: vlan: add global mcast_querier option Nikolay Aleksandrov
2021-08-26 13:05 ` [PATCH iproute2-next 17/17] bridge: vlan: add support for dumping router ports 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=20210826130533.149111-2-razor@blackwall.org \
--to=razor@blackwall.org \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=roopa@nvidia.com \
--cc=troglobit@gmail.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).