From d24f6e2a34ca829bd2ff6adb98b49d4d2d9cb737 Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 21 Oct 2005 09:23:12 +0000 Subject: 2005-10-21 Paul Jakma * (general) SPF millisecond resolution timer with adaptive, linear back-off holdtime. Prettification of ospf_timer_dump. * ospf_dump.c: (ospf_timeval_dump) new function. The guts of ospf_timer_dump, but made to be more dynamic in printing out the relative timeval, sliding the precision printed out according to the value. (ospf_timer_dump) guts moved to ospf_timeval_dump. * ospf_dump.h: export ospf_timeval_dump. * ospf_flood.c: (ospf_flood) remove gettimeofday, use the libzebra exported recent_time instead, as it's not terribly critical to have time exactly right - the dropped LSA will be retransmited to us if we don't ACK it. * ospf_packet.c: (ospf_ls_upd_timer) Ditto, but here we're not transmitting, just putting LSA back on update transmit list. * ospfd.h: delay and holdtimes should be unsigned. Add spf_max_holdtime and spf_hold_multiplier. Update default defines for delay and hold time to be in msec. (struct ospf) change the SPF timestamp to a struct timeval. Remove ospf_timers_spf_(un)?set. * ospfd.c: (ospf_timers_spf_{set,unset}) removed. (ospf_new) initialise spf_max_holdtime and spf_hold_multiplier * ospf_spf.c: (ospf_spf_calculate) SPF timestamp is a timeval now, update with gettimeofday. (ospf_spf_calculate_schedule) Change SPF timers to millisecond resolution. Make the holdtime be adaptive, with a linear increase in holdtime ever consecutive SPF run which occurs within holdtime of previous SPF, bounded by spf_max_holdtime. * ospf_vty.c: Update spf timers commands. (ospf_timers_spf_set) trivial helper. (ospf_timers_throttle_spf_cmd) new command to set SPF delay, initial hold and max hold times with millisecond resolution. (ospf_timers_spf_cmd) Deprecated. Accept the old values, convert to msec, truncate to new limits. (no_ospf_timers_throttle_spf_cmd) set timers to defaults. (no_ospf_timers_spf_cmd) deprecated form, same as previous. (show_ip_ospf_cmd) Display SPF parameters and times. (show_ip_ospf_neighbour_header) Centralise the 'sh ip os ne' header. (show_ip_ospf_neighbor_sub) Fix the field widths. Get rid of the multiple spaces which were making the lines even longer. (show_ip_ospf_neighbor_cmd) Use show_ip_ospf_neighbour_header (show_ip_ospf_neighbor_all_cmd) ditto and fix the field widths for NBMA neighbours. (show_ip_ospf_neighbor_int) Use header function. (show_ip_ospf_nbr_nbma_detail_sub) use sizeof for timebuf, local array - safer. (show_ip_ospf_neighbor_detail_sub) ditto (ospf_vty_init) install the new SPF throttle timer commands. --- ospfd/ospfd.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'ospfd/ospfd.h') diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index b24a1cf7..38e56b6f 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -88,8 +88,9 @@ #define OSPF_AUTH_CMD_NOTSEEN -2 /* OSPF SPF timer values. */ -#define OSPF_SPF_DELAY_DEFAULT 1 -#define OSPF_SPF_HOLDTIME_DEFAULT 1 +#define OSPF_SPF_DELAY_DEFAULT 200 +#define OSPF_SPF_HOLDTIME_DEFAULT 1000 +#define OSPF_SPF_MAX_HOLDTIME_DEFAULT 10000 /* OSPF interface default values. */ #define OSPF_OUTPUT_COST_DEFAULT 10 @@ -191,8 +192,10 @@ struct ospf #define OPAQUE_BLOCK_TYPE_11_LSA_BIT (1 << 3) #endif /* HAVE_OPAQUE_LSA */ - int spf_delay; /* SPF delay time. */ - int spf_holdtime; /* SPF hold time. */ + unsigned int spf_delay; /* SPF delay time. */ + unsigned int spf_holdtime; /* SPF hold time. */ + unsigned int spf_max_holdtime; /* SPF maximum-holdtime */ + unsigned int spf_hold_multiplier; /* Adaptive multiplier for hold time */ int default_originate; /* Default information originate. */ #define DEFAULT_ORIGINATE_NONE 0 #define DEFAULT_ORIGINATE_ZEBRA 1 @@ -231,7 +234,7 @@ struct ospf prefix is LSA's adv. network*/ /* Time stamps. */ - time_t ts_spf; /* SPF calculation time stamp. */ + struct timeval ts_spf; /* SPF calculation time stamp. */ struct list *maxage_lsa; /* List of MaxAge LSA for deletion. */ int redistribute; /* Num of redistributed protocols. */ @@ -557,8 +560,6 @@ extern int ospf_area_import_list_set (struct ospf *, struct ospf_area *, extern int ospf_area_import_list_unset (struct ospf *, struct ospf_area *); extern int ospf_area_shortcut_set (struct ospf *, struct ospf_area *, int); extern int ospf_area_shortcut_unset (struct ospf *, struct ospf_area *); -extern int ospf_timers_spf_set (struct ospf *, u_int32_t, u_int32_t); -extern int ospf_timers_spf_unset (struct ospf *); extern int ospf_timers_refresh_set (struct ospf *, int); extern int ospf_timers_refresh_unset (struct ospf *); extern int ospf_nbr_nbma_set (struct ospf *, struct in_addr); -- cgit v1.2.1