FD.io VPP  v21.01.1
Vector Packet Processing
pw_cw.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 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 __PW_CW_DPO_H__
17 #define __PW_CW_DPO_H__
18 
19 #include <vnet/vnet.h>
20 #include <vnet/mpls/packet.h>
21 #include <vnet/dpo/dpo.h>
22 
23 /**
24  * A Psuedo Wire Control Word is 4 bytes
25  */
26 typedef u32 pw_cw_t;
27 
28 /**
29  * A representation of a Psuedo Wire Control Word pop DPO
30  */
31 typedef struct pw_cw_dpo_t
32 {
33  /**
34  * Next DPO in the graph
35  */
37 
38  /**
39  * Number of locks/users of the label
40  */
42 } pw_cw_dpo_t;
43 
44 /**
45  * @brief Assert that the MPLS label object is less than a cache line in size.
46  * Should this get any bigger then we will need to reconsider how many labels
47  * can be pushed in one object.
48  */
50 
51 /* #define STATIC_ASSERT_ALIGNOF(d, s) \ */
52 /* STATIC_ASSERT (alignof (d) == sizeof(s), "Align of " #d " must be " # s " bytes") */
53 
54 /* STATIC_ASSERT_AIGNOF(pw_cw_dpo_t, u64); */
55 
56 /**
57  * @brief Create an PW CW pop
58  *
59  * @param parent The parent of the created MPLS label object
60  * @param dpo The PW CW DPO created
61  */
62 extern void pw_cw_dpo_create(const dpo_id_t *paremt,
63  dpo_id_t *dpo);
64 
65 extern u8* format_pw_cw_dpo(u8 *s, va_list *args);
66 
67 /*
68  * Encapsulation violation for fast data-path access
69  */
71 
72 static inline pw_cw_dpo_t *
74 {
75  return (pool_elt_at_index(pw_cw_dpo_pool, index));
76 }
77 
78 extern void pw_cw_dpo_module_init(void);
79 
80 #endif
static pw_cw_dpo_t * pw_cw_dpo_get(index_t index)
Definition: pw_cw.h:73
void pw_cw_dpo_module_init(void)
Definition: pw_cw.c:310
unsigned long u64
Definition: types.h:89
struct pw_cw_dpo_t pw_cw_dpo_t
A representation of a Psuedo Wire Control Word pop DPO.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
void pw_cw_dpo_create(const dpo_id_t *paremt, dpo_id_t *dpo)
Create an PW CW pop.
Definition: pw_cw.c:43
unsigned char u8
Definition: types.h:56
unsigned int u32
Definition: types.h:88
A representation of a Psuedo Wire Control Word pop DPO.
Definition: pw_cw.h:31
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:170
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:546
unsigned short u16
Definition: types.h:57
dpo_id_t pwcw_parent
Next DPO in the graph.
Definition: pw_cw.h:36
u16 pwcw_locks
Number of locks/users of the label.
Definition: pw_cw.h:41
pw_cw_dpo_t * pw_cw_dpo_pool
Definition: pw_cw.c:24
u32 index
Definition: flow_types.api:221
u32 pw_cw_t
A Psuedo Wire Control Word is 4 bytes.
Definition: pw_cw.h:26
STATIC_ASSERT_SIZEOF(pw_cw_dpo_t, 2 *sizeof(u64))
Assert that the MPLS label object is less than a cache line in size.
u8 * format_pw_cw_dpo(u8 *s, va_list *args)
Definition: pw_cw.c:68