aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
authorJulian Anastasov <ja@ssi.bg>2011-03-19 08:13:54 -0400
committerDavid S. Miller <davem@davemloft.net>2011-03-22 04:06:33 -0400
commit04024b937a6e9b7d4320b5853557cea3930d528c (patch)
treed14d770251f5b50d9647a662848c64bab034265a /net/ipv4/devinet.c
parent2d230e2b2c3111cf4a11619f60dcd158ae84e3ab (diff)
ipv4: optimize route adding on secondary promotion
Optimize the calling of fib_add_ifaddr for all secondary addresses after the promoted one to start from their place, not from the new place of the promoted secondary. It will save some CPU cycles because we are sure the promoted secondary was first for the subnet and all next secondaries do not change their place. Signed-off-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 2523001f4c9..d5a4553bebc 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -375,6 +375,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
375 blocking_notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa1); 375 blocking_notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa1);
376 376
377 if (promote) { 377 if (promote) {
378 struct in_ifaddr *next_sec = promote->ifa_next;
378 379
379 if (prev_prom) { 380 if (prev_prom) {
380 prev_prom->ifa_next = promote->ifa_next; 381 prev_prom->ifa_next = promote->ifa_next;
@@ -386,7 +387,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
386 rtmsg_ifa(RTM_NEWADDR, promote, nlh, pid); 387 rtmsg_ifa(RTM_NEWADDR, promote, nlh, pid);
387 blocking_notifier_call_chain(&inetaddr_chain, 388 blocking_notifier_call_chain(&inetaddr_chain,
388 NETDEV_UP, promote); 389 NETDEV_UP, promote);
389 for (ifa = promote->ifa_next; ifa; ifa = ifa->ifa_next) { 390 for (ifa = next_sec; ifa; ifa = ifa->ifa_next) {
390 if (ifa1->ifa_mask != ifa->ifa_mask || 391 if (ifa1->ifa_mask != ifa->ifa_mask ||
391 !inet_ifa_match(ifa1->ifa_address, ifa)) 392 !inet_ifa_match(ifa1->ifa_address, ifa))
392 continue; 393 continue;