FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ioam_seqno_lib.c
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 
16 #include <vlib/vlib.h>
17 #include <vnet/vnet.h>
19 
20 u8 *
21 show_ioam_seqno_cmd_fn (u8 * s, ioam_seqno_data * seqno_data, u8 enc)
22 {
23  seqno_rx_info *rx;
24 
25  s = format (s, "SeqNo Data:\n");
26  if (enc)
27  {
28  s = format (s, " Current Seq. Number : %llu\n", seqno_data->seq_num);
29  }
30  else
31  {
32  rx = &seqno_data->seqno_rx;
34  }
35 
36  format (s, "\n");
37  return s;
38 }
39 
40 u8 *
42 {
43  s = format (s, " Highest Seq. Number : %llu\n", rx->bitmap.highest);
44  s = format (s, " Packets received : %llu\n", rx->rx_packets);
45  s = format (s, " Lost packets : %llu\n", rx->lost_packets);
46  s = format (s, " Reordered packets : %llu\n", rx->reordered_packets);
47  s = format (s, " Duplicate packets : %llu\n", rx->dup_packets);
48 
49  format (s, "\n");
50  return s;
51 }
52 
53 void
55 {
56  data->seq_num = 0;
57  ioam_seqno_init_rx_info (&data->seqno_rx);
58  return;
59 }
60 
61 void
63 {
64  seqno_bitmap *bitmap = &data->bitmap;
67  bitmap->mask = 32 * SEQNO_WINDOW_ARRAY_SIZE - 1;
68  bitmap->array[0] = 0x00000000; /* pretend we haven seen sequence numbers 0 */
69  bitmap->highest = 0;
70 
71  data->dup_packets = 0;
72  data->lost_packets = 0;
73  data->reordered_packets = 0;
74  data->rx_packets = 0;
75  return;
76 }
77 
78 /*
79  * fd.io coding-style-patch-verification: ON
80  *
81  * Local Variables:
82  * eval: (c-set-style "gnu")
83  * End:
84  */
vlib.h
seqno_rx_info_
Definition: ioam_seqno_lib.h:36
show_ioam_seqno_cmd_fn
u8 * show_ioam_seqno_cmd_fn(u8 *s, ioam_seqno_data *seqno_data, u8 enc)
Definition: ioam_seqno_lib.c:21
SEQNO_WINDOW_SIZE
#define SEQNO_WINDOW_SIZE
Definition: ioam_seqno_lib.h:23
seqno_bitmap_::mask
u32 mask
Definition: ioam_seqno_lib.h:30
seqno_bitmap_
Definition: ioam_seqno_lib.h:26
seqno_bitmap_::highest
u64 highest
Definition: ioam_seqno_lib.h:32
ioam_seqno_init_rx_info
void ioam_seqno_init_rx_info(seqno_rx_info *data)
Definition: ioam_seqno_lib.c:62
show_ioam_seqno_analyse_data_fn
u8 * show_ioam_seqno_analyse_data_fn(u8 *s, seqno_rx_info *rx)
Definition: ioam_seqno_lib.c:41
ioam_seqno_data_
Definition: ioam_seqno_lib.h:46
seqno_rx_info_::bitmap
seqno_bitmap bitmap
Definition: ioam_seqno_lib.h:42
ioam_seqno_init_data
void ioam_seqno_init_data(ioam_seqno_data *data)
Definition: ioam_seqno_lib.c:54
seqno_bitmap_::window_size
u32 window_size
Definition: ioam_seqno_lib.h:28
ioam_seqno_lib.h
ioam_seqno_data_::seqno_rx
seqno_rx_info seqno_rx
Definition: ioam_seqno_lib.h:51
seqno_rx_info_::dup_packets
u64 dup_packets
Definition: ioam_seqno_lib.h:41
data
u8 data[128]
Definition: ipsec_types.api:95
ioam_seqno_data_::seq_num
u32 seq_num
Definition: ioam_seqno_lib.h:50
format
description fragment has unexpected format
Definition: map.api:433
seqno_bitmap_::array_size
u32 array_size
Definition: ioam_seqno_lib.h:29
u8
unsigned char u8
Definition: types.h:56
seqno_bitmap_::array
u64 array[SEQNO_WINDOW_ARRAY_SIZE]
Definition: ioam_seqno_lib.h:33
vnet.h
seqno_rx_info_::lost_packets
u64 lost_packets
Definition: ioam_seqno_lib.h:39
seqno_rx_info_::reordered_packets
u64 reordered_packets
Definition: ioam_seqno_lib.h:40
seqno_rx_info_::rx_packets
u64 rx_packets
Definition: ioam_seqno_lib.h:38
SEQNO_WINDOW_ARRAY_SIZE
#define SEQNO_WINDOW_ARRAY_SIZE
Definition: ioam_seqno_lib.h:24