16 #ifndef included_gro_func_h 17 #define included_gro_func_h 63 if (b0->
flags & VNET_BUFFER_F_IS_IP4)
64 return VNET_BUFFER_F_IS_IP4;
65 if (b0->
flags & VNET_BUFFER_F_IS_IP6)
66 return VNET_BUFFER_F_IS_IP6;
71 u16 ethertype = clib_net_to_host_u16 (eh->
type);
77 ethertype = clib_net_to_host_u16 (vlan->
type);
78 if (ethertype == ETHERNET_TYPE_VLAN)
81 ethertype = clib_net_to_host_u16 (vlan->
type);
84 if (ethertype == ETHERNET_TYPE_IP4)
85 return VNET_BUFFER_F_IS_IP4;
86 if (ethertype == ETHERNET_TYPE_IP6)
87 return VNET_BUFFER_F_IS_IP6;
92 return VNET_BUFFER_F_IS_IP4;
94 return VNET_BUFFER_F_IS_IP6;
111 u32 next_tcp_seq0 = clib_net_to_host_u32 (tcp0->seq_number);
112 u32 next_tcp_seq1 = clib_net_to_host_u32 (tcp1->seq_number);
115 if (
PREDICT_TRUE (next_tcp_seq0 + payload_len0 == next_tcp_seq1))
132 while (pb->
flags & VLIB_BUFFER_NEXT_PRESENT)
136 pb->
flags |= VLIB_BUFFER_NEXT_PRESENT;
139 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
156 if (is_ip0 & VNET_BUFFER_F_IS_IP4)
159 else if (is_ip0 & VNET_BUFFER_F_IS_IP6)
212 u16 l234_sz0, l234_sz1;
213 u32 pkt_len0, pkt_len1, payload_len0, payload_len1;
220 if (is_ip0 & VNET_BUFFER_F_IS_IP4)
223 else if (is_ip0 & VNET_BUFFER_F_IS_IP6)
229 if (is_ip1 & VNET_BUFFER_F_IS_IP4)
232 else if (is_ip1 & VNET_BUFFER_F_IS_IP6)
290 payload_len0 = pkt_len0 - l234_sz0;
291 payload_len1 = pkt_len1 - l234_sz1;
301 return tcp1->ack_number;
315 if (is_ip0 & VNET_BUFFER_F_IS_IP4)
318 else if (is_ip0 & VNET_BUFFER_F_IS_IP6)
332 (VNET_BUFFER_F_GSO | VNET_BUFFER_F_IS_IP4 |
333 VNET_BUFFER_F_OFFLOAD_TCP_CKSUM | VNET_BUFFER_F_OFFLOAD_IP_CKSUM);
343 (VNET_BUFFER_F_GSO | VNET_BUFFER_F_IS_IP6 |
344 VNET_BUFFER_F_OFFLOAD_TCP_CKSUM);
349 tcp0->ack_number = ack_number;
350 b0->
flags &= ~VLIB_BUFFER_IS_TRACED;
423 int is_l2 = flow_table->
is_l2;
467 u16 l234_sz0, l234_sz_s;
468 u32 pkt_len_s, payload_len0, payload_len_s;
473 if (is_ip_s & VNET_BUFFER_F_IS_IP4)
476 else if (is_ip_s & VNET_BUFFER_F_IS_IP6)
486 payload_len0 = pkt_len0 - l234_sz0;
487 payload_len_s = pkt_len_s - l234_sz_s;
535 u16 n_left_from,
u32 * to)
539 for (
i = 0;
i < n_left_from;
i++)
554 u32 bi = 1, ack_number = 0;
557 while (n_left_from > 1)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u32 sw_if_index[VLIB_N_RX_TX]
static_always_inline u8 gro_flow_table_is_enable(gro_flow_table_t *flow_table)
vl_api_wireguard_peer_flags_t flags
static_always_inline void gro_flow_store_packet(gro_flow_t *gro_flow, u32 bi0)
#define GRO_FLOW_TABLE_FLUSH
static_always_inline u8 gro_flow_table_is_timeout(vlib_main_t *vm, gro_flow_table_t *flow_table)
u16 current_length
Nbytes between current data and the end of this buffer.
static_always_inline void ip46_address_set_ip6(ip46_address_t *dst, const ip6_address_t *src)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
struct _tcp_header tcp_header_t
static_always_inline void gro_get_ip6_flow_from_packet(u32 *sw_if_index, ip6_header_t *ip6, tcp_header_t *tcp, gro_flow_key_t *flow_key, int is_l2)
static_always_inline gro_packet_action_t gro_tcp_sequence_check(tcp_header_t *tcp0, tcp_header_t *tcp1, u32 payload_len0)
ip46_address_t src_address
static_always_inline u32 vnet_gro_simple_inline(vlib_main_t *vm, u32 *from, u16 n_left_from, int is_l2)
coalesce buffers in opportunistic way without flow tables
#define static_always_inline
static_always_inline void gro_merge_buffers(vlib_main_t *vm, vlib_buffer_t *b0, vlib_buffer_t *b1, u32 bi1, u32 payload_len1, u16 l234_sz1)
#define GRO_FLOW_TABLE_MAX_SIZE
static_always_inline u8 gro_is_bad_packet(vlib_buffer_t *b, u8 flags, i16 l234_sz)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static_always_inline gro_flow_t * gro_flow_table_find_or_add_flow(gro_flow_table_t *flow_table, gro_flow_key_t *flow_key)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static_always_inline u32 gro_get_packet_data(vlib_main_t *vm, vlib_buffer_t *b0, generic_header_offset_t *gho0, gro_flow_key_t *flow_key0, int is_l2)
ip46_address_t dst_address
static_always_inline void vnet_gro_flow_table_schedule_node_on_dispatcher(vlib_main_t *vm, gro_flow_table_t *flow_table)
static_always_inline u32 vnet_gro_flow_table_flush(vlib_main_t *vm, gro_flow_table_t *flow_table, u32 *to)
gro_flow_t gro_flow[GRO_FLOW_TABLE_MAX_SIZE]
static_always_inline void gro_flow_table_reset_flow(gro_flow_table_t *flow_table, gro_flow_t *gro_flow)
static_always_inline u32 gro_coalesce_buffers(vlib_main_t *vm, vlib_buffer_t *b0, vlib_buffer_t *b1, u32 bi1, int is_l2)
sll srl srl sll sra u16x4 i
static_always_inline u8 gro_flow_is_timeout(vlib_main_t *vm, gro_flow_t *gro_flow)
static_always_inline u32 gro_is_ip4_or_ip6_packet(vlib_buffer_t *b0, int is_l2)
static_always_inline u8 gro_flow_is_equal(gro_flow_key_t *first, gro_flow_key_t *second)
static_always_inline u32 vnet_gro_inline(vlib_main_t *vm, gro_flow_table_t *flow_table, u32 *from, u16 n_left_from, u32 *to)
coalesce buffers with flow tables
static_always_inline void gro_flow_table_set_timeout(vlib_main_t *vm, gro_flow_table_t *flow_table, f64 timeout_expire)
static_always_inline int ethernet_frame_is_tagged(u16 type)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static_always_inline u32 vnet_gro_flow_table_inline(vlib_main_t *vm, gro_flow_table_t *flow_table, u32 bi0, u32 *to)
static_always_inline void vnet_generic_header_offset_parser(vlib_buffer_t *b0, generic_header_offset_t *gho, int is_l2, int is_ip4, int is_ip6)
static_always_inline void gro_flow_set_timeout(vlib_main_t *vm, gro_flow_t *gro_flow, f64 timeout_expire)
timeout_expire is in between 3 to 10 microseconds 3e-6 1e-5
vl_api_mac_event_action_t action
u32 next_buffer
Next buffer for this linked-list of buffers.
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static_always_inline void gro_fixup_header(vlib_main_t *vm, vlib_buffer_t *b0, u32 ack_number, int is_l2)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static void ip46_address_set_ip4(ip46_address_t *ip46, const ip4_address_t *ip)
vl_api_interface_index_t sw_if_index
static_always_inline void gro_get_ip4_flow_from_packet(u32 *sw_if_index, ip4_header_t *ip4, tcp_header_t *tcp, gro_flow_key_t *flow_key, int is_l2)