Introduce the very basic NFP vDPA library.

Signed-off-by: Shujing Dong <shujing.d...@corigine.com>
Signed-off-by: Chaoyong He <chaoyong...@corigine.com>
Reviewed-by: Long Wu <long...@corigine.com>
Reviewed-by: Peng Zhang <peng.zh...@corigine.com>
---
 drivers/vdpa/meson.build        |  1 +
 drivers/vdpa/nfp/meson.build    | 16 ++++++++++++++++
 drivers/vdpa/nfp/nfp_vdpa_log.c |  9 +++++++++
 drivers/vdpa/nfp/nfp_vdpa_log.h | 21 +++++++++++++++++++++
 4 files changed, 47 insertions(+)
 create mode 100644 drivers/vdpa/nfp/meson.build
 create mode 100644 drivers/vdpa/nfp/nfp_vdpa_log.c
 create mode 100644 drivers/vdpa/nfp/nfp_vdpa_log.h

diff --git a/drivers/vdpa/meson.build b/drivers/vdpa/meson.build
index 77412c7d09..896e8e0304 100644
--- a/drivers/vdpa/meson.build
+++ b/drivers/vdpa/meson.build
@@ -8,6 +8,7 @@ endif
 drivers = [
         'ifc',
         'mlx5',
+        'nfp',
         'sfc',
 ]
 std_deps = ['bus_pci', 'kvargs']
diff --git a/drivers/vdpa/nfp/meson.build b/drivers/vdpa/nfp/meson.build
new file mode 100644
index 0000000000..b17866e157
--- /dev/null
+++ b/drivers/vdpa/nfp/meson.build
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2023 Corigine, Inc.
+
+if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
+    build = false
+    reason = 'only supported on 64-bit Linux'
+endif
+
+if not dpdk_conf.has('RTE_LIB_VHOST')
+    build = false
+    reason = 'missing dependency, DPDK vhost library'
+endif
+
+sources = files(
+        'nfp_vdpa_log.c',
+)
diff --git a/drivers/vdpa/nfp/nfp_vdpa_log.c b/drivers/vdpa/nfp/nfp_vdpa_log.c
new file mode 100644
index 0000000000..8c957d59ea
--- /dev/null
+++ b/drivers/vdpa/nfp/nfp_vdpa_log.c
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2023 Corigine, Inc.
+ * All rights reserved.
+ */
+
+#include "nfp_vdpa_log.h"
+
+RTE_LOG_REGISTER_SUFFIX(nfp_core_logtype, driver, NOTICE);
+RTE_LOG_REGISTER_SUFFIX(nfp_vdpa_logtype, driver, NOTICE);
diff --git a/drivers/vdpa/nfp/nfp_vdpa_log.h b/drivers/vdpa/nfp/nfp_vdpa_log.h
new file mode 100644
index 0000000000..c3fb274cb5
--- /dev/null
+++ b/drivers/vdpa/nfp/nfp_vdpa_log.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2023 Corigine, Inc.
+ * All rights reserved.
+ */
+
+#ifndef __NFP_VDPA_LOG_H__
+#define __NFP_VDPA_LOG_H__
+
+#include <rte_log.h>
+
+extern int nfp_vdpa_logtype;
+#define DRV_VDPA_LOG(level, fmt, args...) \
+       rte_log(RTE_LOG_ ## level, nfp_vdpa_logtype, \
+               "NFP_VDPA: %s(): " fmt "\n", __func__, ## args)
+
+extern int nfp_core_logtype;
+#define DRV_CORE_LOG(level, fmt, args...) \
+       rte_log(RTE_LOG_ ## level, nfp_core_logtype, \
+               "NFP_CORE: %s(): " fmt "\n", __func__, ## args)
+
+#endif /* __NFP_VDPA_LOG_H__ */
-- 
2.39.1

Reply via email to