FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
node.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * af_packet.c - linux kernel packet interface
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <linux/if_packet.h>
21 
22 #include <vlib/vlib.h>
23 #include <vlib/unix/unix.h>
24 #include <vnet/ip/ip.h>
25 #include <vnet/ethernet/ethernet.h>
27 #include <vnet/feature/feature.h>
28 #include <vnet/ethernet/packet.h>
29 
31 
32 #define foreach_af_packet_input_error \
33  _(PARTIAL_PKT, "partial packet")
34 
35 typedef enum
36 {
37 #define _(f,s) AF_PACKET_INPUT_ERROR_##f,
39 #undef _
42 
44 #define _(n,s) s,
46 #undef _
47 };
48 
49 typedef struct
50 {
53  int block;
54  struct tpacket2_hdr tph;
56 
57 static u8 *
58 format_af_packet_input_trace (u8 * s, va_list * args)
59 {
60  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
61  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
62  af_packet_input_trace_t *t = va_arg (*args, af_packet_input_trace_t *);
63  u32 indent = format_get_indent (s);
64 
65  s = format (s, "af_packet: hw_if_index %d next-index %d",
66  t->hw_if_index, t->next_index);
67 
68  s =
69  format (s,
70  "\n%Utpacket2_hdr:\n%Ustatus 0x%x len %u snaplen %u mac %u net %u"
71  "\n%Usec 0x%x nsec 0x%x vlan %U"
72 #ifdef TP_STATUS_VLAN_TPID_VALID
73  " vlan_tpid %u"
74 #endif
75  ,
76  format_white_space, indent + 2,
77  format_white_space, indent + 4,
78  t->tph.tp_status,
79  t->tph.tp_len,
80  t->tph.tp_snaplen,
81  t->tph.tp_mac,
82  t->tph.tp_net,
83  format_white_space, indent + 4,
84  t->tph.tp_sec,
85  t->tph.tp_nsec, format_ethernet_vlan_tci, t->tph.tp_vlan_tci
86 #ifdef TP_STATUS_VLAN_TPID_VALID
87  , t->tph.tp_vlan_tpid
88 #endif
89  );
90  return s;
91 }
92 
93 always_inline void
94 buffer_add_to_chain (vlib_main_t * vm, u32 bi, u32 first_bi, u32 prev_bi)
95 {
97  vlib_buffer_t *first_b = vlib_get_buffer (vm, first_bi);
98  vlib_buffer_t *prev_b = vlib_get_buffer (vm, prev_bi);
99 
100  /* update first buffer */
102 
103  /* update previous buffer */
104  prev_b->next_buffer = bi;
105  prev_b->flags |= VLIB_BUFFER_NEXT_PRESENT;
106 
107  /* update current buffer */
108  b->next_buffer = 0;
109 }
110 
112 fill_gso_buffer_flags (vlib_buffer_t *b, u32 gso_size, u8 l4_hdr_sz)
113 {
114  b->flags |= VNET_BUFFER_F_GSO;
115  vnet_buffer2 (b)->gso_size = gso_size;
116  vnet_buffer2 (b)->gso_l4_hdr_sz = l4_hdr_sz;
117 }
118 
121 {
123  vnet_buffer_oflags_t oflags = 0;
124  if (clib_net_to_host_u16 (eth->type) == ETHERNET_TYPE_IP4)
125  {
126  ip4_header_t *ip4 =
128  b->flags |= VNET_BUFFER_F_IS_IP4;
129  if (ip4->protocol == IP_PROTOCOL_TCP)
130  {
131  oflags |= VNET_BUFFER_OFFLOAD_F_TCP_CKSUM;
133  sizeof (ethernet_header_t) +
135  tcp->checksum = 0;
136  *l4_hdr_sz = tcp_header_bytes (tcp);
137  }
138  else if (ip4->protocol == IP_PROTOCOL_UDP)
139  {
140  oflags |= VNET_BUFFER_OFFLOAD_F_UDP_CKSUM;
142  sizeof (ethernet_header_t) +
144  udp->checksum = 0;
145  *l4_hdr_sz = sizeof (*udp);
146  }
147  vnet_buffer (b)->l3_hdr_offset = sizeof (ethernet_header_t);
148  vnet_buffer (b)->l4_hdr_offset =
150  if (oflags)
152  }
153  else if (clib_net_to_host_u16 (eth->type) == ETHERNET_TYPE_IP6)
154  {
155  ip6_header_t *ip6 =
157  b->flags |= VNET_BUFFER_F_IS_IP6;
158  u16 ip6_hdr_len = sizeof (ip6_header_t);
159  if (ip6_ext_hdr (ip6->protocol))
160  {
161  ip6_ext_header_t *p = (void *) (ip6 + 1);
162  ip6_hdr_len += ip6_ext_header_len (p);
163  while (ip6_ext_hdr (p->next_hdr))
164  {
165  ip6_hdr_len += ip6_ext_header_len (p);
166  p = ip6_ext_next_header (p);
167  }
168  }
169  if (ip6->protocol == IP_PROTOCOL_TCP)
170  {
171  oflags |= VNET_BUFFER_OFFLOAD_F_TCP_CKSUM;
172  tcp_header_t *tcp =
174  sizeof (ethernet_header_t) + ip6_hdr_len);
175  tcp->checksum = 0;
176  *l4_hdr_sz = tcp_header_bytes (tcp);
177  }
178  else if (ip6->protocol == IP_PROTOCOL_UDP)
179  {
180  oflags |= VNET_BUFFER_OFFLOAD_F_UDP_CKSUM;
181  udp_header_t *udp =
183  sizeof (ethernet_header_t) + ip6_hdr_len);
184  udp->checksum = 0;
185  *l4_hdr_sz = sizeof (*udp);
186  }
187  vnet_buffer (b)->l3_hdr_offset = sizeof (ethernet_header_t);
188  vnet_buffer (b)->l4_hdr_offset =
189  sizeof (ethernet_header_t) + ip6_hdr_len;
190  if (oflags)
192  }
193 }
194 
198 {
200  struct tpacket2_hdr *tph;
202  u32 block = 0;
203  u32 rx_frame;
204  u32 n_free_bufs;
205  u32 n_rx_packets = 0;
206  u32 n_rx_bytes = 0;
207  u32 *to_next = 0;
208  u32 block_size = apif->rx_req->tp_block_size;
209  u32 frame_size = apif->rx_req->tp_frame_size;
210  u32 frame_num = apif->rx_req->tp_frame_nr;
211  u8 *block_start = apif->rx_ring + block * block_size;
212  uword n_trace = vlib_get_trace_count (vm, node);
214  u32 n_buffer_bytes = vlib_buffer_get_default_data_size (vm);
215  u32 min_bufs = apif->rx_req->tp_frame_size / n_buffer_bytes;
216 
217  n_free_bufs = vec_len (apm->rx_buffers[thread_index]);
218  if (PREDICT_FALSE (n_free_bufs < VLIB_FRAME_SIZE))
219  {
221  VLIB_FRAME_SIZE + n_free_bufs - 1);
222  n_free_bufs +=
223  vlib_buffer_alloc (vm, &apm->rx_buffers[thread_index][n_free_bufs],
225  _vec_len (apm->rx_buffers[thread_index]) = n_free_bufs;
226  }
227 
228  rx_frame = apif->next_rx_frame;
229  tph = (struct tpacket2_hdr *) (block_start + rx_frame * frame_size);
230  while ((tph->tp_status & TP_STATUS_USER) && (n_free_bufs > min_bufs))
231  {
232  vlib_buffer_t *b0 = 0, *first_b0 = 0;
233  u32 next0 = next_index;
234 
235  u32 n_left_to_next;
236  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
237  while ((tph->tp_status & TP_STATUS_USER) && (n_free_bufs > min_bufs) &&
238  n_left_to_next)
239  {
240  u32 data_len = tph->tp_snaplen;
241  u32 offset = 0;
242  u32 bi0 = 0, first_bi0 = 0, prev_bi0;
243  u8 l4_hdr_sz = 0;
244 
245  while (data_len)
246  {
247  /* grab free buffer */
248  u32 last_empty_buffer =
249  vec_len (apm->rx_buffers[thread_index]) - 1;
250  prev_bi0 = bi0;
251  bi0 = apm->rx_buffers[thread_index][last_empty_buffer];
252  b0 = vlib_get_buffer (vm, bi0);
253  _vec_len (apm->rx_buffers[thread_index]) = last_empty_buffer;
254  n_free_bufs--;
255 
256  /* copy data */
257  u32 bytes_to_copy =
258  data_len > n_buffer_bytes ? n_buffer_bytes : data_len;
259  u32 vlan_len = 0;
260  u32 bytes_copied = 0;
261  b0->current_data = 0;
262  /* Kernel removes VLAN headers, so reconstruct VLAN */
263  if (PREDICT_FALSE (tph->tp_status & TP_STATUS_VLAN_VALID))
264  {
265  if (PREDICT_TRUE (offset == 0))
266  {
268  (u8 *) tph + tph->tp_mac,
269  sizeof (ethernet_header_t));
271  ethernet_vlan_header_t *vlan =
272  (ethernet_vlan_header_t *) (eth + 1);
273  vlan->priority_cfi_and_id =
274  clib_host_to_net_u16 (tph->tp_vlan_tci);
275  vlan->type = eth->type;
276  eth->type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
277  vlan_len = sizeof (ethernet_vlan_header_t);
278  bytes_copied = sizeof (ethernet_header_t);
279  }
280  }
282  bytes_copied + vlan_len,
283  (u8 *) tph + tph->tp_mac + offset +
284  bytes_copied, (bytes_to_copy - bytes_copied));
285 
286  /* fill buffer header */
287  b0->current_length = bytes_to_copy + vlan_len;
288 
289  if (offset == 0)
290  {
292  b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID;
293  vnet_buffer (b0)->sw_if_index[VLIB_RX] = apif->sw_if_index;
294  vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
295  first_bi0 = bi0;
296  first_b0 = vlib_get_buffer (vm, first_bi0);
297  if (tph->tp_status & TP_STATUS_CSUMNOTREADY)
298  mark_tcp_udp_cksum_calc (first_b0, &l4_hdr_sz);
299  if (tph->tp_snaplen > apif->host_mtu)
300  fill_gso_buffer_flags (first_b0, apif->host_mtu,
301  l4_hdr_sz);
302  }
303  else
304  buffer_add_to_chain (vm, bi0, first_bi0, prev_bi0);
305 
306  offset += bytes_to_copy;
307  data_len -= bytes_to_copy;
308  }
309  n_rx_packets++;
310  n_rx_bytes += tph->tp_snaplen;
311  to_next[0] = first_bi0;
312  to_next += 1;
313  n_left_to_next--;
314 
315  /* drop partial packets */
316  if (PREDICT_FALSE (tph->tp_len != tph->tp_snaplen))
317  {
319  first_b0->error =
320  node->errors[AF_PACKET_INPUT_ERROR_PARTIAL_PKT];
321  }
322  else
323  {
325 
326  if (PREDICT_FALSE (apif->per_interface_next_index != ~0))
327  next0 = apif->per_interface_next_index;
328 
329  /* redirect if feature path enabled */
331  first_b0);
332  }
333 
334  /* trace */
335  if (PREDICT_FALSE
336  (n_trace > 0 && vlib_trace_buffer (vm, node, next0, first_b0,
337  /* follow_chain */ 0)))
338  {
340  vlib_set_trace_count (vm, node, --n_trace);
341  tr = vlib_add_trace (vm, node, first_b0, sizeof (*tr));
342  tr->next_index = next0;
343  tr->hw_if_index = apif->hw_if_index;
344  clib_memcpy_fast (&tr->tph, tph, sizeof (struct tpacket2_hdr));
345  }
346 
347  /* enque and take next packet */
349  n_left_to_next, first_bi0, next0);
350 
351  /* next packet */
352  tph->tp_status = TP_STATUS_KERNEL;
353  rx_frame = (rx_frame + 1) % frame_num;
354  tph = (struct tpacket2_hdr *) (block_start + rx_frame * frame_size);
355  }
356 
357  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
358  }
359 
360  apif->next_rx_frame = rx_frame;
361 
363  (vnet_get_main ()->interface_main.combined_sw_if_counters
365  vlib_get_thread_index (), apif->hw_if_index, n_rx_packets, n_rx_bytes);
366 
368  return n_rx_packets;
369 }
370 
374 {
375  u32 n_rx_packets = 0;
379  for (int i = 0; i < vec_len (pv); i++)
380  {
381  af_packet_if_t *apif;
382  apif = vec_elt_at_index (apm->interfaces, pv[i].dev_instance);
383  if (apif->is_admin_up)
384  n_rx_packets += af_packet_device_input_fn (vm, node, frame, apif);
385  }
386 
387  return n_rx_packets;
388 }
389 
390 /* *INDENT-OFF* */
392  .name = "af-packet-input",
394  .sibling_of = "device-input",
395  .format_trace = format_af_packet_input_trace,
396  .type = VLIB_NODE_TYPE_INPUT,
397  .state = VLIB_NODE_STATE_INTERRUPT,
398  .n_errors = AF_PACKET_INPUT_N_ERROR,
399  .error_strings = af_packet_input_error_strings,
400 };
401 /* *INDENT-ON* */
402 
403 
404 /*
405  * fd.io coding-style-patch-verification: ON
406  *
407  * Local Variables:
408  * eval: (c-set-style "gnu")
409  * End:
410  */
vlib.h
format_af_packet_input_trace
static u8 * format_af_packet_input_trace(u8 *s, va_list *args)
Definition: node.c:58
vlib_buffer_t::next_buffer
u32 next_buffer
Next buffer for this linked-list of buffers.
Definition: buffer.h:149
tcp_header_bytes
static int tcp_header_bytes(tcp_header_t *t)
Definition: tcp_packet.h:93
thread_index
u32 thread_index
Definition: nat44_ei_hairpinning.c:492
frame
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
Definition: nat44_ei.c:3048
af_packet_main
af_packet_main_t af_packet_main
Definition: af_packet.c:39
buffer_add_to_chain
static void buffer_add_to_chain(vlib_main_t *vm, u32 bi, u32 first_bi, u32 prev_bi)
Definition: node.c:94
ip4
vl_api_ip4_address_t ip4
Definition: one.api:376
foreach_af_packet_input_error
#define foreach_af_packet_input_error
Definition: node.c:32
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
af_packet_input_trace_t::block
int block
Definition: node.c:53
af_packet_if_t
Definition: af_packet.h:30
vlib_get_buffer
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:111
ethernet_vlan_header_t
Definition: packet.h:128
af_packet_if_t::hw_if_index
u32 hw_if_index
Definition: af_packet.h:41
tcp_header_t
struct _tcp_header tcp_header_t
AF_PACKET_INPUT_N_ERROR
@ AF_PACKET_INPUT_N_ERROR
Definition: node.c:40
VNET_DEVICE_INPUT_NEXT_DROP
@ VNET_DEVICE_INPUT_NEXT_DROP
Definition: devices.h:29
ip6_ext_header_len
#define ip6_ext_header_len(p)
Definition: ip6_packet.h:545
VLIB_FRAME_SIZE
#define VLIB_FRAME_SIZE
Definition: node.h:368
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
vnet_buffer_offload_flags_set
static_always_inline void vnet_buffer_offload_flags_set(vlib_buffer_t *b, vnet_buffer_oflags_t oflags)
Definition: buffer.h:522
vnet_buffer_oflags_t
vnet_buffer_oflags_t
Definition: buffer.h:118
VLIB_NODE_TYPE_INPUT
@ VLIB_NODE_TYPE_INPUT
Definition: node.h:76
u16
unsigned short u16
Definition: types.h:57
block_size
u16 block_size
Definition: ikev2_types.api:97
ethernet_header_t::type
u16 type
Definition: packet.h:59
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
VLIB_RX
@ VLIB_RX
Definition: defs.h:46
vlib_get_trace_count
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
Definition: trace_funcs.h:212
vnet_buffer2
#define vnet_buffer2(b)
Definition: buffer.h:499
VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT
@ VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT
Definition: devices.h:28
vlib_frame_t
Definition: node.h:372
af_packet_main_t
Definition: af_packet.h:54
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
udp_header_t
Definition: udp_packet.h:45
ip4_header_t
Definition: ip4_packet.h:87
ethernet.h
af_packet_main_t::rx_buffers
u32 ** rx_buffers
Definition: af_packet.h:63
vlib_buffer_t::current_data
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
Definition: buffer.h:119
af_packet_input_trace_t::next_index
u32 next_index
Definition: node.c:51
fill_gso_buffer_flags
static_always_inline void fill_gso_buffer_flags(vlib_buffer_t *b, u32 gso_size, u8 l4_hdr_sz)
Definition: node.c:112
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
packet.h
af_packet_if_t::next_rx_frame
u32 next_rx_frame
Definition: af_packet.h:45
af_packet_if_t::rx_req
struct tpacket_req * rx_req
Definition: af_packet.h:37
VLIB_NODE_FN
#define VLIB_NODE_FN(node)
Definition: node.h:202
feature.h
format_ethernet_vlan_tci
u8 * format_ethernet_vlan_tci(u8 *s, va_list *va)
Definition: format.c:79
vlib_buffer_alloc
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
Definition: buffer_funcs.h:708
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
vnet_buffer
#define vnet_buffer(b)
Definition: buffer.h:437
vec_elt_at_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Definition: vec_bootstrap.h:203
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
af_packet_input_node
vlib_node_registration_t af_packet_input_node
(constructor) VLIB_REGISTER_NODE (af_packet_input_node)
Definition: node.c:391
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
vlib_get_thread_index
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:208
rx_queue_funcs.h
static_always_inline
#define static_always_inline
Definition: clib.h:112
af_packet_main_t::interfaces
af_packet_if_t * interfaces
Definition: af_packet.h:57
uword
u64 uword
Definition: types.h:112
ethernet_header_t
Definition: packet.h:52
vlib_main_t::thread_index
u32 thread_index
Definition: main.h:213
af_packet_if_t::is_admin_up
u8 is_admin_up
Definition: af_packet.h:49
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
VLIB_NODE_FLAG_TRACE_SUPPORTED
#define VLIB_NODE_FLAG_TRACE_SUPPORTED
Definition: node.h:295
af_packet_device_input_fn
static uword af_packet_device_input_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, af_packet_if_t *apif)
Definition: node.c:196
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
VNET_INTERFACE_COUNTER_RX
@ VNET_INTERFACE_COUNTER_RX
Definition: interface.h:914
vlib_set_trace_count
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
Definition: trace_funcs.h:226
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vlib_buffer_t::current_length
u16 current_length
Nbytes between current data and the end of this buffer.
Definition: buffer.h:122
udp_header_t::checksum
u16 checksum
Definition: udp_packet.h:55
ethernet_vlan_header_t::priority_cfi_and_id
u16 priority_cfi_and_id
Definition: packet.h:131
af_packet_input_error_t
af_packet_input_error_t
Definition: node.c:35
vlib_validate_buffer_enqueue_x1
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
Definition: buffer_node.h:224
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
clib_bihash_value
template key/value backing page structure
Definition: bihash_doc.h:44
af_packet_input_trace_t
Definition: node.c:49
format
description fragment has unexpected format
Definition: map.api:433
format_get_indent
static u32 format_get_indent(u8 *s)
Definition: format.h:72
data_len
u8 data_len
Definition: ikev2_types.api:24
vlib_put_next_frame
vlib_put_next_frame(vm, node, next_index, 0)
af_packet_if_t::host_mtu
u32 host_mtu
Definition: af_packet.h:51
vlib_buffer_get_default_data_size
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
Definition: buffer_funcs.h:122
ip.h
ip6_ext_hdr
static u8 ip6_ext_hdr(u8 nexthdr)
Definition: ip6_packet.h:524
u32
unsigned int u32
Definition: types.h:88
ip6
vl_api_ip6_address_t ip6
Definition: one.api:424
af_packet.h
vnet_hw_if_get_rxq_poll_vector
static_always_inline vnet_hw_if_rxq_poll_vector_t * vnet_hw_if_get_rxq_poll_vector(vlib_main_t *vm, vlib_node_runtime_t *node)
Definition: rx_queue_funcs.h:69
ip6_header_t
Definition: ip6_packet.h:294
af_packet_if_t::sw_if_index
u32 sw_if_index
Definition: af_packet.h:42
vlib_main_t
Definition: main.h:102
vlib_node_t
Definition: node.h:247
vlib_add_trace
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace.c:628
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
u8
unsigned char u8
Definition: types.h:56
mark_tcp_udp_cksum_calc
static_always_inline void mark_tcp_udp_cksum_calc(vlib_buffer_t *b, u8 *l4_hdr_sz)
Definition: node.c:120
unix.h
vlib_buffer_get_current
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:257
vnet_feature_start_device_input_x1
static_always_inline void vnet_feature_start_device_input_x1(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
Definition: feature.h:343
ethernet_vlan_header_t::type
u16 type
Definition: packet.h:136
af_packet_input_trace_t::hw_if_index
u32 hw_if_index
Definition: node.c:52
af_packet_if_t::rx_ring
u8 * rx_ring
Definition: af_packet.h:39
ip4_header_bytes
static int ip4_header_bytes(const ip4_header_t *i)
Definition: ip4_packet.h:190
vnet_device_increment_rx_packets
static void vnet_device_increment_rx_packets(u32 thread_index, u64 count)
Definition: devices.h:86
ip6_ext_next_header
static void * ip6_ext_next_header(ip6_ext_header_t *ext_hdr)
Definition: ip6_packet.h:549
vlib_node_runtime_t
Definition: node.h:454
vlib_trace_buffer
static __clib_warn_unused_result int vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
Definition: trace_funcs.h:153
PREDICT_TRUE
#define PREDICT_TRUE(x)
Definition: clib.h:125
vlib_buffer_t::total_length_not_including_first_buffer
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
Definition: buffer.h:176
vlib_get_next_frame
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
Definition: node_funcs.h:395
af_packet_input_trace_t::tph
struct tpacket2_hdr tph
Definition: node.c:54
VLIB_TX
@ VLIB_TX
Definition: defs.h:47
vnet_hw_if_rxq_poll_vector_t::dev_instance
u32 dev_instance
Definition: interface.h:748
af_packet_if_t::per_interface_next_index
u32 per_interface_next_index
Definition: af_packet.h:48
vlib_increment_combined_counter
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
format_white_space
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
vlib_buffer_t::flags
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
Definition: buffer.h:133
af_packet_input_error_strings
static char * af_packet_input_error_strings[]
Definition: node.c:43
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
vnet_hw_if_rxq_poll_vector_t
Definition: interface.h:746
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169