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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __PW_CW_DPO_H__
17 #define __PW_CW_DPO_H__
19 #include <vnet/vnet.h>
20 #include <vnet/mpls/packet.h>
21 #include <vnet/dpo/dpo.h>
24 * A Psuedo Wire Control Word is 4 bytes
29 * A representation of a Psuedo Wire Control Word pop DPO
31 typedef struct pw_cw_dpo_t
34 * Next DPO in the graph
39 * Number of locks/users of the label
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.
49 STATIC_ASSERT_SIZEOF(pw_cw_dpo_t, 2 * sizeof(u64));
51 /* #define STATIC_ASSERT_ALIGNOF(d, s) \ */
52 /* STATIC_ASSERT (alignof (d) == sizeof(s), "Align of " #d " must be " # s " bytes") */
54 /* STATIC_ASSERT_AIGNOF(pw_cw_dpo_t, u64); */
57 * @brief Create an PW CW pop
59 * @param parent The parent of the created MPLS label object
60 * @param dpo The PW CW DPO created
62 extern void pw_cw_dpo_create(const dpo_id_t *paremt,
65 extern u8* format_pw_cw_dpo(u8 *s, va_list *args);
68 * Encapsulation violation for fast data-path access
70 extern pw_cw_dpo_t *pw_cw_dpo_pool;
72 static inline pw_cw_dpo_t *
73 pw_cw_dpo_get (index_t index)
75 return (pool_elt_at_index(pw_cw_dpo_pool, index));
78 extern void pw_cw_dpo_module_init(void);