api: refactor vlibmemory
[vpp.git] / src / vnet / mfib / mfib_signal.h
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 __MFIB_SIGNAL_H__
17 #define __MFIB_SIGNAL_H__
18
19 #include <vlib/vlib.h>
20 #include <vnet/mfib/mfib_types.h>
21 #include <vnet/mfib/mfib_itf.h>
22 #include <vnet/mfib/mfib_entry.h>
23
24 #define MFIB_SIGNAL_BUFFER_SIZE 255
25
26 /**
27  * A pair of indicies, for the entry and interface resp.
28  */
29 typedef struct mfib_signal_t_
30 {
31     fib_node_index_t mfs_entry;
32     index_t mfs_itf;
33
34     /**
35      * @brief A buffer copied from the DP plane that triggered the signal
36      */
37     u8 mfs_buffer[MFIB_SIGNAL_BUFFER_SIZE];
38
39     u8 mfs_buffer_len;
40 } mfib_signal_t;
41
42
43 extern void mfib_signal_push(const mfib_entry_t *mfe,
44                              mfib_itf_t *mfi,
45                              vlib_buffer_t *b0);
46 extern void mfib_signal_remove_itf(const mfib_itf_t *mfi);
47
48 extern void mfib_signal_module_init(void);
49
50 struct _svm_queue;
51
52 extern void vl_mfib_signal_send_one(struct _svm_queue *q,
53                                     u32 context,
54                                     const mfib_signal_t *mfs);
55 extern int mfib_signal_send_one(struct _svm_queue *q,
56                                 u32 context);
57
58 #endif
59