mirror of
https://dev.iopsys.eu/feed/intel.git
synced 2025-12-20 02:18:20 +08:00
Add dsl-cpe-fapi and related packages
This commit is contained in:
7
dsl-cpe-fapi/Config.in
Normal file
7
dsl-cpe-fapi/Config.in
Normal file
@@ -0,0 +1,7 @@
|
||||
menu "Configuration"
|
||||
depends on PACKAGE_dsl-cpe-fapi
|
||||
|
||||
config dsl-cpe-fapi_FAPI_DAEMON
|
||||
bool "Support CLI application"
|
||||
default n
|
||||
endmenu
|
||||
121
dsl-cpe-fapi/Makefile
Normal file
121
dsl-cpe-fapi/Makefile
Normal file
@@ -0,0 +1,121 @@
|
||||
#
|
||||
# Copyright (C) 2017 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
|
||||
|
||||
PKG_NAME:=dsl-cpe-fapi
|
||||
PKG_VERSION:=0.6.1
|
||||
PKG_MD5SUM:=4d24f6163e6c2ba53222872bf7019198
|
||||
PKG_BASE_NAME:=dsl_cpe_fapi
|
||||
PKG_SOURCE:=$(PKG_BASE_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_BASE_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=git@dev.iopsys.eu:intel/$(PKG_NAME).git
|
||||
|
||||
LANTIQ_BIN_DIR=/$(VENDOR_PATH)/bin
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_FIXUP:=libtool
|
||||
PKG_INSTALL:=1
|
||||
|
||||
-include $(INCLUDE_DIR)/package-version-override.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(findstring intel,$(VENDOR_PATH)),intel)
|
||||
#UGW8 onwards
|
||||
$(call include_mk, ugw-loglevel.mk)
|
||||
else
|
||||
-include $(INCLUDE_DIR)/ugw-loglevel.mk
|
||||
endif
|
||||
|
||||
# Get config values from general image config or other packages in dependency list
|
||||
# Definition of these values will be overtaken from package 'dsl-cpe-mei-vrx'
|
||||
|
||||
# Set default config values if necessary (not defined before)
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Lantiq
|
||||
SUBMENU:=DSL Subsystem
|
||||
TITLE:=DSL CPE FAPI shared lib
|
||||
URL:=http://www.lantiq.com/
|
||||
MAINTAINER:=Lantiq Beteiligungs-GmbH & Co. KG
|
||||
DEPENDS:= +libugwhelper +libpthread +librt +lib-cli +dsl-cpe-control-vrx +libscapi +system_fapi
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
This package contains the DSL CPE FAPI.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
$(call Package/$(PKG_NAME)/override_version)
|
||||
$(call Package/$(PKG_NAME)/override_source_path)
|
||||
$(call Package/$(PKG_NAME)/config_debug_level)
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-vrx \
|
||||
--enable-driver-include="-I$(STAGING_DIR)/usr/include/drv_dsl_cpe_api" \
|
||||
--enable-ifxos-include="-I$(STAGING_DIR)/usr/include/ifxos" \
|
||||
--enable-ifxos-library="-L$(STAGING_DIR)/usr/lib" \
|
||||
--enable-dsl-fapi-include="-I$(STAGING_DIR)/usr/include/dsl-fapi" \
|
||||
--enable-dsl-fapi-library="-L$(STAGING_DIR)/usr/lib" \
|
||||
--enable-cli \
|
||||
--enable-cli-include="-I$(STAGING_DIR)/usr/include/cli" \
|
||||
--enable-cli-library="-L$(STAGING_DIR)/usr/lib" \
|
||||
|
||||
ifeq ($(CONFIG_dsl-cpe-fapi_FAPI_DAEMON),y)
|
||||
CONFIGURE_ARGS += --enable-dsl-fapi-daemon=yes
|
||||
else
|
||||
CONFIGURE_ARGS += --enable-dsl-fapi-daemon=no
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += -I$(LINUX_DIR)/user_headers/include/net/ -I$(LINUX_DIR)/user_headers/include/ -I$(LINUX_DIR)/include/
|
||||
|
||||
ifeq ($(CONFIG_USE_MUSL),y)
|
||||
TARGET_CFLAGS += -DCONFIG_USE_MUSL
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
# remove "configured" stamps of other configs
|
||||
@- rm $(PKG_BUILD_DIR)/.configured*
|
||||
$(call Build/Configure/Default)
|
||||
endef
|
||||
|
||||
define Build/Clean
|
||||
@- rm -Rf $(PKG_BUILD_DIR)/ipkg*
|
||||
@- [ -e $(PKG_BUILD_DIR)/Makefile ] && $(MAKE) -C $(PKG_BUILD_DIR) clean
|
||||
$(call Build/Clean/Default)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/{lib,include/dsl-fapi}
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/include/* $(1)/usr/include/dsl-fapi
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dsl_fapi_config.h $(1)/usr/include/dsl-fapi
|
||||
mkdir -p $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/*.{a,la,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Build/UninstallDev
|
||||
- rm -f $(1)/usr/lib/libdslfapi*.*
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
cd $(1)/usr/lib && rm -f "libdslfapi.so.0" && ln -s "../../$(VENDOR_PATH)/usr/lib/libdslfapi.so" "libdslfapi.so.0"
|
||||
$(INSTALL_DIR) $(1)/$(VENDOR_PATH)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libdslfapi.so $(1)/$(VENDOR_PATH)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/$(LANTIQ_BIN_DIR)
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dsl_fapid $(1)/$(LANTIQ_BIN_DIR)
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dsl_fapi_pipe.sh $(1)/$(LANTIQ_BIN_DIR)
|
||||
$(INSTALL_BIN) ./files/dsl_fapi.cfg $(1)/$(LANTIQ_BIN_DIR)
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/docs
|
||||
$(CP) $(PKG_BUILD_DIR)/include/dsl_fapi.h $(STAGING_DIR)/usr/docs/.
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
20
dsl-cpe-fapi/files/dsl_fapi.cfg
Normal file
20
dsl-cpe-fapi/files/dsl_fapi.cfg
Normal file
@@ -0,0 +1,20 @@
|
||||
X_LANTIQ_COM_BitswapUs_V, 1
|
||||
X_LANTIQ_COM_BitswapUs_A, 1
|
||||
X_LANTIQ_COM_BitswapDs_V, 0
|
||||
X_LANTIQ_COM_BitswapDs_A, 0
|
||||
X_LANTIQ_COM_LinkEncapsulationConfig, G.992.3_Annex_K_ATM,G.992.3_Annex_K_PTM,G.993.2_Annex_K_PTM
|
||||
X_LANTIQ_COM_ReTxUs, 1
|
||||
X_LANTIQ_COM_ReTxDs_V, 0
|
||||
X_LANTIQ_COM_ReTxDs_A, 0
|
||||
X_LANTIQ_COM_SraUs_V, 1
|
||||
X_LANTIQ_COM_SraUs_A, 0
|
||||
X_LANTIQ_COM_SraDs_V, 1
|
||||
X_LANTIQ_COM_SraDs_A, 0
|
||||
X_LANTIQ_COM_XTSE, 0x5 0x0 0x4 0x0 0xC 0x1 0x0 0x7
|
||||
X_LANTIQ_COM_VirtualNoiseUs, 1
|
||||
X_LANTIQ_COM_VirtualNoiseDs, 0
|
||||
X_LANTIQ_COM_Vectoring, Auto
|
||||
X_LANTIQ_COM_DSLNextMode, VDSL
|
||||
X_LANTIQ_COM_DSLActSeq, StandardGHS
|
||||
X_LANTIQ_COM_DSLActMode, GHS
|
||||
X_LANTIQ_COM_DSLRemember, 1
|
||||
243
fapi_system/Makefile
Executable file
243
fapi_system/Makefile
Executable file
@@ -0,0 +1,243 @@
|
||||
#
|
||||
# Copyright (C) 2009 OpenWrt.org
|
||||
# Copyright (C) 2017 Intel Corporation
|
||||
#
|
||||
# Openwrt Makefile for system_fapi
|
||||
#
|
||||
#
|
||||
|
||||
#### Includes ###################################
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
#### Package Info ###############################
|
||||
PKG_NAME:=system_fapi
|
||||
PKG_SOURCE_VERSION:=1.1.8.10
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_NAME:=system_service
|
||||
PKG_SOURCE_INNERDIR:=fapi_system_src
|
||||
PKG_SOURCE_URL:=ssh://git@gts-chd.intel.com:29418/sw_ugw/$(PKG_SOURCE_NAME).git
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Intel
|
||||
PKG_LICENSE:=Intel
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
-include $(INCLUDE_DIR)/package-version-override.mk
|
||||
$(call include_mk, ugw-loglevel.mk)
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Intel
|
||||
SUBMENU:=UGW Functional APIs
|
||||
TITLE:=UGW System Configuration FAPI
|
||||
URL:=http://www.intel.com
|
||||
MAINTAINER:=Intel Corporation
|
||||
DEPENDS:= +libscapi +libsafec
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Intel UGW FAPI for System Configuration
|
||||
endef
|
||||
|
||||
#### Exports ####################################
|
||||
export LINUX_KARCH TARGET_CONFIGURE_OPTS LINUX_DIR PKG_BUILD_DIR
|
||||
|
||||
### Menuconfig ##################################
|
||||
define Package/$(PKG_NAME)/config
|
||||
$(call Package/$(PKG_NAME)/override_version)
|
||||
$(call Package/$(PKG_NAME)/override_source_path)
|
||||
$(call Package/$(PKG_NAME)/config_debug_level)
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -I$(LINUX_DIR)/user_headers/include/net/ \
|
||||
-I$(LINUX_DIR)/user_headers/include/ \
|
||||
-I$(LINUX_DIR)/include/ \
|
||||
-I$(STAGING_DIR)/usr/include/ \
|
||||
-DCONFIG_LTQ_PPA_IPv6_ENABLE \
|
||||
-DCONFIG_LTQ_PPA_QOS \
|
||||
-DCONFIG_LTQ_PPA_QOS_WFQ \
|
||||
-DCONFIG_LTQ_PPA_QOS_RATE_SHAPING \
|
||||
-DCONFIG_LTQ_PPA_HAL_SELECTOR \
|
||||
-DCONFIG_LTQ_PPA_API_SW_FASTPATH
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_kmod-lantiq-swaccel),y)
|
||||
TARGET_CFLAGS += -DCONFIG_LTQ_PPA_API_SW_FASTPATH
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_kmod-toe_drv),y)
|
||||
TARGET_CFLAGS += -DCONFIG_INTEL_TRAFFIC_OFFLOAD_ENGINE
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_kmod-directconnect_dp),y)
|
||||
TARGET_CFLAGS += -DCONFIG_DC_DATAPATH_FRAMEWORK
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_switch_cli),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_LANTIQ_SWITCH
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_switch_cli_ugw8),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_LANTIQ_SWITCH
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx200),y)
|
||||
TARGET_CFLAGS +=-DPLATFORM_XRX200
|
||||
export PLATFORM_XRX200=1
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CONFIG_TARGET_lantiq_xrx200_EASY220W2)),y)
|
||||
TARGET_CFLAGS +=-DPLATFORM_XRX200_EASY220W2
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx330),y)
|
||||
TARGET_CFLAGS +=-DPLATFORM_XRX330
|
||||
export PLATFORM_XRX330=1
|
||||
|
||||
ifeq ($(strip $(CONFIG_TARGET_lantiq_xrx330_EASY300_AC1200)),y)
|
||||
TARGET_CFLAGS +=-DPLATFORM_XRX330_EASY300_AC1200
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CONFIG_TARGET_lantiq_xrx330_EASY330_AC1200_35B)),y)
|
||||
TARGET_CFLAGS +=-DPLATFORM_XRX330_EASY300_AC1200
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CONFIG_TARGET_lantiq_xrx330_EASY330_RT)),y)
|
||||
TARGET_CFLAGS +=-DPLATFORM_XRX330_EASY330_RT
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx300),y)
|
||||
TARGET_CFLAGS +=-DPLATFORM_XRX300
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx500),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_LTQ_PPA_HAL_SELECTOR -DCONFIG_LTQ_PPA_GRX500 -DCONFIG_LTQ_TARGET_GRX500 -DPLATFORM_XRX500
|
||||
export PLATFORM_XRX500=1
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_intel_mips_xrx500),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_LTQ_PPA_HAL_SELECTOR -DCONFIG_LTQ_PPA_GRX500 -DCONFIG_LTQ_TARGET_GRX500 -DPLATFORM_XRX500
|
||||
export PLATFORM_XRX500=1
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_intel_xway_xrx500),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_LTQ_PPA_HAL_SELECTOR -DCONFIG_LTQ_PPA_GRX500 -DCONFIG_LTQ_TARGET_GRX500 -DPLATFORM_XRX500
|
||||
export PLATFORM_XRX500=1
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_intel_xway_xrx500_4kec),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_LTQ_PPA_HAL_SELECTOR -DCONFIG_LTQ_PPA_GRX500 -DCONFIG_LTQ_TARGET_GRX500 -DPLATFORM_XRX500
|
||||
export PLATFORM_XRX500=1
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_intel_x86),y)
|
||||
TARGET_CFLAGS += -DNO_PPA
|
||||
TARGET_CFLAGS += -DPLATFORM_XRX750
|
||||
export PLATFORM_XRX750=1
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_kmod-lan_port_separation),y)
|
||||
TARGET_CFLAGS +=-DENABLE_LAN_PORT_SEPARATION
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_kmod-gphy_event),y)
|
||||
TARGET_CFLAGS +=-DENABLE_LAN_PORT_LINK_EVENT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_kmod-vrx518-dp-mod),y)
|
||||
TARGET_CFLAGS += -DCONFIG_VRX518_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_ltq_vrx320_datapath_drv),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_VRX320_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_VRX320_PTM_VECTORING),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_VRX320_PTM_VECTORING_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FEATURE_SESSION_LIMIT),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_LTQ_PPA_HANDLE_CONNTRACK_SESSIONS
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_kmod-pp_crypto_drv),y)
|
||||
EXTRA_CFLAGS += -DCONFIG_IPSEC_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FEATURE_WWAN_LTE_SUPPORT),y)
|
||||
EXTRA_CFLAGS += -DCONFIG_WWAN_LTE_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_kmod-l2nat),y)
|
||||
EXTRA_CFLAGS += -DCONFIG_L2NAT_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USE_MUSL),y)
|
||||
TARGET_CFLAGS += -DCONFIG_USE_MUSL
|
||||
endif
|
||||
|
||||
TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib/ppa_api/ \
|
||||
-L$(LINUX_DIR)/user_headers/include/net/
|
||||
|
||||
#### Target Rules ###############################
|
||||
# To Staging Dir
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/docs/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/fapi_processorstat.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/fapi_sys_common.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/ppa_api_local.h $(1)/usr/include/
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx200),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/xRX220/xRX220_callback.h $(1)/usr/include/
|
||||
endif
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx500),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/xRX350/xRX350_callback.h $(1)/usr/include/
|
||||
endif
|
||||
ifeq ($(CONFIG_TARGET_intel_xway_xrx500),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/xRX350/xRX350_callback.h $(1)/usr/include/
|
||||
endif
|
||||
ifeq ($(CONFIG_TARGET_intel_xway_xrx500_4kec),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/xRX350/xRX350_callback.h $(1)/usr/include/
|
||||
endif
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx330),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/xRX330/xRX330_callback.h $(1)/usr/include/
|
||||
endif
|
||||
$(CP) $(PKG_BUILD_DIR)/include/fapi_led.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/fapi_sys_common.h $(1)/usr/docs/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/fapi_led.h $(1)/usr/docs/
|
||||
$(CP) $(PKG_BUILD_DIR)/*.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
# To ipkg / Rootfs
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/$(VENDOR_PATH)/usr/lib
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx200),y)
|
||||
$(INSTALL_DIR) $(1)/$(VENDOR_PATH)/etc/
|
||||
endif
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx330),y)
|
||||
$(INSTALL_DIR) $(1)/$(VENDOR_PATH)/etc/
|
||||
endif
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libsysfapi.so $(1)/$(VENDOR_PATH)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libethfapi.so $(1)/$(VENDOR_PATH)/usr/lib/
|
||||
ifneq ($(CONFIG_LANTIQ_OPENWRT_FIRMWARE),y)
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx200),y)
|
||||
$(CP) ./files/etc/* $(1)/$(VENDOR_PATH)/etc/
|
||||
endif
|
||||
ifeq ($(CONFIG_TARGET_lantiq_xrx330),y)
|
||||
$(CP) ./files/etc/* $(1)/$(VENDOR_PATH)/etc/
|
||||
endif
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
define Build/Clean
|
||||
if [ -d $(PKG_BUILD_DIR) ]; then $(MAKE) -C $(PKG_BUILD_DIR) clean; \
|
||||
$(RM) -r $(PKG_BUILD_DIR)/ipkg-$(BOARD); fi
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
82
fapi_system/files/etc/config_bridge_accel
Executable file
82
fapi_system/files/etc/config_bridge_accel
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! "$CONFIGLOADED" ]; then
|
||||
if [ -r /etc/rc.d/config.sh ]; then
|
||||
. /etc/rc.d/config.sh 2>/dev/null
|
||||
CONFIGLOADED="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
local wanintf
|
||||
local lan
|
||||
local brname
|
||||
local action
|
||||
|
||||
wanintf=$1
|
||||
lan=$2
|
||||
brname=$3
|
||||
action=$4
|
||||
|
||||
#if [ "$intf" = "ra0" -o "$intf" = "wlan" -o "$intf" = "ath" ]; then
|
||||
|
||||
#if [ "$1" = "wlan0" -o "$1" = "ath0" -o "$1" = "ra0" ]; then
|
||||
|
||||
#add switch config to accelerate wlan traffic
|
||||
# enable_bridge_accel 0 $intf $brname
|
||||
|
||||
#else
|
||||
iface=$(echo $wanintf | cut -d "_" -f1)
|
||||
if [ "${iface::3}" = "nas" ]; then
|
||||
. ${VENDOR_PATH}/etc/switch_functions "dsl" 2> /dev/null
|
||||
elif [ "$iface" = "ptm0" ]; then
|
||||
. ${VENDOR_PATH}/etc/switch_functions "dsl" 2> /dev/null
|
||||
elif [ "$iface" = "eth1" ]; then
|
||||
. ${VENDOR_PATH}/etc/switch_functions "eth" 2> /dev/null
|
||||
fi
|
||||
|
||||
if [ "$action" = "enable" ]; then
|
||||
echo disable > /proc/ppa/api/bridged_flow_learning
|
||||
killall dnsmasq
|
||||
#add switch config to accelerate lan-wan traffic
|
||||
enable_bridge_accel $wanintf $lan $brname
|
||||
|
||||
elif [ "$action" = "disable" ]; then
|
||||
|
||||
#add switch config to accelerate lan-wan traffic
|
||||
disable_bridge_accel $wanintf $lan
|
||||
|
||||
echo enable > /proc/ppa/api/bridged_flow_learning
|
||||
#dnsmasq
|
||||
elif [ "$action" = "bridge_add" ]; then
|
||||
|
||||
#local lanif
|
||||
if [ ! "$lan" == "-" ] ; then
|
||||
${VENDOR_PATH}/etc/vrx220_multi_bridge_config ADD "$lan"
|
||||
fi
|
||||
#if [ ! $wanintf == "-" ] ; then
|
||||
# echo disable > /proc/ppa/api/bridged_flow_learning
|
||||
# killall dnsmasq
|
||||
# for i in $lan ; do
|
||||
# if [ "$i" = "5" ] ; then
|
||||
# lanif="$lanif eth0_1"
|
||||
# elif [ "$i" = "2" ] ; then
|
||||
# lanif="$lanif eth0_2"
|
||||
# elif [ "$i" = "3" ] ; then
|
||||
# lanif="$lanif eth0_3"
|
||||
# fi
|
||||
# enable_bridge_accel $wanintf $lan $brname
|
||||
#fi
|
||||
elif [ "$action" = "bridge_del" ]; then
|
||||
|
||||
#if [ ! $wanintf == "-" ] ; then
|
||||
# disable_bridge_accel $wanintf $lan
|
||||
#fi
|
||||
if [ ! "$lan" == "-" ] ; then
|
||||
${VENDOR_PATH}/etc/vrx220_multi_bridge_config DEL "$lan"
|
||||
fi
|
||||
elif [ "$action" = "bridge_mod" ]; then
|
||||
|
||||
if [ ! "$lan" == "-" ] ; then
|
||||
${VENDOR_PATH}/etc/vrx220_multi_bridge_config MOD "$lan"
|
||||
fi
|
||||
fi
|
||||
3
fapi_system/files/etc/disable_bridge_acceleration.sh
Executable file
3
fapi_system/files/etc/disable_bridge_acceleration.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo disable > /proc/ppa/api/bridged_flow_learning
|
||||
32
fapi_system/files/etc/enable_lan_port_sep
Executable file
32
fapi_system/files/etc/enable_lan_port_sep
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! "$CONFIGLOADED" ]; then
|
||||
if [ -r /etc/rc.d/config.sh ]; then
|
||||
. /etc/rc.d/config.sh 2>/dev/null
|
||||
CONFIGLOADED="1"
|
||||
fi
|
||||
fi
|
||||
. ${VENDOR_PATH}/etc/switchports.conf 2> /dev/null
|
||||
|
||||
echo "===Enable lan port seperation for $switch_lan_ports==="
|
||||
if [ -n "$switch_lan_ports" ]; then
|
||||
lan_port=$switch_lan_ports
|
||||
else
|
||||
lan_port="4 5"
|
||||
fi
|
||||
|
||||
brctl delif br-lan eth0
|
||||
|
||||
i=1
|
||||
for port in $lan_port; do
|
||||
echo "adding interface eth0_${i}"
|
||||
eval interface_name=eth0_${i}
|
||||
ip link add dev $interface_name link eth0 type ethsw ports $port
|
||||
# interfaces are brought up later on by SLs, not required here
|
||||
#ifconfig $interface_name 0.0.0.0 up
|
||||
#brctl addif br-lan $interface_name
|
||||
i=`expr $i \+ 1`
|
||||
done
|
||||
|
||||
|
||||
|
||||
661
fapi_system/files/etc/switch_functions
Executable file
661
fapi_system/files/etc/switch_functions
Executable file
@@ -0,0 +1,661 @@
|
||||
#!/bin/sh
|
||||
if [ ! "$CONFIGLOADED" ]; then
|
||||
if [ -r /etc/config.sh ]; then
|
||||
. /etc/config.sh 2>/dev/null
|
||||
CONFIGLOADED="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
. ${VENDOR_PATH}/etc/switchports.conf 2> /dev/null
|
||||
|
||||
CONFIG_FEATURE_BR_ACCEL_SUPPORT=1
|
||||
|
||||
cpu_port="6"
|
||||
#wan_port="5 10 11"
|
||||
if [ "$1" = "eth" ]; then
|
||||
if [ -n "$switch_lan_ports" ]; then
|
||||
wan_port_mii1=$switch_mii1_port
|
||||
else
|
||||
wan_port_mii1="5"
|
||||
fi
|
||||
elif [ "$1" = "dsl" ]; then
|
||||
wan_port_xdsl="10 11"
|
||||
fi
|
||||
if [ "A$CONFIG_FEATURE_WWAN_LTE_SUPPORT" = "Ay" ]; then
|
||||
wan_port_lte="7"
|
||||
fi
|
||||
wan_port="$wan_port_mii1 $wan_port_xdsl $wan_port_lte"
|
||||
if [ -n "$switch_lan_ports" ]; then
|
||||
lan_port=$switch_lan_ports
|
||||
else
|
||||
lan_port="4 2 3"
|
||||
fi
|
||||
wlan_port_ext="10 11"
|
||||
if [ "A$CONFIG_FEATURE_WWAN_LTE_SUPPORT" = "Ay" ]; then
|
||||
wlan_port="8 9"
|
||||
else
|
||||
wlan_port="7 8 9"
|
||||
fi
|
||||
if [ "$1" = "eth" ]; then
|
||||
# ETH-WAN mode : Port <10,11> unused, assign it as wlan port
|
||||
wlan_port="$wlan_port $wlan_port_ext"
|
||||
fi
|
||||
#wlan_port_all="7 8 9"
|
||||
#wlan_port_lte="8 9"
|
||||
#wlan_port_ext="10 11"
|
||||
pce_rule_start="50"
|
||||
bridge_accel_Order="20"
|
||||
lan_port_all="$lan_port $wlan_port"
|
||||
lan_port_1=$(echo ${lan_port} | awk '{ print $1 }')
|
||||
|
||||
###############################################################################################################
|
||||
# *VLAN IDs used for LAN / WAN separation inside switch.
|
||||
# *501 = LAN side VLAN.
|
||||
# -> All LAN ports (1,2,3,4), WLAN ports (7,8,9) will have this as PVID
|
||||
# -> LAN ports (1,2,3,4), WLAN ports (7,8,9) & CPU port (6) will be members of this VLAN
|
||||
# -> This ensures that # Enables isolation of a specified port from the rest of the switch
|
||||
# Any packets from packets from LAN side is not flooded to wan side
|
||||
# *500 = CPU port VLAN.
|
||||
# -> CPU port will have this as PVID
|
||||
# -> LAN ports(1,2,3,4), WLAN ports (7,8,9), WAN ports (5,10,11) will be members of this VLAN
|
||||
# -> This ensures that packets from CPU reach LAN side as well as WAN side
|
||||
# *502 = WAN side VLAN
|
||||
# -> All WAN ports (5,10,11) will have this PVID
|
||||
# -> WAN ports (5,10,11) and CPU port (6) will be members of this VLAN
|
||||
# -> This ensures that packets from WAN side is not flooded to LAN side
|
||||
###############################################################################################################
|
||||
lan_vid_all=501
|
||||
cpu_vid=500
|
||||
wan_vid=502
|
||||
|
||||
###############################################################################################################
|
||||
# *WAN and LAN VLAN needs to have different fids so that the swithc maintains two different set of
|
||||
# switch tables which helps in maintaining the LAN / WAN isolation.
|
||||
###############################################################################################################
|
||||
lan_fid=0
|
||||
cpu_fid=0
|
||||
wan_fid=1
|
||||
|
||||
|
||||
###############################################################################################################
|
||||
# *VLAN ids 2050-2053 will be used internally for LAN port separation
|
||||
###############################################################################################################
|
||||
lan_vid_port_start=2050
|
||||
|
||||
###############################################################################################################
|
||||
# *VLAN ids 2-5 will be used for creating virtual interfaces eth0.2-etho.5
|
||||
###############################################################################################################
|
||||
software_vid_port_start=`expr $lan_vid_port_start \- 2048`
|
||||
|
||||
###############################################################################################################
|
||||
# Function to create a VLAN id by calling IFX_ETHSW_VLAN_ID_CREATE
|
||||
# Arguements:
|
||||
# $1 VLANid to be created <1-4096>
|
||||
# $2 Fid to be sepcified. <1-256>
|
||||
###############################################################################################################
|
||||
create_vlanid() {
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_VLAN_ID_CREATE nVId=$1 nFId=$2 2> /dev/null
|
||||
}
|
||||
|
||||
###############################################################################################################
|
||||
# Function to delete a specified VLAN id by using IFX_ETHSW_VLAN_ID_DELETE
|
||||
# Arguements:
|
||||
# $1 vlan id to be deleted <1-4096>
|
||||
###############################################################################################################
|
||||
delete_vlanid() {
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_VLAN_ID_DELETE nVId=$1
|
||||
}
|
||||
|
||||
###############################################################################################################
|
||||
# Function to set pvid of a specified port
|
||||
# Arguements:
|
||||
# $1 Portid <0-11>
|
||||
# $2 VLANid <1-4096>
|
||||
# $3 TVM (Transparent VLAN Mode) <0/1>
|
||||
###############################################################################################################
|
||||
config_port_pvid() {
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_VLAN_PORT_CFG_SET nPortId=$1 nPortVId=$2 bVLAN_UnknownDrop=0 bVLAN_ReAssign=0 eVLAN_MemberViolation=$4 eAdmitMode=0 bTVM=$3
|
||||
}
|
||||
|
||||
###############################################################################################################
|
||||
# Function to set add a port as member to a specified VLAN
|
||||
# Arguements:
|
||||
# $1 VLANid <1-4096>
|
||||
# $2 Portid <0-11>
|
||||
# $3 Egress tagging <0/1>
|
||||
###############################################################################################################
|
||||
config_port_member() {
|
||||
local vid=$1
|
||||
local port=$2
|
||||
local egress_tag=$3
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_VLAN_PORT_MEMBER_ADD nVId=$vid nPortId=$port bVLAN_TagEgress=$egress_tag
|
||||
}
|
||||
|
||||
###############################################################################################################
|
||||
# Function to set remove a port from a vlan membership
|
||||
# Arguements:
|
||||
# $1 VLANid <1-4096>
|
||||
# $2 Portid <0-11>
|
||||
###############################################################################################################
|
||||
reset_port_member() {
|
||||
|
||||
local vid=$1
|
||||
local port=$2
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_VLAN_PORT_MEMBER_REMOVE nVId=$vid nPortId=$port
|
||||
}
|
||||
|
||||
##############################################################################################################
|
||||
# Function to separate LAN and WAN interrupts (DMA channels) i.e LAN : 129 and WAN : 64
|
||||
# Applicable to SMP models ONLY
|
||||
# By default all the ports are served by DMA 129. Here we set the traffic class of WAN and WLAN ports to 3,
|
||||
# this enabled the traffic to be served using DMA 64
|
||||
##############################################################################################################
|
||||
#split_lan_wan_dma_channel() {
|
||||
#if [ -n $1 -a $1 -eq 1 ]; then
|
||||
# port_idx=58
|
||||
# for i in $wlan_port; do
|
||||
# switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=$port_idx pattern.bEnable=1 pattern.bPortIdEnable=1 pattern.nPortId=$i action.eTrafficClassAction=2 action.nTrafficClassAlternate=3
|
||||
# port_idx=`expr $port_idx + 1`
|
||||
# done
|
||||
#
|
||||
# port_idx=61
|
||||
# for i in $wan_port; do
|
||||
# switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=$port_idx pattern.bEnable=1 pattern.bPortIdEnable=1 pattern.nPortId=$i action.eTrafficClassAction=2 action.nTrafficClassAlternate=3
|
||||
# port_idx=`expr $port_idx + 1`
|
||||
# done
|
||||
#else
|
||||
# port_idx=58
|
||||
# for i in $wlan_port; do
|
||||
# switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=$port_idx
|
||||
# port_idx=`expr $port_idx + 1`
|
||||
# done
|
||||
#
|
||||
# port_idx=61
|
||||
# for i in $wan_port; do
|
||||
# switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=$port_idx
|
||||
# port_idx=`expr $port_idx + 1`
|
||||
# done
|
||||
#fi
|
||||
#}
|
||||
|
||||
###############################################################################################################
|
||||
# Function to reset the switch configurations done using switch_init
|
||||
###############################################################################################################
|
||||
switch_uninit() {
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_DISABLE
|
||||
|
||||
#reset the switch to re-configure
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_HW_INIT
|
||||
delete_vlanid $lan_vid_all
|
||||
delete_vlanid $cpu_vid
|
||||
delete_vlanid $wan_vid
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_ENABLE
|
||||
}
|
||||
|
||||
###############################################################################################################
|
||||
# Function to return a switch portmap corresponding to a portlist
|
||||
# Combines each port bitmap from portlist together into a hex portmap
|
||||
# Arguments:
|
||||
# $@ = Portlist <0-11>
|
||||
###############################################################################################################
|
||||
switch_port_map() {
|
||||
for port in "$@"
|
||||
do
|
||||
let "portmap |= $((1 << $port))"
|
||||
done
|
||||
printf '0x%x' $portmap
|
||||
}
|
||||
|
||||
###############################################################################################################
|
||||
# Enables Bridging acceleration between LAN & WAN
|
||||
# The user needs to specify a LAN interface & bridged WAN interface name to enable the bridging of packets
|
||||
# between specified LAN port and WAN port
|
||||
# IMPORTANT NOTE: ATM WAN can be plain nasX
|
||||
# input arguements
|
||||
# $1 = wan interface name (eg: ptm0.800 or eth1.100 or nas2 )
|
||||
# $2 = lan interface names (eg: eth0.2,eth0.3)
|
||||
# $3 = bridge name (eg: br0 or br1)
|
||||
###############################################################################################################
|
||||
enable_bridge_accel() {
|
||||
local waniface
|
||||
local wanvlan
|
||||
|
||||
waniface=$(echo $1 | cut -d "_" -f1)
|
||||
if [ "${waniface::3}" = "nas" ]; then
|
||||
local vpivci=$(sed -n '/'$waniface'/,/vcc/p' /proc/net/atm/br2684|grep vcc|sed -e 's/.*vcc 0./\1/' -e 's/:.*/\1/')
|
||||
if [ "A${vpivci}A" != "AA" ]; then
|
||||
waniface=$1
|
||||
if [ "$CONFIG_TARGET_LANTIQ_XRX300" = "1" -o "$CONFIG_TARGET_LANTIQ_XRX330" = "1" ]; then
|
||||
wanvlan=$(grep $vpivci /proc/eth/vrx318/dsl_vlan | awk '{print $5}')
|
||||
elif [ "$CONFIG_TARGET_LANTIQ_XRX200" = "1" ]; then
|
||||
wanvlan=$(grep $vpivci /proc/eth/dsl_vlan | awk '{print $5}')
|
||||
fi
|
||||
fi
|
||||
else
|
||||
wanvlan=$(echo $1 | cut -d "_" -f2)
|
||||
fi
|
||||
|
||||
local bridgemac=$(/sbin/ifconfig $3 | sed -e's/^.*HWaddr \([^ ]*\) .*$/\1/;t;d')
|
||||
#for handling non vlan wan interface ptm0 & eth1
|
||||
if [ "${wanvlan::3}" = "wan" ] ; then
|
||||
if [ "${waniface}" = "ptm0" -o "${waniface}" = "eth1" ]; then
|
||||
wanvlan=$wan_vid
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "A${waniface}A" = "AA" -o "A${wanvlan}A" = "AA" ]; then
|
||||
echo "WAN interface is not valid!!!"
|
||||
elif [ "A${bridgemac}A" = "AA" ]; then
|
||||
echo "Invalid bridge name!!!"
|
||||
else
|
||||
if [ "${waniface::3}" = "ptm" ]; then
|
||||
# once the below statement is called all the routed wan connections on ptmX.* will stop working
|
||||
# please ensure that all the routed wans calls add_wan_vlanif() while wan creation
|
||||
# disable tvm on wan if
|
||||
if [ "$wanvlan" -ne "$wan_vid" ]; then
|
||||
create_vlanid $wanvlan $wan_fid
|
||||
fi
|
||||
for i in $wan_port_xdsl; do
|
||||
config_port_pvid $i $wan_vid 0 3
|
||||
if [ "$wanvlan" -ne "$wan_vid" ]; then
|
||||
config_port_member $wanvlan $i 1
|
||||
else
|
||||
config_port_member $wanvlan $i 0
|
||||
fi
|
||||
done
|
||||
elif [ "${waniface::3}" = "nas" ]; then
|
||||
# for nas if vlan, fid should be 0
|
||||
create_vlanid $wanvlan 0
|
||||
# disable tvm, set memberviolation=2 on wan if
|
||||
# disable learning on wan if
|
||||
for i in $wan_port_xdsl; do
|
||||
config_port_pvid $i $wan_vid 0 2
|
||||
switch_cli PORT_CFG_SET nPortId=$i bLearning=1
|
||||
done
|
||||
|
||||
elif [ "${waniface::3}" = "eth" ]; then
|
||||
# once the below statement is called all the routed wan connections on ethX.* will stop working
|
||||
# please ensure that all the routed wans calls add_wan_vlanif() while wan creation
|
||||
# disable tvm on wan if
|
||||
if [ "$wanvlan" -ne "$wan_vid" ]; then
|
||||
create_vlanid $wanvlan $wan_fid
|
||||
fi
|
||||
for i in $wan_port_mii1; do
|
||||
config_port_pvid $i $wan_vid 0 3
|
||||
if [ "$wanvlan" -ne "$wan_vid" ]; then
|
||||
config_port_member $wanvlan $i 1
|
||||
else
|
||||
config_port_member $wanvlan $i 0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
k=0
|
||||
m=0
|
||||
for lan_if in $( echo $2 | sed -n 1'p' | tr ',' '\n'); do
|
||||
# lan port
|
||||
if [ "${lan_if::4}" = "eth0" ]; then
|
||||
output=`switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_VLAN_PORT_CFG_GET nPortId=$lan_port_1| grep -w nPortVId | awk '{ print $2 }'`
|
||||
if [ "${lan_if:4:1}" = "." ]; then
|
||||
#vlan based port separation
|
||||
if [ "1$CONFIG_FEATURE_BR_ACCEL_SUPPORT" = "11" ]; then
|
||||
local lanvlan=$(echo $lan_if | cut -d "." -f2)
|
||||
j=0
|
||||
|
||||
for i in $lan_port; do
|
||||
tvlan=`expr $software_vid_port_start \+ $j`
|
||||
if [ $tvlan = $lanvlan ]; then
|
||||
nvlan_id=`expr $lan_vid_port_start \- $software_vid_port_start \+ $lanvlan`
|
||||
nport_id=$i
|
||||
break
|
||||
fi
|
||||
j=`expr $j \+ 1`
|
||||
k=`expr $k \+ 3`
|
||||
done
|
||||
else
|
||||
if [ "$output" != "$lan_vid_port_start" ]; then
|
||||
echo "Ports not separated, can't proceed"
|
||||
break
|
||||
else
|
||||
local lanvlan=$(echo $lan_if | cut -d "." -f2)
|
||||
j=0
|
||||
|
||||
for i in $lan_port; do
|
||||
tvlan=`expr $software_vid_port_start \+ $j`
|
||||
if [ $tvlan = $lanvlan ]; then
|
||||
nvlan_id=`expr $lan_vid_port_start \- $software_vid_port_start \+ $lanvlan`
|
||||
nport_id=$i
|
||||
break
|
||||
fi
|
||||
j=`expr $j \+ 1`
|
||||
k=`expr $k \+ 3`
|
||||
done
|
||||
fi
|
||||
fi
|
||||
elif [ "${lan_if:4:1}" = "_" ]; then
|
||||
#driver based lan port separation
|
||||
if [ "1$CONFIG_FEATURE_BR_ACCEL_SUPPORT" = "11" ]; then
|
||||
local lanvlan=$(echo $lan_if | cut -d "_" -f2)
|
||||
j=1
|
||||
|
||||
for i in $lan_port; do
|
||||
if [ $j = $lanvlan ]; then
|
||||
nvlan_id=$lan_vid_all
|
||||
nport_id=$i
|
||||
break
|
||||
fi
|
||||
j=`expr $j \+ 1`
|
||||
k=`expr $k \+ 3`
|
||||
done
|
||||
else
|
||||
if [ "$output" = "$lan_vid_all" ]; then
|
||||
local lanvlan=$(echo $lan_if | cut -d "_" -f2)
|
||||
j=1
|
||||
|
||||
for i in $lan_port; do
|
||||
if [ $j = $lanvlan ]; then
|
||||
nvlan_id=$lan_vid_all
|
||||
nport_id=$i
|
||||
#<--break not required-->break
|
||||
fi
|
||||
j=`expr $j \+ 1`
|
||||
k=`expr $k \+ 3`
|
||||
done
|
||||
else
|
||||
echo "Ports are separated, cannot proceed"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
else
|
||||
#no lan port separation
|
||||
if [ "$output" = "$lan_vid_all" ]; then
|
||||
nvlan_id=$lan_vid_all
|
||||
nport_id=$lan_port
|
||||
else
|
||||
echo "Ports are separated, cannot proceed"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
echo "lan ports = $lan_port"
|
||||
# wireless port
|
||||
elif [ "${lan_if::4}" = "wlan" -o "${lan_if::3}" = "ath" -o "${lan_if::3}" = "ra" ]; then
|
||||
#wireless ports needs to be read from ppa/api/directpath
|
||||
#ifid + 4 = portid
|
||||
nvlan_id=$lan_vid_all
|
||||
nport_id=$(echo `sed -n '/'"$lan_if "'/,/rx_fn_rxif_pkt/p' /proc/ppa/api/directpath` | awk '{print $7}')
|
||||
echo "wlan port id = $nport_id"
|
||||
if [ $nport_id -gt 0 ]; then
|
||||
nport_id=`expr $nport_id \+ 4`
|
||||
else
|
||||
echo "Invalid wireless interface!!!"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "A${nvlan_id}A" = "AA" -o "A${nport_id}A" = "AA" ]; then
|
||||
echo "Invalid lan port!!!" $lan_if
|
||||
break
|
||||
else
|
||||
if [ "${waniface::3}" = "nas" ]; then
|
||||
#for ATM WAN upstream traffic still goes through CPU path.
|
||||
for i in $nport_id; do
|
||||
config_port_member $wanvlan $i 0
|
||||
done
|
||||
else
|
||||
reset_port_member $wanvlan $cpu_port
|
||||
|
||||
for i in $nport_id; do
|
||||
config_port_pvid $i $wanvlan 0 3
|
||||
config_port_member $wanvlan $i 0
|
||||
if [ "1$CONFIG_FEATURE_BR_ACCEL_SUPPORT" != "11" ]; then
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ $k` pattern.bEnable=1 pattern.bPortIdEnable=1 pattern.nPortId=$i pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=FF:FF:FF:FF:FF:FF action.eVLAN_Action=2 action.nVLAN_Id=$nvlan_id
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ $k \+ 1` pattern.bEnable=1 pattern.bPortIdEnable=1 pattern.nPortId=$i pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=$bridgemac action.eVLAN_Action=2 action.nVLAN_Id=$nvlan_id
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ $k \+ 2` pattern.bEnable=1 pattern.bPortIdEnable=1 pattern.nPortId=$i pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=01:00:5E:00:00:00 pattern.nMAC_DstMask=0x03F action.eVLAN_Action=2 action.nVLAN_Id=$nvlan_id
|
||||
k=`expr $k + 3`
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ "1$CONFIG_FEATURE_BR_ACCEL_SUPPORT" = "11" ]; then
|
||||
eval pce_rule_start=$bridge_accel_Order
|
||||
config_port_member $wanvlan $cpu_port 1
|
||||
#packets coming from WAN with VLAN $wan_vlan shall be forwarded only to the LAN ports
|
||||
#multicast packets from WAN needs to be forwarded to CPU for Learning
|
||||
if [ "${waniface::3}" = "ptm" ]; then
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start` pattern.bEnable=1 pattern.bVid=1 pattern.nVid=$wanvlan pattern.bPortIdEnable=1 pattern.nPortId=11 pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=01:00:5E:00:00:00 pattern.nMAC_DstMask=0x03F action.ePortMapAction=4 action.nForwardPortMap=0x40
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ 1` pattern.bEnable=1 pattern.bPortIdEnable=1 pattern.nPortId=11 pattern.bVid=1 pattern.nVid=$wanvlan action.eVLAN_CrossAction=1 action.eVLAN_Action=2 action.nVLAN_Id=$wanvlan
|
||||
elif [ "${waniface::3}" = "nas" ]; then
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start` pattern.bEnable=1 pattern.bVid=1 pattern.nVid=$wanvlan pattern.bPortIdEnable=1 pattern.nPortId=11 pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=01:00:5E:00:00:00 pattern.nMAC_DstMask=0x03F action.ePortMapAction=4 action.nForwardPortMap=0x40
|
||||
elif [ "${waniface::3}" = "eth" ]; then
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start` pattern.bEnable=1 pattern.bVid=1 pattern.nVid=$wanvlan pattern.bPortIdEnable=1 pattern.nPortId=$wan_port_mii1 pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=01:00:5E:00:00:00 pattern.nMAC_DstMask=0x03F action.ePortMapAction=4 action.nForwardPortMap=0x40
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ 1` pattern.bEnable=1 pattern.bPortIdEnable=1 pattern.nPortId=$wan_port_mii1 pattern.bVid=1 pattern.nVid=$wanvlan action.eVLAN_CrossAction=1 action.eVLAN_Action=2 action.nVLAN_Id=$wanvlan
|
||||
fi
|
||||
|
||||
# packets from CPU with VLAN = $wan_vlan shall be forwarded only to the WAN ports.
|
||||
if [ "${waniface::3}" = "ptm" -o "${waniface::3}" = "eth" ]; then
|
||||
# get portmap for $wan_port list of existing platform
|
||||
forward_portmap=$(switch_port_map $wan_port)
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ 2` pattern.bEnable=1 pattern.bPortIdEnable=1 pattern.nPortId=$cpu_port pattern.bVid=1 pattern.nVid=$wanvlan action.ePortMapAction=4 action.nForwardPortMap=$forward_portmap action.eVLAN_Action=2 action.nVLAN_Id=$wanvlan
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ 3` pattern.bEnable=1 pattern.bVid=0 pattern.nVid=$wanvlan pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=FF:FF:FF:FF:FF:FF action.eVLAN_Action=2 action.nVLAN_Id=$nvlan_id
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ 4` pattern.bEnable=1 pattern.bVid=0 pattern.nVid=$wanvlan pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=$bridgemac action.eVLAN_Action=2 action.nVLAN_Id=$nvlan_id
|
||||
switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ 5` pattern.bEnable=1 pattern.bVid=0 pattern.nVid=$wanvlan pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=01:00:5E:00:00:00 pattern.nMAC_DstMask=0x03F action.eVLAN_Action=2 action.nVLAN_Id=$nvlan_id
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
switch_cli IFX_ETHSW_MAC_TABLE_CLEAR
|
||||
# tbd: if we need to access the dut from bridged wan we have to add the below rule on the wan port
|
||||
# switch_cli IFX_FLOW_PCE_RULE_WRITE pattern.nIndex=`expr $pce_rule_start \+ $k` pattern.bEnable=1 pattern.bPortIdEnable=1 pattern.nPortId=$wan_port pattern.bMAC_DstEnable=1 pattern.nMAC_Dst=$bridgemac action.eVLAN_Action=2 action.nVLAN_Id=$wanvlan
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################################################
|
||||
# Disables Bridging acceleration between LAN & WAN
|
||||
# The user needs to specify a LAN port & bridged WAN interface name disable bridging acceleration between
|
||||
# specified LAN port and WAN port
|
||||
# input arguements
|
||||
# $1 = wan interface name (eg: ptm0.800 or eth1.100 or nas2 )
|
||||
# $2 = lan interface names (eg: eth0.2,eth0.3)
|
||||
###############################################################################################################
|
||||
disable_bridge_accel() {
|
||||
local waniface
|
||||
local wanvlan
|
||||
|
||||
waniface=$(echo $1 | cut -d "_" -f1)
|
||||
if [ "${waniface::3}" = "nas" ]; then
|
||||
local vpivci=$(sed -n '/'$waniface'/,/vcc/p' /proc/net/atm/br2684|grep vcc|sed -e 's/.*vcc 0./\1/' -e 's/:.*/\1/')
|
||||
if [ "A${vpivci}A" != "AA" ]; then
|
||||
waniface=$1
|
||||
if [ "$CONFIG_TARGET_LANTIQ_XRX300" = "1" -o "$CONFIG_TARGET_LANTIQ_XRX330" = "1" ]; then
|
||||
wanvlan=$(grep $vpivci /proc/eth/vrx318/dsl_vlan | awk '{print $5}')
|
||||
elif [ "$CONFIG_TARGET_LANTIQ_XRX200" = "1" ]; then
|
||||
wanvlan=$(grep $vpivci /proc/eth/dsl_vlan | awk '{print $5}')
|
||||
fi
|
||||
fi
|
||||
else
|
||||
wanvlan=$(echo $1 | cut -d "_" -f2)
|
||||
fi
|
||||
|
||||
#for handling non vlan wan interface ptm0 & eth1
|
||||
if [ "${wanvlan::3}" = "wan" ] ; then
|
||||
if [ "${waniface}" = "ptm0" -o "${waniface}" = "eth1" ]; then
|
||||
wanvlan=$wan_vid
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "A${waniface}A" = "AA" -o "A${wanvlan}A" = "AA" ]; then
|
||||
echo "WAN interface is not valid!!!"
|
||||
else
|
||||
j=0
|
||||
if [ "${waniface::3}" = "ptm" ]; then
|
||||
for i in $wan_port_xdsl; do
|
||||
config_port_pvid $i $wan_vid 1 3
|
||||
done
|
||||
if [ "$wanvlan" -ne "$wan_vid" ]; then
|
||||
delete_vlanid $wanvlan
|
||||
fi
|
||||
fi
|
||||
|
||||
k=0
|
||||
m=0
|
||||
for lan_if in $( echo $2 | sed -n 1'p' | tr ',' '\n'); do
|
||||
# lan port
|
||||
if [ "${lan_if::4}" = "eth0" ]; then
|
||||
if [ "${lan_if:4:1}" = "." ]; then
|
||||
#vlan based port separation
|
||||
local lanvlan=$(echo $lan_if | cut -d "." -f2)
|
||||
j=0
|
||||
|
||||
for i in $lan_port; do
|
||||
tvlan=`expr $software_vid_port_start \+ $j`
|
||||
if [ $tvlan = $lanvlan ]; then
|
||||
nvlan_id=`expr $lan_vid_port_start \- $software_vid_port_start \+ $lanvlan`
|
||||
nport_id=$i
|
||||
break
|
||||
fi
|
||||
j=`expr $j \+ 1`
|
||||
k=`expr $k \+ 3`
|
||||
done
|
||||
elif [ "${lan_if:4:1}" = "_" ]; then
|
||||
#driver based lan port separation
|
||||
local lanvlan=$(echo $lan_if | cut -d "_" -f2)
|
||||
j=1
|
||||
|
||||
for i in $lan_port; do
|
||||
if [ $j = $lanvlan ]; then
|
||||
nvlan_id=$lan_vid_all
|
||||
nport_id=$i
|
||||
break
|
||||
fi
|
||||
j=`expr $j \+ 1`
|
||||
k=`expr $k \+ 3`
|
||||
done
|
||||
else
|
||||
#no lan port separation
|
||||
nvlan_id=$lan_vid_all
|
||||
nport_id=$lan_port
|
||||
fi
|
||||
# wireless port
|
||||
elif [ "${lan_if::4}" = "wlan" -o "${lan_if::3}" = "ath" -o "${lan_if::3}" = "ra" ]; then
|
||||
#wireless ports needs to be read from ppa/api/directpath
|
||||
#ifid + 4 = portid
|
||||
nvlan_id=$lan_vid_all
|
||||
nport_id=$(echo `sed -n '/'"$lan_if "'/,/rx_fn_rxif_pkt/p' /proc/ppa/api/directpath` | awk '{print $7}')
|
||||
if [ $nport_id -gt 0 ]; then
|
||||
nport_id=`expr $nport_id \+ 4`
|
||||
else
|
||||
echo "Invalid wireless interface!!!"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "A${nvlan_id}A" = "AA" -o "A${nport_id}A" = "AA" ]; then
|
||||
echo "Invalid lan port!!!" $lan_if
|
||||
break
|
||||
else
|
||||
if [ "$wanvlan" -ne "$wan_vid" ]; then
|
||||
config_port_member $wanvlan $cpu_port 1
|
||||
else
|
||||
config_port_member $wanvlan $cpu_port 0
|
||||
fi
|
||||
|
||||
for i in $nport_id; do
|
||||
reset_port_member $wanvlan $i
|
||||
config_port_pvid $i $nvlan_id 1 3
|
||||
if [ "1$CONFIG_FEATURE_BR_ACCEL_SUPPORT" != "11" ]; then
|
||||
switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=`expr $pce_rule_start \+ $k`
|
||||
switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=`expr $pce_rule_start \+ $k \+ 1`
|
||||
switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=`expr $pce_rule_start \+ $k \+ 2`
|
||||
k=`expr $k + 3`
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "1$CONFIG_FEATURE_BR_ACCEL_SUPPORT" = "11" ]; then
|
||||
eval pce_rule_start=$bridge_accel_Order
|
||||
|
||||
switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=`expr $pce_rule_start`
|
||||
if [ "${waniface::3}" = "ptm" -o "${waniface::3}" = "eth" ]; then
|
||||
switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=`expr $pce_rule_start \+ 1`
|
||||
switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=`expr $pce_rule_start \+ 2`
|
||||
switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=`expr $pce_rule_start \+ 3`
|
||||
switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=`expr $pce_rule_start \+ 4`
|
||||
switch_cli IFX_FLOW_PCE_RULE_DELETE nIndex=`expr $pce_rule_start \+ 5`
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
# nas wan if vlan was used by flow table, ok to delete now
|
||||
if [ "${waniface::3}" = "nas" ]; then
|
||||
# reset tvm, memberviolation=3 back on wan if
|
||||
# enable learning back on wan if
|
||||
for i in $wan_port_xdsl; do
|
||||
config_port_pvid $i $wan_vid 1 3
|
||||
switch_cli PORT_CFG_SET nPortId=$i bLearning=0
|
||||
done
|
||||
delete_vlanid $wanvlan
|
||||
fi
|
||||
|
||||
switch_cli IFX_ETHSW_MAC_TABLE_CLEAR
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################################################
|
||||
# Function to config GPHY LED
|
||||
###############################################################################################################
|
||||
config_led()
|
||||
{
|
||||
|
||||
[ "$CONFIG_TARGET_LANTIQ_XRX300" = "1" -o "$CONFIG_TARGET_LANTIQ_XRX330" = "1" ] && {
|
||||
# AR10 and EASY330 platfrom
|
||||
for port in $lan_port; do
|
||||
switch_cli IFX_ETHSW_MMD_DATA_WRITE nAddressDev=$port nAddressReg=0x1F01e2 nData=0x42
|
||||
switch_cli IFX_ETHSW_MMD_DATA_WRITE nAddressDev=$port nAddressReg=0x1F01e3 nData=0x10
|
||||
switch_cli IFX_ETHSW_MMD_DATA_WRITE nAddressDev=$port nAddressReg=0x1F01e4 nData=0x70
|
||||
switch_cli IFX_ETHSW_MMD_DATA_WRITE nAddressDev=$port nAddressReg=0x1F01e5 nData=0x03
|
||||
done
|
||||
[ "$CONFIG_TARGET_LANTIQ_XRX330" = "1" ] && {
|
||||
# EASY330 platfrom
|
||||
switch_cli IFX_ETHSW_MMD_DATA_WRITE nAddressDev=0x2 nAddressReg=0x1F01e2 nData=0x70
|
||||
switch_cli IFX_ETHSW_MMD_DATA_WRITE nAddressDev=0x2 nAddressReg=0x1F01e3 nData=0x03
|
||||
switch_cli IFX_ETHSW_MMD_DATA_WRITE nAddressDev=0x2 nAddressReg=0x1F01e4 nData=0x42
|
||||
switch_cli IFX_ETHSW_MMD_DATA_WRITE nAddressDev=0x2 nAddressReg=0x1F01e5 nData=0x10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
####################################################################################################################
|
||||
# This function initializes switch buffers for GRX300 platform.
|
||||
# Default configuration on this platform is different from other platforms where in,
|
||||
# 512 switch buffers are available on GRX300 (GSWIP 2.2 and above) compared to 256 on the rest (GSWIP-2.1 and below)
|
||||
# This configuration is required to address congestion problems due to bursty traffic.
|
||||
# Buffers reserved for each queue can be tuned for different scenarios.
|
||||
# Given configuration is based on test cases and scenarios executed by switch team.
|
||||
####################################################################################################################
|
||||
init_sw_cfg_for_grx330_plat() {
|
||||
if [ "A$CONFIG_TARGET_LANTIQ_XRX330" = "A1" ]; then # [ GRX330 config starts
|
||||
# Enable Flow Control eFlowCtrl=3
|
||||
i=0
|
||||
while [ $i -le 5 ]
|
||||
do
|
||||
switch_cli IFX_ETHSW_PORT_CFG_SET nPortId=$i eEnable=1 eFlowCtrl=3
|
||||
switch_cli IFX_ETHSW_QOS_FLOWCTRL_PORT_CFG_SET nPortId=$i nFlowCtrl_Min=18 nFlowCtrl_Max=30
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
|
||||
# Configure Buffer reservation of each queue to 24 for i 0 31
|
||||
i=0
|
||||
while [ $i -le 31 ]
|
||||
do
|
||||
switch_cli IFX_ETHSW_QOS_QUEUE_BUFFER_RESERVE_CFG_SET nQueueId=$i nBufferReserved=24
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
# Configure Global buffer threshold
|
||||
switch_cli IFX_ETHSW_QOS_WRED_CFG_SET eProfile=0 nRed_Min=0x3ff nRed_Max=0x3ff nYellow_Min=0x3ff nYellow_Max=0x3ff nGreen_Min=0x180 nGreen_Max=0x180
|
||||
|
||||
# Configure Global flowcontrol threshold buffer
|
||||
switch_cli IFX_ETHSW_QOS_FLOWCTRL_CFG_SET nFlowCtrlNonConform_Min=0x3ff nFlowCtrlNonConform_Max=0x3ff nFlowCtrlConform_Min=0x3ff nFlowCtrlConform_Max=0x3ff
|
||||
fi # GRX330 config ends ]
|
||||
}
|
||||
|
||||
|
||||
111
fapi_system/files/etc/switch_init
Executable file
111
fapi_system/files/etc/switch_init
Executable file
@@ -0,0 +1,111 @@
|
||||
#!/bin/sh
|
||||
if [ ! "$CONFIGLOADED" ]; then
|
||||
if [ -r /etc/config.sh ]; then
|
||||
. /etc/config.sh 2>/dev/null
|
||||
CONFIGLOADED="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
. ${VENDOR_PATH}/etc/switchports.conf 2> /dev/null
|
||||
. ${VENDOR_PATH}/etc/switch_functions $1 2 > /dev/null
|
||||
|
||||
###############################################################################################################
|
||||
#Initializes the Switch ports for the selected WAN mode
|
||||
# ALL LAN ports will be set with PVID 501
|
||||
# ALL LAN ports, WLAN ports and CPU port will be member of VLAN 501
|
||||
# ALL WAN ports will be set with PVID 502
|
||||
# ALL WAN ports and CPU port will be member of VLAN 502
|
||||
# CPU Port will be set with PVID 500
|
||||
# ALL LAN ports, WLAN Ports, WAN ports & CPU port will be member of VLAN 500
|
||||
###############################################################################################################
|
||||
echo "======SWITCH INIT ==============="
|
||||
local maxPacketLen=1536
|
||||
output=`switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_VLAN_PORT_CFG_GET nPortId=$lan_port_1| grep -w nPortVId | awk '{ print $2 }'`
|
||||
|
||||
if [ $output = $lan_vid_all -o $output = $lan_vid_port_start ]; then
|
||||
switch_uninit
|
||||
fi
|
||||
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_DISABLE
|
||||
|
||||
if [ "$CONFIG_FEATURE_MINI_JUMBO_FRAMES" == "1" ] ; then
|
||||
#
|
||||
# When mini jumbo frames feature is enabled the larger size packets should
|
||||
# pass through switch. Default packet len configured in switch is 1536. In
|
||||
# case of mini jumbo frames switch shall support packets upto 1600 bytes.
|
||||
#
|
||||
maxPacketLen=1600
|
||||
fi
|
||||
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_CFG_SET eMAC_TableAgeTimer=3 bVLAN_Aware=1 \
|
||||
nMaxPacketLen=$maxPacketLen bPauseMAC_ModeSrc=0 nPauseMAC_Src=00:00:00:00:00:00
|
||||
|
||||
#create the VLAN id
|
||||
create_vlanid $wan_vid $wan_fid
|
||||
create_vlanid $cpu_vid $cpu_fid
|
||||
create_vlanid $lan_vid_all $lan_fid
|
||||
|
||||
# Setting the PVID 502 for WAN ports
|
||||
# TVM is set to 0 in case of ETH WAN port and 1 in case of xDSL WAN port; because ATM and PTM will have some VLANs which is used internally by PPA
|
||||
# That means if a tagged packet comes from wan side we must have corresponding VLAN created in Switch which has both WAN port and CPU port as member and
|
||||
# egress tagging enabled on CPU port for that VLAN.
|
||||
for i in $wan_port; do
|
||||
if [ $i = $wan_port_mii1 ]; then
|
||||
#for ethwan we need to set TVM of wanport to 0
|
||||
#if [ "$CONFIG_FEATURE_EEE" = "1" ]; then
|
||||
# switch_cli IFX_ETHSW_PORT_LINK_CFG_SET nPortId=$i bLPI=1
|
||||
#fi
|
||||
config_port_pvid $i $wan_vid 0 3
|
||||
else
|
||||
config_port_pvid $i $wan_vid 1 3
|
||||
fi
|
||||
done
|
||||
|
||||
# Setting PVID of CPU port as 500
|
||||
config_port_pvid $cpu_port $cpu_vid 0 2
|
||||
|
||||
# Setting PVID of LAN ports as 501
|
||||
for i in $lan_port_all; do
|
||||
config_port_pvid $i $lan_vid_all 1 3
|
||||
done
|
||||
|
||||
# ALL LAN ports, WLAN Ports, WAN ports & CPU port will be member of CPU VLAN 500
|
||||
for i in $lan_port_all $cpu_port $wan_port; do
|
||||
config_port_member $cpu_vid $i 0
|
||||
done
|
||||
|
||||
# ALL LAN ports, WLAN ports and CPU port will be member of VLAN 501
|
||||
for i in $lan_port_all $cpu_port; do
|
||||
config_port_member $lan_vid_all $i 0
|
||||
done
|
||||
|
||||
|
||||
# ALL WAN ports and CPU port will be member of VLAN 502
|
||||
for i in $wan_port $cpu_port; do
|
||||
config_port_member $wan_vid $i 0
|
||||
done
|
||||
switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_ENABLE
|
||||
#if [ "$CONFIG_FEATURE_EEE" = "1" ]; then
|
||||
#for i in $lan_port_all; do
|
||||
# switch_cli IFX_ETHSW_PORT_LINK_CFG_SET nPortId=$i bLPI=1
|
||||
#done
|
||||
#fi
|
||||
# spilt the lan and wan interrupts (DMA channels)
|
||||
# split_lan_wan_dma_channel 1
|
||||
|
||||
mii1_reg="$((1 << wan_port_mii1))"
|
||||
# Disable pause frame for cpu port
|
||||
switch_cli IFX_FLOW_REGISTER_SET nRegAddr=0x94b nData=0x1c0
|
||||
if [ "$1" = "eth" ]; then
|
||||
switch_cli IFX_FLOW_REGISTER_SET nRegAddr=0xccd nData=$mii1_reg
|
||||
echo 0 > /proc/sys/net/bridge/bridge-nf-call-iptables
|
||||
echo 0 > /proc/sys/net/bridge/bridge-nf-call-ip6tables
|
||||
fi
|
||||
# Configure reserved buffers and global WRED configuration for GRX330 platform
|
||||
init_sw_cfg_for_grx330_plat
|
||||
#configure leds for grx330/300
|
||||
config_led
|
||||
echo "Switch Init done "
|
||||
#switch_cli dev=$CONFIG_SWITCH_DEVICE_ID IFX_ETHSW_VLAN_PORT_MEMBER_READ
|
||||
|
||||
|
||||
93
fapi_system/files/etc/vrx220_multi_bridge_config
Executable file
93
fapi_system/files/etc/vrx220_multi_bridge_config
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/sh
|
||||
|
||||
#$1 operation ADD DEL MOD
|
||||
#$2 portid
|
||||
|
||||
if [ ! "$CONFIGLOADED" ]; then
|
||||
if [ -r /etc/config.sh ]; then
|
||||
. /etc/config.sh 2>/dev/null
|
||||
CONFIGLOADED="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
# this script will use only vlan related cofiguration, hence not passing wan mode.
|
||||
. ${VENDOR_PATH}/etc/switch_functions 2> /dev/null
|
||||
|
||||
switch_cli IFX_ETHSW_VLAN_PORT_MEMBER_READ > /tmp/switch.txt
|
||||
|
||||
sed -i -e 's/ VLAN ID | Port | Tag Member//g' /tmp/switch.txt
|
||||
sed -i -e 's/----------------------------//g' /tmp/switch.txt
|
||||
sed -i -e 's/---//g' /tmp/switch.txt
|
||||
sed 's/^[ \t]*//;s/[ \t]*$//' < /tmp/switch.txt > /tmp/switch1.txt
|
||||
|
||||
__preVlanId=0
|
||||
map=
|
||||
NextVlan=500
|
||||
flag="notfound"
|
||||
cpuport=6
|
||||
|
||||
#common in both DEL and ADD case.
|
||||
rmflag=0
|
||||
while read p; do
|
||||
[ -z "$p" ] && continue
|
||||
__vlanId=`echo $p | awk '{print $1;}'`
|
||||
__portId=`echo $p | awk '{print $3;}'`
|
||||
|
||||
if [ $__preVlanId != $__vlanId ] ; then
|
||||
map="$map $__vlanId"
|
||||
else
|
||||
if [ $__portId != $cpuport ] ; then
|
||||
rmflag=1
|
||||
fi
|
||||
fi
|
||||
if [ $__vlanId != "500" ] ; then
|
||||
for i in $2
|
||||
do
|
||||
if [ $__portId == $i ] ; then
|
||||
reset_port_member $__vlanId $__portId
|
||||
if [ $__vlanId != "501" ] && [ $1 != "MOD" ] && [ $rmflag != "1" ] ; then
|
||||
reset_port_member $__vlanId $cpuport #cpu port
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
__preVlanId="$__vlanId"
|
||||
done < /tmp/switch1.txt
|
||||
|
||||
#if [ $1 == "DEL" ] ; then
|
||||
# config_port_member 501 $2 0 # adding backto base bridge
|
||||
# switch_cli IFX_ETHSW_VLAN_PORT_MEMBER_ADD nVId=501 nPortId=$2
|
||||
#fi
|
||||
|
||||
i=0
|
||||
j=0
|
||||
if [ $1 == "ADD" ] ; then
|
||||
while : ; do
|
||||
for i in $map
|
||||
do
|
||||
if [ "$NextVlan" == "$i" ] ; then
|
||||
flag="found"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$flag" == "found" ] ; then
|
||||
flag="notfound"
|
||||
else
|
||||
break
|
||||
fi
|
||||
NextVlan=$((NextVlan+1))
|
||||
done
|
||||
|
||||
nFId=`echo -n $NextVlan | tail -c 1`
|
||||
if ! switch_cli IFX_ETHSW_VLAN_ID_GET nVId=$NextVlan &> /dev/null; then
|
||||
create_vlanid $NextVlan $nFId #lan fid
|
||||
fi
|
||||
for j in $2
|
||||
do
|
||||
config_port_pvid $j $NextVlan 1 3
|
||||
config_port_member $NextVlan $j 0
|
||||
config_port_member $NextVlan $cpuport 0 #cpu port
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf /tmp/switch.txt /tmp/switch1.txt
|
||||
33
fapi_system/files/etc/wan_vlan_config
Executable file
33
fapi_system/files/etc/wan_vlan_config
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
if [ ! "$CONFIGLOADED" ]; then
|
||||
if [ -r /etc/config.sh ]; then
|
||||
. /etc/config.sh 2>/dev/null
|
||||
CONFIGLOADED="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
. ${VENDOR_PATH}/etc/switchports.conf 2> /dev/null
|
||||
. ${VENDOR_PATH}/etc/switch_functions $3 2> /dev/null
|
||||
|
||||
# This script takes wan vlan id as input argument and configures VLANs
|
||||
# in switch. This script calls functions defined in
|
||||
# ${VENDOR_PATH}/etc/switch_functions
|
||||
|
||||
operation=$1
|
||||
wan_vid=$2
|
||||
Egress_tag=1
|
||||
|
||||
echo "wan vlan config $1 called for vlan $2"
|
||||
if [ "$1" = "1" ]; then
|
||||
create_vlanid $wan_vid $wan_fid
|
||||
config_port_member $wan_vid $cpu_port $Egress_tag
|
||||
for i in $wan_port; do
|
||||
config_port_member $wan_vid $i $Egress_tag
|
||||
done
|
||||
elif [ "$1" = "0" ]; then
|
||||
for i in $wan_port; do
|
||||
reset_port_member $wan_vid $wan_port $Egress_tag
|
||||
done
|
||||
reset_port_member $wan_vid $cpu_port $Egress_tag
|
||||
delete_vlanid $wan_vid $wan_fid
|
||||
fi
|
||||
2923
fapi_system/patches/0001-PPA-compilation.patch
Normal file
2923
fapi_system/patches/0001-PPA-compilation.patch
Normal file
File diff suppressed because it is too large
Load Diff
90
libhelper/Makefile
Normal file
90
libhelper/Makefile
Normal file
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# Copyright (C) 2009 OpenWrt.org
|
||||
# Copyright (C) 2017 Intel Corporation
|
||||
#
|
||||
# Openwrt Makefile for libhelper
|
||||
#
|
||||
#
|
||||
|
||||
#### Includes ###################################
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
#### Package Info ###############################
|
||||
PKG_NAME:=libhelper
|
||||
PKG_SOURCE_VERSION:=1.4.0.3
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_NAME:=ugw_sdk
|
||||
PKG_SOURCE_INNERDIR:=helper/libhelper
|
||||
PKG_SOURCE_URL:=ssh://git@gts-chd.intel.com:29418/sw_ugw/$(PKG_SOURCE_NAME).git
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_MAINTAINER:=Intel
|
||||
PKG_LICENSE:=Intel
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
-include $(INCLUDE_DIR)/package-version-override.mk
|
||||
$(call include_mk, ugw-loglevel.mk)
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Intel
|
||||
SUBMENU:=UGW Framework
|
||||
TITLE:=UGW SDK Helper library
|
||||
URL:=http://www.intel.com
|
||||
MAINTAINER:=Intel Corporation
|
||||
DEPENDS:=
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
UGW SDK Helper Library to define function,prototypes,structs,enums which are
|
||||
used for list manipulation and debug purposes.
|
||||
endef
|
||||
|
||||
### Menuconfig ##################################
|
||||
define Package/$(PKG_NAME)/config
|
||||
$(call Package/$(PKG_NAME)/override_version)
|
||||
$(call Package/$(PKG_NAME)/override_source_path)
|
||||
$(call Package/$(PKG_NAME)/config_debug_level)
|
||||
$(call config_add_global_debug_level)
|
||||
config $(PKG_NAME)_MEM_DEBUG
|
||||
depends on PACKAGE_$(PKG_NAME)
|
||||
bool "Memory Debug"
|
||||
help
|
||||
Memory Debug
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += $(if $(CONFIG_libugwhelper_MEM_DEBUG),-DMEM_DEBUG)
|
||||
|
||||
#### Target Rules ###############################
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
|
||||
touch $(STAGING_DIR)/usr/include/vendor.h
|
||||
echo "#define VENDOR_PATH \"$(VENDOR_PATH)\"" > $(STAGING_DIR)/usr/include/vendor.h
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/docs
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/mk/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/include/*.h $(1)/usr/include/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/include/*.h $(1)/usr/docs/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libhelper.so $(1)/usr/lib/
|
||||
$(INSTALL_DATA) ./files/ugw-loglevel.mk $(STAGING_DIR)/mk/
|
||||
$(RM) $(1)/usr/docs/list.h
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/$(VENDOR_PATH)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libhelper.so $(1)/$(VENDOR_PATH)/usr/lib/
|
||||
endef
|
||||
|
||||
define Build/Clean
|
||||
if [ -d $(PKG_BUILD_DIR) ]; then $(MAKE) -C $(PKG_BUILD_DIR) clean; \
|
||||
$(RM) -r $(PKG_BUILD_DIR)/ipkg-$(BOARD); fi
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
48
libhelper/files/ugw-loglevel.mk
Normal file
48
libhelper/files/ugw-loglevel.mk
Normal file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Add menu configurable log level options to a package.
|
||||
# This also converts configured log levels to corresponding compile flags
|
||||
# for the sources.
|
||||
#
|
||||
|
||||
ifeq ($(PKG_IS_KERNEL_MODULE),y)
|
||||
PKG_NAME_PREF:=kmod-
|
||||
endif
|
||||
|
||||
define config_add_global_debug_level
|
||||
config FEATURE_UGW_GLOBAL_DEBUG_LEVEL
|
||||
depends on PACKAGE_$(PKG_NAME_PREF)$(PKG_NAME)
|
||||
int 'Specifiy Debug level from 0 - 7 for UGW Software'
|
||||
range 0 7
|
||||
default '4'
|
||||
help
|
||||
Add global debug level for UGW Software (ranges: 0 - 7)
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME_PREF)$(PKG_NAME)/config_debug_level
|
||||
config $(PKG_NAME_PREF)$(PKG_NAME)_DEBUG_LEVEL
|
||||
string 'Specifiy Debug level from 0 - 7.'
|
||||
depends on PACKAGE_$(PKG_NAME_PREF)$(PKG_NAME)
|
||||
default ""
|
||||
help
|
||||
Compiles out all the debug levels greater than the selected level 'X' (0 <= X <= 7).
|
||||
Allows control over debug prints and code foot print.
|
||||
|
||||
config $(PKG_NAME_PREF)$(PKG_NAME)_DEBUG_TYPE
|
||||
int 'Specifiy Debug Type from 0 - 3.'
|
||||
depends on PACKAGE_$(PKG_NAME_PREF)$(PKG_NAME)
|
||||
range 0 3
|
||||
default 1
|
||||
help
|
||||
Specify where the log needs to be redirected.
|
||||
0 - None
|
||||
1 - File
|
||||
2 - Console
|
||||
3 - Both File and Console
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -DPACKAGE_ID=\\\"$(PKG_NAME_PREF)$(PKG_NAME)\\\" -DLOGGING_ID=\"$(subst -,_,$(PKG_NAME_PREF)$(PKG_NAME))\" \
|
||||
$(if $(call qstrip,$(CONFIG_$(PKG_NAME_PREF)$(PKG_NAME)_DEBUG_LEVEL)),\
|
||||
-DLOG_LEVEL=$(CONFIG_$(PKG_NAME_PREF)$(PKG_NAME)_DEBUG_LEVEL),-DLOG_LEVEL=$(CONFIG_FEATURE_UGW_GLOBAL_DEBUG_LEVEL)) \
|
||||
$(if $(call qstrip,$(CONFIG_$(PKG_NAME_PREF)$(PKG_NAME)_DEBUG_TYPE)),\
|
||||
-DLOG_TYPE=$(CONFIG_$(PKG_NAME_PREF)$(PKG_NAME)_DEBUG_TYPE))
|
||||
|
||||
100
libscapi/Makefile
Normal file
100
libscapi/Makefile
Normal file
@@ -0,0 +1,100 @@
|
||||
#
|
||||
# Copyright (C) 2009 OpenWrt.org
|
||||
# Copyright (C) 2017 Intel Corporation
|
||||
#
|
||||
# Openwrt Makefile for libscapi
|
||||
#
|
||||
#
|
||||
|
||||
#### Includes ###################################
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
#### Package Info ###############################
|
||||
PKG_NAME:=libscapi
|
||||
PKG_SOURCE_VERSION:=1.5.1.3
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_NAME:=ugw_sdk
|
||||
PKG_SOURCE_INNERDIR:=libscapi
|
||||
PKG_SOURCE_URL:=ssh://git@gts-chd.intel.com:29418/sw_ugw/$(PKG_SOURCE_NAME).git
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_MAINTAINER:=Intel
|
||||
PKG_LICENSE:=Intel
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
-include $(INCLUDE_DIR)/package-version-override.mk
|
||||
$(call include_mk, ugw-loglevel.mk)
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=lib
|
||||
CATEGORY:=Intel
|
||||
SUBMENU:=UGW Framework
|
||||
TITLE:=UGW Framework System Configuration APIs
|
||||
URL:=http://www.intel.com
|
||||
MAINTAINER:=Intel Corporation
|
||||
DEPENDS:= +libhelper
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
UGW Framework System Configuration APIs
|
||||
endef
|
||||
|
||||
### Menuconfig ##################################
|
||||
define Package/$(PKG_NAME)/config
|
||||
$(call Package/$(PKG_NAME)/override_version)
|
||||
$(call Package/$(PKG_NAME)/override_source_path)
|
||||
$(call Package/$(PKG_NAME)/config_debug_level)
|
||||
menu "$(PKG_NAME) features"
|
||||
depends on PACKAGE_$(PKG_NAME)
|
||||
source "$(SOURCE)/config/Config.in"
|
||||
endmenu
|
||||
endef
|
||||
#export $(PKG_CONFIG_DEPENDS)
|
||||
|
||||
ifeq ($(CONFIG_USE_MUSL),y)
|
||||
TARGET_CFLAGS += -DCONFIG_USE_MUSL
|
||||
endif
|
||||
|
||||
#### Target Rules ###############################
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(if $(CONFIG_$(PKG_NAME)_USE_CUSTOM_SOURCE_DIR),,./files/interface_config.sh $(TOPDIR)/.config $(PKG_BUILD_DIR)/interfaces.cfg)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.so $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/include/*.h $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/docs
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/include/scapi_proto.h $(1)/usr/docs/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/include/ugw_error.h $(1)/usr/docs/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/include/ulogging.h $(1)/usr/docs/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mem $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/scapiutil $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/$(VENDOR_PATH)/etc/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/interfaces.cfg $(1)/$(VENDOR_PATH)/etc/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.so $(1)/usr/lib
|
||||
$(if $(CONFIG_TARGET_x86), \
|
||||
$(INSTALL_DIR) $(1)/lib/preinit; \
|
||||
$(INSTALL_BIN) ./files/scapi_utils.sh $(1)/lib/preinit/; \
|
||||
,\
|
||||
$(INSTALL_DIR) $(1)/etc/preinit.d; \
|
||||
$(INSTALL_BIN) ./files/scapi_utils.sh $(1)/etc/preinit.d/; \
|
||||
$(SED) 's/.*boot_hook_add.*preinit.*/scapi_utils_init/g' $(1)/etc/preinit.d/scapi_utils.sh; \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Clean
|
||||
if [ -d $(PKG_BUILD_DIR) ]; then $(MAKE) -C $(PKG_BUILD_DIR) clean; \
|
||||
$(RM) -r $(PKG_BUILD_DIR)/ipkg-$(BOARD); fi
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
270
libscapi/config/Config.in
Normal file
270
libscapi/config/Config.in
Normal file
@@ -0,0 +1,270 @@
|
||||
menu INTERFACE1
|
||||
|
||||
config INTERFACE1_TYPE
|
||||
string "Type"
|
||||
default "LAN"
|
||||
|
||||
config INTERFACE1_IFNAME
|
||||
string "IfName"
|
||||
default "eth0_1"
|
||||
|
||||
config INTERFACE1_MACVLAN
|
||||
bool "MacvLan"
|
||||
default n
|
||||
|
||||
config INTERFACE1_PROTOS
|
||||
string "Protos"
|
||||
default "Static"
|
||||
|
||||
config INTERFACE1_MODE
|
||||
string "Mode"
|
||||
default "ETH"
|
||||
|
||||
config INTERFACE1_PORTID
|
||||
string "Switch Port"
|
||||
default ""
|
||||
|
||||
config INTERFACE1_ENABLE
|
||||
bool "Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE1_LINKENABLE
|
||||
bool "Link Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE1_BONDMEMBERS
|
||||
string "Bond Members"
|
||||
|
||||
endmenu
|
||||
|
||||
menu INTERFACE2
|
||||
|
||||
config INTERFACE2_TYPE
|
||||
string "Type"
|
||||
default "LAN"
|
||||
|
||||
config INTERFACE2_IFNAME
|
||||
string "IfName"
|
||||
default "eth0_2"
|
||||
|
||||
config INTERFACE2_MACVLAN
|
||||
bool "MacvLan"
|
||||
default n
|
||||
|
||||
config INTERFACE2_PROTOS
|
||||
string "Protos"
|
||||
default "Static"
|
||||
|
||||
config INTERFACE2_MODE
|
||||
string "Mode"
|
||||
default "ETH"
|
||||
|
||||
config INTERFACE2_PORTID
|
||||
string "Switch Port"
|
||||
default ""
|
||||
|
||||
config INTERFACE2_ENABLE
|
||||
bool "Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE2_LINKENABLE
|
||||
bool "Link Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE2_BONDMEMBERS
|
||||
string "Bond Members"
|
||||
|
||||
|
||||
endmenu
|
||||
|
||||
menu INTERFACE3
|
||||
|
||||
config INTERFACE3_TYPE
|
||||
string "Type"
|
||||
default "LAN"
|
||||
|
||||
config INTERFACE3_IFNAME
|
||||
string "IfName"
|
||||
default "eth0_3"
|
||||
|
||||
config INTERFACE3_MACVLAN
|
||||
bool "MacvLan"
|
||||
default n
|
||||
|
||||
config INTERFACE3_PROTOS
|
||||
string "Protos"
|
||||
default "Static"
|
||||
|
||||
config INTERFACE3_MODE
|
||||
string "Mode"
|
||||
default "ETH"
|
||||
|
||||
config INTERFACE3_PORTID
|
||||
string "Switch Port"
|
||||
default ""
|
||||
|
||||
config INTERFACE3_ENABLE
|
||||
bool "Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE3_LINKENABLE
|
||||
bool "Link Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE3_BONDMEMBERS
|
||||
string "Bond Members"
|
||||
|
||||
endmenu
|
||||
|
||||
menu INTERFACE4
|
||||
|
||||
config INTERFACE4_TYPE
|
||||
string "Type"
|
||||
default "LAN"
|
||||
|
||||
config INTERFACE4_IFNAME
|
||||
string "IfName"
|
||||
default "eth0_4"
|
||||
|
||||
config INTERFACE4_MACVLAN
|
||||
bool "MacvLan"
|
||||
default n
|
||||
|
||||
config INTERFACE4_PROTOS
|
||||
string "Protos"
|
||||
default "Static"
|
||||
|
||||
config INTERFACE4_MODE
|
||||
string "Mode"
|
||||
default "ETH"
|
||||
|
||||
config INTERFACE4_PORTID
|
||||
string "Switch Port"
|
||||
default ""
|
||||
|
||||
config INTERFACE4_ENABLE
|
||||
bool "Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE4_LINKENABLE
|
||||
bool "Link Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE4_BONDMEMBERS
|
||||
string "Bond Members"
|
||||
|
||||
endmenu
|
||||
|
||||
menu INTERFACE5
|
||||
|
||||
config INTERFACE5_TYPE
|
||||
string "Type"
|
||||
default "WAN"
|
||||
|
||||
config INTERFACE5_IFNAME
|
||||
string "IfName"
|
||||
default "eth1"
|
||||
|
||||
config INTERFACE5_MACVLAN
|
||||
bool "MacvLan"
|
||||
default y
|
||||
|
||||
config INTERFACE5_PROTOS
|
||||
string "Protos"
|
||||
default "Static,DHCP,PPPoE"
|
||||
|
||||
config INTERFACE5_MODE
|
||||
string "Mode"
|
||||
default "ETH"
|
||||
|
||||
config INTERFACE5_PORTID
|
||||
string "Switch Port"
|
||||
default ""
|
||||
|
||||
config INTERFACE5_ENABLE
|
||||
bool "Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE5_LINKENABLE
|
||||
bool "Link Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE5_BONDMEMBERS
|
||||
string "Bond Members"
|
||||
|
||||
endmenu
|
||||
|
||||
menu INTERFACE6
|
||||
|
||||
config INTERFACE6_TYPE
|
||||
string "Type"
|
||||
default "WAN"
|
||||
|
||||
config INTERFACE6_MACVLAN
|
||||
bool "MacvLan"
|
||||
default y
|
||||
|
||||
config INTERFACE6_PROTOS
|
||||
string "Protos"
|
||||
default "Static,DHCP,PPPoE"
|
||||
|
||||
config INTERFACE6_MODE
|
||||
string "Mode"
|
||||
default "ETH"
|
||||
|
||||
config INTERFACE6_PORTID
|
||||
string "Switch Port"
|
||||
default ""
|
||||
|
||||
config INTERFACE6_ENABLE
|
||||
bool "Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE6_LINKENABLE
|
||||
bool "Link Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE6_BONDMEMBERS
|
||||
string "Bond Members"
|
||||
|
||||
endmenu
|
||||
|
||||
menu INTERFACE7
|
||||
|
||||
config INTERFACE7_TYPE
|
||||
string "Type"
|
||||
default "WAN"
|
||||
|
||||
config INTERFACE7_IFNAME
|
||||
string "IfName"
|
||||
default "bond-bond0"
|
||||
|
||||
config INTERFACE7_MACVLAN
|
||||
bool "MacvLan"
|
||||
default y
|
||||
|
||||
config INTERFACE7_PROTOS
|
||||
string "Protos"
|
||||
default "Static,DHCP,PPPoE"
|
||||
|
||||
config INTERFACE7_MODE
|
||||
string "Mode"
|
||||
default "bond"
|
||||
|
||||
config INTERFACE7_PORTID
|
||||
string "Switch Port"
|
||||
default ""
|
||||
|
||||
config INTERFACE7_ENABLE
|
||||
bool "Enable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE7_LINKENABLE
|
||||
bool "LinkEnable"
|
||||
default "y"
|
||||
|
||||
config INTERFACE7_BONDMEMBERS
|
||||
string "Bond Members"
|
||||
default "eth1 nrgmii3"
|
||||
|
||||
endmenu
|
||||
157
libscapi/files/interface_config.sh
Executable file
157
libscapi/files/interface_config.sh
Executable file
@@ -0,0 +1,157 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
|
||||
file=$1 ;
|
||||
configFilePath=$2 ;
|
||||
sList= ;
|
||||
sInterface= ;
|
||||
sLanArr= ;
|
||||
sWanArr= ;
|
||||
|
||||
#remove if any existing file
|
||||
rm -rf $configFilePath ;
|
||||
count_int=0;
|
||||
count_lan=0;
|
||||
count_wan=0;
|
||||
|
||||
|
||||
while read -r line;
|
||||
do
|
||||
{
|
||||
#Inputs to the script, the delimiter, and the string itself
|
||||
|
||||
substring="CONFIG_INTERFACE";
|
||||
|
||||
string=$line ;
|
||||
#read each line of file
|
||||
if test "${line#$substring}" != "$line"
|
||||
then
|
||||
#Split the String into Substrings (CONIG_INTERFACE1_TYPE->1_TYPE)
|
||||
sList=$(echo $string | sed -e 's/^ *CONFIG_INTERFACE//g' | sed 's/'\"'//g');
|
||||
sInterface[$count_int]=$sList;
|
||||
|
||||
count_int=$count_int+1 ;
|
||||
|
||||
#process if type is LAN
|
||||
if [[ "$sList" == *_TYPE*=*LAN* ]];then
|
||||
#saving the interface number in pos_lantype
|
||||
pos_lantype=$(echo ${sList//[^0-9]/});
|
||||
|
||||
#get all the paramter for interface_position check if interface name is present then add in lan interface
|
||||
while read -r interfaceline;
|
||||
do
|
||||
#Inputs to the script, the delimiter, and the string itself
|
||||
|
||||
substring="CONFIG_INTERFACE";
|
||||
|
||||
string=$interfaceline ;
|
||||
#read each line of file
|
||||
if test "${interfaceline#$substring}" != "$interfaceline"
|
||||
then
|
||||
#Split the String into Substrings (CONIG_INTERFACE1_TYPE->1_TYPE)
|
||||
sInterfaceList=$(echo $string | sed -e 's/^ *CONFIG_INTERFACE//g' | sed 's/'\"'//g');
|
||||
|
||||
if [[ "$sInterfaceList" == $pos_lantype"_IFNAME"* ]];then
|
||||
varVal=$(echo $sInterfaceList | cut -f2 -d=)
|
||||
|
||||
#if not empty then copy the index in lan array
|
||||
if [[ ! -z "${varVal// }" ]]; then
|
||||
sLanArr[$count_lan]=$pos_lantype ;
|
||||
count_lan=$count_lan+1 ;
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
done < $file
|
||||
|
||||
fi #end of lan
|
||||
|
||||
|
||||
|
||||
|
||||
#process if type is WAN
|
||||
if [[ "$sList" == *_TYPE*=*WAN* ]];then
|
||||
pos_wantype=$(echo ${sList//[^0-9]/});
|
||||
|
||||
#get all the paramter for interface_position check if interface name is present then add in wan interface
|
||||
while read -r interfaceline;
|
||||
do
|
||||
#Inputs to the script, the delimiter, and the string itself
|
||||
|
||||
substring="CONFIG_INTERFACE";
|
||||
|
||||
string=$interfaceline ;
|
||||
#read each line of file
|
||||
if test "${interfaceline#$substring}" != "$interfaceline"
|
||||
then
|
||||
#Split the String into Substrings (CONIG_INTERFACE1_TYPE->1_TYPE)
|
||||
sInterfaceList=$(echo $string | sed -e 's/^ *CONFIG_INTERFACE//g' | sed 's/'\"'//g');
|
||||
#check if IFNAME is empty
|
||||
if [[ "$sInterfaceList" == $pos_wantype"_IFNAME"* ]];then
|
||||
varVal=$(echo $sInterfaceList | cut -f2 -d=)
|
||||
|
||||
|
||||
#if not empty then copy the index in wan array
|
||||
if [[ ! -z "${varVal// }" ]]; then
|
||||
sWanArr[$count_wan]=$pos_wantype ;
|
||||
count_wan=$count_wan+1 ;
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
done < $file
|
||||
|
||||
fi #end of wan
|
||||
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
done < $file
|
||||
|
||||
i=1;
|
||||
count=1;
|
||||
#for each lan array,output the interface to config file
|
||||
for (( j = 0; j < ${#sLanArr[@]}; j++ )); do
|
||||
echo -e "###################LAN-${i}###########\n{" >> $configFilePath ;
|
||||
for (( k = 0; k < ${#sInterface[@]}; k++ )); do
|
||||
|
||||
|
||||
if [[ ${sInterface[k]} =~ ^${sLanArr[j]}_.* ]];then
|
||||
if [[ ${sInterface[k]} =~ ^.*=y$ ]]; then
|
||||
echo ${sInterface[k]} | sed 's/^[0-9]*_//' | sed 's/=y$/=true/' >> $configFilePath ;
|
||||
else
|
||||
echo ${sInterface[k]} | sed 's/^[0-9]*_//' >> $configFilePath ;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo -e "}\n###################END LAN-${i}#######" >> $configFilePath ;
|
||||
((i++))
|
||||
((count++))
|
||||
done
|
||||
i=1;
|
||||
#for each wan array,output the interface to config file
|
||||
for (( j = 0; j < ${#sWanArr[@]}; j++ )); do
|
||||
echo -e "###################WAN-${i}###########\n{" >> $configFilePath ;
|
||||
for (( k = 0; k < ${#sInterface[@]}; k++ )); do
|
||||
|
||||
|
||||
if [[ ${sInterface[k]} =~ ^${sWanArr[j]}_.* ]];then
|
||||
if [[ ${sInterface[k]} =~ ^.*=y$ ]]; then
|
||||
echo ${sInterface[k]} | sed 's/^[0-9]*_//' | sed 's/=y$/=true/' >> $configFilePath ;
|
||||
else
|
||||
echo ${sInterface[k]} | sed 's/^[0-9]*_//' >> $configFilePath ;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo -e "}\n###################END WAN-${i}#######" >> $configFilePath ;
|
||||
((i++))
|
||||
((count++))
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
88
libscapi/files/scapi_utils.sh
Executable file
88
libscapi/files/scapi_utils.sh
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/profile.d/ugw_framework_env.sh
|
||||
|
||||
scapi_utils_init()
|
||||
{
|
||||
local file="${VENDOR_PATH}/etc/.certchk"
|
||||
local fwfile="${VENDOR_PATH}/etc/csd/fwboot"
|
||||
|
||||
local cmd_line t_active_bank active_bank t_update_chk update_chk
|
||||
cmd_line="`cat /proc/cmdline`";
|
||||
|
||||
[ -z "${cmd_line##*active_bank=[AB]*}" ] && {
|
||||
t_active_bank=${cmd_line##*active_bank=};
|
||||
active_bank=${t_active_bank::1};
|
||||
} || active_bank=A;
|
||||
|
||||
[ -z "${cmd_line##*update_chk=[0-4]*}" ] && {
|
||||
t_update_chk=${cmd_line##*update_chk=};
|
||||
update_chk=${t_update_chk::1};
|
||||
} || update_chk=0;
|
||||
|
||||
if [ "$active_bank" = "B" -a "$update_chk" = "0" ]; then
|
||||
/usr/sbin/uboot_env --set --name update_chk --value 2
|
||||
elif [ "$active_bank" = "A" -a "$update_chk" != "0" ]; then
|
||||
/usr/sbin/uboot_env --set --name update_chk --value 0
|
||||
fi
|
||||
|
||||
#create certificate for lighthttpd on first boot.
|
||||
if [ ! -s $file ] ; then
|
||||
key=`scapiutil get_key`
|
||||
fi
|
||||
|
||||
#check whether fw boot or normal boot
|
||||
if [ -f $fwfile ] ; then
|
||||
|
||||
#find last running configuration
|
||||
file=`cat ${VENDOR_PATH}/etc/csd/csdswap`
|
||||
_lastmodified=`echo $file | cut -d \= -f 2`
|
||||
|
||||
if [[ $_lastmodified -eq 1 ]] ; then
|
||||
csdutil merge ${VENDOR_PATH}/config/.run-data.xml /rom/${VENDOR_PATH}/etc/datacfg /rom/${VENDOR_PATH}/etc/ctrlcfg
|
||||
else
|
||||
csdutil merge ${VENDOR_PATH}/config/.run-data-swp.xml /rom/${VENDOR_PATH}/etc/datacfg /rom/${VENDOR_PATH}/etc/ctrlcfg
|
||||
fi
|
||||
|
||||
#remove fwboot
|
||||
[ -e $fwfile ] && rm $fwfile
|
||||
fi
|
||||
|
||||
#create log soft link under /tmp directory for procd log on boot.
|
||||
|
||||
# The source directory and target directories.
|
||||
target_location="/tmp/debug_level" # Contains the working location of file.
|
||||
source_location="${VENDOR_PATH}/etc/debug_level" # file location.
|
||||
|
||||
if [ ! -s $source_location ] ; then
|
||||
echo '2' > $source_location
|
||||
echo '#Auto generated file for procd debug level(1-5)' >> $source_location
|
||||
fi
|
||||
|
||||
ln -s "$source_location" "$target_location"
|
||||
|
||||
#check devices comming up with default mac or not.
|
||||
old_mac=`scapiutil get_mac`
|
||||
[ -n "$CONFIG_UBOOT_CONFIG_ETHERNET_ADDRESS" -a -n "$old_mac" ] && \
|
||||
[ "$old_mac" = "$CONFIG_UBOOT_CONFIG_ETHERNET_ADDRESS" ] && {
|
||||
local i=0;
|
||||
while [ $i -lt 5 ]; do
|
||||
echo -en "\033[J"; usleep 150000;
|
||||
echo -en "#######################################################\n";
|
||||
echo -en "# DEVICE CONFIGURED WITH DEFAULT MAC ADDRESS!! #\n";
|
||||
echo -en "# This may conflict with other devices. Please change #\n";
|
||||
echo -en "# the MAC address for un-interrupted services. #\n";
|
||||
echo -en "#######################################################\n";
|
||||
echo -en "\033[5A\033G"; usleep 300000;
|
||||
let i++
|
||||
done; echo -en "\n\n\n\n\n";
|
||||
echo -en "######Please configure the MAC from uboot using \n";
|
||||
echo -en "######set ethaddr 'xx:xx:xx:xx:xx' \n";
|
||||
echo -en "###### Board is going to reboot#####\n";
|
||||
sleep 5;
|
||||
reboot;
|
||||
} || true
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential scapi_utils_init
|
||||
|
||||
Reference in New Issue
Block a user