FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
mpls_disposition.h
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 #ifndef __MPLS_DISP_DPO_H__
17 #define __MPLS_DISP_DPO_H__
18 
19 #include <vnet/vnet.h>
20 #include <vnet/mpls/packet.h>
21 #include <vnet/dpo/dpo.h>
22 #include <vnet/mfib/mfib_types.h>
23 
24 /**
25  * A representation of an MPLS label for imposition in the data-path
26  */
27 typedef struct mpls_disp_dpo_t
28 {
29  /**
30  * required for pool_get_aligned.
31  * memebers used in the switch path come first!
32  */
33  CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
34 
35  /**
36  * Next DPO in the graph
37  */
39 
40  /**
41  * The protocol of the payload/packets that are being encapped
42  */
44 
45  /**
46  * RPF-ID (if this is an mcast disposition)
47  */
49 
50  /**
51  * Number of locks/users of the label
52  */
54 
55  /**
56  * LSP mode
57  */
60 
61 /**
62  * @brief Assert that the MPLS label object is less than a cache line in size.
63  * Should this get any bigger then we will need to reconsider how many labels
64  * can be pushed in one object.
65  */
66 _Static_assert((sizeof(mpls_disp_dpo_t) <= CLIB_CACHE_LINE_BYTES),
67  "MPLS Disposition DPO is larger than one cache line.");
68 
69 /**
70  * @brief Create an MPLS label object
71  *
72  * @param payload_proto The ptocool of the payload packets that will
73  * be imposed with this label header.
74  * @param rpf_id The RPF ID the packet will aquire - only for mcast
75  * @param mode The LSP mode; pipe or uniform
76  * @param dpo The parent of the created MPLS label object
77  */
78 extern void mpls_disp_dpo_create(dpo_proto_t payload_proto,
79  fib_rpf_id_t rpf_id,
81  const dpo_id_t *parent,
82  dpo_id_t *dpo);
83 
84 extern u8* format_mpls_disp_dpo(u8 *s, va_list *args);
85 
86 
87 /*
88  * Encapsulation violation for fast data-path access
89  */
91 
92 static inline mpls_disp_dpo_t *
94 {
95  return (pool_elt_at_index(mpls_disp_dpo_pool, index));
96 }
97 
98 extern void mpls_disp_dpo_module_init(void);
99 
100 #endif
u16 mdd_locks
Number of locks/users of the label.
struct mpls_disp_dpo_t mpls_disp_dpo_t
A representation of an MPLS label for imposition in the data-path.
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
unsigned char u8
Definition: types.h:56
dpo_proto_t mdd_payload_proto
The protocol of the payload/packets that are being encapped.
fib_rpf_id_t mdd_rpf_id
RPF-ID (if this is an mcast disposition)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:168
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:514
unsigned short u16
Definition: types.h:57
enum fib_mpls_lsp_mode_t_ fib_mpls_lsp_mode_t
MPLS LSP mode - only valid at the head and tail.
mpls_disp_dpo_t * mpls_disp_dpo_pool
u8 * format_mpls_disp_dpo(u8 *s, va_list *args)
vl_api_vxlan_gbp_api_tunnel_mode_t mode
Definition: vxlan_gbp.api:44
u32 fib_rpf_id_t
An RPF-ID is numerical value that is used RPF validate.
Definition: fib_types.h:397
A representation of an MPLS label for imposition in the data-path.
void mpls_disp_dpo_module_init(void)
dpo_id_t mdd_dpo
Next DPO in the graph.
static mpls_disp_dpo_t * mpls_disp_dpo_get(index_t index)
fib_mpls_lsp_mode_t mdd_mode
LSP mode.
CLIB_CACHE_LINE_ALIGN_MARK(cacheline0)
required for pool_get_aligned.
void mpls_disp_dpo_create(dpo_proto_t payload_proto, fib_rpf_id_t rpf_id, fib_mpls_lsp_mode_t mode, const dpo_id_t *parent, dpo_id_t *dpo)
Create an MPLS label object.
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59