FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
ip6_ioam_seqno.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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 
17 #include <vlib/vlib.h>
18 #include <vnet/vnet.h>
19 #include <vppinfra/error.h>
20 
21 #include <vnet/ip/ip.h>
22 
23 #include <vppinfra/hash.h>
24 #include <vppinfra/error.h>
25 #include <vppinfra/elog.h>
26 
27 #include "ip6_ioam_seqno.h"
28 #include "ip6_ioam_e2e.h"
29 
30 
31 /*
32  * This Routine gets called from IPv6 hop-by-hop option handling.
33  * Only if we are encap node, then add PPC data.
34  * On a Transit(MID) node we dont do anything with E2E headers.
35  * On decap node decap is handled by seperate function.
36  */
37 int
40 {
41  u32 opaque_index = vnet_buffer(b)->l2_classify.opaque_index;
42  ioam_e2e_option_t * e2e;
43  int rv = 0;
45 
46  /* Bypass seqno processing */
47  if (PREDICT_FALSE(opaque_index == 0x7FFFFFFF))
48  return rv;
49 
51  e2e = (ioam_e2e_option_t *) opt;
52  e2e->e2e_hdr.e2e_data = clib_host_to_net_u32(++data->seq_num);
53 
54  return (rv);
55 }
56 
57 /*
58  * This Routine gets called on POP/Decap node.
59  */
60 int
63 {
64  u32 opaque_index = vnet_buffer(b)->l2_classify.opaque_index;
65  ioam_e2e_option_t * e2e;
66  int rv = 0;
68 
70  e2e = (ioam_e2e_option_t *) opt;
71  ioam_analyze_seqno(&data->seqno_rx,
72  (u64) clib_net_to_host_u32(e2e->e2e_hdr.e2e_data));
73 
74  return (rv);
75 }
vlib.h
ip6_ioam_seqno.h
elog.h
ioam_analyze_seqno
static void ioam_analyze_seqno(seqno_rx_info *seqno_rx, u64 seqno)
Definition: ioam_seqno_lib.h:117
ip6_hop_by_hop_option_t
Definition: ip6_hop_by_hop_packet.h:29
ioam_seqno_data_
Definition: ioam_seqno_lib.h:46
ioam_e2ec_get_seqno_data_from_flow_ctx
static ioam_seqno_data * ioam_e2ec_get_seqno_data_from_flow_ctx(u32 flow_ctx)
Definition: ip6_ioam_e2e.h:44
error.h
vnet_buffer
#define vnet_buffer(b)
Definition: buffer.h:437
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
ip6_ioam_e2e.h
ioam_seqno_encap_handler
int ioam_seqno_encap_handler(vlib_buffer_t *b, ip6_header_t *ip, ip6_hop_by_hop_option_t *opt)
Definition: ip6_ioam_seqno.c:38
ioam_seqno_decap_handler
int ioam_seqno_decap_handler(vlib_buffer_t *b, ip6_header_t *ip, ip6_hop_by_hop_option_t *opt)
Definition: ip6_ioam_seqno.c:61
data
u8 data[128]
Definition: ipsec_types.api:92
u64
unsigned long u64
Definition: types.h:89
ip.h
u32
unsigned int u32
Definition: types.h:88
ip6_header_t
Definition: ip6_packet.h:294
hash.h
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
ip
vl_api_address_t ip
Definition: l2.api:558
rv
int __clib_unused rv
Definition: application.c:491
vnet.h
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111