>From f0124b0f0aa0e5b9288114eb8e6ff9b4f8c33ec8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 28 Mar 2013 15:17:47 -0700 Subject: [PATCH 2/2] ip: remove unnecessary ll_init_map Don't call ll_init_map on modify operations Saves significant overhead with 1000's of devices. --- ip/ipaddress.c | 2 -- ip/ipaddrlabel.c | 2 -- ip/iplink.c | 2 -- ip/iproute.c | 6 ------ ip/xfrm_monitor.c | 2 -- 5 files changed, 14 deletions(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 149df69..5b9a438 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -1365,8 +1365,6 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) if (!scoped && cmd != RTM_DELADDR) req.ifa.ifa_scope = default_scope(&lcl); - ll_init_map(&rth); - if ((req.ifa.ifa_index = ll_name_to_index(d)) == 0) { fprintf(stderr, "Cannot find device \"%s\"\n", d); return -1; diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c index eb6a48c..1789d9c 100644 --- a/ip/ipaddrlabel.c +++ b/ip/ipaddrlabel.c @@ -246,8 +246,6 @@ static int ipaddrlabel_flush(int argc, char **argv) int do_ipaddrlabel(int argc, char **argv) { - ll_init_map(&rth); - if (argc < 1) { return ipaddrlabel_list(0, NULL); } else if (matches(argv[0], "list") == 0 || diff --git a/ip/iplink.c b/ip/iplink.c index 5c7b43c..dc98019 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -533,8 +533,6 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv) } } - ll_init_map(&rth); - if (!(flags & NLM_F_CREATE)) { if (!dev) { fprintf(stderr, "Not enough information: \"dev\" " diff --git a/ip/iproute.c b/ip/iproute.c index 2c2a331..adef774 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -970,8 +970,6 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) if (d || nhs_ok) { int idx; - ll_init_map(&rth); - if (d) { if ((idx = ll_name_to_index(d)) == 0) { fprintf(stderr, "Cannot find device \"%s\"\n", d); @@ -1265,8 +1263,6 @@ static int iproute_list_flush_or_save(int argc, char **argv, int action) if (do_ipv6 == AF_UNSPEC && filter.tb) do_ipv6 = AF_INET; - ll_init_map(&rth); - if (id || od) { int idx; @@ -1452,8 +1448,6 @@ static int iproute_get(int argc, char **argv) exit(1); } - ll_init_map(&rth); - if (idev || odev) { int idx; diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c index bfc48f1..a1f5d53 100644 --- a/ip/xfrm_monitor.c +++ b/ip/xfrm_monitor.c @@ -408,8 +408,6 @@ int do_xfrm_monitor(int argc, char **argv) return rtnl_from_file(fp, xfrm_accept_msg, (void*)stdout); } - //ll_init_map(&rth); - if (rtnl_open_byproto(&rth, groups, NETLINK_XFRM) < 0) exit(1); -- 1.7.10.4