Skip to content

Commit

Permalink
ospfd: Fast OSPF convergence
Browse files Browse the repository at this point in the history
When considering small networks that have extreme requirements on
availability and thus convergence delay, the timers given in the OSPF RFC
seem a little “conservative”, i.e., the delay between accepted LSAs and the
rate at which LSAs are sent.  Cisco introduced two commands 'timers throttle
lsa all’ and 'timers lsa arrival’, which allow operators to tune these
parameters.

I have been writing a patch to also support 'timers lsa arrival’ fully and
‘timers throttle lsa all’ (without the throttling part) also in quagga.
  • Loading branch information
nomick authored and donaldsharp committed Jun 9, 2016
1 parent 588d1f8 commit 16e56a1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ospfd/ospf_flood.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ ospf_flood (struct ospf *ospf, struct ospf_neighbor *nbr,
; /* Accept this LSA for quick LSDB resynchronization. */
}
else if (tv_cmp (tv_sub (recent_relative_time (), current->tv_recv),
intms2tv (ospf->min_ls_arrival)) < 0)
msec2tv (ospf->min_ls_arrival)) < 0)
{
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("LSA[Flooding]: LSA is received recently.");
Expand Down
18 changes: 9 additions & 9 deletions ospfd/ospf_lsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,25 @@ tv_floor (struct timeval a)
}

struct timeval
intms2tv (int a)
int2tv (int a)
{
struct timeval ret;

ret.tv_sec = a/1000;
ret.tv_usec = (a%1000)*1000;
ret.tv_sec = a;
ret.tv_usec = 0;

return ret;
}

struct timeval
int2tv (int a)
msec2tv (int a)
{
struct timeval ret;

ret.tv_sec = a;
ret.tv_usec = 0;
ret.tv_sec = a/1000;
ret.tv_usec = (a%1000) * 1000;

return ret;
return tv_adjust (ret);
}

struct timeval
Expand Down Expand Up @@ -156,9 +156,9 @@ ospf_lsa_refresh_delay (struct ospf_lsa *lsa)
quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
delta = tv_sub (now, lsa->tv_orig);

if (tv_cmp (delta, intms2tv (OSPF_MIN_LS_INTERVAL)) < 0)
if (tv_cmp (delta, msec2tv (OSPF_MIN_LS_INTERVAL)) < 0)
{
delay = tv_ceil (tv_sub (intms2tv (OSPF_MIN_LS_INTERVAL), delta));
delay = tv_ceil (tv_sub (msec2tv (OSPF_MIN_LS_INTERVAL), delta));

if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
zlog_debug ("LSA[Type%d:%s]: Refresh timer delay %d seconds",
Expand Down
2 changes: 1 addition & 1 deletion ospfd/ospf_lsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ struct as_external_lsa
extern struct timeval tv_adjust (struct timeval);
extern int tv_ceil (struct timeval);
extern int tv_floor (struct timeval);
extern struct timeval intms2tv (int);
extern struct timeval int2tv (int);
extern struct timeval msec2tv (int);
extern struct timeval tv_add (struct timeval, struct timeval);
extern struct timeval tv_sub (struct timeval, struct timeval);
extern int tv_cmp (struct timeval, struct timeval);
Expand Down
2 changes: 1 addition & 1 deletion ospfd/ospf_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@ ospf_ls_upd (struct ospf *ospf, struct ip *iph, struct ospf_header *ospfh,
quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);

if (tv_cmp (tv_sub (now, current->tv_orig),
intms2tv (oi->ospf->min_ls_arrival)) >= 0)
msec2tv (ospf->min_ls_arrival)) >= 0)
/* Trap NSSA type later.*/
ospf_ls_upd_send_lsa (nbr, current, OSPF_SEND_PACKET_DIRECT);
DISCARD_LSA (lsa, 8);
Expand Down
8 changes: 4 additions & 4 deletions ospfd/ospfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,16 @@ ospf_new (u_short instance)
new->default_metric = -1;
new->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH;

/* LSA timers */
new->min_ls_interval = OSPF_MIN_LS_INTERVAL;
new->min_ls_arrival = OSPF_MIN_LS_ARRIVAL;

/* SPF timer value init. */
new->spf_delay = OSPF_SPF_DELAY_DEFAULT;
new->spf_holdtime = OSPF_SPF_HOLDTIME_DEFAULT;
new->spf_max_holdtime = OSPF_SPF_MAX_HOLDTIME_DEFAULT;
new->spf_hold_multiplier = 1;

/* LSA timers value init */
new->min_ls_interval = OSPF_MIN_LS_INTERVAL;
new->min_ls_arrival = OSPF_MIN_LS_ARRIVAL;

/* MaxAge init. */
new->maxage_delay = OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT;
new->maxage_lsa = route_table_init();
Expand Down
8 changes: 4 additions & 4 deletions ospfd/ospfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,16 @@ struct ospf

#define OSPF_STUB_MAX_METRIC_SUMMARY_COST 0x00ff0000

/* LSA timers */
unsigned int min_ls_interval; /* minimum delay between LSAs (in msec) */
unsigned int min_ls_arrival; /* minimum interarrival time between LSAs (in msec) */

/* SPF parameters */
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 */

/* LSA timer parameters */
unsigned int min_ls_interval; /* mininum delay between LSAs (in msec) */
unsigned int min_ls_arrival; /* LSA minimum arrival in milliseconds. */

int default_originate; /* Default information originate. */
#define DEFAULT_ORIGINATE_NONE 0
#define DEFAULT_ORIGINATE_ZEBRA 1
Expand Down

0 comments on commit 16e56a1

Please sign in to comment.