[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1587619280-46386-2-git-send-email-roopa@cumulusnetworks.com>
Date: Wed, 22 Apr 2020 22:21:19 -0700
From: Roopa Prabhu <roopa@...ulusnetworks.com>
To: dsahern@...il.com, davem@...emloft.net
Cc: netdev@...r.kernel.org, nikolay@...ulusnetworks.com,
bpoirier@...ulusnetworks.com
Subject: [PATCH net-next 1/2] ipv4: add sysctl to skip route notify on nexthop changes
From: Roopa Prabhu <roopa@...ulusnetworks.com>
Route notifications on nexthop changes exists for backward
compatibility. In systems which have moved to the new
nexthop API, these route update notifications cancel the
performance benefits provided by the new nexthop API.
This patch adds a sysctl to disable these route notifications
generated for changes to nexthop objects.
Signed-off-by: Roopa Prabhu <roopa@...ulusnetworks.com>
---
include/net/netns/ipv4.h | 2 ++
net/ipv4/af_inet.c | 1 +
net/ipv4/nexthop.c | 3 ++-
net/ipv4/sysctl_net_ipv4.c | 7 +++++++
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 154b8f0..59a190c 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -111,6 +111,8 @@ struct netns_ipv4 {
int sysctl_tcp_early_demux;
int sysctl_udp_early_demux;
+ int sysctl_nexthop_skip_route_notify;
+
int sysctl_fwmark_reflect;
int sysctl_tcp_fwmark_accept;
#ifdef CONFIG_NET_L3_MASTER_DEV
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index c618e24..7c1db4b 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1835,6 +1835,7 @@ static __net_init int inet_init_net(struct net *net)
net->ipv4.sysctl_ip_early_demux = 1;
net->ipv4.sysctl_udp_early_demux = 1;
net->ipv4.sysctl_tcp_early_demux = 1;
+ net->ipv4.sysctl_nexthop_skip_route_notify = 0;
#ifdef CONFIG_SYSCTL
net->ipv4.sysctl_ip_prot_sock = PROT_SOCK;
#endif
diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index fdfca53..fc6c76b 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -895,7 +895,8 @@ static void __nexthop_replace_notify(struct net *net, struct nexthop *nh,
{
struct fib6_info *f6i;
- if (!list_empty(&nh->fi_list)) {
+ if (!net->ipv4.sysctl_nexthop_skip_route_notify &&
+ !list_empty(&nh->fi_list)) {
struct fib_info *fi;
/* expectation is a few fib_info per nexthop and then
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 81b267e..1cd010d 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -711,6 +711,13 @@ static struct ctl_table ipv4_net_table[] = {
.proc_handler = proc_tcp_early_demux
},
{
+ .procname = "nexthop_skip_route_notify",
+ .data = &init_net.ipv4.sysctl_nexthop_skip_route_notify,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec
+ },
+ {
.procname = "ip_default_ttl",
.data = &init_net.ipv4.sysctl_ip_default_ttl,
.maxlen = sizeof(int),
--
2.1.4
Powered by blists - more mailing lists