Skip to content

Commit

Permalink
pinctrl: fix restart of controller when bfd min_tx is too low.
Browse files Browse the repository at this point in the history
Avoid the number zero to be divisor.

Signed-off-by: wangchuanlei <wangchuanlei@inspur.com>
Acked-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
  • Loading branch information
wangchuanlei authored and putnopvut committed May 2, 2023
1 parent 89b7fe1 commit fc98cc1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion controller/pinctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -6999,7 +6999,9 @@ bfd_monitor_send_msg(struct rconn *swconn, long long int *bfd_time)
pinctrl_send_bfd_tx_msg(swconn, entry, false);

tx_timeout = MAX(entry->local_min_tx, entry->remote_min_rx);
tx_timeout -= random_range((tx_timeout * 25) / 100);
if (tx_timeout >= 4) {
tx_timeout -= random_range(tx_timeout / 4);
}
entry->next_tx = cur_time + tx_timeout;
next:
if (*bfd_time > entry->next_tx) {
Expand Down

0 comments on commit fc98cc1

Please sign in to comment.