16 #ifndef included_gro_func_h 17 #define included_gro_func_h 65 if (b0->
flags & VNET_BUFFER_F_IS_IP4)
66 return VNET_BUFFER_F_IS_IP4;
67 if (b0->
flags & VNET_BUFFER_F_IS_IP6)
68 return VNET_BUFFER_F_IS_IP6;
73 u16 ethertype = clib_net_to_host_u16 (eh->
type);
79 ethertype = clib_net_to_host_u16 (vlan->
type);
80 if (ethertype == ETHERNET_TYPE_VLAN)
83 ethertype = clib_net_to_host_u16 (vlan->
type);
86 if (ethertype == ETHERNET_TYPE_IP4)
87 return VNET_BUFFER_F_IS_IP4;
88 if (ethertype == ETHERNET_TYPE_IP6)
89 return VNET_BUFFER_F_IS_IP6;
94 return VNET_BUFFER_F_IS_IP4;
96 return VNET_BUFFER_F_IS_IP6;
113 u32 next_tcp_seq0 = clib_net_to_host_u32 (tcp0->seq_number);
114 u32 next_tcp_seq1 = clib_net_to_host_u32 (tcp1->seq_number);
117 if (
PREDICT_TRUE (next_tcp_seq0 + payload_len0 == next_tcp_seq1))
134 while (pb->
flags & VLIB_BUFFER_NEXT_PRESENT)
138 pb->
flags |= VLIB_BUFFER_NEXT_PRESENT;
141 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
150 if (b0->
flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM)
151 return VNET_BUFFER_F_L4_CHECKSUM_CORRECT;
176 if (is_ip0 & VNET_BUFFER_F_IS_IP4)
179 else if (is_ip0 & VNET_BUFFER_F_IS_IP6)
217 if ((flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) == 0)
237 u16 l234_sz0, l234_sz1;
238 u32 pkt_len0, pkt_len1, payload_len0, payload_len1;
245 if (is_ip0 & VNET_BUFFER_F_IS_IP4)
248 else if (is_ip0 & VNET_BUFFER_F_IS_IP6)
254 if (is_ip1 & VNET_BUFFER_F_IS_IP4)
257 else if (is_ip1 & VNET_BUFFER_F_IS_IP6)
315 payload_len0 = pkt_len0 - l234_sz0;
316 payload_len1 = pkt_len1 - l234_sz1;
326 return tcp1->ack_number;
340 if (is_ip0 & VNET_BUFFER_F_IS_IP4)
343 else if (is_ip0 & VNET_BUFFER_F_IS_IP6)
357 (VNET_BUFFER_F_GSO | VNET_BUFFER_F_IS_IP4 |
358 VNET_BUFFER_F_OFFLOAD_TCP_CKSUM | VNET_BUFFER_F_OFFLOAD_IP_CKSUM);
368 (VNET_BUFFER_F_GSO | VNET_BUFFER_F_IS_IP6 |
369 VNET_BUFFER_F_OFFLOAD_TCP_CKSUM);
374 tcp0->ack_number = ack_number;
375 b0->
flags &= ~VLIB_BUFFER_IS_TRACED;
448 int is_l2 = flow_table->
is_l2;
492 u16 l234_sz0, l234_sz_s;
493 u32 pkt_len_s, payload_len0, payload_len_s;
498 if (is_ip_s & VNET_BUFFER_F_IS_IP4)
501 else if (is_ip_s & VNET_BUFFER_F_IS_IP6)
511 payload_len0 = pkt_len0 - l234_sz0;
512 payload_len_s = pkt_len_s - l234_sz_s;
560 u16 n_left_from,
u32 * to)
564 for (
i = 0;
i < n_left_from;
i++)
579 u32 bi = 1, ack_number = 0;
582 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)
u32 ip4_tcp_udp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
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
u32 ip6_tcp_udp_icmp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
vl_api_mac_event_action_t action
u32 next_buffer
Next buffer for this linked-list of buffers.
VLIB buffer representation.
static_always_inline u32 gro_validate_checksum(vlib_main_t *vm, vlib_buffer_t *b0, generic_header_offset_t *gho0, int is_ip4)
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)