[dpdk-dev] [PATCH v10 02/20] ethtool: move from sample folder into lib folder

Ferruh Yigit ferruh.yigit at intel.com
Tue Jul 4 18:13:19 CEST 2017


ethtool library initially developed for ethtool sample application,
moving it to library folder to reuse it.

Sample application will continue to use ethtool library.

Sample application disabled for now, it will be enabled again when
modifications to the ethtool library finished.

Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 examples/Makefile                                  |  2 +-
 examples/ethtool/Makefile                          | 24 ++++++++-------
 examples/ethtool/{ethtool-app => }/ethapp.c        |  0
 examples/ethtool/{ethtool-app => }/ethapp.h        |  0
 examples/ethtool/{ethtool-app => }/main.c          |  0
 .../ethtool/lib => lib/librte_ethtool}/Makefile    | 35 ++++++++--------------
 .../lib => lib/librte_ethtool}/rte_ethtool.c       |  0
 .../lib => lib/librte_ethtool}/rte_ethtool.h       |  0
 lib/librte_ethtool/rte_ethtool_version.map         | 24 +++++++++++++++
 9 files changed, 51 insertions(+), 34 deletions(-)
 rename examples/ethtool/{ethtool-app => }/ethapp.c (100%)
 rename examples/ethtool/{ethtool-app => }/ethapp.h (100%)
 rename examples/ethtool/{ethtool-app => }/main.c (100%)
 rename {examples/ethtool/lib => lib/librte_ethtool}/Makefile (76%)
 rename {examples/ethtool/lib => lib/librte_ethtool}/rte_ethtool.c (100%)
 rename {examples/ethtool/lib => lib/librte_ethtool}/rte_ethtool.h (100%)

diff --git a/examples/Makefile b/examples/Makefile
index c0e9c3be6..aa1696158 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -40,7 +40,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += bond
 DIRS-y += cmdline
 DIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += distributor
-DIRS-y += ethtool
+DIRS-n += ethtool
 DIRS-y += exception_path
 DIRS-$(CONFIG_RTE_LIBRTE_EFD) += server_node_efd
 DIRS-y += helloworld
diff --git a/examples/ethtool/Makefile b/examples/ethtool/Makefile
index 30b42b70e..a774eace0 100644
--- a/examples/ethtool/Makefile
+++ b/examples/ethtool/Makefile
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -33,20 +33,22 @@ ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
 
-# Default target, can be overwritten by command line or environment
+# Default target, can be overridden by command line or environment
 RTE_TARGET ?= x86_64-native-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(CONFIG_RTE_EXEC_ENV),"linuxapp")
-$(info This application can only operate in a linuxapp environment, \
-please change the definition of the RTE_TARGET environment variable)
-else
+# binary name
+APP = ethtool
 
-DIRS-y += lib ethtool-app
-endif
+# all source are stored in SRCS-y
+SRCS-y := main.c ethapp.c
+
+#CFLAGS += -O3 -D_GNU_SOURCE -pthread -I$(SRCDIR)/../lib
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
 
-DEPDIRS-ethtool-app := lib
-DEPDIRS-lib := librte_eal librte_ether
+#LDLIBS += -L$(subst ethtool-app,lib,$(RTE_OUTPUT))/lib
+#LDLIBS += -lrte_ethtool
 
-include $(RTE_SDK)/mk/rte.extsubdir.mk
+include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethapp.c
similarity index 100%
rename from examples/ethtool/ethtool-app/ethapp.c
rename to examples/ethtool/ethapp.c
diff --git a/examples/ethtool/ethtool-app/ethapp.h b/examples/ethtool/ethapp.h
similarity index 100%
rename from examples/ethtool/ethtool-app/ethapp.h
rename to examples/ethtool/ethapp.h
diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/main.c
similarity index 100%
rename from examples/ethtool/ethtool-app/main.c
rename to examples/ethtool/main.c
diff --git a/examples/ethtool/lib/Makefile b/lib/librte_ethtool/Makefile
similarity index 76%
rename from examples/ethtool/lib/Makefile
rename to lib/librte_ethtool/Makefile
index 266babade..f41cad3da 100644
--- a/examples/ethtool/lib/Makefile
+++ b/lib/librte_ethtool/Makefile
@@ -29,35 +29,26 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-ifeq ($(RTE_SDK),)
-$(error "Please define RTE_SDK environment variable")
-endif
-
-# Default target, can be overwritten by command line or environment
-RTE_TARGET ?= x86_64-native-linuxapp-gcc
-
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(CONFIG_RTE_EXEC_ENV),"linuxapp")
-$(error This application can only operate in a linuxapp environment, \
-please change the definition of the RTE_TARGET environment variable)
-endif
-
+#
 # library name
+#
 LIB = librte_ethtool.a
 
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+EXPORT_MAP := rte_ethtool_version.map
+
 LIBABIVER := 1
 
 # all source are stored in SRC-Y
-SRCS-y := rte_ethtool.c
+SRCS-$(CONFIG_RTE_LIBRTE_ETHTOOL) := rte_ethtool.c
 
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS)
-
-ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
-ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
-LDLIBS += -lrte_pmd_ixgbe
-endif
-endif
+#
+# Export include files
+#
+SYMLINK-$(CONFIG_RTE_LIBRTE_ETHTOOL)-include += rte_ethtool.h
 
-include $(RTE_SDK)/mk/rte.extlib.mk
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/examples/ethtool/lib/rte_ethtool.c b/lib/librte_ethtool/rte_ethtool.c
similarity index 100%
rename from examples/ethtool/lib/rte_ethtool.c
rename to lib/librte_ethtool/rte_ethtool.c
diff --git a/examples/ethtool/lib/rte_ethtool.h b/lib/librte_ethtool/rte_ethtool.h
similarity index 100%
rename from examples/ethtool/lib/rte_ethtool.h
rename to lib/librte_ethtool/rte_ethtool.h
diff --git a/lib/librte_ethtool/rte_ethtool_version.map b/lib/librte_ethtool/rte_ethtool_version.map
index b6d2840be..a6e756c50 100644
--- a/lib/librte_ethtool/rte_ethtool_version.map
+++ b/lib/librte_ethtool/rte_ethtool_version.map
@@ -1,4 +1,28 @@
 DPDK_17.08 {
+	global:
+
+	rte_ethtool_get_drvinfo;
+	rte_ethtool_get_link;
+	rte_ethtool_get_regs_len;
+	rte_ethtool_get_regs;
+	rte_ethtool_get_eeprom_len;
+	rte_ethtool_get_eeprom;
+	rte_ethtool_set_eeprom;
+	rte_ethtool_get_pauseparam;
+	rte_ethtool_set_pauseparam;
+	rte_ethtool_get_ringparam;
+	rte_ethtool_set_ringparam;
+
+	rte_ethtool_net_open;
+	rte_ethtool_net_stop;
+	rte_ethtool_net_get_mac_addr;
+	rte_ethtool_net_set_mac_addr;
+	rte_ethtool_net_validate_addr;
+	rte_ethtool_net_change_mtu;
+	rte_ethtool_net_get_stats64;
+	rte_ethtool_net_vlan_rx_add_vid;
+	rte_ethtool_net_vlan_rx_kill_vid;
+	rte_ethtool_net_set_rx_mode;
 
 	local: *;
 };
-- 
2.13.0



More information about the dev mailing list