FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
punt.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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 __PUNT_H__
17 #define __PUNT_H__
18 
19 #include <vlib/vlib.h>
20 
21 /**
22  * The 'syatem' defined punt reasons.
23  * Only add to this list reasons defined and used within the vlib subsystem.
24  * To define new reasons in e.g. plgins, use punt_reason_alloc()
25  */
26 typedef enum vlib_punt_reason_t_
27 {
30 
31 
32 /**
33  * @brief Format a punt reason
34  */
35 extern u8 *format_vlib_punt_reason (u8 * s, va_list * args);
36 
37 /**
38  * Typedef for a client handle
39  */
40 typedef int vlib_punt_hdl_t;
41 
42 /**
43  * @brief Register a new clinet
44  *
45  * @param who - The name of the client
46  *
47  * @retrun the handle the punt infra allocated for this client that must
48  * be used when the client wishes to use the infra
49  */
51 
52 /**
53  * Allocate a new punt reason
54  */
55 extern int vlib_punt_reason_alloc (vlib_punt_hdl_t client,
56  const char *reason_name,
57  vlib_punt_reason_t * reason);
58 
59 /**
60  * @brief Register a node to receive particular punted buffers
61  *
62  * @paran client - The registered client registering for the packets
63  * @param reason - The reason the packet was punted
64  * @param node - The node to which the punted packets will be sent
65  */
66 extern int vlib_punt_register (vlib_punt_hdl_t client,
67  vlib_punt_reason_t reason, const char *node);
68 extern int vlib_punt_unregister (vlib_punt_hdl_t client,
69  vlib_punt_reason_t pr, const char *node);
70 
71 /**
72  * FOR USE IN THE DP ONLY
73  *
74  * Arc[s] to follow for each reason
75  */
76 extern u16 **punt_dp_db;
77 
78 /**
79  * FOR USE IN THE DP ONLY
80  *
81  * Per-reason counters
82  */
84 
85 #endif
86 
87 /*
88  * fd.io coding-style-patch-verification: ON
89  *
90  * Local Variables:
91  * eval: (c-set-style "gnu")
92  * End:
93  */
int vlib_punt_hdl_t
Typedef for a client handle.
Definition: punt.h:40
unsigned char u8
Definition: types.h:56
u8 * format_vlib_punt_reason(u8 *s, va_list *args)
Format a punt reason.
Definition: punt.c:132
int vlib_punt_reason_alloc(vlib_punt_hdl_t client, const char *reason_name, vlib_punt_reason_t *reason)
Allocate a new punt reason.
Definition: punt.c:370
int vlib_punt_register(vlib_punt_hdl_t client, vlib_punt_reason_t reason, const char *node)
Register a node to receive particular punted buffers.
Definition: punt.c:252
int vlib_punt_unregister(vlib_punt_hdl_t client, vlib_punt_reason_t pr, const char *node)
Definition: punt.c:316
vlib_punt_hdl_t vlib_punt_client_register(const char *who)
Register a new clinet.
Definition: punt.c:140
unsigned short u16
Definition: types.h:57
vlib_combined_counter_main_t punt_counters
FOR USE IN THE DP ONLY.
Definition: punt.c:26
A collection of combined counters.
Definition: counter.h:188
u16 ** punt_dp_db
FOR USE IN THE DP ONLY.
Definition: punt.c:103
vlib_punt_reason_t_
The &#39;syatem&#39; defined punt reasons.
Definition: punt.h:26
enum vlib_punt_reason_t_ vlib_punt_reason_t
The &#39;syatem&#39; defined punt reasons.