[3/3] ethdev: import and export data variables for MSVC
Checks
Commit Message
MSVC requires that data variables be explicitly declared as either
imported or exported. Provide macros that allow dpdk to correctly
declare data variables as exported for itself and imported for
applications.
Use new per-library macro to declare variables exported or imported for
per-lcore data variables.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
lib/ethdev/meson.build | 1 +
lib/ethdev/rte_ethdev_core.h | 3 +++
lib/ethdev/rte_ethdev_export.h | 23 +++++++++++++++++++++++
lib/ethdev/version.map | 2 +-
4 files changed, 28 insertions(+), 1 deletion(-)
create mode 100644 lib/ethdev/rte_ethdev_export.h
Comments
On Tue, 12 Mar 2024 00:51:48 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> diff --git a/lib/ethdev/rte_ethdev_export.h b/lib/ethdev/rte_ethdev_export.h
> new file mode 100644
> index 0000000..7887bee
> --- /dev/null
> +++ b/lib/ethdev/rte_ethdev_export.h
> @@ -0,0 +1,23 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2024 Microsoft Corporation
> + */
> +
> +#ifndef _RTE_ETHDEV_EXPORT_H_
> +#define _RTE_ETHDEV_EXPORT_H_
> +
> +/**
> + * @file
> + *
> + * Import / Export macros for ethdev data variables.
> + */
> +
> +#include <rte_common.h>
> +
> +#ifndef __rte_ethdev_export
> +#define __rte_ethdev_export __rte_declare_import
> +#else
> +#undef __rte_ethdev_export
> +#define __rte_ethdev_export __rte_declare_export
> +#endif
> +
> +#endif
Why not put this in rte_ethdev_core.h rather than a new file??
Patch needs to be resubmitted anyway because it fails github build
from missing C++ guards.
@@ -23,6 +23,7 @@ sources = files(
headers = files(
'rte_cman.h',
'rte_ethdev.h',
+ 'rte_ethdev_export.h',
'rte_ethdev_trace_fp.h',
'rte_dev_info.h',
'rte_flow.h',
@@ -16,6 +16,8 @@
* Applications should not use these directly.
*/
+#include <rte_ethdev_export.h>
+
struct rte_eth_dev_callback;
/** @internal Structure to keep track of registered callbacks */
RTE_TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
@@ -126,6 +128,7 @@ struct __rte_cache_aligned rte_eth_fp_ops {
};
+__rte_ethdev_export
extern struct rte_eth_fp_ops rte_eth_fp_ops[RTE_MAX_ETHPORTS];
#endif /* _RTE_ETHDEV_CORE_H_ */
new file mode 100644
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Microsoft Corporation
+ */
+
+#ifndef _RTE_ETHDEV_EXPORT_H_
+#define _RTE_ETHDEV_EXPORT_H_
+
+/**
+ * @file
+ *
+ * Import / Export macros for ethdev data variables.
+ */
+
+#include <rte_common.h>
+
+#ifndef __rte_ethdev_export
+#define __rte_ethdev_export __rte_declare_import
+#else
+#undef __rte_ethdev_export
+#define __rte_ethdev_export __rte_declare_export
+#endif
+
+#endif
@@ -83,7 +83,7 @@ DPDK_24 {
rte_eth_find_next_of;
rte_eth_find_next_owned_by;
rte_eth_find_next_sibling;
- rte_eth_fp_ops;
+ rte_eth_fp_ops; # MSVC_NO_EXPORT
rte_eth_iterator_cleanup;
rte_eth_iterator_init;
rte_eth_iterator_next;