From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: [PATCH iproute2-next 0/3] Improve batch times by caching link lookups Date: Mon, 7 Jan 2019 14:55:49 -0800 Message-ID: <20190107225552.8441-1-dsahern@kernel.org> Cc: netdev@vger.kernel.org, David Ahern To: stephen@networkplumber.org Return-path: Received: from mail.kernel.org ([198.145.29.99]:38812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726667AbfAGW4O (ORCPT ); Mon, 7 Jan 2019 17:56:14 -0500 Sender: netdev-owner@vger.kernel.org List-ID: From: David Ahern Many commands convert device names to an index using ll_name_to_index. ll_name_to_index calls if_nametoindex which is ioctl based and the result is not cached. When using a batch file this means the same device lookups can be done repeatedly adding unnecessary overhead (socket + ioctl + close for each device lookup). This series adds a new function, ll_link_get, to send a netlink based RTM_GETLINK. If successful, the result is cached in idx_head and name_head so future lookups can re-use the entry. ll_name_to_index is updated to use ll_link_get over if_nametoindex. The first 2 patches add a means to drop an entry from the cache and updates iplink_modify to use that new function to drop entries on device renames. David Ahern (3): ll_map: Add function to remove link cache entry by index ip link: Drop cache entry on name changes Improve batch times by caching link lookups include/ll_map.h | 1 + ip/ip_common.h | 3 ++- ip/iplink.c | 10 ++++++++-- ip/iplink_vxcan.c | 3 ++- ip/link_veth.c | 3 ++- lib/ll_map.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 72 insertions(+), 6 deletions(-) -- 2.11.0