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: I2b102b82e21fcc137e62db748d8982bdbbdf87e2
Closes-Bug: 1795839
(cherry picked from commit 514d42f)
  • Loading branch information
kirankn80 committed Feb 8, 2019
1 parent f7d9371 commit 1d38cf7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dpdk/vr_dpdk_interface.c
Expand Up @@ -568,6 +568,7 @@ dpdk_fabric_if_add(struct vr_interface *vif)
{
int ret;
uint8_t port_id;
uint16_t mtu;
struct rte_pci_addr pci_address;
struct vr_dpdk_ethdev *ethdev;
struct ether_addr mac_addr;
Expand Down Expand Up @@ -620,6 +621,17 @@ 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 1d38cf7

Please sign in to comment.