dpdk: Add support for Mellanox ConnectX-4 devices
[vpp.git] / vnet / vnet / fib / fib_node_list.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  * @brief a hetrogeneous w.r.t. FIB node type, list of FIB nodes.
17  * Since we cannot use C pointers, due to memeory reallocs, the next/prev
18  * are described as an index to an element. Each element contains a pointer
19  * (key:{type, index}) to a FIB node.
20  */
21
22 #ifndef __FIB_NODE_LIST_H__
23 #define __FIB_NODE_LIST_H__
24
25 #include <vnet/fib/fib_node.h>
26
27 extern fib_node_list_t fib_node_list_create(void);
28 extern void fib_node_list_destroy(fib_node_list_t *list);
29
30 extern u32 fib_node_list_push_front(fib_node_list_t head,
31                                     int owner_id,
32                                     fib_node_type_t type,
33                                     fib_node_index_t index);
34 extern u32 fib_node_list_push_back(fib_node_list_t head,
35                                    int owner_id,
36                                    fib_node_type_t type,
37                                    fib_node_index_t index);
38 extern void fib_node_list_remove(fib_node_list_t head,
39                                  u32 sibling);
40 extern void fib_node_list_elt_remove(u32 sibling);
41
42 extern int fib_node_list_advance(u32 sibling);
43
44 extern int fib_node_list_get_front(fib_node_list_t head,
45                                    fib_node_ptr_t *ptr);
46
47 extern int fib_node_list_elt_get_next(u32 elt,
48                                       fib_node_ptr_t *ptr);
49
50 extern u32 fib_node_list_get_size(fib_node_list_t head);
51
52 /**
53  * @brief Callback function invoked during a list walk
54  */
55 typedef int (*fib_node_list_walk_cb_t)(fib_node_ptr_t *owner,
56                                        void *args);
57
58 extern void fib_node_list_walk(fib_node_list_t head,
59                                fib_node_list_walk_cb_t fn,
60                                void *args);
61
62 extern void fib_node_list_memory_show(void);
63
64 #endif