aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/bonding/device.c
diff options
context:
space:
mode:
authorSteven <sluong@cisco.com>2018-04-12 19:36:19 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2018-04-13 08:49:08 +0000
commit4f8863b21405d1ab3e067e978a60be72a343358b (patch)
tree85ff0693b4093c6774f4448f020f130ea472df8c /src/vnet/bonding/device.c
parent95c87b5ae5db74385f56ba5dd08718c65a1edf69 (diff)
bond: ping fails between l2 BD [VPP-1238]
In dpdk based bonding, when the bond interface is configured for l2, it automatically sets the bond interface to promiscuous mode and sets rx redirect to ethernet-input. This allows traffic to be bridged to non compute node facing interface when it is received from the compute node interface. For native vpp bonding, we need to do similar things. When the bond interface is configured for l2, we set the slave interfaces to promiscuous mode and set rx redirect to ethernet-input because dpdk does not know anything about the bond interface. Likewise, when a new interface is enslaved, we also need to do the same thing if the bond interface has already been configured for l2. Change-Id: I7e168008e8a4221be74929b2a20e6db0ce8f3110 Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'src/vnet/bonding/device.c')
-rw-r--r--src/vnet/bonding/device.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/vnet/bonding/device.c b/src/vnet/bonding/device.c
index e3c454bbc72..a27524089aa 100644
--- a/src/vnet/bonding/device.c
+++ b/src/vnet/bonding/device.c
@@ -74,6 +74,48 @@ format_bond_interface_name (u8 * s, va_list * args)
}
static __clib_unused clib_error_t *
+bond_set_l2_mode_function (vnet_main_t * vnm,
+ struct vnet_hw_interface_t *bif_hw,
+ i32 l2_if_adjust)
+{
+ bond_if_t *bif;
+ u32 *sw_if_index;
+ struct vnet_hw_interface_t *sif_hw;
+
+ bif = bond_get_master_by_sw_if_index (bif_hw->sw_if_index);
+ if (!bif)
+ return 0;
+
+ if ((bif_hw->l2_if_count == 1) && (l2_if_adjust == 1))
+ {
+ /* Just added first L2 interface on this port */
+ vec_foreach (sw_if_index, bif->slaves)
+ {
+ sif_hw = vnet_get_sup_hw_interface (vnm, *sw_if_index);
+ ethernet_set_flags (vnm, sif_hw->hw_if_index,
+ ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
+
+ /* ensure all packets go to ethernet-input */
+ ethernet_set_rx_redirect (vnm, sif_hw, 1);
+ }
+ }
+ else if ((bif_hw->l2_if_count == 0) && (l2_if_adjust == -1))
+ {
+ /* Just removed last L2 subinterface on this port */
+ vec_foreach (sw_if_index, bif->slaves)
+ {
+ sif_hw = vnet_get_sup_hw_interface (vnm, *sw_if_index);
+ ethernet_set_flags (vnm, sif_hw->hw_if_index, 0);
+
+ /* Allow ip packets to go directly to ip4-input etc */
+ ethernet_set_rx_redirect (vnm, sif_hw, 0);
+ }
+ }
+
+ return 0;
+}
+
+static __clib_unused clib_error_t *
bond_subif_add_del_function (vnet_main_t * vnm, u32 hw_if_index,
struct vnet_sw_interface_t *st, int is_add)
{
@@ -640,6 +682,7 @@ VNET_DEVICE_CLASS (bond_dev_class) = {
.tx_function_n_errors = BOND_TX_N_ERROR,
.tx_function_error_strings = bond_tx_error_strings,
.format_device_name = format_bond_interface_name,
+ .set_l2_mode_function = bond_set_l2_mode_function,
.admin_up_down_function = bond_interface_admin_up_down,
.subif_add_del_function = bond_subif_add_del_function,
.format_tx_trace = format_bond_tx_trace,