diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2020-10-07 13:23:55 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-10-08 06:23:58 +0000 |
commit | 83143710e80c8df703fe1ebc0e513aa37971d295 (patch) | |
tree | 9bba21dc2be10bfe8e8ad2266f8f811bb18024bf /src/vnet/devices/virtio | |
parent | adb10ad775ead572456fd29c04c704c4deee4416 (diff) |
virtio: fix the trace
Type: fix
This patch fixes the commit e347acbc31111504c015531e8ad764a86d489309
Change-Id: Icee7a6e250c94ae93e606d7869acc55c7a5806b1
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio')
-rw-r--r-- | src/vnet/devices/virtio/device.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c index a414f821428..334da18ecb7 100644 --- a/src/vnet/devices/virtio/device.c +++ b/src/vnet/devices/virtio/device.c @@ -312,11 +312,11 @@ set_gso_offsets (vlib_buffer_t * b, virtio_net_hdr_v1_t * hdr, int is_l2) } static_always_inline u16 -add_buffer_to_slot (vlib_main_t * vm, virtio_if_t * vif, - virtio_if_type_t type, virtio_vring_t * vring, - u32 bi, u16 free_desc_count, +add_buffer_to_slot (vlib_main_t * vm, vlib_node_runtime_t * node, + virtio_if_t * vif, virtio_if_type_t type, + virtio_vring_t * vring, u32 bi, u16 free_desc_count, u16 avail, u16 next, u16 mask, int do_gso, - int csum_offload, uword node_index) + int csum_offload) { u16 n_added = 0; int hdr_sz = vif->virtio_net_hdr_sz; @@ -334,7 +334,7 @@ add_buffer_to_slot (vlib_main_t * vm, virtio_if_t * vif, set_gso_offsets (b, hdr, is_l2); else { - virtio_interface_drop_inline (vm, node_index, &bi, 1, + virtio_interface_drop_inline (vm, node->node_index, &bi, 1, VIRTIO_TX_ERROR_GSO_PACKET_DROP); return n_added; } @@ -346,12 +346,17 @@ add_buffer_to_slot (vlib_main_t * vm, virtio_if_t * vif, set_checksum_offsets (b, hdr, is_l2); else { - virtio_interface_drop_inline (vm, node_index, &bi, 1, + virtio_interface_drop_inline (vm, node->node_index, &bi, 1, VIRTIO_TX_ERROR_CSUM_OFFLOAD_PACKET_DROP); return n_added; } } + if (PREDICT_FALSE (b->flags & VLIB_BUFFER_IS_TRACED)) + { + virtio_tx_trace (vm, node, type, b, bi); + } + if (PREDICT_TRUE ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0)) { d->addr = @@ -374,7 +379,7 @@ add_buffer_to_slot (vlib_main_t * vm, virtio_if_t * vif, u32 indirect_buffer = 0; if (PREDICT_FALSE (vlib_buffer_alloc (vm, &indirect_buffer, 1) == 0)) { - virtio_interface_drop_inline (vm, node_index, &bi, 1, + virtio_interface_drop_inline (vm, node->node_index, &bi, 1, VIRTIO_TX_ERROR_INDIRECT_DESC_ALLOC_FAILED); return n_added; } @@ -599,15 +604,11 @@ retry: u32 bi = virtio_vring_buffering_read_from_front (vring->buffering); if (bi == ~0) break; - vlib_buffer_t *b0 = vlib_get_buffer (vm, bi); - if (b0->flags & VLIB_BUFFER_IS_TRACED) - { - virtio_tx_trace (vm, node, type, b0, buffers[0]); - } + n_added = - add_buffer_to_slot (vm, vif, type, vring, bi, free_desc_count, - avail, next, mask, do_gso, csum_offload, - node->node_index); + add_buffer_to_slot (vm, node, vif, type, vring, bi, + free_desc_count, avail, next, mask, do_gso, + csum_offload); if (PREDICT_FALSE (n_added == 0)) { n_buffers_left--; @@ -628,15 +629,10 @@ retry: { u16 n_added = 0; - vlib_buffer_t *b0 = vlib_get_buffer (vm, buffers[0]); - if (b0->flags & VLIB_BUFFER_IS_TRACED) - { - virtio_tx_trace (vm, node, type, b0, buffers[0]); - } n_added = - add_buffer_to_slot (vm, vif, type, vring, buffers[0], free_desc_count, - avail, next, mask, do_gso, csum_offload, - node->node_index); + add_buffer_to_slot (vm, node, vif, type, vring, buffers[0], + free_desc_count, avail, next, mask, do_gso, + csum_offload); if (PREDICT_FALSE (n_added == 0)) { |