FD.io VPP  v16.12-rc0-308-g931be3a
Vector Packet Processing
cnat_global.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * cnat_global.c - global variables
4  *
5  * Copyright (c) 2008-2009, 2012 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 /* gloable variables */
21 
22 #include <vlib/vlib.h>
23 #include <vnet/vnet.h>
24 #include <vppinfra/error.h>
25 #include <vnet/buffer.h>
26 
27 #include "dslite_defs.h"
28 #include "tcp_header_definitions.h"
31 /* ctx/sf alloc error counters */
34 
37 
40 
43 
45 
46 /* TOBE_PORTED : Remove following once we bring DSLite */
51 
53 
54 /*
55  * ipv4_decr_ttl_n_calc_csum()
56  * - It decrements the TTL and calculates the incremental IPv4 checksum
57  */
58 
59 /* TOBE_PORTED: Following is in cnat_util.c */
60 always_inline __attribute__((unused))
62 {
63  u32 checksum;
64  u16 old;
65  u16 ttl;
66 
67  ttl = ipv4->ttl;
68  old = clib_net_to_host_u16(ttl);
69 
70  /* Decrement TTL */
71  ipv4->ttl--;
72 
73  /* Calculate incremental checksum */
74  checksum = old + (~clib_net_to_host_u16(ttl) & 0xFFFF);
75  checksum += clib_net_to_host_u16(ipv4->checksum);
76  checksum = (checksum & 0xFFFF) + (checksum >> 16);
77  ipv4->checksum = clib_host_to_net_u32(checksum + (checksum >> 16));
78 }
79 
u32 rcv_pkt_errs
Definition: cnat_global.c:44
u8 nfv9_configured
Definition: cnat_global.c:30
u32 null_deq_ctx
Definition: cnat_global.c:36
u32 cnat_current_time
Definition: cnat_global.c:29
u32 null_enq_pkt
Definition: cnat_global.c:32
u32 dslite_defrag_debug_level
Definition: cnat_global.c:49
u32 sf_alloc_errs
Definition: cnat_global.c:42
Definition: dslite_defs.h:106
#define always_inline
Definition: clib.h:84
u32 null_enq_ctx
Definition: cnat_global.c:35
u32 null_enq_wqe
Definition: cnat_global.c:38
dslite_table_entry_t * dslite_table_db_ptr
Definition: cnat_global.c:52
static void ipv4_decr_ttl_n_calc_csum(ipv4_header *ipv4)
Definition: cnat_global.c:61
u32 null_deq_wqe
Definition: cnat_global.c:39
u32 dslite_data_path_debug_level
Definition: cnat_global.c:48
unsigned int u32
Definition: types.h:88
u32 dslite_config_debug_level
Definition: cnat_global.c:47
u32 ctx_alloc_errs
Definition: cnat_global.c:41
unsigned short u16
Definition: types.h:57
unsigned char u8
Definition: types.h:56
u32 null_deq_pkt
Definition: cnat_global.c:33
u32 dslite_debug_level
Definition: cnat_global.c:50