diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2009-06-24 11:02:50 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2009-06-24 11:02:50 -0700 |
commit | 90868efe14b30eb4ad810f917ec5f2e8626127e6 (patch) | |
tree | 81c98627ed9674a0243c5f500985714b1ce76067 | |
parent | a76c7dd88af5251e20bdaa84a8f517f69863e8cf (diff) | |
download | quagga-90868efe14b30eb4ad810f917ec5f2e8626127e6.tar.bz2 quagga-90868efe14b30eb4ad810f917ec5f2e8626127e6.tar.xz |
Revert "ospf: fix performance of ospf_lsa_maxage"
This patch seems to cause bug 4627.
This reverts commit ca5f52dcb72b6bc19037400ec27053d8fe2b5e6e.
-rw-r--r-- | ospfd/ospf_lsa.c | 24 | ||||
-rw-r--r-- | ospfd/ospf_lsa.h | 9 |
2 files changed, 23 insertions, 10 deletions
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 62a4fb45..aaf1f484 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -261,6 +261,14 @@ ospf_lsa_free (struct ospf_lsa *lsa) XFREE (MTYPE_OSPF_LSA, lsa); } +/* Lock LSA. */ +struct ospf_lsa * +ospf_lsa_lock (struct ospf_lsa *lsa) +{ + lsa->lock++; + return lsa; +} + /* Unlock LSA. */ void ospf_lsa_unlock (struct ospf_lsa **lsa) @@ -2994,6 +3002,19 @@ ospf_maxage_lsa_remover (struct thread *thread) return 0; } +static int +ospf_lsa_maxage_exist (struct ospf *ospf, struct ospf_lsa *new) +{ + struct listnode *node; + struct ospf_lsa *lsa; + + for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa)) + if (lsa == new) + return 1; + + return 0; +} + void ospf_lsa_maxage_delete (struct ospf *ospf, struct ospf_lsa *lsa) { @@ -3011,7 +3032,7 @@ ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa) { /* When we saw a MaxAge LSA flooded to us, we put it on the list and schedule the MaxAge LSA remover. */ - if (CHECK_FLAG(lsa->flags, OSPF_LSA_MAXAGE)) + if (ospf_lsa_maxage_exist (ospf, lsa)) { if (IS_DEBUG_OSPF (lsa, LSA_FLOODING)) zlog_debug ("LSA[Type%d:%s]: %p already exists on MaxAge LSA list", @@ -3020,7 +3041,6 @@ ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa) } listnode_add (ospf->maxage_lsa, ospf_lsa_lock (lsa)); - SET_FLAG(lsa->flags, OSPF_LSA_MAXAGE); if (IS_DEBUG_OSPF (lsa, LSA_FLOODING)) zlog_debug ("LSA[%s]: MaxAge LSA remover scheduled.", dump_lsa_key (lsa)); diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h index bca4c9ef..8dd054c3 100644 --- a/ospfd/ospf_lsa.h +++ b/ospfd/ospf_lsa.h @@ -80,7 +80,6 @@ struct ospf_lsa #define OSPF_LSA_DISCARD 0x10 #define OSPF_LSA_LOCAL_XLT 0x20 #define OSPF_LSA_PREMATURE_AGE 0x40 -#define OSPF_LSA_MAXAGE 0x80 /* LSA data. */ struct lsa_header *data; @@ -245,13 +244,7 @@ extern struct ospf_neighbor *ospf_nbr_lookup_ptop (struct ospf_interface *); extern struct ospf_lsa *ospf_lsa_new (void); extern struct ospf_lsa *ospf_lsa_dup (struct ospf_lsa *); extern void ospf_lsa_free (struct ospf_lsa *); - -static inline struct ospf_lsa *ospf_lsa_lock (struct ospf_lsa *lsa) -{ - lsa->lock++; - return lsa; -} - +extern struct ospf_lsa *ospf_lsa_lock (struct ospf_lsa *); extern void ospf_lsa_unlock (struct ospf_lsa **); extern void ospf_lsa_discard (struct ospf_lsa *); |