mirror_iproute2/lib
David Ahern 55870dfe7f Improve batch and dump times by caching link lookups
ip route uses ll_name_to_index and ll_index_to_name to convert between
device names and indices. At the moment both use for the ioctl based glibc
functions if_nametoindex and if_indextoname and does not cache the result.
When using a batch file or dumping large number of routes this means the
same device lookups can be done repeatedly adding unnecessary overhead
(socket + ioctl + close for each device lookup).

Add a new function, ll_link_get, to send a netlink based RTM_GETLINK. If
successful, cache the result in idx_head and name_head so future lookups
can re-use the entry. Update ll_name_to_index and ll_index_to_name to use
ll_link_get and only fallback to the glibc functions if it fails.

With this change the time to install 720,022 routes with 2 ecmp nexthops
where the nexthop device is given is reduced from 31.4 seconds to 19.2
seconds. A dump of those routes drops from 13.3 to 2.8 seconds.

Signed-off-by: David Ahern <dsahern@gmail.com>
2019-02-22 18:51:20 -08:00
..
bpf.c Merge branch 'iproute2-master' into next 2019-02-22 18:50:39 -08:00
color.c lib/color: make local functions static 2018-11-19 11:42:44 -08:00
coverity_model.c scrub out whitespace issues 2016-03-27 10:50:14 -07:00
exec.c SPDX license identifiers 2017-11-24 12:21:35 -08:00
fs.c Include bsd/string.h only in include/utils.h 2018-11-05 08:38:32 -08:00
inet_proto.c Include bsd/string.h only in include/utils.h 2018-11-05 08:38:32 -08:00
json_print.c Merge branch 'iproute2-master' into iproute2-next 2018-12-19 12:02:17 -08:00
json_writer.c Merge branch 'iproute2-master' into iproute2-next 2018-12-19 12:02:17 -08:00
libgenl.c SPDX license identifiers 2017-11-24 12:21:35 -08:00
libnetlink.c lib/libnetlink: ensure a minimum of 32KB for the buffer used in rtnl_recvmsg() 2019-02-13 13:51:44 -08:00
ll_addr.c lib/ll_addr: whitespace and indent cleanup 2018-11-19 11:42:44 -08:00
ll_map.c Improve batch and dump times by caching link lookups 2019-02-22 18:51:20 -08:00
ll_proto.c drop unneeded include of syslog.h 2017-11-12 16:22:36 -08:00
ll_types.c drop unneeded include of syslog.h 2017-11-12 16:22:36 -08:00
Makefile lib: Correct object file dependencies 2018-02-16 08:14:18 -08:00
mpls_ntop.c SPDX license identifiers 2017-11-24 12:21:35 -08:00
mpls_pton.c SPDX license identifiers 2017-11-24 12:21:35 -08:00
names.c tc: drop unused name_to_id function 2018-11-19 11:42:44 -08:00
namespace.c lib/namespace: avoid double-mounting a /sys 2018-07-27 13:40:12 -07:00
rt_names.c iproute2: Add support for a few routing protocols 2018-06-11 11:18:30 -07:00
utils.c Merge branch 'iproute2-master' into iproute2-next 2018-12-19 12:02:17 -08:00