Adjust buffer data offset based on rte_mbuff data_off
This commit removes assumption that all packets have
data offset equal to RTE_PKTMBUF_HEADROOM. Some drivers
like fm10K receive packets with different data offset.
Change-Id: I0aba6296458dab9df6fff639b4b827b2084ddc3e
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/vnet/vnet/devices/dpdk/node.c b/vnet/vnet/devices/dpdk/node.c
index 0dd3cfc..2c90d80 100644
--- a/vnet/vnet/devices/dpdk/node.c
+++ b/vnet/vnet/devices/dpdk/node.c
@@ -502,7 +502,6 @@
u32 n_trace, trace_cnt __attribute__((unused));
vlib_buffer_free_list_t * fl;
u8 efd_discard_burst = 0;
- u16 ip_align_offset = 0;
u32 buffer_flags_template;
if (xd->admin_up == 0)
@@ -522,9 +521,6 @@
return 0;
}
- if (xd->pmd == VNET_DPDK_PMD_THUNDERX)
- ip_align_offset = 6;
-
buffer_flags_template = dm->buffer_flags_template;
vec_reset_length (xd->d_trace_buffers);
@@ -673,15 +669,11 @@
sizeof (ethernet_header_t) : 0);
b0->current_data = l3_offset0;
+ /* Some drivers like fm10k receive frames with
+ mb->data_off > RTE_PKTMBUF_HEADROOM */
+ b0->current_data += mb->data_off - RTE_PKTMBUF_HEADROOM;
b0->current_length = mb->data_len - l3_offset0;
- if (PREDICT_FALSE (ip_align_offset != 0))
- {
- if (next0 == DPDK_RX_NEXT_IP4_INPUT ||
- next0 == DPDK_RX_NEXT_IP6_INPUT)
- b0->current_data += ip_align_offset;
- }
-
b0->flags = buffer_flags_template;
if (VMWARE_LENGTH_BUG_WORKAROUND)
@@ -1390,6 +1382,9 @@
sizeof (ethernet_header_t) : 0);
b0->current_data = l3_offset0;
+ /* Some drivers like fm10k receive frames with
+ mb->data_off > RTE_PKTMBUF_HEADROOM */
+ b0->current_data += mb->data_off - RTE_PKTMBUF_HEADROOM;
b0->current_length = mb->data_len - l3_offset0;
b0->flags = buffer_flags_template;