diff options
author | Damjan Marion <damarion@cisco.com> | 2022-01-17 14:49:17 +0100 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2022-01-18 13:20:21 +0000 |
commit | 1cd0e5dd533f4209dde453eaa43215e52cd42985 (patch) | |
tree | 88ed4b47252cfe27c13ac0f85a6cfc86a7052d5b /src/vnet/devices | |
parent | 49378f206b8e780a898e632f7dd8db912b9b118e (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')
-rw-r--r-- | src/vnet/devices/af_packet/af_packet.c | 10 | ||||
-rw-r--r-- | src/vnet/devices/tap/tap.c | 10 |
2 files changed, 10 insertions, 10 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 diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index 2e7ad39f3b4..f5ed30ad7b0 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -683,12 +683,10 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) } if (vif->type == VIRTIO_IF_TYPE_TUN) { - hw->max_supported_packet_bytes = TUN_MAX_PACKET_BYTES; - hw->min_packet_bytes = hw->min_supported_packet_bytes = - TUN_MIN_PACKET_BYTES; - hw->max_packet_bytes = - args->host_mtu_size ? args->host_mtu_size : TUN_DEFAULT_PACKET_BYTES; - vnet_sw_interface_set_mtu (vnm, hw->sw_if_index, hw->max_packet_bytes); + hw->min_frame_size = TUN_MIN_PACKET_BYTES; + vnet_hw_interface_set_mtu ( + vnm, hw->sw_if_index, + args->host_mtu_size ? args->host_mtu_size : TUN_DEFAULT_PACKET_BYTES); } vnet_hw_if_change_caps (vnm, vif->hw_if_index, &cc); |