dpdk: add buffer.h
[vpp.git] / src / plugins / dpdk / buffer.h
1 /*
2  * Copyright (c) 2017-2019 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 include_dpdk_buffer_h
17 #define include_dpdk_buffer_h
18
19 #define rte_mbuf_from_vlib_buffer(x) (((struct rte_mbuf *)x) - 1)
20 #define vlib_buffer_from_rte_mbuf(x) ((vlib_buffer_t *)(x+1))
21
22 clib_error_t *dpdk_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs,
23                                        unsigned socket_id);
24
25 #endif /* include_dpdk_buffer_h */
26
27 /** @endcond */
28 /*
29  * fd.io coding-style-patch-verification: ON
30  *
31  * Local Variables:
32  * eval: (c-set-style "gnu")
33  * End:
34  */