FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
interface_tx_dpo.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 
17 #include <vnet/adj/rewrite.h>
18 
19 /*
20  * We do not lock nor unlock these DPOs since there is nothing to lock
21  * all we do is construct DPO object wrappers around a sw_if_index
22  */
23 static void
25 {
26 }
27 
28 static void
30 {
31 }
32 
33 /*
34  * interface_tx_dpo_add_or_lock
35  *
36  * construct DPO object wrappers around a sw_if_index
37  */
38 void
41  dpo_id_t *dpo)
42 {
44 }
45 
46 u8*
47 format_interface_tx_dpo (u8* s, va_list *ap)
48 {
49  index_t index = va_arg(*ap, index_t);
50  CLIB_UNUSED(u32 indent) = va_arg(*ap, u32);
51  vnet_main_t * vnm = vnet_get_main();
52 
53  return (format(s, "%U-tx-dpo:",
55  vnm,
57 }
58 
59 static void
61 {
62 }
63 
64 u32*
66 {
67  u32 *node_indices = NULL;
68 
69  /*
70  * return the interface's TX node for the wrapped sw_if_index
71  */
72  vec_add1(node_indices,
74  dpo->dpoi_index));
75 
76  return (node_indices);
77 }
78 
81  .dv_unlock = interface_tx_dpo_unlock,
82  .dv_format = format_interface_tx_dpo,
83  .dv_mem_show = interface_tx_dpo_mem_show,
84  .dv_get_next_node = interface_tx_dpo_get_next_node,
85 };
86 
87 void
89 {
91 }
92 
interface_tx_dpo_lock
static void interface_tx_dpo_lock(dpo_id_t *dpo)
Definition: interface_tx_dpo.c:24
dpo_id_t_::dpoi_index
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:190
interface_tx_dpo_add_or_lock
void interface_tx_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, dpo_id_t *dpo)
The data-path object representing transmitting the packet on a n interface.
Definition: interface_tx_dpo.c:39
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
rewrite.h
interface_tx_dpo_module_init
void interface_tx_dpo_module_init(void)
Definition: interface_tx_dpo.c:88
vnet_get_sw_interface
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:58
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
interface_tx_dpo_unlock
static void interface_tx_dpo_unlock(dpo_id_t *dpo)
Definition: interface_tx_dpo.c:29
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
index_t
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:43
dpo_vft_t_::dv_lock
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:428
interface_tx_dpo_mem_show
static void interface_tx_dpo_mem_show(void)
Definition: interface_tx_dpo.c:60
format_interface_tx_dpo
u8 * format_interface_tx_dpo(u8 *s, va_list *ap)
Definition: interface_tx_dpo.c:47
vnet_main_t
Definition: vnet.h:76
vnet_tx_node_index_for_sw_interface
u32 vnet_tx_node_index_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: rewrite.c:89
index
u32 index
Definition: flow_types.api:221
format
description fragment has unexpected format
Definition: map.api:433
u32
unsigned int u32
Definition: types.h:88
interface_tx_dpo.h
DPO_INTERFACE_TX
@ DPO_INTERFACE_TX
Definition: dpo.h:120
interface_tx_dpo_get_next_node
u32 * interface_tx_dpo_get_next_node(const dpo_id_t *dpo)
Definition: interface_tx_dpo.c:65
interface_tx_dpo_vft
const static dpo_vft_t interface_tx_dpo_vft
Definition: interface_tx_dpo.c:79
dpo_vft_t_
A virtual function table regisitered for a DPO type.
Definition: dpo.h:423
u8
unsigned char u8
Definition: types.h:56
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
dpo_set
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:188
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
format_vnet_sw_interface_name
format_function_t format_vnet_sw_interface_name
Definition: interface_funcs.h:453
dpo_register
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
Definition: dpo.c:329