FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
stream.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /*
16  * pg_stream.c: packet generator streams
17  *
18  * Copyright (c) 2008 Eliot Dresselhaus
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining
21  * a copy of this software and associated documentation files (the
22  * "Software"), to deal in the Software without restriction, including
23  * without limitation the rights to use, copy, modify, merge, publish,
24  * distribute, sublicense, and/or sell copies of the Software, and to
25  * permit persons to whom the Software is furnished to do so, subject to
26  * the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be
29  * included in all copies or substantial portions of the Software.
30  *
31  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
35  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
36  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38  */
39 
40 #include <vnet/vnet.h>
41 #include <vnet/pg/pg.h>
42 #include <vnet/ethernet/ethernet.h>
43 #include <vnet/ip/ip.h>
44 #include <vnet/mpls/mpls.h>
45 #include <vnet/devices/devices.h>
46 
47 /* Mark stream active or inactive. */
48 void
49 pg_stream_enable_disable (pg_main_t * pg, pg_stream_t * s, int want_enabled)
50 {
51  vlib_main_t *vm;
52  vnet_main_t *vnm = vnet_get_main ();
54 
55  want_enabled = want_enabled != 0;
56 
57  if (pg_stream_is_enabled (s) == want_enabled)
58  /* No change necessary. */
59  return;
60 
61  if (want_enabled)
62  s->n_packets_generated = 0;
63 
64  /* Toggle enabled flag. */
66 
67  ASSERT (!pool_is_free (pg->streams, s));
68 
72  want_enabled);
73 
74  if (want_enabled)
75  {
78 
81  }
82 
83  if (vlib_num_workers ())
85  else
86  vm = vlib_get_main ();
87 
90  (pg->enabled_streams[s->worker_index]) ?
91  VLIB_NODE_STATE_DISABLED : VLIB_NODE_STATE_POLLING));
92 
93  s->packet_accumulator = 0;
94  s->time_last_generate = 0;
95 }
96 
97 static u8 *
98 format_pg_output_trace (u8 * s, va_list * va)
99 {
100  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*va, vlib_main_t *);
101  CLIB_UNUSED (vlib_node_t * node) = va_arg (*va, vlib_node_t *);
102  pg_output_trace_t *t = va_arg (*va, pg_output_trace_t *);
103  u32 indent = format_get_indent (s);
104 
105  s = format (s, "%Ubuffer 0x%x: %U", format_white_space, indent,
107 
108  s = format (s, "\n%U%U", format_white_space, indent,
110  sizeof (t->buffer.pre_data));
111 
112  return s;
113 }
114 
115 static u8 *
116 format_pg_interface_name (u8 * s, va_list * args)
117 {
118  pg_main_t *pg = &pg_main;
119  u32 if_index = va_arg (*args, u32);
120  pg_interface_t *pi;
121 
122  pi = pool_elt_at_index (pg->interfaces, if_index);
123  s = format (s, "pg%d", pi->id);
124 
125  return s;
126 }
127 
128 static clib_error_t *
130 {
131  u32 hw_flags = 0;
132 
135 
136  vnet_hw_interface_set_flags (vnm, hw_if_index, hw_flags);
137 
138  return 0;
139 }
140 
141 static int
143 {
144  return (!mac_address_cmp (m1, m2));
145 }
146 
147 static clib_error_t *
149  const u8 * address, u8 is_add)
150 {
151  pg_main_t *pg = &pg_main;
152 
154  {
156  pg_interface_t *pi;
157 
158  pi = pool_elt_at_index (pg->interfaces, hi->dev_instance);
159 
161  if (is_add)
163  else
164  {
167  if (~0 != pos)
168  vec_del1 (pi->allowed_mcast_macs, pos);
169  }
170  }
171  return (NULL);
172 }
173 
174 /* *INDENT-OFF* */
176  .name = "pg",
177  .tx_function = pg_output,
178  .format_device_name = format_pg_interface_name,
179  .format_tx_trace = format_pg_output_trace,
180  .admin_up_down_function = pg_interface_admin_up_down,
181  .mac_addr_add_del_function = pg_add_del_mac_address,
182 };
183 /* *INDENT-ON* */
184 
185 static u8 *
188  vnet_link_t link_type, const void *dst_address)
189 {
190  u8 *rewrite = NULL;
191  u16 *h;
192 
193  vec_validate (rewrite, sizeof (*h) - 1);
194  h = (u16 *) rewrite;
195  h[0] = clib_host_to_net_u16 (vnet_link_to_l3_proto (link_type));
196 
197  return (rewrite);
198 }
199 
200 /* *INDENT-OFF* */
201 VNET_HW_INTERFACE_CLASS (pg_interface_class,static) = {
202  .name = "Packet generator",
203  .build_rewrite = pg_build_rewrite,
204 };
205 /* *INDENT-ON* */
206 
207 static u32
209 {
210  /* nothing for now */
211  return 0;
212 }
213 
214 void
216  u32 tx_node_index)
217 {
218  if (enable)
219  {
220  gro_flow_table_init (&pi->flow_table, 1 /* is_l2 */ ,
221  tx_node_index);
222  pi->coalesce_enabled = 1;
223  }
224  else
225  {
226  pi->coalesce_enabled = 0;
228  }
229 }
230 
231 u8 *
232 format_pg_tun_tx_trace (u8 *s, va_list *args)
233 {
234  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
235  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
236 
237  s = format (s, "PG: tunnel (no-encap)");
238  return s;
239 }
240 
241 VNET_HW_INTERFACE_CLASS (pg_tun_hw_interface_class) = {
242  .name = "PG-tun",
243  //.format_header = format_gre_header_with_length,
244  //.unformat_header = unformat_gre_header,
245  .build_rewrite = NULL,
246  //.update_adjacency = gre_update_adj,
248 };
249 
250 u32
251 pg_interface_add_or_get (pg_main_t *pg, uword if_id, u8 gso_enabled,
252  u32 gso_size, u8 coalesce_enabled,
254 {
255  vnet_main_t *vnm = vnet_get_main ();
257  pg_interface_t *pi;
259  uword *p;
260  u32 i;
261 
262  p = hash_get (pg->if_index_by_if_id, if_id);
263 
264  if (p)
265  {
266  return p[0];
267  }
268  else
269  {
270  u8 hw_addr[6];
271  f64 now = vlib_time_now (vm);
272  u32 rnd;
273 
274  pool_get (pg->interfaces, pi);
275  i = pi - pg->interfaces;
276 
277  rnd = (u32) (now * 1e6);
278  rnd = random_u32 (&rnd);
279  clib_memcpy_fast (hw_addr + 2, &rnd, sizeof (rnd));
280  hw_addr[0] = 2;
281  hw_addr[1] = 0xfe;
282 
283  pi->id = if_id;
284  pi->mode = mode;
285 
286  switch (pi->mode)
287  {
288  case PG_MODE_ETHERNET:
289  ethernet_register_interface (vnm, pg_dev_class.index, i, hw_addr,
291  break;
292  case PG_MODE_IP4:
293  case PG_MODE_IP6:
295  vnm, pg_dev_class.index, i, pg_tun_hw_interface_class.index, i);
296  break;
297  }
298  hi = vnet_get_hw_interface (vnm, pi->hw_if_index);
299  if (gso_enabled)
300  {
302  pi->gso_enabled = 1;
303  pi->gso_size = gso_size;
304  if (coalesce_enabled)
305  {
306  pg_interface_enable_disable_coalesce (pi, 1, hi->tx_node_index);
307  }
308  }
309  pi->sw_if_index = hi->sw_if_index;
310 
311  hash_set (pg->if_index_by_if_id, if_id, i);
312 
313  vec_validate (pg->if_id_by_sw_if_index, hi->sw_if_index);
314  pg->if_id_by_sw_if_index[hi->sw_if_index] = i;
315 
316  if (vlib_num_workers ())
317  {
320  *pi->lockp = 0;
321  }
322  }
323 
324  return i;
325 }
326 
327 static void
329  pg_edit_group_t * g, pg_edit_t * e, uword want_commit)
330 {
331  u32 i, i0, i1, mask, n_bits_left;
332  u8 *v, *s, *m;
333 
334  i0 = e->lsb_bit_offset / BITS (u8);
335 
336  /* Make space for edit in value and mask. */
339 
340  if (e->type != PG_EDIT_FIXED)
341  {
342  switch (e->type)
343  {
344  case PG_EDIT_RANDOM:
345  case PG_EDIT_INCREMENT:
347  break;
348 
349  default:
350  break;
351  }
352 
353  if (want_commit)
354  {
356  vec_add1 (g->non_fixed_edits, e[0]);
357  }
358  return;
359  }
360 
361  s = g->fixed_packet_data;
362  m = g->fixed_packet_data_mask;
363 
364  n_bits_left = e->n_bits;
365  i0 = e->lsb_bit_offset / BITS (u8);
366  i1 = e->lsb_bit_offset % BITS (u8);
367 
368  v = e->values[PG_EDIT_LO];
369  i = pg_edit_n_alloc_bytes (e) - 1;
370 
371  /* Odd low order bits?. */
372  if (i1 != 0 && n_bits_left > 0)
373  {
374  u32 n = clib_min (n_bits_left, BITS (u8) - i1);
375 
376  mask = pow2_mask (n) << i1;
377 
378  ASSERT (i0 < vec_len (s));
379  ASSERT (i < vec_len (v));
380  ASSERT ((v[i] & ~mask) == 0);
381 
382  s[i0] |= v[i] & mask;
383  m[i0] |= mask;
384 
385  i0--;
386  i--;
387  n_bits_left -= n;
388  }
389 
390  /* Even bytes. */
391  while (n_bits_left >= 8)
392  {
393  ASSERT (i0 < vec_len (s));
394  ASSERT (i < vec_len (v));
395 
396  s[i0] = v[i];
397  m[i0] = ~0;
398 
399  i0--;
400  i--;
401  n_bits_left -= 8;
402  }
403 
404  /* Odd high order bits. */
405  if (n_bits_left > 0)
406  {
407  mask = pow2_mask (n_bits_left);
408 
409  ASSERT (i0 < vec_len (s));
410  ASSERT (i < vec_len (v));
411  ASSERT ((v[i] & ~mask) == 0);
412 
413  s[i0] |= v[i] & mask;
414  m[i0] |= mask;
415  }
416 
417  if (want_commit)
418  pg_edit_free (e);
419 }
420 
421 void
423  u32 group_index,
424  void *packet_data,
425  void *packet_data_mask)
426 {
427  pg_edit_group_t *g = pg_stream_get_group (s, group_index);
428  pg_edit_t *e;
429 
430  vec_foreach (e, g->edits) do_edit (s, g, e, /* want_commit */ 0);
431 
432  clib_memcpy_fast (packet_data, g->fixed_packet_data,
434  clib_memcpy_fast (packet_data_mask, g->fixed_packet_data_mask,
436 }
437 
438 static void
440 {
441  pg_edit_group_t *g;
442  pg_edit_t *e;
443  word i;
444 
445  for (i = vec_len (s->edit_groups) - 1; i >= 0; i--)
446  {
447  g = vec_elt_at_index (s->edit_groups, i);
448  vec_foreach (e, g->edits) do_edit (s, g, e, /* want_commit */ 1);
449 
450  /* All edits have either been performed or added to
451  g->non_fixed_edits. So, we can delete the vector. */
452  vec_free (g->edits);
453  }
454 
457  vec_foreach (g, s->edit_groups)
458  {
459  int i;
461 
462  /* Relocate and copy non-fixed edits from group to stream. */
465 
466  for (i = 0; i < vec_len (g->non_fixed_edits); i++)
468 
472 
477  }
478 }
479 
480 void
482 {
484  pg_stream_t *s;
485  uword *p;
486 
487  if (!pg->stream_index_by_name)
489  = hash_create_vec (0, sizeof (s->name[0]), sizeof (uword));
490 
491  /* Delete any old stream with the same name. */
492  if (s_init->name
493  && (p = hash_get_mem (pg->stream_index_by_name, s_init->name)))
494  {
495  pg_stream_del (pg, p[0]);
496  }
497 
498  pool_get (pg->streams, s);
499  s[0] = s_init[0];
500 
501  /* Give it a name. */
502  if (!s->name)
503  s->name = format (0, "stream%d", s - pg->streams);
504  else
505  s->name = vec_dup (s->name);
506 
507  hash_set_mem (pg->stream_index_by_name, s->name, s - pg->streams);
508 
509  /* Get fixed part of buffer data. */
510  if (s->edit_groups)
512 
513  /* Determine packet size. */
514  switch (s->packet_size_edit_type)
515  {
516  case PG_EDIT_INCREMENT:
517  case PG_EDIT_RANDOM:
518  if (s->min_packet_bytes == s->max_packet_bytes)
520  break;
521 
522  default:
523  /* Get packet size from fixed edits. */
525  if (!s->replay_packet_templates)
528  break;
529  }
530 
532 
533  {
534  int n;
535 
537  n = s->max_packet_bytes / s->buffer_bytes;
538  n += (s->max_packet_bytes % s->buffer_bytes) != 0;
539 
540  vec_resize (s->buffer_indices, n);
541  }
542 
543  /* Find an interface to use. */
545  pg, s->if_id, 0 /* gso_enabled */, 0 /* gso_size */,
546  0 /* coalesce_enabled */, PG_MODE_ETHERNET);
547 
548  if (s->sw_if_index[VLIB_RX] == ~0)
549  {
551  /*
552  * Default the RX interface if unset. It's a bad mistake to
553  * set [VLIB_TX] prior to ip lookup, since the ip lookup code
554  * interprets [VLIB_TX] as a fib index...
555  */
556  s->sw_if_index[VLIB_RX] = pi->sw_if_index;
557  }
558 
559  /* Connect the graph. */
561  s->node_index);
562 }
563 
564 void
566 {
567  pg_stream_t *s;
568  pg_buffer_index_t *bi;
569 
570  s = pool_elt_at_index (pg->streams, index);
571 
572  pg_stream_enable_disable (pg, s, /* want_enabled */ 0);
574 
575  vec_foreach (bi, s->buffer_indices)
576  {
578  }
579 
580  pg_stream_free (s);
581  pool_put (pg->streams, s);
582 }
583 
584 void
586 {
587  /* Determine packet size. */
588  switch (s->packet_size_edit_type)
589  {
590  case PG_EDIT_INCREMENT:
591  case PG_EDIT_RANDOM:
592  if (s->min_packet_bytes == s->max_packet_bytes)
594  case PG_EDIT_FIXED:
595  break;
596 
597  default:
598  /* Get packet size from fixed edits. */
600  if (!s->replay_packet_templates)
603  break;
604  }
605 
607 }
608 
609 
610 /*
611  * fd.io coding-style-patch-verification: ON
612  *
613  * Local Variables:
614  * eval: (c-set-style "gnu")
615  * End:
616  */
pg_output_trace_t
Definition: pg.h:416
do_edit
static void do_edit(pg_stream_t *stream, pg_edit_group_t *g, pg_edit_t *e, uword want_commit)
Definition: stream.c:328
pg_interface_t::allowed_mcast_macs
mac_address_t * allowed_mcast_macs
Definition: pg.h:328
pg_stream_t::edit_groups
pg_edit_group_t * edit_groups
Definition: pg.h:108
pg_dev_class
vnet_device_class_t pg_dev_class
pg_stream_t::packet_size_edit_type
pg_edit_type_t packet_size_edit_type
Definition: pg.h:110
PG_EDIT_FIXED
@ PG_EDIT_FIXED
Definition: edit.h:52
device_input_node
vlib_node_registration_t device_input_node
(constructor) VLIB_REGISTER_NODE (device_input_node)
Definition: devices.c:32
vlib_num_workers
static u32 vlib_num_workers()
Definition: threads.h:333
pg_interface_admin_up_down
static clib_error_t * pg_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: stream.c:129
vnet_sw_interface_set_flags
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
Definition: interface.c:523
vec_add
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
Definition: vec.h:688
mac
vl_api_mac_address_t mac
Definition: l2.api:559
hash_set
#define hash_set(h, key, value)
Definition: hash.h:255
pg_eth_flag_change
static u32 pg_eth_flag_change(vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 flags)
Definition: stream.c:208
pg_stream_t::min_packet_bytes
u32 min_packet_bytes
Definition: pg.h:113
pg_edit_group_t::start_byte_offset
u32 start_byte_offset
Definition: pg.h:69
pg_buffer_index_t::buffer_fifo
u32 * buffer_fifo
Definition: pg.h:92
vlib_node_add_next
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
Definition: node_funcs.h:1177
pg.h
pow2_mask
static uword pow2_mask(uword x)
Definition: clib.h:252
vlib_node_set_state
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
Definition: node_funcs.h:175
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
pg_interface_t::hw_if_index
u32 hw_if_index
Definition: pg.h:315
pg_stream_t::time_last_generate
f64 time_last_generate
Definition: pg.h:173
format_pg_output_trace
static u8 * format_pg_output_trace(u8 *s, va_list *va)
Definition: stream.c:98
pg_stream_t::fixed_packet_data_mask
u8 * fixed_packet_data_mask
Definition: pg.h:122
vlib_get_worker_vlib_main
static vlib_main_t * vlib_get_worker_vlib_main(u32 worker_index)
Definition: threads.h:474
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
format_pg_tun_tx_trace
u8 * format_pg_tun_tx_trace(u8 *s, va_list *args)
Definition: stream.c:232
u16
unsigned short u16
Definition: types.h:57
hash_set_mem
#define hash_set_mem(h, key, value)
Definition: hash.h:275
mode
vl_api_tunnel_mode_t mode
Definition: gre.api:48
VNET_SW_INTERFACE_FLAG_ADMIN_UP
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
Definition: interface.h:844
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
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
pg_interface_t::coalesce_enabled
u8 coalesce_enabled
Definition: pg.h:320
VNET_HW_INTERFACE_FLAG_LINK_UP
@ VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:509
gro_flow_table_init
static_always_inline u32 gro_flow_table_init(gro_flow_table_t **flow_table, u8 is_l2, u32 node_index)
Definition: gro.h:120
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
mpls.h
mac_address_cmp
static_always_inline int mac_address_cmp(const mac_address_t *a, const mac_address_t *b)
Definition: mac_address.h:134
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
pg_output_trace_t::buffer_index
u32 buffer_index
Definition: pg.h:418
pg_interface_t::flow_table
gro_flow_table_t * flow_table
Definition: pg.h:321
pg_build_rewrite
static u8 * pg_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Definition: stream.c:186
ethernet.h
h
h
Definition: flowhash_template.h:372
VNET_HW_INTERFACE_CLASS
VNET_HW_INTERFACE_CLASS(pg_interface_class, static)
vec_search_with_function
#define vec_search_with_function(v, E, fn)
Search a vector for the index of the entry that matches.
Definition: vec.h:1075
pg_stream_t::node_index
u32 node_index
Definition: pg.h:149
random_u32
static u32 random_u32(u32 *seed)
32-bit random number generator
Definition: random.h:69
pg_edit_group_t::edits
pg_edit_t * edits
Definition: pg.h:59
gro_flow_table_free
static_always_inline void gro_flow_table_free(gro_flow_table_t *flow_table)
Definition: gro.h:171
pg_interface_t::lockp
volatile u32 * lockp
Definition: pg.h:312
pg_interface_t::gso_size
u32 gso_size
Definition: pg.h:323
pg_stream_t::flags
u32 flags
Definition: pg.h:101
pg_edit_group_t
Definition: pg.h:56
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
pg_stream_t::next_index
u32 next_index
Definition: pg.h:155
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
pg_stream_t::max_packet_bytes
u32 max_packet_bytes
Definition: pg.h:113
hash_unset_mem
#define hash_unset_mem(h, key)
Definition: hash.h:291
pg_stream_t::buffer_indices
pg_buffer_index_t * buffer_indices
Definition: pg.h:177
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
vec_dup
#define vec_dup(V)
Return copy of vector (no header, no alignment)
Definition: vec.h:444
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_hw_interface
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface_funcs.h:44
pg_stream_t::sw_if_index
u32 sw_if_index[VLIB_N_RX_TX]
Definition: pg.h:146
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
pg_stream_t::n_packets_generated
u64 n_packets_generated
Definition: pg.h:160
pg_stream_free
static void pg_stream_free(pg_stream_t *s)
Definition: pg.h:202
pg_edit_t::last_increment_value
u64 last_increment_value
Definition: edit.h:87
pg_edit_n_alloc_bytes
static uword pg_edit_n_alloc_bytes(pg_edit_t *e)
Definition: edit.h:120
PG_EDIT_LO
#define PG_EDIT_LO
Definition: edit.h:83
VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO
Definition: interface.h:537
format_pg_interface_name
static u8 * format_pg_interface_name(u8 *s, va_list *args)
Definition: stream.c:116
hash_get
#define hash_get(h, key)
Definition: hash.h:249
BITS
#define BITS(x)
Definition: clib.h:69
pg_edit_t::type
pg_edit_type_t type
Definition: edit.h:66
pg_edit_t::n_bits
u32 n_bits
Definition: edit.h:79
pg_stream_t::if_id
u32 if_id
Definition: pg.h:157
pool_is_free
#define pool_is_free(P, E)
Use free bitmap to query whether given element is free.
Definition: pool.h:294
uword
u64 uword
Definition: types.h:112
f64
double f64
Definition: types.h:142
mask
vl_api_pnat_mask_t mask
Definition: pnat.api:45
pg_edit_get_value
static u64 pg_edit_get_value(pg_edit_t *e, int hi_or_lo)
Definition: edit.h:173
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
address
manual_print typedef address
Definition: ip_types.api:96
PG_STREAM_FLAGS_IS_ENABLED
#define PG_STREAM_FLAGS_IS_ENABLED
Definition: pg.h:104
format_vnet_buffer_no_chain
format_function_t format_vnet_buffer_no_chain
Definition: buffer.h:520
pg_output_trace_t::buffer
vlib_buffer_t buffer
Definition: pg.h:419
pg_interface_t::gso_enabled
u8 gso_enabled
Definition: pg.h:322
clib_bitmap_set
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
Definition: bitmap.h:167
clib_min
#define clib_min(x, y)
Definition: clib.h:342
pg_stream_get_group
static pg_edit_group_t * pg_stream_get_group(pg_stream_t *s, u32 group_index)
Definition: pg.h:233
pg_main_t::if_index_by_if_id
uword * if_index_by_if_id
Definition: pg.h:351
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:58
pg_interface_t::mode
pg_interface_mode_t mode
Definition: pg.h:326
pg_main_t::if_id_by_sw_if_index
uword * if_id_by_sw_if_index
Definition: pg.h:352
pg_output
vlib_node_function_t pg_output
Definition: pg.h:370
PG_MODE_ETHERNET
@ PG_MODE_ETHERNET
Definition: pg.h:304
PG_MODE_IP4
@ PG_MODE_IP4
Definition: pg.h:305
pg_stream_t::packet_accumulator
f64 packet_accumulator
Definition: pg.h:175
pg_interface_mode_t
enum pg_interface_mode_t_ pg_interface_mode_t
hash_create_vec
#define hash_create_vec(elts, key_bytes, value_bytes)
Definition: hash.h:667
hash_get_mem
#define hash_get_mem(h, key)
Definition: hash.h:269
vnet_hw_interface_t
Definition: interface.h:638
vnet_main_t
Definition: vnet.h:76
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
index
u32 index
Definition: flow_types.api:221
pg_main_t::interfaces
pg_interface_t * interfaces
Definition: pg.h:350
pg_stream_t::worker_index
u32 worker_index
Definition: pg.h:152
pg_stream_t::name
u8 * name
Definition: pg.h:99
pg_main_t::stream_index_by_name
uword * stream_index_by_name
Definition: pg.h:347
pg_main_t
Definition: pg.h:338
pg_edit_group_t::non_fixed_edits
pg_edit_t * non_fixed_edits
Definition: pg.h:62
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
format_get_indent
static u32 format_get_indent(u8 *s)
Definition: format.h:72
ethernet_address_cast
static uword ethernet_address_cast(const u8 *a)
Definition: packet.h:67
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
u32
unsigned int u32
Definition: types.h:88
format_ethernet_header_with_length
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
Definition: format.c:97
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
pg_interface_t::id
u32 id
Definition: pg.h:318
pg_edit_group_get_fixed_packet_data
void pg_edit_group_get_fixed_packet_data(pg_stream_t *s, u32 group_index, void *packet_data, void *packet_data_mask)
Definition: stream.c:422
vec_resize
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V,...
Definition: vec.h:296
pg_mac_address_cmp
static int pg_mac_address_cmp(const mac_address_t *m1, const mac_address_t *m2)
Definition: stream.c:142
pg_edit_group_t::fixed_packet_data
u8 * fixed_packet_data
Definition: pg.h:65
mac_address_t_
Definition: mac_address.h:21
now
f64 now
Definition: nat44_ei_out2in.c:710
pg_interface_add_or_get
u32 pg_interface_add_or_get(pg_main_t *pg, uword if_id, u8 gso_enabled, u32 gso_size, u8 coalesce_enabled, pg_interface_mode_t mode)
Definition: stream.c:251
pg_stream_t::last_increment_packet_size
u32 last_increment_packet_size
Definition: pg.h:135
vlib_main_t
Definition: main.h:102
vnet_link_t
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
vnet_link_to_l3_proto
vnet_l3_packet_type_t vnet_link_to_l3_proto(vnet_link_t link)
Convert a link to to an Ethertype.
Definition: interface.c:1719
vlib_node_t
Definition: node.h:247
pg_stream_del
void pg_stream_del(pg_main_t *pg, uword index)
Definition: stream.c:565
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
pg_main_t::enabled_streams
uword ** enabled_streams
Definition: pg.h:344
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vnet_hw_interface_set_flags
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
Definition: interface.c:513
pg_interface_enable_disable_coalesce
void pg_interface_enable_disable_coalesce(pg_interface_t *pi, u8 enable, u32 tx_node_index)
Definition: stream.c:215
PG_MODE_IP6
@ PG_MODE_IP6
Definition: pg.h:306
pg_stream_enable_disable
void pg_stream_enable_disable(pg_main_t *pg, pg_stream_t *s, int want_enabled)
Definition: stream.c:49
pg_add_del_mac_address
static clib_error_t * pg_add_del_mac_address(vnet_hw_interface_t *hi, const u8 *address, u8 is_add)
Definition: stream.c:148
pg_stream_t::non_fixed_edits
pg_edit_t * non_fixed_edits
Definition: pg.h:117
i
int i
Definition: flowhash_template.h:376
PG_EDIT_RANDOM
@ PG_EDIT_RANDOM
Definition: edit.h:58
pg_buffer_index_t
Definition: pg.h:86
pg_stream_t::replay_packet_templates
u8 ** replay_packet_templates
Definition: pg.h:179
pg_edit_free
static void pg_edit_free(pg_edit_t *e)
Definition: edit.h:91
VNET_HW_INTERFACE_CLASS_FLAG_P2P
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
Definition: interface.h:394
word
i64 word
Definition: types.h:111
devices.h
clib_mem_alloc_aligned
static void * clib_mem_alloc_aligned(uword size, uword align)
Definition: mem.h:264
pg_edit_t
Definition: edit.h:64
pg_main_t::streams
pg_stream_t * streams
Definition: pg.h:341
perform_fixed_edits
static void perform_fixed_edits(pg_stream_t *s)
Definition: stream.c:439
pg_stream_t
Definition: pg.h:96
vlib_time_now
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:327
pg_stream_add
void pg_stream_add(pg_main_t *pg, pg_stream_t *s_init)
Definition: stream.c:481
vlib_buffer_t::pre_data
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
Definition: buffer.h:201
vnet.h
clib_fifo_free
#define clib_fifo_free(f)
Definition: fifo.h:257
pg_stream_change
void pg_stream_change(pg_main_t *pg, pg_stream_t *s)
Definition: stream.c:585
pg_input_node
vlib_node_registration_t pg_input_node
(constructor) VLIB_REGISTER_NODE (pg_input_node)
Definition: input.c:1826
pg_interface_t
Definition: pg.h:309
pg_edit_group_t::fixed_packet_data_mask
u8 * fixed_packet_data_mask
Definition: pg.h:66
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
rewrite
rewrite
Definition: pnat.api:158
pg_stream_t::buffer_bytes
u32 buffer_bytes
Definition: pg.h:126
VNET_DEVICE_CLASS
VNET_DEVICE_CLASS(pg_dev_class)
pg_edit_t::lsb_bit_offset
i32 lsb_bit_offset
Definition: edit.h:73
pg_stream_t::pg_if_index
u32 pg_if_index
Definition: pg.h:138
PG_EDIT_INVALID_TYPE
@ PG_EDIT_INVALID_TYPE
Definition: edit.h:49
clib_bitmap_is_zero
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
Definition: bitmap.h:57
vnet_register_interface
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
Definition: interface.c:812
ethernet_register_interface
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
Definition: interface.c:348
vec_del1
#define vec_del1(v, i)
Delete the element at index I.
Definition: vec.h:896
pg_stream_is_enabled
static int pg_stream_is_enabled(pg_stream_t *s)
Definition: pg.h:227
pg_interface_t::sw_if_index
u32 sw_if_index
Definition: pg.h:315
format_white_space
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
pg_stream_t::fixed_packet_data
u8 * fixed_packet_data
Definition: pg.h:122
mac_address_from_bytes
static_always_inline void mac_address_from_bytes(mac_address_t *mac, const u8 *bytes)
Definition: mac_address.h:92
PG_EDIT_INCREMENT
@ PG_EDIT_INCREMENT
Definition: edit.h:55
pg_main
pg_main_t pg_main
Definition: init.c:44
pg_edit_t::values
u8 * values[2]
Definition: edit.h:82
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105