FD.io VPP  v17.04.2-2-ga8f93f8
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;
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  */
#define SEQNO_WINDOW_SIZE
void ioam_seqno_init_data(ioam_seqno_data *data)
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:418
seqno_rx_info seqno_rx
u8 * show_ioam_seqno_analyse_data_fn(u8 *s, seqno_rx_info *rx)
u8 * show_ioam_seqno_cmd_fn(u8 *s, ioam_seqno_data *seqno_data, u8 enc)
unsigned char u8
Definition: types.h:56
void ioam_seqno_init_rx_info(seqno_rx_info *data)
#define SEQNO_WINDOW_ARRAY_SIZE
seqno_bitmap bitmap
u64 array[SEQNO_WINDOW_ARRAY_SIZE]