[dpdk-dev] [PATCH 1/2] kvargs: the life of the party

Gaetan Rivet gaetan.rivet at 6wind.com
Fri Mar 23 19:45:02 CET 2018


Signed-off-by: Gaetan Rivet <gaetan.rivet at 6wind.com>
---

This is a rough sketch of what would be done to move rte_kvargs
within the EAL and change the parsing in rte_dev to use it.

 drivers/baseband/Makefile                          |  2 +-
 lib/Makefile                                       |  5 +-
 lib/librte_eal/Makefile                            |  2 +
 lib/librte_eal/common/Makefile                     |  2 +-
 lib/librte_eal/kvargs/Makefile                     | 23 ++++++++++
 .../kvargs}/meson.build                            |  0
 .../kvargs}/rte_kvargs.c                           | 12 +++--
 .../kvargs}/rte_kvargs.h                           |  0
 .../kvargs}/rte_kvargs_version.map                 |  0
 .../{common/include => kvargs}/rte_string_fns.h    |  0
 lib/librte_eal/linuxapp/eal/eal_hugepage_info.c    |  2 +-
 lib/librte_kvargs/Makefile                         | 53 ----------------------
 12 files changed, 37 insertions(+), 64 deletions(-)
 create mode 100644 lib/librte_eal/kvargs/Makefile
 rename lib/{librte_kvargs => librte_eal/kvargs}/meson.build (100%)
 rename lib/{librte_kvargs => librte_eal/kvargs}/rte_kvargs.c (96%)
 rename lib/{librte_kvargs => librte_eal/kvargs}/rte_kvargs.h (100%)
 rename lib/{librte_kvargs => librte_eal/kvargs}/rte_kvargs_version.map (100%)
 rename lib/librte_eal/{common/include => kvargs}/rte_string_fns.h (100%)
 delete mode 100644 lib/librte_kvargs/Makefile

diff --git a/drivers/baseband/Makefile b/drivers/baseband/Makefile
index 4ec83b0a0..64f6f9ca7 100644
--- a/drivers/baseband/Makefile
+++ b/drivers/baseband/Makefile
@@ -4,7 +4,7 @@
 include $(RTE_SDK)/mk/rte.vars.mk
 
 core-libs := librte_eal librte_mbuf librte_mempool librte_ring
-core-libs += librte_bbdev librte_kvargs librte_cfgfile
+core-libs += librte_bbdev librte_cfgfile
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_NULL) += null
 DEPDIRS-null = $(core-libs)
diff --git a/lib/Makefile b/lib/Makefile
index 6bb6a8bed..aef95b201 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -20,12 +20,11 @@ DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
 DEPDIRS-librte_cmdline := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
 DEPDIRS-librte_ether := librte_net librte_eal librte_mempool librte_ring
-DEPDIRS-librte_ether += librte_mbuf librte_kvargs
+DEPDIRS-librte_ether += librte_mbuf
 DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += librte_bbdev
 DEPDIRS-librte_bbdev := librte_eal librte_mempool librte_mbuf
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += librte_cryptodev
 DEPDIRS-librte_cryptodev := librte_eal librte_mempool librte_ring librte_mbuf
-DEPDIRS-librte_cryptodev += librte_kvargs
 DIRS-$(CONFIG_RTE_LIBRTE_SECURITY) += librte_security
 DEPDIRS-librte_security := librte_eal librte_mempool librte_ring librte_mbuf
 DEPDIRS-librte_security += librte_ether
@@ -71,8 +70,6 @@ DEPDIRS-librte_flow_classify :=  librte_net librte_table librte_acl
 DIRS-$(CONFIG_RTE_LIBRTE_SCHED) += librte_sched
 DEPDIRS-librte_sched := librte_eal librte_mempool librte_mbuf librte_net
 DEPDIRS-librte_sched += librte_timer
-DIRS-$(CONFIG_RTE_LIBRTE_KVARGS) += librte_kvargs
-DEPDIRS-librte_kvargs := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += librte_distributor
 DEPDIRS-librte_distributor := librte_eal librte_mbuf librte_ether
 DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
diff --git a/lib/librte_eal/Makefile b/lib/librte_eal/Makefile
index ccd45cb84..d6b520aeb 100644
--- a/lib/librte_eal/Makefile
+++ b/lib/librte_eal/Makefile
@@ -3,7 +3,9 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+DIRS-y += kvargs
 DIRS-y += common
+DEPDIRS-common := kvargs
 DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += linuxapp
 DEPDIRS-linuxapp := common
 DIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += bsdapp
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 211b21b4b..607ae0447 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -9,7 +9,7 @@ INC += rte_errno.h rte_launch.h rte_lcore.h
 INC += rte_log.h rte_memory.h rte_memzone.h
 INC += rte_per_lcore.h rte_random.h
 INC += rte_tailq.h rte_interrupts.h rte_alarm.h
-INC += rte_string_fns.h rte_version.h
+INC += rte_version.h
 INC += rte_eal_memconfig.h rte_malloc_heap.h
 INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_class.h
 INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
diff --git a/lib/librte_eal/kvargs/Makefile b/lib/librte_eal/kvargs/Makefile
new file mode 100644
index 000000000..65d15744e
--- /dev/null
+++ b/lib/librte_eal/kvargs/Makefile
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2014 6WIND S.A.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_kvargs.a
+
+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+
+EXPORT_MAP := rte_kvargs_version.map
+
+LIBABIVER := 1
+
+# all source are stored in SRCS-y
+SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
+
+# install includes
+INCS := rte_kvargs.h
+INCS += rte_string_fns.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_KVARGS)-include := $(INCS)
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_kvargs/meson.build b/lib/librte_eal/kvargs/meson.build
similarity index 100%
rename from lib/librte_kvargs/meson.build
rename to lib/librte_eal/kvargs/meson.build
diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_eal/kvargs/rte_kvargs.c
similarity index 96%
rename from lib/librte_kvargs/rte_kvargs.c
rename to lib/librte_eal/kvargs/rte_kvargs.c
index 9662375e8..69a942723 100644
--- a/lib/librte_kvargs/rte_kvargs.c
+++ b/lib/librte_eal/kvargs/rte_kvargs.c
@@ -3,13 +3,17 @@
  * Copyright(c) 2014 6WIND S.A.
  */
 
-#include <string.h>
+#include <stdio.h>
 #include <stdlib.h>
-
-#include <rte_log.h>
-#include <rte_string_fns.h>
+#include <string.h>
 
 #include "rte_kvargs.h"
+#include "rte_string_fns.h"
+
+#define ERR stderr
+#define PMD "[PMD]"
+#define RTE_LOG(lvl, prefix, ...) \
+	fprintf(lvl, prefix " " __VA_ARGS__);
 
 /*
  * Receive a string with a list of arguments following the pattern
diff --git a/lib/librte_kvargs/rte_kvargs.h b/lib/librte_eal/kvargs/rte_kvargs.h
similarity index 100%
rename from lib/librte_kvargs/rte_kvargs.h
rename to lib/librte_eal/kvargs/rte_kvargs.h
diff --git a/lib/librte_kvargs/rte_kvargs_version.map b/lib/librte_eal/kvargs/rte_kvargs_version.map
similarity index 100%
rename from lib/librte_kvargs/rte_kvargs_version.map
rename to lib/librte_eal/kvargs/rte_kvargs_version.map
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/kvargs/rte_string_fns.h
similarity index 100%
rename from lib/librte_eal/common/include/rte_string_fns.h
rename to lib/librte_eal/kvargs/rte_string_fns.h
diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
index 8bbf771af..63d701555 100644
--- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
+++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
@@ -24,7 +24,7 @@
 #include <rte_debug.h>
 #include <rte_log.h>
 #include <rte_common.h>
-#include "rte_string_fns.h"
+#include <rte_string_fns.h>
 #include "eal_internal_cfg.h"
 #include "eal_hugepages.h"
 #include "eal_filesystem.h"
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
deleted file mode 100644
index 4eaa9334d..000000000
--- a/lib/librte_kvargs/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-# BSD LICENSE
-#
-# Copyright 2014 6WIND S.A.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution.
-#
-# - Neither the name of 6WIND S.A. nor the names of its
-#   contributors may be used to endorse or promote products derived
-#   from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE.
-
-include $(RTE_SDK)/mk/rte.vars.mk
-
-# library name
-LIB = librte_kvargs.a
-
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
-LDLIBS += -lrte_eal
-
-EXPORT_MAP := rte_kvargs_version.map
-
-LIBABIVER := 1
-
-# all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
-
-# install includes
-INCS := rte_kvargs.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_KVARGS)-include := $(INCS)
-
-include $(RTE_SDK)/mk/rte.lib.mk
-- 
2.11.0



More information about the dev mailing list