From patchwork Thu Mar 10 06:57:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkatesh Vivekanandan X-Patchwork-Id: 63739 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp269723lbc; Wed, 9 Mar 2016 23:00:11 -0800 (PST) X-Received: by 10.140.99.72 with SMTP id p66mr2107124qge.16.1457593211761; Wed, 09 Mar 2016 23:00:11 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c81si2330724qha.130.2016.03.09.23.00.11; Wed, 09 Mar 2016 23:00:11 -0800 (PST) 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 5D58B6512E; Thu, 10 Mar 2016 07:00:11 +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=-1.9 required=5.0 tests=BAYES_00, 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 5761A6512B; Thu, 10 Mar 2016 06:58:32 +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 EEA5265111; Thu, 10 Mar 2016 06:57:40 +0000 (UTC) Received: from mail-irv-18.broadcom.com (5520-maca-inet1-outside.broadcom.com [216.31.211.11]) by lists.linaro.org (Postfix) with ESMTP id 2FAF76508B for ; Thu, 10 Mar 2016 06:57:39 +0000 (UTC) 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 E0A10820D7; Wed, 9 Mar 2016 22:57:38 -0800 (PST) Received: from apslabuser-PowerEdge-T610.ban.broadcom.com (unknown [10.131.60.56]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 807EB40FE5; Wed, 9 Mar 2016 22:57:17 -0800 (PST) From: venkatesh.vivekanandan@linaro.org To: lng-odp@lists.linaro.org Date: Thu, 10 Mar 2016 12:27:35 +0530 Message-Id: <1457593055-19596-1-git-send-email-venkatesh.vivekanandan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH v1 4/5] 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 | 111 +++++++++++++++++++++++++++++++++++++++++++++++ example/m4/configure.m4 | 3 +- 3 files changed, 114 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..864aff3 --- /dev/null +++ b/example/ipfw/Makefile.am @@ -0,0 +1,111 @@ +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_IPFW = sys/netpfil/ipfw/ip_fw2.c sys/netpfil/ipfw/ip_fw_pfil.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_sockopt.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_dynamic.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_table.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_log.c +SRCS_IPFW += sys/netpfil/ipfw/ip_dummynet.c sys/netpfil/ipfw/ip_dn_io.c +SRCS_IPFW += sys/netpfil/ipfw/ip_dn_glue.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_iface.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_table_algo.c +SRCS_IPFW += sys/netpfil/ipfw/ip_fw_table_value.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_wf2q.c +SRCS_IPFW += sys/netpfil/ipfw/dn_sched_rr.c +SRCS_IPFW += sys/netpfil/ipfw/dn_sched_qfq.c +SRCS_IPFW += sys/netpfil/ipfw/dn_sched_prio.c +SRCS_NET = sys/net/radix.c +SRCS_NETINET = sys/netinet/in_cksum.c +# Module glue and functions missing in linux +IPFW_SRCS = $(SRCS_IPFW) $(SRCS_NET) $(SRCS_NETINET) +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])