| # |
| # Copyright (C) 2007 OpenWrt.org |
| # |
| # This is free software, licensed under the GNU General Public License v2. |
| # See /LICENSE for more information. |
| # |
| # |
| |
| include $(TOPDIR)/rules.mk |
| include $(INCLUDE_DIR)/kernel.mk |
| |
| USE_SOURCE_DIR:=$(MRVLDIR)/fastpath |
| |
| PKG_NAME:=mfp |
| PKG_VERSION:=2.1 |
| |
| PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) |
| PREBUILT_DIR:=$(CURDIR)/files |
| |
| PKG_MAINTAINER:=Tomer Eliyahu <tomere@marvell.com> |
| |
| include $(INCLUDE_DIR)/package.mk |
| |
| define KernelPackage/mfp |
| SUBMENU:=Marvell Fastpath |
| TITLE:=Marvell Fastpath |
| KCONFIG:= \ |
| CONFIG_NF_CONNTRACK_FASTPATH=y \ |
| CONFIG_NETIF_RX_FASTPATH_HOOK=y |
| DEPENDS:=@TARGET_mmp +kmod-nf-conntrack-netlink +kmod-ip6tables |
| FILES:=$(PKG_BUILD_DIR)/mfp.ko |
| VERSION:=$(LINUX_VERSION)+$(PKG_NAME)-$(PKG_VERSION) |
| endef |
| |
| define KernelPackage/mfp/description |
| Kernel support for Marvell fastpath |
| endef |
| |
| define KernelPackage/mfp/config |
| source "$(SOURCE)/Config.in" |
| endef |
| |
| EXTRA_CFLAGS:= \ |
| -Inet/bridge \ |
| $(if $(wildcard $(MRVLDIR)/fastpath/PBMARK),-DFP_DRV_VERSION=$(cat version.txt),-DFP_DRV_VERSION=$(shell cd $(USE_SOURCE_DIR) && git log -1 --format="%H")) \ |
| -DFP_FORWARD_RX_HOOK_DEFAULT=$(CONFIG_FASTPATH_FORWARD_RX_HOOK) \ |
| -DFP_FORWARD_TX_HOOK_DEFAULT=$(CONFIG_FASTPATH_FORWARD_TX_HOOK) \ |
| $(if $(CONFIG_FASTPATH_DEBUG),-DFASTPATH_DEBUG) \ |
| $(if $(CONFIG_TARGET_mmp),-DSKB_P_SUPPORT) \ |
| $(if $(CONFIG_FASTPATH_WARN_AS_ERR),-DFASTPATH_WARN_AS_ERR) \ |
| $(if $(CONFIG_FASTPATH_LEARNER_WQ),-DFP_LEARNER_WQ_DEFAULT=true,-DFP_LEARNER_WQ_DEFAULT=false) |
| |
| ifeq "$(CONFIG_TARGET_mmp_pxa1826)" "y" |
| EXTRA_CFLAGS += -DFP_USE_SRAM_POOL_OPT |
| endif |
| |
| ifeq "$(CONFIG_TARGET_mmp_asr1802s)" "y" |
| EXTRA_CFLAGS += -DFP_USE_SRAM_POOL_OPT |
| endif |
| |
| ifeq "$(CONFIG_TARGET_mmp_asr1803)" "y" |
| EXTRA_CFLAGS += -DFP_USE_SRAM_POOL_OPT |
| endif |
| |
| MAKE_CMD:=$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ |
| ARCH="$(LINUX_KARCH)" \ |
| CROSS_COMPILE="$(TARGET_CROSS)" \ |
| M="$(PKG_BUILD_DIR)" \ |
| cmd_ar='rm -f $$$$@; $(TARGET_CROSS)ar cDrs $$$$@ $$$$(real-prereqs)' \ |
| EXTRA_CFLAGS="$(EXTRA_CFLAGS)" |
| |
| |
| CLEAN_CMD:=rm -rf $(PKG_BUILD_DIR)/{*.o,*.mod.*,modules.order,Module.symvers,ipkg-*,*.ko,*.a,ipkg-*} \ |
| rm -rf $(MRVLDIR)/fastpath/{*.o,*.mod.*,modules.order,Module.symvers,ipkg-*,*.ko,*.a,ipkg-*} |
| |
| define Build/Prepare/Prebuilt |
| @rm -rf $(PKG_BUILD_DIR) |
| $(if $(wildcard $(PREBUILT_DIR)/*),,@echo "ERROR: PREBUILT_DIR=$(PREBUILT_DIR) path not found"; false) |
| @mkdir -p $(MRVLDIR)/fastpath |
| $(CP) $(PREBUILT_DIR)/* $(MRVLDIR)/fastpath/ |
| @ln -snf $(MRVLDIR)/fastpath/ $(PKG_BUILD_DIR) |
| touch $(MRVLDIR)/fastpath/PBMARK |
| endef |
| |
| $(STAMP_PREPARED): FORCE |
| |
| define Build/Prepare |
| $(if $(and $(wildcard $(USE_SOURCE_DIR)/.git),$(filter 39d0a3097cff8c63d3190bfef5034f8b699c8d9c,$(shell cd $(USE_SOURCE_DIR) && git rev-list --max-parents=0 HEAD))), $(call Build/Prepare/Default,),$(call Build/Prepare/Prebuilt,)) |
| endef |
| |
| define Build/Compile |
| $(MAKE_CMD) modules |
| [ -e $(MRVLDIR)/fastpath/PBMARK ] || echo $(shell cd $(USE_SOURCE_DIR) && git log -1 --format="%H") > $(MRVLDIR)/fastpath/version.txt |
| mkdir -p $(BIN_DIR)/symbol/modules |
| cp -rf $(PKG_BUILD_DIR)/mfp.o $(BIN_DIR)/symbol/modules/ |
| if [ -e $(MRVLDIR)/fastpath/lib.a ]; then \ |
| $(TARGET_CROSS)strip -g $(MRVLDIR)/fastpath/lib.a; \ |
| $(TARGET_CROSS)strip -g $(MRVLDIR)/fastpath/*.ko; \ |
| mv $(MRVLDIR)/fastpath/lib.a $(MRVLDIR)/fastpath/mfp.a; \ |
| fi |
| endef |
| |
| define Build/Clean |
| $(if $(wildcard $(USE_SOURCE_DIR)), $(CLEAN_CMD),) |
| endef |
| |
| $(eval $(call KernelPackage,mfp)) |