summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/af_packet
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-01-17 14:49:17 +0100
committerOle Tr�an <otroan@employees.org>2022-01-18 13:20:21 +0000
commit1cd0e5dd533f4209dde453eaa43215e52cd42985 (patch)
tree88ed4b47252cfe27c13ac0f85a6cfc86a7052d5b /src/vnet/devices/af_packet
parent49378f206b8e780a898e632f7dd8db912b9b118e (diff)
vnet: distinguish between max_frame_size and MTU
Type: improvement Change-Id: I3659de6599f402c92e3855e3bf0e5e3388f2bea0 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices/af_packet')
-rw-r--r--src/vnet/devices/af_packet/af_packet.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index cf4f91e2fcd..208537996e3 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -57,13 +57,15 @@ unsigned int if_nametoindex (const char *ifname);
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 @@ af_packet_eth_set_mtu (vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 mtu)
return rv;
}
else
- apif->host_mtu = mtu;
+ apif->host_mtu = frame_size + hi->frame_overhead;
return 0;
}
@@ -398,7 +400,7 @@ af_packet_create_if (af_packet_create_if_arg_t *arg)
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