Skip to content

Commit

Permalink
Merge "Set MAC address of slave interface explicitly if it is a SR-IO…
Browse files Browse the repository at this point in the history
…V VF." into R3.0
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed May 25, 2016
2 parents f9a5357 + 306b142 commit 0891b19
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions dpdk/vr_dpdk_interface.c
Expand Up @@ -163,7 +163,7 @@ dpdk_find_pci_addr_by_port(struct rte_pci_addr *addr, uint8_t port_id)
}

static inline void
dpdk_set_hw_vlan_filter_strip(uint32_t port_id, struct vr_interface *vif)
dpdk_set_addr_vlan_filter_strip(uint32_t port_id, struct vr_interface *vif)
{
uint32_t i, ret;
uint8_t *port_id_ptr;
Expand All @@ -178,6 +178,25 @@ dpdk_set_hw_vlan_filter_strip(uint32_t port_id, struct vr_interface *vif)
* TODO: vf_lcore_id check for SR-IOV VF should be a per-interface
* check to handle the case where a bond has a VF and a PF in it.
*/

/*
* Set the MAC address of slave interfaces. Doing it from the bond driver in
* DPDK doesn't seem to work on SR-IOV VFs.
*/
if ((ethdev->ethdev_nb_slaves != -1) && vr_dpdk.vf_lcore_id) {
ret = rte_eth_dev_default_mac_addr_set(*port_id_ptr,
(struct ether_addr *)vif->vif_mac);
if (ret == 0) {
RTE_LOG(INFO, VROUTER, "Bond slave port %d now uses vif MAC "
MAC_FORMAT "\n",
*port_id_ptr, MAC_VALUE(vif->vif_mac));
} else {
RTE_LOG(ERR, VROUTER, "Error setting vif MAC to bond slave port %d: "
"%s (%d)\n",
*port_id_ptr, rte_strerror(-ret), -ret);
}
}

if ((vr_dpdk.vlan_tag != VLAN_ID_INVALID) && vr_dpdk.vf_lcore_id) {
ret = rte_eth_dev_set_vlan_offload(*port_id_ptr, ETH_VLAN_FILTER_OFFLOAD);
if (ret) {
Expand Down Expand Up @@ -465,7 +484,7 @@ dpdk_fabric_if_add(struct vr_interface *vif)
#endif

/* Set hardware VLAN stripping */
dpdk_set_hw_vlan_filter_strip(port_id, vif);
dpdk_set_addr_vlan_filter_strip(port_id, vif);

/* schedule RX/TX queues */
return vr_dpdk_lcore_if_schedule(vif, vr_dpdk_lcore_least_used_get(),
Expand Down

0 comments on commit 0891b19

Please sign in to comment.