Skip to content

Commit

Permalink
DPDK: Fix for vhost0 MTU not getting set
Browse files Browse the repository at this point in the history
After an agent soft reset, vif 0 gets deleted and added back. But due to
a timing issue, before it gets added back, the vhost0 MTU notification
used to come resulting in MTU not getting set (Since vif is not added
yet). Fix is to query the MTU from PMD during vif 0 addition.

Change-Id: I262f2e62cbd390b3c8bae2bdc777fc1ac4249886
Closes-Bug: 1795839
  • Loading branch information
kirankn80 committed Dec 18, 2018
1 parent a98c055 commit 7504900
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dpdk/vr_dpdk_interface.c
Expand Up @@ -735,6 +735,7 @@ dpdk_fabric_if_add(struct vr_interface *vif)
{
int ret;
uint16_t port_id, ports_num;
uint16_t mtu;
struct rte_pci_addr pci_address;
struct vr_dpdk_ethdev *ethdev;
struct ether_addr mac_addr;
Expand Down Expand Up @@ -792,6 +793,18 @@ dpdk_fabric_if_add(struct vr_interface *vif)
MAC_VALUE(mac_addr.addr_bytes), MAC_VALUE(vif->vif_mac));
}

if (rte_eth_dev_get_mtu(port_id, &mtu) == 0 && mtu > 0) {
/* Ethernet header size */
mtu += sizeof(struct vr_eth);
if (vr_dpdk.vlan_tag != VLAN_ID_INVALID) {
/* 802.1q header size */
mtu += sizeof(uint32_t);
}
vif->vif_mtu = mtu;
if (vif->vif_bridge)
vif->vif_bridge->vif_mtu = mtu;
}

ethdev = &vr_dpdk.ethdevs[port_id];
if (ethdev->ethdev_ptr != NULL) {
RTE_LOG(ERR, VROUTER, " error adding eth dev %s: already added\n",
Expand Down

0 comments on commit 7504900

Please sign in to comment.