[v2,18/25] drivers/vdpa: introduce the NFP vDPA library

Message ID 20231024022849.3092506-19-chaoyong.he@corigine.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series add the NFP vDPA PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Oct. 24, 2023, 2:28 a.m. UTC
  Introduce the very basic NFP vDPA library.

Signed-off-by: Shujing Dong <shujing.dong@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@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
  

Comments

Ferruh Yigit Oct. 25, 2023, 4:09 p.m. UTC | #1
On 10/24/2023 3:28 AM, Chaoyong He wrote:
> Introduce the very basic NFP vDPA library.
> 
> Signed-off-by: Shujing Dong <shujing.dong@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>

<...>

> --- /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
> +

Similar to previous comment, this may break the build.
Instead of this check, it is possible to add vhost and common/nfp as
dependency to this driver, using 'deps'.


> +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);
>

Both has 'driver' has suffix, I assume copy/paste error.
  
Chaoyong He Oct. 26, 2023, 1:39 a.m. UTC | #2
> On 10/24/2023 3:28 AM, Chaoyong He wrote:
> > Introduce the very basic NFP vDPA library.
> >
> > Signed-off-by: Shujing Dong <shujing.dong@corigine.com>
> > Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> > Reviewed-by: Long Wu <long.wu@corigine.com>
> > Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> 
> <...>
> 
> > --- /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
> > +
> 
> Similar to previous comment, this may break the build.
> Instead of this check, it is possible to add vhost and common/nfp as
> dependency to this driver, using 'deps'.
> 

Sorry for that, I will drop it in the next version.

> 
> > +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);
> >
> 
> Both has 'driver' has suffix, I assume copy/paste error.

Thanks point that out, will revise in the next version.
  

Patch

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__ */