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

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



Thanks a lot for the changes. Looks okay to me. I just found by change two smaller things, but these can be changed while upstreaming. No need for a new version.

Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>

On 05.06.19 14:43, 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       |  87 ++++++++++++++++++++++
  MAINTAINERS.md  |  10 +++
  Makefile        |   9 +++
  Makefile.uk     | 187 ++++++++++++++++++++++++++++++++++++++++++++++++
  README.md       |   5 ++
  9 files changed, 357 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.

We are based in "Europe" ;-)

+                           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..96d946e
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,87 @@
+### Invisible option for dependencies
+config APP_DEPENDENCIES
+       bool
+       default y
+
+menuconfig LIBCLICK
+       bool "The Click modular router"
+       select UKUNISTD
+       select LIBNEWLIB
+       select LIBLWIP
+       default y
+
+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..647c3ba
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+UK_ROOT ?= $(PWD)/../../unikraft
+UK_LIBS ?= $(PWD)/../../libs
+LIBS := $(UK_LIBS)/newlib:$(UK_LIBS)/lwip
+
+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..9885520
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,187 @@
+#
+#  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
+# Sadly, kconfig doesn't support an "unselect" option, so the next best thing
+# we can do is catch this invalid configuration here and throw an error with
+# an explanation what to do.
+################################################################################
+ifeq ($(CONFIG_LWIP_AUTOIFACE),y)
+$(error Click cannot be built with LWIP option "Automatically attach netifs"! 
Please disable)
+endif
+
+################################################################################
+# 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)))
+
+################################################################################
+# 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 to generate tools needed by further prepare 
targets
+$(LIBCLICK_BUILD)/.configured: $(LIBCLICK_BUILD)/.cpfromtodevs
+       $(call verbose_cmd,CONFIGURE,libclick: $(notdir $@),\
+              cd $(LIBCLICK_EXTRACTED) && ./configure --enable-minios 
--with-xen=$(LIBCLICK_BUILD) --with-minios=$(LIBCLICK_BUILD) --with-newlib=$(LIBCLICK_BUILD) 
--with-lwip=$(LIBCLICK_BUILD) && \
+              $(TOUCH) $@)
+
+# Generate element build rules using click-buildtool
+$(LIBCLICK_BUILD)/.elementsmk: $(LIBCLICK_BUILD)/.configured $(UK_CONFIG_OUT)
+       $(call verbose_cmd,ELEMMK,libclick: $(notdir $@),\
+              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,libclick: $(notdir $@),\
+              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)/.cpfromtodevs: $(LIBCLICK_BUILD)/.origin
+       $(call verbose_cmd,CP,libclick: $(notdir $@),\

Maybe you want to call it `ELEMCP` instead of just `CP`. We are copying Unikraft elements and it would be inline with the other two commands. However, this is minor thing. I am okay with both.

+       $(MKDIR) -p $(LIBCLICK_ORIGIN)/click-$(LIBCLICK_COMMIT_HASH)/elements 
&& \
+       $(CP) -r $(LIBCLICK_BASE)/unikraft 
$(LIBCLICK_ORIGIN)/click-$(LIBCLICK_COMMIT_HASH)/elements/ && \
+       touch $@)
+
+ifneq ($(CONFIG_LIBCLICK_ELEMS_UNIKRAFT),)
+$(LIBCLICK_BUILD)/.prepared: $(LIBCLICK_BUILD)/.cpfromtodevs 
$(LIBCLICK_BUILD)/elements.cc
+else
+$(LIBCLICK_BUILD)/.prepared: $(LIBCLICK_BUILD)/elements.cc
+endif
+
+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

 


Rackspace

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