Blame 0002-macvlan-Add-bclim-parameter.patch

498081
From 7d1444d9563575ec3346620f12788799080db8c5 Mon Sep 17 00:00:00 2001
498081
Message-Id: <7d1444d9563575ec3346620f12788799080db8c5.1683109787.git.aclaudi@redhat.com>
498081
In-Reply-To: <d60a7ac3c0f6aa2a933f48a69ab31e3637f6906c.1683109787.git.aclaudi@redhat.com>
498081
References: <d60a7ac3c0f6aa2a933f48a69ab31e3637f6906c.1683109787.git.aclaudi@redhat.com>
498081
From: Andrea Claudi <aclaudi@redhat.com>
498081
Date: Wed, 3 May 2023 11:19:24 +0200
498081
Subject: [PATCH] macvlan: Add bclim parameter
498081
498081
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2186945
498081
Upstream Status: iproute2-next.git commit e8a3fb47
498081
498081
commit e8a3fb470b4e96aa35a2731c7cc175b946c0a62d
498081
Author: Herbert Xu <herbert@gondor.apana.org.au>
498081
Date:   Thu Mar 30 11:07:25 2023 +0800
498081
498081
    macvlan: Add bclim parameter
498081
498081
    This patch adds support for setting the broadcast queueing threshold
498081
    on macvlan devices.  This controls which multicast packets will be
498081
    processed in a workqueue instead of inline.
498081
498081
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
498081
498081
     ip/iplink_macvlan.c          |   26 ++++++++++++++++++++++++--
498081
     man/man8/ip-link.8.in        |   18 ++++++++++++++++++
498081
     3 files changed, 43 insertions(+), 2 deletions(-)
498081
498081
    Signed-off-by: David Ahern <dsahern@kernel.org>
498081
---
498081
 ip/iplink_macvlan.c   | 26 ++++++++++++++++++++++++--
498081
 man/man8/ip-link.8.in | 18 ++++++++++++++++++
498081
 2 files changed, 42 insertions(+), 2 deletions(-)
498081
498081
diff --git a/ip/iplink_macvlan.c b/ip/iplink_macvlan.c
498081
index 0f13637d..6bdc76d1 100644
498081
--- a/ip/iplink_macvlan.c
498081
+++ b/ip/iplink_macvlan.c
498081
@@ -26,13 +26,14 @@
498081
 static void print_explain(struct link_util *lu, FILE *f)
498081
 {
498081
 	fprintf(f,
498081
-		"Usage: ... %s mode MODE [flag MODE_FLAG] MODE_OPTS [bcqueuelen BC_QUEUE_LEN]\n"
498081
+		"Usage: ... %s mode MODE [flag MODE_FLAG] MODE_OPTS [bcqueuelen BC_QUEUE_LEN] [bclim BCLIM]\n"
498081
 		"\n"
498081
 		"MODE: private | vepa | bridge | passthru | source\n"
498081
 		"MODE_FLAG: null | nopromisc | nodst\n"
498081
 		"MODE_OPTS: for mode \"source\":\n"
498081
 		"\tmacaddr { { add | del } <macaddr> | set [ <macaddr> [ <macaddr>  ... ] ] | flush }\n"
498081
-		"BC_QUEUE_LEN: Length of the rx queue for broadcast/multicast: [0-4294967295]\n",
498081
+		"BC_QUEUE_LEN: Length of the rx queue for broadcast/multicast: [0-4294967295]\n"
498081
+		"BCLIM: Threshold for broadcast queueing: 32-bit integer\n",
498081
 		lu->id
498081
 	);
498081
 }
498081
@@ -67,6 +68,12 @@ static int bc_queue_len_arg(const char *arg)
498081
 	return -1;
498081
 }
498081
 
498081
+static int bclim_arg(const char *arg)
498081
+{
498081
+	fprintf(stderr, "Error: illegal value for \"bclim\": \"%s\"\n", arg);
498081
+	return -1;
498081
+}
498081
+
498081
 static int macvlan_parse_opt(struct link_util *lu, int argc, char **argv,
498081
 			  struct nlmsghdr *n)
498081
 {
498081
@@ -168,6 +175,15 @@ static int macvlan_parse_opt(struct link_util *lu, int argc, char **argv,
498081
 				return bc_queue_len_arg(*argv);
498081
 			}
498081
 			addattr32(n, 1024, IFLA_MACVLAN_BC_QUEUE_LEN, bc_queue_len);
498081
+		} else if (!strcmp(*argv, "bclim")) {
498081
+			__s32 bclim;
498081
+			NEXT_ARG();
498081
+
498081
+			if (get_s32(&bclim, *argv, 0)) {
498081
+				return bclim_arg(*argv);
498081
+			}
498081
+			addattr_l(n, 1024, IFLA_MACVLAN_BC_CUTOFF,
498081
+				  &bclim, sizeof(bclim));
498081
 		} else if (matches(*argv, "help") == 0) {
498081
 			explain(lu);
498081
 			return -1;
498081
@@ -245,6 +261,12 @@ static void macvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]
498081
 		print_luint(PRINT_ANY, "usedbcqueuelen", "usedbcqueuelen %lu ", bc_queue_len);
498081
 	}
498081
 
498081
+	if (tb[IFLA_MACVLAN_BC_CUTOFF] &&
498081
+		RTA_PAYLOAD(tb[IFLA_MACVLAN_BC_CUTOFF]) >= sizeof(__s32)) {
498081
+		__s32 bclim = rta_getattr_s32(tb[IFLA_MACVLAN_BC_CUTOFF]);
498081
+		print_int(PRINT_ANY, "bclim", "bclim %d ", bclim);
498081
+	}
498081
+
498081
 	/* in source mode, there are more options to print */
498081
 
498081
 	if (mode != MACVLAN_MODE_SOURCE)
498081
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
498081
index eeddf493..62aebabd 100644
498081
--- a/man/man8/ip-link.8.in
498081
+++ b/man/man8/ip-link.8.in
498081
@@ -1455,6 +1455,7 @@ the following additional arguments are supported:
498081
 .BR mode " { " private " | " vepa " | " bridge " | " passthru
498081
 .RB " [ " nopromisc " ] | " source " [ " nodst " ] } "
498081
 .RB " [ " bcqueuelen " { " LENGTH " } ] "
498081
+.RB " [ " bclim " " LIMIT " ] "
498081
 
498081
 .in +8
498081
 .sp
498081
@@ -1513,6 +1514,13 @@ will be the maximum length that any macvlan interface has requested.
498081
 When listing device parameters both the bcqueuelen parameter
498081
 as well as the actual used bcqueuelen are listed to better help
498081
 the user understand the setting.
498081
+
498081
+.BR bclim " " LIMIT
498081
+- Set the threshold for broadcast queueing.
498081
+.BR LIMIT " must be a 32-bit integer."
498081
+Setting this to -1 disables broadcast queueing altogether.  Otherwise
498081
+a multicast address will be queued as broadcast if the number of devices
498081
+using it is greater than the given value.
498081
 .in -8
498081
 
498081
 .TP
498081
@@ -2675,6 +2683,9 @@ Update the broadcast/multicast queue length.
498081
 [
498081
 .BI bcqueuelen "  LENGTH  "
498081
 ]
498081
+[
498081
+.BI bclim " LIMIT "
498081
+]
498081
 
498081
 .in +8
498081
 .BI bcqueuelen " LENGTH "
498081
@@ -2688,6 +2699,13 @@ will be the maximum length that any macvlan interface has requested.
498081
 When listing device parameters both the bcqueuelen parameter
498081
 as well as the actual used bcqueuelen are listed to better help
498081
 the user understand the setting.
498081
+
498081
+.BI bclim " LIMIT "
498081
+- Set the threshold for broadcast queueing.
498081
+.IR LIMIT " must be a 32-bit integer."
498081
+Setting this to -1 disables broadcast queueing altogether.  Otherwise
498081
+a multicast address will be queued as broadcast if the number of devices
498081
+using it is greater than the given value.
498081
 .in -8
498081
 
498081
 .TP
498081
-- 
498081
2.40.1
498081