From 002723c45b042a270e0ab521b4b88da3d2d7ef55 Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Tue, 22 Oct 2019 21:27:22 -0700 Subject: lacp: add actor steady state check prior to skip processing lacp pdu In a rare event, we may be skipping processing lacp pdu's when the it is not in steady state. Type: fix Signed-off-by: Steven Luong Change-Id: I3595d22dbff8a97dce9fb4d4452d2051bcf6f523 --- src/vnet/bonding/cli.c | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'src/vnet/bonding/cli.c') diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c index 9687e8841fe..ba481756086 100644 --- a/src/vnet/bonding/cli.c +++ b/src/vnet/bonding/cli.c @@ -43,7 +43,6 @@ bond_disable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif) /* deleting the active slave for active-backup */ switching_active = 1; vec_del1 (bif->active_slaves, i); - hash_unset (bif->active_slave_by_sw_if_index, sif->sw_if_index); if (sif->lacp_enabled && bif->numa_only) { /* For lacp mode, if we check it is a slave on local numa node, @@ -142,35 +141,39 @@ bond_enable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif) bond_main_t *bm = &bond_main; vnet_main_t *vnm = vnet_get_main (); vnet_hw_interface_t *hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index); + int i; + uword p; bif = bond_get_master_by_dev_instance (sif->bif_dev_instance); clib_spinlock_lock_if_init (&bif->lockp); - if (!hash_get (bif->active_slave_by_sw_if_index, sif->sw_if_index)) + vec_foreach_index (i, bif->active_slaves) + { + p = *vec_elt_at_index (bif->active_slaves, i); + if (p == sif->sw_if_index) + goto done; + } + + if (sif->lacp_enabled && bif->numa_only && (vm->numa_node == hw->numa_node)) { - hash_set (bif->active_slave_by_sw_if_index, sif->sw_if_index, - sif->sw_if_index); + vec_insert_elts (bif->active_slaves, &sif->sw_if_index, 1, + bif->n_numa_slaves); + bif->n_numa_slaves++; + } + else + vec_add1 (bif->active_slaves, sif->sw_if_index); - if ((sif->lacp_enabled && bif->numa_only) - && (vm->numa_node == hw->numa_node)) - { - vec_insert_elts (bif->active_slaves, &sif->sw_if_index, 1, - bif->n_numa_slaves); - bif->n_numa_slaves++; - } + sif->is_local_numa = (vm->numa_node == hw->numa_node) ? 1 : 0; + if (bif->mode == BOND_MODE_ACTIVE_BACKUP) + { + if (vec_len (bif->active_slaves) == 1) + /* First slave becomes active? */ + vlib_process_signal_event (bm->vlib_main, bond_process_node.index, + BOND_SEND_GARP_NA, bif->hw_if_index); else - vec_add1 (bif->active_slaves, sif->sw_if_index); - - sif->is_local_numa = (vm->numa_node == hw->numa_node) ? 1 : 0; - if (bif->mode == BOND_MODE_ACTIVE_BACKUP) - { - if (vec_len (bif->active_slaves) == 1) - /* First slave becomes active? */ - vlib_process_signal_event (bm->vlib_main, bond_process_node.index, - BOND_SEND_GARP_NA, bif->hw_if_index); - else - bond_sort_slaves (bif); - } + bond_sort_slaves (bif); } + +done: clib_spinlock_unlock_if_init (&bif->lockp); if (bif->mode == BOND_MODE_LACP) -- cgit 1.2.3-korg