FD.io VPP
v18.07-rc0-415-g6c78436
Vector Packet Processing
Main Page
Related Pages
Modules
Namespaces
Data Structures
Source
Files
Symbols
ip6_ioam_analyse.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
16
#ifndef PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IP6_IOAM_ANALYSE_NODE_H_
17
#define PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IP6_IOAM_ANALYSE_NODE_H_
18
19
#include <
ioam/analyse/ioam_analyse.h
>
20
#include <
vnet/ip/ip6_hop_by_hop.h
>
21
#include <
ioam/encap/ip6_ioam_trace.h
>
22
23
/** @brief IP6-iOAM analyser main structure.
24
@note cache aligned.
25
*/
26
typedef
struct
27
{
28
/** Array of function pointer to analyse each hop-by-hop option. */
29
int (*analyse_hbh_handler[
MAX_IP6_HBH_OPTION
]) (
u32
flow_id,
30
ip6_hop_by_hop_option_t
*
31
opt,
u16
len);
32
33
/** This contains the aggregated data from the time VPP started analysing. */
34
ioam_analyser_data_t
*
aggregated_data
;
35
36
}
ip6_ioam_analyser_main_t
;
37
38
extern
ip6_ioam_analyser_main_t
ioam_analyser_main
;
39
40
extern
vlib_node_registration_t
analyse_node_local
;
41
extern
vlib_node_registration_t
analyse_node_remote
;
42
43
void
ip6_ioam_analyse_register_handlers
(
void
);
44
45
void
ip6_ioam_analyse_unregister_handlers
(
void
);
46
47
clib_error_t
*
ip6_ioam_analyse_init
(
vlib_main_t
*
vm
);
48
49
inline
static
ioam_analyser_data_t
*
50
ioam_analyse_get_data_from_flow_id
(
u32
flow_id)
51
{
52
if
(flow_id >=
vec_len
(ioam_analyser_main.
aggregated_data
))
53
return
NULL
;
54
55
if
(ioam_analyser_main.
aggregated_data
[flow_id].
is_free
)
56
ioam_analyser_main.
aggregated_data
[flow_id].
is_free
= 0;
57
58
return
(ioam_analyser_main.
aggregated_data
+ flow_id);
59
}
60
61
always_inline
void
*
62
ip6_ioam_find_hbh_option
(
ip6_hop_by_hop_header_t
* hbh0,
u8
option)
63
{
64
ip6_hop_by_hop_option_t
*opt0, *limit0;
65
u8
type0;
66
67
opt0 = (
ip6_hop_by_hop_option_t
*) (hbh0 + 1);
68
limit0 =
69
(
ip6_hop_by_hop_option_t
*) ((
u8
*) hbh0 + ((hbh0->
length
+ 1) << 3));
70
71
while
(opt0 < limit0)
72
{
73
type0 = opt0->
type
;
74
if
(type0 == option)
75
return
((
void
*) opt0);
76
77
if
(0 == type0)
78
{
79
opt0 = (
ip6_hop_by_hop_option_t
*) ((
u8
*) opt0) + 1;
80
continue
;
81
}
82
opt0 = (
ip6_hop_by_hop_option_t
*)
83
(((
u8
*) opt0) + opt0->
length
+ sizeof (
ip6_hop_by_hop_option_t
));
84
}
85
86
return
NULL
;
87
}
88
89
always_inline
int
90
ip6_ioam_analyse_compare_path_delay
(
ip6_hop_by_hop_header_t
* hbh0,
91
ip6_hop_by_hop_header_t
* hbh1,
92
bool
oneway)
93
{
94
ioam_trace_option_t *trace0 =
NULL
, *trace1 =
NULL
;
95
f64
delay0, delay1;
96
97
trace0 =
98
ip6_ioam_find_hbh_option
(hbh0,
HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
);
99
trace1 =
100
ip6_ioam_find_hbh_option
(hbh1,
HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
);
101
102
if
(
PREDICT_FALSE
((trace0 ==
NULL
) && (trace1 ==
NULL
)))
103
return
0;
104
105
if
(
PREDICT_FALSE
(trace1 ==
NULL
))
106
return
1;
107
108
if
(
PREDICT_FALSE
(trace0 ==
NULL
))
109
return
-1;
110
111
delay0 =
ip6_ioam_analyse_calc_delay
(&trace0->trace_hdr,
112
trace0->hdr.length - 2, oneway);
113
delay1 =
ip6_ioam_analyse_calc_delay
(&trace1->trace_hdr,
114
trace1->hdr.length - 2, oneway);
115
116
return
(delay0 - delay1);
117
}
118
119
#endif
/* PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IP6_IOAM_ANALYSE_NODE_H_ */
120
121
/*
122
* fd.io coding-style-patch-verification: ON
123
*
124
* Local Variables:
125
* eval: (c-set-style "gnu")
126
* End:
127
*/
ip6_hop_by_hop_option_t::type
u8 type
Definition:
ip6_hop_by_hop_packet.h:38
ip6_hop_by_hop_option_t::length
u8 length
Definition:
ip6_hop_by_hop_packet.h:40
NULL
#define NULL
Definition:
clib.h:55
ip6_ioam_analyse_compare_path_delay
static int ip6_ioam_analyse_compare_path_delay(ip6_hop_by_hop_header_t *hbh0, ip6_hop_by_hop_header_t *hbh1, bool oneway)
Definition:
ip6_ioam_analyse.h:90
ioam_analyse_get_data_from_flow_id
static ioam_analyser_data_t * ioam_analyse_get_data_from_flow_id(u32 flow_id)
Definition:
ip6_ioam_analyse.h:50
ip6_ioam_analyse_calc_delay
static f64 ip6_ioam_analyse_calc_delay(ioam_trace_hdr_t *trace, u16 trace_len, u8 oneway)
Definition:
ioam_analyse.h:130
u8
unsigned char u8
Definition:
types.h:56
ioam_analyser_main
ip6_ioam_analyser_main_t ioam_analyser_main
Definition:
node.c:63
f64
double f64
Definition:
types.h:142
ioam_analyser_data_t_::is_free
u8 is_free
Definition:
ioam_analyse.h:101
ip6_ioam_analyser_main_t
IP6-iOAM analyser main structure.
Definition:
ip6_ioam_analyse.h:26
always_inline
#define always_inline
Definition:
clib.h:92
ip6_hop_by_hop_header_t
Definition:
ip6_hop_by_hop_packet.h:18
u32
unsigned int u32
Definition:
types.h:88
u16
unsigned short u16
Definition:
types.h:57
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition:
clib.h:105
ip6_hop_by_hop.h
vm
vlib_main_t * vm
Definition:
buffer.c:294
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
analyse_node_local
vlib_node_registration_t analyse_node_local
(constructor) VLIB_REGISTER_NODE (analyse_node_local)
Definition:
node.c:479
ip6_hop_by_hop_option_t
Definition:
ip6_hop_by_hop_packet.h:29
ip6_ioam_analyser_main_t::aggregated_data
ioam_analyser_data_t * aggregated_data
This contains the aggregated data from the time VPP started analysing.
Definition:
ip6_ioam_analyse.h:34
HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
Definition:
ip6_hop_by_hop_packet.h:44
ioam_analyse.h
clib_error_t
Definition:
clib_error.h:21
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
ip6_ioam_analyse_register_handlers
void ip6_ioam_analyse_register_handlers(void)
Definition:
node.c:454
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition:
vec_bootstrap.h:142
ioam_analyser_data_t_
Analysed iOAM data.
Definition:
ioam_analyse.h:97
vlib_main_t
Definition:
main.h:59
ip6_hop_by_hop_header_t::length
u8 length
Definition:
ip6_hop_by_hop_packet.h:26
ip6_ioam_analyse_init
clib_error_t * ip6_ioam_analyse_init(vlib_main_t *vm)
ip6_ioam_analyse_unregister_handlers
void ip6_ioam_analyse_unregister_handlers(void)
Definition:
node.c:465
analyse_node_remote
vlib_node_registration_t analyse_node_remote
(constructor) VLIB_REGISTER_NODE (analyse_node_remote)
Definition:
node.c:498
MAX_IP6_HBH_OPTION
#define MAX_IP6_HBH_OPTION
Definition:
ip6_hop_by_hop.h:22
ip6_ioam_trace.h
src
plugins
ioam
analyse
ip6
ip6_ioam_analyse.h
Generated on Tue Aug 21 2018 06:01:55 for FD.io VPP by
1.8.11