Add ability to filter and change MACs
[vpp.git] / vnet / vnet / plugin / p1.c
1 /*
2  * Copyright (c) 2015 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  * This file and in fact the entire directory shouldn't even exist.
17  * Vnet ought to be a dynamic library. 
18
19  * Unfortunately, various things malfunction when we try to go there. 
20  * Plugin DLL's end up with their own copies of critical
21  * data structures. No one of these problems would be tough to fix, 
22  * but there are quite a number of them.
23  */
24
25 /* 
26  * Make certain that plugin .dll's which reference the following functions
27  * can find them...
28  */
29
30 #define foreach_plugin_reference                \
31 _(unformat_vnet_hw_interface)                   \
32 _(unformat_vnet_sw_interface)                   \
33 _(format_vnet_hw_interface)                     \
34 _(format_vnet_sw_interface)                     \
35 _(format_vnet_sw_interface_name_override)       \
36 _(vnet_hw_interface_rx_redirect_to_node)        \
37 _(vnet_config_add_feature)                      \
38 _(vnet_config_del_feature)                      \
39 _(vnet_get_main)                                \
40 _(_vlib_init_function_l2_init)                  \
41 _(_vlib_init_function_pg_init)                  \
42 _(_vlib_init_function_ip_main_init)             \
43 _(_vlib_init_function_ethernet_init)            \
44 _(_vlib_init_function_ethernet_arp_init)        \
45 _(_vlib_config_function_dpdk_config)            \
46 _(l2input_intf_bitmap_enable)                   \
47 _(ip4_main)                                     \
48 _(ip6_main)                                     \
49 _(format_ip4_address)                           \
50 _(unformat_ip4_address)                         \
51 _(ip4_address_compare)                          \
52 _(ip6_address_compare)                          \
53 _(format_ip6_address)                           \
54 _(format_ip6_address_and_length)                \
55 _(udp_register_dst_port)                        \
56 _(ethernet_register_input_type)                 \
57 _(ethernet_set_flags)                           \
58 _(format_ip6_address)                           \
59 _(unformat_ip6_address)                         \
60 _(ip6_main)                                     \
61 _(find_ip6_fib_by_table_index_or_id)            \
62 _(format_ethernet_address)                      \
63 _(unformat_ethernet_address)                    \
64 _(unformat_ethernet_interface)                  \
65 _(ethernet_register_l2_input)                   \
66 _(ethernet_register_l3_redirect)                \
67 _(unformat_pg_payload)                          \
68 _(format_ip4_address_and_length)                \
69 _(ip_incremental_checksum)                      \
70 _(ethernet_sw_interface_set_l2_mode)            \
71 _(vnet_create_loopback_interface)               \
72 _(ethernet_set_rx_redirect)                     \
73 _(ethernet_set_flags)                           \
74 _(ethernet_get_main)                            \
75 _(ethernet_get_interface)                       \
76 _(vnet_hw_interface_set_flags)                  \
77 _(vnet_sw_interface_set_flags)                  \
78 _(vnet_create_sw_interface)                     \
79 _(vnet_delete_sw_interface)                     \
80 _(vnet_get_main)                                \
81 _(pg_stream_add)                                \
82 _(pg_stream_del)                                \
83 _(pg_stream_enable_disable)                     \
84 _(pg_main)                                      \
85 _(ip_main)                                      \
86 _(unformat_pg_edit)                             \
87 _(unformat_tcp_udp_port)                        \
88 _(unformat_pg_number)                           \
89 _(_vlib_init_function_ip4_lookup_init)          \
90 _(_vlib_init_function_ip6_lookup_init)          \
91 _(ip4_register_protocol)                        \
92 _(ip6_register_protocol)                        \
93 _(ip_csum_and_memcpy)
94
95 #if DPDK > 0
96 #define foreach_dpdk_plugin_reference           \
97 _(dpdk_set_next_node)                           \
98 _(dpdk_worker_thread)                           \
99 _(dpdk_io_thread)                               \
100 _(dpdk_frame_queue_dequeue)                     \
101 _(vlib_get_handoff_queue_elt)                   \
102 _(dpdk_get_handoff_node_index)                  \
103 _(dpdk_set_flowcontrol_callback)                \
104 _(dpdk_interface_tx_vector)                     \
105 _(rte_calloc)                                   \
106 _(rte_free)                                     \
107 _(rte_malloc)                                   \
108 _(rte_zmalloc)                                  \
109 _(rte_malloc_virt2phy)                          \
110 _(rte_eal_get_configuration)                    \
111 _(post_sw_interface_set_flags)                  \
112 _(dpdk_get_admin_up_down_in_progress)           \
113 _(efd_config)                                   \
114 _(dpdk_set_mac_address)                         \
115 _(dpdk_set_mc_filter)
116 #else
117 #define foreach_dpdk_plugin_reference
118 #endif
119
120 #if IPV6SR > 0
121 #define foreach_ip6_sr_plugin_reference         \
122 _(vnet_register_sr_app_callback)                \
123 _(format_ip6_sr_header)
124 #else
125 #define foreach_ip6_sr_plugin_reference
126 #endif 
127
128 #define _(a) void a (void);
129 foreach_plugin_reference
130 foreach_dpdk_plugin_reference
131 foreach_ip6_sr_plugin_reference
132 #undef _
133
134 void *vnet_library_plugin_references[] =
135   {
136 #define _(a) &a,
137     foreach_plugin_reference
138     foreach_dpdk_plugin_reference
139     foreach_ip6_sr_plugin_reference
140 #undef _
141   };
142
143 void vnet_library_plugin_reference(void) { }