diff options
author | Damjan Marion <damarion@cisco.com> | 2022-01-04 20:07:32 +0100 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2022-01-05 10:48:54 +0000 |
commit | dfc853c0ac2f8f15765a51268a53b023d4cf6c65 (patch) | |
tree | 267aef8cbb34ca94a2abd2b952df7fe3fadc8403 /src/plugins/dpdk | |
parent | 343ff3700948703a977a6ebcd0f9e84c4a988d90 (diff) |
dpdk: keep buffer flags per-device
Type: improvement
Change-Id: Idb0b079df49c12643c9a93ee0effe011d3489068
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dpdk')
-rw-r--r-- | src/plugins/dpdk/device/common.c | 5 | ||||
-rw-r--r-- | src/plugins/dpdk/device/dpdk.h | 5 | ||||
-rw-r--r-- | src/plugins/dpdk/device/init.c | 11 | ||||
-rw-r--r-- | src/plugins/dpdk/device/node.c | 1 |
4 files changed, 7 insertions, 15 deletions
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c index b3de5cf652c..3bd5001480e 100644 --- a/src/plugins/dpdk/device/common.c +++ b/src/plugins/dpdk/device/common.c @@ -147,7 +147,12 @@ dpdk_device_setup (dpdk_device_t * xd) goto error; rte_eth_dev_set_mtu (xd->port_id, hi->max_packet_bytes); + xd->buffer_flags = + (VLIB_BUFFER_TOTAL_LENGTH_VALID | VLIB_BUFFER_EXT_HDR_VALID); + if (xd->port_conf.rxmode.offloads & DEV_RX_OFFLOAD_TCP_CKSUM) + xd->buffer_flags |= + (VNET_BUFFER_F_L4_CHECKSUM_COMPUTED | VNET_BUFFER_F_L4_CHECKSUM_CORRECT); if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) dpdk_device_start (xd); diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h index 7ead961d091..362c74bd5d3 100644 --- a/src/plugins/dpdk/device/dpdk.h +++ b/src/plugins/dpdk/device/dpdk.h @@ -176,6 +176,7 @@ typedef struct u32 hw_if_index; u32 sw_if_index; + u32 buffer_flags; /* next node index if we decide to steal the rx graph arc */ u32 per_interface_next_index; @@ -330,14 +331,10 @@ typedef struct typedef struct { - /* Devices */ dpdk_device_t *devices; dpdk_per_thread_data_t *per_thread_data; - /* buffer flags template, configurable to enable/disable tcp / udp cksum */ - u32 buffer_flags_template; - /* * flag indicating that a posted admin up/down * (via post_sw_interface_set_flags) is in progress diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 53fd24b2044..06fb55e1734 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -230,10 +230,6 @@ dpdk_lib_init (dpdk_main_t * dm) if (CLIB_DEBUG > 0) dpdk_log_notice ("DPDK drivers found %d ports...", nports); - if (dm->conf->enable_tcp_udp_checksum) - dm->buffer_flags_template &= ~(VNET_BUFFER_F_L4_CHECKSUM_CORRECT - | VNET_BUFFER_F_L4_CHECKSUM_COMPUTED); - /* vlib_buffer_t template */ vec_validate_aligned (dm->per_thread_data, tm->n_vlib_mains - 1, CLIB_CACHE_LINE_BYTES); @@ -241,7 +237,6 @@ dpdk_lib_init (dpdk_main_t * dm) { dpdk_per_thread_data_t *ptd = vec_elt_at_index (dm->per_thread_data, i); clib_memset (&ptd->buffer_template, 0, sizeof (vlib_buffer_t)); - ptd->buffer_template.flags = dm->buffer_flags_template; vnet_buffer (&ptd->buffer_template)->sw_if_index[VLIB_TX] = (u32) ~ 0; } @@ -1887,12 +1882,6 @@ dpdk_init (vlib_main_t * vm) vec_add1 (dm->conf->eal_init_args, (u8 *) "vnet"); - /* Default vlib_buffer_t flags, DISABLES tcp/udp checksumming... */ - dm->buffer_flags_template = (VLIB_BUFFER_TOTAL_LENGTH_VALID | - VLIB_BUFFER_EXT_HDR_VALID | - VNET_BUFFER_F_L4_CHECKSUM_COMPUTED | - VNET_BUFFER_F_L4_CHECKSUM_CORRECT); - dm->stat_poll_interval = DPDK_STATS_POLL_INTERVAL; dm->link_state_poll_interval = DPDK_LINK_POLL_INTERVAL; diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c index 2357e399dc8..9acf594ba19 100644 --- a/src/plugins/dpdk/device/node.c +++ b/src/plugins/dpdk/device/node.c @@ -376,6 +376,7 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd, /* Update buffer template */ vnet_buffer (bt)->sw_if_index[VLIB_RX] = xd->sw_if_index; bt->error = node->errors[DPDK_ERROR_NONE]; + bt->flags = xd->buffer_flags; /* as DPDK is allocating empty buffers from mempool provided before interface start for each queue, it is safe to store this in the template */ bt->buffer_pool_index = rxq->buffer_pool_index; |