vnet: distinguish between max_frame_size and MTU
Type: improvement
Change-Id: I3659de6599f402c92e3855e3bf0e5e3388f2bea0
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index cf4f91e..2085379 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -57,13 +57,15 @@
typedef struct tpacket_req tpacket_req_t;
static clib_error_t *
-af_packet_eth_set_mtu (vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 mtu)
+af_packet_eth_set_max_frame_size (vnet_main_t *vnm, vnet_hw_interface_t *hi,
+ u32 frame_size)
{
clib_error_t *error, *rv;
af_packet_main_t *apm = &af_packet_main;
af_packet_if_t *apif = pool_elt_at_index (apm->interfaces, hi->dev_instance);
- error = vnet_netlink_set_link_mtu (apif->host_if_index, mtu);
+ error = vnet_netlink_set_link_mtu (apif->host_if_index,
+ frame_size + hi->frame_overhead);
if (error)
{
@@ -75,7 +77,7 @@
return rv;
}
else
- apif->host_mtu = mtu;
+ apif->host_mtu = frame_size + hi->frame_overhead;
return 0;
}
@@ -398,7 +400,7 @@
eir.dev_class_index = af_packet_device_class.index;
eir.dev_instance = if_index;
eir.address = hw_addr;
- eir.cb.set_mtu = af_packet_eth_set_mtu;
+ eir.cb.set_max_frame_size = af_packet_eth_set_max_frame_size;
apif->hw_if_index = vnet_eth_register_interface (vnm, &eir);
}
else