diff options
Diffstat (limited to 'src/vnet/devices/virtio/device.c')
-rw-r--r-- | src/vnet/devices/virtio/device.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c index ec5cdbd7bdd..112f77e7065 100644 --- a/src/vnet/devices/virtio/device.c +++ b/src/vnet/devices/virtio/device.c @@ -309,12 +309,12 @@ set_checksum_offsets (vlib_buffer_t *b, vnet_virtio_net_hdr_v1_t *hdr, const int is_l2) { vnet_buffer_oflags_t oflags = vnet_buffer (b)->oflags; - + i16 l4_hdr_offset = vnet_buffer (b)->l4_hdr_offset - b->current_data; if (b->flags & VNET_BUFFER_F_IS_IP4) { ip4_header_t *ip4; hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; - hdr->csum_start = vnet_buffer (b)->l4_hdr_offset; // 0x22; + hdr->csum_start = l4_hdr_offset; // 0x22; /* * virtio devices do not support IP4 checksum offload. So driver takes @@ -347,7 +347,7 @@ set_checksum_offsets (vlib_buffer_t *b, vnet_virtio_net_hdr_v1_t *hdr, { ip6_header_t *ip6; hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; - hdr->csum_start = vnet_buffer (b)->l4_hdr_offset; // 0x36; + hdr->csum_start = l4_hdr_offset; // 0x36; ip6 = (ip6_header_t *) (b->data + vnet_buffer (b)->l3_hdr_offset); /* @@ -376,17 +376,16 @@ set_gso_offsets (vlib_buffer_t *b, vnet_virtio_net_hdr_v1_t *hdr, const int is_l2) { vnet_buffer_oflags_t oflags = vnet_buffer (b)->oflags; + i16 l4_hdr_offset = vnet_buffer (b)->l4_hdr_offset - b->current_data; if (b->flags & VNET_BUFFER_F_IS_IP4) { ip4_header_t *ip4; hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; hdr->gso_size = vnet_buffer2 (b)->gso_size; - hdr->hdr_len = vnet_buffer (b)->l4_hdr_offset - - vnet_buffer (b)->l2_hdr_offset + - vnet_buffer2 (b)->gso_l4_hdr_sz; + hdr->hdr_len = l4_hdr_offset + vnet_buffer2 (b)->gso_l4_hdr_sz; hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; - hdr->csum_start = vnet_buffer (b)->l4_hdr_offset; // 0x22; + hdr->csum_start = l4_hdr_offset; // 0x22; hdr->csum_offset = STRUCT_OFFSET_OF (tcp_header_t, checksum); ip4 = (ip4_header_t *) (b->data + vnet_buffer (b)->l3_hdr_offset); /* @@ -400,11 +399,9 @@ set_gso_offsets (vlib_buffer_t *b, vnet_virtio_net_hdr_v1_t *hdr, { hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; hdr->gso_size = vnet_buffer2 (b)->gso_size; - hdr->hdr_len = vnet_buffer (b)->l4_hdr_offset - - vnet_buffer (b)->l2_hdr_offset + - vnet_buffer2 (b)->gso_l4_hdr_sz; + hdr->hdr_len = l4_hdr_offset + vnet_buffer2 (b)->gso_l4_hdr_sz; hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; - hdr->csum_start = vnet_buffer (b)->l4_hdr_offset; // 0x36; + hdr->csum_start = l4_hdr_offset; // 0x36; hdr->csum_offset = STRUCT_OFFSET_OF (tcp_header_t, checksum); } } @@ -1205,16 +1202,6 @@ virtio_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags) return 0; } -static clib_error_t * -virtio_subif_add_del_function (vnet_main_t * vnm, - u32 hw_if_index, - struct vnet_sw_interface_t *st, int is_add) -{ - /* Nothing for now */ - return 0; -} - -/* *INDENT-OFF* */ VNET_DEVICE_CLASS (virtio_device_class) = { .name = "virtio", .format_device_name = format_virtio_device_name, @@ -1225,11 +1212,9 @@ VNET_DEVICE_CLASS (virtio_device_class) = { .rx_redirect_to_node = virtio_set_interface_next_node, .clear_counters = virtio_clear_hw_interface_counters, .admin_up_down_function = virtio_interface_admin_up_down, - .subif_add_del_function = virtio_subif_add_del_function, .rx_mode_change_function = virtio_interface_rx_mode_change, }; -/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON |