summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammed Hawari <mohammed@hawari.fr>2021-01-13 13:45:45 +0100
committerMohammed Hawari <mohammed@hawari.fr>2021-01-19 17:09:26 +0100
commit0b374922d236cada6efddca170990737accacf8a (patch)
tree7fa382ffe1b546e046935f4c8a4ed7799fb58f4c
parent66b80310fb14f24a83979055895492ff7e061492 (diff)
avf: fix l2_len for csum offload
Use vlib_buffer_t::current_data instead of vnet_buffer_opaque_t::l2_hdr_offset to compute l2_len for checksum offload (l2_hdr_offset might be invalid if packet originates from an L3 interface) Change-Id: I2031ea6fd6a7af4b6e186751e119ebd6161641b5 Type: fix Signed-off-by: Mohammed Hawari <mohammed@hawari.fr> (cherry picked from commit 533ac64330436752f82477973e4587e2197c4719)
-rw-r--r--src/plugins/avf/output.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/avf/output.c b/src/plugins/avf/output.c
index cbc85b846fe..2fe30643513 100644
--- a/src/plugins/avf/output.c
+++ b/src/plugins/avf/output.c
@@ -67,7 +67,7 @@ avf_tx_prepare_cksum (vlib_buffer_t * b, u8 is_tso)
u32 is_ip6 = b->flags & VNET_BUFFER_F_IS_IP6;
ASSERT (!is_tcp || !is_udp);
ASSERT (is_ip4 || is_ip6);
- i16 l2_hdr_offset = vnet_buffer (b)->l2_hdr_offset;
+ i16 l2_hdr_offset = b->current_data;
i16 l3_hdr_offset = vnet_buffer (b)->l3_hdr_offset;
i16 l4_hdr_offset = vnet_buffer (b)->l4_hdr_offset;
u16 l2_len = l3_hdr_offset - l2_hdr_offset;
@@ -156,9 +156,8 @@ avf_tx_fill_ctx_desc (vlib_main_t * vm, avf_txq_t * txq, avf_tx_desc_t * d,
/* Acquire a reference on the placeholder buffer */
ctx_ph->ref_count++;
- u16 l234hdr_sz =
- vnet_buffer (b)->l4_hdr_offset -
- vnet_buffer (b)->l2_hdr_offset + vnet_buffer2 (b)->gso_l4_hdr_sz;
+ u16 l234hdr_sz = vnet_buffer (b)->l4_hdr_offset - b->current_data +
+ vnet_buffer2 (b)->gso_l4_hdr_sz;
u16 tlen = vlib_buffer_length_in_chain (vm, b) - l234hdr_sz;
d[0].qword[0] = 0;
d[0].qword[1] = AVF_TXD_DTYP_CTX | AVF_TXD_CTX_CMD_TSO