FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ioam_cache.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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 #ifndef __included_ioam_cache_h__
16 #define __included_ioam_cache_h__
17 
18 #include <vnet/vnet.h>
19 #include <vnet/ip/ip.h>
20 #include <vnet/ip/ip_packet.h>
21 #include <vnet/ip/ip4_packet.h>
22 #include <vnet/ip/ip6_packet.h>
23 #include <vnet/srv6/sr.h>
24 
25 #include <vppinfra/pool.h>
26 #include <vppinfra/hash.h>
27 #include <vppinfra/error.h>
28 #include <vppinfra/elog.h>
29 #include <vppinfra/bihash_8_8.h>
32 /*
33  * ioam_cache.h
34  * This header contains routines for caching of ioam header and
35  * buffer:
36  * 1 - On application facing node: to cache ioam header recvd
37  * in request and reattach in response to provide round
38  * trip path visibility. Since request response matching
39  * is needed works with TCP and relies on (5 tuples,seq no)
40  * 2 - On M-Anycast server node: This node replicates requests
41  * towards multiple anycast service nodes serving anycast
42  * IP6 address. It evaluates response and forwards the best
43  * response towards the client of requesting the service.
44  * Again since request-response matching is needed, works
45  * with TCP and relies on (5 tuples,seq no) for matching.
46  * To do this it caches SYN-ACK responses for a short time to
47  * evaluate multiple responses received before the selected
48  * SYN-ACK response is forwared and others dropped.
49  *
50  * M-Anycast server cache:
51  * - There is a pool of cache entries per worker thread.
52  * - Cache entry is created when SYN is received expected
53  * number of responses are marked based on number of
54  * SR tunnels for the anycast destination address
55  * - The pool/thread id and pool index are attached in the
56  * message as an ioam option for quick look up.
57  * - When is received SYN-ACK the ioam option containing
58  * thread id + pool index of the cache entry is used to
59  * look up cache entry.
60  * - Cache synchronization:
61  * - This is achieved by cache entry add/del/update all handled
62  * by the same worker/main thread
63  * - Packets from client to threads - syn packets, can be disctributed
64  * based on incoming interface affinity to the cpu core pinned to
65  * the thread or a simple sequence number based distribution
66  * if thread per interface is not scaling
67  * - Response packets from server towards clients - syn-acks, are
68  * forced to the same thread that created the cache entry
69  * using SR and the destination of SR v6 address assigned
70  * to the core/thread. This adderss is sent as an ioam option
71  * in the syn that can be then used on the other side to
72  * populate v6 dst address in the response
73  * - Timeout: timer wheel per thread is used to track the syn-ack wait
74  * time. The timer wheel tick is updated via an input node per thread.
75  *
76  * Application facing node/Service side cache:
77  * - Single pool of cache entries.
78  * - Cache entry is created when SYN is received. Caches the ioam
79  * header. Hash table entry is created based on 5 tuple and
80  * TCP seq no to pool index
81  * - Response SYN-ACK processed by looking up pool index in hash table
82  * and cache entry in the pool is used to get the ioam header rewrite
83  * string. Entry is freed from pool and hash table after use.
84  * - Locking/Synchronization: Currently this functionality is deployed
85  * with main/single thread only. Hence no locking is used.
86  * - Deployment: A VPP node per application server servicing anycast
87  * address is expected. Locking/synchronization needed when the server
88  * /application facing node is started with multiple worker threads.
89  *
90  */
91 
92 /*
93  * Application facing server side caching:
94  * Cache entry for ioam header
95  * Currently caters to TCP and relies on
96  * TCP - 5 tuples + seqno to cache and reinsert
97  * ioam header b/n TCP request response
98  */
99 typedef struct
100 {
101  /** Required for pool_get_aligned */
102  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
103  ip6_address_t src_address;
104  ip6_address_t dst_address;
109  ip6_address_t next_hop;
113 
114 /*
115  * Cache entry for anycast server selection
116  * Works for TCP as 5 tuple + sequence number
117  * is required for request response matching
118  * max_responses expected is set based on number
119  * of SR tunnels for the dst_address
120  * Timeout or all response_received = max_responses
121  * will clear the entry
122  * buffer_index index of the response msg vlib buffer
123  * that is currently the best response
124  */
125 typedef struct
126 {
127  /** Required for pool_get_aligned */
128  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
131  ip6_address_t src_address;
132  ip6_address_t dst_address;
138  ip6_hop_by_hop_header_t *hbh; //pointer to hbh header in the buffer
143  /** Handle returned from tw_start_timer */
145  /** entry should expire at this clock tick */
148 
149 /*
150  * Per thread tunnel selection cache stats
151  */
152 typedef struct
153 {
157 
158 /* Server side: iOAM header caching */
159 #define MAX_CACHE_ENTRIES 4096
160 /* M-Anycast: Cache for SR tunnel selection */
161 #define MAX_CACHE_TS_ENTRIES 1048576
162 
163 #define IOAM_CACHE_TABLE_DEFAULT_HASH_NUM_BUCKETS (4 * 1024)
164 #define IOAM_CACHE_TABLE_DEFAULT_HASH_MEMORY_SIZE (2<<20)
165 
166 typedef struct
167 {
168  /* API message ID base */
170 
171  /* Pool of ioam_cache_buffer_t */
173 
174  /* For steering packets ioam cache entry is followed by
175  * SR header. This is the SR rewrite template */
177  /* The current rewrite string being used */
180  ip6_address_t sr_localsid_cache;
181 
184  clib_bihash_8_8_t ioam_rewrite_cache_table;
185 
186  /* M-Anycast: Pool of ioam_cache_ts_entry_t per thread */
189  /** per thread single-wheel */
190  tw_timer_wheel_16t_2w_512sl_t *timer_wheels;
191 
192  /*
193  * Selection criteria: oneway delay: Server to M-Anycast
194  * or RTT
195  */
198  ip6_address_t sr_localsid_ts;
199 
200  /* convenience */
202 
208 
212 
214 
217 
218 /* Compute flow hash. We'll use it to select which Sponge to use for this
219  * flow. And other things.
220  * ip6_compute_flow_hash in ip6.h doesnt locate tcp/udp when
221  * ext headers are present. While it could be made to it will be a
222  * performance hit for ECMP flows.
223  * HEnce this function here, with L4 information directly input
224  * Useful when tcp/udp headers are already located in presence of
225  * ext headers
226  */
229  u8 protocol,
230  u16 src_port,
231  u16 dst_port, flow_hash_config_t flow_hash_config)
232 {
233  u64 a, b, c;
234  u64 t1, t2;
235 
236  t1 = (ip->src_address.as_u64[0] ^ ip->src_address.as_u64[1]);
237  t1 = (flow_hash_config & IP_FLOW_HASH_SRC_ADDR) ? t1 : 0;
238 
239  t2 = (ip->dst_address.as_u64[0] ^ ip->dst_address.as_u64[1]);
240  t2 = (flow_hash_config & IP_FLOW_HASH_DST_ADDR) ? t2 : 0;
241 
242  a = (flow_hash_config & IP_FLOW_HASH_REVERSE_SRC_DST) ? t2 : t1;
243  b = (flow_hash_config & IP_FLOW_HASH_REVERSE_SRC_DST) ? t1 : t2;
244  b ^= (flow_hash_config & IP_FLOW_HASH_PROTO) ? protocol : 0;
245 
246  t1 = src_port;
247  t2 = dst_port;
248 
249  t1 = (flow_hash_config & IP_FLOW_HASH_SRC_PORT) ? t1 : 0;
250  t2 = (flow_hash_config & IP_FLOW_HASH_DST_PORT) ? t2 : 0;
251 
252  c = (flow_hash_config & IP_FLOW_HASH_REVERSE_SRC_DST) ?
253  ((t1 << 16) | t2) : ((t2 << 16) | t1);
254 
255  hash_mix64 (a, b, c);
256  return (u32) c;
257 }
258 
259 
260 /* 2 new ioam E2E options :
261  * 1. HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE_ID: IP6 address
262  * of ioam node that inserted ioam header
263  * 2. HBH_OPTION_TYPE_IOAM_E2E_CACHE_ID: Pool id and index
264  * to look up tunnel select cache entry
265  */
266 #define HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE_ID 30
267 #define HBH_OPTION_TYPE_IOAM_E2E_CACHE_ID 31
268 
269 typedef CLIB_PACKED (struct
270  {
271  ip6_hop_by_hop_option_t hdr; u8 e2e_type; u8 reserved[5];
272  ip6_address_t id;
273  }) ioam_e2e_id_option_t;
274 
275 typedef CLIB_PACKED (struct
276  {
277  ip6_hop_by_hop_option_t hdr; u8 e2e_type; u8 pool_id;
278  u32 pool_index;
279  }) ioam_e2e_cache_option_t;
280 
281 #define IOAM_E2E_ID_OPTION_RND ((sizeof(ioam_e2e_id_option_t) + 7) & ~7)
282 #define IOAM_E2E_ID_HBH_EXT_LEN (IOAM_E2E_ID_OPTION_RND >> 3)
283 #define IOAM_E2E_CACHE_OPTION_RND ((sizeof(ioam_e2e_cache_option_t) + 7) & ~7)
284 #define IOAM_E2E_CACHE_HBH_EXT_LEN (IOAM_E2E_CACHE_OPTION_RND >> 3)
285 
286 static inline void
287 ioam_e2e_id_rewrite_handler (ioam_e2e_id_option_t * e2e_option,
288  ip6_address_t * address)
289 {
290  e2e_option->id.as_u64[0] = address->as_u64[0];
291  e2e_option->id.as_u64[1] = address->as_u64[1];
292 
293 }
294 
295 /* Following functions are for the caching of ioam header
296  * to enable reattaching it for a complete request-response
297  * message exchange */
298 inline static void
300 {
302  if (entry)
303  {
304  vec_free (entry->ioam_rewrite_string);
305  clib_memset (entry, 0, sizeof (*entry));
306  pool_put (cm->ioam_rewrite_pool, entry);
307  }
308 }
309 
310 inline static ioam_cache_entry_t *
312 {
314  ioam_cache_entry_t *entry = 0;
315 
316  entry = pool_elt_at_index (cm->ioam_rewrite_pool, pool_index);
317  ioam_cache_entry_free (entry);
318  return (0);
319 }
320 
321 inline static ioam_cache_entry_t *
323 {
325  u32 flow_hash = ip6_compute_flow_hash_ext (ip0, ip0->protocol,
328  IP_FLOW_HASH_REVERSE_SRC_DST);
330 
331  kv.key = (u64) flow_hash << 32 | seq_no;
332  kv.value = 0;
333  value.key = 0;
334  value.value = 0;
335 
336  if (clib_bihash_search_8_8 (&cm->ioam_rewrite_cache_table, &kv, &value) >=
337  0)
338  {
339  ioam_cache_entry_t *entry = 0;
340 
341  entry = pool_elt_at_index (cm->ioam_rewrite_pool, value.value);
342  /* match */
343  if (ip6_address_compare (&ip0->src_address, &entry->dst_address) == 0 &&
344  ip6_address_compare (&ip0->dst_address, &entry->src_address) == 0 &&
345  entry->src_port == dst_port &&
346  entry->dst_port == src_port && entry->seq_no == seq_no)
347  {
348  /* If lookup is successful remove it from the hash */
349  clib_bihash_add_del_8_8 (&cm->ioam_rewrite_cache_table, &kv, 0);
350  return (entry);
351  }
352  else
353  return (0);
354 
355  }
356  return (0);
357 }
358 
359 /*
360  * Caches ioam hbh header
361  * Extends the hbh header with option to contain IP6 address of the node
362  * that caches it
363  */
364 inline static int
366  ip6_header_t * ip0,
367  u16 src_port,
368  u16 dst_port, ip6_hop_by_hop_header_t * hbh0, u32 seq_no)
369 {
371  ioam_cache_entry_t *entry = 0;
372  u32 rewrite_len = 0, e2e_id_offset = 0;
373  u32 pool_index = 0;
374  ioam_e2e_id_option_t *e2e = 0;
375 
376  pool_get_aligned (cm->ioam_rewrite_pool, entry, CLIB_CACHE_LINE_BYTES);
377  clib_memset (entry, 0, sizeof (*entry));
378  pool_index = entry - cm->ioam_rewrite_pool;
379 
380  clib_memcpy_fast (entry->dst_address.as_u64, ip0->dst_address.as_u64,
381  sizeof (ip6_address_t));
382  clib_memcpy_fast (entry->src_address.as_u64, ip0->src_address.as_u64,
383  sizeof (ip6_address_t));
384  entry->src_port = src_port;
385  entry->dst_port = dst_port;
386  entry->seq_no = seq_no;
387  rewrite_len = ((hbh0->length + 1) << 3);
388  vec_validate (entry->ioam_rewrite_string, rewrite_len - 1);
390  if (e2e)
391  {
392  entry->next_hop.as_u64[0] = e2e->id.as_u64[0];
393  entry->next_hop.as_u64[1] = e2e->id.as_u64[1];
394  }
395  else
396  {
397  return (-1);
398  }
399  e2e_id_offset = (u8 *) e2e - (u8 *) hbh0;
400  /* setup e2e id option to insert v6 address of the node caching it */
401  clib_memcpy_fast (entry->ioam_rewrite_string, hbh0, rewrite_len);
403 
404  /* suffix rewrite string with e2e ID option */
405  e2e = (ioam_e2e_id_option_t *) (entry->ioam_rewrite_string + e2e_id_offset);
406  ioam_e2e_id_rewrite_handler (e2e, &cm->sr_localsid_cache);
407  entry->my_address_offset = (u8 *) (&e2e->id) - (u8 *) hbh0;
408 
409  /* add it to hash, replacing and freeing any collision for now */
410  u32 flow_hash =
414  kv.key = (u64) flow_hash << 32 | seq_no;
415  kv.value = 0;
416  if (clib_bihash_search_8_8 (&cm->ioam_rewrite_cache_table, &kv, &value) >=
417  0)
418  {
419  /* replace */
421  }
422  kv.value = pool_index;
423  clib_bihash_add_del_8_8 (&cm->ioam_rewrite_cache_table, &kv, 1);
424  return (0);
425 }
426 
427 /* Creates SR rewrite string
428  * This is appended with ioam header on the server facing
429  * node.
430  * This SR header is necessary to attract packets towards
431  * selected Anycast server.
432  */
433 inline static void
435 {
437  ip6_address_t *segments = 0;
438  ip6_address_t *this_seg = 0;
439 
440  /* This nodes address and the original dest will be
441  * filled when the packet is processed */
442  vec_add2 (segments, this_seg, 1);
443  clib_memset (this_seg, 0xfe, sizeof (ip6_address_t));
444  cm->sr_rewrite_template = ip6_sr_compute_rewrite_string_insert (segments);
445  vec_free (segments);
446 }
447 
448 inline static int
450 {
452 
453  pool_alloc_aligned (cm->ioam_rewrite_pool,
455  cm->lookup_table_nbuckets = IOAM_CACHE_TABLE_DEFAULT_HASH_NUM_BUCKETS;
456  cm->lookup_table_nbuckets = 1 << max_log2 (cm->lookup_table_nbuckets);
457  cm->lookup_table_size = IOAM_CACHE_TABLE_DEFAULT_HASH_MEMORY_SIZE;
458 
459  clib_bihash_init_8_8 (&cm->ioam_rewrite_cache_table,
460  "ioam rewrite cache table",
461  cm->lookup_table_nbuckets, cm->lookup_table_size);
462  /* Create SR rewrite template */
464  return (1);
465 }
466 
467 inline static int
469 {
471  ioam_cache_entry_t *entry = 0;
472  /* free pool and hash table */
473  clib_bihash_free_8_8 (&cm->ioam_rewrite_cache_table);
474  pool_foreach (entry, cm->ioam_rewrite_pool)
475  {
476  ioam_cache_entry_free (entry);
477  }
478  pool_free (cm->ioam_rewrite_pool);
479  cm->ioam_rewrite_pool = 0;
480  vec_free (cm->sr_rewrite_template);
481  cm->sr_rewrite_template = 0;
482  return (0);
483 }
484 
485 inline static u8 *
486 format_ioam_cache_entry (u8 * s, va_list * args)
487 {
488  ioam_cache_entry_t *e = va_arg (*args, ioam_cache_entry_t *);
490  int rewrite_len = vec_len (e->ioam_rewrite_string);
491 
492  s = format (s, "%d: %U:%d to %U:%d seq_no %lu\n",
493  (e - cm->ioam_rewrite_pool),
495  e->src_port,
497 
498  if (rewrite_len)
499  {
500  s = format (s, " %U",
503  rewrite_len - 1);
504  }
505  return s;
506 }
507 
509 
510 #define IOAM_CACHE_TS_TIMEOUT 1.0 //SYN timeout 1 sec
511 #define IOAM_CACHE_TS_TICK 100e-3
512 /* Timer delays as multiples of 100ms */
513 #define IOAM_CACHE_TS_TIMEOUT_TICKS IOAM_CACHE_TS_TICK*9
514 #define TIMER_HANDLE_INVALID ((u32) ~0)
515 
516 
517 void expired_cache_ts_timer_callback (u32 * expired_timers);
518 
519 /*
520  * Following functions are to manage M-Anycast server selection
521  * cache
522  * There is a per worker thread pool to create a cache entry
523  * for a TCP SYN received. TCP SYN-ACK contians ioam header
524  * with HBH_OPTION_TYPE_IOAM_E2E_CACHE_ID option to point to the
525  * entry.
526  */
527 inline static int
529 {
531  int no_of_threads = vec_len (vlib_worker_threads);
532  int i;
533 
534  vec_validate_aligned (cm->ioam_ts_pool, no_of_threads - 1,
536  vec_validate_aligned (cm->ts_stats, no_of_threads - 1,
538  vec_validate (cm->timer_wheels, no_of_threads - 1);
539  cm->lookup_table_nbuckets = IOAM_CACHE_TABLE_DEFAULT_HASH_NUM_BUCKETS;
540  cm->lookup_table_nbuckets = 1 << max_log2 (cm->lookup_table_nbuckets);
541  cm->lookup_table_size = IOAM_CACHE_TABLE_DEFAULT_HASH_MEMORY_SIZE;
542  for (i = 0; i < no_of_threads; i++)
543  {
544  pool_alloc_aligned (cm->ioam_ts_pool[i],
546  clib_memset (&cm->ts_stats[i], 0, sizeof (ioam_cache_ts_pool_stats_t));
547  tw_timer_wheel_init_16t_2w_512sl (&cm->timer_wheels[i],
550  /* timer period 100ms */ ,
551  10e4);
552  cm->timer_wheels[i].last_run_time = vlib_time_now (vm);
553  }
555  return (1);
556 }
557 
558 always_inline void
561 {
562  entry->timer_handle
563  = tw_timer_start_16t_2w_512sl (&cm->timer_wheels[entry->pool_id],
564  entry->pool_index, 1, interval);
565 }
566 
567 always_inline void
569  ioam_cache_ts_entry_t * entry)
570 {
571  tw_timer_stop_16t_2w_512sl (&cm->timer_wheels[entry->pool_id],
572  entry->timer_handle);
574 }
575 
576 inline static void
579 {
581  vlib_main_t *vm = cm->vlib_main;
582  vlib_frame_t *nf = 0;
583  u32 *to_next;
584 
585  if (entry)
586  {
587  if (entry->hbh != 0)
588  {
590  nf->n_vectors = 0;
591  to_next = vlib_frame_vector_args (nf);
592  nf->n_vectors = 1;
593  to_next[0] = entry->buffer_index;
595  }
596  pool_put (cm->ioam_ts_pool[thread_id], entry);
597  cm->ts_stats[thread_id].inuse--;
598  clib_memset (entry, 0, sizeof (*entry));
599  }
600 }
601 
602 inline static int
604 {
606  ioam_cache_ts_entry_t *entry = 0;
607  int no_of_threads = vec_len (vlib_worker_threads);
608  int i;
609 
610  /* free pool and hash table */
611  for (i = 0; i < no_of_threads; i++)
612  {
613  pool_foreach (entry, cm->ioam_ts_pool[i])
614  {
615  ioam_cache_ts_entry_free (i, entry, cm->error_node_index);
616  }
617  pool_free (cm->ioam_ts_pool[i]);
618  cm->ioam_ts_pool = 0;
619  tw_timer_wheel_free_16t_2w_512sl (&cm->timer_wheels[i]);
620  }
621  vec_free (cm->ioam_ts_pool);
622  return (0);
623 }
624 
625 inline static int
626 ioam_cache_ts_entry_cleanup (u32 thread_id, u32 pool_index)
627 {
629  ioam_cache_ts_entry_t *entry = 0;
630 
631  entry = pool_elt_at_index (cm->ioam_ts_pool[thread_id], pool_index);
632  ioam_cache_ts_entry_free (thread_id, entry, cm->error_node_index);
633  return (0);
634 }
635 
636 /*
637  * Caches buffer for ioam SR tunnel select for Anycast service
638  */
639 inline static int
641  u16 src_port,
642  u16 dst_port,
643  u32 seq_no,
644  u8 max_responses, u64 now, u32 thread_id, u32 * pool_index)
645 {
647  ioam_cache_ts_entry_t *entry = 0;
648 
649  if (cm->ts_stats[thread_id].inuse == MAX_CACHE_TS_ENTRIES)
650  {
651  cm->ts_stats[thread_id].add_failed++;
652  return (-1);
653  }
654 
655  pool_get_aligned (cm->ioam_ts_pool[thread_id], entry,
657  clib_memset (entry, 0, sizeof (*entry));
658  *pool_index = entry - cm->ioam_ts_pool[thread_id];
659 
660  clib_memcpy_fast (entry->dst_address.as_u64, ip0->dst_address.as_u64,
661  sizeof (ip6_address_t));
662  clib_memcpy_fast (entry->src_address.as_u64, ip0->src_address.as_u64,
663  sizeof (ip6_address_t));
664  entry->src_port = src_port;
665  entry->dst_port = dst_port;
666  entry->seq_no = seq_no;
667  entry->response_received = 0;
668  entry->max_responses = max_responses;
669  entry->created_at = now;
670  entry->hbh = 0;
671  entry->buffer_index = 0;
672  entry->pool_id = thread_id;
673  entry->pool_index = *pool_index;
675  cm->ts_stats[thread_id].inuse++;
676  return (0);
677 }
678 
679 inline static void
680 ioam_cache_ts_send (u32 thread_id, i32 pool_index)
681 {
683  ioam_cache_ts_entry_t *entry = 0;
684 
685  entry = pool_elt_at_index (cm->ioam_ts_pool[thread_id], pool_index);
686  if (!pool_is_free (cm->ioam_ts_pool[thread_id], entry) && entry)
687  {
688  /* send and free pool entry */
689  ioam_cache_ts_entry_free (thread_id, entry, cm->ip6_hbh_pop_node_index);
690  }
691 }
692 
693 inline static void
694 ioam_cache_ts_check_and_send (u32 thread_id, i32 pool_index)
695 {
697  ioam_cache_ts_entry_t *entry = 0;
698  entry = pool_elt_at_index (cm->ioam_ts_pool[thread_id], pool_index);
699  if (entry && entry->hbh)
700  {
701  if (entry->response_received == entry->max_responses ||
703  vlib_time_now (cm->vlib_main))
704  {
705  ioam_cache_ts_timer_reset (cm, entry);
706  ioam_cache_ts_send (thread_id, pool_index);
707  }
708  }
709 }
710 
711 inline static int
713  i32 pool_index,
714  u32 buffer_index, ip6_hop_by_hop_header_t * hbh)
715 {
717  ioam_cache_ts_entry_t *entry = 0;
718  vlib_main_t *vm = cm->vlib_main;
719  vlib_frame_t *nf = 0;
720  u32 *to_next;
721 
722  entry = pool_elt_at_index (cm->ioam_ts_pool[thread_id], pool_index);
723  if (!pool_is_free (cm->ioam_ts_pool[thread_id], entry) && entry)
724  {
725  /* drop existing buffer */
726  if (entry->hbh != 0)
727  {
728  nf = vlib_get_frame_to_node (vm, cm->error_node_index);
729  nf->n_vectors = 0;
730  to_next = vlib_frame_vector_args (nf);
731  nf->n_vectors = 1;
732  to_next[0] = entry->buffer_index;
733  vlib_put_frame_to_node (vm, cm->error_node_index, nf);
734  }
735  /* update */
736  entry->buffer_index = buffer_index;
737  entry->hbh = hbh;
738  /* check and send */
739  ioam_cache_ts_check_and_send (thread_id, pool_index);
740  return (0);
741  }
742  return (-1);
743 }
744 
745 /*
746  * looks up the entry based on the e2e option pool index
747  * result = 0 found the entry
748  * result < 0 indicates failture to find an entry
749  */
750 inline static int
752  u8 protocol,
753  u16 src_port,
754  u16 dst_port,
755  u32 seq_no,
757  u32 * pool_index, u8 * thread_id, u8 response_seen)
758 {
760  ip6_hop_by_hop_header_t *hbh0 = 0;
761  ioam_e2e_cache_option_t *e2e = 0;
762 
763  hbh0 = (ip6_hop_by_hop_header_t *) (ip0 + 1);
764  e2e =
765  (ioam_e2e_cache_option_t *) ((u8 *) hbh0 + cm->rewrite_pool_index_offset);
766  if ((u8 *) e2e < ((u8 *) hbh0 + ((hbh0->length + 1) << 3))
767  && e2e->hdr.type == HBH_OPTION_TYPE_IOAM_E2E_CACHE_ID)
768  {
769  ioam_cache_ts_entry_t *entry = 0;
770  *pool_index = e2e->pool_index;
771  *thread_id = e2e->pool_id;
772  entry = pool_elt_at_index (cm->ioam_ts_pool[*thread_id], *pool_index);
773  /* match */
774  if (entry &&
775  ip6_address_compare (&ip0->src_address, &entry->dst_address) == 0 &&
776  ip6_address_compare (&ip0->dst_address, &entry->src_address) == 0 &&
777  entry->src_port == dst_port &&
778  entry->dst_port == src_port && entry->seq_no == seq_no)
779  {
780  *hbh = entry->hbh;
781  entry->response_received += response_seen;
782  return (0);
783  }
784  else if (entry)
785  {
786  return (-1);
787  }
788  }
789  return (-1);
790 }
791 
792 inline static u8 *
793 format_ioam_cache_ts_entry (u8 * s, va_list * args)
794 {
795  ioam_cache_ts_entry_t *e = va_arg (*args, ioam_cache_ts_entry_t *);
796  u32 thread_id = va_arg (*args, u32);
798  ioam_e2e_id_option_t *e2e = 0;
799  vlib_main_t *vm = cm->vlib_main;
800  clib_time_t *ct = &vm->clib_time;
801 
802  if (!e)
803  goto end;
804 
805  if (e->hbh)
806  {
807  e2e =
810 
811  s =
812  format (s,
813  "%d: %U:%d to %U:%d seq_no %u buffer %u %U \n\t\tCreated at %U Received %d\n",
814  (e - cm->ioam_ts_pool[thread_id]), format_ip6_address,
816  &e->dst_address, e->dst_port, e->seq_no, e->buffer_index,
817  format_ip6_address, e2e ? &e2e->id : 0, format_time_interval,
818  "h:m:s:u",
819  (e->created_at -
821  e->response_received);
822  }
823  else
824  {
825  s =
826  format (s,
827  "%d: %U:%d to %U:%d seq_no %u Buffer %u \n\t\tCreated at %U Received %d\n",
828  (e - cm->ioam_ts_pool[thread_id]), format_ip6_address,
830  &e->dst_address, e->dst_port, e->seq_no, e->buffer_index,
831  format_time_interval, "h:m:s:u",
832  (e->created_at -
834  e->response_received);
835  }
836 
837 end:
838  return s;
839 }
840 
841 /*
842  * Get extended rewrite string for iOAM data in v6
843  * This makes space for an e2e options to carry cache pool info
844  * and manycast server address.
845  * It set the rewrite string per configs in ioam ip6 + new option
846  * for cache along with offset to the option to populate cache
847  * pool id and index
848  */
849 static inline int
851 {
855  u32 rewrite_len = 0;
856  ioam_e2e_cache_option_t *e2e = 0;
857  ioam_e2e_id_option_t *e2e_id = 0;
858 
859  vec_free (cm->rewrite);
860  ip6_ioam_set_rewrite (&(cm->rewrite), hm->has_trace_option,
862  hbh = (ip6_hop_by_hop_header_t *) cm->rewrite;
863  rewrite_len = ((hbh->length + 1) << 3);
864  vec_validate (cm->rewrite,
865  rewrite_len - 1 + IOAM_E2E_CACHE_OPTION_RND +
867  hbh = (ip6_hop_by_hop_header_t *) cm->rewrite;
868  /* setup e2e id option to insert pool id and index of the node caching it */
870  cm->rewrite_pool_index_offset = rewrite_len;
871  e2e = (ioam_e2e_cache_option_t *) (cm->rewrite + rewrite_len);
872  e2e->hdr.type = HBH_OPTION_TYPE_IOAM_E2E_CACHE_ID
874  e2e->hdr.length = sizeof (ioam_e2e_cache_option_t) -
875  sizeof (ip6_hop_by_hop_option_t);
876  e2e->e2e_type = 2;
877  e2e_id =
878  (ioam_e2e_id_option_t *) ((u8 *) e2e + sizeof (ioam_e2e_cache_option_t));
879  e2e_id->hdr.type =
881  e2e_id->hdr.length =
882  sizeof (ioam_e2e_id_option_t) - sizeof (ip6_hop_by_hop_option_t);
883  e2e_id->e2e_type = 1;
884 
885  return (0);
886 }
887 
888 static inline int
890 {
892 
893  vec_free (cm->rewrite);
894  cm->rewrite = 0;
895  cm->rewrite_pool_index_offset = 0;
896  return (0);
897 }
898 #endif /* __included_ioam_cache_h__ */
899 
900 /*
901  * fd.io coding-style-patch-verification: ON
902  *
903  * Local Variables:
904  * eval: (c-set-style "gnu")
905  * End:
906  */
IOAM_CACHE_TS_TIMEOUT
#define IOAM_CACHE_TS_TIMEOUT
Definition: ioam_cache.h:510
ioam_cache_main_t::ioam_rewrite_pool
ioam_cache_entry_t * ioam_rewrite_pool
Definition: ioam_cache.h:172
ioam_cache_ts_entry_t::max_responses
u8 max_responses
Definition: ioam_cache.h:141
vlib_frame_t::n_vectors
u16 n_vectors
Definition: node.h:387
ioam_cache_ts_lookup
static int ioam_cache_ts_lookup(ip6_header_t *ip0, u8 protocol, u16 src_port, u16 dst_port, u32 seq_no, ip6_hop_by_hop_header_t **hbh, u32 *pool_index, u8 *thread_id, u8 response_seen)
Definition: ioam_cache.h:751
ioam_cache_ts_entry_t::stop_timer_handle
u32 stop_timer_handle
Definition: ioam_cache.h:142
ioam_cache_lookup
static ioam_cache_entry_t * ioam_cache_lookup(ip6_header_t *ip0, u16 src_port, u16 dst_port, u32 seq_no)
Definition: ioam_cache.h:322
ioam_cache_ts_entry_t::pool_index
u32 pool_index
Definition: ioam_cache.h:130
format_ioam_cache_ts_entry
static u8 * format_ioam_cache_ts_entry(u8 *s, va_list *args)
Definition: ioam_cache.h:793
ioam_cache_ts_entry_t::timer_handle
u32 timer_handle
Handle returned from tw_start_timer.
Definition: ioam_cache.h:144
ioam_cache_entry_cleanup
static ioam_cache_entry_t * ioam_cache_entry_cleanup(u32 pool_index)
Definition: ioam_cache.h:311
ip6_hop_by_hop_ioam_main_t::has_trace_option
u8 has_trace_option
Definition: ip6_hop_by_hop.h:68
dst_port
vl_api_ip_port_and_mask_t dst_port
Definition: flow_types.api:92
format_ioam_cache_entry
static u8 * format_ioam_cache_entry(u8 *s, va_list *args)
Definition: ioam_cache.h:486
bihash_8_8.h
ioam_cache_ts_entry_free
static void ioam_cache_ts_entry_free(u32 thread_id, ioam_cache_ts_entry_t *entry, u32 node_index)
Definition: ioam_cache.h:577
vlib_main_t::clib_time
clib_time_t clib_time
Definition: main.h:106
ioam_cache_main_t::vlib_main
vlib_main_t * vlib_main
Definition: ioam_cache.h:201
MAX_CACHE_ENTRIES
#define MAX_CACHE_ENTRIES
Definition: ioam_cache.h:159
ioam_cache_main_t::sr_localsid_cache
ip6_address_t sr_localsid_cache
Definition: ioam_cache.h:180
elog.h
ioam_cache_main_t::ts_hbh_slot
uword ts_hbh_slot
Definition: ioam_cache.h:204
ioam_cache_entry_t::src_address
ip6_address_t src_address
Definition: ioam_cache.h:103
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
CLIB_CACHE_LINE_ALIGN_MARK
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition: cache.h:60
ioam_cache_entry_t::src_port
u16 src_port
Definition: ioam_cache.h:105
ioam_cache_ts_entry_t::dst_address
ip6_address_t dst_address
Definition: ioam_cache.h:132
ioam_cache_main
ioam_cache_main_t ioam_cache_main
Definition: ioam_cache.c:38
ioam_cache_ts_pool_stats_t::inuse
u64 inuse
Definition: ioam_cache.h:154
ip6_header_t::protocol
u8 protocol
Definition: ip6_packet.h:304
ip6_address_compare
int ip6_address_compare(ip6_address_t *a1, ip6_address_t *a2)
Definition: ip46_cli.c:60
ioam_cache_ts_entry_t
Definition: ioam_cache.h:125
ioam_cache_main_t::timer_wheels
tw_timer_wheel_16t_2w_512sl_t * timer_wheels
per thread single-wheel
Definition: ioam_cache.h:190
pool_get_aligned
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
Definition: pool.h:249
ip6_ioam_set_rewrite
int ip6_ioam_set_rewrite(u8 **rwp, int has_trace_option, int has_pot_option, int has_seqno_option)
Definition: ip6_hop_by_hop.c:1138
ioam_cache_ts_check_and_send
static void ioam_cache_ts_check_and_send(u32 thread_id, i32 pool_index)
Definition: ioam_cache.h:694
ioam_cache_ts_node
vlib_node_registration_t ioam_cache_ts_node
(constructor) VLIB_REGISTER_NODE (ioam_cache_ts_node)
Definition: ioam_cache_tunnel_select_node.c:239
HBH_OPTION_TYPE_SKIP_UNKNOWN
#define HBH_OPTION_TYPE_SKIP_UNKNOWN
Definition: ip6_hop_by_hop_packet.h:32
clib_bihash_kv_8_8_t::value
u64 value
the value
Definition: bihash_8_8.h:44
clib_bihash_kv_8_8_t::key
u64 key
the key
Definition: bihash_8_8.h:43
ioam_cache_ts_entry_t::seq_no
u32 seq_no
Definition: ioam_cache.h:136
ip6_hop_by_hop_ioam_main_t
Definition: ip6_hop_by_hop.h:48
ioam_cache_entry_t::protocol
u8 protocol
Definition: ioam_cache.h:107
u16
unsigned short u16
Definition: types.h:57
ip6_ioam_analyse.h
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
ip6_ioam_ts_cache_cleanup_rewrite
static int ip6_ioam_ts_cache_cleanup_rewrite(void)
Definition: ioam_cache.h:889
node_index
node node_index
Definition: interface_output.c:440
ioam_cache_entry_t::next_hop
ip6_address_t next_hop
Definition: ioam_cache.h:109
ip6_hop_by_hop_option_t
Definition: ip6_hop_by_hop_packet.h:29
ip_packet.h
ioam_cache_ts_table_destroy
static int ioam_cache_ts_table_destroy(vlib_main_t *vm)
Definition: ioam_cache.h:603
ioam_cache_main_t::lookup_table_nbuckets
u64 lookup_table_nbuckets
Definition: ioam_cache.h:182
vlib_frame_t
Definition: node.h:372
vlib_worker_threads
vlib_worker_thread_t * vlib_worker_threads
Definition: threads.c:35
vlib_get_frame_to_node
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
Definition: main.c:184
ip6_hop_by_hop_header_t
Definition: ip6_hop_by_hop_packet.h:18
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
CLIB_PACKED
typedef CLIB_PACKED(struct { ip6_hop_by_hop_option_t hdr;u8 e2e_type;u8 reserved[5];ip6_address_t id;}) ioam_e2e_id_option_t
ioam_cache_ts_add
static int ioam_cache_ts_add(ip6_header_t *ip0, u16 src_port, u16 dst_port, u32 seq_no, u8 max_responses, u64 now, u32 thread_id, u32 *pool_index)
Definition: ioam_cache.h:640
clib_time_t::seconds_per_clock
f64 seconds_per_clock
Definition: time.h:58
i32
signed int i32
Definition: types.h:77
TIMER_HANDLE_INVALID
#define TIMER_HANDLE_INVALID
Definition: ioam_cache.h:514
ioam_cache_entry_t::my_address_offset
u16 my_address_offset
Definition: ioam_cache.h:110
ip6_packet.h
ip6_ioam_ts_cache_set_rewrite
static int ip6_ioam_ts_cache_set_rewrite(void)
Definition: ioam_cache.h:850
ioam_cache_main_t::wait_for_responses
u8 wait_for_responses
Definition: ioam_cache.h:197
max_log2
static uword max_log2(uword x)
Definition: clib.h:223
sr.h
Segment Routing data structures definitions.
vlib_put_frame_to_node
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
Definition: main.c:218
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
hash.h
ip6_compute_flow_hash_ext
static u32 ip6_compute_flow_hash_ext(const ip6_header_t *ip, u8 protocol, u16 src_port, u16 dst_port, flow_hash_config_t flow_hash_config)
Definition: ioam_cache.h:228
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
error.h
vec_add2
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:644
ioam_cache_ts_pool_stats_t
Definition: ioam_cache.h:152
ioam_cache_main_t::ip6_add_from_cache_hbh_node_index
u32 ip6_add_from_cache_hbh_node_index
Definition: ioam_cache.h:209
ioam_cache_ts_send
static void ioam_cache_ts_send(u32 thread_id, i32 pool_index)
Definition: ioam_cache.h:680
ioam_cache_ts_entry_t::buffer_index
u32 buffer_index
Definition: ioam_cache.h:137
ioam_cache_main_t::rewrite_pool_index_offset
u8 rewrite_pool_index_offset
Definition: ioam_cache.h:179
ioam_cache_ts_entry_t::protocol
u8 protocol
Definition: ioam_cache.h:135
IOAM_E2E_CACHE_HBH_EXT_LEN
#define IOAM_E2E_CACHE_HBH_EXT_LEN
Definition: ioam_cache.h:284
vlib_frame_vector_args
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:301
ip6_ioam_find_hbh_option
static void * ip6_ioam_find_hbh_option(ip6_hop_by_hop_header_t *hbh0, u8 option)
Definition: ip6_ioam_analyse.h:62
ioam_cache_main_t::lookup_table_size
u64 lookup_table_size
Definition: ioam_cache.h:183
end
f64 end
end of the time range
Definition: mactime.api:44
flow_hash_config_t
enum flow_hash_config_t_ flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
vec_validate_aligned
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
Definition: vec.h:534
c
svmdb_client_t * c
Definition: vpp_get_metrics.c:48
IP_FLOW_HASH_DEFAULT
#define IP_FLOW_HASH_DEFAULT
Default: 5-tuple + flowlabel without the "reverse" bit.
Definition: ip_flow_hash.h:22
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
ioam_cache_ts_entry_t::pool_id
u32 pool_id
Definition: ioam_cache.h:129
pool.h
Fixed length block allocator. Pools are built from clib vectors and bitmaps. Use pools when repeatedl...
ioam_cache_entry_t::seq_no
u32 seq_no
Definition: ioam_cache.h:108
src_port
vl_api_ip_port_and_mask_t src_port
Definition: flow_types.api:91
format_time_interval
u8 * format_time_interval(u8 *s, va_list *args)
Definition: std-formats.c:138
ip6_header_t::dst_address
ip6_address_t dst_address
Definition: ip6_packet.h:310
cm
vnet_feature_config_main_t * cm
Definition: nat44_ei_hairpinning.c:594
ioam_cache_main_t::ioam_rewrite_cache_table
clib_bihash_8_8_t ioam_rewrite_cache_table
Definition: ioam_cache.h:184
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
ioam_cache_add
static int ioam_cache_add(vlib_buffer_t *b0, ip6_header_t *ip0, u16 src_port, u16 dst_port, ip6_hop_by_hop_header_t *hbh0, u32 seq_no)
Definition: ioam_cache.h:365
ioam_cache_ts_entry_t::src_port
u16 src_port
Definition: ioam_cache.h:133
ioam_cache_main_t::sr_rewrite_template
u8 * sr_rewrite_template
Definition: ioam_cache.h:176
MAX_CACHE_TS_ENTRIES
#define MAX_CACHE_TS_ENTRIES
Definition: ioam_cache.h:161
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:58
interval
u16 interval
Definition: vrrp.api:34
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
ioam_cache_main_t::ip6_reset_ts_hbh_node_index
u32 ip6_reset_ts_hbh_node_index
Definition: ioam_cache.h:210
IOAM_CACHE_TABLE_DEFAULT_HASH_NUM_BUCKETS
#define IOAM_CACHE_TABLE_DEFAULT_HASH_NUM_BUCKETS
Definition: ioam_cache.h:163
ioam_e2e_id_rewrite_handler
static void ioam_e2e_id_rewrite_handler(ioam_e2e_id_option_t *e2e_option, ip6_address_t *address)
Definition: ioam_cache.h:287
pool_alloc_aligned
#define pool_alloc_aligned(P, N, A)
Allocate N more free elements to pool (general version).
Definition: pool.h:344
ioam_cache_ts_entry_t::src_address
ip6_address_t src_address
Definition: ioam_cache.h:131
ip6_hop_by_hop_ioam_main
ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main
Definition: ip6_hop_by_hop.c:45
ip4_packet.h
id
u8 id[64]
Definition: dhcp.api:160
ioam_cache_entry_t::ioam_rewrite_string
u8 * ioam_rewrite_string
Definition: ioam_cache.h:111
ioam_cache_table_init
static int ioam_cache_table_init(vlib_main_t *vm)
Definition: ioam_cache.h:449
ioam_cache_ts_entry_t::response_received
u8 response_received
Definition: ioam_cache.h:140
tw_timer_16t_2w_512sl.h
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
ioam_cache_main_t::ip6_hbh_pop_node_index
u32 ip6_hbh_pop_node_index
Definition: ioam_cache.h:205
ioam_cache_ts_timer_set
static void ioam_cache_ts_timer_set(ioam_cache_main_t *cm, ioam_cache_ts_entry_t *entry, u32 interval)
Definition: ioam_cache.h:559
ioam_cache_ts_entry_t::created_at
u64 created_at
Definition: ioam_cache.h:139
ioam_cache_node
vlib_node_registration_t ioam_cache_node
(constructor) VLIB_REGISTER_NODE (ioam_cache_node)
Definition: ioam_cache_node.c:183
ioam_cache_main_t::msg_id_base
u16 msg_id_base
Definition: ioam_cache.h:169
clib_time_t
Definition: time.h:44
u64
unsigned long u64
Definition: types.h:89
format
description fragment has unexpected format
Definition: map.api:433
ioam_cache_main_t::cleanup_process_node_index
u32 cleanup_process_node_index
Definition: ioam_cache.h:207
IOAM_E2E_ID_HBH_EXT_LEN
#define IOAM_E2E_ID_HBH_EXT_LEN
Definition: ioam_cache.h:282
IOAM_CACHE_TABLE_DEFAULT_HASH_MEMORY_SIZE
#define IOAM_CACHE_TABLE_DEFAULT_HASH_MEMORY_SIZE
Definition: ioam_cache.h:164
ioam_cache_entry_free
static void ioam_cache_entry_free(ioam_cache_entry_t *entry)
Definition: ioam_cache.h:299
ip.h
u32
unsigned int u32
Definition: types.h:88
protocol
vl_api_ip_proto_t protocol
Definition: lb_types.api:72
ioam_cache_ts_pool_stats_t::add_failed
u64 add_failed
Definition: ioam_cache.h:155
HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE_ID
#define HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE_ID
Definition: ioam_cache.h:266
ip6_hop_by_hop_header_t::length
u8 length
Definition: ip6_hop_by_hop_packet.h:26
ioam_cache_ts_timer_node_enable
void ioam_cache_ts_timer_node_enable(vlib_main_t *vm, u8 enable)
Definition: ioam_cache_tunnel_select_node.c:689
clib_bihash_kv_8_8_t
8 octet key, 8 octet key value pair
Definition: bihash_8_8.h:41
ioam_cache_main_t::rewrite
u8 * rewrite
Definition: ioam_cache.h:178
ioam_cache_table_destroy
static int ioam_cache_table_destroy(vlib_main_t *vm)
Definition: ioam_cache.h:468
ioam_cache_entry_t
Definition: ioam_cache.h:99
value
u8 value
Definition: qos.api:54
ioam_cache_main_t::criteria_oneway
bool criteria_oneway
Definition: ioam_cache.h:196
ip6_header_t
Definition: ip6_packet.h:294
ioam_cache_main_t
Definition: ioam_cache.h:166
now
f64 now
Definition: nat44_ei_out2in.c:710
IOAM_CACHE_TS_TICK
#define IOAM_CACHE_TS_TICK
Definition: ioam_cache.h:511
ip6_header_t::src_address
ip6_address_t src_address
Definition: ip6_packet.h:310
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
ioam_cache_main_t::ts_stats
ioam_cache_ts_pool_stats_t * ts_stats
Definition: ioam_cache.h:188
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
u8
unsigned char u8
Definition: types.h:56
a
a
Definition: bitmap.h:525
ip
vl_api_address_t ip
Definition: l2.api:558
format_ip6_address
format_function_t format_ip6_address
Definition: format.h:91
i
int i
Definition: flowhash_template.h:376
pool_free
#define pool_free(p)
Free a pool.
Definition: pool.h:447
ip6_hop_by_hop_header_t::protocol
u8 protocol
Definition: ip6_hop_by_hop_packet.h:21
ip6_sr_compute_rewrite_string_insert
static u8 * ip6_sr_compute_rewrite_string_insert(ip6_address_t *sl)
SR rewrite string computation for SRH insertion (inline)
Definition: sr.h:379
ioam_cache_ts_table_init
static int ioam_cache_ts_table_init(vlib_main_t *vm)
Definition: ioam_cache.h:528
ioam_cache_ts_entry_t::hbh
ip6_hop_by_hop_header_t * hbh
Definition: ioam_cache.h:138
ioam_cache_main_t::sr_localsid_ts
ip6_address_t sr_localsid_ts
Definition: ioam_cache.h:198
ioam_cache_main_t::ioam_ts_pool
ioam_cache_ts_entry_t ** ioam_ts_pool
Definition: ioam_cache.h:187
vlib_time_now
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:327
expired_cache_ts_timer_callback
void expired_cache_ts_timer_callback(u32 *expired_timers)
Definition: ioam_cache_tunnel_select_node.c:698
ioam_cache_main_t::cache_hbh_slot
uword cache_hbh_slot
Definition: ioam_cache.h:203
vnet.h
ioam_cache_ts_entry_t::expected_to_expire
u32 expected_to_expire
entry should expire at this clock tick
Definition: ioam_cache.h:146
hash_mix64
#define hash_mix64(a0, b0, c0)
Definition: hash.h:530
ip6_hop_by_hop_ioam_main_t::has_pot_option
u8 has_pot_option
Definition: ip6_hop_by_hop.h:71
ioam_cache_ts_entry_cleanup
static int ioam_cache_ts_entry_cleanup(u32 thread_id, u32 pool_index)
Definition: ioam_cache.h:626
ioam_cache_entry_t::dst_port
u16 dst_port
Definition: ioam_cache.h:106
HBH_OPTION_TYPE_IOAM_E2E_CACHE_ID
#define HBH_OPTION_TYPE_IOAM_E2E_CACHE_ID
Definition: ioam_cache.h:267
ioam_cache_sr_rewrite_template_create
static void ioam_cache_sr_rewrite_template_create(void)
Definition: ioam_cache.h:434
ioam_cache_entry_t::dst_address
ip6_address_t dst_address
Definition: ioam_cache.h:104
ioam_cache_main_t::error_node_index
u32 error_node_index
Definition: ioam_cache.h:206
vlib_main_t::cpu_time_main_loop_start
u64 cpu_time_main_loop_start
Definition: main.h:115
format_ip6_hop_by_hop_ext_hdr
u8 * format_ip6_hop_by_hop_ext_hdr(u8 *s, va_list *args)
Definition: ip6_forward.c:2289
ip6_hop_by_hop_ioam_main_t::has_seqno_option
u8 has_seqno_option
Definition: ip6_hop_by_hop.h:74
IOAM_E2E_CACHE_OPTION_RND
#define IOAM_E2E_CACHE_OPTION_RND
Definition: ioam_cache.h:283
ioam_cache_ts_timer_reset
static void ioam_cache_ts_timer_reset(ioam_cache_main_t *cm, ioam_cache_ts_entry_t *entry)
Definition: ioam_cache.h:568
IOAM_E2E_ID_OPTION_RND
#define IOAM_E2E_ID_OPTION_RND
Definition: ioam_cache.h:281
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
ioam_cache_ts_update
static int ioam_cache_ts_update(u32 thread_id, i32 pool_index, u32 buffer_index, ip6_hop_by_hop_header_t *hbh)
Definition: ioam_cache.h:712
ioam_cache_ts_entry_t::dst_port
u16 dst_port
Definition: ioam_cache.h:134