Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH 3/4] netconfig: Optimize IPv4 address deletion
Date: Wed, 02 Oct 2019 13:39:58 -0700	[thread overview]
Message-ID: <20191002203959.5582-3-tim.a.kourt@linux.intel.com> (raw)
In-Reply-To: <20191002203959.5582-1-tim.a.kourt@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

Decrease the queue traversals to a single pass
---
 src/netconfig.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/netconfig.c b/src/netconfig.c
index cf951245..2175d9be 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -427,22 +427,22 @@ static void netconfig_ifaddr_deleted(struct netconfig *netconfig,
 					uint32_t len)
 {
 	struct netconfig_ifaddr *ifaddr;
-	char *ip;
+	struct netconfig_ifaddr query;
 
-	rtnl_ifaddr_extract(ifa, len, NULL, &ip, NULL);
+	rtnl_ifaddr_extract(ifa, len, NULL, &query.ip, NULL);
 
-	ifaddr = netconfig_ifaddr_find(netconfig, ifa->ifa_family,
-							ifa->ifa_prefixlen, ip);
+	query.family = ifa->ifa_family;
+	query.prefix_len = ifa->ifa_prefixlen;
 
-	l_free(ip);
+	ifaddr = l_queue_remove_if(netconfig->ifaddr_list,
+						netconfig_ifaddr_match, &query);
+	l_free(query.ip);
 
 	if (!ifaddr)
 		return;
 
 	l_debug("ifaddr %s/%u", ifaddr->ip, ifaddr->prefix_len);
 
-	l_queue_remove(netconfig->ifaddr_list, ifaddr);
-
 	netconfig_ifaddr_destroy(ifaddr);
 }
 
-- 
2.13.6

  parent reply	other threads:[~2019-10-02 20:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 20:39 [PATCH 1/4] rtnlutil: Add IPv6 route deletion helper Tim Kourt
2019-10-02 20:39 ` [PATCH 2/4] netconfig: Remove IPv6 default route Tim Kourt
2019-10-02 20:39 ` Tim Kourt [this message]
2019-10-02 20:39 ` [PATCH 4/4] netconfig: Fix return type for module init Tim Kourt
2019-10-03 15:56 ` [PATCH 1/4] rtnlutil: Add IPv6 route deletion helper Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191002203959.5582-3-tim.a.kourt@linux.intel.com \
    --to=tim.a.kourt@linux.intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox