[ovs-dev] [PATCH V2 1/4] bfd: Implement BFD decay.
Alex Wang
alexw at nicira.com
Tue Aug 13 05:24:14 UTC 2013
Hey Ethan,
This is the newest version,
I think I address most of issues, mentioned in your comments,
Kind Regards,
Alex Wang,
On Tue, Aug 6, 2013 at 8:51 AM, Alex Wang <alexw at nicira.com> wrote:
> When there is no incoming data traffic at the interface for a period,
> BFD decay allows the bfd session to increase the min_rx. This is
> helpful in that some interfaces may be idle for long a time. And cpu
> consumption can be reduced by processing fewer bfd control packets.
>
> Signed-off-by: Alex Wang <alexw at nicira.com>
>
> ---
>
> v1 -> v2:
> - add 'in_decay' boolean variable to bfd struct
> and simplify code.
> - include unit test to this patch.
>
> ---
> lib/bfd.c | 103 +++++++++++++++++++++--
> lib/bfd.h | 5 +-
> ofproto/ofproto-dpif.c | 7 +-
> tests/bfd.at | 211
> +++++++++++++++++++++++++++++++++++++++++++++---
> vswitchd/vswitch.xml | 10 +++
> 5 files changed, 319 insertions(+), 17 deletions(-)
>
> diff --git a/lib/bfd.c b/lib/bfd.c
> index d4ac489..8a0f5e1 100644
> --- a/lib/bfd.c
> +++ b/lib/bfd.c
> @@ -26,6 +26,7 @@
> #include "hash.h"
> #include "hmap.h"
> #include "list.h"
> +#include "netdev.h"
> #include "netlink.h"
> #include "odp-util.h"
> #include "ofpbuf.h"
> @@ -149,6 +150,9 @@ struct bfd {
> bool cpath_down; /* Concatenated Path Down. */
> uint8_t mult; /* bfd.DetectMult. */
>
> + struct netdev *netdev;
> + uint64_t rx_packets; /* Packets received by 'netdev'. */
> +
> enum state state; /* bfd.SessionState. */
> enum state rmt_state; /* bfd.RemoteSessionState. */
>
> @@ -184,6 +188,11 @@ struct bfd {
>
> atomic_bool check_tnl_key; /* Verify tunnel key of inbound
> packets? */
> atomic_int ref_cnt;
> +
> + /* BFD decay related variables. */
> + bool in_decay;
> + int decay_min_rx;
> + long long int decay_detect_time; /* Decay detection time. */
> };
>
> static struct ovs_mutex mutex = OVS_MUTEX_INITIALIZER;
> @@ -206,6 +215,8 @@ static void bfd_set_state(struct bfd *, enum state,
> enum diag)
> static uint32_t generate_discriminator(void) OVS_REQ_WRLOCK(&mutex);
> static void bfd_put_details(struct ds *, const struct bfd *)
> OVS_REQ_WRLOCK(&mutex);
> +static uint64_t bfd_rx_packets(const struct bfd *) OVS_REQ_WRLOCK(&mutex);
> +static void bfd_try_decay(struct bfd *) OVS_REQ_WRLOCK(&mutex);
> static void bfd_unixctl_show(struct unixctl_conn *, int argc,
> const char *argv[], void *aux OVS_UNUSED);
> static void bfd_unixctl_set_forwarding_override(struct unixctl_conn *,
> @@ -253,12 +264,13 @@ bfd_get_status(const struct bfd *bfd, struct smap
> *smap)
> * handle for the session, or NULL if BFD is not enabled according to
> 'cfg'.
> * Also returns NULL if cfg is NULL. */
> struct bfd *
> -bfd_configure(struct bfd *bfd, const char *name, const struct smap *cfg)
> - OVS_EXCLUDED(mutex)
> +bfd_configure(struct bfd *bfd, const char *name, const struct smap *cfg,
> + struct netdev *netdev) OVS_EXCLUDED(mutex)
> {
> static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
> static atomic_uint16_t udp_src = ATOMIC_VAR_INIT(0);
>
> + int decay_min_rx;
> long long int min_tx, min_rx;
> bool cpath_down;
> const char *hwaddr;
> @@ -290,6 +302,10 @@ bfd_configure(struct bfd *bfd, const char *name,
> const struct smap *cfg)
> bfd->min_tx = 1000;
> bfd->mult = 3;
> atomic_init(&bfd->ref_cnt, 1);
> + bfd->netdev = netdev_ref(netdev);
> + bfd->rx_packets = bfd_rx_packets(bfd);
> + bfd->in_decay = false;
> + bfd->decay_detect_time = 0;
>
> /* RFC 5881 section 4
> * The source port MUST be in the range 49152 through 65535. The
> same
> @@ -325,6 +341,24 @@ bfd_configure(struct bfd *bfd, const char *name,
> const struct smap *cfg)
> || (!bfd_in_poll(bfd) && bfd->cfg_min_rx > bfd->min_rx)) {
> bfd->min_rx = bfd->cfg_min_rx;
> }
> + /* Always resets decay_min_rx when cfg_min_rx is updated. */
> + bfd->decay_min_rx = 0;
> + bfd_poll(bfd);
> + }
> +
> + decay_min_rx = smap_get_int(cfg, "decay_min_rx", 0);
> + if (bfd->decay_min_rx != decay_min_rx ) {
> + if (decay_min_rx > 0 && decay_min_rx < bfd->cfg_min_rx) {
> + VLOG_WARN("%s: decay_min_rx cannot be less than %lld ms",
> + bfd->name, bfd->cfg_min_rx);
> + bfd->decay_min_rx = 0;
> + } else {
> + bfd->decay_min_rx = decay_min_rx;
> + }
> + /* Resets current decay. */
> + bfd->in_decay = false;
> + bfd->decay_detect_time = (bfd->decay_min_rx < 2000 ?
> + 2000 : bfd->decay_min_rx) + time_msec();
> bfd_poll(bfd);
> }
>
> @@ -373,6 +407,7 @@ bfd_unref(struct bfd *bfd) OVS_EXCLUDED(mutex)
> if (orig == 1) {
> ovs_mutex_lock(&mutex);
> hmap_remove(all_bfds, &bfd->node);
> + netdev_close(bfd->netdev);
> free(bfd->name);
> free(bfd);
> ovs_mutex_unlock(&mutex);
> @@ -398,12 +433,25 @@ bfd_wait(const struct bfd *bfd) OVS_EXCLUDED(mutex)
> void
> bfd_run(struct bfd *bfd) OVS_EXCLUDED(mutex)
> {
> + long long int now;
> + bool old_in_decay;
> +
> ovs_mutex_lock(&mutex);
> - if (bfd->state > STATE_DOWN && time_msec() >= bfd->detect_time) {
> + now = time_msec();
> + old_in_decay = bfd->in_decay;
> +
> + if (bfd->state > STATE_DOWN && now >= bfd->detect_time) {
> bfd_set_state(bfd, STATE_DOWN, DIAG_EXPIRED);
> }
>
> - if (bfd->min_tx != bfd->cfg_min_tx || bfd->min_rx != bfd->cfg_min_rx)
> {
> + if (bfd->state == STATE_UP && bfd->decay_min_rx > 0
> + && now >= bfd->decay_detect_time) {
> + bfd_try_decay(bfd);
> + }
> +
> + if (bfd->min_tx != bfd->cfg_min_tx
> + || (bfd->min_rx != bfd->cfg_min_rx && bfd->min_rx !=
> bfd->decay_min_rx)
> + || bfd->in_decay != old_in_decay) {
> bfd_poll(bfd);
> }
> ovs_mutex_unlock(&mutex);
> @@ -680,6 +728,20 @@ bfd_process_packet(struct bfd *bfd, const struct flow
> *flow,
> out:
> ovs_mutex_unlock(&mutex);
> }
> +
> +/* Must be called when the netdev owned by 'bfd' should change. */
> +void
> +bfd_set_netdev(struct bfd *bfd, const struct netdev *netdev)
> + OVS_EXCLUDED(mutex)
> +{
> + ovs_mutex_lock(&mutex);
> + if (bfd->netdev != netdev) {
> + netdev_close(bfd->netdev);
> + bfd->netdev = netdev_ref(netdev);
> + }
> + ovs_mutex_unlock(&mutex);
> +}
> +
>
> static bool
> bfd_forwarding__(const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
> @@ -707,7 +769,7 @@ bfd_poll(struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
> if (bfd->state > STATE_DOWN && !bfd_in_poll(bfd)
> && !(bfd->flags & FLAG_FINAL)) {
> bfd->poll_min_tx = bfd->cfg_min_tx;
> - bfd->poll_min_rx = bfd->cfg_min_rx;
> + bfd->poll_min_rx = bfd->in_decay ? bfd->decay_min_rx :
> bfd->cfg_min_rx;
> bfd->flags |= FLAG_POLL;
> bfd->next_tx = 0;
> VLOG_INFO_RL(&rl, "%s: Initiating poll sequence", bfd->name);
> @@ -781,7 +843,8 @@ bfd_flag_str(enum flags flags)
> ds_put_cstr(&ds, "poll ");
> }
>
> - ovs_strlcpy(flag_str, ds_cstr(&ds), sizeof flag_str);
> + /* Do not copy the trailing whitespace. */
> + ovs_strlcpy(flag_str, ds_cstr(&ds), ds.length);
> ds_destroy(&ds);
> return flag_str;
> }
> @@ -882,6 +945,34 @@ bfd_set_state(struct bfd *bfd, enum state state, enum
> diag diag)
> }
> }
>
> +static uint64_t
> +bfd_rx_packets(const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
> +{
> + struct netdev_stats stats;
> +
> + if (!netdev_get_stats(bfd->netdev, &stats)) {
> + return stats.rx_packets;
> + } else {
> + return 0;
> + }
> +}
> +
> +static void
> +bfd_try_decay(struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
> +{
> + uint64_t rx_packets = bfd_rx_packets(bfd);
> + int64_t diff, measure;
> +
> + diff = rx_packets - bfd->rx_packets;
> + measure = (bfd->decay_min_rx < 2000 ? 2000 : bfd->decay_min_rx)
> + / bfd->min_rx + 5;
> + bfd->decay_detect_time = (bfd->decay_min_rx < 2000 ?
> + 2000 : bfd->decay_min_rx) + time_msec();
> + bfd->rx_packets = rx_packets;
> + /* Decays when there is no obvious data traffic. */
> + bfd->in_decay = diff <= measure ? true : false;
> +}
> +
> static uint32_t
> generate_discriminator(void)
> {
> diff --git a/lib/bfd.h b/lib/bfd.h
> index 67d012e..0e1e33d 100644
> --- a/lib/bfd.h
> +++ b/lib/bfd.h
> @@ -24,6 +24,7 @@
> struct bfd;
> struct flow;
> struct flow_wildcards;
> +struct netdev;
> struct ofpbuf;
> struct smap;
>
> @@ -40,11 +41,13 @@ void bfd_process_packet(struct bfd *, const struct
> flow *,
> const struct ofpbuf *);
>
> struct bfd *bfd_configure(struct bfd *, const char *name,
> - const struct smap *smap);
> + const struct smap *smap,
> + struct netdev *netdev);
> struct bfd *bfd_ref(const struct bfd *);
> void bfd_unref(struct bfd *);
>
> bool bfd_forwarding(const struct bfd *);
> void bfd_get_status(const struct bfd *, struct smap *);
> +void bfd_set_netdev(struct bfd *, const struct netdev *);
>
> #endif /* bfd.h */
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index a8e5cd5..75fd96c 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -1862,6 +1862,10 @@ port_modified(struct ofport *port_)
> cfm_set_netdev(port->cfm, port->up.netdev);
> }
>
> + if (port->bfd) {
> + bfd_set_netdev(port->bfd, port->up.netdev);
> + }
> +
> if (port->is_tunnel && tnl_port_reconfigure(port, port->up.netdev,
> port->odp_port)) {
> ofproto_dpif_cast(port->up.ofproto)->backer->need_revalidate =
> @@ -1996,7 +2000,8 @@ set_bfd(struct ofport *ofport_, const struct smap
> *cfg)
> struct bfd *old;
>
> old = ofport->bfd;
> - ofport->bfd = bfd_configure(old, netdev_get_name(ofport->up.netdev),
> cfg);
> + ofport->bfd = bfd_configure(old, netdev_get_name(ofport->up.netdev),
> + cfg, ofport->up.netdev);
> if (ofport->bfd != old) {
> ofproto->backer->need_revalidate = REV_RECONFIGURE;
> }
> diff --git a/tests/bfd.at b/tests/bfd.at
> index c54fff0..0484e87 100644
> --- a/tests/bfd.at
> +++ b/tests/bfd.at
> @@ -20,9 +20,9 @@ AT_CHECK([ovs-appctl bfd/show $1 | sed -e '/Time:/d' |
> sed -e '/Discriminator/d'
> m4_define([BFD_CHECK_TX], [
> AT_CHECK([ovs-appctl bfd/show $1 | sed -n '/TX Interval/p'],[0],
> [dnl
> - TX Interval: Approx 1000ms
> - Local Minimum TX Interval: $2
> - Remote Minimum TX Interval: $3
> + TX Interval: Approx $2
> + Local Minimum TX Interval: $3
> + Remote Minimum TX Interval: $4
> ])
> ])
>
> @@ -30,8 +30,8 @@ m4_define([BFD_CHECK_RX], [
> AT_CHECK([ovs-appctl bfd/show $1 | sed -n '/RX Interval/p'],[0],
> [dnl
> RX Interval: Approx $2
> - Local Minimum RX Interval: $2
> - Remote Minimum RX Interval: $3
> + Local Minimum RX Interval: $3
> + Remote Minimum RX Interval: $4
> ])
> ])
> AT_SETUP([bfd - basic config on different bridges])
> @@ -202,14 +202,207 @@ BFD_CHECK([p0], [true], [false], [none], [up], [No
> Diagnostic], [none], [up], [N
> #Edit the min Tx value.
> AT_CHECK([ovs-vsctl set interface p0 bfd:min_tx=200])
> for i in `seq 0 20`; do ovs-appctl time/warp 100; done
> -BFD_CHECK_TX([p0], [200ms], [100ms])
> -BFD_CHECK_TX([p1], [100ms], [200ms])
> +BFD_CHECK_TX([p0], [1000ms], [200ms], [100ms])
> +BFD_CHECK_TX([p1], [1000ms], [100ms], [200ms])
>
> #Edit the min Rx value.
> AT_CHECK([ovs-vsctl set interface p1 bfd:min_rx=300])
> for i in `seq 0 20`; do ovs-appctl time/warp 100; done
> -BFD_CHECK_RX([p1], [300ms], [1000ms])
> -BFD_CHECK_RX([p0], [1000ms], [300ms])
> +BFD_CHECK_RX([p1], [300ms], [300ms], [1000ms])
> +BFD_CHECK_RX([p0], [1000ms], [1000ms], [300ms])
>
> OVS_VSWITCHD_STOP
> AT_CLEANUP
> +
> +# Tests below are for bfd decay features.
> +AT_SETUP([bfd - bfd decay])
> +OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
> + add-port br1 p1 -- set Interface p1 type=patch \
> + options:peer=p0 ofport_request=2 -- \
> + add-port br0 p0 -- set Interface p0 type=patch \
> + options:peer=p1 ofport_request=1 -- \
> + set Interface p0 bfd:enable=true bfd:min_tx=300
> bfd:min_rx=300 bfd:decay_min_rx=3000 -- \
> + set Interface p1 bfd:enable=true bfd:min_tx=500
> bfd:min_rx=500 -- \
> + add-port br1 p2 -- set Interface p2 type=internal
> ofport_request=3])
> +
> +ovs-appctl time/stop
> +
> +
> +# Test-1 BFD decay: decay to decay_min_rx
> +# bfd:decay_min_rx is set to 3000ms after the first 2500ms,
> +# the bfd should be up.
> +for i in `seq 0 4`; do ovs-appctl time/warp 500; done
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +
> +# advance the clock by 500ms.
> +ovs-appctl time/warp 500
> +# now at 3000ms, min_rx should decay to 3000ms and there should be
> +# poll sequence flags.
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
> +
> +# since the tx_min of p0 is still 500ms, after 500ms from decay,
> +# the control message will be sent from p0 to p1, and p1 'flag'
> +# will go back to none.
> +ovs-appctl time/warp 500
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> +
> +# the rx_min of p0 is 3000ms now, and p1 will send next control message
> +# 3000ms after decay. so, advance clock by 2500ms to make that happen.
> +for i in `seq 0 4`; do ovs-appctl time/warp 500; done
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
> +
> +
> +# Test-2 BFD decay: go back to cfg_min_rx when there is traffic
> +# receive packet at 1/100ms rate for 3000ms.
> +for i in `seq 0 30`
> +do
> + ovs-appctl time/warp 100
> + AT_CHECK([ovs-ofctl packet-out br1 3 2
> "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
> + [0], [stdout], [])
> +done
> +# after a decay interval (3000ms), the p0 min_rx will go back to
> +# cfg_min_rx. there should be poll sequence flags.
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +
> +# 500ms later, both direction will send control messages,
> +# and their 'flag' will go back to none.
> +ovs-appctl time/warp 500
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +
> +
> +# Test-3 BFD decay: go back to cfg_min_rx when decay_min_rx is
> +# changed. advance the clock by 2500ms to 3000m after restore of
> +# min_rx. p0 is decayed, and there should be the poll sequence flags.
> +for i in `seq 0 4`; do ovs-appctl time/warp 500; done
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
> +
> +# advance the clock, to make 'flag' go back to none.
> +for i in `seq 0 5`; do ovs-appctl time/warp 500; done
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> +
> +# change decay_min_rx to 1000ms.
> +# for decay_min_rx < 2000ms, the decay detection time is set to 2000ms.
> +# this should firstly reset the min_rx and start poll sequence.
> +AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=1000])
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +
> +# for the following 1500ms, there should be no decay,
> +# since the decay_detect_time is set to 2000ms.
> +for i in `seq 0 2`
> +do
> + ovs-appctl time/warp 500
> + BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> + BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> + BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> + BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +done
> +
> +ovs-appctl time/warp 500
> +# at 2000ms, decay should happen and there should be the poll sequence
> flags.
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
> +# advance the clock, so 'flag' go back to none.
> +for i in `seq 0 4`; do ovs-appctl time/warp 500; done
> +
> +
> +# Test-4 BFD decay: set min_rx to 800ms.
> +# this should firstly reset the min_rx and then re-decay to 1000ms.
> +AT_CHECK([ovs-vsctl set Interface p0 bfd:min_rx=800])
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [800ms], [800ms], [500ms])
> +
> +# for the following 1600ms, there should be no decay,
> +# since the decay detection time is set to 2000ms.
> +for i in `seq 0 1`
> +do
> + ovs-appctl time/warp 800
> + ovs-appctl bfd/show
> + BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> + BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> + BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> + BFD_CHECK_RX([p0], [800ms], [800ms], [500ms])
> +done
> +
> +ovs-appctl time/warp 400
> +# at 2000ms, decay should happen and there should be the poll sequence
> flags.
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
> +# advance the clock, so 'flag' go back to none.
> +for i in `seq 0 4`; do ovs-appctl time/warp 500; done
> +
> +
> +# Test-5 BFD decay: set min_rx to 300ms and decay_min_rx to 5000ms
> together.
> +AT_CHECK([ovs-vsctl set Interface p0 bfd:min_rx=300
> bfd:decay_min_rx=5000])
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +
> +# for decay_min_rx > 2000ms, the decay detection time is set to
> +# decay_min_rx (5000ms).
> +# for the following 4500ms, there should be no decay,
> +# since the decay detection time is set to 5000ms.
> +for i in `seq 0 8`
> +do
> + ovs-appctl time/warp 500
> + BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> + BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> + BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> + BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +done
> +
> +ovs-appctl time/warp 500
> +# at 5000ms, decay should happen and there should be the poll sequence
> flags.
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [5000ms], [5000ms], [500ms])
> +# advance the clock, to make 'flag' go back to none.
> +for i in `seq 0 9`; do ovs-appctl time/warp 500; done
> +
> +
> +# Test-6 BFD decay: set decay_min_rx to 0 to disable bfd decay.
> +AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=0])
> +# min_rx is reset, and there should be the poll sequence flags.
> +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [final],
> [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +for i in `seq 0 20`
> +do
> + ovs-appctl time/warp 500
> + BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> + BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> + BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> + BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +done
> +
> +AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
> +AT_CLEANUP
> +
> diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
> index b89d58c..b73a612 100644
> --- a/vswitchd/vswitch.xml
> +++ b/vswitchd/vswitch.xml
> @@ -1880,6 +1880,16 @@
> specified. Defaults to <code>100</code>.
> </column>
>
> + <column name="bfd" key="decay_min_rx" type='{"type": "integer"}'>
> + <code>decay_min_rx</code> is used to set the
> <code>min_rx</code>,
> + when there is no obvious incoming data traffic at the interface.
> + It cannot be less than the <code>min_rx</code>. The decay
> feature
> + is disable by setting the <code>decay_min_rx</code> to 0. And
> the
> + feature is reset everytime itself or <code>min_rx</code> is
> + reconfigured.
> + </column>
> +
> +
> <column name="bfd" key="cpath_down" type='{"type": "boolean"}'>
> Concatenated path down may be used when the local system should
> not
> have traffic forwarded to it for some reason other than a
> connectivty
> --
> 1.7.9.5
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20130812/2a9ac025/attachment-0003.html>
More information about the dev
mailing list