octeon: enable tx checksum offload capability 00/41400/2
authorMonendra Singh Kushwaha <[email protected]>
Mon, 5 Aug 2024 10:00:22 +0000 (15:30 +0530)
committerDamjan Marion <[email protected]>
Wed, 21 Aug 2024 11:53:36 +0000 (11:53 +0000)
This patch enables tx checksum offload and sets correct l3/l4 offset.

Type: feature

Signed-off-by: Monendra Singh Kushwaha <[email protected]>
Change-Id: I666f4000cb51c4979567a52255377dbe15ffb202

src/plugins/dev_octeon/init.c
src/plugins/dev_octeon/tx_node.c

index fd65ce6..29d1c16 100644 (file)
@@ -131,6 +131,9 @@ oct_init_nix (vlib_main_t *vm, vnet_dev_t *dev)
        .rx_offloads = {
          .ip4_cksum = 1,
        },
+       .tx_offloads = {
+         .ip4_cksum = 1,
+       },
       },
       .ops = {
         .init = oct_port_init,
index 0907493..6d23983 100644 (file)
@@ -255,19 +255,18 @@ oct_tx_enq1 (vlib_main_t *vm, oct_tx_ctx_t *ctx, vlib_buffer_t *b,
       if (oflags & VNET_BUFFER_OFFLOAD_F_IP_CKSUM)
        {
          d.hdr_w1.ol3type = NIX_SENDL3TYPE_IP4_CKSUM;
-         d.hdr_w1.ol3ptr = vnet_buffer (b)->l3_hdr_offset;
-         d.hdr_w1.ol4ptr =
-           vnet_buffer (b)->l3_hdr_offset + sizeof (ip4_header_t);
+         d.hdr_w1.ol3ptr = vnet_buffer (b)->l3_hdr_offset - b->current_data;
+         d.hdr_w1.ol4ptr = d.hdr_w1.ol3ptr + sizeof (ip4_header_t);
        }
       if (oflags & VNET_BUFFER_OFFLOAD_F_UDP_CKSUM)
        {
          d.hdr_w1.ol4type = NIX_SENDL4TYPE_UDP_CKSUM;
-         d.hdr_w1.ol4ptr = vnet_buffer (b)->l4_hdr_offset;
+         d.hdr_w1.ol4ptr = vnet_buffer (b)->l4_hdr_offset - b->current_data;
        }
       else if (oflags & VNET_BUFFER_OFFLOAD_F_TCP_CKSUM)
        {
          d.hdr_w1.ol4type = NIX_SENDL4TYPE_TCP_CKSUM;
-         d.hdr_w1.ol4ptr = vnet_buffer (b)->l4_hdr_offset;
+         d.hdr_w1.ol4ptr = vnet_buffer (b)->l4_hdr_offset - b->current_data;
        }
     }