From a5c308e68d5578e5d75327619e30d73a95abb1a5 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sun, 20 Jan 2019 02:02:51 +0100 Subject: dpdk: add buffer.h Change-Id: I998658ad7860b23425444e218ce2e1ec655b885a Signed-off-by: Damjan Marion --- src/plugins/dpdk/buffer.c | 1 + src/plugins/dpdk/buffer.h | 34 ++++++++++++++++++++++++++++++++++ src/plugins/dpdk/device/cli.c | 1 + src/plugins/dpdk/device/common.c | 2 +- src/plugins/dpdk/device/device.c | 2 +- src/plugins/dpdk/device/dpdk.h | 8 -------- src/plugins/dpdk/device/dpdk_priv.h | 3 --- src/plugins/dpdk/device/init.c | 1 + src/plugins/dpdk/device/node.c | 1 + src/plugins/dpdk/ipsec/crypto_node.c | 1 + src/plugins/dpdk/ipsec/esp_decrypt.c | 1 + src/plugins/dpdk/ipsec/esp_encrypt.c | 1 + 12 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 src/plugins/dpdk/buffer.h diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c index 827e7e85923..aed194074cc 100644 --- a/src/plugins/dpdk/buffer.c +++ b/src/plugins/dpdk/buffer.c @@ -77,6 +77,7 @@ #include #include #include +#include STATIC_ASSERT (VLIB_BUFFER_PRE_DATA_SIZE == RTE_PKTMBUF_HEADROOM, "VLIB_BUFFER_PRE_DATA_SIZE must be equal to RTE_PKTMBUF_HEADROOM"); diff --git a/src/plugins/dpdk/buffer.h b/src/plugins/dpdk/buffer.h new file mode 100644 index 00000000000..56bf4fff3e6 --- /dev/null +++ b/src/plugins/dpdk/buffer.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef include_dpdk_buffer_h +#define include_dpdk_buffer_h + +#define rte_mbuf_from_vlib_buffer(x) (((struct rte_mbuf *)x) - 1) +#define vlib_buffer_from_rte_mbuf(x) ((vlib_buffer_t *)(x+1)) + +clib_error_t *dpdk_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, + unsigned socket_id); + +#endif /* include_dpdk_buffer_h */ + +/** @endcond */ +/* + * fd.io coding-style-patch-verification: ON + * + * Local Variables: + * eval: (c-set-style "gnu") + * End: + */ diff --git a/src/plugins/dpdk/device/cli.c b/src/plugins/dpdk/device/cli.c index 7e20f565a8c..bbe367f7ec5 100644 --- a/src/plugins/dpdk/device/cli.c +++ b/src/plugins/dpdk/device/cli.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c index 57430eff977..25d5802899f 100644 --- a/src/plugins/dpdk/device/common.c +++ b/src/plugins/dpdk/device/common.c @@ -22,8 +22,8 @@ #include #include #include +#include #include - #include #include diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c index 9b54f34a5b2..86b9a50f41b 100644 --- a/src/plugins/dpdk/device/device.c +++ b/src/plugins/dpdk/device/device.c @@ -19,8 +19,8 @@ #include #include +#include #include - #include #include diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h index a1e07b42ca7..425cf265873 100644 --- a/src/plugins/dpdk/device/dpdk.h +++ b/src/plugins/dpdk/device/dpdk.h @@ -530,14 +530,6 @@ clib_error_t *unformat_rss_fn (unformat_input_t * input, uword * rss_fn); clib_error_t *unformat_hqos (unformat_input_t * input, dpdk_device_config_hqos_t * hqos); -clib_error_t *dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, - u32 elt_size, u32 num_elts, - u32 pool_priv_size, u16 cache_size, u8 numa, - struct rte_mempool **_mp, u32 * map_index); - -clib_error_t *dpdk_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, - unsigned socket_id); - struct rte_pci_device *dpdk_get_pci_device (const struct rte_eth_dev_info *info); diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h index b44cd49142c..1956cca19c3 100644 --- a/src/plugins/dpdk/device/dpdk_priv.h +++ b/src/plugins/dpdk/device/dpdk_priv.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#define rte_mbuf_from_vlib_buffer(x) (((struct rte_mbuf *)x) - 1) -#define vlib_buffer_from_rte_mbuf(x) ((vlib_buffer_t *)(x+1)) - #define DPDK_NB_RX_DESC_DEFAULT 1024 #define DPDK_NB_TX_DESC_DEFAULT 1024 #define DPDK_NB_RX_DESC_VIRTIO 256 diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 93f020595a9..dcff0e52293 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c index 250ded5048c..7db66ffab25 100644 --- a/src/plugins/dpdk/device/node.c +++ b/src/plugins/dpdk/device/node.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/dpdk/ipsec/crypto_node.c b/src/plugins/dpdk/ipsec/crypto_node.c index 966e86da288..84782b17ad4 100644 --- a/src/plugins/dpdk/ipsec/crypto_node.c +++ b/src/plugins/dpdk/ipsec/crypto_node.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/dpdk/ipsec/esp_decrypt.c b/src/plugins/dpdk/ipsec/esp_decrypt.c index dff22439ce4..d8d1d385f0f 100644 --- a/src/plugins/dpdk/ipsec/esp_decrypt.c +++ b/src/plugins/dpdk/ipsec/esp_decrypt.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/dpdk/ipsec/esp_encrypt.c b/src/plugins/dpdk/ipsec/esp_encrypt.c index cdeeb4022f6..fc12eece989 100644 --- a/src/plugins/dpdk/ipsec/esp_encrypt.c +++ b/src/plugins/dpdk/ipsec/esp_encrypt.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include -- cgit 1.2.3-korg