[RFC PATCH 04/11] dev: move unrelated macros from header
David Marchand
david.marchand at redhat.com
Tue Jun 28 16:46:36 CEST 2022
RTE_FUNC_PTR_OR_* macros have nothing to do with the rte_device object
and associated API.
Move them to rte_common.h and include it where needed.
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
drivers/common/qat/qat_device.c | 1 +
drivers/compress/qat/qat_comp_pmd.c | 1 +
drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 1 +
drivers/net/ixgbe/rte_pmd_ixgbe.c | 1 +
drivers/net/liquidio/lio_ethdev.c | 1 +
lib/compressdev/rte_compressdev.c | 1 +
lib/dmadev/rte_dmadev.c | 1 +
lib/eal/include/rte_common.h | 11 +++++++++++
lib/eal/include/rte_dev.h | 11 -----------
lib/ethdev/ethdev_driver.c | 1 +
lib/ethdev/ethdev_pci.h | 1 +
lib/mempool/rte_mempool_ops.c | 1 +
lib/regexdev/rte_regexdev.c | 1 +
lib/security/rte_security.c | 1 +
lib/vhost/vdpa.c | 1 +
15 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index db4b087d2b..6583cf0554 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -2,6 +2,7 @@
* Copyright(c) 2018-2022 Intel Corporation
*/
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <rte_devargs.h>
#include <ctype.h>
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index dc8db84a68..e4cac159be 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -2,6 +2,7 @@
* Copyright(c) 2015-2022 Intel Corporation
*/
+#include <rte_common.h>
#include <rte_malloc.h>
#include "qat_comp.h"
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 1e0c4fe464..88c9b21cd8 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2017 Intel Corporation
*/
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <rte_reorder.h>
#include <rte_cryptodev.h>
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 9729f8575f..8ae4d9b39a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -2,6 +2,7 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
+#include <rte_common.h>
#include <ethdev_driver.h>
#include "base/ixgbe_api.h"
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 90ffe31b9f..ccbd0ff849 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -2,6 +2,7 @@
* Copyright(c) 2017 Cavium, Inc
*/
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <ethdev_driver.h>
#include <ethdev_pci.h>
diff --git a/lib/compressdev/rte_compressdev.c b/lib/compressdev/rte_compressdev.c
index 22c438f2dd..12469042f7 100644
--- a/lib/compressdev/rte_compressdev.c
+++ b/lib/compressdev/rte_compressdev.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <inttypes.h>
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <rte_malloc.h>
#include <rte_eal.h>
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..e199b888c8 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -5,6 +5,7 @@
#include <inttypes.h>
+#include <rte_common.h>
#include <rte_eal.h>
#include <rte_lcore.h>
#include <rte_log.h>
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index a96cc2a138..1617b5ed14 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -861,6 +861,17 @@ rte_log2_u64(uint64_t v)
/** Number of elements in the array. */
#define RTE_DIM(a) (sizeof (a) / sizeof ((a)[0]))
+/* Macros to check for invalid function pointers */
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+ if ((func) == NULL) \
+ return retval; \
+} while (0)
+
+#define RTE_FUNC_PTR_OR_RET(func) do { \
+ if ((func) == NULL) \
+ return; \
+} while (0)
+
/**
* Converts a numeric string to the equivalent uint64_t value.
* As well as straight number conversion, also recognises the suffixes
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index e6ff1218f9..24f9122558 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -36,17 +36,6 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
enum rte_dev_event_type event,
void *cb_arg);
-/* Macros to check for invalid function pointers */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
- if ((func) == NULL) \
- return retval; \
-} while (0)
-
-#define RTE_FUNC_PTR_OR_RET(func) do { \
- if ((func) == NULL) \
- return; \
-} while (0)
-
/**
* Device policies.
*/
diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
index a285f213f0..86f5a37874 100644
--- a/lib/ethdev/ethdev_driver.c
+++ b/lib/ethdev/ethdev_driver.c
@@ -2,6 +2,7 @@
* Copyright(c) 2022 Intel Corporation
*/
+#include <rte_common.h>
#include <rte_kvargs.h>
#include <rte_malloc.h>
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index 0549842709..b4bb460dcb 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -10,6 +10,7 @@
extern "C" {
#endif
+#include <rte_common.h>
#include <rte_malloc.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 2d36dee8f0..d60235a7e3 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <string.h>
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <rte_mempool.h>
#include <rte_errno.h>
diff --git a/lib/regexdev/rte_regexdev.c b/lib/regexdev/rte_regexdev.c
index 02a388bc5d..aa57ab5bfa 100644
--- a/lib/regexdev/rte_regexdev.c
+++ b/lib/regexdev/rte_regexdev.c
@@ -5,6 +5,7 @@
#include <string.h>
+#include <rte_common.h>
#include <rte_memzone.h>
#include <rte_string_fns.h>
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 4f5e4b4d49..046b6496d2 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -4,6 +4,7 @@
* Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
*/
+#include <rte_common.h>
#include <rte_cryptodev.h>
#include <rte_dev.h>
#include <rte_telemetry.h>
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index 8fa2153023..3597fe897d 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
#include <sys/queue.h>
+#include <rte_common.h>
#include <rte_class.h>
#include <rte_malloc.h>
#include <rte_spinlock.h>
--
2.36.1
More information about the dev
mailing list