Disable for-us udp/tcp checksum validation by default
This patch alters behavior for dpdk rx packets. Depending on test results, it may be necessary to extend the scheme to packets received on non-dpdk paravirtualized interfaces, and packets originating in the vpp stack itself. Change-Id: I8444232a90ff176e7d6a688e36801174575251a1 Signed-off-by: Dave Barach <dave@barachs.net>
This commit is contained in:
@ -301,6 +301,9 @@ typedef struct {
|
||||
/* per-thread recycle lists */
|
||||
u32 ** recycle;
|
||||
|
||||
/* buffer flags template, configurable to enable/disable tcp / udp cksum */
|
||||
u32 buffer_flags_template;
|
||||
|
||||
/* flow control callback. If 0 then flow control is disabled */
|
||||
dpdk_flowcontrol_callback_t flowcontrol_callback;
|
||||
|
||||
|
@ -1008,6 +1008,12 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
no_huge = 1;
|
||||
}
|
||||
|
||||
else if (unformat (input, "enable-tcp-udp-checksum"))
|
||||
{
|
||||
dm->buffer_flags_template &=
|
||||
~(IP_BUFFER_L4_CHECKSUM_CORRECT | IP_BUFFER_L4_CHECKSUM_COMPUTED);
|
||||
}
|
||||
|
||||
else if (unformat (input, "decimal-interface-names"))
|
||||
dm->interface_name_format_decimal = 1;
|
||||
|
||||
@ -1767,6 +1773,12 @@ _(rte_nicvf_pmd_init)
|
||||
dm->vhost_coalesce_frames = 32;
|
||||
dm->vhost_coalesce_time = 1e-3;
|
||||
|
||||
/* Default vlib_buffer_t flags, DISABLES tcp/udp checksumming... */
|
||||
dm->buffer_flags_template =
|
||||
(VLIB_BUFFER_TOTAL_LENGTH_VALID
|
||||
| IP_BUFFER_L4_CHECKSUM_COMPUTED
|
||||
| IP_BUFFER_L4_CHECKSUM_CORRECT);
|
||||
|
||||
/* init CLI */
|
||||
if ((error = vlib_call_init_function (vm, dpdk_cli_init)))
|
||||
return error;
|
||||
|
@ -542,7 +542,8 @@ static inline u32 dpdk_device_input ( dpdk_main_t * dm,
|
||||
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)
|
||||
return 0;
|
||||
|
||||
@ -563,6 +564,8 @@ static inline u32 dpdk_device_input ( dpdk_main_t * dm,
|
||||
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);
|
||||
trace_cnt = n_trace = vlib_get_trace_count (vm, node);
|
||||
|
||||
@ -718,7 +721,7 @@ static inline u32 dpdk_device_input ( dpdk_main_t * dm,
|
||||
b0->current_data += ip_align_offset;
|
||||
}
|
||||
|
||||
b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID;
|
||||
b0->flags = buffer_flags_template;
|
||||
|
||||
if (VMWARE_LENGTH_BUG_WORKAROUND)
|
||||
b0->current_length -= 4;
|
||||
@ -1142,6 +1145,7 @@ void dpdk_io_thread (vlib_worker_thread_t * w,
|
||||
u16 queue_id = 0;
|
||||
vlib_node_runtime_t * node_trace;
|
||||
u32 first_worker_index = 0;
|
||||
u32 buffer_flags_template;
|
||||
|
||||
/* Wait until the dpdk init sequence is complete */
|
||||
while (dm->io_thread_release == 0)
|
||||
@ -1186,6 +1190,8 @@ void dpdk_io_thread (vlib_worker_thread_t * w,
|
||||
/* packet tracing is triggered on the dpdk-input node for ease-of-use */
|
||||
node_trace = vlib_node_get_runtime (vm, dpdk_input_node.index);
|
||||
|
||||
buffer_flags_template = dm->buffer_flags_template;
|
||||
|
||||
/* And handle them... */
|
||||
while (1)
|
||||
{
|
||||
@ -1382,7 +1388,7 @@ void dpdk_io_thread (vlib_worker_thread_t * w,
|
||||
b0->current_data = l3_offset0;
|
||||
b0->current_length = mb->data_len - l3_offset0;
|
||||
|
||||
b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID;
|
||||
b0->flags = buffer_flags_template;
|
||||
|
||||
if (VMWARE_LENGTH_BUG_WORKAROUND)
|
||||
b0->current_length -= 4;
|
||||
@ -1585,6 +1591,7 @@ dpdk_io_input (vlib_main_t * vm,
|
||||
u16 queue_id = 0;
|
||||
vlib_node_runtime_t * node_trace;
|
||||
static u32 first_worker_index;
|
||||
u32 buffer_flags_template;
|
||||
|
||||
if (PREDICT_FALSE(num_workers_set == 0))
|
||||
{
|
||||
@ -1613,6 +1620,8 @@ dpdk_io_input (vlib_main_t * vm,
|
||||
/* packet tracing is triggered on the dpdk-input node for ease-of-use */
|
||||
node_trace = vlib_node_get_runtime (vm, dpdk_input_node.index);
|
||||
|
||||
buffer_flags_template = dm->buffer_flags_template;
|
||||
|
||||
vec_foreach (xd, dm->devices)
|
||||
{
|
||||
u32 n_buffers;
|
||||
@ -1780,7 +1789,7 @@ dpdk_io_input (vlib_main_t * vm,
|
||||
b0->current_data = l3_offset0;
|
||||
b0->current_length = mb->data_len - l3_offset0;
|
||||
|
||||
b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID;
|
||||
b0->flags = buffer_flags_template;
|
||||
|
||||
if (VMWARE_LENGTH_BUG_WORKAROUND)
|
||||
b0->current_length -= 4;
|
||||
|
Reference in New Issue
Block a user