[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/CLICK PATCH v2 01/11] Initial public release: basic unikraft files



Hey all,

I have actually some comments about this patch. See my comments inline.

On 05.06.19 10:56, Costin Lupu wrote:
Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>

On 6/5/19 10:35 AM, Florian Schmidt wrote:
Add Makefile, Makefile.uk, Config.uk, .gitignore, .md files

Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx>
Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
  .gitignore      |   4 ++
  CODING_STYLE.md |   4 ++
  CONTRIBUTING.md |   4 ++
  COPYING.md      |  47 +++++++++++++
  Config.uk       |  86 +++++++++++++++++++++++
  MAINTAINERS.md  |  10 +++
  Makefile        |   9 +++
  Makefile.uk     | 182 ++++++++++++++++++++++++++++++++++++++++++++++++
  README.md       |   5 ++
  9 files changed, 351 insertions(+)
  create mode 100644 .gitignore
  create mode 100644 CODING_STYLE.md
  create mode 100644 CONTRIBUTING.md
  create mode 100644 COPYING.md
  create mode 100644 Config.uk
  create mode 100644 MAINTAINERS.md
  create mode 100644 Makefile
  create mode 100644 Makefile.uk
  create mode 100644 README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a9fb71b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+.config
+.config.old
+..config.tmp
+build/
diff --git a/CODING_STYLE.md b/CODING_STYLE.md
new file mode 100644
index 0000000..5730041
--- /dev/null
+++ b/CODING_STYLE.md
@@ -0,0 +1,4 @@
+Coding Style
+============
+
+Please refer to the `CODING_STYLE.md` file in the main Unikraft repository.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..5f55eca
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+Contributing to Unikraft
+=======================
+
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository.
diff --git a/COPYING.md b/COPYING.md
new file mode 100644
index 0000000..52f3753
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,47 @@
+License
+=======
+
+Unikraft click wrappers
+------------------------
+
+This repository contains wrapper code to build the Click modular router with
+Unikraft. The wrapper code is generally published under a BSD 3-clause licence.
+each C code file in this repository should declare who is the copyright owner
+and under which terms and conditions the code is licensed. If such a licence
+note is missing, the following copyright notice will apply:
+
+       Copyright (c) 2019, NEC Laboratories Europei GmbH, NEC Corporation.
+                           All rights reserved.
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions
+       are met:
+
+       1. Redistributions of source code must retain the above copyright
+          notice, this list of conditions and the following disclaimer.
+       2. 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.
+       3. Neither the name of the copyright holder 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 HOLDER 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.
+
+Click source code
+------------------
+
+During building, the build system will download the Click modular router source
+This code has a variety of licences; please find more information in the
+`LICENSE` file in Click's root directory, or at
+https://raw.githubusercontent.com/kohler/click/master/LICENSE .
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..02ed997
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,86 @@
+### Invisible option for dependencies
+config APP_DEPENDENCIES
+       bool
+       default y
+
+menuconfig LIBCLICK
+       bool "The Click modular router"
+       depends on HAVE_LIBC
+       select LIBLWIP
+       default y

It is probably better if you select LIBNEWLIB instead of checking if a LIBC is there. If we add more libc's later, we anyway need to check if it compiles. newlib is the working configuration.

+
+if LIBCLICK
+
+config LIBCLICK_MAIN
+       bool "Enable Click main function"
+       default n
+       help
+         Define main function instead of click_main function
+
+config LIBCLICK_ELEMS_AQM
+       bool "Enable AQM elements"
+       default y
+       help
+         Build with IP elements
+
+config LIBCLICK_ELEMS_ETHERNET
+       bool "Enable Ethernet elements"
+       default y
+       help
+         Build with Ethernet elements
+
+config LIBCLICK_ELEMS_ETHERSWITCH
+       bool "Enable Ethernet switch elements"
+       default y
+       help
+         Build with Ethernet switch elements
+
+config LIBCLICK_ELEMS_ICMP
+       bool "Enable ICMP elements"
+       default y
+       help
+         Build with ICMP elements
+
+config LIBCLICK_ELEMS_IP
+       bool "Enable IP elements"
+       default y
+       help
+         Build with adaptive queue management elements
+
+config LIBCLICK_ELEMS_UNIKRAFT
+       bool "Enable Unikraft networking"
+       default y
+       help
+         Build with Unikraft FromDevice and ToDevice elements
+
+config LIBCLICK_ELEMS_LOCAL
+       bool "Enable local elements"
+       default y
+       help
+         Build with local elements
+
+config LIBCLICK_ELEMS_SIMPLE
+       bool "Enable simple elements"
+       default y
+       help
+         Build with simple elements
+
+config LIBCLICK_ELEMS_STANDARD
+       bool "Enable standard elements"
+       default y
+       help
+         Build with standard elements
+
+config LIBCLICK_ELEMS_TCPUDP
+       bool "Enable TCP/UDP elements"
+       default y
+       help
+         Build with TCP/UDP elements
+
+config LIBCLICK_ELEMS_THREADS
+       bool "Enable multi-threading elements"
+       default y
+       help
+         Build with multi-threading elements
+
+endif
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..b1482c7
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,10 @@
+Maintainers List
+================
+
+For notes on how to read this information, please refer to `MAINTAINERS.md` in
+the main Unikraft repository.
+
+       CLICK-UNIKRAFT
+       M:      Felipe Huici <felipe.huici@xxxxxxxxx>
+       L:      minios-devel@xxxxxxxxxxxxx
+       F: *
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8ecf80b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+UK_ROOT ?= $(PWD)/../unikraft
+UK_LIBS ?= $(PWD)/..
+LIBS := $(UK_LIBS)/newlib:$(UK_LIBS)/lwip
+

So far, we had the following default definition for UK_ROOT and UK_LIBS:
 UK_ROOT ?= $(PWD)/../../unikraft
 UK_LIBS ?= $(PWD)/../../libs
For simplicity we should use the as we do with the applications `helloworld` and `httpreply` so that user can expect the same default directory structure.

+all:
+       @$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS)
+
+$(MAKECMDGOALS):
+       @$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS) $(MAKECMDGOALS)
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..c464a89
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,182 @@
+#
+#  Copyright (c) 2019, NEC Laboratories Europe GmbH, NEC Corporation.
+#                      All rights reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. 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.
+#  3. Neither the name of the copyright holder 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 HOLDER 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.
+#
+#  THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+#
+
+################################################################################
+# Check requirements: Click requires netdev access, so LWIP must not attach 
them
+################################################################################
+ifeq ($(CONFIG_LWIP_AUTOIFACE),y)
+$(error Click cannot be built with LWIP option "Automatically attach netifs"! 
Please disable)
+endif

Could you add a comment why you are doing this with an error?: KConfig unfortunately does not support to `unselect` an configuration option. I hope problems like this can be fixed by updating to a recent KConfig system.

+
+################################################################################
+# Register with unikraft
+################################################################################
+$(eval $(call addlib,libclick))
+
+################################################################################
+# Sources
+################################################################################
+LIBCLICK_COMMIT_HASH=a5384835a6cac10f8d44da4eeea8eaa8f8e6a0c2
+LIBCLICK_URL=https://codeload.github.com/kohler/click/zip/$(LIBCLICK_COMMIT_HASH)
+$(eval $(call 
fetchas,libclick,$(LIBCLICK_URL),click-$(LIBCLICK_COMMIT_HASH).zip))
+LIBCLICK_PATCHDIR=$(LIBCLICK_BASE)/patches
+$(eval $(call 
patch,libclick,$(LIBCLICK_PATCHDIR),click-$(LIBCLICK_COMMIT_HASH)))
+
+################################################################################
+# Copy Unikraft from/to devices
+################################################################################
+ifneq ($(CONFIG_LIBCLICK_ELEMS_UNIKRAFT),)
+$(shell mkdir -p $(LIBCLICK_ORIGIN)/click-$(LIBCLICK_COMMIT_HASH)/elements)
+$(shell cp -r $(LIBCLICK_BASE)/unikraft 
$(LIBCLICK_ORIGIN)/click-$(LIBCLICK_COMMIT_HASH)/elements/)
+endif
+

Oh, you should do this as build rule with according dependencies instead. You could run this right after the sources got extracted (depend it on $(LIBCLICK_BUILD)/.origin) and before the configure script is called. Please also use the provided variables for MKDIR and CP command and the `verbose_cmd`/`build_cmd` command. As it looks like now, it copies these files when ever make is involved. This also enforces a re-compilation of those file all the time. Better to add them as dependency there, too.

+################################################################################
+# Helpers
+################################################################################
+LIBCLICK_EXTRACTED=$(LIBCLICK_ORIGIN)/click-$(LIBCLICK_COMMIT_HASH)
+LIBCLICK_ELEMENTS_DIR=$(LIBCLICK_EXTRACTED)/elements
+LIBCLICK_BUILDTOOL=$(LIBCLICK_EXTRACTED)/bin/click-buildtool
+LIBCLICK_ELEM_DIRS=aqm ethernet etherswitch icmp ip unikraft \
+                  local simple standard tcpudp threads
+
+################################################################################
+# Config Menu - Filter which element categories actually get built
+################################################################################
+LIBCLICK_ELEM_DIRS_U=$(call uc,$(LIBCLICK_ELEM_DIRS))
+LIBCLICK_FILTERED_ELEM_DIRS_U := $(foreach V, $(LIBCLICK_ELEM_DIRS_U), \
+                                 $(if $(filter 
y,$(CONFIG_LIBCLICK_ELEMS_$V)),$V))
+LIBCLICK_FILTERED_ELEM_DIRS=$(call lc,$(LIBCLICK_FILTERED_ELEM_DIRS_U))
+
+################################################################################
+# App-specific Targets
+################################################################################
+
+# Run Click's configure script
+$(LIBCLICK_BUILD)/.configured: $(LIBCLICK_BUILD)/.origin
+       $(call verbose_cmd,CONFIGURE,libapp: $@,\
+              cd $(LIBCLICK_EXTRACTED) && ./configure --enable-minios 
--with-xen=$(LIBCLICK_BUILD) --with-minios=$(LIBCLICK_BUILD) --with-newlib=$(LIBCLICK_BUILD) 
--with-lwip=$(LIBCLICK_BUILD) && \
+              $(TOUCH) $@)


Could you add a short comment why we need to run this configure script (as example: `bin/click-buildtool` is generated)?

+
+# Generate element build rules using click-buildtool
+$(LIBCLICK_BUILD)/.elementsmk: $(LIBCLICK_BUILD)/.configured $(UK_CONFIG_OUT)
+       $(call verbose_cmd,ELEMMK,libapp: $@,\
+              cd $(LIBCLICK_ELEMENTS_DIR) && echo "$(LIBCLICK_FILTERED_ELEM_DIRS)" | 
$(LIBCLICK_BUILDTOOL) findelem -r unikraft -X $(LIBCLICK_BUILD)/elements.exclude | grep -E "^[^#]" | awk 
'{print "LIBCLICK_SRCS-y += $$(LIBCLICK_EXTRACTED)/elements/" $$1}' > $@)
+
+# Generate elements.cc and add it to the build list
+$(LIBCLICK_BUILD)/elements.cc: $(LIBCLICK_BUILD)/.elementsmk
+       $(call verbose_cmd,ELEMCC,libapp: $@,\
+              echo "$(LIBCLICK_FILTERED_ELEM_DIRS)" | $(LIBCLICK_BUILDTOOL) findelem -r 
unikraft -p $(LIBCLICK_ELEMENTS_DIR) -X $(LIBCLICK_BUILD)/elements.exclude > 
$(LIBCLICK_BUILD)/.elementsconf && \
+              $(LIBCLICK_BUILDTOOL) elem2export < $(LIBCLICK_BUILD)/.elementsconf 
> $(LIBCLICK_BUILD)/elements.cc)
+
+$(LIBCLICK_BUILD)/.prepared: $(LIBCLICK_BUILD)/elements.cc
+
+UK_PREPARE += $(LIBCLICK_BUILD)/.prepared
+
+################################################################################
+# App includes, compile flags
+################################################################################
+LIBCLICK_CINCLUDES   += -I$(LIBCLICK_BASE)/include        \
+                       -I$(LIBCLICK_EXTRACTED)      \
+                       -I$(LIBCLICK_EXTRACTED)/include \
+                       -I$(LIBLWIP_LWIP_SRCS)/include/posix
+LIBCLICK_CXXINCLUDES += -I$(LIBCLICK_BASE)/include        \
+                       -I$(LIBCLICK_EXTRACTED)           \
+                       -I$(LIBCLICK_EXTRACTED)/include \
+                       -I$(LIBLWIP_LWIP_SRCS)/include/posix
+
+################################################################################
+# Global flags
+################################################################################
+LIBCLICK_CFLAGS-y       += -DLWIP_TIMEVAL_PRIVATE=0 -DCLICK_USERLEVEL
+LIBCLICK_CXXFLAGS-y     += -DLWIP_TIMEVAL_PRIVATE=0 -DCLICK_USERLEVEL 
-DHAVE_IP6
+LIBCLICK_CXXFLAGS       += -fno-exceptions -fno-rtti -std=c++11
+
+# Suppress some warnings to make the build process look neater
+LIBCLICK_SUPPRESS_FLAGS := -Wno-strict-aliasing
+LIBCLICK_CFLAGS-y += $(LIBCLICK_SUPPRESS_FLAGS)
+LIBCLICK_CXXFLAGS-y += $(LIBCLICK_SUPPRESS_FLAGS)
+
+################################################################################
+# Unikraft <-> Click glue code
+################################################################################
+LIBCLICK_SRCS-y += $(LIBCLICK_BASE)/click.cc
+
+################################################################################
+# Click sources
+################################################################################
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/archive.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/args.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/atomic.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/bighashmap_arena.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/bitvector.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/confparse.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/crc32.c
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/driver.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/element.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/elemfilter.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/error.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/etheraddress.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/gaprate.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/glue.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/handlercall.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/hashallocator.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/in_cksum.c
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/integers.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/ipaddress.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/ipflowid.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/iptable.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/lexer.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/master.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/md5.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/nameinfo.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/notifier.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/packet.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/router.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/routerthread.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/routervisitor.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/straccum.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/string.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/task.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/timer.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/timerset.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/timestamp.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/variableenv.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/ip6table.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/ip6address.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/ip6flowid.cc
+LIBCLICK_SRCS-y += $(LIBCLICK_EXTRACTED)/lib/selectset.cc
+
+################################################################################
+# Click elements
+################################################################################
+LIBCLICK_SRCS-y += $(LIBCLICK_BUILD)/elements.cc
+-include $(LIBCLICK_BUILD)/.elementsmk
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2cde5b0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,5 @@
+Click for Unikraft
+===================
+
+Please refer to the `README.md` as well as the documentation in the `doc/`
+subdirectory of the main unikraft repository.


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

>

Thanks,

Simon

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.