From patchwork Mon Mar 21 17:49:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkatesh Vivekanandan X-Patchwork-Id: 64130 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1550506lbc; Mon, 21 Mar 2016 10:51:16 -0700 (PDT) X-Received: by 10.50.44.81 with SMTP id c17mr8206113igm.93.1458582676158; Mon, 21 Mar 2016 10:51:16 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 90si12807134ioh.121.2016.03.21.10.51.15; Mon, 21 Mar 2016 10:51:16 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 9233E6181B; Mon, 21 Mar 2016 17:51:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 542E161857; Mon, 21 Mar 2016 17:50:07 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 257A961818; Mon, 21 Mar 2016 17:49:47 +0000 (UTC) Received: from mail-gw2-out.broadcom.com (mail-gw2-out.broadcom.com [216.31.210.63]) by lists.linaro.org (Postfix) with ESMTP id 1234D61818 for ; Mon, 21 Mar 2016 17:49:44 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.24,372,1455004800"; d="scan'208";a="91054179" Received: from mail-irv-18.broadcom.com ([10.15.198.37]) by mail-gw2-out.broadcom.com with ESMTP; 21 Mar 2016 10:56:59 -0700 Received: from mail-irva-13.broadcom.com (mail-irva-13.broadcom.com [10.11.16.103]) by mail-irv-18.broadcom.com (Postfix) with ESMTP id A0D288202D; Mon, 21 Mar 2016 10:49:44 -0700 (PDT) Received: from apslabuser-PowerEdge-T610.ban.broadcom.com (unknown [10.131.60.56]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id DFC1340FEA; Mon, 21 Mar 2016 10:49:17 -0700 (PDT) From: venkatesh.vivekanandan@linaro.org To: lng-odp@lists.linaro.org Date: Mon, 21 Mar 2016 23:19:41 +0530 Message-Id: <1458582581-21827-1-git-send-email-venkatesh.vivekanandan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH v4 4/6] linux-generic: odp-ipfw: Initial changes to compile uipfw in odp X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Venkatesh Vivekanandan - created example/ipfw/Makefile.am - changes done in example/m4/configure.m4 - uipfw is the same as netmap-ipfw's kipfw - odp_uipfw runs in userspace to receive/send packets from network interface. This is mostly like a forwarding application, that forwards traffic from one port to other port after running through a set of rules. Signed-off-by: Venkatesh Vivekanandan --- example/Makefile.am | 2 +- example/ipfw/Makefile.am | 113 +++++++++++++++++++++++++++++++++++++++++++++++ example/m4/configure.m4 | 3 +- 3 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 example/ipfw/Makefile.am diff --git a/example/Makefile.am b/example/Makefile.am index 33556da..2dea019 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -1,2 +1,2 @@ SUBDIRS = classifier generator ipsec packet time timer traffic_mgmt \ - l2fwd_simple ipfw/ipfw + l2fwd_simple ipfw/ipfw ipfw diff --git a/example/ipfw/Makefile.am b/example/ipfw/Makefile.am new file mode 100644 index 0000000..a37d00b --- /dev/null +++ b/example/ipfw/Makefile.am @@ -0,0 +1,113 @@ +OBJDIR=objs +# ipfw and uipfw are built in subdirs +INCDIRS = -I ./$(OBJDIR)/include_e -DEMULATE_SYSCTL +INCDIRS += -I ./sys -I ./extra/sys -I ./extra/sys/contrib/pf -I../../include +# ODP specific start +INCDIRS += -I$(top_srcdir)/test \ + -I$(top_srcdir)/platform/@with_platform@/include \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/helper/include +# ODP specific end + + +OBJPATH = ./$(OBJDIR) + +# EFILES* are the dummy files created to avoid compilation errors. +# Please refer Makefile.kipfw available at +# https://github.com/luigirizzo/netmap-ipfw.git + +#EFILES_. = libutil.h +#EFILES_sys = condvar.h priv.h _lock.h cpuset.h +#EFILES_sys += lock.h ucred.h # taskqueue.h +#EFILES_sys += sockio.h +#EFILES_sys += cpuset.h +#EFILES_machine = in_cksum.h +#EFILES_netinet = in_pcb.h ip_carp.h pim.h sctp.h tcp_var.h +#EFILES_net = if_types.h bpf.h netisr.h vnet.h +#EFILES_linux = module.h + +E_CFLAGS = $(INCDIRS) +E_CFLAGS += -include ./extra/glue.h # headers +E_CFLAGS += -include ./extra/missing.h # headers +E_CFLAGS += -O2 -Wall -Werror +E_CFLAGS += -fno-strict-aliasing +E_CFLAGS += -Wno-variadic-macros +E_CFLAGS += -Wno-pointer-arith +E_CFLAGS += -g +E_CFLAGS += -DKERNEL_SIDE # build the kernel side of the firewall +E_CFLAGS += -DUSERSPACE # communicate through userspace +E_CFLAGS += -DINET +E_CFLAGS += -DIPFIREWALL_DEFAULT_TO_ACCEPT +E_CFLAGS += -D_BSD_SOURCE +E_CFLAGS += -D_DEFAULT_SOURCE # on glibc 2.20 and above +# many of the kernel headers need _KERNEL +E_CFLAGS += -D_KERNEL +E_CFLAGS += -D__BSD_VISIBLE +E_CFLAGS += -D_GNU_SOURCE # ffsl +E_CFLAGS += -DNEED_SIN_LEN +E_CFLAGS += -include ./extra/linux_defs.h +E_CFLAGS += -Wno-unused-but-set-variable +E_CFLAGS += -Wno-unused +E_CFLAGS += -Dradix -DNEED_ROUNDUP2 + +#ipfw + dummynet section, other parts are not compiled in +SRCS_NET = sys/net/radix.c +SRCS_NETINET = sys/netinet/in_cksum.c +SRCS_IPFW = sys/netpfil/ipfw/dn_heap.c +SRCS_IPFW += sys/netpfil/ipfw/dn_sched_fifo.c +SRCS_IPFW += sys/netpfil/ipfw/dn_sched_prio.c +SRCS_IPFW += sys/netpfil/ipfw/dn_sched_qfq.c +SRCS_IPFW += sys/netpfil/ipfw/dn_sched_rr.c +SRCS_IPFW += sys/netpfil/ipfw/dn_sched_wf2q.c +SRCS_IPFW += sys/netpfil/ipfw/ip_dn_glue.c +SRCS_IPFW += sys/netpfil/ipfw/ip_dn_io.c +SRCS_IPFW += sys/netpfil/ipfw/ip_dummynet.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw2.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_dynamic.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_iface.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_log.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_pfil.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_sockopt.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_table.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_table_algo.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_table_value.c +# Module glue and functions missing in linux +IPFW_SRCS = $(SRCS_NET) $(SRCS_NETINET) $(SRCS_IPFW) +IPFW_SRCS += extra/ipfw2_mod.c # bsd_compat.c + +IPFW_SRCS += extra/missing.c extra/session.c + +# entries to create empty files +#EFILES_. += opt_inet.h opt_ipsec.h opt_ipdivert.h +#EFILES_. += opt_inet6.h opt_ipfw.h opt_mpath.h +#EFILES_. += opt_mbuf_stress_test.h opt_param.h +#EFILES_. += timeconv.h + +#EFILES_altq += if_altq.h + +#EFILES_net += if_var.h route.h if_clone.h +#EFILES_netpfil/pf += pf_mtag.h +#EFILES_netinet += in_var.h ip_var.h udp_var.h +#EFILES_netinet6 += ip6_var.h +#EFILES_sys += proc.h sockopt.h sysctl.h +# new +#EFILES_sys += mutex.h _mutex.h _rwlock.h rwlock.h +#EFILES_sys += eventhandler.h +#EFILES_sys += jail.h ktr.h rmlock.h +#EFILES_sys += counter.h + +#EFILES_vm += vm.h vm_extern.h + +AM_CFLAGS = $(E_CFLAGS) +AM_CFLAGS += -I$(top_srcdir)/platform/$(with_platform)/arch/$(ARCH) + +AM_LDFLAGS += ../../lib/.libs/libodp.a ../../lib/.libs/libodphelper.a -lpthread + +bin_PROGRAMS = odp_uipfw$(EXEEXT) +odp_uipfw_LDFLAGS = $(AM_LDFLAGS) -static +odp_uipfw_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example + +noinst_HEADERS = \ + $(top_srcdir)/example/example_debug.h + +dist_odp_uipfw_SOURCES = $(IPFW_SRCS) diff --git a/example/m4/configure.m4 b/example/m4/configure.m4 index ebe38ec..4d9c893 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -7,4 +7,5 @@ AC_CONFIG_FILES([example/classifier/Makefile example/timer/Makefile example/traffic_mgmt/Makefile example/l2fwd_simple/Makefile - example/ipfw/ipfw/Makefile]) + example/ipfw/ipfw/Makefile + example/ipfw/Makefile])