diff mbox series

[RFC,iproute2-next,2/2] ip: link: Support mdb_notify_on_flag_change knob

Message ID 20250318225026.145501-3-Joseph.Huang@garmin.com (mailing list archive)
State RFC
Delegated to: David Ahern
Headers show
Series Add support mdb offload failure notification | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Joseph Huang March 18, 2025, 10:50 p.m. UTC
Add support for manipulating the new mdb_notify_on_flag_change knob
of a bridge. This knob is used to control how the bridge shall notify
use space about mdb flag changes:

0 - the bridge will not notify user space about MDB flag change
1 - the bridge will notify user space about flag change if either
    MDB_PG_FLAGS_OFFLOAD or MDB_PG_FLAGS_OFFLOAD_FAILED has changed
2 - the bridge will notify user space about flag change only if
    MDB_PG_FLAGS_OFFLOAD_FAILED has changed

The default value is 0.

Signed-off-by: Joseph Huang <Joseph.Huang@garmin.com>
---
 ip/iplink_bridge.c    | 15 +++++++++++++++
 man/man8/ip-link.8.in | 19 +++++++++++++++++++
 2 files changed, 34 insertions(+)
diff mbox series

Patch

diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
index 1fe89551..fd8f2669 100644
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -62,6 +62,7 @@  static void print_explain(FILE *f)
 		"		  [ nf_call_iptables NF_CALL_IPTABLES ]\n"
 		"		  [ nf_call_ip6tables NF_CALL_IP6TABLES ]\n"
 		"		  [ nf_call_arptables NF_CALL_ARPTABLES ]\n"
+		"		  [ mdb_notify_on_flag_change NOTIFY_ON_FLAG_CHANGE ]\n"
 		"\n"
 		"Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n"
 	);
@@ -413,6 +414,14 @@  static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 
 			addattr8(n, 1024, IFLA_BR_NF_CALL_ARPTABLES,
 				 nf_call_arpt);
+		} else if (matches(*argv, "mdb_notify_on_flag_change") == 0) {
+			__u8 mdb_notify_on_flag_change;
+
+			NEXT_ARG();
+			if (get_u8(&mdb_notify_on_flag_change, *argv, 0))
+				invarg("invalid mdb_notify_on_flag_change", *argv);
+			addattr8(n, 1024, IFLA_BR_MDB_NOTIFY_ON_FLAG_CHANGE,
+				  mdb_notify_on_flag_change);
 		} else if (matches(*argv, "help") == 0) {
 			explain();
 			return -1;
@@ -815,6 +824,12 @@  static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 			   "nf_call_arptables",
 			   "nf_call_arptables %u ",
 			   rta_getattr_u8(tb[IFLA_BR_NF_CALL_ARPTABLES]));
+
+	if (tb[IFLA_BR_MDB_NOTIFY_ON_FLAG_CHANGE])
+		print_uint(PRINT_ANY,
+			   "mdb_notify_on_flag_change",
+			   "mdb_notify_on_flag_change %u ",
+			   rta_getattr_u8(tb[IFLA_BR_MDB_NOTIFY_ON_FLAG_CHANGE]));
 }
 
 static void bridge_print_help(struct link_util *lu, int argc, char **argv,
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index efb62481..2f8bc354 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -1753,6 +1753,8 @@  the following additional arguments are supported:
 .BI nf_call_ip6tables " NF_CALL_IP6TABLES "
 ] [
 .BI nf_call_arptables " NF_CALL_ARPTABLES "
+] [
+.BI mdb_notify_on_flag_change " MDB_NOTIFY_ON_FLAG_CHANGE "
 ]
 
 .in +8
@@ -1977,6 +1979,23 @@  or disable
 .RI ( NF_CALL_ARPTABLES " == 0) "
 arptables hooks on the bridge.
 
+.BI mdb_notify_on_flag_change " MDB_NOTIFY_ON_FLAG_CHANGE "
+- set how the bridge notifies user space about MDB flag changes.
+.I MDB_NOTIFY_ON_FLAG_CHANGE
+is an integer value having the following meaning:
+.in +8
+.sp
+.B 0
+- do not notify user space about MDB flag change
+
+.B 1
+- notify user space if either offload flag or offload failed flag
+has changed
+
+.B 2
+- notify user space only if offload failed flag has changed
+.in -8
+
 
 .in -8