#include <vnet/udp/udp_packet.h>
#include <vnet/devices/virtio/virtio.h>
+#define VIRTIO_TX_MAX_CHAIN_LEN 127
+
#define foreach_virtio_tx_func_error \
_(NO_FREE_SLOTS, "no free tx slots") \
_(TRUNC_PACKET, "packet > buffer size -- truncated in tx ring") \
virtio_tx_trace_t *t = va_arg (*va, virtio_tx_trace_t *);
u32 indent = format_get_indent (s);
- s = format (s, "%Ubuffer 0x%x: %U\n",
- format_white_space, indent,
- t->buffer_index, format_vnet_buffer, &t->buffer);
+ s = format (s, "%Ubuffer 0x%x: %U\n", format_white_space, indent,
+ t->buffer_index, format_vnet_buffer_no_chain, &t->buffer);
s =
format (s, "%U%U\n", format_white_space, indent,
format_generic_header_offset, &t->gho);
set_checksum_offsets (vlib_buffer_t *b, virtio_net_hdr_v1_t *hdr,
const int is_l2)
{
- u32 oflags = vnet_buffer2 (b)->oflags;
+ vnet_buffer_oflags_t oflags = vnet_buffer (b)->oflags;
if (b->flags & VNET_BUFFER_F_IS_IP4)
{
static void
set_gso_offsets (vlib_buffer_t *b, virtio_net_hdr_v1_t *hdr, const int is_l2)
{
- u32 oflags = vnet_buffer2 (b)->oflags;
+ vnet_buffer_oflags_t oflags = vnet_buffer (b)->oflags;
if (b->flags & VNET_BUFFER_F_IS_IP4)
{
b = vlib_get_buffer (vm, b->next_buffer);
id->addr = vlib_buffer_get_current_pa (vm, b);
id->len = b->current_length;
+ if (PREDICT_FALSE (count == VIRTIO_TX_MAX_CHAIN_LEN))
+ {
+ if (b->flags & VLIB_BUFFER_NEXT_PRESENT)
+ vlib_error_count (vm, node->node_index,
+ VIRTIO_TX_ERROR_TRUNC_PACKET, 1);
+ break;
+ }
}
}
else /* VIRTIO_IF_TYPE_[TAP | TUN] */
b = vlib_get_buffer (vm, b->next_buffer);
id->addr = pointer_to_uword (vlib_buffer_get_current (b));
id->len = b->current_length;
+ if (PREDICT_FALSE (count == VIRTIO_TX_MAX_CHAIN_LEN))
+ {
+ if (b->flags & VLIB_BUFFER_NEXT_PRESENT)
+ vlib_error_count (vm, node->node_index,
+ VIRTIO_TX_ERROR_TRUNC_PACKET, 1);
+ break;
+ }
}
}
id->flags = 0;
b = vlib_get_buffer (vm, b->next_buffer);
id->addr = vlib_buffer_get_current_pa (vm, b);
id->len = b->current_length;
+ if (PREDICT_FALSE (count == VIRTIO_TX_MAX_CHAIN_LEN))
+ {
+ if (b->flags & VLIB_BUFFER_NEXT_PRESENT)
+ vlib_error_count (vm, node->node_index,
+ VIRTIO_TX_ERROR_TRUNC_PACKET, 1);
+ break;
+ }
}
}
id->flags = 0;