Skip to content

Commit

Permalink
bfdd: echo-mode doesn't need poll to start/stop
Browse files Browse the repository at this point in the history
Remove all polling negotiation when starting/stopping `echo-mode` as it
is not necessary.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
  • Loading branch information
rzalamena committed Feb 14, 2019
1 parent c0ef9a8 commit 8bd859f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
20 changes: 4 additions & 16 deletions bfdd/bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,33 +137,21 @@ void ptm_bfd_xmt_TO(struct bfd_session *bfd, int fbit)
ptm_bfd_start_xmt_timer(bfd, false);
}

void ptm_bfd_echo_stop(struct bfd_session *bfd, int polling)
void ptm_bfd_echo_stop(struct bfd_session *bfd)
{
bfd->echo_xmt_TO = 0;
bfd->echo_detect_TO = 0;
BFD_UNSET_FLAG(bfd->flags, BFD_SESS_FLAG_ECHO_ACTIVE);

bfd_echo_xmttimer_delete(bfd);
bfd_echo_recvtimer_delete(bfd);

if (polling) {
bfd->polling = polling;
bfd->new_timers.desired_min_tx = bfd->up_min_tx;
bfd->new_timers.required_min_rx = bfd->timers.required_min_rx;
ptm_bfd_snd(bfd, 0);
}
}

void ptm_bfd_echo_start(struct bfd_session *bfd)
{
bfd->echo_detect_TO = (bfd->remote_detect_mult * bfd->echo_xmt_TO);
if (bfd->echo_detect_TO > 0)
ptm_bfd_echo_xmt_TO(bfd);

bfd->polling = 1;
bfd->new_timers.desired_min_tx = bfd->up_min_tx;
bfd->new_timers.required_min_rx = bfd->timers.required_min_rx;
ptm_bfd_snd(bfd, 0);
}

void ptm_bfd_ses_up(struct bfd_session *bfd)
Expand Down Expand Up @@ -209,7 +197,7 @@ void ptm_bfd_ses_dn(struct bfd_session *bfd, uint8_t diag)

/* Stop echo packet transmission if they are active */
if (BFD_CHECK_FLAG(bfd->flags, BFD_SESS_FLAG_ECHO_ACTIVE))
ptm_bfd_echo_stop(bfd, 0);
ptm_bfd_echo_stop(bfd);

if (old_state != bfd->ses_state) {
bfd->stats.session_down++;
Expand Down Expand Up @@ -440,7 +428,7 @@ static void _bfd_session_update(struct bfd_session *bs,
goto skip_echo;

BFD_UNSET_FLAG(bs->flags, BFD_SESS_FLAG_ECHO);
ptm_bfd_echo_stop(bs, 0);
ptm_bfd_echo_stop(bs);
}

skip_echo:
Expand Down Expand Up @@ -845,7 +833,7 @@ void bs_echo_timer_handler(struct bfd_session *bs)
/* Remote peer asked to stop echo. */
if (bs->remote_timers.required_min_echo == 0) {
if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO_ACTIVE))
ptm_bfd_echo_stop(bs, 0);
ptm_bfd_echo_stop(bs);

return;
}
Expand Down
2 changes: 1 addition & 1 deletion bfdd/bfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ struct bfd_session *ptm_bfd_sess_new(struct bfd_peer_cfg *bpc);
int ptm_bfd_ses_del(struct bfd_peer_cfg *bpc);
void ptm_bfd_ses_dn(struct bfd_session *bfd, uint8_t diag);
void ptm_bfd_ses_up(struct bfd_session *bfd);
void ptm_bfd_echo_stop(struct bfd_session *bfd, int polling);
void ptm_bfd_echo_stop(struct bfd_session *bfd);
void ptm_bfd_echo_start(struct bfd_session *bfd);
void ptm_bfd_xmt_TO(struct bfd_session *bfd, int fbit);
void ptm_bfd_start_xmt_timer(struct bfd_session *bfd, bool is_echo);
Expand Down
2 changes: 1 addition & 1 deletion bfdd/bfdd_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ DEFPY(bfd_peer_echo, bfd_peer_echo_cmd, "[no] echo-mode",
return CMD_SUCCESS;

BFD_UNSET_FLAG(bs->flags, BFD_SESS_FLAG_ECHO);
ptm_bfd_echo_stop(bs, 0);
ptm_bfd_echo_stop(bs);
} else {
if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO))
return CMD_SUCCESS;
Expand Down

0 comments on commit 8bd859f

Please sign in to comment.