Skip to contentSkip to conversation

net/iavf/base: make the base code as common share

PATCH Superseded Haiyue Wang 3 participants 7 messages Jan 2, 2020 – Jan 13, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/iavf/base: make the base code as common share

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

---
 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
drivers/common/Makefile +5 -0
index 1ff033bba..3254c5274 100644
@@ -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
drivers/common/iavf/Makefile new file +28 -0
new file mode 100644
index 000000000..e3b2e7a3c
@@ -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
drivers/common/iavf/README renamed from drivers/net/iavf/base/README +0 -0
similarity index 100%
rename from drivers/net/iavf/base/README
rename to drivers/common/iavf/README
drivers/common/iavf/iavf_adminq.c renamed from drivers/net/iavf/base/iavf_adminq.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.c
rename to drivers/common/iavf/iavf_adminq.c
drivers/common/iavf/iavf_adminq.h renamed from drivers/net/iavf/base/iavf_adminq.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.h
rename to drivers/common/iavf/iavf_adminq.h
drivers/common/iavf/iavf_adminq_cmd.h renamed from drivers/net/iavf/base/iavf_adminq_cmd.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq_cmd.h
rename to drivers/common/iavf/iavf_adminq_cmd.h
drivers/common/iavf/iavf_alloc.h renamed from drivers/net/iavf/base/iavf_alloc.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_alloc.h
rename to drivers/common/iavf/iavf_alloc.h
drivers/common/iavf/iavf_common.c renamed from drivers/net/iavf/base/iavf_common.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_common.c
rename to drivers/common/iavf/iavf_common.c
drivers/common/iavf/iavf_devids.h renamed from drivers/net/iavf/base/iavf_devids.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_devids.h
rename to drivers/common/iavf/iavf_devids.h
drivers/common/iavf/iavf_main.c new file +114 -0

114 lines not on this page · raw message

drivers/common/iavf/iavf_osdep.h renamed from drivers/net/iavf/base/iavf_osdep.h +8 -41

74 lines not on this page · raw message

drivers/common/iavf/iavf_prototype.h renamed from drivers/net/iavf/base/iavf_prototype.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_prototype.h
rename to drivers/common/iavf/iavf_prototype.h
drivers/common/iavf/iavf_register.h renamed from drivers/net/iavf/base/iavf_register.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_register.h
rename to drivers/common/iavf/iavf_register.h
drivers/common/iavf/iavf_status.h renamed from drivers/net/iavf/base/iavf_status.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_status.h
rename to drivers/common/iavf/iavf_status.h
drivers/common/iavf/iavf_type.h renamed from drivers/net/iavf/base/iavf_type.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_type.h
rename to drivers/common/iavf/iavf_type.h
drivers/common/iavf/meson.build new file +10 -0
new file mode 100644
index 000000000..09c121a7b
@@ -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
drivers/common/iavf/rte_common_iavf_version.map new file +12 -0
new file mode 100644
index 000000000..1a0839262
@@ -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: *;
+};
drivers/common/iavf/virtchnl.h renamed from drivers/net/iavf/base/virtchnl.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/virtchnl.h
rename to drivers/common/iavf/virtchnl.h
drivers/common/meson.build +1 -1
index 7b5e566f3..fc620f741 100644
@@ -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@'
drivers/net/iavf/Makefile +2 -21
index 81c9a0dbf..514073d76 100644
@@ -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
drivers/net/iavf/base/meson.build deleted +0 -23
deleted file mode 100644
index bcb24b739..000000000
@@ -1,23 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Luca Boccassi <[email protected]>
-
-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()
drivers/net/iavf/iavf.h +5 -1
index 77b706893..7c5d5b339 100644
@@ -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
drivers/net/iavf/iavf_ethdev.c +0 -83

92 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +0 -3
index 88f79ba37..067290db4 100644
@@ -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"
 
drivers/net/iavf/iavf_rxtx_vec_avx2.c +0 -1
index a5133d8d8..7c5d23fd0 100644
@@ -2,7 +2,6 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "base/iavf_prototype.h"
 #include "iavf_rxtx_vec_common.h"
 
 #include <x86intrin.h>
drivers/net/iavf/iavf_rxtx_vec_sse.c +0 -2
index 2b16dc1b5..b978cc6e0 100644
@@ -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"
drivers/net/iavf/iavf_vchnl.c +0 -5
index bf87ab611..b258ad2e7 100644
@@ -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"
 
drivers/net/iavf/meson.build +2 -2
index ce820573b..dbd0b01db 100644
@@ -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',
mk/rte.app.mk +4 -0
index 05ea034b9..597d6f6e9 100644
@@ -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
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 net/iavf/base: change the base code as common

Change the iavf base code as driver common library, it is used by iavf PMD now, and it can be used by i40evf PMD in the future.

---
v2: update the commit message, and rename the iavf_main.c to iavf_impl.c

 drivers/common/Makefile                       |   5 +
 drivers/common/iavf/Makefile                  |  28 +++++
 drivers/{net/iavf/base => common/iavf}/README |   1 +
 .../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_impl.c               | 114 ++++++++++++++++++
 .../iavf/base => common/iavf}/iavf_osdep.h    |  50 ++------
 .../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, 192 insertions(+), 184 deletions(-)
 create mode 100644 drivers/common/iavf/Makefile
 rename drivers/{net/iavf/base => common/iavf}/README (96%)
 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_impl.c
 rename drivers/{net/iavf/base => common/iavf}/iavf_osdep.h (75%)
 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
drivers/common/Makefile +5 -0
index 1ff033bba..3254c5274 100644
@@ -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
drivers/common/iavf/Makefile new file +28 -0
new file mode 100644
index 000000000..43383e376
@@ -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_impl.c
+
+LDLIBS += -lrte_eal
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/common/iavf/README renamed from drivers/net/iavf/base/README +1 -0
similarity index 96%
rename from drivers/net/iavf/base/README
rename to drivers/common/iavf/README
index e8c49c36f..b78e89bee 100644
@@ -17,3 +17,4 @@ NOTE: The source code in this directory should not be modified apart from
 the following file(s):
 
     iavf_osdep.h
+    iavf_impl.c
drivers/common/iavf/iavf_adminq.c renamed from drivers/net/iavf/base/iavf_adminq.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.c
rename to drivers/common/iavf/iavf_adminq.c
drivers/common/iavf/iavf_adminq.h renamed from drivers/net/iavf/base/iavf_adminq.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.h
rename to drivers/common/iavf/iavf_adminq.h
drivers/common/iavf/iavf_adminq_cmd.h renamed from drivers/net/iavf/base/iavf_adminq_cmd.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq_cmd.h
rename to drivers/common/iavf/iavf_adminq_cmd.h
drivers/common/iavf/iavf_alloc.h renamed from drivers/net/iavf/base/iavf_alloc.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_alloc.h
rename to drivers/common/iavf/iavf_alloc.h
drivers/common/iavf/iavf_common.c renamed from drivers/net/iavf/base/iavf_common.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_common.c
rename to drivers/common/iavf/iavf_common.c
drivers/common/iavf/iavf_devids.h renamed from drivers/net/iavf/base/iavf_devids.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_devids.h
rename to drivers/common/iavf/iavf_devids.h
drivers/common/iavf/iavf_impl.c new file +114 -0

114 lines not on this page · raw message

drivers/common/iavf/iavf_osdep.h renamed from drivers/net/iavf/base/iavf_osdep.h +8 -42

75 lines not on this page · raw message

drivers/common/iavf/iavf_prototype.h renamed from drivers/net/iavf/base/iavf_prototype.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_prototype.h
rename to drivers/common/iavf/iavf_prototype.h
drivers/common/iavf/iavf_register.h renamed from drivers/net/iavf/base/iavf_register.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_register.h
rename to drivers/common/iavf/iavf_register.h
drivers/common/iavf/iavf_status.h renamed from drivers/net/iavf/base/iavf_status.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_status.h
rename to drivers/common/iavf/iavf_status.h
drivers/common/iavf/iavf_type.h renamed from drivers/net/iavf/base/iavf_type.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_type.h
rename to drivers/common/iavf/iavf_type.h
drivers/common/iavf/meson.build new file +10 -0
new file mode 100644
index 000000000..7b68ef27f
@@ -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_impl.c')
+
+if cc.has_argument('-Wno-pointer-to-int-cast')
+        cflags += '-Wno-pointer-to-int-cast'
+endif
drivers/common/iavf/rte_common_iavf_version.map new file +12 -0
new file mode 100644
index 000000000..1a0839262
@@ -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: *;
+};
drivers/common/iavf/virtchnl.h renamed from drivers/net/iavf/base/virtchnl.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/virtchnl.h
rename to drivers/common/iavf/virtchnl.h
drivers/common/meson.build +1 -1
index 7b5e566f3..fc620f741 100644
@@ -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@'
drivers/net/iavf/Makefile +2 -21
index 81c9a0dbf..514073d76 100644
@@ -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
drivers/net/iavf/base/meson.build deleted +0 -23
deleted file mode 100644
index bcb24b739..000000000
@@ -1,23 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Luca Boccassi <[email protected]>
-
-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()
drivers/net/iavf/iavf.h +5 -1
index 77b706893..7c5d5b339 100644
@@ -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
drivers/net/iavf/iavf_ethdev.c +0 -83

92 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +0 -3
index 88f79ba37..067290db4 100644
@@ -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"
 
drivers/net/iavf/iavf_rxtx_vec_avx2.c +0 -1
index a5133d8d8..7c5d23fd0 100644
@@ -2,7 +2,6 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "base/iavf_prototype.h"
 #include "iavf_rxtx_vec_common.h"
 
 #include <x86intrin.h>
drivers/net/iavf/iavf_rxtx_vec_sse.c +0 -2
index 2b16dc1b5..b978cc6e0 100644
@@ -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"
drivers/net/iavf/iavf_vchnl.c +0 -5
index bf87ab611..b258ad2e7 100644
@@ -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"
 
drivers/net/iavf/meson.build +2 -2
index ce820573b..dbd0b01db 100644
@@ -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',
mk/rte.app.mk +4 -0
index 05ea034b9..597d6f6e9 100644
@@ -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
Signature · 1 line
2.17.1
#2 lore raw

PATCH v3 1/1 net/iavf/base: change the base as driver common

In reply to Haiyue Wang

Change the iavf base code as driver common library, it is used by iavf PMD now, and it can be used by other Intel SR-IOV PMDs in the future.

---
v3: update the commit message.

v2: update the commit message, and rename the iavf_main.c to iavf_impl.c

 drivers/common/Makefile                       |   5 +
 drivers/common/iavf/Makefile                  |  28 +++++
 drivers/{net/iavf/base => common/iavf}/README |   1 +
 .../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_impl.c               | 114 ++++++++++++++++++
 .../iavf/base => common/iavf}/iavf_osdep.h    |  50 ++------
 .../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, 192 insertions(+), 184 deletions(-)
 create mode 100644 drivers/common/iavf/Makefile
 rename drivers/{net/iavf/base => common/iavf}/README (96%)
 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_impl.c
 rename drivers/{net/iavf/base => common/iavf}/iavf_osdep.h (75%)
 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
drivers/common/Makefile +5 -0
index 1ff033bba..3254c5274 100644
@@ -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
drivers/common/iavf/Makefile new file +28 -0
new file mode 100644
index 000000000..43383e376
@@ -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_impl.c
+
+LDLIBS += -lrte_eal
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/common/iavf/README renamed from drivers/net/iavf/base/README +1 -0
similarity index 96%
rename from drivers/net/iavf/base/README
rename to drivers/common/iavf/README
index e8c49c36f..b78e89bee 100644
@@ -17,3 +17,4 @@ NOTE: The source code in this directory should not be modified apart from
 the following file(s):
 
     iavf_osdep.h
+    iavf_impl.c
drivers/common/iavf/iavf_adminq.c renamed from drivers/net/iavf/base/iavf_adminq.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.c
rename to drivers/common/iavf/iavf_adminq.c
drivers/common/iavf/iavf_adminq.h renamed from drivers/net/iavf/base/iavf_adminq.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.h
rename to drivers/common/iavf/iavf_adminq.h
drivers/common/iavf/iavf_adminq_cmd.h renamed from drivers/net/iavf/base/iavf_adminq_cmd.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq_cmd.h
rename to drivers/common/iavf/iavf_adminq_cmd.h
drivers/common/iavf/iavf_alloc.h renamed from drivers/net/iavf/base/iavf_alloc.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_alloc.h
rename to drivers/common/iavf/iavf_alloc.h
drivers/common/iavf/iavf_common.c renamed from drivers/net/iavf/base/iavf_common.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_common.c
rename to drivers/common/iavf/iavf_common.c
drivers/common/iavf/iavf_devids.h renamed from drivers/net/iavf/base/iavf_devids.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_devids.h
rename to drivers/common/iavf/iavf_devids.h
drivers/common/iavf/iavf_impl.c new file +114 -0

114 lines not on this page · raw message

drivers/common/iavf/iavf_osdep.h renamed from drivers/net/iavf/base/iavf_osdep.h +8 -42

75 lines not on this page · raw message

drivers/common/iavf/iavf_prototype.h renamed from drivers/net/iavf/base/iavf_prototype.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_prototype.h
rename to drivers/common/iavf/iavf_prototype.h
drivers/common/iavf/iavf_register.h renamed from drivers/net/iavf/base/iavf_register.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_register.h
rename to drivers/common/iavf/iavf_register.h
drivers/common/iavf/iavf_status.h renamed from drivers/net/iavf/base/iavf_status.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_status.h
rename to drivers/common/iavf/iavf_status.h
drivers/common/iavf/iavf_type.h renamed from drivers/net/iavf/base/iavf_type.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_type.h
rename to drivers/common/iavf/iavf_type.h
drivers/common/iavf/meson.build new file +10 -0
new file mode 100644
index 000000000..7b68ef27f
@@ -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_impl.c')
+
+if cc.has_argument('-Wno-pointer-to-int-cast')
+        cflags += '-Wno-pointer-to-int-cast'
+endif
drivers/common/iavf/rte_common_iavf_version.map new file +12 -0
new file mode 100644
index 000000000..1a0839262
@@ -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: *;
+};
drivers/common/iavf/virtchnl.h renamed from drivers/net/iavf/base/virtchnl.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/virtchnl.h
rename to drivers/common/iavf/virtchnl.h
drivers/common/meson.build +1 -1
index 7b5e566f3..fc620f741 100644
@@ -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@'
drivers/net/iavf/Makefile +2 -21
index 81c9a0dbf..514073d76 100644
@@ -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
drivers/net/iavf/base/meson.build deleted +0 -23
deleted file mode 100644
index bcb24b739..000000000
@@ -1,23 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Luca Boccassi <[email protected]>
-
-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()
drivers/net/iavf/iavf.h +5 -1
index 946680891..fe25d807c 100644
@@ -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
drivers/net/iavf/iavf_ethdev.c +0 -83

92 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +0 -3
index 88f79ba37..067290db4 100644
@@ -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"
 
drivers/net/iavf/iavf_rxtx_vec_avx2.c +0 -1
index a5133d8d8..7c5d23fd0 100644
@@ -2,7 +2,6 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "base/iavf_prototype.h"
 #include "iavf_rxtx_vec_common.h"
 
 #include <x86intrin.h>
drivers/net/iavf/iavf_rxtx_vec_sse.c +0 -2
index 2b16dc1b5..b978cc6e0 100644
@@ -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"
drivers/net/iavf/iavf_vchnl.c +0 -5
index 303b51538..fa4da3a6d 100644
@@ -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"
 
drivers/net/iavf/meson.build +2 -2
index ce820573b..dbd0b01db 100644
@@ -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',
mk/rte.app.mk +4 -0
index 05ea034b9..597d6f6e9 100644
@@ -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
Signature · 1 line
2.17.1
#3 lore raw

PATCH v4 1/1 net/iavf/base: change the base as driver common

In reply to Haiyue Wang

Change the iavf base code as driver common library, it is used by iavf PMD now, and it can be used by other Intel SR-IOV PMDs in the future.

---
v4: keep the iavf spinlock & memmory function prototype in osdep.h

v3: update the commit message.

v2: update the commit message, and rename the iavf_main.c to iavf_impl.c

 drivers/common/Makefile                       |  5 +
 drivers/common/iavf/Makefile                  | 28 ++++++
 drivers/{net/iavf/base => common/iavf}/README |  1 +
 .../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_impl.c               | 95 +++++++++++++++++++
 .../iavf/base => common/iavf}/iavf_osdep.h    | 15 +--
 .../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, 173 insertions(+), 149 deletions(-)
 create mode 100644 drivers/common/iavf/Makefile
 rename drivers/{net/iavf/base => common/iavf}/README (96%)
 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_impl.c
 rename drivers/{net/iavf/base => common/iavf}/iavf_osdep.h (93%)
 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
drivers/common/Makefile +5 -0
index 1ff033bba..3254c5274 100644
@@ -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
drivers/common/iavf/Makefile new file +28 -0
new file mode 100644
index 000000000..43383e376
@@ -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_impl.c
+
+LDLIBS += -lrte_eal
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/common/iavf/README renamed from drivers/net/iavf/base/README +1 -0
similarity index 96%
rename from drivers/net/iavf/base/README
rename to drivers/common/iavf/README
index e8c49c36f..b78e89bee 100644
@@ -17,3 +17,4 @@ NOTE: The source code in this directory should not be modified apart from
 the following file(s):
 
     iavf_osdep.h
+    iavf_impl.c
drivers/common/iavf/iavf_adminq.c renamed from drivers/net/iavf/base/iavf_adminq.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.c
rename to drivers/common/iavf/iavf_adminq.c
drivers/common/iavf/iavf_adminq.h renamed from drivers/net/iavf/base/iavf_adminq.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.h
rename to drivers/common/iavf/iavf_adminq.h
drivers/common/iavf/iavf_adminq_cmd.h renamed from drivers/net/iavf/base/iavf_adminq_cmd.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq_cmd.h
rename to drivers/common/iavf/iavf_adminq_cmd.h
drivers/common/iavf/iavf_alloc.h renamed from drivers/net/iavf/base/iavf_alloc.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_alloc.h
rename to drivers/common/iavf/iavf_alloc.h
drivers/common/iavf/iavf_common.c renamed from drivers/net/iavf/base/iavf_common.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_common.c
rename to drivers/common/iavf/iavf_common.c
drivers/common/iavf/iavf_devids.h renamed from drivers/net/iavf/base/iavf_devids.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_devids.h
rename to drivers/common/iavf/iavf_devids.h
drivers/common/iavf/iavf_impl.c new file +95 -0

95 lines not on this page · raw message

drivers/common/iavf/iavf_osdep.h renamed from drivers/net/iavf/base/iavf_osdep.h +8 -7
similarity index 93%
rename from drivers/net/iavf/base/iavf_osdep.h
rename to drivers/common/iavf/iavf_osdep.h
index 1b22f9fbc..7d72863bc 100644
@@ -21,8 +21,6 @@
 #include <rte_log.h>
 #include <rte_io.h>
 
-#include "../iavf_log.h"
-
 #define INLINE inline
 #define STATIC static
 
@@ -72,10 +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)
 #define CPU_TO_LE64(h) rte_cpu_to_le_64(h)
@@ -123,10 +117,17 @@ uint32_t iavf_read_addr(volatile void *addr)
 
 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
 
+extern int iavf_common_logger;
+
+#define DEBUGOUT(S)          rte_log(RTE_LOG_DEBUG, iavf_common_logger, S)
+#define DEBUGOUT2(S, A...)   rte_log(RTE_LOG_DEBUG, iavf_common_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_common_logger,      \
+			"iavf %02x.%x " s,                      \
 			(h)->bus.device, (h)->bus.func,         \
 					##__VA_ARGS__);         \
 } while (0)
drivers/common/iavf/iavf_prototype.h renamed from drivers/net/iavf/base/iavf_prototype.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_prototype.h
rename to drivers/common/iavf/iavf_prototype.h
drivers/common/iavf/iavf_register.h renamed from drivers/net/iavf/base/iavf_register.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_register.h
rename to drivers/common/iavf/iavf_register.h
drivers/common/iavf/iavf_status.h renamed from drivers/net/iavf/base/iavf_status.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_status.h
rename to drivers/common/iavf/iavf_status.h
drivers/common/iavf/iavf_type.h renamed from drivers/net/iavf/base/iavf_type.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_type.h
rename to drivers/common/iavf/iavf_type.h
drivers/common/iavf/meson.build new file +10 -0
new file mode 100644
index 000000000..7b68ef27f
@@ -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_impl.c')
+
+if cc.has_argument('-Wno-pointer-to-int-cast')
+        cflags += '-Wno-pointer-to-int-cast'
+endif
drivers/common/iavf/rte_common_iavf_version.map new file +12 -0
new file mode 100644
index 000000000..1a0839262
@@ -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: *;
+};
drivers/common/iavf/virtchnl.h renamed from drivers/net/iavf/base/virtchnl.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/virtchnl.h
rename to drivers/common/iavf/virtchnl.h
drivers/common/meson.build +1 -1
index 7b5e566f3..fc620f741 100644
@@ -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@'
drivers/net/iavf/Makefile +2 -21
index 81c9a0dbf..514073d76 100644
@@ -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
drivers/net/iavf/base/meson.build deleted +0 -23
deleted file mode 100644
index bcb24b739..000000000
@@ -1,23 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Luca Boccassi <[email protected]>
-
-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()
drivers/net/iavf/iavf.h +5 -1
index 946680891..fe25d807c 100644
@@ -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
drivers/net/iavf/iavf_ethdev.c +0 -83

92 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +0 -3
index 88f79ba37..067290db4 100644
@@ -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"
 
drivers/net/iavf/iavf_rxtx_vec_avx2.c +0 -1
index a5133d8d8..7c5d23fd0 100644
@@ -2,7 +2,6 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "base/iavf_prototype.h"
 #include "iavf_rxtx_vec_common.h"
 
 #include <x86intrin.h>
drivers/net/iavf/iavf_rxtx_vec_sse.c +0 -2
index 2b16dc1b5..b978cc6e0 100644
@@ -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"
drivers/net/iavf/iavf_vchnl.c +0 -5
index 303b51538..fa4da3a6d 100644
@@ -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"
 
drivers/net/iavf/meson.build +2 -2
index ce820573b..dbd0b01db 100644
@@ -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',
mk/rte.app.mk +4 -0
index 05ea034b9..597d6f6e9 100644
@@ -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
Signature · 1 line
2.17.1
Acked-by on v4 1/1
#4 lore raw

Re: [dpdk-dev] [PATCH v4] net/iavf/base: change the base as driver common

Quoted 10 lines

-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Wednesday, January 8, 2020 11:12 AM
To: [email protected]; Ye, Xiaolong <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Cc: Wang, Haiyue <[email protected]>
Subject: [PATCH v4] net/iavf/base: change the base as driver common

Quoted 4 lines

Change the iavf base code as driver common library, it is used by iavf PMD now, and it can be used by other Intel SR-IOV PMDs in the future.

#5 lore raw

PATCH v5 1/1 net/iavf/base: change the base as driver common

In reply to Haiyue Wang

Change the iavf base code as driver common library, it is used by iavf PMD now, and it can be used by other Intel SR-IOV PMDs in the future.

---
v5: update the MAINTAINERS

v4: keep the iavf spinlock & memmory function prototype in osdep.h

v3: update the commit message.

v2: update the commit message, and rename the iavf_main.c to iavf_impl.c

 MAINTAINERS                                   |  1 +
 drivers/common/Makefile                       |  5 +
 drivers/common/iavf/Makefile                  | 28 ++++++
 drivers/{net/iavf/base => common/iavf}/README |  1 +
 .../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_impl.c               | 95 +++++++++++++++++++
 .../iavf/base => common/iavf}/iavf_osdep.h    | 15 +--
 .../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 +
 30 files changed, 174 insertions(+), 149 deletions(-)
 create mode 100644 drivers/common/iavf/Makefile
 rename drivers/{net/iavf/base => common/iavf}/README (96%)
 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_impl.c
 rename drivers/{net/iavf/base => common/iavf}/iavf_osdep.h (93%)
 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
MAINTAINERS +1 -0
index 9b5c80ff2..35dc758a1 100644
@@ -677,6 +677,7 @@ M: Jingjing Wu <[email protected]>
 M: Wenzhuo Lu <[email protected]>
 T: git://dpdk.org/next/dpdk-next-net-intel
 F: drivers/net/iavf/
+F: drivers/common/iavf/
 F: doc/guides/nics/features/iavf*.ini
 
 Intel ifc
drivers/common/Makefile +5 -0
index 1ff033bba..3254c5274 100644
@@ -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
drivers/common/iavf/Makefile new file +28 -0
new file mode 100644
index 000000000..43383e376
@@ -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_impl.c
+
+LDLIBS += -lrte_eal
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/common/iavf/README renamed from drivers/net/iavf/base/README +1 -0
similarity index 96%
rename from drivers/net/iavf/base/README
rename to drivers/common/iavf/README
index e8c49c36f..b78e89bee 100644
@@ -17,3 +17,4 @@ NOTE: The source code in this directory should not be modified apart from
 the following file(s):
 
     iavf_osdep.h
+    iavf_impl.c
drivers/common/iavf/iavf_adminq.c renamed from drivers/net/iavf/base/iavf_adminq.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.c
rename to drivers/common/iavf/iavf_adminq.c
drivers/common/iavf/iavf_adminq.h renamed from drivers/net/iavf/base/iavf_adminq.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq.h
rename to drivers/common/iavf/iavf_adminq.h
drivers/common/iavf/iavf_adminq_cmd.h renamed from drivers/net/iavf/base/iavf_adminq_cmd.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_adminq_cmd.h
rename to drivers/common/iavf/iavf_adminq_cmd.h
drivers/common/iavf/iavf_alloc.h renamed from drivers/net/iavf/base/iavf_alloc.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_alloc.h
rename to drivers/common/iavf/iavf_alloc.h
drivers/common/iavf/iavf_common.c renamed from drivers/net/iavf/base/iavf_common.c +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_common.c
rename to drivers/common/iavf/iavf_common.c
drivers/common/iavf/iavf_devids.h renamed from drivers/net/iavf/base/iavf_devids.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_devids.h
rename to drivers/common/iavf/iavf_devids.h
drivers/common/iavf/iavf_impl.c new file +95 -0

95 lines not on this page · raw message

drivers/common/iavf/iavf_osdep.h renamed from drivers/net/iavf/base/iavf_osdep.h +8 -7
similarity index 93%
rename from drivers/net/iavf/base/iavf_osdep.h
rename to drivers/common/iavf/iavf_osdep.h
index 1b22f9fbc..7d72863bc 100644
@@ -21,8 +21,6 @@
 #include <rte_log.h>
 #include <rte_io.h>
 
-#include "../iavf_log.h"
-
 #define INLINE inline
 #define STATIC static
 
@@ -72,10 +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)
 #define CPU_TO_LE64(h) rte_cpu_to_le_64(h)
@@ -123,10 +117,17 @@ uint32_t iavf_read_addr(volatile void *addr)
 
 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
 
+extern int iavf_common_logger;
+
+#define DEBUGOUT(S)          rte_log(RTE_LOG_DEBUG, iavf_common_logger, S)
+#define DEBUGOUT2(S, A...)   rte_log(RTE_LOG_DEBUG, iavf_common_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_common_logger,      \
+			"iavf %02x.%x " s,                      \
 			(h)->bus.device, (h)->bus.func,         \
 					##__VA_ARGS__);         \
 } while (0)
drivers/common/iavf/iavf_prototype.h renamed from drivers/net/iavf/base/iavf_prototype.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_prototype.h
rename to drivers/common/iavf/iavf_prototype.h
drivers/common/iavf/iavf_register.h renamed from drivers/net/iavf/base/iavf_register.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_register.h
rename to drivers/common/iavf/iavf_register.h
drivers/common/iavf/iavf_status.h renamed from drivers/net/iavf/base/iavf_status.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_status.h
rename to drivers/common/iavf/iavf_status.h
drivers/common/iavf/iavf_type.h renamed from drivers/net/iavf/base/iavf_type.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/iavf_type.h
rename to drivers/common/iavf/iavf_type.h
drivers/common/iavf/meson.build new file +10 -0
new file mode 100644
index 000000000..7b68ef27f
@@ -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_impl.c')
+
+if cc.has_argument('-Wno-pointer-to-int-cast')
+        cflags += '-Wno-pointer-to-int-cast'
+endif
drivers/common/iavf/rte_common_iavf_version.map new file +12 -0
new file mode 100644
index 000000000..1a0839262
@@ -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: *;
+};
drivers/common/iavf/virtchnl.h renamed from drivers/net/iavf/base/virtchnl.h +0 -0
similarity index 100%
rename from drivers/net/iavf/base/virtchnl.h
rename to drivers/common/iavf/virtchnl.h
drivers/common/meson.build +1 -1
index 7b5e566f3..fc620f741 100644
@@ -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@'
drivers/net/iavf/Makefile +2 -21
index 81c9a0dbf..514073d76 100644
@@ -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
drivers/net/iavf/base/meson.build deleted +0 -23
deleted file mode 100644
index bcb24b739..000000000
@@ -1,23 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Luca Boccassi <[email protected]>
-
-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()
drivers/net/iavf/iavf.h +5 -1
index 946680891..fe25d807c 100644
@@ -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
drivers/net/iavf/iavf_ethdev.c +0 -83

92 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +0 -3
index 88f79ba37..067290db4 100644
@@ -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"
 
drivers/net/iavf/iavf_rxtx_vec_avx2.c +0 -1
index a5133d8d8..7c5d23fd0 100644
@@ -2,7 +2,6 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "base/iavf_prototype.h"
 #include "iavf_rxtx_vec_common.h"
 
 #include <x86intrin.h>
drivers/net/iavf/iavf_rxtx_vec_sse.c +0 -2
index 2b16dc1b5..b978cc6e0 100644
@@ -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"
drivers/net/iavf/iavf_vchnl.c +0 -5
index 303b51538..fa4da3a6d 100644
@@ -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"
 
drivers/net/iavf/meson.build +2 -2
index ce820573b..dbd0b01db 100644
@@ -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',
mk/rte.app.mk +4 -0
index 05ea034b9..597d6f6e9 100644
@@ -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
Signature · 1 line
2.17.1
Applied
#6 lore raw

Re: [dpdk-dev] [PATCH v5] net/iavf/base: change the base as driver common

Quoted 6 lines · Haiyue Wang

Change the iavf base code as driver common library, it is used by iavf PMD now, and it can be used by other Intel SR-IOV PMDs in the future.

---

Applied to dpdk-next-net-intel, Thanks.