DPDK patches and discussions
 help / color / mirror / Atom feed
From: Haiyue Wang <haiyue.wang@intel.com>
To: dev@dpdk.org, xiaolong.ye@intel.com, qi.z.zhang@intel.com,
	qiming.yang@intel.com
Cc: Haiyue Wang <haiyue.wang@intel.com>
Subject: [dpdk-dev] [PATCH v1] net/iavf/base: make the base code as common share
Date: Thu,  2 Jan 2020 13:33:38 +0800	[thread overview]
Message-ID: <20200102053338.112378-1-haiyue.wang@intel.com> (raw)

The iavf base code can be shared with iavf, i40evf PMDs, so make it as
common share part firstly.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
 drivers/common/Makefile                       |   5 +
 drivers/common/iavf/Makefile                  |  28 +++++
 drivers/{net/iavf/base => common/iavf}/README |   0
 .../iavf/base => common/iavf}/iavf_adminq.c   |   0
 .../iavf/base => common/iavf}/iavf_adminq.h   |   0
 .../base => common/iavf}/iavf_adminq_cmd.h    |   0
 .../iavf/base => common/iavf}/iavf_alloc.h    |   0
 .../iavf/base => common/iavf}/iavf_common.c   |   0
 .../iavf/base => common/iavf}/iavf_devids.h   |   0
 drivers/common/iavf/iavf_main.c               | 114 ++++++++++++++++++
 .../iavf/base => common/iavf}/iavf_osdep.h    |  49 ++------
 .../base => common/iavf}/iavf_prototype.h     |   0
 .../iavf/base => common/iavf}/iavf_register.h |   0
 .../iavf/base => common/iavf}/iavf_status.h   |   0
 .../iavf/base => common/iavf}/iavf_type.h     |   0
 drivers/common/iavf/meson.build               |  10 ++
 .../common/iavf/rte_common_iavf_version.map   |  12 ++
 .../{net/iavf/base => common/iavf}/virtchnl.h |   0
 drivers/common/meson.build                    |   2 +-
 drivers/net/iavf/Makefile                     |  23 +---
 drivers/net/iavf/base/meson.build             |  23 ----
 drivers/net/iavf/iavf.h                       |   6 +-
 drivers/net/iavf/iavf_ethdev.c                |  83 -------------
 drivers/net/iavf/iavf_rxtx.c                  |   3 -
 drivers/net/iavf/iavf_rxtx_vec_avx2.c         |   1 -
 drivers/net/iavf/iavf_rxtx_vec_sse.c          |   2 -
 drivers/net/iavf/iavf_vchnl.c                 |   5 -
 drivers/net/iavf/meson.build                  |   4 +-
 mk/rte.app.mk                                 |   4 +
 29 files changed, 191 insertions(+), 183 deletions(-)
 create mode 100644 drivers/common/iavf/Makefile
 rename drivers/{net/iavf/base => common/iavf}/README (100%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_adminq.c (100%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_adminq.h (100%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_adminq_cmd.h (100%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_alloc.h (100%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_common.c (100%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_devids.h (100%)
 create mode 100644 drivers/common/iavf/iavf_main.c
 rename drivers/{net/iavf/base => common/iavf}/iavf_osdep.h (76%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_prototype.h (100%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_register.h (100%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_status.h (100%)
 rename drivers/{net/iavf/base => common/iavf}/iavf_type.h (100%)
 create mode 100644 drivers/common/iavf/meson.build
 create mode 100644 drivers/common/iavf/rte_common_iavf_version.map
 rename drivers/{net/iavf/base => common/iavf}/virtchnl.h (100%)
 delete mode 100644 drivers/net/iavf/base/meson.build

diff --git a/drivers/common/Makefile b/drivers/common/Makefile
index 1ff033bba..3254c5274 100644
--- a/drivers/common/Makefile
+++ b/drivers/common/Makefile
@@ -30,4 +30,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_COMMON_DPAAX),y)
 DIRS-y += dpaax
 endif
 
+IAVF-y := $(CONFIG_RTE_LIBRTE_IAVF_PMD)
+ifneq (,$(findstring y,$(IAVF-y)))
+DIRS-y += iavf
+endif
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/common/iavf/Makefile b/drivers/common/iavf/Makefile
new file mode 100644
index 000000000..e3b2e7a3c
--- /dev/null
+++ b/drivers/common/iavf/Makefile
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_common_iavf.a
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -Wno-pointer-arith
+CFLAGS += -Wno-cast-qual
+
+EXPORT_MAP := rte_common_iavf_version.map
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-y += iavf_adminq.c
+SRCS-y += iavf_common.c
+SRCS-y += iavf_main.c
+
+LDLIBS += -lrte_eal
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/iavf/base/README b/drivers/common/iavf/README
similarity index 100%
rename from drivers/net/iavf/base/README
rename to drivers/common/iavf/README
diff --git a/drivers/net/iavf/base/iavf_adminq.c b/drivers/common/iavf/iavf_adminq.c
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.c
rename to drivers/common/iavf/iavf_adminq.c
diff --git a/drivers/net/iavf/base/iavf_adminq.h b/drivers/common/iavf/iavf_adminq.h
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.h
rename to drivers/common/iavf/iavf_adminq.h
diff --git a/drivers/net/iavf/base/iavf_adminq_cmd.h b/drivers/common/iavf/iavf_adminq_cmd.h
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq_cmd.h
rename to drivers/common/iavf/iavf_adminq_cmd.h
diff --git a/drivers/net/iavf/base/iavf_alloc.h b/drivers/common/iavf/iavf_alloc.h
similarity index 100%
rename from drivers/net/iavf/base/iavf_alloc.h
rename to drivers/common/iavf/iavf_alloc.h
diff --git a/drivers/net/iavf/base/iavf_common.c b/drivers/common/iavf/iavf_common.c
similarity index 100%
rename from drivers/net/iavf/base/iavf_common.c
rename to drivers/common/iavf/iavf_common.c
diff --git a/drivers/net/iavf/base/iavf_devids.h b/drivers/common/iavf/iavf_devids.h
similarity index 100%
rename from drivers/net/iavf/base/iavf_devids.h
rename to drivers/common/iavf/iavf_devids.h
diff --git a/drivers/common/iavf/iavf_main.c b/drivers/common/iavf/iavf_main.c
new file mode 100644
index 000000000..e96b41143
--- /dev/null
+++ b/drivers/common/iavf/iavf_main.c
@@ -0,0 +1,114 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <stdio.h>
+#include <inttypes.h>
+
+#include <rte_common.h>
+#include <rte_random.h>
+#include <rte_malloc.h>
+#include <rte_memzone.h>
+
+#include "iavf_type.h"
+#include "iavf_prototype.h"
+
+int iavf_logger;
+
+void
+iavf_init_spinlock(struct iavf_spinlock *sp)
+{
+	rte_spinlock_init(&sp->spinlock);
+}
+
+void
+iavf_acquire_spinlock(struct iavf_spinlock *sp)
+{
+	rte_spinlock_lock(&sp->spinlock);
+}
+
+void
+iavf_release_spinlock(struct iavf_spinlock *sp)
+{
+	rte_spinlock_unlock(&sp->spinlock);
+}
+
+void
+iavf_destroy_spinlock(__rte_unused struct iavf_spinlock *sp)
+{
+}
+
+enum iavf_status
+iavf_allocate_dma_mem(__rte_unused struct iavf_hw *hw, struct iavf_dma_mem *mem,
+		      __rte_unused enum iavf_memory_type type,
+		      u64 size, u32 alignment)
+{
+	const struct rte_memzone *mz = NULL;
+	char z_name[RTE_MEMZONE_NAMESIZE];
+
+	if (!mem)
+		return IAVF_ERR_PARAM;
+
+	snprintf(z_name, sizeof(z_name), "iavf_dma_%"PRIu64, rte_rand());
+	mz = rte_memzone_reserve_bounded(z_name, size, SOCKET_ID_ANY,
+					 RTE_MEMZONE_IOVA_CONTIG, alignment,
+					 RTE_PGSIZE_2M);
+	if (!mz)
+		return IAVF_ERR_NO_MEMORY;
+
+	mem->size = size;
+	mem->va = mz->addr;
+	mem->pa = mz->iova;
+	mem->zone = mz;
+
+	return IAVF_SUCCESS;
+}
+
+enum iavf_status
+iavf_free_dma_mem(__rte_unused struct iavf_hw *hw, struct iavf_dma_mem *mem)
+{
+	if (!mem)
+		return IAVF_ERR_PARAM;
+
+	rte_memzone_free(mem->zone);
+	mem->zone = NULL;
+	mem->va = NULL;
+	mem->pa = (u64)0;
+
+	return IAVF_SUCCESS;
+}
+
+enum iavf_status
+iavf_allocate_virt_mem(__rte_unused struct iavf_hw *hw,
+		       struct iavf_virt_mem *mem, u32 size)
+{
+	if (!mem)
+		return IAVF_ERR_PARAM;
+
+	mem->size = size;
+	mem->va = rte_zmalloc("iavf", size, 0);
+
+	if (mem->va)
+		return IAVF_SUCCESS;
+	else
+		return IAVF_ERR_NO_MEMORY;
+}
+
+enum iavf_status
+iavf_free_virt_mem(__rte_unused struct iavf_hw *hw, struct iavf_virt_mem *mem)
+{
+	if (!mem)
+		return IAVF_ERR_PARAM;
+
+	rte_free(mem->va);
+	mem->va = NULL;
+
+	return IAVF_SUCCESS;
+}
+
+RTE_INIT(iavf_log)
+{
+	iavf_logger = rte_log_register("pmd.common.iavf");
+	if (iavf_logger >= 0)
+		rte_log_set_level(iavf_logger, RTE_LOG_NOTICE);
+}
diff --git a/drivers/net/iavf/base/iavf_osdep.h b/drivers/common/iavf/iavf_osdep.h
similarity index 76%
rename from drivers/net/iavf/base/iavf_osdep.h
rename to drivers/common/iavf/iavf_osdep.h
index 1b22f9fbc..e150f5596 100644
--- a/drivers/net/iavf/base/iavf_osdep.h
+++ b/drivers/common/iavf/iavf_osdep.h
@@ -21,8 +21,6 @@
 #include <rte_log.h>
 #include <rte_io.h>
 
-#include "../iavf_log.h"
-
 #define INLINE inline
 #define STATIC static
 
@@ -72,9 +70,6 @@ typedef uint64_t        u64;
 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
 #define ASSERT(x) if(!(x)) rte_panic("IAVF: x")
 
-#define DEBUGOUT(S)             PMD_DRV_LOG_RAW(DEBUG, S)
-#define DEBUGOUT2(S, A...)      PMD_DRV_LOG_RAW(DEBUG, S, ##A)
-#define DEBUGFUNC(F)            DEBUGOUT(F "\n")
 
 #define CPU_TO_LE16(o) rte_cpu_to_le_16(o)
 #define CPU_TO_LE32(s) rte_cpu_to_le_32(s)
@@ -123,10 +118,17 @@ uint32_t iavf_read_addr(volatile void *addr)
 
 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
 
+extern int iavf_logger;
+
+#define DEBUGOUT(S)             rte_log(RTE_LOG_DEBUG, iavf_logger, S)
+#define DEBUGOUT2(S, A...)      rte_log(RTE_LOG_DEBUG, iavf_logger, S, ##A)
+#define DEBUGFUNC(F)            DEBUGOUT(F "\n")
+
 #define iavf_debug(h, m, s, ...)                                \
 do {                                                            \
 	if (((m) & (h)->debug_mask))                            \
-		PMD_DRV_LOG_RAW(DEBUG, "iavf %02x.%x " s,       \
+		rte_log(RTE_LOG_DEBUG, iavf_logger,             \
+			"iavf %02x.%x " s,                      \
 			(h)->bus.device, (h)->bus.func,         \
 					##__VA_ARGS__);         \
 } while (0)
@@ -149,39 +151,4 @@ struct iavf_spinlock {
 	rte_spinlock_t spinlock;
 };
 
-#define iavf_allocate_dma_mem(h, m, unused, s, a) \
-			iavf_allocate_dma_mem_d(h, m, s, a)
-#define iavf_free_dma_mem(h, m) iavf_free_dma_mem_d(h, m)
-
-#define iavf_allocate_virt_mem(h, m, s) iavf_allocate_virt_mem_d(h, m, s)
-#define iavf_free_virt_mem(h, m) iavf_free_virt_mem_d(h, m)
-
-static inline void
-iavf_init_spinlock_d(struct iavf_spinlock *sp)
-{
-	rte_spinlock_init(&sp->spinlock);
-}
-
-static inline void
-iavf_acquire_spinlock_d(struct iavf_spinlock *sp)
-{
-	rte_spinlock_lock(&sp->spinlock);
-}
-
-static inline void
-iavf_release_spinlock_d(struct iavf_spinlock *sp)
-{
-	rte_spinlock_unlock(&sp->spinlock);
-}
-
-static inline void
-iavf_destroy_spinlock_d(__rte_unused struct iavf_spinlock *sp)
-{
-}
-
-#define iavf_init_spinlock(_sp) iavf_init_spinlock_d(_sp)
-#define iavf_acquire_spinlock(_sp) iavf_acquire_spinlock_d(_sp)
-#define iavf_release_spinlock(_sp) iavf_release_spinlock_d(_sp)
-#define iavf_destroy_spinlock(_sp) iavf_destroy_spinlock_d(_sp)
-
 #endif /* _IAVF_OSDEP_H_ */
diff --git a/drivers/net/iavf/base/iavf_prototype.h b/drivers/common/iavf/iavf_prototype.h
similarity index 100%
rename from drivers/net/iavf/base/iavf_prototype.h
rename to drivers/common/iavf/iavf_prototype.h
diff --git a/drivers/net/iavf/base/iavf_register.h b/drivers/common/iavf/iavf_register.h
similarity index 100%
rename from drivers/net/iavf/base/iavf_register.h
rename to drivers/common/iavf/iavf_register.h
diff --git a/drivers/net/iavf/base/iavf_status.h b/drivers/common/iavf/iavf_status.h
similarity index 100%
rename from drivers/net/iavf/base/iavf_status.h
rename to drivers/common/iavf/iavf_status.h
diff --git a/drivers/net/iavf/base/iavf_type.h b/drivers/common/iavf/iavf_type.h
similarity index 100%
rename from drivers/net/iavf/base/iavf_type.h
rename to drivers/common/iavf/iavf_type.h
diff --git a/drivers/common/iavf/meson.build b/drivers/common/iavf/meson.build
new file mode 100644
index 000000000..09c121a7b
--- /dev/null
+++ b/drivers/common/iavf/meson.build
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+allow_experimental_apis = true
+
+sources = files('iavf_adminq.c', 'iavf_common.c', 'iavf_main.c')
+
+if cc.has_argument('-Wno-pointer-to-int-cast')
+        cflags += '-Wno-pointer-to-int-cast'
+endif
diff --git a/drivers/common/iavf/rte_common_iavf_version.map b/drivers/common/iavf/rte_common_iavf_version.map
new file mode 100644
index 000000000..1a0839262
--- /dev/null
+++ b/drivers/common/iavf/rte_common_iavf_version.map
@@ -0,0 +1,12 @@
+DPDK_20.0 {
+	global:
+
+	iavf_init_adminq;
+	iavf_shutdown_adminq;
+	iavf_aq_send_msg_to_pf;
+	iavf_clean_arq_element;
+	iavf_set_mac_type;
+	iavf_vf_parse_hw_config;
+
+	local: *;
+};
diff --git a/drivers/net/iavf/base/virtchnl.h b/drivers/common/iavf/virtchnl.h
similarity index 100%
rename from drivers/net/iavf/base/virtchnl.h
rename to drivers/common/iavf/virtchnl.h
diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index 7b5e566f3..fc620f741 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -2,6 +2,6 @@
 # Copyright(c) 2018 Cavium, Inc
 
 std_deps = ['eal']
-drivers = ['cpt', 'dpaax', 'mvep', 'octeontx', 'octeontx2', 'qat']
+drivers = ['cpt', 'dpaax', 'iavf', 'mvep', 'octeontx', 'octeontx2', 'qat']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
 driver_name_fmt = 'rte_common_@0@'
diff --git a/drivers/net/iavf/Makefile b/drivers/net/iavf/Makefile
index 81c9a0dbf..514073d76 100644
--- a/drivers/net/iavf/Makefile
+++ b/drivers/net/iavf/Makefile
@@ -8,37 +8,18 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_iavf.a
 
+CFLAGS += -I$(RTE_SDK)/drivers/common/iavf
 CFLAGS += -O3 $(WERROR_FLAGS) -Wno-strict-aliasing -DALLOW_EXPERIMENTAL_API
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
 LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_common_iavf
 
 EXPORT_MAP := rte_pmd_iavf_version.map
 
-#
-# Add extra flags for base driver files (also known as shared code)
-# to disable warnings
-#
-ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
-CFLAGS_BASE_DRIVER =
-else ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
-CFLAGS_BASE_DRIVER = -Wno-pointer-to-int-cast
-else
-CFLAGS_BASE_DRIVER = -Wno-pointer-to-int-cast
-
-endif
-OBJS_BASE_DRIVER=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
-$(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
-
-
-VPATH += $(SRCDIR)/base
-
 #
 # all source are stored in SRCS-y
 #
-SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf_adminq.c
-SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf_common.c
-
 SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf_vchnl.c
 SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf_rxtx.c
diff --git a/drivers/net/iavf/base/meson.build b/drivers/net/iavf/base/meson.build
deleted file mode 100644
index bcb24b739..000000000
--- a/drivers/net/iavf/base/meson.build
+++ /dev/null
@@ -1,23 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
-
-sources = [
-	'iavf_adminq.c',
-	'iavf_common.c',
-]
-
-error_cflags = ['-Wno-pointer-to-int-cast']
-c_args = cflags
-if allow_experimental_apis
-	c_args += '-DALLOW_EXPERIMENTAL_API'
-endif
-foreach flag: error_cflags
-	if cc.has_argument(flag)
-		c_args += flag
-	endif
-endforeach
-
-base_lib = static_library('iavf_base', sources,
-	dependencies: static_rte_eal,
-	c_args: c_args)
-base_objs = base_lib.extract_all_objects()
diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 77b706893..7c5d5b339 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -6,7 +6,11 @@
 #define _IAVF_ETHDEV_H_
 
 #include <rte_kvargs.h>
-#include "base/iavf_type.h"
+#include <iavf_prototype.h>
+#include <iavf_adminq_cmd.h>
+#include <iavf_type.h>
+
+#include "iavf_log.h"
 
 #define IAVF_AQ_LEN               32
 #define IAVF_AQ_BUF_SZ            4096
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 233f2fb3a..f69c50df5 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -25,11 +25,6 @@
 #include <rte_memzone.h>
 #include <rte_dev.h>
 
-#include "iavf_log.h"
-#include "base/iavf_prototype.h"
-#include "base/iavf_adminq_cmd.h"
-#include "base/iavf_type.h"
-
 #include "iavf.h"
 #include "iavf_rxtx.h"
 
@@ -1470,81 +1465,3 @@ RTE_INIT(iavf_init_log)
 		rte_log_set_level(iavf_logtype_tx_free, RTE_LOG_DEBUG);
 #endif
 }
-
-/* memory func for base code */
-enum iavf_status
-iavf_allocate_dma_mem_d(__rte_unused struct iavf_hw *hw,
-		       struct iavf_dma_mem *mem,
-		       u64 size,
-		       u32 alignment)
-{
-	const struct rte_memzone *mz = NULL;
-	char z_name[RTE_MEMZONE_NAMESIZE];
-
-	if (!mem)
-		return IAVF_ERR_PARAM;
-
-	snprintf(z_name, sizeof(z_name), "iavf_dma_%"PRIu64, rte_rand());
-	mz = rte_memzone_reserve_bounded(z_name, size, SOCKET_ID_ANY,
-			RTE_MEMZONE_IOVA_CONTIG, alignment, RTE_PGSIZE_2M);
-	if (!mz)
-		return IAVF_ERR_NO_MEMORY;
-
-	mem->size = size;
-	mem->va = mz->addr;
-	mem->pa = mz->phys_addr;
-	mem->zone = (const void *)mz;
-	PMD_DRV_LOG(DEBUG,
-		    "memzone %s allocated with physical address: %"PRIu64,
-		    mz->name, mem->pa);
-
-	return IAVF_SUCCESS;
-}
-
-enum iavf_status
-iavf_free_dma_mem_d(__rte_unused struct iavf_hw *hw,
-		   struct iavf_dma_mem *mem)
-{
-	if (!mem)
-		return IAVF_ERR_PARAM;
-
-	PMD_DRV_LOG(DEBUG,
-		    "memzone %s to be freed with physical address: %"PRIu64,
-		    ((const struct rte_memzone *)mem->zone)->name, mem->pa);
-	rte_memzone_free((const struct rte_memzone *)mem->zone);
-	mem->zone = NULL;
-	mem->va = NULL;
-	mem->pa = (u64)0;
-
-	return IAVF_SUCCESS;
-}
-
-enum iavf_status
-iavf_allocate_virt_mem_d(__rte_unused struct iavf_hw *hw,
-			struct iavf_virt_mem *mem,
-			u32 size)
-{
-	if (!mem)
-		return IAVF_ERR_PARAM;
-
-	mem->size = size;
-	mem->va = rte_zmalloc("iavf", size, 0);
-
-	if (mem->va)
-		return IAVF_SUCCESS;
-	else
-		return IAVF_ERR_NO_MEMORY;
-}
-
-enum iavf_status
-iavf_free_virt_mem_d(__rte_unused struct iavf_hw *hw,
-		    struct iavf_virt_mem *mem)
-{
-	if (!mem)
-		return IAVF_ERR_PARAM;
-
-	rte_free(mem->va);
-	mem->va = NULL;
-
-	return IAVF_SUCCESS;
-}
diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 88f79ba37..067290db4 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -24,9 +24,6 @@
 #include <rte_ip.h>
 #include <rte_net.h>
 
-#include "iavf_log.h"
-#include "base/iavf_prototype.h"
-#include "base/iavf_type.h"
 #include "iavf.h"
 #include "iavf_rxtx.h"
 
diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx2.c b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
index a5133d8d8..7c5d23fd0 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx2.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
@@ -2,7 +2,6 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "base/iavf_prototype.h"
 #include "iavf_rxtx_vec_common.h"
 
 #include <x86intrin.h>
diff --git a/drivers/net/iavf/iavf_rxtx_vec_sse.c b/drivers/net/iavf/iavf_rxtx_vec_sse.c
index 2b16dc1b5..b978cc6e0 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_sse.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_sse.c
@@ -6,8 +6,6 @@
 #include <rte_ethdev_driver.h>
 #include <rte_malloc.h>
 
-#include "base/iavf_prototype.h"
-#include "base/iavf_type.h"
 #include "iavf.h"
 #include "iavf_rxtx.h"
 #include "iavf_rxtx_vec_common.h"
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index bf87ab611..b258ad2e7 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -19,11 +19,6 @@
 #include <rte_ethdev_driver.h>
 #include <rte_dev.h>
 
-#include "iavf_log.h"
-#include "base/iavf_prototype.h"
-#include "base/iavf_adminq_cmd.h"
-#include "base/iavf_type.h"
-
 #include "iavf.h"
 #include "iavf_rxtx.h"
 
diff --git a/drivers/net/iavf/meson.build b/drivers/net/iavf/meson.build
index ce820573b..dbd0b01db 100644
--- a/drivers/net/iavf/meson.build
+++ b/drivers/net/iavf/meson.build
@@ -5,8 +5,8 @@ cflags += ['-Wno-strict-aliasing']
 
 allow_experimental_apis = true
 
-subdir('base')
-objs = [base_objs]
+includes += include_directories('../../common/iavf')
+deps += ['common_iavf']
 
 sources = files(
 	'iavf_ethdev.c',
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 05ea034b9..597d6f6e9 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -183,6 +183,10 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_HNS3_PMD)       += -lrte_pmd_hns3
 _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD)       += -lrte_pmd_i40e
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IAVF_PMD)       += -lrte_pmd_iavf
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ICE_PMD)        += -lrte_pmd_ice
+IAVF-y := $(CONFIG_RTE_LIBRTE_IAVF_PMD)
+ifeq ($(findstring y,$(IAVF-y)),y)
+_LDLIBS-y += -lrte_common_iavf
+endif
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)      += -lrte_pmd_ixgbe
 ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KNI)        += -lrte_pmd_kni
-- 
2.17.1


             reply	other threads:[~2020-01-02  5:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-02  5:33 Haiyue Wang [this message]
2020-01-03 14:49 ` [dpdk-dev] [PATCH v2] net/iavf/base: change the base code as common Haiyue Wang
2020-01-06  5:43 ` [dpdk-dev] [PATCH v3] net/iavf/base: change the base as driver common Haiyue Wang
2020-01-08  3:11 ` [dpdk-dev] [PATCH v4] " Haiyue Wang
2020-01-08  3:23   ` Zhang, Qi Z
2020-01-10  1:37 ` [dpdk-dev] [PATCH v5] " Haiyue Wang
2020-01-13  7:54   ` Ye Xiaolong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200102053338.112378-1-haiyue.wang@intel.com \
    --to=haiyue.wang@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).