summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-11-25 18:44:01 +0100
committerEd Warnicke <hagbard@gmail.com>2021-11-27 15:31:46 +0000
commit9adcc9778c316d4c94c6734b8c8e4ce0daede820 (patch)
tree0af9e73a9d29bc5ce632cac0589e086ddc7895ff /src/vnet
parentc6eb7da390fbfaf5bd93ec22a9d2e60e0448d71c (diff)
devices: fix af_packet GSO check
Type: fix This fixes the GSO size calculation in af_packet which didn't include the ethernet size. This is not ideal, as we default to the host side mtu to check whether a packet is GSO or not and to set the GSO size. But there doesn't seem to be more info passed with the packets. Change-Id: I9769e1dd21d5989b4cf67295352b5535454f88d1 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/devices/af_packet/node.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index 0fdae5c3039..efe701642bb 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -209,6 +209,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 thread_index = vm->thread_index;
u32 n_buffer_bytes = vlib_buffer_get_default_data_size (vm);
u32 min_bufs = apif->rx_req->tp_frame_size / n_buffer_bytes;
+ u32 eth_header_size = 0;
vlib_buffer_t bt;
if (apif->mode == AF_PACKET_IF_MODE_IP)
@@ -217,6 +218,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
else
{
+ eth_header_size = sizeof (ethernet_header_t);
next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
if (PREDICT_FALSE (apif->per_interface_next_index != ~0))
next_index = apif->per_interface_next_index;
@@ -307,7 +309,10 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
first_b0 = vlib_get_buffer (vm, first_bi0);
if (tph->tp_status & TP_STATUS_CSUMNOTREADY)
mark_tcp_udp_cksum_calc (first_b0, &l4_hdr_sz);
- if (tph->tp_snaplen > apif->host_mtu)
+ /* This is a trade-off for GSO. As kernel isn't passing
+ * us the GSO state or size, we guess it by comparing it
+ * to the host MTU of the interface */
+ if (tph->tp_snaplen > (apif->host_mtu + eth_header_size))
fill_gso_buffer_flags (first_b0, apif->host_mtu,
l4_hdr_sz);
}
bel */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2016 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 @dir
 @brief Inband OAM (iOAM) implementation
*/