Update MAC address kept for Bonded Interface and its Slaves

Change-Id: I9f7f9f840c3c1aad5e8c9a4fa1ba7a58a85cfd9e
Signed-off-by: John Lo <loj@cisco.com>
This commit is contained in:
John Lo
2017-03-22 13:27:27 -04:00
parent ed6b52bc5c
commit 24d01367c8

View File

@ -1888,24 +1888,24 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
int rv; int rv;
/* Get MAC of 1st slave link */ /* Get MAC of 1st slave link */
rte_eth_macaddr_get (slink[0], rte_eth_macaddr_get
(struct ether_addr *) addr); (slink[0], (struct ether_addr *) addr);
/* Set MAC of bounded interface to that of 1st slave link */ /* Set MAC of bounded interface to that of 1st slave link */
rv = clib_warning ("Set MAC for bond dev# %d", i);
rte_eth_bond_mac_address_set (i, rv = rte_eth_bond_mac_address_set
(struct ether_addr *) (i, (struct ether_addr *) addr);
addr); if (rv)
if (rv < 0) clib_warning ("Set MAC addr failure rv=%d", rv);
clib_warning ("Failed to set MAC address");
/* Populate MAC of bonded interface in VPP hw tables */ /* Populate MAC of bonded interface in VPP hw tables */
bhi = bhi = vnet_get_hw_interface
vnet_get_hw_interface (vnm, (vnm, dm->devices[i].vlib_hw_if_index);
dm->devices[i].vlib_hw_if_index); bei = pool_elt_at_index
bei = (em->interfaces, bhi->hw_instance);
pool_elt_at_index (em->interfaces, bhi->hw_instance);
clib_memcpy (bhi->hw_address, addr, 6); clib_memcpy (bhi->hw_address, addr, 6);
clib_memcpy (bei->address, addr, 6); clib_memcpy (bei->address, addr, 6);
/* Init l3 packet size allowed on bonded interface */ /* Init l3 packet size allowed on bonded interface */
bhi->max_packet_bytes = ETHERNET_MAX_PACKET_BYTES; bhi->max_packet_bytes = ETHERNET_MAX_PACKET_BYTES;
bhi->max_l3_packet_bytes[VLIB_RX] = bhi->max_l3_packet_bytes[VLIB_RX] =
@ -1917,22 +1917,31 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
dpdk_device_t *sdev = &dm->devices[slave]; dpdk_device_t *sdev = &dm->devices[slave];
vnet_hw_interface_t *shi; vnet_hw_interface_t *shi;
vnet_sw_interface_t *ssi; vnet_sw_interface_t *ssi;
ethernet_interface_t *sei;
/* Add MAC to all slave links except the first one */ /* Add MAC to all slave links except the first one */
if (nlink) if (nlink)
rte_eth_dev_mac_addr_add (slave, {
(struct ether_addr *) clib_warning ("Add MAC for slave dev# %d", slave);
addr, 0); rv = rte_eth_dev_mac_addr_add
(slave, (struct ether_addr *) addr, 0);
if (rv)
clib_warning ("Add MAC addr failure rv=%d", rv);
}
/* Set slaves bitmap for bonded interface */ /* Set slaves bitmap for bonded interface */
bhi->bond_info = bhi->bond_info = clib_bitmap_set
clib_bitmap_set (bhi->bond_info, (bhi->bond_info, sdev->vlib_hw_if_index, 1);
sdev->vlib_hw_if_index, 1);
/* Set slave link flags on slave interface */ /* Set slave link flags on slave interface */
shi = shi = vnet_get_hw_interface
vnet_get_hw_interface (vnm, sdev->vlib_hw_if_index); (vnm, sdev->vlib_hw_if_index);
ssi = ssi = vnet_get_sw_interface
vnet_get_sw_interface (vnm, sdev->vlib_sw_if_index); (vnm, sdev->vlib_sw_if_index);
sei = pool_elt_at_index
(em->interfaces, shi->hw_instance);
shi->bond_info = VNET_HW_INTERFACE_BOND_INFO_SLAVE; shi->bond_info = VNET_HW_INTERFACE_BOND_INFO_SLAVE;
ssi->flags |= VNET_SW_INTERFACE_FLAG_BOND_SLAVE; ssi->flags |= VNET_SW_INTERFACE_FLAG_BOND_SLAVE;
clib_memcpy (shi->hw_address, addr, 6);
clib_memcpy (sei->address, addr, 6);
/* Set l3 packet size allowed as the lowest of slave */ /* Set l3 packet size allowed as the lowest of slave */
if (bhi->max_l3_packet_bytes[VLIB_RX] > if (bhi->max_l3_packet_bytes[VLIB_RX] >