From aa3ba071f611816afebdd2af531f449af548852f Mon Sep 17 00:00:00 2001 From: Adriano Marto Reis Date: Mon, 6 Dec 2021 09:37:51 +1000 Subject: [PATCH 1/4] babeld: Presenting interface configuration parameters * Presenting the configuration parameters enable-timestamps, max-rtt-penalty, rtt-min, and rtt-max. * Using #defines for the default configuration values instead of magic numbers. * rtt-max and rtt-min are entered and presented in milliseconds, but stored and internally used in microseconds. Signed-off-by: Adriano Marto Reis --- babeld/babel_interface.c | 40 +++++++++++++++++++++++++++++++++------- babeld/babeld.h | 6 ++++++ 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 615ed9fee3..1dae93b0ed 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -484,7 +484,9 @@ DEFUN (babel_set_rtt_min, babel_ifp = babel_get_if_nfo(ifp); assert (babel_ifp != NULL); - babel_ifp->rtt_min = rtt; + babel_ifp->rtt_min = + rtt + * 1000; // value entered in milliseconds and stored as microseconds return CMD_SUCCESS; } @@ -504,7 +506,9 @@ DEFUN (babel_set_rtt_max, babel_ifp = babel_get_if_nfo(ifp); assert (babel_ifp != NULL); - babel_ifp->rtt_max = rtt; + babel_ifp->rtt_max = + rtt + * 1000; // value entered in milliseconds and stored as microseconds return CMD_SUCCESS; } @@ -1328,8 +1332,29 @@ interface_config_write (struct vty *vty) babel_ifp->update_interval); write++; } - /* Some parameters have different defaults for wired/wireless. */ - if (CHECK_FLAG (babel_ifp->flags, BABEL_IF_WIRED)) { + if (CHECK_FLAG(babel_ifp->flags, BABEL_IF_TIMESTAMPS)) { + vty_out(vty, " babel enable-timestamps\n"); + write++; + } + if (babel_ifp->max_rtt_penalty != BABEL_DEFAULT_MAX_RTT_PENALTY) { + vty_out(vty, " babel max-rtt-penalty %u\n", + babel_ifp->max_rtt_penalty); + write++; + } + if (babel_ifp->rtt_decay != BABEL_DEFAULT_RTT_DECAY) { + vty_out(vty, " babel rtt-decay %u\n", babel_ifp->rtt_decay); + write++; + } + if (babel_ifp->rtt_min != BABEL_DEFAULT_RTT_MIN) { + vty_out(vty, " babel rtt-min %u\n", babel_ifp->rtt_min / 1000); + write++; + } + if (babel_ifp->rtt_max != BABEL_DEFAULT_RTT_MAX) { + vty_out(vty, " babel rtt-max %u\n", babel_ifp->rtt_max / 1000); + write++; + } + /* Some parameters have different defaults for wired/wireless. */ + if (CHECK_FLAG (babel_ifp->flags, BABEL_IF_WIRED)) { if (!CHECK_FLAG (babel_ifp->flags, BABEL_IF_SPLIT_HORIZON)) { vty_out (vty, " no babel split-horizon\n"); write++; @@ -1395,9 +1420,10 @@ babel_interface_allocate (void) babel_ifp->bucket_time = babel_now.tv_sec; babel_ifp->bucket = BUCKET_TOKENS_MAX; babel_ifp->hello_seqno = (frr_weak_random() & 0xFFFF); - babel_ifp->rtt_min = 10000; - babel_ifp->rtt_max = 120000; - babel_ifp->max_rtt_penalty = 150; + babel_ifp->rtt_decay = BABEL_DEFAULT_RTT_DECAY; + babel_ifp->rtt_min = BABEL_DEFAULT_RTT_MIN; + babel_ifp->rtt_max = BABEL_DEFAULT_RTT_MAX; + babel_ifp->max_rtt_penalty = BABEL_DEFAULT_MAX_RTT_PENALTY; babel_ifp->hello_interval = BABEL_DEFAULT_HELLO_INTERVAL; babel_ifp->update_interval = BABEL_DEFAULT_UPDATE_INTERVAL; babel_ifp->channel = BABEL_IF_CHANNEL_INTERFERING; diff --git a/babeld/babeld.h b/babeld/babeld.h index 4487aae99f..38859f54da 100644 --- a/babeld/babeld.h +++ b/babeld/babeld.h @@ -81,6 +81,11 @@ THE SOFTWARE. #define BABEL_DEFAULT_HELLO_INTERVAL 4000 #define BABEL_DEFAULT_UPDATE_INTERVAL 16000 #define BABEL_DEFAULT_RESEND_DELAY 2000 +#define BABEL_DEFAULT_RTT_DECAY 42 + +/* Values in microseconds */ +#define BABEL_DEFAULT_RTT_MIN 10000 +#define BABEL_DEFAULT_RTT_MAX 120000 /* In units of seconds */ #define BABEL_DEFAULT_SMOOTHING_HALF_LIFE 4 @@ -90,6 +95,7 @@ THE SOFTWARE. #define BABEL_DEFAULT_RXCOST_WIRED 96 #define BABEL_DEFAULT_RXCOST_WIRELESS 256 +#define BABEL_DEFAULT_MAX_RTT_PENALTY 150 /* Babel structure. */ struct babel From a665be6a88ded83485210b555511b3a3a3ed1371 Mon Sep 17 00:00:00 2001 From: Adriano Marto Reis Date: Mon, 6 Dec 2021 09:41:25 +1000 Subject: [PATCH 2/4] doc: Updating babel default configuration parameters Updating babel default configuration parameters rtt-min and max-rtt-penalty according to the actual implementation. Signed-off-by: Adriano Marto Reis --- doc/user/babeld.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/user/babeld.rst b/doc/user/babeld.rst index 2d9fef13c3..f1866f0b16 100644 --- a/doc/user/babeld.rst +++ b/doc/user/babeld.rst @@ -132,7 +132,7 @@ Babel configuration This specifies the minimum RTT, in milliseconds, starting from which we increase the cost to a neighbour. The additional cost is linear in - (rtt - rtt-min). The default is 100 ms. + (rtt - rtt-min). The default is 10 ms. .. clicmd:: babel rtt-max (1-65535) @@ -144,8 +144,8 @@ Babel configuration .. clicmd:: babel max-rtt-penalty (0-65535) This specifies the maximum cost added to a neighbour because of RTT, i.e. - when the RTT is higher or equal than rtt-max. The default is 0, which - effectively disables the use of a RTT-based cost. + when the RTT is higher or equal than rtt-max. The default is 150. Setting it, + to 0 effectively disables the use of a RTT-based cost. .. clicmd:: babel enable-timestamps From 896cf5c5f20f4bbd8c31323b588e55caaa550233 Mon Sep 17 00:00:00 2001 From: Adriano Marto Reis Date: Tue, 7 Dec 2021 18:18:33 +1000 Subject: [PATCH 3/4] babeld: C-style comments Replacing C++-style comments with C-style comments. Signed-off-by: "Adriano Marto Reis" --- babeld/babel_interface.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 1dae93b0ed..e725fbffe9 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -484,9 +484,8 @@ DEFUN (babel_set_rtt_min, babel_ifp = babel_get_if_nfo(ifp); assert (babel_ifp != NULL); - babel_ifp->rtt_min = - rtt - * 1000; // value entered in milliseconds and stored as microseconds + /* The value is entered in milliseconds but stored as microseconds. */ + babel_ifp->rtt_min = rtt * 1000; return CMD_SUCCESS; } @@ -506,9 +505,8 @@ DEFUN (babel_set_rtt_max, babel_ifp = babel_get_if_nfo(ifp); assert (babel_ifp != NULL); - babel_ifp->rtt_max = - rtt - * 1000; // value entered in milliseconds and stored as microseconds + /* The value is entered in milliseconds but stored as microseconds. */ + babel_ifp->rtt_max = rtt * 1000; return CMD_SUCCESS; } From ef473aa3e4a3b1a9fe3bf7e2b05f93e415c122ac Mon Sep 17 00:00:00 2001 From: Adriano Marto Reis Date: Tue, 7 Dec 2021 18:20:03 +1000 Subject: [PATCH 4/4] doc: Minor grammar correction No comma needed. Signed-off-by: "Adriano Marto Reis" --- doc/user/babeld.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/babeld.rst b/doc/user/babeld.rst index f1866f0b16..bda0045a60 100644 --- a/doc/user/babeld.rst +++ b/doc/user/babeld.rst @@ -144,7 +144,7 @@ Babel configuration .. clicmd:: babel max-rtt-penalty (0-65535) This specifies the maximum cost added to a neighbour because of RTT, i.e. - when the RTT is higher or equal than rtt-max. The default is 150. Setting it, + when the RTT is higher or equal than rtt-max. The default is 150. Setting it to 0 effectively disables the use of a RTT-based cost.