[qca-ssdk-shell] First commit for ssdk-shell
SSDK shell code need to be released under open source license. So
the code is moved into the new git repository and its all files'
copyright header is writen into that of ISC license.
Change-Id: Id22625bc14c944098bce6fdcf463df585f29539c
Signed-off-by: luny <luny@codeaurora.org>
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..adcf872
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,47 @@
+include ./config
+
+ifndef PRJ_PATH
+ PRJ_PATH=$(shell pwd)
+endif
+export PRJ_PATH
+
+include ./make/config.mk
+include ./make/tools.mk
+include ./make/$(OS)_opt.mk
+
+SUB_DIR=$(patsubst %/, %, $(dir $(wildcard src/*/Makefile)))
+SUB_LIB=$(subst src/, , $(SUB_DIR))
+
+all: $(BIN_DIR) uslib shell
+ @echo "---Build [SSDK_SH-$(VERSION)] at $(BUILD_DATE) finished."
+
+kslib:kslib_o
+ $(AR) -r $(BIN_DIR)/$(KS_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/KSLIB/*.o)
+
+kslib_o:
+ $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=KSLIB -C src/$i all || exit 1;)
+
+uslib:uslib_o
+ $(AR) -r $(BIN_DIR)/$(US_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/USLIB/*.o)
+
+uslib_o:
+ $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=USLIB -C src/$i all || exit 1;)
+
+shell:uslib shell_o
+ $(CP) $(BLD_DIR)/SHELL/$(SHELLOBJ) $(BIN_DIR)/$(SHELLOBJ)
+ $(STRIP) $(BIN_DIR)/$(SHELLOBJ)
+
+shell_o:
+ $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=SHELL -C src/$i all || exit 1;)
+
+$(BIN_DIR):
+ $(MKDIR) -p $@
+
+release:
+ @cd make; ./release.sh $(VER)
+
+clean:
+ $(RM) -f $(BLD_DIR)/KSLIB/*
+ $(RM) -f $(BLD_DIR)/USLIB/*
+ $(RM) -f $(BLD_DIR)/SHELL/*
+ $(RM) -f $(BIN_DIR)/*
diff --git a/config b/config
new file mode 100755
index 0000000..e1e8494
--- /dev/null
+++ b/config
@@ -0,0 +1,141 @@
+#CPU=mips
+
+OS=linux
+
+ifeq ($(KVER), 3.4.0)
+OS_VER=3_4
+endif
+
+ifeq ($(KVER), 3.3.8)
+OS_VER=3_2
+endif
+
+ifeq ($(ARCH), arm)
+BOARD=ipq806x
+endif
+
+ifeq ($(ARCH), mips)
+BOARD=ar71xx
+endif
+
+ifeq ($(BOARD), ar71xx)
+BOARD_NAME=BOARD_AR71XX
+endif
+
+ifeq ($(BOARD), ipq806x)
+BOARD_NAME=BOARD_IPQ806X
+endif
+
+OS_SUB=31
+CHIP_TYPE=ISISC
+
+ifndef OS_VER
+OS_VER=2_6
+endif
+# OS subversion, 2.6.31 for WASP (db120)
+#OS_SUB=31
+# GCC version, 3 or 4
+#GCC_VER=4
+
+#For MIPS Linux2.6
+ #pb45
+ #TOOL_PATH=/disk/pb45/sw/build/gcc-3.4.4-2.16.1/build_mips_nofpu/bin
+ #SYS_PATH=/disk/pb45/sw/linux/kernels/mips-linux-2.6.15
+
+ #ap81
+# compatiable with OpenWRT
+ifndef TOOL_PATH
+TOOL_PATH=/disk/ap81fus/sw/build/gcc-3.4.4-2.16.1/build_mips/bin
+endif
+ifndef SYS_PATH
+SYS_PATH=/disk/ap81fus/sw/linux/kernels/mips-linux-2.6.15
+endif
+ifeq ($(ARCH), mips)
+ CPU_CFLAG=-Wstrict-prototypes -fomit-frame-pointer -G 0 -mno-abicalls -fno-strict-aliasing -O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB -D$(BOARD_NAME)
+endif
+
+
+#db120
+ifeq ($(BOARD_TYPE),db12x)
+OS_SUB=31
+GCC_VER=4
+TOOL_PATH=$(TOPDIR)/build/gcc-4.3.3/build_mips/staging_dir/usr/bin
+SYS_PATH=$(TOPDIR)/linux/kernels/mips-linux-2.6.31
+CPU_CFLAG=-Wstrict-prototypes -fomit-frame-pointer -G 0 -mno-abicalls -fno-strict-aliasing -O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB
+endif
+
+ifeq ($(ARCH), arm)
+ CPU_CFLAG=-D__LINUX_ARM_ARCH__=7 -DMODULE -fno-common -DCONFIG_MMU -D$(BOARD_NAME)
+endif
+
+ifeq ($(BOARD_TYPE), ap136)
+OS_SUB=31
+GCC_VER=4
+TOOL_PATH=$(TOPDIR)/build/gcc-4.3.3/build_mips/staging_dir/usr/bin
+SYS_PATH=$(TOPDIR)/linux/kernels/mips-linux-2.6.31
+CPU_CFLAG=-Wstrict-prototypes -fomit-frame-pointer -G 0 -mno-abicalls -fno-strict-aliasing -O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB
+endif
+
+#For MIPS Linux2.4
+ #TOOL_PATH=/home/perforce/kernel2.4/5.3.1.20/tools/gcc-3.3.3-2.4.25/toolchain_mips/bin
+ #SYS_PATH=/home/perforce/kernel2.4/5.3.1.20/src/kernels/mips-linux-2.4.25
+
+ #TOOLPREFIX=$(CPU)-$(OS)-
+ #CPU_CFLAG=-Wstrict-prototypes -Wundef -fomit-frame-pointer -G 0 -mno-abicalls -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fno-pic -pipe -mabi=32 -march=r4600 -Wa,-32 -Wa,-march=r4600 -Wa,--trap -DMODULE -mlong-calls -DEXPORT_SYMTAB
+
+
+KERNEL_MODE=TRUE
+#compatiable with OpenWRT
+ifeq ($(SWITCH_SSDK_MODE),user)
+KERNEL_MODE=FLASE
+endif
+
+#FAL=FALSE or not define FAL, FAL will not be included in SSDK
+FAL=TRUE
+
+#CHIP_TYPE can be defined as ATHENA, GARUDA, SHIVA, HORUS, ISIS, ISISC and ALL_CHIP(ALL_CHIP means GARUDA, SHIVA, HORUS and ISIS)
+CHIP_TYPE=ISISC
+
+#UK_IF=FALSE or not define UK_IF, UK_IF will not be included in SSDK
+#when UK_IF=TRUE one of UK_NETLINK,UK_IOCTL must be defined as TRUE
+UK_IF=TRUE
+#UK_IOCTL=TRUE define user-kernel space communication based on ioctl
+UK_IOCTL=TRUE
+UK_MINOR_DEV=254
+
+#API_LOCK=FALSE or not define API_LOCK, API_LOCK will not be included in SSDK
+API_LOCK=FALSE
+
+#REG_ACCESS_SPEEDUP=FALSE or not define REG_ACCESS_SPEEDUP, REG_ACCESS_SPEEDUP will not be enabled, now only ISIS supports
+REG_ACCESS_SPEEDUP=FALSE
+
+#ALL supported features:
+#ACL FDB IGMP LEAKY LED MIB MIRROR MISC PORTCONTROL PORTVLAN QOS RATE STP VLAN
+#IN_X=FALSE or not define IN_X, X will not be included in SSDK
+IN_ACL=TRUE
+IN_FDB=TRUE
+IN_IGMP=TRUE
+IN_LEAKY=TRUE
+IN_LED=TRUE
+IN_MIB=TRUE
+IN_MIRROR=TRUE
+IN_MISC=TRUE
+IN_PORTCONTROL=TRUE
+IN_PORTVLAN=TRUE
+IN_QOS=TRUE
+IN_RATE=TRUE
+IN_STP=TRUE
+IN_VLAN=TRUE
+IN_REDUCED_ACL=FALSE
+IN_COSMAP=TRUE
+IN_IP=TRUE
+IN_NAT=TRUE
+IN_TRUNK=TRUE
+IN_SEC=TRUE
+ifeq ($(HNAT_FEATURE), enable)
+IN_NAT_HELPER=TRUE
+else
+IN_NAT_HELPER=FALSE
+endif
+IN_INTERFACECONTROL=TRUE
+IN_MACBLOCK=FALSE
diff --git a/include/api/api_access.h b/include/api/api_access.h
new file mode 100755
index 0000000..806c24d
--- /dev/null
+++ b/include/api/api_access.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _API_ACCESS_H
+#define _API_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+ sw_api_func_t *
+ sw_api_func_find(a_uint32_t api_id);
+
+ sw_api_param_t *
+ sw_api_param_find(a_uint32_t api_id);
+
+ a_uint32_t
+ sw_api_param_nums(a_uint32_t api_id);
+
+ sw_error_t
+ sw_api_get(sw_api_t *sw_api);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _API_ACCESS_H */
diff --git a/include/api/api_desc.h b/include/api/api_desc.h
new file mode 100755
index 0000000..329dfed
--- /dev/null
+++ b/include/api/api_desc.h
@@ -0,0 +1,2183 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _API_DESC_H_
+#define _API_DESC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define SW_API_PT_DUPLEX_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DUPLEX_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DUPLEX_GET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_DUPLEX_GET, SW_DUPLEX, sizeof(fal_port_duplex_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "duplex"),
+
+#define SW_API_PT_DUPLEX_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DUPLEX_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DUPLEX_SET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_DUPLEX_SET, SW_DUPLEX, sizeof(fal_port_duplex_t), SW_PARAM_IN, \
+ "duplex"),
+
+#define SW_API_PT_SPEED_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_SPEED_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_SPEED_GET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_SPEED_GET, SW_SPEED, sizeof(fal_port_speed_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "speed"),
+
+#define SW_API_PT_SPEED_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_SPEED_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_SPEED_SET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_SPEED_SET, SW_SPEED, sizeof(fal_port_speed_t), SW_PARAM_IN, \
+ "speed"),
+
+#define SW_API_PT_AN_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_AN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_AN_GET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_AN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "autoneg"),
+
+
+#define SW_API_PT_AN_ENABLE_DESC \
+ SW_PARAM_DEF(SW_API_PT_AN_ENABLE, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_AN_ENABLE, SW_UINT32, 4, SW_PARAM_IN, "Port No."),
+
+
+#define SW_API_PT_AN_RESTART_DESC \
+ SW_PARAM_DEF(SW_API_PT_AN_RESTART, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_AN_RESTART, SW_UINT32, 4, SW_PARAM_IN, "Port No."),
+
+#define SW_API_PT_AN_ADV_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_AN_ADV_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_AN_ADV_GET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_AN_ADV_GET, SW_CAP, 4, SW_PARAM_PTR|SW_PARAM_OUT, "autoneg"),
+
+#define SW_API_PT_AN_ADV_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_AN_ADV_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_AN_ADV_SET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_AN_ADV_SET, SW_CAP, 4, SW_PARAM_IN, "autoneg"),
+
+#define SW_API_PT_HDR_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_HDR_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_HDR_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_HDR_SET, SW_ENABLE, 4, SW_PARAM_IN, "Header"),
+
+#define SW_API_PT_HDR_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_HDR_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_HDR_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_HDR_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Header"),
+
+#define SW_API_PT_FLOWCTRL_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_SET, SW_ENABLE, 4, SW_PARAM_IN, "Flow control"),
+
+#define SW_API_PT_FLOWCTRL_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Flow control"),
+
+#define SW_API_PT_FLOWCTRL_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_MODE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Force mode"),
+
+#define SW_API_PT_FLOWCTRL_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_FLOWCTRL_MODE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Force mode"),
+
+#define SW_API_PT_POWERSAVE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_POWERSAVE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_POWERSAVE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_POWERSAVE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Powersave Status"),
+
+#define SW_API_PT_POWERSAVE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_POWERSAVE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_POWERSAVE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_POWERSAVE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Powersave Status"),
+
+#define SW_API_PT_HIBERNATE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_HIBERNATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_HIBERNATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_HIBERNATE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Hibernate status"),
+
+#define SW_API_PT_HIBERNATE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_HIBERNATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_HIBERNATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_HIBERNATE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Hibernate Status"),
+
+#define SW_API_PT_CDT_DESC \
+ SW_PARAM_DEF(SW_API_PT_CDT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_CDT, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_CDT, SW_UINT32, 4, SW_PARAM_IN, "MDI Pair ID"), \
+ SW_PARAM_DEF(SW_API_PT_CDT, SW_CABLESTATUS, 4, SW_PARAM_PTR|SW_PARAM_OUT, "cable status"), \
+ SW_PARAM_DEF(SW_API_PT_CDT, SW_CABLELEN, 4, SW_PARAM_PTR|SW_PARAM_OUT, "cable len"),
+
+#define SW_API_PT_TXHDR_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_TXHDR_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_TXHDR_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_TXHDR_SET, SW_HDRMODE, sizeof(fal_port_header_mode_t), \
+ SW_PARAM_IN, "HdrMode"),
+
+#define SW_API_PT_TXHDR_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_TXHDR_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_TXHDR_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_TXHDR_GET, SW_HDRMODE, sizeof(fal_port_header_mode_t), \
+ SW_PARAM_PTR|SW_PARAM_OUT, "HdrMode"),
+
+#define SW_API_PT_RXHDR_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_RXHDR_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_RXHDR_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_RXHDR_SET, SW_HDRMODE, sizeof(fal_port_header_mode_t), \
+ SW_PARAM_IN, "HdrMode"),
+
+#define SW_API_PT_RXHDR_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_RXHDR_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_RXHDR_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_RXHDR_GET, SW_HDRMODE, sizeof(fal_port_header_mode_t), \
+ SW_PARAM_PTR|SW_PARAM_OUT, "HdrMode"),
+
+#define SW_API_HEADER_TYPE_SET_DESC \
+ SW_PARAM_DEF(SW_API_HEADER_TYPE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_HEADER_TYPE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"), \
+ SW_PARAM_DEF(SW_API_HEADER_TYPE_SET, SW_UINT32, 4, SW_PARAM_IN, "Value"),
+
+#define SW_API_HEADER_TYPE_GET_DESC \
+ SW_PARAM_DEF(SW_API_HEADER_TYPE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_HEADER_TYPE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"), \
+ SW_PARAM_DEF(SW_API_HEADER_TYPE_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Value"),
+
+#define SW_API_TXMAC_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_TXMAC_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TXMAC_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_TXMAC_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Value"),
+
+#define SW_API_TXMAC_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_TXMAC_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TXMAC_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_TXMAC_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Value"),
+
+#define SW_API_RXMAC_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_RXMAC_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_RXMAC_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_RXMAC_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Value"),
+
+#define SW_API_RXMAC_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_RXMAC_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_RXMAC_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_RXMAC_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Value"),
+
+#define SW_API_TXFC_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_TXFC_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TXFC_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_TXFC_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Value"),
+
+#define SW_API_TXFC_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_TXFC_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TXFC_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_TXFC_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Value"),
+
+#define SW_API_RXFC_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_RXFC_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_RXFC_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_RXFC_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Value"),
+
+#define SW_API_RXFC_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_RXFC_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_RXFC_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_RXFC_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Value"),
+
+#define SW_API_BP_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_BP_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_BP_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_BP_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Value"),
+
+#define SW_API_BP_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_BP_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_BP_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_BP_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Value"),
+
+#define SW_API_PT_LINK_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_LINK_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_LINK_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_LINK_MODE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Value"),
+
+#define SW_API_PT_LINK_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_LINK_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_LINK_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_LINK_MODE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Value"),
+
+#define SW_API_PT_LINK_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_LINK_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_LINK_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_LINK_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"),
+
+#define SW_API_PT_MAC_LOOPBACK_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MAC_LOOPBACK_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAC_LOOPBACK_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAC_LOOPBACK_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_PT_MAC_LOOPBACK_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MAC_LOOPBACK_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAC_LOOPBACK_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAC_LOOPBACK_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+
+
+
+#define SW_API_VLAN_ADD_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_ADD, SW_UINT32, 4, SW_PARAM_IN, "Vlan Id"),
+
+#define SW_API_VLAN_DEL_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_DEL, SW_UINT32, 4, SW_PARAM_IN, "Vlan Id"),
+
+#define SW_API_VLAN_MEM_UPDATE_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_MEM_UPDATE, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_MEM_UPDATE, SW_UINT32, 4, SW_PARAM_IN, "Vlan Id"), \
+ SW_PARAM_DEF(SW_API_VLAN_MEM_UPDATE, SW_PBMP, sizeof(fal_pbmp_t), SW_PARAM_IN, \
+ "Member Port Map"), \
+ SW_PARAM_DEF(SW_API_VLAN_MEM_UPDATE, SW_PBMP, sizeof(fal_pbmp_t), SW_PARAM_IN, \
+ "U Member Port Map"),
+
+#define SW_API_VLAN_FIND_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_FIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_FIND, SW_UINT32, 4, SW_PARAM_IN, "Vlan Id"), \
+ SW_PARAM_DEF(SW_API_VLAN_FIND, SW_VLAN, sizeof(fal_vlan_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Vlan Entry"),
+
+#define SW_API_VLAN_NEXT_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Vlan Id"), \
+ SW_PARAM_DEF(SW_API_VLAN_NEXT, SW_VLAN, sizeof(fal_vlan_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Vlan Entry"),
+
+#define SW_API_VLAN_APPEND_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_APPEND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_APPEND, SW_VLAN, sizeof(fal_vlan_t), SW_PARAM_PTR|SW_PARAM_IN, "Vlan Entry"),
+
+#define SW_API_VLAN_FLUSH_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_FLUSH, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),
+
+#define SW_API_VLAN_FID_SET_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_FID_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_FID_SET, SW_UINT32, 4, SW_PARAM_IN, "Vlan ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_FID_SET, SW_UINT32, 4, SW_PARAM_IN, "FDB ID"),
+
+#define SW_API_VLAN_FID_GET_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_FID_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_FID_GET, SW_UINT32, 4, SW_PARAM_IN, "Vlan ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_FID_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "FDB ID"),
+
+#define SW_API_VLAN_MEMBER_ADD_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_MEMBER_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_MEMBER_ADD, SW_UINT32, 4, SW_PARAM_IN, "Vlan ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_MEMBER_ADD, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_MEMBER_ADD, SW_EGMODE, sizeof(fal_pt_1q_egmode_t), \
+ SW_PARAM_IN, "Port Info"),
+
+#define SW_API_VLAN_MEMBER_DEL_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_MEMBER_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_MEMBER_DEL, SW_UINT32, 4, SW_PARAM_IN, "Vlan ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_MEMBER_DEL, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),
+
+#define SW_API_VLAN_LEARN_STATE_SET_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_LEARN_STATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_LEARN_STATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Vlan ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_LEARN_STATE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_VLAN_LEARN_STATE_GET_DESC \
+ SW_PARAM_DEF(SW_API_VLAN_LEARN_STATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_LEARN_STATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Vlan ID"), \
+ SW_PARAM_DEF(SW_API_VLAN_LEARN_STATE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+
+
+
+#define SW_API_PT_ING_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_ING_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_ING_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_ING_MODE_GET, SW_1QMODE, sizeof(fal_pt_1qmode_t), \
+ SW_PARAM_PTR|SW_PARAM_OUT, "1qmode"),
+
+#define SW_API_PT_ING_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_ING_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_ING_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_ING_MODE_SET, SW_1QMODE, sizeof(fal_pt_1qmode_t), \
+ SW_PARAM_IN, "1qmode"),
+
+#define SW_API_PT_EG_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_EG_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_EG_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_EG_MODE_GET, SW_EGMODE, sizeof(fal_pt_1q_egmode_t),\
+ SW_PARAM_PTR|SW_PARAM_OUT, "egvlan"),
+
+#define SW_API_PT_EG_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_EG_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_EG_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_EG_MODE_SET, SW_EGMODE, sizeof(fal_pt_1q_egmode_t), \
+ SW_PARAM_IN, "egvlan"),
+
+#define SW_API_PT_VLAN_MEM_ADD_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_ADD, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_ADD, SW_UINT32, 4, SW_PARAM_IN, "Member Port Id"),
+
+#define SW_API_PT_VLAN_MEM_DEL_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_DEL, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_DEL, SW_UINT32, 4, SW_PARAM_IN, "Member Port Id"),
+
+#define SW_API_PT_VLAN_MEM_UPDATE_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_UPDATE, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_UPDATE, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_UPDATE, SW_PBMP, sizeof(fal_pbmp_t), SW_PARAM_IN, \
+ "Member Port Bitmap"),
+
+#define SW_API_PT_VLAN_MEM_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_GET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_MEM_GET, SW_PBMP, sizeof(fal_pbmp_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Member Port Bitmap"),
+
+#define SW_API_PT_DEF_VID_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DEF_VID_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_VID_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID."), \
+ SW_PARAM_DEF(SW_API_PT_DEF_VID_SET, SW_UINT32, 4, SW_PARAM_IN, "Vlan Id"),
+
+#define SW_API_PT_DEF_VID_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DEF_VID_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_VID_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID."), \
+ SW_PARAM_DEF(SW_API_PT_DEF_VID_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Vlan Id"),
+
+#define SW_API_PT_FORCE_DEF_VID_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FORCE_DEF_VID_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FORCE_DEF_VID_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_FORCE_DEF_VID_SET, SW_ENABLE, 4, SW_PARAM_IN, "Force"),
+
+#define SW_API_PT_FORCE_DEF_VID_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FORCE_DEF_VID_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FORCE_DEF_VID_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_FORCE_DEF_VID_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Force"),
+
+#define SW_API_PT_FORCE_PORTVLAN_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FORCE_PORTVLAN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FORCE_PORTVLAN_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_FORCE_PORTVLAN_SET, SW_ENABLE, 4, SW_PARAM_IN, "Force"),
+
+#define SW_API_PT_FORCE_PORTVLAN_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FORCE_PORTVLAN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FORCE_PORTVLAN_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_FORCE_PORTVLAN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Force"),
+
+#define SW_API_PT_NESTVLAN_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_NESTVLAN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_NESTVLAN_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_NESTVLAN_SET, SW_ENABLE, 4, SW_PARAM_IN, "Nestvlan"),
+
+#define SW_API_PT_NESTVLAN_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_NESTVLAN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_NESTVLAN_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_NESTVLAN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Nestvlan"),
+
+#define SW_API_NESTVLAN_TPID_SET_DESC \
+ SW_PARAM_DEF(SW_API_NESTVLAN_TPID_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NESTVLAN_TPID_SET, SW_UINT32, 4, SW_PARAM_IN, "TPID"),
+
+#define SW_API_NESTVLAN_TPID_GET_DESC \
+ SW_PARAM_DEF(SW_API_NESTVLAN_TPID_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NESTVLAN_TPID_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "TPID"),
+
+#define SW_API_PT_IN_VLAN_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_IN_VLAN_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_IN_VLAN_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_IN_VLAN_MODE_SET, SW_INVLAN, sizeof(fal_pt_invlan_mode_t), SW_PARAM_IN, "Invlan"),
+
+#define SW_API_PT_IN_VLAN_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_IN_VLAN_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_IN_VLAN_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_IN_VLAN_MODE_GET, SW_INVLAN, sizeof(fal_pt_invlan_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "Invlan"),
+
+#define SW_API_PT_TLS_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_TLS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_TLS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_TLS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_PT_TLS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_TLS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_TLS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_TLS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+#define SW_API_PT_PRI_PROPAGATION_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_PRI_PROPAGATION_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_PRI_PROPAGATION_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_PRI_PROPAGATION_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_PT_PRI_PROPAGATION_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_PRI_PROPAGATION_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_PRI_PROPAGATION_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_PRI_PROPAGATION_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+#define SW_API_PT_DEF_SVID_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DEF_SVID_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_SVID_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_SVID_SET, SW_UINT32, 4, SW_PARAM_IN, "svid"),
+
+#define SW_API_PT_DEF_SVID_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DEF_SVID_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_SVID_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_SVID_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "svid"),
+
+#define SW_API_PT_DEF_CVID_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DEF_CVID_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_CVID_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_CVID_SET, SW_UINT32, 4, SW_PARAM_IN, "cvid"),
+
+#define SW_API_PT_DEF_CVID_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DEF_CVID_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_CVID_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_DEF_CVID_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "cvid"),
+
+#define SW_API_PT_VLAN_PROPAGATION_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_PROPAGATION_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_PROPAGATION_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_PROPAGATION_SET, SW_VLANPROPAGATION, sizeof(fal_vlan_propagation_mode_t), SW_PARAM_IN, "Vlan propagation"),
+
+#define SW_API_PT_VLAN_PROPAGATION_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_PROPAGATION_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_PROPAGATION_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_VLAN_PROPAGATION_GET, SW_VLANPROPAGATION, sizeof(fal_vlan_propagation_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "Vlan propagation"),
+
+#define SW_API_PT_VLAN_TRANS_ADD_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_ADD, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_ADD, SW_VLANTRANSLATION, sizeof(fal_vlan_trans_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Vlan Translation"),
+
+#define SW_API_PT_VLAN_TRANS_DEL_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_DEL, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_DEL, SW_VLANTRANSLATION, sizeof(fal_vlan_trans_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Vlan Translation"),
+
+#define SW_API_PT_VLAN_TRANS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_GET, SW_VLANTRANSLATION, sizeof(fal_vlan_trans_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Vlan Translation"),
+
+#define SW_API_QINQ_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_QINQ_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_QINQ_MODE_SET, SW_QINQMODE, sizeof(fal_qinq_mode_t), SW_PARAM_IN, "qinq mode"),
+
+#define SW_API_QINQ_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_QINQ_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_QINQ_MODE_GET, SW_QINQMODE, sizeof(fal_qinq_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "qinq mode"),
+
+#define SW_API_PT_QINQ_ROLE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_QINQ_ROLE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_QINQ_ROLE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_QINQ_ROLE_SET, SW_QINQROLE, sizeof(fal_qinq_port_role_t), SW_PARAM_IN, "qinq role"),
+
+#define SW_API_PT_QINQ_ROLE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_QINQ_ROLE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_QINQ_ROLE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_QINQ_ROLE_GET, SW_QINQROLE, sizeof(fal_qinq_port_role_t), SW_PARAM_PTR|SW_PARAM_OUT, "qinq role"),
+
+#define SW_API_PT_VLAN_TRANS_ITERATE_DESC \
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_ITERATE, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_ITERATE, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_ITERATE, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Iterator"),\
+ SW_PARAM_DEF(SW_API_PT_VLAN_TRANS_ITERATE, SW_VLANTRANSLATION, sizeof(fal_vlan_trans_entry_t), SW_PARAM_PTR|SW_PARAM_OUT, "Vlan Translation"),
+
+#define SW_API_PT_MAC_VLAN_XLT_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MAC_VLAN_XLT_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAC_VLAN_XLT_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAC_VLAN_XLT_SET, SW_ENABLE, 4, SW_PARAM_IN, "Status"),
+
+#define SW_API_PT_MAC_VLAN_XLT_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MAC_VLAN_XLT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAC_VLAN_XLT_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAC_VLAN_XLT_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"),
+
+#define SW_API_NETISOLATE_SET_DESC \
+ SW_PARAM_DEF(SW_API_NETISOLATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NETISOLATE_SET, SW_ENABLE, 4, SW_PARAM_IN, "enable"),
+
+#define SW_API_NETISOLATE_GET_DESC \
+ SW_PARAM_DEF(SW_API_NETISOLATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NETISOLATE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "enable"),
+
+#define SW_API_EG_FLTR_BYPASS_EN_SET_DESC \
+ SW_PARAM_DEF(SW_API_EG_FLTR_BYPASS_EN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_EG_FLTR_BYPASS_EN_SET, SW_ENABLE, 4, SW_PARAM_IN, "enable"),
+
+#define SW_API_EG_FLTR_BYPASS_EN_GET_DESC \
+ SW_PARAM_DEF(SW_API_EG_FLTR_BYPASS_EN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_EG_FLTR_BYPASS_EN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "enable"),
+
+#define SW_API_FDB_ADD_DESC \
+ SW_PARAM_DEF(SW_API_FDB_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_ADD, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Fdb Entry"),
+
+#define SW_API_FDB_DELALL_DESC \
+ SW_PARAM_DEF(SW_API_FDB_DELALL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_DELALL, SW_UINT32, 4, SW_PARAM_IN, "Flag"),
+
+#define SW_API_FDB_DELPORT_DESC \
+ SW_PARAM_DEF(SW_API_FDB_DELPORT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_DELPORT, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_FDB_DELPORT, SW_UINT32, 4, SW_PARAM_IN, "Flag"),
+
+#define SW_API_FDB_DELMAC_DESC \
+ SW_PARAM_DEF(SW_API_FDB_DELMAC, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_DELMAC, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Fdb Entry"),
+
+#define SW_API_FDB_FIRST_DESC \
+ SW_PARAM_DEF(SW_API_FDB_FIRST, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_FIRST, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_OUT, "Fdb Entry"),
+
+#define SW_API_FDB_NEXT_DESC \
+ SW_PARAM_DEF(SW_API_FDB_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_NEXT, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Fdb Entry"),
+
+#define SW_API_FDB_FIND_DESC \
+ SW_PARAM_DEF(SW_API_FDB_FIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_FIND, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Fdb Entry"),
+
+#define SW_API_FDB_PT_LEARN_SET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_SET, SW_ENABLE, 4, SW_PARAM_IN, "Learn"),
+
+#define SW_API_FDB_PT_LEARN_GET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Learn"),
+
+#define SW_API_FDB_AGE_CTRL_SET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_AGE_CTRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_AGE_CTRL_SET, SW_ENABLE, 4, SW_PARAM_IN, "Age"),
+
+#define SW_API_FDB_AGE_CTRL_GET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_AGE_CTRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_AGE_CTRL_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Age"),
+
+#define SW_API_FDB_VLAN_IVL_SVL_SET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_VLAN_IVL_SVL_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_VLAN_IVL_SVL_SET, SW_FDBSMODE, 4, SW_PARAM_IN, "Smode"),
+
+#define SW_API_FDB_VLAN_IVL_SVL_GET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_VLAN_IVL_SVL_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_VLAN_IVL_SVL_GET, SW_FDBSMODE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Smode"),
+
+#define SW_API_FDB_AGE_TIME_SET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_AGE_TIME_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_AGE_TIME_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Time"),
+
+#define SW_API_FDB_AGE_TIME_GET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_AGE_TIME_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_AGE_TIME_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Time"),
+
+#define SW_API_FDB_ITERATE_DESC \
+ SW_PARAM_DEF(SW_API_FDB_ITERATE, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_ITERATE, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Iterator"),\
+ SW_PARAM_DEF(SW_API_FDB_ITERATE, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_OUT, "Fdb Entry"),
+
+#define SW_API_FDB_EXTEND_NEXT_DESC \
+ SW_PARAM_DEF(SW_API_FDB_EXTEND_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_EXTEND_NEXT, SW_FDBOPRATION, sizeof(fal_fdb_op_t), SW_PARAM_PTR|SW_PARAM_IN, "OperateOption"),\
+ SW_PARAM_DEF(SW_API_FDB_EXTEND_NEXT, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Fdb Entry"),
+
+#define SW_API_FDB_EXTEND_FIRST_DESC \
+ SW_PARAM_DEF(SW_API_FDB_EXTEND_FIRST, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_EXTEND_FIRST, SW_FDBOPRATION, sizeof(fal_fdb_op_t), SW_PARAM_PTR|SW_PARAM_IN, "OperateOption"),\
+ SW_PARAM_DEF(SW_API_FDB_EXTEND_FIRST, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Fdb Entry"),
+
+#define SW_API_FDB_TRANSFER_DESC \
+ SW_PARAM_DEF(SW_API_FDB_TRANSFER, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_TRANSFER, SW_UINT32, 4, SW_PARAM_IN, "Old Port ID"),\
+ SW_PARAM_DEF(SW_API_FDB_TRANSFER, SW_UINT32, 4, SW_PARAM_IN, "New Port ID"),\
+ SW_PARAM_DEF(SW_API_FDB_TRANSFER, SW_UINT32, 4, SW_PARAM_IN, "FID"),\
+ SW_PARAM_DEF(SW_API_FDB_TRANSFER, SW_FDBOPRATION, sizeof(fal_fdb_op_t), SW_PARAM_PTR|SW_PARAM_IN, "OperateOption"),
+
+#define SW_API_PT_FDB_LEARN_LIMIT_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_LIMIT_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_LIMIT_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_LIMIT_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"), \
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_LIMIT_SET, SW_UINT32, 4, SW_PARAM_IN, "LimitCnt"),
+
+#define SW_API_PT_FDB_LEARN_LIMIT_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_LIMIT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_LIMIT_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_LIMIT_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"), \
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_LIMIT_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "LimitCnt"),
+
+#define SW_API_PT_FDB_LEARN_EXCEED_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_EXCEED_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_EXCEED_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_EXCEED_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "cmd"),
+
+#define SW_API_PT_FDB_LEARN_EXCEED_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_EXCEED_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_EXCEED_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_FDB_LEARN_EXCEED_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "cmd"),
+
+#define SW_API_FDB_LEARN_LIMIT_SET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_LEARN_LIMIT_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_FDB_LEARN_LIMIT_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"), \
+ SW_PARAM_DEF(SW_API_FDB_LEARN_LIMIT_SET, SW_UINT32, 4, SW_PARAM_IN, "LimitCnt"),
+
+#define SW_API_FDB_LEARN_LIMIT_GET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_LEARN_LIMIT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_LEARN_LIMIT_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"), \
+ SW_PARAM_DEF(SW_API_FDB_LEARN_LIMIT_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "LimitCnt"),
+
+#define SW_API_FDB_LEARN_EXCEED_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_LEARN_EXCEED_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_FDB_LEARN_EXCEED_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "cmd"),
+
+#define SW_API_FDB_LEARN_EXCEED_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_LEARN_EXCEED_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_FDB_LEARN_EXCEED_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "cmd"),
+
+#define SW_API_FDB_RESV_ADD_DESC \
+ SW_PARAM_DEF(SW_API_FDB_RESV_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_RESV_ADD, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Fdb Resv Entry"),
+
+#define SW_API_FDB_RESV_DEL_DESC \
+ SW_PARAM_DEF(SW_API_FDB_RESV_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_RESV_DEL, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Fdb Resv Entry"),
+
+#define SW_API_FDB_RESV_FIND_DESC \
+ SW_PARAM_DEF(SW_API_FDB_RESV_FIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_RESV_FIND, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Fdb Resv Entry"),
+
+#define SW_API_FDB_RESV_ITERATE_DESC \
+ SW_PARAM_DEF(SW_API_FDB_RESV_ITERATE, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_RESV_ITERATE, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Iterator"),\
+ SW_PARAM_DEF(SW_API_FDB_RESV_ITERATE, SW_FDBENTRY, sizeof(fal_fdb_entry_t), SW_PARAM_PTR|SW_PARAM_OUT, "Fdb Resv Entry"),
+
+#define SW_API_FDB_PT_LEARN_STATIC_SET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_STATIC_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_STATIC_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_STATIC_SET, SW_ENABLE, 4, SW_PARAM_IN, "LearnStatic"),
+
+#define SW_API_FDB_PT_LEARN_STATIC_GET_DESC \
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_STATIC_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_STATIC_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PT_LEARN_STATIC_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "LearnStatic"),
+
+#define SW_API_FDB_PORT_ADD_DESC \
+ SW_PARAM_DEF(SW_API_FDB_PORT_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PORT_ADD, SW_UINT32, 4, SW_PARAM_IN, "FID"),\
+ SW_PARAM_DEF(SW_API_FDB_PORT_ADD, SW_MACADDR, sizeof(fal_mac_addr_t), SW_PARAM_PTR|SW_PARAM_IN, "Address"),\
+ SW_PARAM_DEF(SW_API_FDB_PORT_ADD, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),
+
+#define SW_API_FDB_PORT_DEL_DESC \
+ SW_PARAM_DEF(SW_API_FDB_PORT_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_FDB_PORT_DEL, SW_UINT32, 4, SW_PARAM_IN, "FID"),\
+ SW_PARAM_DEF(SW_API_FDB_PORT_DEL, SW_MACADDR, sizeof(fal_mac_addr_t), SW_PARAM_PTR|SW_PARAM_IN, "Address"),\
+ SW_PARAM_DEF(SW_API_FDB_PORT_DEL, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),
+
+
+
+
+#define SW_API_ACL_LIST_CREAT_DESC \
+ SW_PARAM_DEF(SW_API_ACL_LIST_CREAT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_CREAT, SW_UINT32, 4, SW_PARAM_IN, "List ID"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_CREAT, SW_UINT32, 4, SW_PARAM_IN, "List Priority"),
+
+#define SW_API_ACL_LIST_DESTROY_DESC \
+ SW_PARAM_DEF(SW_API_ACL_LIST_DESTROY, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_DESTROY, SW_UINT32, 4, SW_PARAM_IN, "List ID"),
+
+#define SW_API_ACL_RULE_ADD_DESC \
+ SW_PARAM_DEF(SW_API_ACL_RULE_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_ADD, SW_UINT32, 4, SW_PARAM_IN, "List ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_ADD, SW_UINT32, 4, SW_PARAM_IN, "Rule ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_ADD, SW_UINT32, 4, SW_PARAM_IN, "Rule Number"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_ADD, SW_ACLRULE, sizeof(fal_acl_rule_t), SW_PARAM_PTR|SW_PARAM_IN, "Rule"),
+
+#define SW_API_ACL_RULE_DELETE_DESC \
+ SW_PARAM_DEF(SW_API_ACL_RULE_DELETE, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_DELETE, SW_UINT32, 4, SW_PARAM_IN, "List ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_DELETE, SW_UINT32, 4, SW_PARAM_IN, "Rule ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_DELETE, SW_UINT32, 4, SW_PARAM_IN, "Rule Number"),
+
+#define SW_API_ACL_RULE_QUERY_DESC \
+ SW_PARAM_DEF(SW_API_ACL_RULE_QUERY, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_QUERY, SW_UINT32, 4, SW_PARAM_IN, "List ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_QUERY, SW_UINT32, 4, SW_PARAM_IN, "Rule ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_QUERY, SW_ACLRULE, sizeof(fal_acl_rule_t), SW_PARAM_PTR|SW_PARAM_OUT, "Rule"),
+
+#define SW_API_ACL_LIST_BIND_DESC \
+ SW_PARAM_DEF(SW_API_ACL_LIST_BIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_BIND, SW_UINT32, 4, SW_PARAM_IN, "List ID"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_BIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_BIND, SW_UINT32, 4, SW_PARAM_IN, "List ID"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_BIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),
+
+#define SW_API_ACL_LIST_UNBIND_DESC \
+ SW_PARAM_DEF(SW_API_ACL_LIST_UNBIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_UNBIND, SW_UINT32, 4, SW_PARAM_IN, "List ID"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_UNBIND, SW_UINT32, 4, SW_PARAM_IN, "Direction"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_UNBIND, SW_UINT32, 4, SW_PARAM_IN, "Object Type"),\
+ SW_PARAM_DEF(SW_API_ACL_LIST_UNBIND, SW_UINT32, 4, SW_PARAM_IN, "Object Index"),
+
+#define SW_API_ACL_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_ACL_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Status"),
+
+#define SW_API_ACL_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_ACL_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"),
+
+#define SW_API_ACL_LIST_DUMP_DESC \
+ SW_PARAM_DEF(SW_API_ACL_LIST_DUMP, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),
+
+#define SW_API_ACL_RULE_DUMP_DESC \
+ SW_PARAM_DEF(SW_API_ACL_RULE_DUMP, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),
+
+#define SW_API_ACL_PT_UDF_PROFILE_SET_DESC \
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_SET, SW_ACL_UDF_TYPE, sizeof(fal_acl_udf_type_t), SW_PARAM_IN, "udf_type"),\
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_SET, SW_UINT32, 4, SW_PARAM_IN, "udf_offset"),\
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_SET, SW_UINT32, 4, SW_PARAM_IN, "udf_length"),
+
+#define SW_API_ACL_PT_UDF_PROFILE_GET_DESC \
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_GET, SW_ACL_UDF_TYPE, sizeof(fal_acl_udf_type_t), SW_PARAM_IN, "udf_type"),\
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "udf_offset"),\
+ SW_PARAM_DEF(SW_API_ACL_PT_UDF_PROFILE_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "udf_length"),
+
+#define SW_API_ACL_RULE_ACTIVE_DESC \
+ SW_PARAM_DEF(SW_API_ACL_RULE_ACTIVE, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_ACTIVE, SW_UINT32, 4, SW_PARAM_IN, "List ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_ACTIVE, SW_UINT32, 4, SW_PARAM_IN, "Rule ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_ACTIVE, SW_UINT32, 4, SW_PARAM_IN, "Rule Number"),
+
+#define SW_API_ACL_RULE_DEACTIVE_DESC \
+ SW_PARAM_DEF(SW_API_ACL_RULE_DEACTIVE, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_DEACTIVE, SW_UINT32, 4, SW_PARAM_IN, "List ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_DEACTIVE, SW_UINT32, 4, SW_PARAM_IN, "Rule ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_DEACTIVE, SW_UINT32, 4, SW_PARAM_IN, "Rule Number"),
+
+#define SW_API_ACL_RULE_SRC_FILTER_STS_SET_DESC \
+ SW_PARAM_DEF(SW_API_ACL_RULE_SRC_FILTER_STS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_SRC_FILTER_STS_SET, SW_UINT32, 4, SW_PARAM_IN, "Rule ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_SRC_FILTER_STS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_ACL_RULE_SRC_FILTER_STS_GET_DESC \
+ SW_PARAM_DEF(SW_API_ACL_RULE_SRC_FILTER_STS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_SRC_FILTER_STS_GET, SW_UINT32, 4, SW_PARAM_IN, "Rule ID"),\
+ SW_PARAM_DEF(SW_API_ACL_RULE_SRC_FILTER_STS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+#define SW_API_QOS_SCH_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_SCH_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_SCH_MODE_SET, SW_SCH, sizeof(fal_sch_mode_t), SW_PARAM_IN, "Schedule mode"),\
+ SW_PARAM_DEF(SW_API_QOS_SCH_MODE_SET, SW_UINT_A, 16, SW_PARAM_PTR|SW_PARAM_IN, "Weight"),
+
+#define SW_API_QOS_SCH_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_SCH_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_SCH_MODE_GET, SW_SCH, sizeof(fal_sch_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "Schedule mode"),\
+ SW_PARAM_DEF(SW_API_QOS_SCH_MODE_GET, SW_UINT_A, 16, SW_PARAM_PTR|SW_PARAM_OUT, "Weight"),
+
+#define SW_API_QOS_QU_TX_BUF_ST_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_ST_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_ST_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_ST_SET, SW_ENABLE, 4, SW_PARAM_IN, "Buffer limit"),
+
+#define SW_API_QOS_QU_TX_BUF_ST_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_ST_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_ST_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_ST_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Buffer limit"),
+
+#define SW_API_QOS_QU_TX_BUF_NR_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_IN, "Queue ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Buffer Number"),
+
+#define SW_API_QOS_QU_TX_BUF_NR_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_IN, "Queue ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QU_TX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Buffer Number"),
+
+#define SW_API_QOS_PT_TX_BUF_ST_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_ST_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_ST_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_ST_SET, SW_ENABLE, 4, SW_PARAM_IN, "Buffer limit"),
+
+#define SW_API_QOS_PT_TX_BUF_ST_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_ST_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_ST_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_ST_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Buffer limit"),
+
+#define SW_API_QOS_PT_RED_EN_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_RED_EN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_RED_EN_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_RED_EN_SET, SW_ENABLE, 4, SW_PARAM_IN, "enable"),
+
+#define SW_API_QOS_PT_RED_EN_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_RED_EN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_RED_EN_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_RED_EN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "enable"),
+
+#define SW_API_QOS_PT_TX_BUF_NR_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Buffer Number"),
+
+#define SW_API_QOS_PT_TX_BUF_NR_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_TX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Buffer Number"),
+
+#define SW_API_QOS_PT_RX_BUF_NR_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_RX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_RX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_RX_BUF_NR_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Buffer Number"),
+
+#define SW_API_QOS_PT_RX_BUF_NR_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_RX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_RX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_RX_BUF_NR_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Buffer Number"),
+
+#define SW_API_COSMAP_UP_QU_SET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_QU_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_COSMAP_UP_QU_SET, SW_UINT32, 4, SW_PARAM_IN, "Dot1p"),\
+ SW_PARAM_DEF(SW_API_COSMAP_UP_QU_SET, SW_UINT32, 4, SW_PARAM_IN, "Queue"),
+
+#define SW_API_COSMAP_UP_QU_GET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_QU_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_COSMAP_UP_QU_GET, SW_UINT32, 4, SW_PARAM_IN, "Dot1p"),\
+ SW_PARAM_DEF(SW_API_COSMAP_UP_QU_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Queue"),
+
+#define SW_API_COSMAP_DSCP_QU_SET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_QU_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_QU_SET, SW_UINT32, 4, SW_PARAM_IN, "DSCP"),\
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_QU_SET, SW_UINT32, 4, SW_PARAM_IN, "Queue"),
+
+#define SW_API_COSMAP_DSCP_QU_GET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_QU_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_QU_GET, SW_UINT32, 4, SW_PARAM_IN, "DSCP"),\
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_QU_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Queue"),
+
+#define SW_API_QOS_PT_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_SET, SW_QOS, sizeof(fal_qos_mode_t), SW_PARAM_IN, "Qos mode"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_QOS_PT_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_GET, SW_QOS, sizeof(fal_qos_mode_t), SW_PARAM_IN, "Qos mode"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+#define SW_API_QOS_PT_MODE_PRI_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_PRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_PRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_PRI_SET, SW_QOS, sizeof(fal_qos_mode_t), SW_PARAM_IN, "Qos mode"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_PRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Priority"),
+
+#define SW_API_QOS_PT_MODE_PRI_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_PRI_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_PRI_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_PRI_GET, SW_QOS, sizeof(fal_qos_mode_t), SW_PARAM_IN, "Qos mode"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_MODE_PRI_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Priority"),
+
+#define SW_API_QOS_PORT_DEF_UP_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PORT_DEF_UP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_DEF_UP_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_DEF_UP_SET, SW_UINT32, 4, SW_PARAM_IN, "default up"),
+
+#define SW_API_QOS_PORT_DEF_UP_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PORT_DEF_UP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_DEF_UP_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_DEF_UP_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "default up"),
+
+#define SW_API_QOS_PORT_SCH_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PORT_SCH_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_SCH_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_SCH_MODE_SET, SW_SCH, sizeof(fal_sch_mode_t), SW_PARAM_IN, "Schedule mode"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_SCH_MODE_SET, SW_UINT_A, 24, SW_PARAM_PTR|SW_PARAM_IN, "Weight"),
+
+#define SW_API_QOS_PORT_SCH_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PORT_SCH_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_SCH_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_SCH_MODE_GET, SW_SCH, sizeof(fal_sch_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "Schedule mode"),\
+ SW_PARAM_DEF(SW_API_QOS_PORT_SCH_MODE_GET, SW_UINT_A, 24, SW_PARAM_PTR|SW_PARAM_OUT, "Weight"),
+
+#define SW_API_QOS_PT_DEF_SPRI_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_SPRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_SPRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_SPRI_SET, SW_UINT32, 4, SW_PARAM_IN, "default spri"),
+
+#define SW_API_QOS_PT_DEF_SPRI_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_SPRI_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_SPRI_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_SPRI_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "default spri"),
+
+#define SW_API_QOS_PT_DEF_CPRI_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_CPRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_CPRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_CPRI_SET, SW_UINT32, 4, SW_PARAM_IN, "default cpri"),
+
+
+#define SW_API_QOS_PT_FORCE_SPRI_ST_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_SPRI_ST_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_SPRI_ST_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_SPRI_ST_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_QOS_PT_FORCE_SPRI_ST_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_SPRI_ST_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_SPRI_ST_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_SPRI_ST_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+#define SW_API_QOS_PT_FORCE_CPRI_ST_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_CPRI_ST_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_CPRI_ST_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_CPRI_ST_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_QOS_PT_FORCE_CPRI_ST_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_CPRI_ST_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_CPRI_ST_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_FORCE_CPRI_ST_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+
+
+#define SW_API_QOS_PT_DEF_CPRI_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_CPRI_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_CPRI_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_PT_DEF_CPRI_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "default cpri"),
+
+
+#define SW_API_QOS_QUEUE_REMARK_SET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_SET, SW_UINT32, 4, SW_PARAM_IN, "Queue ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_SET, SW_UINT32, 4, SW_PARAM_IN, "Table ID"), \
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_QOS_QUEUE_REMARK_GET_DESC \
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_GET, SW_UINT32, 4, SW_PARAM_IN, "Queue ID"),\
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Table ID"), \
+ SW_PARAM_DEF(SW_API_QOS_QUEUE_REMARK_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+
+
+
+#define SW_API_PT_IGMPS_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_IGMPS_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_PT_IGMPS_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_IGMPS_MODE_SET, SW_ENABLE, 4, SW_PARAM_IN, "IGMP snooping"),
+
+#define SW_API_PT_IGMPS_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_IGMPS_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_IGMPS_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_IGMPS_MODE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "IGMP snooping"),
+
+#define SW_API_IGMP_MLD_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_MLD_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_MLD_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "cmd"),
+
+#define SW_API_IGMP_MLD_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_MLD_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_MLD_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "cmd"),
+
+#define SW_API_IGMP_PT_JOIN_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_PT_JOIN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_PT_JOIN_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_PT_JOIN_SET, SW_ENABLE, 4, SW_PARAM_IN, "Join"),
+
+#define SW_API_IGMP_PT_JOIN_GET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_PT_JOIN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_PT_JOIN_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_PT_JOIN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Join"),
+
+#define SW_API_IGMP_PT_LEAVE_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_PT_LEAVE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_PT_LEAVE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_PT_LEAVE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Leave"),
+
+#define SW_API_IGMP_PT_LEAVE_GET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_PT_LEAVE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_PT_LEAVE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_PT_LEAVE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Leave"),
+
+#define SW_API_IGMP_RP_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_RP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_RP_SET, SW_PBMP, sizeof(fal_pbmp_t), SW_PARAM_IN, "Ports"),
+
+#define SW_API_IGMP_RP_GET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_RP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_RP_GET, SW_PBMP, sizeof(fal_pbmp_t), SW_PARAM_PTR|SW_PARAM_OUT, "Ports"),
+
+#define SW_API_IGMP_ENTRY_CREAT_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_CREAT_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_CREAT_SET, SW_ENABLE, 4, SW_PARAM_IN, "creat Entry"),
+
+#define SW_API_IGMP_ENTRY_CREAT_GET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_CREAT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_CREAT_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "creat Entry"),
+
+#define SW_API_IGMP_ENTRY_STATIC_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_STATIC_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_STATIC_SET, SW_ENABLE, 4, SW_PARAM_IN, "static"),
+
+#define SW_API_IGMP_ENTRY_STATIC_GET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_STATIC_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_STATIC_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "static"),
+
+#define SW_API_IGMP_ENTRY_LEAKY_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_LEAKY_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_LEAKY_SET, SW_ENABLE, 4, SW_PARAM_IN, "leaky"),
+
+#define SW_API_IGMP_ENTRY_LEAKY_GET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_LEAKY_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_LEAKY_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "leaky"),
+
+#define SW_API_IGMP_ENTRY_V3_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_V3_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_V3_SET, SW_ENABLE, 4, SW_PARAM_IN, "version3"),
+
+#define SW_API_IGMP_ENTRY_V3_GET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_V3_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_V3_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "version3"),
+
+#define SW_API_IGMP_ENTRY_QUEUE_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_QUEUE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_QUEUE_SET, SW_ENABLE, 4, SW_PARAM_IN, "queue"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_QUEUE_SET, SW_UINT32, 4, SW_PARAM_IN, "queue_id"),
+
+#define SW_API_IGMP_ENTRY_QUEUE_GET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_QUEUE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_QUEUE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "queue"), \
+ SW_PARAM_DEF(SW_API_IGMP_ENTRY_QUEUE_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "queue_id"),
+
+#define SW_API_PT_IGMP_LEARN_LIMIT_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_LIMIT_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_LIMIT_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_LIMIT_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"), \
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_LIMIT_SET, SW_UINT32, 4, SW_PARAM_IN, "LimitCnt"),
+
+#define SW_API_PT_IGMP_LEARN_LIMIT_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_LIMIT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_LIMIT_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_LIMIT_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"), \
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_LIMIT_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "LimitCnt"),
+
+#define SW_API_PT_IGMP_LEARN_EXCEED_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_EXCEED_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_EXCEED_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_EXCEED_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "cmd"),
+
+#define SW_API_PT_IGMP_LEARN_EXCEED_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_EXCEED_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_EXCEED_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_PT_IGMP_LEARN_EXCEED_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "cmd"),
+
+#define SW_API_IGMP_SG_ENTRY_SET_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_SG_ENTRY_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_SG_ENTRY_SET, SW_SGENTRY, sizeof(fal_igmp_sg_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "entry"),
+
+#define SW_API_IGMP_SG_ENTRY_CLEAR_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_SG_ENTRY_CLEAR, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_SG_ENTRY_CLEAR, SW_SGENTRY, sizeof(fal_igmp_sg_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "entry"),
+
+#define SW_API_IGMP_SG_ENTRY_SHOW_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_SG_ENTRY_SHOW, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),
+
+#define SW_API_IGMP_SG_ENTRY_QUERY_DESC \
+ SW_PARAM_DEF(SW_API_IGMP_SG_ENTRY_QUERY, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IGMP_SG_ENTRY_QUERY, SW_SGINFOENTRY, sizeof(fal_igmp_sg_info_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "info"),
+
+
+#define SW_API_UC_LEAKY_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_UC_LEAKY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_UC_LEAKY_MODE_SET, SW_LEAKY, sizeof(fal_leaky_ctrl_mode_t), SW_PARAM_IN, "Uc Leaky mode"),
+
+#define SW_API_UC_LEAKY_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_UC_LEAKY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_UC_LEAKY_MODE_GET, SW_LEAKY, sizeof(fal_leaky_ctrl_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "Uc Leaky mode"),
+
+#define SW_API_MC_LEAKY_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_MC_LEAKY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MC_LEAKY_MODE_SET, SW_LEAKY, sizeof(fal_leaky_ctrl_mode_t), SW_PARAM_IN, "Mc Leaky mode"),
+
+#define SW_API_MC_LEAKY_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_MC_LEAKY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MC_LEAKY_MODE_GET, SW_LEAKY, sizeof(fal_leaky_ctrl_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "Mc Leaky mode"),
+
+#define SW_API_ARP_LEAKY_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_ARP_LEAKY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_ARP_LEAKY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_ARP_LEAKY_MODE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Arp leaky"),
+
+#define SW_API_ARP_LEAKY_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_ARP_LEAKY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_ARP_LEAKY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_ARP_LEAKY_MODE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Arp leaky"),
+
+#define SW_API_PT_UC_LEAKY_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_UC_LEAKY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_UC_LEAKY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_UC_LEAKY_MODE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Port Unicast leaky"),
+
+#define SW_API_PT_UC_LEAKY_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_UC_LEAKY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_UC_LEAKY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_UC_LEAKY_MODE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Port Uc leaky"),
+
+#define SW_API_PT_MC_LEAKY_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MC_LEAKY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MC_LEAKY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MC_LEAKY_MODE_SET, SW_ENABLE, 4, SW_PARAM_IN, "Port Multicast leaky"),
+
+#define SW_API_PT_MC_LEAKY_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MC_LEAKY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MC_LEAKY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MC_LEAKY_MODE_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Port Mc leaky"),
+
+
+
+#define SW_API_MIRROR_ANALY_PT_SET_DESC \
+ SW_PARAM_DEF(SW_API_MIRROR_ANALY_PT_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_ANALY_PT_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),
+
+#define SW_API_MIRROR_ANALY_PT_GET_DESC \
+ SW_PARAM_DEF(SW_API_MIRROR_ANALY_PT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_ANALY_PT_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Port ID"),
+
+#define SW_API_MIRROR_IN_PT_SET_DESC \
+ SW_PARAM_DEF(SW_API_MIRROR_IN_PT_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_IN_PT_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_IN_PT_SET, SW_ENABLE, 4, SW_PARAM_IN, "Ingerss mirror"),
+
+#define SW_API_MIRROR_IN_PT_GET_DESC \
+ SW_PARAM_DEF(SW_API_MIRROR_IN_PT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_IN_PT_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_IN_PT_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Ingeress mirror"),
+
+#define SW_API_MIRROR_EG_PT_SET_DESC \
+ SW_PARAM_DEF(SW_API_MIRROR_EG_PT_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_EG_PT_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_EG_PT_SET, SW_ENABLE, 4, SW_PARAM_IN, "Egerss mirror"),
+
+#define SW_API_MIRROR_EG_PT_GET_DESC \
+ SW_PARAM_DEF(SW_API_MIRROR_EG_PT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_EG_PT_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_MIRROR_EG_PT_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Egeress mirror"),
+
+
+
+#define SW_API_RATE_QU_EGRL_SET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Queue ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Speed"),\
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_SET, SW_ENABLE, 4, SW_PARAM_IN, "Rate limit"),
+
+#define SW_API_RATE_QU_EGRL_GET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Queue ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Speed"),\
+ SW_PARAM_DEF(SW_API_RATE_QU_EGRL_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Rate limit"),
+
+#define SW_API_RATE_PT_EGRL_SET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PT_EGRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_EGRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_EGRL_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Speed"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_EGRL_SET, SW_ENABLE, 4, SW_PARAM_IN, "Rate limit"),
+
+#define SW_API_RATE_PT_EGRL_GET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PT_EGRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_EGRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_EGRL_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Speed"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_EGRL_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Rate limit"),
+
+#define SW_API_RATE_PT_INRL_SET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PT_INRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_INRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_INRL_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Speed"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_INRL_SET, SW_ENABLE, 4, SW_PARAM_IN, "Rate limit"),
+
+#define SW_API_RATE_PT_INRL_GET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PT_INRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_INRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_INRL_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Speed"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_INRL_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Rate limit"),
+
+#define SW_API_STORM_CTRL_FRAME_SET_DESC \
+ SW_PARAM_DEF(SW_API_STORM_CTRL_FRAME_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_FRAME_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_FRAME_SET, SW_STORM, sizeof(fal_storm_type_t), SW_PARAM_IN, "Frame type"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_FRAME_SET, SW_ENABLE, 4, SW_PARAM_IN, "strom contrl"),
+
+#define SW_API_STORM_CTRL_FRAME_GET_DESC \
+ SW_PARAM_DEF(SW_API_STORM_CTRL_FRAME_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_FRAME_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_FRAME_GET, SW_STORM, sizeof(fal_storm_type_t), SW_PARAM_IN, "Frame type"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_FRAME_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "strom contrl"),
+
+#define SW_API_STORM_CTRL_RATE_SET_DESC \
+ SW_PARAM_DEF(SW_API_STORM_CTRL_RATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_RATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_RATE_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Speed"),
+
+#define SW_API_STORM_CTRL_RATE_GET_DESC \
+ SW_PARAM_DEF(SW_API_STORM_CTRL_RATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_RATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_STORM_CTRL_RATE_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Speed"),
+
+#define SW_API_RATE_PORT_POLICER_SET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PORT_POLICER_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PORT_POLICER_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PORT_POLICER_SET, SW_INGPOLICER, sizeof(fal_port_policer_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Policer"),
+
+#define SW_API_RATE_PORT_POLICER_GET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PORT_POLICER_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PORT_POLICER_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PORT_POLICER_GET, SW_INGPOLICER, sizeof(fal_port_policer_t), SW_PARAM_PTR|SW_PARAM_OUT, "Policer"),
+
+#define SW_API_RATE_PORT_SHAPER_SET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PORT_SHAPER_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PORT_SHAPER_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PORT_SHAPER_SET, SW_ENABLE, 4, SW_PARAM_IN, "Status"), \
+ SW_PARAM_DEF(SW_API_RATE_PORT_SHAPER_SET, SW_EGSHAPER, sizeof(fal_egress_shaper_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Shaper"),
+
+#define SW_API_RATE_PORT_SHAPER_GET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PORT_SHAPER_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PORT_SHAPER_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PORT_SHAPER_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"), \
+ SW_PARAM_DEF(SW_API_RATE_PORT_SHAPER_GET, SW_EGSHAPER, sizeof(fal_egress_shaper_t), SW_PARAM_PTR|SW_PARAM_OUT, "Shaper"),
+
+#define SW_API_RATE_QUEUE_SHAPER_SET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_SET, SW_UINT32, 4, SW_PARAM_IN, "Queue ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"), \
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_SET, SW_EGSHAPER, sizeof(fal_egress_shaper_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Shaper"),
+
+#define SW_API_RATE_QUEUE_SHAPER_GET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_GET, SW_UINT32, 4, SW_PARAM_IN, "Queue ID"),\
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"), \
+ SW_PARAM_DEF(SW_API_RATE_QUEUE_SHAPER_GET, SW_EGSHAPER, sizeof(fal_egress_shaper_t), SW_PARAM_PTR|SW_PARAM_OUT, "Shaper"),
+
+#define SW_API_RATE_ACL_POLICER_SET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_ACL_POLICER_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_ACL_POLICER_SET, SW_UINT32, 4, SW_PARAM_IN, "Policer ID"),\
+ SW_PARAM_DEF(SW_API_RATE_ACL_POLICER_SET, SW_ACLPOLICER, sizeof(fal_acl_policer_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Policer"),
+
+#define SW_API_RATE_ACL_POLICER_GET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_ACL_POLICER_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_ACL_POLICER_GET, SW_UINT32, 4, SW_PARAM_IN, "Policer ID"),\
+ SW_PARAM_DEF(SW_API_RATE_ACL_POLICER_GET, SW_ACLPOLICER, sizeof(fal_acl_policer_t), SW_PARAM_PTR|SW_PARAM_OUT, "Policer"),
+
+#define SW_API_RATE_PT_ADDRATEBYTE_SET_DESC\
+ SW_PARAM_DEF(SW_API_RATE_PT_ADDRATEBYTE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_ADDRATEBYTE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_ADDRATEBYTE_SET, SW_UINT32, 4, SW_PARAM_IN, "AddRateByte"),
+
+#define SW_API_RATE_PT_ADDRATEBYTE_GET_DESC\
+ SW_PARAM_DEF(SW_API_RATE_PT_ADDRATEBYTE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_ADDRATEBYTE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_ADDRATEBYTE_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "AddRateByte"),
+
+#define SW_API_RATE_PT_GOL_FLOW_EN_SET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PT_GOL_FLOW_EN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_GOL_FLOW_EN_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_GOL_FLOW_EN_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_RATE_PT_GOL_FLOW_EN_GET_DESC \
+ SW_PARAM_DEF(SW_API_RATE_PT_GOL_FLOW_EN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_GOL_FLOW_EN_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_RATE_PT_GOL_FLOW_EN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+#define SW_API_STP_PT_STATE_SET_DESC \
+ SW_PARAM_DEF(SW_API_STP_PT_STATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_STP_PT_STATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Spaning tree ID"),\
+ SW_PARAM_DEF(SW_API_STP_PT_STATE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_STP_PT_STATE_SET, SW_STP, sizeof(fal_stp_state_t), SW_PARAM_IN, "Port State"),
+
+#define SW_API_STP_PT_STATE_GET_DESC \
+ SW_PARAM_DEF(SW_API_STP_PT_STATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_STP_PT_STATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Spaning tree ID"),\
+ SW_PARAM_DEF(SW_API_STP_PT_STATE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),\
+ SW_PARAM_DEF(SW_API_STP_PT_STATE_GET, SW_STP, sizeof(fal_stp_state_t), SW_PARAM_PTR|SW_PARAM_OUT, "Port State"),
+
+
+
+
+#define SW_API_PT_MIB_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MIB_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MIB_GET, SW_UINT32, 4, SW_PARAM_IN, "Port No."), \
+ SW_PARAM_DEF(SW_API_PT_MIB_GET, SW_MIB, sizeof(fal_mib_info_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "MIB info"),
+
+#define SW_API_MIB_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_MIB_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIB_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "MIB status"),
+
+#define SW_API_MIB_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_MIB_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIB_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "MIB status"),
+
+#define SW_API_PT_MIB_FLUSH_COUNTERS_DESC\
+ SW_PARAM_DEF(SW_API_PT_MIB_FLUSH_COUNTERS, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MIB_FLUSH_COUNTERS, SW_UINT32, 4, SW_PARAM_IN, "Port No."),
+
+#define SW_API_MIB_CPU_KEEP_SET_DESC \
+ SW_PARAM_DEF(SW_API_MIB_CPU_KEEP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIB_CPU_KEEP_SET, SW_ENABLE, 4, SW_PARAM_IN, "CPU_KEEP Set"),
+
+#define SW_API_MIB_CPU_KEEP_GET_DESC \
+ SW_PARAM_DEF(SW_API_MIB_CPU_KEEP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MIB_CPU_KEEP_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "CPU_KEEP Get"),
+
+
+
+
+
+
+#define SW_API_ARP_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_ARP_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_ARP_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "ARP acknowledge"),
+
+#define SW_API_ARP_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_ARP_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_ARP_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "ARP acknowledge"),
+
+#define SW_API_FRAME_MAX_SIZE_SET_DESC \
+ SW_PARAM_DEF(SW_API_FRAME_MAX_SIZE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_FRAME_MAX_SIZE_SET, SW_UINT32, 4, SW_PARAM_IN, "Frame Size"),
+
+#define SW_API_FRAME_MAX_SIZE_GET_DESC \
+ SW_PARAM_DEF(SW_API_FRAME_MAX_SIZE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_FRAME_MAX_SIZE_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Frame Size"),
+
+#define SW_API_PT_UNK_SA_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_UNK_SA_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_SA_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_SA_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "Forwarding"),
+
+#define SW_API_PT_UNK_SA_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_UNK_SA_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_SA_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_SA_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "Forwarding"),
+
+#define SW_API_PT_UNK_UC_FILTER_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_UNK_UC_FILTER_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_UC_FILTER_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_UC_FILTER_SET, SW_ENABLE, 4, SW_PARAM_IN, "Filter"),
+
+#define SW_API_PT_UNK_UC_FILTER_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_UNK_UC_FILTER_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_UC_FILTER_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_UC_FILTER_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Filter"),
+
+#define SW_API_PT_UNK_MC_FILTER_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_UNK_MC_FILTER_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_MC_FILTER_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_MC_FILTER_SET, SW_ENABLE, 4, SW_PARAM_IN, "Filter"),
+
+#define SW_API_PT_UNK_MC_FILTER_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_UNK_MC_FILTER_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_MC_FILTER_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_UNK_MC_FILTER_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Filter"),
+
+#define SW_API_PT_BC_FILTER_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_BC_FILTER_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_BC_FILTER_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_BC_FILTER_SET, SW_ENABLE, 4, SW_PARAM_IN, "Filter"),
+
+#define SW_API_PT_BC_FILTER_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_BC_FILTER_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_BC_FILTER_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_BC_FILTER_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Filter"),
+
+#define SW_API_CPU_PORT_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_CPU_PORT_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_CPU_PORT_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Cpu port"),
+
+#define SW_API_CPU_PORT_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_CPU_PORT_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_CPU_PORT_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Cpu port"),
+
+#define SW_API_BC_TO_CPU_PORT_SET_DESC \
+ SW_PARAM_DEF(SW_API_BC_TO_CPU_PORT_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_BC_TO_CPU_PORT_SET, SW_ENABLE, 4, SW_PARAM_IN, "ToCpu"),
+
+#define SW_API_BC_TO_CPU_PORT_GET_DESC \
+ SW_PARAM_DEF(SW_API_BC_TO_CPU_PORT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_BC_TO_CPU_PORT_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "ToCpu"),
+
+#define SW_API_PPPOE_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "Forwarding"),
+
+#define SW_API_PPPOE_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "Forwarding"),
+
+#define SW_API_PPPOE_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "PPPOE"),
+
+#define SW_API_PPPOE_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "PPPOE"),
+
+#define SW_API_PT_DHCP_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DHCP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DHCP_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_DHCP_SET, SW_ENABLE, 4, SW_PARAM_IN, "DHCP"),
+
+#define SW_API_PT_DHCP_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_DHCP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_DHCP_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_DHCP_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "DHCP"),
+
+#define SW_API_ARP_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_ARP_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_ARP_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "cmd"),
+
+#define SW_API_ARP_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_ARP_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_ARP_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "cmd"),
+
+#define SW_API_EAPOL_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_EAPOL_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_EAPOL_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "cmd"),
+
+#define SW_API_EAPOL_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_EAPOL_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_EAPOL_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "cmd"),
+
+#define SW_API_PPPOE_SESSION_ADD_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_ADD, SW_UINT32, 4, SW_PARAM_IN, "Session ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_ADD, SW_ENABLE, 4, SW_PARAM_IN, "StripHdr"),
+
+#define SW_API_PPPOE_SESSION_DEL_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_DEL, SW_UINT32, 4, SW_PARAM_IN, "Session ID"),
+
+#define SW_API_PPPOE_SESSION_GET_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_GET, SW_UINT32, 4, SW_PARAM_IN, "Session ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "StripHdr"),
+
+#define SW_API_EAPOL_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_EAPOL_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_EAPOL_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_EAPOL_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_EAPOL_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_EAPOL_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_EAPOL_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_EAPOL_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+#define SW_API_RIPV1_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_RIPV1_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_RIPV1_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_RIPV1_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_RIPV1_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_RIPV1_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+#define SW_API_PT_ARP_REQ_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_ARP_REQ_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_ARP_REQ_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_ARP_REQ_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "ARP Req acknowledge"),
+
+#define SW_API_PT_ARP_REQ_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_ARP_REQ_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_ARP_REQ_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_ARP_REQ_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "ARP Req acknowledge"),
+
+#define SW_API_PT_ARP_ACK_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_ARP_ACK_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_ARP_ACK_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_ARP_ACK_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "ARP Ack acknowledge"),
+
+#define SW_API_PT_ARP_ACK_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_ARP_ACK_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_ARP_ACK_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_ARP_ACK_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "ARP Ack acknowledge"),
+
+#define SW_API_PPPOE_SESSION_TABLE_ADD_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_TABLE_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_TABLE_ADD, SW_PPPOE, sizeof(fal_pppoe_session_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Session"),
+
+#define SW_API_PPPOE_SESSION_TABLE_DEL_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_TABLE_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_TABLE_DEL, SW_PPPOE, sizeof(fal_pppoe_session_t), SW_PARAM_PTR|SW_PARAM_IN, "Session"),
+
+#define SW_API_PPPOE_SESSION_TABLE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_TABLE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_TABLE_GET, SW_PPPOE, sizeof(fal_pppoe_session_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Session"),
+
+#define SW_API_PPPOE_SESSION_ID_SET_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_ID_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_ID_SET, SW_UINT32, 4, SW_PARAM_IN, "Index"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_ID_SET, SW_UINT32, 4, SW_PARAM_IN, "ID"),
+
+#define SW_API_PPPOE_SESSION_ID_GET_DESC \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_ID_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_ID_GET, SW_UINT32, 4, SW_PARAM_IN, "Index"), \
+ SW_PARAM_DEF(SW_API_PPPOE_SESSION_ID_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "ID"),
+
+#define SW_API_INTR_MASK_SET_DESC \
+ SW_PARAM_DEF(SW_API_INTR_MASK_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_MASK_SET, SW_UINT32, 4, SW_PARAM_IN, "Mask"),
+
+#define SW_API_INTR_MASK_GET_DESC \
+ SW_PARAM_DEF(SW_API_INTR_MASK_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_MASK_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Mask"),
+
+#define SW_API_INTR_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_INTR_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_STATUS_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"),
+
+#define SW_API_INTR_STATUS_CLEAR_DESC \
+ SW_PARAM_DEF(SW_API_INTR_STATUS_CLEAR, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_STATUS_CLEAR, SW_UINT32, 4, SW_PARAM_IN, "Status"),
+
+#define SW_API_INTR_PORT_LINK_MASK_SET_DESC \
+ SW_PARAM_DEF(SW_API_INTR_PORT_LINK_MASK_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_PORT_LINK_MASK_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_INTR_PORT_LINK_MASK_SET, SW_UINT32, 4, SW_PARAM_IN, "Mask"),
+
+#define SW_API_INTR_PORT_LINK_MASK_GET_DESC \
+ SW_PARAM_DEF(SW_API_INTR_PORT_LINK_MASK_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_PORT_LINK_MASK_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_INTR_PORT_LINK_MASK_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Mask"),
+
+#define SW_API_INTR_PORT_LINK_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_INTR_PORT_LINK_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_PORT_LINK_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_INTR_PORT_LINK_STATUS_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"),
+
+#define SW_API_INTR_MASK_MAC_LINKCHG_SET_DESC \
+ SW_PARAM_DEF(SW_API_INTR_MASK_MAC_LINKCHG_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_MASK_MAC_LINKCHG_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_INTR_MASK_MAC_LINKCHG_SET, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_INTR_MASK_MAC_LINKCHG_GET_DESC \
+ SW_PARAM_DEF(SW_API_INTR_MASK_MAC_LINKCHG_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_MASK_MAC_LINKCHG_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_INTR_MASK_MAC_LINKCHG_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Enable"),
+
+#define SW_API_INTR_STATUS_MAC_LINKCHG_GET_DESC \
+ SW_PARAM_DEF(SW_API_INTR_STATUS_MAC_LINKCHG_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_INTR_STATUS_MAC_LINKCHG_GET, SW_PBMP, sizeof(fal_pbmp_t), SW_PARAM_PTR|SW_PARAM_OUT, "Intr Port Bitmap"),
+
+#define SW_API_INTR_STATUS_MAC_LINKCHG_CLEAR_DESC \
+ SW_PARAM_DEF(SW_API_INTR_STATUS_MAC_LINKCHG_CLEAR, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),
+
+#define SW_API_CPU_VID_EN_SET_DESC \
+ SW_PARAM_DEF(SW_API_CPU_VID_EN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_CPU_VID_EN_SET, SW_ENABLE, 4, SW_PARAM_IN, "Cpu vid"),
+
+#define SW_API_CPU_VID_EN_GET_DESC \
+ SW_PARAM_DEF(SW_API_CPU_VID_EN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_CPU_VID_EN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Cpu vid"),
+
+#define SW_API_RTD_PPPOE_EN_SET_DESC \
+ SW_PARAM_DEF(SW_API_RTD_PPPOE_EN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_RTD_PPPOE_EN_SET, SW_ENABLE, 4, SW_PARAM_IN, "RTD PPPoE"),
+
+#define SW_API_RTD_PPPOE_EN_GET_DESC \
+ SW_PARAM_DEF(SW_API_RTD_PPPOE_EN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_RTD_PPPOE_EN_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "RTD PPPoE"),
+
+
+#define SW_API_LED_PATTERN_SET_DESC \
+ SW_PARAM_DEF(SW_API_LED_PATTERN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_LED_PATTERN_SET, SW_UINT32, 4, SW_PARAM_IN, "Pattern Group"),\
+ SW_PARAM_DEF(SW_API_LED_PATTERN_SET, SW_UINT32, 4, SW_PARAM_IN, "Pattern ID"),\
+ SW_PARAM_DEF(SW_API_LED_PATTERN_SET, SW_LEDPATTERN, sizeof(led_ctrl_pattern_t), SW_PARAM_PTR|SW_PARAM_IN, "Pattern"),
+
+#define SW_API_LED_PATTERN_GET_DESC \
+ SW_PARAM_DEF(SW_API_LED_PATTERN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_LED_PATTERN_GET, SW_UINT32, 4, SW_PARAM_IN, "Pattern Group"),\
+ SW_PARAM_DEF(SW_API_LED_PATTERN_GET, SW_UINT32, 4, SW_PARAM_IN, "Pattern ID"),\
+ SW_PARAM_DEF(SW_API_LED_PATTERN_GET, SW_LEDPATTERN, sizeof(led_ctrl_pattern_t), SW_PARAM_PTR|SW_PARAM_OUT, "Pattern"),
+
+
+#define SW_API_PHY_GET_DESC \
+ SW_PARAM_DEF(SW_API_PHY_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_PHY_GET, SW_UINT32, 4, SW_PARAM_IN, "Phy ID"),\
+ SW_PARAM_DEF(SW_API_PHY_GET, SW_UINT32, 4, SW_PARAM_IN, "Reg ID"),\
+ SW_PARAM_DEF(SW_API_PHY_GET, SW_UINT16, 2, SW_PARAM_PTR|SW_PARAM_OUT, "Data"),
+
+
+#define SW_API_PHY_SET_DESC \
+ SW_PARAM_DEF(SW_API_PHY_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_PHY_SET, SW_UINT32, 4, SW_PARAM_IN, "Phy ID"),\
+ SW_PARAM_DEF(SW_API_PHY_SET, SW_UINT32, 4, SW_PARAM_IN, "Reg ID"),\
+ SW_PARAM_DEF(SW_API_PHY_SET, SW_UINT16, 2, SW_PARAM_IN, "Data"),
+
+#define SW_API_REG_GET_DESC \
+ SW_PARAM_DEF(SW_API_REG_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_REG_GET, SW_UINT32, 4, SW_PARAM_IN, "Reg Addr"),\
+ SW_PARAM_DEF(SW_API_REG_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Data"),\
+ SW_PARAM_DEF(SW_API_REG_GET, SW_UINT32, 4, SW_PARAM_IN, "Data Len"),
+
+#define SW_API_REG_SET_DESC \
+ SW_PARAM_DEF(SW_API_REG_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_REG_SET, SW_UINT32, 4, SW_PARAM_IN, "Reg Addr"),\
+ SW_PARAM_DEF(SW_API_REG_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "Data"),\
+ SW_PARAM_DEF(SW_API_REG_SET, SW_UINT32, 4, SW_PARAM_IN, "Data Len"),
+
+#define SW_API_REG_FIELD_GET_DESC \
+ SW_PARAM_DEF(SW_API_REG_FIELD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_GET, SW_UINT32, 4, SW_PARAM_IN, "Reg Addr"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_GET, SW_UINT32, 4, SW_PARAM_IN, "Bit Offset"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_GET, SW_UINT32, 4, SW_PARAM_IN, "Field Len"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Data"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_GET, SW_UINT32, 4, SW_PARAM_IN, "Data Len"),
+
+#define SW_API_REG_FIELD_SET_DESC \
+ SW_PARAM_DEF(SW_API_REG_FIELD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_SET, SW_UINT32, 4, SW_PARAM_IN, "Reg Addr"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_SET, SW_UINT32, 4, SW_PARAM_IN, "Bit Offset"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_SET, SW_UINT32, 4, SW_PARAM_IN, "Field Len"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "Data"),\
+ SW_PARAM_DEF(SW_API_REG_FIELD_SET, SW_UINT32, 4, SW_PARAM_IN, "Data Len"),
+
+
+
+
+#define SW_API_COSMAP_DSCP_TO_PRI_SET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_PRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_PRI_SET, SW_UINT32, 4, SW_PARAM_IN, "DSCP"), \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_PRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Priority"),
+
+#define SW_API_COSMAP_DSCP_TO_PRI_GET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_PRI_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_PRI_GET, SW_UINT32, 4, SW_PARAM_IN, "DSCP"), \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_PRI_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Priority"),
+
+#define SW_API_COSMAP_DSCP_TO_DP_SET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_DP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_DP_SET, SW_UINT32, 4, SW_PARAM_IN, "DSCP"), \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_DP_SET, SW_UINT32, 4, SW_PARAM_IN, "DP"),
+
+#define SW_API_COSMAP_DSCP_TO_DP_GET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_DP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_DP_GET, SW_UINT32, 4, SW_PARAM_IN, "DSCP"), \
+ SW_PARAM_DEF(SW_API_COSMAP_DSCP_TO_DP_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "DP"),
+
+#define SW_API_COSMAP_UP_TO_PRI_SET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_PRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_PRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Dot1p"), \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_PRI_SET, SW_UINT32, 4, SW_PARAM_IN, "Priority"),
+
+#define SW_API_COSMAP_UP_TO_PRI_GET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_PRI_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_PRI_GET, SW_UINT32, 4, SW_PARAM_IN, "Dot1p"), \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_PRI_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Priority"),
+
+#define SW_API_COSMAP_UP_TO_DP_SET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_DP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_DP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dot1p"), \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_DP_SET, SW_UINT32, 4, SW_PARAM_IN, "DP"),
+
+#define SW_API_COSMAP_UP_TO_DP_GET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_DP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_DP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dot1p"), \
+ SW_PARAM_DEF(SW_API_COSMAP_UP_TO_DP_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "DP"),
+
+#define SW_API_COSMAP_PRI_TO_QU_SET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_QU_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_QU_SET, SW_UINT32, 4, SW_PARAM_IN, "Priority"), \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_QU_SET, SW_UINT32, 4, SW_PARAM_IN, "Queue"),
+
+#define SW_API_COSMAP_PRI_TO_QU_GET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_QU_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_QU_GET, SW_UINT32, 4, SW_PARAM_IN, "Priority"), \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_QU_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Queue"),
+
+#define SW_API_COSMAP_PRI_TO_EHQU_SET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_EHQU_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_EHQU_SET, SW_UINT32, 4, SW_PARAM_IN, "Priority"), \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_EHQU_SET, SW_UINT32, 4, SW_PARAM_IN, "Queue"),
+
+#define SW_API_COSMAP_PRI_TO_EHQU_GET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_EHQU_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_EHQU_GET, SW_UINT32, 4, SW_PARAM_IN, "Priority"), \
+ SW_PARAM_DEF(SW_API_COSMAP_PRI_TO_EHQU_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Queue"),
+
+#define SW_API_COSMAP_EG_REMARK_SET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_EG_REMARK_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_EG_REMARK_SET, SW_UINT32, 4, SW_PARAM_IN, "Table ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_EG_REMARK_SET, SW_REMARKENTRY, sizeof(fal_egress_remark_table_t), SW_PARAM_IN|SW_PARAM_PTR, "Table Entry"),
+
+#define SW_API_COSMAP_EG_REMARK_GET_DESC \
+ SW_PARAM_DEF(SW_API_COSMAP_EG_REMARK_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_EG_REMARK_GET, SW_UINT32, 4, SW_PARAM_IN, "Table ID"), \
+ SW_PARAM_DEF(SW_API_COSMAP_EG_REMARK_GET, SW_REMARKENTRY, sizeof(fal_egress_remark_table_t), SW_PARAM_OUT|SW_PARAM_PTR, "Table Entry"),
+
+
+
+#define SW_API_SEC_NORM_SET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_NORM_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_NORM_SET, SW_UINT32, 4, SW_PARAM_IN, "NormItem"), \
+ SW_PARAM_DEF(SW_API_SEC_NORM_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "NormVal"),
+
+#define SW_API_SEC_NORM_GET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_NORM_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_NORM_GET, SW_UINT32, 4, SW_PARAM_IN, "NormItem"), \
+ SW_PARAM_DEF(SW_API_SEC_NORM_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "NormVal"),
+
+#define SW_API_SEC_MAC_SET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_MAC_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_MAC_SET, SW_SEC_MAC, 4, SW_PARAM_IN, "MAC related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_MAC_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "NormVal"),
+
+#define SW_API_SEC_MAC_GET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_MAC_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_MAC_GET, SW_SEC_MAC, 4, SW_PARAM_IN, "MAC related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_MAC_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "NormVal"),
+
+#define SW_API_SEC_IP_SET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_IP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_IP_SET, SW_SEC_IP, 4, SW_PARAM_IN, "IP related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_IP_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "NormVal"),
+
+#define SW_API_SEC_IP_GET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_IP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_IP_GET, SW_SEC_IP, 4, SW_PARAM_IN, "IP related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_IP_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "NormVal"),
+
+#define SW_API_SEC_IP4_SET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_IP4_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_IP4_SET, SW_SEC_IP4, 4, SW_PARAM_IN, "IP4 related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_IP4_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "NormVal"),
+
+#define SW_API_SEC_IP4_GET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_IP4_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_IP4_GET, SW_SEC_IP4, 4, SW_PARAM_IN, "IP4 related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_IP4_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "NormVal"),
+
+#define SW_API_SEC_IP6_SET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_IP6_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_IP6_SET, SW_SEC_IP6, 4, SW_PARAM_IN, "IP6 related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_IP6_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "NormVal"),
+
+#define SW_API_SEC_IP6_GET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_IP6_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_IP6_GET, SW_SEC_IP6, 4, SW_PARAM_IN, "IP6 related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_IP6_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "NormVal"),
+
+#define SW_API_SEC_TCP_SET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_TCP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_TCP_SET, SW_SEC_TCP, 4, SW_PARAM_IN, "TCP related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_TCP_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "NormVal"),
+
+#define SW_API_SEC_TCP_GET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_TCP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_TCP_GET, SW_SEC_TCP, 4, SW_PARAM_IN, "TCP related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_TCP_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "NormVal"),
+
+#define SW_API_SEC_UDP_SET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_UDP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_UDP_SET, SW_SEC_UDP, 4, SW_PARAM_IN, "UDP related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_UDP_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "NormVal"),
+
+#define SW_API_SEC_UDP_GET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_UDP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_UDP_GET, SW_SEC_UDP, 4, SW_PARAM_IN, "UDP related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_UDP_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "NormVal"),
+
+#define SW_API_SEC_ICMP4_SET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_ICMP4_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_ICMP4_SET, SW_SEC_ICMP4, 4, SW_PARAM_IN, "ICMP4 related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_ICMP4_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "NormVal"),
+
+#define SW_API_SEC_ICMP4_GET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_ICMP4_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_ICMP4_GET, SW_SEC_ICMP4, 4, SW_PARAM_IN, "ICMP4 related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_ICMP4_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "NormVal"),
+
+#define SW_API_SEC_ICMP6_SET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_ICMP6_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_ICMP6_SET, SW_SEC_ICMP6, 4, SW_PARAM_IN, "ICMP6 related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_ICMP6_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN, "NormVal"),
+
+#define SW_API_SEC_ICMP6_GET_DESC \
+ SW_PARAM_DEF(SW_API_SEC_ICMP6_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SEC_ICMP6_GET, SW_SEC_ICMP6, 4, SW_PARAM_IN, "ICMP6 related normalized item"), \
+ SW_PARAM_DEF(SW_API_SEC_ICMP6_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "NormVal"),
+
+#define SW_API_IP_HOST_ADD_DESC \
+ SW_PARAM_DEF(SW_API_IP_HOST_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_ADD, SW_IP_HOSTENTRY, sizeof(fal_host_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Hostentry"),
+
+#define SW_API_IP_HOST_DEL_DESC \
+ SW_PARAM_DEF(SW_API_IP_HOST_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_DEL, SW_UINT32, 4, SW_PARAM_IN, "DelMode"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_DEL, SW_IP_HOSTENTRY, sizeof(fal_host_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Hostentry"),
+
+#define SW_API_IP_HOST_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_HOST_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_GET, SW_UINT32, 4, SW_PARAM_IN, "GetMode"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_GET, SW_IP_HOSTENTRY, sizeof(fal_host_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Hostentry"),
+
+#define SW_API_IP_HOST_NEXT_DESC \
+ SW_PARAM_DEF(SW_API_IP_HOST_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_NEXT, SW_UINT32, 4, SW_PARAM_IN, "NextMode"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_NEXT, SW_IP_HOSTENTRY, sizeof(fal_host_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Hostentry"),
+
+#define SW_API_IP_HOST_COUNTER_BIND_DESC \
+ SW_PARAM_DEF(SW_API_IP_HOST_COUNTER_BIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_COUNTER_BIND, SW_UINT32, 4, SW_PARAM_IN, "EntryID"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_COUNTER_BIND, SW_UINT32, 4, SW_PARAM_IN, "CounterID"),\
+ SW_PARAM_DEF(SW_API_IP_HOST_COUNTER_BIND, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_IP_HOST_PPPOE_BIND_DESC \
+ SW_PARAM_DEF(SW_API_IP_HOST_PPPOE_BIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_PPPOE_BIND, SW_UINT32, 4, SW_PARAM_IN, "EntryID"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_PPPOE_BIND, SW_UINT32, 4, SW_PARAM_IN, "PPPoEID"), \
+ SW_PARAM_DEF(SW_API_IP_HOST_PPPOE_BIND, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_IP_PT_ARP_LEARN_SET_DESC \
+ SW_PARAM_DEF(SW_API_IP_PT_ARP_LEARN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_PT_ARP_LEARN_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IP_PT_ARP_LEARN_SET, SW_UINT32, 4, SW_PARAM_IN, "LearnStatus"),
+
+#define SW_API_IP_PT_ARP_LEARN_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_PT_ARP_LEARN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_PT_ARP_LEARN_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IP_PT_ARP_LEARN_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "LearnStatus"),
+
+#define SW_API_IP_ARP_LEARN_SET_DESC \
+ SW_PARAM_DEF(SW_API_IP_ARP_LEARN_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_ARP_LEARN_SET, SW_ARP_LEARNMODE, sizeof(fal_arp_learn_mode_t), SW_PARAM_IN, "LearnMode"),
+
+#define SW_API_IP_ARP_LEARN_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_ARP_LEARN_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_ARP_LEARN_GET, SW_ARP_LEARNMODE, sizeof(fal_arp_learn_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "LearnMode"),
+
+#define SW_API_IP_SOURCE_GUARD_SET_DESC \
+ SW_PARAM_DEF(SW_API_IP_SOURCE_GUARD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_SOURCE_GUARD_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IP_SOURCE_GUARD_SET, SW_IP_GUARDMODE, sizeof(fal_source_guard_mode_t), SW_PARAM_IN, "GuardMode"),
+
+#define SW_API_IP_SOURCE_GUARD_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_SOURCE_GUARD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_SOURCE_GUARD_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IP_SOURCE_GUARD_GET, SW_IP_GUARDMODE, sizeof(fal_source_guard_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "GuardMode"),
+
+#define SW_API_IP_ARP_GUARD_SET_DESC \
+ SW_PARAM_DEF(SW_API_IP_ARP_GUARD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_ARP_GUARD_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IP_ARP_GUARD_SET, SW_IP_GUARDMODE, sizeof(fal_source_guard_mode_t), SW_PARAM_IN, "GuardMode"),
+
+#define SW_API_IP_ARP_GUARD_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_ARP_GUARD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_ARP_GUARD_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_IP_ARP_GUARD_GET, SW_IP_GUARDMODE, sizeof(fal_source_guard_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "GuardMode"),
+
+#define SW_API_IP_ROUTE_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_IP_ROUTE_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_ROUTE_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Status"),
+
+#define SW_API_IP_ROUTE_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_ROUTE_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_ROUTE_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"),
+
+#define SW_API_IP_INTF_ENTRY_ADD_DESC \
+ SW_PARAM_DEF(SW_API_IP_INTF_ENTRY_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_INTF_ENTRY_ADD, SW_INTFMACENTRY, sizeof(fal_intf_mac_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Entry"),
+
+#define SW_API_IP_INTF_ENTRY_DEL_DESC \
+ SW_PARAM_DEF(SW_API_IP_INTF_ENTRY_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_INTF_ENTRY_DEL, SW_UINT32, 4, SW_PARAM_IN, "Del Mode"), \
+ SW_PARAM_DEF(SW_API_IP_INTF_ENTRY_DEL, SW_INTFMACENTRY, sizeof(fal_intf_mac_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Entry"),
+
+#define SW_API_IP_INTF_ENTRY_NEXT_DESC \
+ SW_PARAM_DEF(SW_API_IP_INTF_ENTRY_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_INTF_ENTRY_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Next Mode"), \
+ SW_PARAM_DEF(SW_API_IP_INTF_ENTRY_NEXT, SW_INTFMACENTRY, sizeof(fal_intf_mac_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Entry"),
+
+#define SW_API_IP_UNK_SOURCE_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_IP_UNK_SOURCE_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_UNK_SOURCE_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "Forwarding"),
+
+#define SW_API_IP_UNK_SOURCE_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_UNK_SOURCE_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_UNK_SOURCE_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "Forwarding"),
+
+#define SW_API_ARP_UNK_SOURCE_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_ARP_UNK_SOURCE_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_ARP_UNK_SOURCE_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "Forwarding"),
+
+#define SW_API_ARP_UNK_SOURCE_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_ARP_UNK_SOURCE_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_ARP_UNK_SOURCE_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "Forwarding"),
+
+#define SW_API_IP_AGE_TIME_SET_DESC \
+ SW_PARAM_DEF(SW_API_IP_AGE_TIME_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_AGE_TIME_SET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Time"),
+
+#define SW_API_IP_AGE_TIME_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_AGE_TIME_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_AGE_TIME_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Time"),
+
+#define SW_API_WCMP_HASH_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_WCMP_HASH_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_WCMP_HASH_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Hash Mode"),
+
+#define SW_API_WCMP_HASH_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_WCMP_HASH_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_WCMP_HASH_MODE_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Hash Mode"),
+
+
+
+
+#define SW_API_NAT_ADD_DESC \
+ SW_PARAM_DEF(SW_API_NAT_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_ADD, SW_NATENTRY, sizeof(fal_nat_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Natentry"),
+
+#define SW_API_NAT_DEL_DESC \
+ SW_PARAM_DEF(SW_API_NAT_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_DEL, SW_UINT32, 4, SW_PARAM_IN, "DelMode"), \
+ SW_PARAM_DEF(SW_API_NAT_DEL, SW_NATENTRY, sizeof(fal_nat_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Natentry"),
+
+#define SW_API_NAT_GET_DESC \
+ SW_PARAM_DEF(SW_API_NAT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_GET, SW_UINT32, 4, SW_PARAM_IN, "GetMode"), \
+ SW_PARAM_DEF(SW_API_NAT_GET, SW_NATENTRY, sizeof(fal_nat_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Natentry"),
+
+#define SW_API_NAT_NEXT_DESC \
+ SW_PARAM_DEF(SW_API_NAT_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_NEXT, SW_UINT32, 4, SW_PARAM_IN, "NextMode"), \
+ SW_PARAM_DEF(SW_API_NAT_NEXT, SW_NATENTRY, sizeof(fal_nat_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Natentry"),
+
+#define SW_API_NAT_COUNTER_BIND_DESC \
+ SW_PARAM_DEF(SW_API_NAT_COUNTER_BIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_COUNTER_BIND, SW_UINT32, 4, SW_PARAM_IN, "EntryID"), \
+ SW_PARAM_DEF(SW_API_NAT_COUNTER_BIND, SW_UINT32, 4, SW_PARAM_IN, "CounterID"),\
+ SW_PARAM_DEF(SW_API_NAT_COUNTER_BIND, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_NAPT_ADD_DESC \
+ SW_PARAM_DEF(SW_API_NAPT_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAPT_ADD, SW_NAPTENTRY, sizeof(fal_napt_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Naptentry"),
+
+#define SW_API_NAPT_DEL_DESC \
+ SW_PARAM_DEF(SW_API_NAPT_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAPT_DEL, SW_UINT32, 4, SW_PARAM_IN, "DelMode"), \
+ SW_PARAM_DEF(SW_API_NAPT_DEL, SW_NAPTENTRY, sizeof(fal_napt_entry_t), SW_PARAM_PTR|SW_PARAM_IN, "Naptentry"),
+
+#define SW_API_NAPT_GET_DESC \
+ SW_PARAM_DEF(SW_API_NAPT_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAPT_GET, SW_UINT32, 4, SW_PARAM_IN, "GetMode"), \
+ SW_PARAM_DEF(SW_API_NAPT_GET, SW_NAPTENTRY, sizeof(fal_napt_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Naptentry"),
+
+#define SW_API_NAPT_NEXT_DESC \
+ SW_PARAM_DEF(SW_API_NAPT_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAPT_NEXT, SW_UINT32, 4, SW_PARAM_IN, "NextMode"), \
+ SW_PARAM_DEF(SW_API_NAPT_NEXT, SW_NAPTENTRY, sizeof(fal_napt_entry_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "Naptentry"),
+
+#define SW_API_NAPT_COUNTER_BIND_DESC \
+ SW_PARAM_DEF(SW_API_NAPT_COUNTER_BIND, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAPT_COUNTER_BIND, SW_UINT32, 4, SW_PARAM_IN, "EntryID"), \
+ SW_PARAM_DEF(SW_API_NAPT_COUNTER_BIND, SW_UINT32, 4, SW_PARAM_IN, "CounterID"),\
+ SW_PARAM_DEF(SW_API_NAPT_COUNTER_BIND, SW_ENABLE, 4, SW_PARAM_IN, "Enable"),
+
+#define SW_API_NAT_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_NAT_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Status"),
+
+#define SW_API_NAT_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_NAT_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"),
+
+#define SW_API_NAT_HASH_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_NAT_HASH_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_HASH_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Hashmode"),
+
+#define SW_API_NAT_HASH_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_NAT_HASH_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_HASH_MODE_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Hashmode"),
+
+#define SW_API_NAPT_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_NAPT_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAPT_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Status"),
+
+#define SW_API_NAPT_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_NAPT_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAPT_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Status"),
+
+#define SW_API_NAPT_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_NAPT_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAPT_MODE_SET, SW_NAPTMODE, sizeof(fal_napt_mode_t), SW_PARAM_IN, "Mode"),
+
+#define SW_API_NAPT_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_NAPT_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAPT_MODE_GET, SW_NAPTMODE, sizeof(fal_napt_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, "Mode"),
+
+#define SW_API_PRV_BASE_ADDR_SET_DESC \
+ SW_PARAM_DEF(SW_API_PRV_BASE_ADDR_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PRV_BASE_ADDR_SET, SW_IP4ADDR, sizeof(fal_ip4_addr_t), SW_PARAM_IN, "BaseAddr"),
+
+#define SW_API_PRV_BASE_ADDR_GET_DESC \
+ SW_PARAM_DEF(SW_API_PRV_BASE_ADDR_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PRV_BASE_ADDR_GET, SW_IP4ADDR, sizeof(fal_ip4_addr_t), SW_PARAM_PTR|SW_PARAM_OUT, "BaseAddr"),
+
+#define SW_API_PRV_ADDR_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PRV_ADDR_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PRV_ADDR_MODE_SET, SW_ENABLE, sizeof(a_bool_t), SW_PARAM_IN, "Mode"),
+
+#define SW_API_PRV_ADDR_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PRV_ADDR_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PRV_ADDR_MODE_GET, SW_ENABLE, sizeof(a_bool_t), SW_PARAM_PTR|SW_PARAM_OUT, "Mode"),
+
+#define SW_API_PUB_ADDR_ENTRY_ADD_DESC \
+ SW_PARAM_DEF(SW_API_PUB_ADDR_ENTRY_ADD, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PUB_ADDR_ENTRY_ADD, SW_PUBADDRENTRY, sizeof(fal_nat_pub_addr_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "PubAddrEntry"),
+
+#define SW_API_PUB_ADDR_ENTRY_DEL_DESC \
+ SW_PARAM_DEF(SW_API_PUB_ADDR_ENTRY_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PUB_ADDR_ENTRY_DEL, SW_UINT32, 4, SW_PARAM_IN, "DelMode"), \
+ SW_PARAM_DEF(SW_API_PUB_ADDR_ENTRY_DEL, SW_PUBADDRENTRY, sizeof(fal_nat_pub_addr_t), SW_PARAM_PTR|SW_PARAM_IN, "PubAddrEntry"),
+
+#define SW_API_PUB_ADDR_ENTRY_NEXT_DESC \
+ SW_PARAM_DEF(SW_API_PUB_ADDR_ENTRY_NEXT, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PUB_ADDR_ENTRY_NEXT, SW_UINT32, 4, SW_PARAM_IN, "NextMode"), \
+ SW_PARAM_DEF(SW_API_PUB_ADDR_ENTRY_NEXT, SW_PUBADDRENTRY, sizeof(fal_nat_pub_addr_t), SW_PARAM_PTR|SW_PARAM_IN|SW_PARAM_OUT, "PubAddrEntry"),
+
+#define SW_API_NAT_UNK_SESSION_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_NAT_UNK_SESSION_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_UNK_SESSION_CMD_SET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_IN, "Forwarding"),
+
+#define SW_API_NAT_UNK_SESSION_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_NAT_UNK_SESSION_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_UNK_SESSION_CMD_GET, SW_MACCMD, sizeof(fal_fwd_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "Forwarding"),
+
+#define SW_API_PRV_BASE_MASK_SET_DESC \
+ SW_PARAM_DEF(SW_API_PRV_BASE_MASK_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PRV_BASE_MASK_SET, SW_IP4ADDR, sizeof(fal_ip4_addr_t), SW_PARAM_IN, "BaseMask"),
+
+#define SW_API_PRV_BASE_MASK_GET_DESC \
+ SW_PARAM_DEF(SW_API_PRV_BASE_MASK_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PRV_BASE_MASK_GET, SW_IP4ADDR, sizeof(fal_ip4_addr_t), SW_PARAM_PTR|SW_PARAM_OUT, "BaseMask"),
+
+#define SW_API_NAT_GLOBAL_SET_DESC \
+ SW_PARAM_DEF(SW_API_NAT_GLOBAL_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_NAT_GLOBAL_SET, SW_ENABLE, 4, SW_PARAM_IN, "Status"),
+
+
+#define SW_API_TRUNK_GROUP_SET_DESC \
+ SW_PARAM_DEF(SW_API_TRUNK_GROUP_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TRUNK_GROUP_SET, SW_UINT32, 4, SW_PARAM_IN, "Trunk ID"), \
+ SW_PARAM_DEF(SW_API_TRUNK_GROUP_SET, SW_ENABLE, sizeof(a_bool_t), SW_PARAM_IN, "Status"), \
+ SW_PARAM_DEF(SW_API_TRUNK_GROUP_SET, SW_PBMP, sizeof(fal_pbmp_t), SW_PARAM_IN, "Member Port Bitmap"),
+
+#define SW_API_TRUNK_GROUP_GET_DESC \
+ SW_PARAM_DEF(SW_API_TRUNK_GROUP_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TRUNK_GROUP_GET, SW_UINT32, 4, SW_PARAM_IN, "Trunk ID"), \
+ SW_PARAM_DEF(SW_API_TRUNK_GROUP_GET, SW_ENABLE, sizeof(a_bool_t), SW_PARAM_PTR|SW_PARAM_OUT, "Status"), \
+ SW_PARAM_DEF(SW_API_TRUNK_GROUP_GET, SW_PBMP, sizeof(fal_pbmp_t), SW_PARAM_PTR|SW_PARAM_OUT, "Member Port Bitmap"),
+
+#define SW_API_TRUNK_HASH_SET_DESC \
+ SW_PARAM_DEF(SW_API_TRUNK_HASH_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TRUNK_HASH_SET, SW_UINT32, 4, SW_PARAM_IN, "Hash Mode"),
+
+#define SW_API_TRUNK_HASH_GET_DESC \
+ SW_PARAM_DEF(SW_API_TRUNK_HASH_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TRUNK_HASH_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Hash Mode"),
+
+#define SW_API_TRUNK_MAN_SA_SET_DESC \
+ SW_PARAM_DEF(SW_API_TRUNK_MAN_SA_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TRUNK_MAN_SA_SET, SW_MACADDR, sizeof(fal_mac_addr_t), SW_PARAM_PTR|SW_PARAM_IN, "[Manipulable SA]:"),
+
+#define SW_API_TRUNK_MAN_SA_GET_DESC \
+ SW_PARAM_DEF(SW_API_TRUNK_MAN_SA_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_TRUNK_MAN_SA_GET, SW_MACADDR, sizeof(fal_mac_addr_t), SW_PARAM_PTR|SW_PARAM_OUT, "[Manipulable SA]:"),
+
+
+#define SW_API_MAC_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_MAC_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MAC_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_MAC_MODE_SET, SW_MACCONFIG, sizeof(fal_mac_config_t), SW_PARAM_PTR|SW_PARAM_IN, "MAC config"),
+
+#define SW_API_MAC_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_MAC_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MAC_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_MAC_MODE_GET, SW_MACCONFIG, sizeof(fal_mac_config_t), SW_PARAM_PTR|SW_PARAM_OUT, "MAC config"),
+
+#define SW_API_PORT_3AZ_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_PORT_3AZ_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PORT_3AZ_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PORT_3AZ_STATUS_SET, SW_ENABLE, sizeof(a_bool_t), SW_PARAM_IN, "Status"),
+
+#define SW_API_PORT_3AZ_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PORT_3AZ_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PORT_3AZ_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PORT_3AZ_STATUS_GET, SW_ENABLE, sizeof(a_bool_t), SW_PARAM_PTR|SW_PARAM_OUT, "Status"),
+
+#define SW_API_PHY_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PHY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PHY_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Phy ID"), \
+ SW_PARAM_DEF(SW_API_PHY_MODE_SET, SW_PHYCONFIG, sizeof(fal_phy_config_t), SW_PARAM_PTR|SW_PARAM_IN, "PHY config"),
+
+#define SW_API_PHY_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PHY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PHY_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Phy ID"), \
+ SW_PARAM_DEF(SW_API_PHY_MODE_GET, SW_PHYCONFIG, sizeof(fal_phy_config_t), SW_PARAM_PTR|SW_PARAM_OUT, "PHY config"),
+
+#define SW_API_FX100_CTRL_SET_DESC \
+ SW_PARAM_DEF(SW_API_FX100_CTRL_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_FX100_CTRL_SET, SW_FX100CONFIG, sizeof(fal_fx100_ctrl_config_t), SW_PARAM_PTR|SW_PARAM_IN, "fx100 config"),
+
+#define SW_API_FX100_CTRL_GET_DESC \
+ SW_PARAM_DEF(SW_API_FX100_CTRL_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_FX100_CTRL_GET, SW_FX100CONFIG, sizeof(fal_fx100_ctrl_config_t), SW_PARAM_PTR|SW_PARAM_OUT, "fx100 config"),
+
+#define SW_API_FX100_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_FX100_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_FX100_STATUS_GET, SW_UINT32, 4, SW_PARAM_PTR|SW_PARAM_OUT, "fx100 status"),
+
+
+#define SW_API_MAC06_EXCH_SET_DESC \
+ SW_PARAM_DEF(SW_API_MAC06_EXCH_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MAC06_EXCH_SET, SW_ENABLE, sizeof(a_bool_t), SW_PARAM_IN, "enable"),
+
+#define SW_API_MAC06_EXCH_GET_DESC \
+ SW_PARAM_DEF(SW_API_MAC06_EXCH_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_MAC06_EXCH_GET, SW_ENABLE, sizeof(a_bool_t), SW_PARAM_PTR|SW_PARAM_OUT, "enable"),
+
+#define SW_API_DESC(api_id) api_id##_DESC
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _API_DESC_H_ */
+
diff --git a/include/api/sw_api.h b/include/api/sw_api.h
new file mode 100755
index 0000000..fcdf3ae
--- /dev/null
+++ b/include/api/sw_api.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _SW_API_H
+#define _SW_API_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "sw.h"
+#include "sw_ioctl.h"
+
+#define SW_MAX_API_BUF 2048
+#define SW_MAX_API_PARAM 12 /* cmd type + return value + ten parameters */
+#define SW_MAX_PAYLOAD (SW_MAX_API_PARAM << 2) /* maximum payload size for netlink msg*/
+#define SW_PARAM_IN 0x1
+#define SW_PARAM_OUT 0x2
+#define SW_PARAM_PTR 0x4
+
+#define SW_API_DEF(ioctl, name) {ioctl, name}
+#if (!defined(KERNEL_MODULE))
+#define SW_PARAM_DEF(ioctl, data, size, type, name) \
+ {ioctl, size, data, type, name}
+#else
+#define SW_PARAM_DEF(ioctl, data, size, type, name) {ioctl, size, data, type}
+#endif
+
+ typedef enum
+ {
+ SW_UINT8 = 1,
+ SW_INT8,
+ SW_UINT16,
+ SW_INT16,
+ SW_UINT32,
+ SW_INT32,
+ SW_UINT64,
+ SW_INT64,
+ SW_ENABLE,
+ SW_SPEED,
+ SW_DUPLEX,
+ SW_1QMODE,
+ SW_EGMODE,
+ SW_CAP,
+ SW_VLAN,
+ SW_PBMP,
+ SW_MIB,
+ SW_MACADDR,
+ SW_FDBENTRY,
+ SW_SCH,
+ SW_QOS,
+ SW_STORM,
+ SW_STP,
+ SW_LEAKY,
+ SW_MACCMD,
+ SW_UINT_A,
+ SW_ACLRULE,
+ SW_LEDPATTERN,
+ SW_INVLAN,
+ SW_VLANPROPAGATION,
+ SW_VLANTRANSLATION,
+ SW_QINQMODE,
+ SW_QINQROLE,
+ SW_CABLESTATUS,
+ SW_CABLELEN,
+ SW_SSDK_CFG,
+ SW_HDRMODE,
+ SW_FDBOPRATION,
+ SW_PPPOE,
+ SW_ACL_UDF_TYPE,
+ SW_IP_HOSTENTRY,
+ SW_ARP_LEARNMODE,
+ SW_IP_GUARDMODE,
+ SW_NATENTRY,
+ SW_NAPTENTRY,
+ SW_NAPTMODE,
+ SW_IP4ADDR,
+ SW_IP6ADDR,
+ SW_INTFMACENTRY,
+ SW_PUBADDRENTRY,
+ SW_INGPOLICER,
+ SW_EGSHAPER,
+ SW_ACLPOLICER,
+ SW_MACCONFIG,
+ SW_PHYCONFIG,
+ SW_DATA_MAX,
+ SW_FDBSMODE,
+ SW_FX100CONFIG,
+ SW_SGENTRY,
+ SW_SEC_MAC,
+ SW_SEC_IP,
+ SW_SEC_IP4,
+ SW_SEC_IP6,
+ SW_SEC_TCP,
+ SW_SEC_UDP,
+ SW_SEC_ICMP4,
+ SW_SEC_ICMP6,
+ SW_REMARKENTRY,
+ SW_SGINFOENTRY,
+ } sw_data_type_e;
+
+ typedef struct
+ {
+ a_uint32_t api_id;
+ void *func;
+ } sw_api_func_t;
+
+ typedef struct
+ {
+ a_uint32_t api_id;
+ a_uint16_t data_size;
+ a_uint8_t data_type;
+ a_uint8_t param_type;
+#if (!defined(KERNEL_MODULE))
+ a_uint8_t param_name[20];
+#endif
+ } sw_api_param_t;
+
+ typedef struct
+ {
+ a_uint32_t api_id;
+ sw_api_func_t *api_fp;
+ sw_api_param_t *api_pp;
+ a_uint32_t api_nr;
+ } sw_api_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _SW_API_H */
diff --git a/include/api/sw_ioctl.h b/include/api/sw_ioctl.h
new file mode 100755
index 0000000..aa626af
--- /dev/null
+++ b/include/api/sw_ioctl.h
@@ -0,0 +1,536 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _SW_IOCTL_H_
+#define _SW_IOCTL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+ /*init*/
+#define SW_API_INIT_OFFSET 10
+#define SW_API_SWITCH_INIT (0 + SW_API_INIT_OFFSET)
+#define SW_API_SWITCH_RESET (1 + SW_API_INIT_OFFSET)
+#define SW_API_SSDK_CFG (2 + SW_API_INIT_OFFSET)
+
+ /*port ctrl*/
+#define SW_API_PORT_OFFSET 30
+#define SW_API_PT_DUPLEX_GET (0 + SW_API_PORT_OFFSET)
+#define SW_API_PT_DUPLEX_SET (1 + SW_API_PORT_OFFSET)
+#define SW_API_PT_SPEED_GET (2 + SW_API_PORT_OFFSET)
+#define SW_API_PT_SPEED_SET (3 + SW_API_PORT_OFFSET)
+#define SW_API_PT_AN_ADV_GET (4 + SW_API_PORT_OFFSET)
+#define SW_API_PT_AN_ADV_SET (5 + SW_API_PORT_OFFSET)
+#define SW_API_PT_AN_GET (6 + SW_API_PORT_OFFSET)
+#define SW_API_PT_AN_ENABLE (7 + SW_API_PORT_OFFSET)
+#define SW_API_PT_AN_RESTART (8 + SW_API_PORT_OFFSET)
+#define SW_API_PT_HDR_SET (9 + SW_API_PORT_OFFSET)
+#define SW_API_PT_HDR_GET (10 + SW_API_PORT_OFFSET)
+#define SW_API_PT_FLOWCTRL_SET (11 + SW_API_PORT_OFFSET)
+#define SW_API_PT_FLOWCTRL_GET (12 + SW_API_PORT_OFFSET)
+#define SW_API_PT_FLOWCTRL_MODE_SET (13 + SW_API_PORT_OFFSET)
+#define SW_API_PT_FLOWCTRL_MODE_GET (14 + SW_API_PORT_OFFSET)
+#define SW_API_PT_POWERSAVE_SET (15 + SW_API_PORT_OFFSET)
+#define SW_API_PT_POWERSAVE_GET (16 + SW_API_PORT_OFFSET)
+#define SW_API_PT_HIBERNATE_SET (17 + SW_API_PORT_OFFSET)
+#define SW_API_PT_HIBERNATE_GET (18 + SW_API_PORT_OFFSET)
+#define SW_API_PT_CDT (19 + SW_API_PORT_OFFSET)
+#define SW_API_PT_TXHDR_SET (20 + SW_API_PORT_OFFSET)
+#define SW_API_PT_TXHDR_GET (21 + SW_API_PORT_OFFSET)
+#define SW_API_PT_RXHDR_SET (22 + SW_API_PORT_OFFSET)
+#define SW_API_PT_RXHDR_GET (23 + SW_API_PORT_OFFSET)
+#define SW_API_HEADER_TYPE_SET (24 + SW_API_PORT_OFFSET)
+#define SW_API_HEADER_TYPE_GET (25 + SW_API_PORT_OFFSET)
+#define SW_API_TXMAC_STATUS_SET (26 + SW_API_PORT_OFFSET)
+#define SW_API_TXMAC_STATUS_GET (27 + SW_API_PORT_OFFSET)
+#define SW_API_RXMAC_STATUS_SET (28 + SW_API_PORT_OFFSET)
+#define SW_API_RXMAC_STATUS_GET (29 + SW_API_PORT_OFFSET)
+#define SW_API_TXFC_STATUS_SET (30 + SW_API_PORT_OFFSET)
+#define SW_API_TXFC_STATUS_GET (31 + SW_API_PORT_OFFSET)
+#define SW_API_RXFC_STATUS_SET (32 + SW_API_PORT_OFFSET)
+#define SW_API_RXFC_STATUS_GET (33 + SW_API_PORT_OFFSET)
+#define SW_API_BP_STATUS_SET (34 + SW_API_PORT_OFFSET)
+#define SW_API_BP_STATUS_GET (35 + SW_API_PORT_OFFSET)
+#define SW_API_PT_LINK_MODE_SET (36 + SW_API_PORT_OFFSET)
+#define SW_API_PT_LINK_MODE_GET (37 + SW_API_PORT_OFFSET)
+#define SW_API_PT_LINK_STATUS_GET (38 + SW_API_PORT_OFFSET)
+#define SW_API_PT_MAC_LOOPBACK_SET (39+ SW_API_PORT_OFFSET)
+#define SW_API_PT_MAC_LOOPBACK_GET (40+ SW_API_PORT_OFFSET)
+
+ /*vlan*/
+#define SW_API_VLAN_OFFSET 100
+#define SW_API_VLAN_ADD (0 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_DEL (1 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_MEM_UPDATE (2 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_FIND (3 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_NEXT (4 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_APPEND (5 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_FLUSH (6 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_FID_SET (7 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_FID_GET (8 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_MEMBER_ADD (9 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_MEMBER_DEL (10 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_LEARN_STATE_SET (11 + SW_API_VLAN_OFFSET)
+#define SW_API_VLAN_LEARN_STATE_GET (12 + SW_API_VLAN_OFFSET)
+
+
+ /*portvlan*/
+#define SW_API_PORTVLAN_OFFSET 200
+#define SW_API_PT_ING_MODE_GET (0 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_ING_MODE_SET (1 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_EG_MODE_GET (2 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_EG_MODE_SET (3 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_MEM_ADD (4 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_MEM_DEL (5 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_MEM_UPDATE (6 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_MEM_GET (7 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_DEF_VID_GET (8 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_DEF_VID_SET (9 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_FORCE_DEF_VID_SET (10 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_FORCE_DEF_VID_GET (11 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_FORCE_PORTVLAN_SET (12 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_FORCE_PORTVLAN_GET (13 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_NESTVLAN_SET (14 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_NESTVLAN_GET (15 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_NESTVLAN_TPID_SET (16 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_NESTVLAN_TPID_GET (17 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_IN_VLAN_MODE_SET (18 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_IN_VLAN_MODE_GET (19 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_TLS_SET (20 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_TLS_GET (21 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_PRI_PROPAGATION_SET (22 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_PRI_PROPAGATION_GET (23 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_DEF_SVID_SET (24 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_DEF_SVID_GET (25 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_DEF_CVID_SET (26 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_DEF_CVID_GET (27 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_PROPAGATION_SET (28 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_PROPAGATION_GET (29 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_TRANS_ADD (30 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_TRANS_DEL (31 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_TRANS_GET (32 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_QINQ_MODE_SET (33 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_QINQ_MODE_GET (34 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_QINQ_ROLE_SET (35 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_QINQ_ROLE_GET (36 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_VLAN_TRANS_ITERATE (37 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_MAC_VLAN_XLT_SET (38 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_PT_MAC_VLAN_XLT_GET (39 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_NETISOLATE_SET (40 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_NETISOLATE_GET (41 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_EG_FLTR_BYPASS_EN_SET (42 + SW_API_PORTVLAN_OFFSET)
+#define SW_API_EG_FLTR_BYPASS_EN_GET (43 + SW_API_PORTVLAN_OFFSET)
+
+ /*fdb*/
+#define SW_API_FDB_OFFSET 300
+#define SW_API_FDB_ADD (0 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_DELALL (1 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_DELPORT (2 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_DELMAC (3 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_FIRST (4 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_NEXT (5 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_FIND (6 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_PT_LEARN_SET (7 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_PT_LEARN_GET (8 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_AGE_CTRL_SET (9 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_AGE_CTRL_GET (10 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_AGE_TIME_SET (11 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_AGE_TIME_GET (12 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_ITERATE (13 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_EXTEND_NEXT (14 + SW_API_FDB_OFFSET)
+#define SW_API_PT_FDB_LEARN_LIMIT_SET (15 + SW_API_FDB_OFFSET)
+#define SW_API_PT_FDB_LEARN_LIMIT_GET (16 + SW_API_FDB_OFFSET)
+#define SW_API_PT_FDB_LEARN_EXCEED_CMD_SET (17 + SW_API_FDB_OFFSET)
+#define SW_API_PT_FDB_LEARN_EXCEED_CMD_GET (18 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_LEARN_LIMIT_SET (19 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_LEARN_LIMIT_GET (20 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_LEARN_EXCEED_CMD_SET (21 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_LEARN_EXCEED_CMD_GET (22 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_RESV_ADD (23 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_RESV_DEL (24 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_RESV_FIND (25 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_RESV_ITERATE (26 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_EXTEND_FIRST (27 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_PT_LEARN_STATIC_SET (28 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_PT_LEARN_STATIC_GET (29 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_TRANSFER (30 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_PORT_ADD (31 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_PORT_DEL (32 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_VLAN_IVL_SVL_SET (33 + SW_API_FDB_OFFSET)
+#define SW_API_FDB_VLAN_IVL_SVL_GET (34 + SW_API_FDB_OFFSET)
+
+
+ /*acl*/
+#define SW_API_ACL_OFFSET 400
+#define SW_API_ACL_LIST_CREAT (0 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_LIST_DESTROY (1 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_RULE_ADD (2 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_RULE_DELETE (3 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_RULE_QUERY (4 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_LIST_BIND (5 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_LIST_UNBIND (6 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_STATUS_SET (7 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_STATUS_GET (8 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_LIST_DUMP (9 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_RULE_DUMP (10 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_PT_UDF_PROFILE_SET (11 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_PT_UDF_PROFILE_GET (12 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_RULE_ACTIVE (13 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_RULE_DEACTIVE (14 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_RULE_SRC_FILTER_STS_SET (15 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_RULE_SRC_FILTER_STS_GET (16 + SW_API_ACL_OFFSET)
+#define SW_API_ACL_RULE_GET_OFFSET (17 + SW_API_ACL_OFFSET)
+
+ /*qos*/
+#define SW_API_QOS_OFFSET 500
+#define SW_API_QOS_SCH_MODE_SET (0 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_SCH_MODE_GET (1 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_QU_TX_BUF_ST_SET (2 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_QU_TX_BUF_ST_GET (3 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_QU_TX_BUF_NR_SET (4 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_QU_TX_BUF_NR_GET (5 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_TX_BUF_ST_SET (6 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_TX_BUF_ST_GET (7 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_TX_BUF_NR_SET (8 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_TX_BUF_NR_GET (9 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_RX_BUF_NR_SET (10 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_RX_BUF_NR_GET (11 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_MODE_SET (12 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_MODE_GET (13 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_MODE_PRI_SET (14 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_MODE_PRI_GET (15 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PORT_DEF_UP_SET (16 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PORT_DEF_UP_GET (17 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PORT_SCH_MODE_SET (18 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PORT_SCH_MODE_GET (19 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_DEF_SPRI_SET (20 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_DEF_SPRI_GET (21 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_DEF_CPRI_SET (22 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_DEF_CPRI_GET (23 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_FORCE_SPRI_ST_SET (24 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_FORCE_SPRI_ST_GET (25 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_FORCE_CPRI_ST_SET (26 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_FORCE_CPRI_ST_GET (27 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_QUEUE_REMARK_SET (28 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_QUEUE_REMARK_GET (29 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_RED_EN_SET (30 + SW_API_QOS_OFFSET)
+#define SW_API_QOS_PT_RED_EN_GET (31 + SW_API_QOS_OFFSET)
+
+ /* igmp */
+#define SW_API_IGMP_OFFSET 600
+#define SW_API_PT_IGMPS_MODE_SET (0 + SW_API_IGMP_OFFSET)
+#define SW_API_PT_IGMPS_MODE_GET (1 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_MLD_CMD_SET (2 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_MLD_CMD_GET (3 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_PT_JOIN_SET (4 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_PT_JOIN_GET (5 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_PT_LEAVE_SET (6 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_PT_LEAVE_GET (7 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_RP_SET (8 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_RP_GET (9 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_CREAT_SET (10 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_CREAT_GET (11 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_STATIC_SET (12 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_STATIC_GET (13 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_LEAKY_SET (14 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_LEAKY_GET (15 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_V3_SET (16 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_V3_GET (17 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_QUEUE_SET (18 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_ENTRY_QUEUE_GET (19 + SW_API_IGMP_OFFSET)
+#define SW_API_PT_IGMP_LEARN_LIMIT_SET (20 + SW_API_IGMP_OFFSET)
+#define SW_API_PT_IGMP_LEARN_LIMIT_GET (21 + SW_API_IGMP_OFFSET)
+#define SW_API_PT_IGMP_LEARN_EXCEED_CMD_SET (22 + SW_API_IGMP_OFFSET)
+#define SW_API_PT_IGMP_LEARN_EXCEED_CMD_GET (23 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_SG_ENTRY_SET (24 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_SG_ENTRY_CLEAR (25 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_SG_ENTRY_SHOW (26 + SW_API_IGMP_OFFSET)
+#define SW_API_IGMP_SG_ENTRY_QUERY (27 + SW_API_IGMP_OFFSET)
+
+ /* leaky */
+#define SW_API_LEAKY_OFFSET 700
+#define SW_API_UC_LEAKY_MODE_SET (0 + SW_API_LEAKY_OFFSET)
+#define SW_API_UC_LEAKY_MODE_GET (1 + SW_API_LEAKY_OFFSET)
+#define SW_API_MC_LEAKY_MODE_SET (2 + SW_API_LEAKY_OFFSET)
+#define SW_API_MC_LEAKY_MODE_GET (3 + SW_API_LEAKY_OFFSET)
+#define SW_API_ARP_LEAKY_MODE_SET (4 + SW_API_LEAKY_OFFSET)
+#define SW_API_ARP_LEAKY_MODE_GET (5 + SW_API_LEAKY_OFFSET)
+#define SW_API_PT_UC_LEAKY_MODE_SET (6 + SW_API_LEAKY_OFFSET)
+#define SW_API_PT_UC_LEAKY_MODE_GET (7 + SW_API_LEAKY_OFFSET)
+#define SW_API_PT_MC_LEAKY_MODE_SET (8 + SW_API_LEAKY_OFFSET)
+#define SW_API_PT_MC_LEAKY_MODE_GET (9 + SW_API_LEAKY_OFFSET)
+
+ /*mirror*/
+#define SW_API_MIR_OFFSET 800
+#define SW_API_MIRROR_ANALY_PT_SET (0 + SW_API_MIR_OFFSET)
+#define SW_API_MIRROR_ANALY_PT_GET (1 + SW_API_MIR_OFFSET)
+#define SW_API_MIRROR_IN_PT_SET (2 + SW_API_MIR_OFFSET)
+#define SW_API_MIRROR_IN_PT_GET (3 + SW_API_MIR_OFFSET)
+#define SW_API_MIRROR_EG_PT_SET (4 + SW_API_MIR_OFFSET)
+#define SW_API_MIRROR_EG_PT_GET (5 + SW_API_MIR_OFFSET)
+
+ /*rate*/
+#define SW_API_RATE_OFFSET 900
+#define SW_API_RATE_QU_EGRL_SET (0 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_QU_EGRL_GET (1 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PT_EGRL_SET (2 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PT_EGRL_GET (3 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PT_INRL_SET (4 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PT_INRL_GET (5 + SW_API_RATE_OFFSET)
+#define SW_API_STORM_CTRL_FRAME_SET (6 + SW_API_RATE_OFFSET)
+#define SW_API_STORM_CTRL_FRAME_GET (7 + SW_API_RATE_OFFSET)
+#define SW_API_STORM_CTRL_RATE_SET (8 + SW_API_RATE_OFFSET)
+#define SW_API_STORM_CTRL_RATE_GET (9 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PORT_POLICER_SET (10 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PORT_POLICER_GET (11 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PORT_SHAPER_SET (12 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PORT_SHAPER_GET (13 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_QUEUE_SHAPER_SET (14 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_QUEUE_SHAPER_GET (15 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_ACL_POLICER_SET (16 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_ACL_POLICER_GET (17 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PT_ADDRATEBYTE_SET (18 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PT_ADDRATEBYTE_GET (19 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PT_GOL_FLOW_EN_SET (20 + SW_API_RATE_OFFSET)
+#define SW_API_RATE_PT_GOL_FLOW_EN_GET (21 + SW_API_RATE_OFFSET)
+
+ /*stp*/
+#define SW_API_STP_OFFSET 1000
+#define SW_API_STP_PT_STATE_SET (0 + SW_API_STP_OFFSET)
+#define SW_API_STP_PT_STATE_GET (1 + SW_API_STP_OFFSET)
+
+ /*mib*/
+#define SW_API_MIB_OFFSET 1100
+#define SW_API_PT_MIB_GET (0 + SW_API_MIB_OFFSET)
+#define SW_API_MIB_STATUS_SET (1 + SW_API_MIB_OFFSET)
+#define SW_API_MIB_STATUS_GET (2 + SW_API_MIB_OFFSET)
+#define SW_API_PT_MIB_FLUSH_COUNTERS (3+ SW_API_MIB_OFFSET)
+#define SW_API_MIB_CPU_KEEP_SET (4+ SW_API_MIB_OFFSET)
+#define SW_API_MIB_CPU_KEEP_GET (5+ SW_API_MIB_OFFSET)
+
+ /*misc*/
+#define SW_API_MISC_OFFSET 1200
+#define SW_API_ARP_STATUS_SET (0 + SW_API_MISC_OFFSET)
+#define SW_API_ARP_STATUS_GET (1 + SW_API_MISC_OFFSET)
+#define SW_API_FRAME_MAX_SIZE_SET (2 + SW_API_MISC_OFFSET)
+#define SW_API_FRAME_MAX_SIZE_GET (3 + SW_API_MISC_OFFSET)
+#define SW_API_PT_UNK_SA_CMD_SET (4 + SW_API_MISC_OFFSET)
+#define SW_API_PT_UNK_SA_CMD_GET (5 + SW_API_MISC_OFFSET)
+#define SW_API_PT_UNK_UC_FILTER_SET (6 + SW_API_MISC_OFFSET)
+#define SW_API_PT_UNK_UC_FILTER_GET (7 + SW_API_MISC_OFFSET)
+#define SW_API_PT_UNK_MC_FILTER_SET (8 + SW_API_MISC_OFFSET)
+#define SW_API_PT_UNK_MC_FILTER_GET (9 + SW_API_MISC_OFFSET)
+#define SW_API_PT_BC_FILTER_SET (10 + SW_API_MISC_OFFSET)
+#define SW_API_PT_BC_FILTER_GET (11 + SW_API_MISC_OFFSET)
+#define SW_API_CPU_PORT_STATUS_SET (12 + SW_API_MISC_OFFSET)
+#define SW_API_CPU_PORT_STATUS_GET (13 + SW_API_MISC_OFFSET)
+#define SW_API_BC_TO_CPU_PORT_SET (14 + SW_API_MISC_OFFSET)
+#define SW_API_BC_TO_CPU_PORT_GET (15 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_CMD_SET (16 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_CMD_GET (17 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_STATUS_SET (18 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_STATUS_GET (19 + SW_API_MISC_OFFSET)
+#define SW_API_PT_DHCP_SET (20 + SW_API_MISC_OFFSET)
+#define SW_API_PT_DHCP_GET (21 + SW_API_MISC_OFFSET)
+#define SW_API_ARP_CMD_SET (22 + SW_API_MISC_OFFSET)
+#define SW_API_ARP_CMD_GET (23 + SW_API_MISC_OFFSET)
+#define SW_API_EAPOL_CMD_SET (24 + SW_API_MISC_OFFSET)
+#define SW_API_EAPOL_CMD_GET (25 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_SESSION_ADD (26 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_SESSION_DEL (27 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_SESSION_GET (28 + SW_API_MISC_OFFSET)
+#define SW_API_EAPOL_STATUS_SET (29 + SW_API_MISC_OFFSET)
+#define SW_API_EAPOL_STATUS_GET (30 + SW_API_MISC_OFFSET)
+#define SW_API_RIPV1_STATUS_SET (31 + SW_API_MISC_OFFSET)
+#define SW_API_RIPV1_STATUS_GET (32 + SW_API_MISC_OFFSET)
+#define SW_API_PT_ARP_REQ_STATUS_SET (33 + SW_API_MISC_OFFSET)
+#define SW_API_PT_ARP_REQ_STATUS_GET (34 + SW_API_MISC_OFFSET)
+#define SW_API_PT_ARP_ACK_STATUS_SET (35 + SW_API_MISC_OFFSET)
+#define SW_API_PT_ARP_ACK_STATUS_GET (36 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_SESSION_TABLE_ADD (37 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_SESSION_TABLE_DEL (38 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_SESSION_TABLE_GET (39 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_SESSION_ID_SET (40 + SW_API_MISC_OFFSET)
+#define SW_API_PPPOE_SESSION_ID_GET (41 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_MASK_SET (42 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_MASK_GET (43 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_STATUS_GET (44 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_STATUS_CLEAR (45 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_PORT_LINK_MASK_SET (46 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_PORT_LINK_MASK_GET (47 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_PORT_LINK_STATUS_GET (48 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_MASK_MAC_LINKCHG_SET (49 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_MASK_MAC_LINKCHG_GET (50 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_STATUS_MAC_LINKCHG_GET (51 + SW_API_MISC_OFFSET)
+#define SW_API_INTR_STATUS_MAC_LINKCHG_CLEAR (52 + SW_API_MISC_OFFSET)
+#define SW_API_CPU_VID_EN_SET (53 + SW_API_MISC_OFFSET)
+#define SW_API_CPU_VID_EN_GET (54 + SW_API_MISC_OFFSET)
+#define SW_API_RTD_PPPOE_EN_SET (55 + SW_API_MISC_OFFSET)
+#define SW_API_RTD_PPPOE_EN_GET (56 + SW_API_MISC_OFFSET)
+
+
+ /*led*/
+#define SW_API_LED_OFFSET 1300
+#define SW_API_LED_PATTERN_SET (0 + SW_API_LED_OFFSET)
+#define SW_API_LED_PATTERN_GET (1 + SW_API_LED_OFFSET)
+
+ /* cosmap */
+#define SW_API_COSMAP_OFFSET 1400
+#define SW_API_COSMAP_UP_QU_SET (0 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_UP_QU_GET (1 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_DSCP_QU_SET (2 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_DSCP_QU_GET (3 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_DSCP_TO_PRI_SET (4 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_DSCP_TO_PRI_GET (5 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_DSCP_TO_DP_SET (6 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_DSCP_TO_DP_GET (7 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_UP_TO_PRI_SET (8 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_UP_TO_PRI_GET (9 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_UP_TO_DP_SET (10 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_UP_TO_DP_GET (11 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_PRI_TO_QU_SET (12 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_PRI_TO_QU_GET (13 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_PRI_TO_EHQU_SET (14 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_PRI_TO_EHQU_GET (15 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_EG_REMARK_SET (16 + SW_API_COSMAP_OFFSET)
+#define SW_API_COSMAP_EG_REMARK_GET (17 + SW_API_COSMAP_OFFSET)
+
+ /* sec */
+#define SW_API_SEC_OFFSET 1500
+#define SW_API_SEC_NORM_SET (0 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_NORM_GET (1 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_MAC_SET (2 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_MAC_GET (3 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_IP_SET (4 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_IP_GET (5 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_IP4_SET (6 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_IP4_GET (7 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_IP6_SET (8 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_IP6_GET (9 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_TCP_SET (10 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_TCP_GET (11 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_UDP_SET (12 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_UDP_GET (13 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_ICMP4_SET (14 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_ICMP4_GET (15 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_ICMP6_SET (16 + SW_API_SEC_OFFSET)
+#define SW_API_SEC_ICMP6_GET (17 + SW_API_SEC_OFFSET)
+
+ /* ip */
+#define SW_API_IP_OFFSET 1600
+#define SW_API_IP_HOST_ADD (0 + SW_API_IP_OFFSET)
+#define SW_API_IP_HOST_DEL (1 + SW_API_IP_OFFSET)
+#define SW_API_IP_HOST_GET (2 + SW_API_IP_OFFSET)
+#define SW_API_IP_HOST_NEXT (3 + SW_API_IP_OFFSET)
+#define SW_API_IP_HOST_COUNTER_BIND (4 + SW_API_IP_OFFSET)
+#define SW_API_IP_HOST_PPPOE_BIND (5 + SW_API_IP_OFFSET)
+#define SW_API_IP_PT_ARP_LEARN_SET (6 + SW_API_IP_OFFSET)
+#define SW_API_IP_PT_ARP_LEARN_GET (7 + SW_API_IP_OFFSET)
+#define SW_API_IP_ARP_LEARN_SET (8 + SW_API_IP_OFFSET)
+#define SW_API_IP_ARP_LEARN_GET (9 + SW_API_IP_OFFSET)
+#define SW_API_IP_SOURCE_GUARD_SET (10 + SW_API_IP_OFFSET)
+#define SW_API_IP_SOURCE_GUARD_GET (11 + SW_API_IP_OFFSET)
+#define SW_API_IP_ARP_GUARD_SET (12 + SW_API_IP_OFFSET)
+#define SW_API_IP_ARP_GUARD_GET (13 + SW_API_IP_OFFSET)
+#define SW_API_IP_ROUTE_STATUS_SET (14 + SW_API_IP_OFFSET)
+#define SW_API_IP_ROUTE_STATUS_GET (15 + SW_API_IP_OFFSET)
+#define SW_API_IP_INTF_ENTRY_ADD (16 + SW_API_IP_OFFSET)
+#define SW_API_IP_INTF_ENTRY_DEL (17 + SW_API_IP_OFFSET)
+#define SW_API_IP_INTF_ENTRY_NEXT (18 + SW_API_IP_OFFSET)
+#define SW_API_IP_UNK_SOURCE_CMD_SET (19 + SW_API_IP_OFFSET)
+#define SW_API_IP_UNK_SOURCE_CMD_GET (20 + SW_API_IP_OFFSET)
+#define SW_API_ARP_UNK_SOURCE_CMD_SET (21 + SW_API_IP_OFFSET)
+#define SW_API_ARP_UNK_SOURCE_CMD_GET (22 + SW_API_IP_OFFSET)
+#define SW_API_IP_AGE_TIME_SET (23 + SW_API_IP_OFFSET)
+#define SW_API_IP_AGE_TIME_GET (24 + SW_API_IP_OFFSET)
+#define SW_API_WCMP_HASH_MODE_SET (25 + SW_API_IP_OFFSET)
+#define SW_API_WCMP_HASH_MODE_GET (26 + SW_API_IP_OFFSET)
+
+ /* nat */
+#define SW_API_NAT_OFFSET 1700
+#define SW_API_NAT_ADD (0 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_DEL (1 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_GET (2 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_NEXT (3 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_COUNTER_BIND (4 + SW_API_NAT_OFFSET)
+#define SW_API_NAPT_ADD (5 + SW_API_NAT_OFFSET)
+#define SW_API_NAPT_DEL (6 + SW_API_NAT_OFFSET)
+#define SW_API_NAPT_GET (7 + SW_API_NAT_OFFSET)
+#define SW_API_NAPT_NEXT (8 + SW_API_NAT_OFFSET)
+#define SW_API_NAPT_COUNTER_BIND (9 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_STATUS_SET (10 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_STATUS_GET (11 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_HASH_MODE_SET (12 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_HASH_MODE_GET (13 + SW_API_NAT_OFFSET)
+#define SW_API_NAPT_STATUS_SET (14 + SW_API_NAT_OFFSET)
+#define SW_API_NAPT_STATUS_GET (15 + SW_API_NAT_OFFSET)
+#define SW_API_NAPT_MODE_SET (16 + SW_API_NAT_OFFSET)
+#define SW_API_NAPT_MODE_GET (17 + SW_API_NAT_OFFSET)
+#define SW_API_PRV_BASE_ADDR_SET (18 + SW_API_NAT_OFFSET)
+#define SW_API_PRV_BASE_ADDR_GET (19 + SW_API_NAT_OFFSET)
+#define SW_API_PRV_ADDR_MODE_SET (20 + SW_API_NAT_OFFSET)
+#define SW_API_PRV_ADDR_MODE_GET (21 + SW_API_NAT_OFFSET)
+#define SW_API_PUB_ADDR_ENTRY_ADD (22 + SW_API_NAT_OFFSET)
+#define SW_API_PUB_ADDR_ENTRY_DEL (23 + SW_API_NAT_OFFSET)
+#define SW_API_PUB_ADDR_ENTRY_NEXT (24 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_UNK_SESSION_CMD_SET (25 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_UNK_SESSION_CMD_GET (26 + SW_API_NAT_OFFSET)
+#define SW_API_PRV_BASE_MASK_SET (27 + SW_API_NAT_OFFSET)
+#define SW_API_PRV_BASE_MASK_GET (28 + SW_API_NAT_OFFSET)
+#define SW_API_NAT_GLOBAL_SET (29 + SW_API_NAT_OFFSET)
+
+ /* trunk */
+#define SW_API_TRUNK_OFFSET 1800
+#define SW_API_TRUNK_GROUP_SET (0 + SW_API_TRUNK_OFFSET)
+#define SW_API_TRUNK_GROUP_GET (1 + SW_API_TRUNK_OFFSET)
+#define SW_API_TRUNK_HASH_SET (2 + SW_API_TRUNK_OFFSET)
+#define SW_API_TRUNK_HASH_GET (3 + SW_API_TRUNK_OFFSET)
+#define SW_API_TRUNK_MAN_SA_SET (4 + SW_API_TRUNK_OFFSET)
+#define SW_API_TRUNK_MAN_SA_GET (5 + SW_API_TRUNK_OFFSET)
+
+ /* Interface Control */
+#define SW_API_INTERFACE_OFFSET 1900
+#define SW_API_MAC_MODE_SET (0 + SW_API_INTERFACE_OFFSET)
+#define SW_API_MAC_MODE_GET (1 + SW_API_INTERFACE_OFFSET)
+#define SW_API_PORT_3AZ_STATUS_SET (2 + SW_API_INTERFACE_OFFSET)
+#define SW_API_PORT_3AZ_STATUS_GET (3 + SW_API_INTERFACE_OFFSET)
+#define SW_API_PHY_MODE_SET (4 + SW_API_INTERFACE_OFFSET)
+#define SW_API_PHY_MODE_GET (5 + SW_API_INTERFACE_OFFSET)
+#define SW_API_FX100_CTRL_SET (6 + SW_API_INTERFACE_OFFSET)
+#define SW_API_FX100_CTRL_GET (7 + SW_API_INTERFACE_OFFSET)
+#define SW_API_FX100_STATUS_GET (8 + SW_API_INTERFACE_OFFSET)
+#define SW_API_MAC06_EXCH_SET (9 + SW_API_INTERFACE_OFFSET)
+#define SW_API_MAC06_EXCH_GET (10 + SW_API_INTERFACE_OFFSET)
+
+ /*debug*/
+#define SW_API_DEBUG_OFFSET 10000
+#define SW_API_PHY_GET (0 + SW_API_DEBUG_OFFSET)
+#define SW_API_PHY_SET (1 + SW_API_DEBUG_OFFSET)
+#define SW_API_REG_GET (2 + SW_API_DEBUG_OFFSET)
+#define SW_API_REG_SET (3 + SW_API_DEBUG_OFFSET)
+#define SW_API_REG_ENTRY_GET (4 + SW_API_DEBUG_OFFSET)
+#define SW_API_REG_ENTRY_SET (5 + SW_API_DEBUG_OFFSET)
+#define SW_API_REG_FIELD_GET (6 + SW_API_DEBUG_OFFSET)
+#define SW_API_REG_FIELD_SET (7 + SW_API_DEBUG_OFFSET)
+
+
+#define SW_API_MAX 0xffff
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _SW_IOCTL_H_ */
diff --git a/include/common/aos_head.h b/include/common/aos_head.h
new file mode 100755
index 0000000..ae9f7d7
--- /dev/null
+++ b/include/common/aos_head.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sal/os/aos_mem.h"
+#include "sal/os/aos_timer.h"
+#include "sal/os/aos_lock.h"
+#include "sal/os/aos_types.h"
+
diff --git a/include/common/shared_func.h b/include/common/shared_func.h
new file mode 100755
index 0000000..6b0d725
--- /dev/null
+++ b/include/common/shared_func.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _SHARED_FUNC_H
+#define _SHARED_FUNC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define SW_RTN_ON_ERROR(rtn) \
+ do { if (rtn != SW_OK) return(rtn); } while(0);
+
+#define SW_OUT_ON_ERROR(rtn) \
+ do { \
+ if (rtn != SW_OK) { \
+ rv = rtn; \
+ goto out;\
+ } \
+ } while(0);
+
+#define SW_RTN_ON_ERROR_EXCEPT_COND1(rtn, cond1) \
+ do { \
+ if ((rtn != SW_OK) && (rtn != cond1)) \
+ return rtn; \
+ }while(0);
+
+#define SW_RTN_ON_NULL(op) \
+ do { \
+ if ((op) == NULL) \
+ return SW_NOT_INITIALIZED;\
+ }while(0);
+
+ /* register functions */
+#define SW_BIT_MASK_U32(nr) (~(0xFFFFFFFF << (nr)))
+
+#define SW_FIELD_MASK_U32(offset, len) \
+ ((SW_BIT_MASK_U32(len) << (offset)))
+
+#define SW_FIELD_MASK_NOT_U32(offset,len) \
+ (~(SW_BIT_MASK_U32(len) << (offset)))
+
+#define SW_FIELD_2_REG(field_val, bit_offset) \
+ (field_val << (bit_offset) )
+
+#define SW_REG_2_FIELD(reg_val, bit_offset, field_len) \
+ (((reg_val) >> (bit_offset)) & ((1 << (field_len)) - 1))
+
+#define SW_REG_SET_BY_FIELD_U32(reg_value, field_value, bit_offset, field_len)\
+ do { \
+ (reg_value) = \
+ (((reg_value) & SW_FIELD_MASK_NOT_U32((bit_offset),(field_len))) \
+ | (((field_value) & SW_BIT_MASK_U32(field_len)) << (bit_offset)));\
+ } while (0)
+
+#define SW_FIELD_GET_BY_REG_U32(reg_value, field_value, bit_offset, field_len)\
+ do { \
+ (field_value) = \
+ (((reg_value) >> (bit_offset)) & SW_BIT_MASK_U32(field_len)); \
+ } while (0)
+
+#define SW_SWAP_BITS_U8(x) \
+ ((((x)&0x80)>>7) | (((x)&0x40)>>5) | (((x)&0x20)>>3) | (((x)&0x10)>>1) \
+ |(((x)&0x1)<<7) | (((x)&0x2)<<5) | (((x)&0x4)<<3) |(((x)&0x8)<<1) )
+
+
+#define SW_OFFSET_U8_2_U16(byte_offset) ((byte_offset) >> 1)
+
+#define SW_OFFSET_U16_2_U8(word16_offset) ((word16_offset) << 1)
+
+#define SW_OFFSET_BIT_2_U8_ALIGN16(bit_offset) (((bit_offset) / 16) * 2)
+
+#define SW_SET_REG_BY_FIELD(reg, field, field_value, reg_value) \
+ SW_REG_SET_BY_FIELD_U32(reg_value, field_value, reg##_##field##_BOFFSET, \
+ reg##_##field##_BLEN)
+
+#define SW_GET_FIELD_BY_REG(reg, field, field_value, reg_value) \
+ SW_FIELD_GET_BY_REG_U32(reg_value, field_value, reg##_##field##_BOFFSET, \
+ reg##_##field##_BLEN)
+
+ /* port bitmap functions */
+#define SW_IS_PBMP_MEMBER(pbm, port) ((pbm & (1 << port)) ? A_TRUE: A_FALSE)
+#define SW_IS_PBMP_EQ(pbm0, pbm1) ((pbm0 == pbm1) ? A_TRUE: A_FALSE)
+
+#define SW_PBMP_AND(pbm0, pbm1) ((pbm0) &= (pbm1))
+#define SW_PBMP_OR(pbm0, pbm1) ((pbm0) |= (pbm1))
+#define SW_IS_PBMP_INCLUDE(pbm0, pbm1) \
+ ((pbm1 == SW_PBMP_AND(pbm0, pbm1)) ? A_TRUE: A_FALSE)
+
+#define SW_PBMP_CLEAR(pbm) ((pbm) = 0)
+#define SW_PBMP_ADD_PORT(pbm, port) ((pbm) |= (1U << (port)))
+#define SW_PBMP_DEL_PORT(pbm,port) ((pbm) &= ~(1U << (port)))
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _SHARED_FUNC_H */
diff --git a/include/common/sw.h b/include/common/sw.h
new file mode 100755
index 0000000..794d621
--- /dev/null
+++ b/include/common/sw.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _SW_H_
+#define _SW_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw_config.h"
+#include "common/aos_head.h"
+#include "common/sw_error.h"
+#include "common/shared_func.h"
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _SW_H_ */
+
diff --git a/include/common/sw_config.h b/include/common/sw_config.h
new file mode 100755
index 0000000..2acd126
--- /dev/null
+++ b/include/common/sw_config.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _SW_CONFIG_H
+#define _SW_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define SW_MAX_NR_DEV 1
+#define SW_MAX_NR_PORT 32
+
+#ifdef HSL_STANDALONG
+#define HSL_LOCAL
+#else
+#define HSL_LOCAL static
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --git a/include/common/sw_error.h b/include/common/sw_error.h
new file mode 100755
index 0000000..e6cb2d2
--- /dev/null
+++ b/include/common/sw_error.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _SW_ERROR_H
+#define _SW_ERROR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+ typedef enum {
+ SW_OK = 0, /* Operation succeeded */
+ SW_FAIL = -1, /* Operation failed */
+ SW_BAD_VALUE = -2, /* Illegal value */
+ SW_OUT_OF_RANGE = -3, /* Value is out of range */
+ SW_BAD_PARAM = -4, /* Illegal parameter(s) */
+ SW_BAD_PTR = -5, /* Illegal pointer value */
+ SW_BAD_LEN = -6, /* Wrong length */
+ SW_BAD_STATE = -7, /* Wrong state of state machine */
+ SW_READ_ERROR = -8, /* Read operation failed */
+ SW_WRITE_ERROR = -9, /* Write operation failed */
+ SW_CREATE_ERROR = -10, /* Fail in creating an entry */
+ SW_DELETE_ERROR = -11, /* Fail in deleteing an entry */
+ SW_NOT_FOUND = -12, /* Entry not found */
+ SW_NO_CHANGE = -13, /* The parameter(s) is the same */
+ SW_NO_MORE = -14, /* No more entry found */
+ SW_NO_SUCH = -15, /* No such entry */
+ SW_ALREADY_EXIST = -16, /* Tried to create existing entry */
+ SW_FULL = -17, /* Table is full */
+ SW_EMPTY = -18, /* Table is empty */
+ SW_NOT_SUPPORTED = -19, /* This request is not support */
+ SW_NOT_IMPLEMENTED = -20, /* This request is not implemented */
+ SW_NOT_INITIALIZED = -21, /* The item is not initialized */
+ SW_BUSY = -22, /* Operation is still running */
+ SW_TIMEOUT = -23, /* Operation Time Out */
+ SW_DISABLE = -24, /* Operation is disabled */
+ SW_NO_RESOURCE = -25, /* Resource not available (memory ...) */
+ SW_INIT_ERROR = -26, /* Error occured while INIT process */
+ SW_NOT_READY = -27, /* The other side is not ready yet */
+ SW_OUT_OF_MEM = -28, /* Cpu memory allocation failed. */
+ SW_ABORTED = -29 /* Operation has been aborted. */
+ } sw_error_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _SW_ERROR_H */
+
diff --git a/include/common/util.h b/include/common/util.h
new file mode 100755
index 0000000..94b5ab6
--- /dev/null
+++ b/include/common/util.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _UTIL_H_
+#define _UTIL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define LL_IN_ORDER 0x1
+#define LL_FIX_NDNR 0x2
+
+ typedef enum {
+ LL_CMP_EQUAL = 0,
+ LL_CMP_GREATER = 1,
+ LL_CMP_SMALLER = 2
+ }
+ ll_cmp_rslt_t;
+
+ typedef ll_cmp_rslt_t(*ll_nd_cmp) (void *src, void *dest);
+
+ typedef void (*ll_nd_dump) (void *data);
+
+ typedef struct _sll_node_t
+ {
+ struct _sll_node_t *next;
+ void *data;
+ } sll_node_t;
+
+ typedef struct
+ {
+ sll_node_t *fst_nd;
+ a_uint32_t nd_nr;
+ a_uint32_t flag;
+ ll_nd_cmp nd_cmp;
+ ll_nd_dump nd_dump;
+ sll_node_t *free_nd;
+ } sll_head_t;
+
+ sll_head_t *sll_creat(ll_nd_cmp cmp_func, ll_nd_dump dump_func,
+ a_uint32_t flag, a_uint32_t nd_nr);
+
+ void sll_destroy(sll_head_t * sll);
+
+ void sll_lock(sll_head_t * sll);
+
+ void sll_unlock(sll_head_t * sll);
+
+ void *sll_nd_find(const sll_head_t * sll, void *data,
+ a_uint32_t * iterator);
+
+ void *sll_nd_next(const sll_head_t * sll, a_uint32_t * iterator);
+
+ sw_error_t sll_nd_insert(sll_head_t * sll, void *data);
+
+ sw_error_t sll_nd_delete(sll_head_t * sll, void *data);
+
+ typedef struct
+ {
+ a_uint32_t id_ptr;
+ a_uint32_t id_nr;
+ a_uint32_t id_min;
+ a_uint32_t id_size;
+ void *id_pool;
+ } sid_pool_t;
+
+ sid_pool_t *sid_pool_creat(a_uint32_t id_nr, a_uint32_t min_id);
+
+ void sid_pool_destroy(sid_pool_t * pool);
+
+ sw_error_t sid_pool_id_alloc(sid_pool_t * pool, a_uint32_t * id);
+
+ sw_error_t sid_pool_id_free(sid_pool_t * pool, a_uint32_t id);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _UTIL_H_ */
diff --git a/include/fal/fal.h b/include/fal/fal.h
new file mode 100755
index 0000000..8a36b76
--- /dev/null
+++ b/include/fal/fal.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _FAL_H
+#define _FAL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "fal_misc.h"
+#include "fal_port_ctrl.h"
+#include "fal_vlan.h"
+#include "fal_fdb.h"
+#include "fal_portvlan.h"
+#include "fal_qos.h"
+#include "fal_stp.h"
+#include "fal_rate.h"
+#include "fal_mirror.h"
+#include "fal_leaky.h"
+#include "fal_igmp.h"
+#include "fal_mib.h"
+#include "fal_acl.h"
+#include "fal_led.h"
+#include "fal_reg_access.h"
+#include "fal_init.h"
+#include "fal_cosmap.h"
+#include "fal_ip.h"
+#include "fal_nat.h"
+#include "fal_sec.h"
+#include "fal_trunk.h"
+#include "fal_interface_ctrl.h"
+#include "fal_fdb.h"
+#include "fal_multi.h"
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_H */
diff --git a/include/fal/fal_acl.h b/include/fal/fal_acl.h
new file mode 100755
index 0000000..6c3a00d
--- /dev/null
+++ b/include/fal/fal_acl.h
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_acl FAL_ACL
+ * @{
+ */
+#ifndef _FAL_ACL_H_
+#define _FAL_ACL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+
+ /**
+ @brief This enum defines the ACL rule type.
+ */
+ typedef enum {
+ FAL_ACL_RULE_MAC = 0, /**< include MAC, udf fields*/
+ FAL_ACL_RULE_IP4, /**< include MAC, IP4 and Tcp/Udp udf fields*/
+ FAL_ACL_RULE_IP6, /**< include MAC, IP6 and Tcp/Udp udf fields*/
+ FAL_ACL_RULE_UDF, /**< only include user defined fields*/
+ FAL_ACL_RULE_BUTT,
+ }
+ fal_acl_rule_type_t;
+
+
+ /**
+ @brief This enum defines the ACL field operation type.
+ */
+ typedef enum
+ {
+ FAL_ACL_FIELD_MASK = 0, /**< match operation is mask*/
+ FAL_ACL_FIELD_RANGE, /**< match operation is range*/
+ FAL_ACL_FIELD_LE, /**< match operation is less and equal*/
+ FAL_ACL_FIELD_GE, /**< match operation is great and equal*/
+ FAL_ACL_FIELD_NE, /**<- match operation is not equal*/
+ FAL_ACL_FIELD_OP_BUTT,
+ } fal_acl_field_op_t;
+
+
+ typedef enum
+ {
+ FAL_ACL_POLICY_ROUTE = 0,
+ FAL_ACL_POLICY_SNAT,
+ FAL_ACL_POLICY_DNAT,
+ FAL_ACL_POLICY_RESERVE,
+ } fal_policy_forward_t;
+
+ typedef enum
+ {
+ FAL_ACL_COMBINED_NONE = 0,
+ FAL_ACL_COMBINED_START,
+ FAL_ACL_COMBINED_CONTINUE,
+ FAL_ACL_COMBINED_END,
+ } fal_combined_t;
+
+ /**
+ @brief This enum defines the ACL field operation type.
+ */
+ typedef enum
+ {
+ FAL_ACL_UDF_TYPE_L2 = 0, /**< */
+ FAL_ACL_UDF_TYPE_L3, /**< */
+ FAL_ACL_UDF_TYPE_L4, /**< */
+ FAL_ACL_UDF_TYPE_L2_SNAP, /**< */
+ FAL_ACL_UDF_TYPE_L3_PLUS, /**< */
+ FAL_ACL_UDF_TYPE_BUTT,
+ } fal_acl_udf_type_t;
+
+#define FAL_ACL_FIELD_MAC_DA 0
+#define FAL_ACL_FIELD_MAC_SA 1
+#define FAL_ACL_FIELD_MAC_ETHTYPE 2
+#define FAL_ACL_FIELD_MAC_TAGGED 3
+#define FAL_ACL_FIELD_MAC_UP 4
+#define FAL_ACL_FIELD_MAC_VID 5
+#define FAL_ACL_FIELD_IP4_SIP 6
+#define FAL_ACL_FIELD_IP4_DIP 7
+#define FAL_ACL_FIELD_IP6_LABEL 8
+#define FAL_ACL_FIELD_IP6_SIP 9
+#define FAL_ACL_FIELD_IP6_DIP 10
+#define FAL_ACL_FIELD_IP_PROTO 11
+#define FAL_ACL_FIELD_IP_DSCP 12
+#define FAL_ACL_FIELD_L4_SPORT 13
+#define FAL_ACL_FIELD_L4_DPORT 14
+#define FAL_ACL_FIELD_UDF 15
+#define FAL_ACL_FIELD_MAC_CFI 16
+#define FAL_ACL_FIELD_ICMP_TYPE 17
+#define FAL_ACL_FIELD_ICMP_CODE 18
+#define FAL_ACL_FIELD_TCP_FLAG 19
+#define FAL_ACL_FIELD_RIPV1 20
+#define FAL_ACL_FIELD_DHCPV4 21
+#define FAL_ACL_FIELD_DHCPV6 22
+#define FAL_ACL_FIELD_MAC_STAG_VID 23
+#define FAL_ACL_FIELD_MAC_STAG_PRI 24
+#define FAL_ACL_FIELD_MAC_STAG_DEI 25
+#define FAL_ACL_FIELD_MAC_STAGGED 26
+#define FAL_ACL_FIELD_MAC_CTAG_VID 27
+#define FAL_ACL_FIELD_MAC_CTAG_PRI 28
+#define FAL_ACL_FIELD_MAC_CTAG_CFI 29
+#define FAL_ACL_FIELD_MAC_CTAGGED 30
+#define FAL_ACL_FIELD_INVERSE_ALL 31
+
+
+#define FAL_ACL_ACTION_PERMIT 0
+#define FAL_ACL_ACTION_DENY 1
+#define FAL_ACL_ACTION_REDPT 2
+#define FAL_ACL_ACTION_RDTCPU 3
+#define FAL_ACL_ACTION_CPYCPU 4
+#define FAL_ACL_ACTION_MIRROR 5
+#define FAL_ACL_ACTION_MODIFY_VLAN 6
+#define FAL_ACL_ACTION_NEST_VLAN 7
+#define FAL_ACL_ACTION_REMARK_UP 8
+#define FAL_ACL_ACTION_REMARK_QUEUE 9
+#define FAL_ACL_ACTION_REMARK_STAG_VID 10
+#define FAL_ACL_ACTION_REMARK_STAG_PRI 11
+#define FAL_ACL_ACTION_REMARK_STAG_DEI 12
+#define FAL_ACL_ACTION_REMARK_CTAG_VID 13
+#define FAL_ACL_ACTION_REMARK_CTAG_PRI 14
+#define FAL_ACL_ACTION_REMARK_CTAG_CFI 15
+#define FAL_ACL_ACTION_REMARK_LOOKUP_VID 16
+#define FAL_ACL_ACTION_REMARK_DSCP 17
+#define FAL_ACL_ACTION_POLICER_EN 18
+#define FAL_ACL_ACTION_WCMP_EN 19
+#define FAL_ACL_ACTION_ARP_EN 20
+#define FAL_ACL_ACTION_POLICY_FORWARD_EN 21
+#define FAL_ACL_ACTION_BYPASS_EGRESS_TRANS 22
+#define FAL_ACL_ACTION_MATCH_TRIGGER_INTR 23
+
+
+
+ /**
+ * @brief This type defines the action in Acl rule.
+ * @details Comments:
+ * It's a bit map type, we can access it through macro FAL_ACTION_FLG_SET,
+ * FAL_ACTION_FLG_CLR and FAL_ACTION_FLG_TST.
+ */
+ typedef a_uint32_t fal_acl_action_map_t;
+
+#define FAL_ACTION_FLG_SET(flag, action) \
+ (flag) |= (0x1UL << (action))
+
+#define FAL_ACTION_FLG_CLR(flag, action) \
+ (flag) &= (~(0x1UL << (action)))
+
+#define FAL_ACTION_FLG_TST(flag, action) \
+ ((flag) & (0x1UL << (action))) ? 1 : 0
+
+
+ /**
+ * @brief This type defines the field in Acl rule.
+ * @details Comments:
+ * It's a bit map type, we can access it through macro FAL_FIELD_FLG_SET,
+ * FAL_FIELD_FLG_CLR and FAL_FIELD_FLG_TST.
+ */
+ typedef a_uint32_t fal_acl_field_map_t[2];
+
+#define FAL_FIELD_FLG_SET(flag, field) \
+ (flag[(field) / 32]) |= (0x1UL << ((field) % 32))
+
+#define FAL_FIELD_FLG_CLR(flag, field) \
+ (flag[(field) / 32]) &= (~(0x1UL << ((field) % 32)))
+
+#define FAL_FIELD_FLG_TST(flag, field) \
+ ((flag[(field) / 32]) & (0x1UL << ((field) % 32))) ? 1 : 0
+
+#define FAL_ACL_UDF_MAX_LENGTH 16
+
+ /**
+ * @brief This structure defines the Acl rule.
+ * @details Fields description:
+ *
+ *
+ * vid_val - If vid_op equals FAL_ACL_FIELD_MASK it's vlan id field value.
+ * If vid_op equals FAL_ACL_FIELD_RANGE it's vlan id field low value. If
+ * vid_op equals other value it's the compared value.
+ *
+ * vid_mask - If vid_op equals FAL_ACL_FIELD_MASK it's vlan id field mask.
+ * If vid_op equals FAL_ACL_FIELD_RANGE it's vlan id field high value. If vid_op
+ * equals other value it's meaningless.
+ *
+ *
+ * ip_dscp_val - It's eight bits field we can set any value between 0 - 255.
+ * ip_dscp_mask - It's eight bits field we can set any value between 0 - 255.
+ *
+ *
+ * src_l4port_val - If src_l4port_op equals FAL_ACL_FIELD_MASK it's layer four
+ * source port field value. If src_l4port_op equals FAL_ACL_FIELD_RANGE it's
+ * layer four source port field low value. If src_l4port_op equals other value
+ * it's the compared value.
+ *
+ *
+ * src_l4port_mask - If src_l4port_op equals FAL_ACL_FIELD_MASK it's layer four
+ * source port field mask. If src_l4port_op equals FAL_ACL_FIELD_RANGE it's
+ * layer four source port field high value. If src_l4port_op equals other value
+ * it's meaningless.
+ *
+ *
+ * dest_l4port_val - If dest_l4port_op equals FAL_ACL_FIELD_MASK it's layer four
+ * destination port field value. If dest_l4port_op equals FAL_ACL_FIELD_RANGE it's
+ * layer four source port field low value. If dest_l4port_op equals other value
+ * it's the compared value.
+ *
+ *
+ * dest_l4port_mask - If dest_l4port_op equals FAL_ACL_FIELD_MASK it's layer four
+ * source port field mask. If dest_l4port_op equals FAL_ACL_FIELD_RANGE it's
+ * layer four source port field high value. If dest_l4port_op equals other value
+ * it's meaningless.
+ *
+ *
+ * ports - If FAL_ACL_ACTION_REDPT bit is setted in action_flg it's redirect
+ * destination ports.
+ *
+ *
+ * dot1p - If FAL_ACL_ACTION_REMARK_DOT1P bit is setted in action_flg it's
+ * the expected dot1p value.
+ *
+ *
+ * queue - If FAL_ACL_ACTION_REMARK_QUEUE bit is setted in action_flg it's
+ * the expected queue value.
+ *
+ *
+ * vid - If FAL_ACL_ACTION_MODIFY_VLAN or FAL_ACL_ACTION_NEST_VLAN bit is
+ * setted in action_flg it's the expected vlan id value.
+ */
+ typedef struct
+ {
+ fal_acl_rule_type_t rule_type;
+ fal_acl_field_map_t field_flg;
+
+ /* fields of mac rule */
+ fal_mac_addr_t src_mac_val;
+ fal_mac_addr_t src_mac_mask;
+ fal_mac_addr_t dest_mac_val;
+ fal_mac_addr_t dest_mac_mask;
+ a_uint16_t ethtype_val;
+ a_uint16_t ethtype_mask;
+ a_uint16_t vid_val;
+ a_uint16_t vid_mask;
+ fal_acl_field_op_t vid_op;
+ a_uint8_t tagged_val;
+ a_uint8_t tagged_mask;
+ a_uint8_t up_val;
+ a_uint8_t up_mask;
+ a_uint8_t cfi_val;
+ a_uint8_t cfi_mask;
+ a_uint16_t resv0;
+
+ /* fields of enhanced mac rule*/
+ a_uint8_t stagged_val;
+ a_uint8_t stagged_mask;
+ a_uint8_t ctagged_val;
+ a_uint8_t ctagged_mask;
+ a_uint16_t stag_vid_val;
+ a_uint16_t stag_vid_mask;
+ fal_acl_field_op_t stag_vid_op;
+ a_uint16_t ctag_vid_val;
+ a_uint16_t ctag_vid_mask;
+ fal_acl_field_op_t ctag_vid_op;
+ a_uint8_t stag_pri_val;
+ a_uint8_t stag_pri_mask;
+ a_uint8_t ctag_pri_val;
+ a_uint8_t ctag_pri_mask;
+ a_uint8_t stag_dei_val;
+ a_uint8_t stag_dei_mask;
+ a_uint8_t ctag_cfi_val;
+ a_uint8_t ctag_cfi_mask;
+
+
+ /* fields of ip4 rule */
+ fal_ip4_addr_t src_ip4_val;
+ fal_ip4_addr_t src_ip4_mask;
+ fal_ip4_addr_t dest_ip4_val;
+ fal_ip4_addr_t dest_ip4_mask;
+
+ /* fields of ip6 rule */
+ a_uint32_t ip6_lable_val;
+ a_uint32_t ip6_lable_mask;
+ fal_ip6_addr_t src_ip6_val;
+ fal_ip6_addr_t src_ip6_mask;
+ fal_ip6_addr_t dest_ip6_val;
+ fal_ip6_addr_t dest_ip6_mask;
+
+ /* fields of ip rule */
+ a_uint8_t ip_proto_val;
+ a_uint8_t ip_proto_mask;
+ a_uint8_t ip_dscp_val;
+ a_uint8_t ip_dscp_mask;
+
+ /* fields of layer four */
+ a_uint16_t src_l4port_val;
+ a_uint16_t src_l4port_mask;
+ fal_acl_field_op_t src_l4port_op;
+ a_uint16_t dest_l4port_val;
+ a_uint16_t dest_l4port_mask;
+ fal_acl_field_op_t dest_l4port_op;
+ a_uint8_t icmp_type_val;
+ a_uint8_t icmp_type_mask;
+ a_uint8_t icmp_code_val;
+ a_uint8_t icmp_code_mask;
+ a_uint8_t tcp_flag_val;
+ a_uint8_t tcp_flag_mask;
+ a_uint8_t ripv1_val;
+ a_uint8_t ripv1_mask;
+ a_uint8_t dhcpv4_val;
+ a_uint8_t dhcpv4_mask;
+ a_uint8_t dhcpv6_val;
+ a_uint8_t dhcpv6_mask;
+
+ /* user defined fields */
+ fal_acl_udf_type_t udf_type;
+ a_uint8_t udf_offset;
+ a_uint8_t udf_len;
+ a_uint8_t udf_val[FAL_ACL_UDF_MAX_LENGTH];
+ a_uint8_t udf_mask[FAL_ACL_UDF_MAX_LENGTH];
+
+ /* fields of action */
+ fal_acl_action_map_t action_flg;
+ fal_pbmp_t ports;
+ a_uint32_t match_cnt;
+ a_uint16_t vid;
+ a_uint8_t up;
+ a_uint8_t queue;
+ a_uint16_t stag_vid;
+ a_uint8_t stag_pri;
+ a_uint8_t stag_dei;
+ a_uint16_t ctag_vid;
+ a_uint8_t ctag_pri;
+ a_uint8_t ctag_cfi;
+ a_uint16_t policer_ptr;
+ a_uint16_t arp_ptr;
+ a_uint16_t wcmp_ptr;
+ a_uint8_t dscp;
+ a_uint8_t rsv;
+ fal_policy_forward_t policy_fwd;
+ fal_combined_t combined;
+ } fal_acl_rule_t;
+
+
+ /**
+ @brief This enum defines the ACL will work on which derection traffic.
+ */
+ typedef enum
+ {
+ FAL_ACL_DIREC_IN = 0, /**< Acl will work on ingressive traffic */
+ FAL_ACL_DIREC_EG, /**< Acl will work on egressive traffic */
+ FAL_ACL_DIREC_BOTH, /**< Acl will work on both ingressive and egressive traffic*/
+ } fal_acl_direc_t;
+
+
+ /**
+ @brief This enum defines the ACL will work on which partiualr object.
+ */
+ typedef enum
+ {
+ FAL_ACL_BIND_PORT = 0, /**< Acl wil work on particular port */
+ } fal_acl_bind_obj_t;
+
+
+ sw_error_t
+ fal_acl_list_creat(a_uint32_t dev_id, a_uint32_t list_id, a_uint32_t list_pri);
+
+
+ sw_error_t
+ fal_acl_list_destroy(a_uint32_t dev_id, a_uint32_t list_id);
+
+
+
+ sw_error_t
+ fal_acl_rule_add(a_uint32_t dev_id, a_uint32_t list_id, a_uint32_t rule_id,
+ a_uint32_t rule_nr, fal_acl_rule_t * rule);
+
+
+ sw_error_t
+ fal_acl_rule_delete(a_uint32_t dev_id, a_uint32_t list_id, a_uint32_t rule_id,
+ a_uint32_t rule_nr);
+
+
+ sw_error_t
+ fal_acl_rule_query(a_uint32_t dev_id, a_uint32_t list_id, a_uint32_t rule_id,
+ fal_acl_rule_t * rule);
+
+
+
+ sw_error_t
+ fal_acl_list_bind(a_uint32_t dev_id, a_uint32_t list_id,
+ fal_acl_direc_t direc, fal_acl_bind_obj_t obj_t,
+ a_uint32_t obj_idx);
+
+
+ sw_error_t
+ fal_acl_list_unbind(a_uint32_t dev_id, a_uint32_t list_id,
+ fal_acl_direc_t direc, fal_acl_bind_obj_t obj_t,
+ a_uint32_t obj_idx);
+
+
+ sw_error_t
+ fal_acl_status_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_acl_status_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_acl_list_dump(a_uint32_t dev_id);
+
+
+ sw_error_t
+ fal_acl_rule_dump(a_uint32_t dev_id);
+
+
+ sw_error_t
+ fal_acl_port_udf_profile_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_acl_udf_type_t udf_type,
+ a_uint32_t offset, a_uint32_t length);
+
+ sw_error_t
+ fal_acl_port_udf_profile_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_acl_udf_type_t udf_type,
+ a_uint32_t * offset, a_uint32_t * length);
+
+ sw_error_t
+ fal_acl_rule_active(a_uint32_t dev_id, a_uint32_t list_id,
+ a_uint32_t rule_id, a_uint32_t rule_nr);
+
+ sw_error_t
+ fal_acl_rule_deactive(a_uint32_t dev_id, a_uint32_t list_id,
+ a_uint32_t rule_id, a_uint32_t rule_nr);
+
+ sw_error_t
+ fal_acl_rule_src_filter_sts_set(a_uint32_t dev_id,
+ a_uint32_t rule_id, a_bool_t enable);
+
+ sw_error_t
+ fal_acl_rule_src_filter_sts_get(a_uint32_t dev_id,
+ a_uint32_t rule_id, a_bool_t* enable);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_ACL_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_api.h b/include/fal/fal_api.h
new file mode 100755
index 0000000..817400c
--- /dev/null
+++ b/include/fal/fal_api.h
@@ -0,0 +1,1136 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _FAL_API_H_
+#define _FAL_API_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef IN_PORTCONTROL
+#define PORTCONTROL_API \
+ SW_API_DEF(SW_API_PT_DUPLEX_GET, fal_port_duplex_get), \
+ SW_API_DEF(SW_API_PT_DUPLEX_SET, fal_port_duplex_set), \
+ SW_API_DEF(SW_API_PT_SPEED_GET, fal_port_speed_get), \
+ SW_API_DEF(SW_API_PT_SPEED_SET, fal_port_speed_set), \
+ SW_API_DEF(SW_API_PT_AN_GET, fal_port_autoneg_status_get), \
+ SW_API_DEF(SW_API_PT_AN_ENABLE, fal_port_autoneg_enable), \
+ SW_API_DEF(SW_API_PT_AN_RESTART, fal_port_autoneg_restart), \
+ SW_API_DEF(SW_API_PT_AN_ADV_GET, fal_port_autoneg_adv_get), \
+ SW_API_DEF(SW_API_PT_AN_ADV_SET, fal_port_autoneg_adv_set), \
+ SW_API_DEF(SW_API_PT_HDR_SET, fal_port_hdr_status_set), \
+ SW_API_DEF(SW_API_PT_HDR_GET, fal_port_hdr_status_get), \
+ SW_API_DEF(SW_API_PT_FLOWCTRL_SET, fal_port_flowctrl_set), \
+ SW_API_DEF(SW_API_PT_FLOWCTRL_GET, fal_port_flowctrl_get), \
+ SW_API_DEF(SW_API_PT_FLOWCTRL_MODE_SET, fal_port_flowctrl_forcemode_set), \
+ SW_API_DEF(SW_API_PT_FLOWCTRL_MODE_GET, fal_port_flowctrl_forcemode_get), \
+ SW_API_DEF(SW_API_PT_POWERSAVE_SET, fal_port_powersave_set), \
+ SW_API_DEF(SW_API_PT_POWERSAVE_GET, fal_port_powersave_get), \
+ SW_API_DEF(SW_API_PT_HIBERNATE_SET, fal_port_hibernate_set), \
+ SW_API_DEF(SW_API_PT_HIBERNATE_GET, fal_port_hibernate_get), \
+ SW_API_DEF(SW_API_PT_CDT, fal_port_cdt), \
+ SW_API_DEF(SW_API_PT_TXHDR_SET, fal_port_txhdr_mode_set), \
+ SW_API_DEF(SW_API_PT_TXHDR_GET, fal_port_txhdr_mode_get), \
+ SW_API_DEF(SW_API_PT_RXHDR_SET, fal_port_rxhdr_mode_set), \
+ SW_API_DEF(SW_API_PT_RXHDR_GET, fal_port_rxhdr_mode_get), \
+ SW_API_DEF(SW_API_HEADER_TYPE_SET, fal_header_type_set), \
+ SW_API_DEF(SW_API_HEADER_TYPE_GET, fal_header_type_get), \
+ SW_API_DEF(SW_API_TXMAC_STATUS_SET, fal_port_txmac_status_set), \
+ SW_API_DEF(SW_API_TXMAC_STATUS_GET, fal_port_txmac_status_get), \
+ SW_API_DEF(SW_API_RXMAC_STATUS_SET, fal_port_rxmac_status_set), \
+ SW_API_DEF(SW_API_RXMAC_STATUS_GET, fal_port_rxmac_status_get), \
+ SW_API_DEF(SW_API_TXFC_STATUS_SET, fal_port_txfc_status_set), \
+ SW_API_DEF(SW_API_TXFC_STATUS_GET, fal_port_txfc_status_get), \
+ SW_API_DEF(SW_API_RXFC_STATUS_SET, fal_port_rxfc_status_set), \
+ SW_API_DEF(SW_API_RXFC_STATUS_GET, fal_port_rxfc_status_get), \
+ SW_API_DEF(SW_API_BP_STATUS_SET, fal_port_bp_status_set), \
+ SW_API_DEF(SW_API_BP_STATUS_GET, fal_port_bp_status_get), \
+ SW_API_DEF(SW_API_PT_LINK_MODE_SET, fal_port_link_forcemode_set), \
+ SW_API_DEF(SW_API_PT_LINK_MODE_GET, fal_port_link_forcemode_get), \
+ SW_API_DEF(SW_API_PT_LINK_STATUS_GET, fal_port_link_status_get), \
+ SW_API_DEF(SW_API_PT_MAC_LOOPBACK_SET, fal_port_mac_loopback_set), \
+ SW_API_DEF(SW_API_PT_MAC_LOOPBACK_GET, fal_port_mac_loopback_get),
+
+#define PORTCONTROL_API_PARAM \
+ SW_API_DESC(SW_API_PT_DUPLEX_GET) \
+ SW_API_DESC(SW_API_PT_DUPLEX_SET) \
+ SW_API_DESC(SW_API_PT_SPEED_GET) \
+ SW_API_DESC(SW_API_PT_SPEED_SET) \
+ SW_API_DESC(SW_API_PT_AN_GET) \
+ SW_API_DESC(SW_API_PT_AN_ENABLE) \
+ SW_API_DESC(SW_API_PT_AN_RESTART) \
+ SW_API_DESC(SW_API_PT_AN_ADV_GET) \
+ SW_API_DESC(SW_API_PT_AN_ADV_SET) \
+ SW_API_DESC(SW_API_PT_HDR_SET) \
+ SW_API_DESC(SW_API_PT_HDR_GET) \
+ SW_API_DESC(SW_API_PT_FLOWCTRL_SET) \
+ SW_API_DESC(SW_API_PT_FLOWCTRL_GET) \
+ SW_API_DESC(SW_API_PT_FLOWCTRL_MODE_SET) \
+ SW_API_DESC(SW_API_PT_FLOWCTRL_MODE_GET) \
+ SW_API_DESC(SW_API_PT_POWERSAVE_SET) \
+ SW_API_DESC(SW_API_PT_POWERSAVE_GET) \
+ SW_API_DESC(SW_API_PT_HIBERNATE_SET) \
+ SW_API_DESC(SW_API_PT_HIBERNATE_GET) \
+ SW_API_DESC(SW_API_PT_CDT) \
+ SW_API_DESC(SW_API_PT_TXHDR_SET) \
+ SW_API_DESC(SW_API_PT_TXHDR_GET) \
+ SW_API_DESC(SW_API_PT_RXHDR_SET) \
+ SW_API_DESC(SW_API_PT_RXHDR_GET) \
+ SW_API_DESC(SW_API_HEADER_TYPE_SET) \
+ SW_API_DESC(SW_API_HEADER_TYPE_GET) \
+ SW_API_DESC(SW_API_TXMAC_STATUS_SET) \
+ SW_API_DESC(SW_API_TXMAC_STATUS_GET) \
+ SW_API_DESC(SW_API_RXMAC_STATUS_SET) \
+ SW_API_DESC(SW_API_RXMAC_STATUS_GET) \
+ SW_API_DESC(SW_API_TXFC_STATUS_SET) \
+ SW_API_DESC(SW_API_TXFC_STATUS_GET) \
+ SW_API_DESC(SW_API_RXFC_STATUS_SET) \
+ SW_API_DESC(SW_API_RXFC_STATUS_GET) \
+ SW_API_DESC(SW_API_BP_STATUS_SET) \
+ SW_API_DESC(SW_API_BP_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_LINK_MODE_SET) \
+ SW_API_DESC(SW_API_PT_LINK_MODE_GET) \
+ SW_API_DESC(SW_API_PT_LINK_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_MAC_LOOPBACK_SET) \
+ SW_API_DESC(SW_API_PT_MAC_LOOPBACK_GET)
+#else
+#define PORTCONTROL_API
+#define PORTCONTROL_API_PARAM
+#endif
+
+#ifdef IN_VLAN
+#define VLAN_API \
+ SW_API_DEF(SW_API_VLAN_ADD, fal_vlan_create), \
+ SW_API_DEF(SW_API_VLAN_DEL, fal_vlan_delete), \
+ SW_API_DEF(SW_API_VLAN_MEM_UPDATE, fal_vlan_member_update), \
+ SW_API_DEF(SW_API_VLAN_FIND, fal_vlan_find), \
+ SW_API_DEF(SW_API_VLAN_NEXT, fal_vlan_next), \
+ SW_API_DEF(SW_API_VLAN_APPEND, fal_vlan_entry_append), \
+ SW_API_DEF(SW_API_VLAN_FLUSH, fal_vlan_flush), \
+ SW_API_DEF(SW_API_VLAN_FID_SET, fal_vlan_fid_set), \
+ SW_API_DEF(SW_API_VLAN_FID_GET, fal_vlan_fid_get), \
+ SW_API_DEF(SW_API_VLAN_MEMBER_ADD, fal_vlan_member_add), \
+ SW_API_DEF(SW_API_VLAN_MEMBER_DEL, fal_vlan_member_del), \
+ SW_API_DEF(SW_API_VLAN_LEARN_STATE_SET, fal_vlan_learning_state_set), \
+ SW_API_DEF(SW_API_VLAN_LEARN_STATE_GET, fal_vlan_learning_state_get),
+
+#define VLAN_API_PARAM \
+ SW_API_DESC(SW_API_VLAN_ADD) \
+ SW_API_DESC(SW_API_VLAN_DEL) \
+ SW_API_DESC(SW_API_VLAN_MEM_UPDATE) \
+ SW_API_DESC(SW_API_VLAN_FIND) \
+ SW_API_DESC(SW_API_VLAN_NEXT) \
+ SW_API_DESC(SW_API_VLAN_APPEND) \
+ SW_API_DESC(SW_API_VLAN_FLUSH) \
+ SW_API_DESC(SW_API_VLAN_FID_SET) \
+ SW_API_DESC(SW_API_VLAN_FID_GET) \
+ SW_API_DESC(SW_API_VLAN_MEMBER_ADD) \
+ SW_API_DESC(SW_API_VLAN_MEMBER_DEL) \
+ SW_API_DESC(SW_API_VLAN_LEARN_STATE_SET) \
+ SW_API_DESC(SW_API_VLAN_LEARN_STATE_GET)
+#else
+#define VLAN_API
+#define VLAN_API_PARAM
+#endif
+
+#ifdef IN_PORTVLAN
+#define PORTVLAN_API \
+ SW_API_DEF(SW_API_PT_ING_MODE_GET, fal_port_1qmode_get), \
+ SW_API_DEF(SW_API_PT_ING_MODE_SET, fal_port_1qmode_set), \
+ SW_API_DEF(SW_API_PT_EG_MODE_GET, fal_port_egvlanmode_get), \
+ SW_API_DEF(SW_API_PT_EG_MODE_SET, fal_port_egvlanmode_set), \
+ SW_API_DEF(SW_API_PT_VLAN_MEM_ADD, fal_portvlan_member_add), \
+ SW_API_DEF(SW_API_PT_VLAN_MEM_DEL, fal_portvlan_member_del), \
+ SW_API_DEF(SW_API_PT_VLAN_MEM_UPDATE, fal_portvlan_member_update), \
+ SW_API_DEF(SW_API_PT_VLAN_MEM_GET, fal_portvlan_member_get), \
+ SW_API_DEF(SW_API_PT_DEF_VID_SET, fal_port_default_vid_set), \
+ SW_API_DEF(SW_API_PT_DEF_VID_GET, fal_port_default_vid_get), \
+ SW_API_DEF(SW_API_PT_FORCE_DEF_VID_SET, fal_port_force_default_vid_set), \
+ SW_API_DEF(SW_API_PT_FORCE_DEF_VID_GET, fal_port_force_default_vid_get), \
+ SW_API_DEF(SW_API_PT_FORCE_PORTVLAN_SET, fal_port_force_portvlan_set), \
+ SW_API_DEF(SW_API_PT_FORCE_PORTVLAN_GET, fal_port_force_portvlan_get), \
+ SW_API_DEF(SW_API_PT_NESTVLAN_SET, fal_port_nestvlan_set), \
+ SW_API_DEF(SW_API_PT_NESTVLAN_GET, fal_port_nestvlan_get), \
+ SW_API_DEF(SW_API_NESTVLAN_TPID_SET, fal_nestvlan_tpid_set), \
+ SW_API_DEF(SW_API_NESTVLAN_TPID_GET, fal_nestvlan_tpid_get), \
+ SW_API_DEF(SW_API_PT_IN_VLAN_MODE_SET, fal_port_invlan_mode_set), \
+ SW_API_DEF(SW_API_PT_IN_VLAN_MODE_GET, fal_port_invlan_mode_get), \
+ SW_API_DEF(SW_API_PT_TLS_SET, fal_port_tls_set), \
+ SW_API_DEF(SW_API_PT_TLS_GET, fal_port_tls_get), \
+ SW_API_DEF(SW_API_PT_PRI_PROPAGATION_SET, fal_port_pri_propagation_set), \
+ SW_API_DEF(SW_API_PT_PRI_PROPAGATION_GET, fal_port_pri_propagation_get), \
+ SW_API_DEF(SW_API_PT_DEF_SVID_SET, fal_port_default_svid_set), \
+ SW_API_DEF(SW_API_PT_DEF_SVID_GET, fal_port_default_svid_get), \
+ SW_API_DEF(SW_API_PT_DEF_CVID_SET, fal_port_default_cvid_set), \
+ SW_API_DEF(SW_API_PT_DEF_CVID_GET, fal_port_default_cvid_get), \
+ SW_API_DEF(SW_API_PT_VLAN_PROPAGATION_SET, fal_port_vlan_propagation_set), \
+ SW_API_DEF(SW_API_PT_VLAN_PROPAGATION_GET, fal_port_vlan_propagation_get), \
+ SW_API_DEF(SW_API_PT_VLAN_TRANS_ADD, fal_port_vlan_trans_add), \
+ SW_API_DEF(SW_API_PT_VLAN_TRANS_DEL, fal_port_vlan_trans_del), \
+ SW_API_DEF(SW_API_PT_VLAN_TRANS_GET, fal_port_vlan_trans_get), \
+ SW_API_DEF(SW_API_QINQ_MODE_SET, fal_qinq_mode_set), \
+ SW_API_DEF(SW_API_QINQ_MODE_GET, fal_qinq_mode_get), \
+ SW_API_DEF(SW_API_PT_QINQ_ROLE_SET, fal_port_qinq_role_set), \
+ SW_API_DEF(SW_API_PT_QINQ_ROLE_GET, fal_port_qinq_role_get), \
+ SW_API_DEF(SW_API_PT_VLAN_TRANS_ITERATE, fal_port_vlan_trans_iterate), \
+ SW_API_DEF(SW_API_PT_MAC_VLAN_XLT_SET, fal_port_mac_vlan_xlt_set), \
+ SW_API_DEF(SW_API_PT_MAC_VLAN_XLT_GET, fal_port_mac_vlan_xlt_get), \
+ SW_API_DEF(SW_API_NETISOLATE_SET, fal_netisolate_set), \
+ SW_API_DEF(SW_API_NETISOLATE_GET, fal_netisolate_get), \
+ SW_API_DEF(SW_API_EG_FLTR_BYPASS_EN_SET, fal_eg_trans_filter_bypass_en_set), \
+ SW_API_DEF(SW_API_EG_FLTR_BYPASS_EN_GET, fal_eg_trans_filter_bypass_en_get),
+
+#define PORTVLAN_API_PARAM \
+ SW_API_DESC(SW_API_PT_ING_MODE_GET) \
+ SW_API_DESC(SW_API_PT_ING_MODE_SET) \
+ SW_API_DESC(SW_API_PT_EG_MODE_GET) \
+ SW_API_DESC(SW_API_PT_EG_MODE_SET) \
+ SW_API_DESC(SW_API_PT_VLAN_MEM_ADD) \
+ SW_API_DESC(SW_API_PT_VLAN_MEM_DEL) \
+ SW_API_DESC(SW_API_PT_VLAN_MEM_UPDATE) \
+ SW_API_DESC(SW_API_PT_VLAN_MEM_GET) \
+ SW_API_DESC(SW_API_PT_DEF_VID_SET) \
+ SW_API_DESC(SW_API_PT_DEF_VID_GET) \
+ SW_API_DESC(SW_API_PT_FORCE_DEF_VID_SET) \
+ SW_API_DESC(SW_API_PT_FORCE_DEF_VID_GET) \
+ SW_API_DESC(SW_API_PT_FORCE_PORTVLAN_SET) \
+ SW_API_DESC(SW_API_PT_FORCE_PORTVLAN_GET) \
+ SW_API_DESC(SW_API_PT_NESTVLAN_SET) \
+ SW_API_DESC(SW_API_PT_NESTVLAN_GET) \
+ SW_API_DESC(SW_API_NESTVLAN_TPID_SET) \
+ SW_API_DESC(SW_API_NESTVLAN_TPID_GET) \
+ SW_API_DESC(SW_API_PT_IN_VLAN_MODE_SET) \
+ SW_API_DESC(SW_API_PT_IN_VLAN_MODE_GET) \
+ SW_API_DESC(SW_API_PT_TLS_SET) \
+ SW_API_DESC(SW_API_PT_TLS_GET) \
+ SW_API_DESC(SW_API_PT_PRI_PROPAGATION_SET) \
+ SW_API_DESC(SW_API_PT_PRI_PROPAGATION_GET) \
+ SW_API_DESC(SW_API_PT_DEF_SVID_SET) \
+ SW_API_DESC(SW_API_PT_DEF_SVID_GET) \
+ SW_API_DESC(SW_API_PT_DEF_CVID_SET) \
+ SW_API_DESC(SW_API_PT_DEF_CVID_GET) \
+ SW_API_DESC(SW_API_PT_VLAN_PROPAGATION_SET) \
+ SW_API_DESC(SW_API_PT_VLAN_PROPAGATION_GET) \
+ SW_API_DESC(SW_API_PT_VLAN_TRANS_ADD) \
+ SW_API_DESC(SW_API_PT_VLAN_TRANS_DEL) \
+ SW_API_DESC(SW_API_PT_VLAN_TRANS_GET) \
+ SW_API_DESC(SW_API_QINQ_MODE_SET) \
+ SW_API_DESC(SW_API_QINQ_MODE_GET) \
+ SW_API_DESC(SW_API_PT_QINQ_ROLE_SET) \
+ SW_API_DESC(SW_API_PT_QINQ_ROLE_GET) \
+ SW_API_DESC(SW_API_PT_VLAN_TRANS_ITERATE) \
+ SW_API_DESC(SW_API_PT_MAC_VLAN_XLT_SET) \
+ SW_API_DESC(SW_API_PT_MAC_VLAN_XLT_GET) \
+ SW_API_DESC(SW_API_NETISOLATE_SET) \
+ SW_API_DESC(SW_API_NETISOLATE_GET) \
+ SW_API_DESC(SW_API_EG_FLTR_BYPASS_EN_SET) \
+ SW_API_DESC(SW_API_EG_FLTR_BYPASS_EN_GET)
+#else
+#define PORTVLAN_API
+#define PORTVLAN_API_PARAM
+#endif
+
+#ifdef IN_FDB
+#define FDB_API \
+ SW_API_DEF(SW_API_FDB_ADD, fal_fdb_add), \
+ SW_API_DEF(SW_API_FDB_DELALL, fal_fdb_del_all), \
+ SW_API_DEF(SW_API_FDB_DELPORT,fal_fdb_del_by_port), \
+ SW_API_DEF(SW_API_FDB_DELMAC, fal_fdb_del_by_mac), \
+ SW_API_DEF(SW_API_FDB_FIRST, fal_fdb_first), \
+ SW_API_DEF(SW_API_FDB_NEXT, fal_fdb_next), \
+ SW_API_DEF(SW_API_FDB_FIND, fal_fdb_find), \
+ SW_API_DEF(SW_API_FDB_PT_LEARN_SET, fal_fdb_port_learn_set), \
+ SW_API_DEF(SW_API_FDB_PT_LEARN_GET, fal_fdb_port_learn_get), \
+ SW_API_DEF(SW_API_FDB_AGE_CTRL_SET, fal_fdb_age_ctrl_set), \
+ SW_API_DEF(SW_API_FDB_AGE_CTRL_GET, fal_fdb_age_ctrl_get), \
+ SW_API_DEF(SW_API_FDB_VLAN_IVL_SVL_SET, fal_fdb_vlan_ivl_svl_set),\
+ SW_API_DEF(SW_API_FDB_VLAN_IVL_SVL_GET, fal_fdb_vlan_ivl_svl_get),\
+ SW_API_DEF(SW_API_FDB_AGE_TIME_SET, fal_fdb_age_time_set), \
+ SW_API_DEF(SW_API_FDB_AGE_TIME_GET, fal_fdb_age_time_get), \
+ SW_API_DEF(SW_API_FDB_ITERATE, fal_fdb_iterate), \
+ SW_API_DEF(SW_API_FDB_EXTEND_NEXT, fal_fdb_extend_next), \
+ SW_API_DEF(SW_API_FDB_EXTEND_FIRST, fal_fdb_extend_first), \
+ SW_API_DEF(SW_API_FDB_TRANSFER, fal_fdb_transfer), \
+ SW_API_DEF(SW_API_PT_FDB_LEARN_LIMIT_SET, fal_port_fdb_learn_limit_set), \
+ SW_API_DEF(SW_API_PT_FDB_LEARN_LIMIT_GET, fal_port_fdb_learn_limit_get), \
+ SW_API_DEF(SW_API_PT_FDB_LEARN_EXCEED_CMD_SET, fal_port_fdb_learn_exceed_cmd_set), \
+ SW_API_DEF(SW_API_PT_FDB_LEARN_EXCEED_CMD_GET, fal_port_fdb_learn_exceed_cmd_get), \
+ SW_API_DEF(SW_API_FDB_LEARN_LIMIT_SET, fal_fdb_learn_limit_set), \
+ SW_API_DEF(SW_API_FDB_LEARN_LIMIT_GET, fal_fdb_learn_limit_get), \
+ SW_API_DEF(SW_API_FDB_LEARN_EXCEED_CMD_SET, fal_fdb_learn_exceed_cmd_set), \
+ SW_API_DEF(SW_API_FDB_LEARN_EXCEED_CMD_GET, fal_fdb_learn_exceed_cmd_get), \
+ SW_API_DEF(SW_API_FDB_RESV_ADD, fal_fdb_resv_add), \
+ SW_API_DEF(SW_API_FDB_RESV_DEL, fal_fdb_resv_del), \
+ SW_API_DEF(SW_API_FDB_RESV_FIND, fal_fdb_resv_find), \
+ SW_API_DEF(SW_API_FDB_RESV_ITERATE, fal_fdb_resv_iterate), \
+ SW_API_DEF(SW_API_FDB_PT_LEARN_STATIC_SET, fal_fdb_port_learn_static_set), \
+ SW_API_DEF(SW_API_FDB_PT_LEARN_STATIC_GET, fal_fdb_port_learn_static_get), \
+ SW_API_DEF(SW_API_FDB_PORT_ADD, fal_fdb_port_add), \
+ SW_API_DEF(SW_API_FDB_PORT_DEL, fal_fdb_port_del),
+
+#define FDB_API_PARAM \
+ SW_API_DESC(SW_API_FDB_ADD) \
+ SW_API_DESC(SW_API_FDB_DELALL) \
+ SW_API_DESC(SW_API_FDB_DELPORT) \
+ SW_API_DESC(SW_API_FDB_DELMAC) \
+ SW_API_DESC(SW_API_FDB_FIRST) \
+ SW_API_DESC(SW_API_FDB_NEXT) \
+ SW_API_DESC(SW_API_FDB_FIND) \
+ SW_API_DESC(SW_API_FDB_PT_LEARN_SET) \
+ SW_API_DESC(SW_API_FDB_PT_LEARN_GET) \
+ SW_API_DESC(SW_API_FDB_AGE_CTRL_SET) \
+ SW_API_DESC(SW_API_FDB_AGE_CTRL_GET) \
+ SW_API_DESC(SW_API_FDB_VLAN_IVL_SVL_SET) \
+ SW_API_DESC(SW_API_FDB_VLAN_IVL_SVL_GET) \
+ SW_API_DESC(SW_API_FDB_AGE_TIME_SET) \
+ SW_API_DESC(SW_API_FDB_AGE_TIME_GET) \
+ SW_API_DESC(SW_API_FDB_ITERATE) \
+ SW_API_DESC(SW_API_FDB_EXTEND_NEXT) \
+ SW_API_DESC(SW_API_FDB_EXTEND_FIRST) \
+ SW_API_DESC(SW_API_FDB_TRANSFER) \
+ SW_API_DESC(SW_API_PT_FDB_LEARN_LIMIT_SET) \
+ SW_API_DESC(SW_API_PT_FDB_LEARN_LIMIT_GET) \
+ SW_API_DESC(SW_API_PT_FDB_LEARN_EXCEED_CMD_SET) \
+ SW_API_DESC(SW_API_PT_FDB_LEARN_EXCEED_CMD_GET) \
+ SW_API_DESC(SW_API_FDB_LEARN_LIMIT_SET) \
+ SW_API_DESC(SW_API_FDB_LEARN_LIMIT_GET) \
+ SW_API_DESC(SW_API_FDB_LEARN_EXCEED_CMD_SET) \
+ SW_API_DESC(SW_API_FDB_LEARN_EXCEED_CMD_GET) \
+ SW_API_DESC(SW_API_FDB_RESV_ADD) \
+ SW_API_DESC(SW_API_FDB_RESV_DEL) \
+ SW_API_DESC(SW_API_FDB_RESV_FIND) \
+ SW_API_DESC(SW_API_FDB_RESV_ITERATE) \
+ SW_API_DESC(SW_API_FDB_PT_LEARN_STATIC_SET) \
+ SW_API_DESC(SW_API_FDB_PT_LEARN_STATIC_GET) \
+ SW_API_DESC(SW_API_FDB_PORT_ADD) \
+ SW_API_DESC(SW_API_FDB_PORT_DEL)
+#else
+#define FDB_API
+#define FDB_API_PARAM
+#endif
+
+#ifdef IN_ACL
+#define ACL_API \
+ SW_API_DEF(SW_API_ACL_LIST_CREAT, fal_acl_list_creat), \
+ SW_API_DEF(SW_API_ACL_LIST_DESTROY, fal_acl_list_destroy), \
+ SW_API_DEF(SW_API_ACL_RULE_ADD, fal_acl_rule_add), \
+ SW_API_DEF(SW_API_ACL_RULE_DELETE, fal_acl_rule_delete), \
+ SW_API_DEF(SW_API_ACL_RULE_QUERY, fal_acl_rule_query), \
+ SW_API_DEF(SW_API_ACL_LIST_BIND, fal_acl_list_bind), \
+ SW_API_DEF(SW_API_ACL_LIST_UNBIND, fal_acl_list_unbind), \
+ SW_API_DEF(SW_API_ACL_STATUS_SET, fal_acl_status_set), \
+ SW_API_DEF(SW_API_ACL_STATUS_GET, fal_acl_status_get), \
+ SW_API_DEF(SW_API_ACL_LIST_DUMP, fal_acl_list_dump), \
+ SW_API_DEF(SW_API_ACL_RULE_DUMP, fal_acl_rule_dump), \
+ SW_API_DEF(SW_API_ACL_PT_UDF_PROFILE_SET, fal_acl_port_udf_profile_set), \
+ SW_API_DEF(SW_API_ACL_PT_UDF_PROFILE_GET, fal_acl_port_udf_profile_get), \
+ SW_API_DEF(SW_API_ACL_RULE_ACTIVE, fal_acl_rule_active), \
+ SW_API_DEF(SW_API_ACL_RULE_DEACTIVE, fal_acl_rule_deactive),\
+ SW_API_DEF(SW_API_ACL_RULE_SRC_FILTER_STS_SET, fal_acl_rule_src_filter_sts_set),\
+ SW_API_DEF(SW_API_ACL_RULE_SRC_FILTER_STS_GET, fal_acl_rule_src_filter_sts_get),\
+
+#define ACL_API_PARAM \
+ SW_API_DESC(SW_API_ACL_LIST_CREAT) \
+ SW_API_DESC(SW_API_ACL_LIST_DESTROY) \
+ SW_API_DESC(SW_API_ACL_RULE_ADD) \
+ SW_API_DESC(SW_API_ACL_RULE_DELETE) \
+ SW_API_DESC(SW_API_ACL_RULE_QUERY) \
+ SW_API_DESC(SW_API_ACL_LIST_BIND) \
+ SW_API_DESC(SW_API_ACL_LIST_UNBIND) \
+ SW_API_DESC(SW_API_ACL_STATUS_SET) \
+ SW_API_DESC(SW_API_ACL_STATUS_GET) \
+ SW_API_DESC(SW_API_ACL_LIST_DUMP) \
+ SW_API_DESC(SW_API_ACL_RULE_DUMP) \
+ SW_API_DESC(SW_API_ACL_PT_UDF_PROFILE_SET) \
+ SW_API_DESC(SW_API_ACL_PT_UDF_PROFILE_GET) \
+ SW_API_DESC(SW_API_ACL_RULE_ACTIVE) \
+ SW_API_DESC(SW_API_ACL_RULE_DEACTIVE) \
+ SW_API_DESC(SW_API_ACL_RULE_SRC_FILTER_STS_SET)\
+ SW_API_DESC(SW_API_ACL_RULE_SRC_FILTER_STS_GET)
+
+#else
+#define ACL_API
+#define ACL_API_PARAM
+#endif
+
+#ifdef IN_QOS
+#define QOS_API \
+ SW_API_DEF(SW_API_QOS_SCH_MODE_SET, fal_qos_sch_mode_set), \
+ SW_API_DEF(SW_API_QOS_SCH_MODE_GET, fal_qos_sch_mode_get), \
+ SW_API_DEF(SW_API_QOS_QU_TX_BUF_ST_SET, fal_qos_queue_tx_buf_status_set), \
+ SW_API_DEF(SW_API_QOS_QU_TX_BUF_ST_GET, fal_qos_queue_tx_buf_status_get), \
+ SW_API_DEF(SW_API_QOS_QU_TX_BUF_NR_SET, fal_qos_queue_tx_buf_nr_set), \
+ SW_API_DEF(SW_API_QOS_QU_TX_BUF_NR_GET, fal_qos_queue_tx_buf_nr_get), \
+ SW_API_DEF(SW_API_QOS_PT_TX_BUF_ST_SET, fal_qos_port_tx_buf_status_set), \
+ SW_API_DEF(SW_API_QOS_PT_TX_BUF_ST_GET, fal_qos_port_tx_buf_status_get), \
+ SW_API_DEF(SW_API_QOS_PT_RED_EN_SET, fal_qos_port_red_en_set), \
+ SW_API_DEF(SW_API_QOS_PT_RED_EN_GET, fal_qos_port_red_en_get), \
+ SW_API_DEF(SW_API_QOS_PT_TX_BUF_NR_SET, fal_qos_port_tx_buf_nr_set), \
+ SW_API_DEF(SW_API_QOS_PT_TX_BUF_NR_GET, fal_qos_port_tx_buf_nr_get), \
+ SW_API_DEF(SW_API_QOS_PT_RX_BUF_NR_SET, fal_qos_port_rx_buf_nr_set), \
+ SW_API_DEF(SW_API_QOS_PT_RX_BUF_NR_GET, fal_qos_port_rx_buf_nr_get), \
+ SW_API_DEF(SW_API_COSMAP_UP_QU_SET, fal_cosmap_up_queue_set), \
+ SW_API_DEF(SW_API_COSMAP_UP_QU_GET, fal_cosmap_up_queue_get), \
+ SW_API_DEF(SW_API_COSMAP_DSCP_QU_SET, fal_cosmap_dscp_queue_set), \
+ SW_API_DEF(SW_API_COSMAP_DSCP_QU_GET, fal_cosmap_dscp_queue_get), \
+ SW_API_DEF(SW_API_QOS_PT_MODE_SET, fal_qos_port_mode_set), \
+ SW_API_DEF(SW_API_QOS_PT_MODE_GET, fal_qos_port_mode_get), \
+ SW_API_DEF(SW_API_QOS_PT_MODE_PRI_SET, fal_qos_port_mode_pri_set), \
+ SW_API_DEF(SW_API_QOS_PT_MODE_PRI_GET, fal_qos_port_mode_pri_get), \
+ SW_API_DEF(SW_API_QOS_PORT_DEF_UP_SET, fal_qos_port_default_up_set), \
+ SW_API_DEF(SW_API_QOS_PORT_DEF_UP_GET, fal_qos_port_default_up_get), \
+ SW_API_DEF(SW_API_QOS_PORT_SCH_MODE_SET, fal_qos_port_sch_mode_set), \
+ SW_API_DEF(SW_API_QOS_PORT_SCH_MODE_GET, fal_qos_port_sch_mode_get), \
+ SW_API_DEF(SW_API_QOS_PT_DEF_SPRI_SET, fal_qos_port_default_spri_set), \
+ SW_API_DEF(SW_API_QOS_PT_DEF_SPRI_GET, fal_qos_port_default_spri_get), \
+ SW_API_DEF(SW_API_QOS_PT_DEF_CPRI_SET, fal_qos_port_default_cpri_set), \
+ SW_API_DEF(SW_API_QOS_PT_DEF_CPRI_GET, fal_qos_port_default_cpri_get), \
+ SW_API_DEF(SW_API_QOS_PT_FORCE_SPRI_ST_SET, fal_qos_port_force_spri_status_set), \
+ SW_API_DEF(SW_API_QOS_PT_FORCE_SPRI_ST_GET, fal_qos_port_force_spri_status_get), \
+ SW_API_DEF(SW_API_QOS_PT_FORCE_CPRI_ST_SET, fal_qos_port_force_cpri_status_set), \
+ SW_API_DEF(SW_API_QOS_PT_FORCE_CPRI_ST_GET, fal_qos_port_force_cpri_status_get), \
+ SW_API_DEF(SW_API_QOS_QUEUE_REMARK_SET, fal_qos_queue_remark_table_set), \
+ SW_API_DEF(SW_API_QOS_QUEUE_REMARK_GET, fal_qos_queue_remark_table_get),
+
+#define QOS_API_PARAM \
+ SW_API_DESC(SW_API_QOS_SCH_MODE_SET) \
+ SW_API_DESC(SW_API_QOS_SCH_MODE_GET) \
+ SW_API_DESC(SW_API_QOS_QU_TX_BUF_ST_SET) \
+ SW_API_DESC(SW_API_QOS_QU_TX_BUF_ST_GET) \
+ SW_API_DESC(SW_API_QOS_QU_TX_BUF_NR_SET) \
+ SW_API_DESC(SW_API_QOS_QU_TX_BUF_NR_GET) \
+ SW_API_DESC(SW_API_QOS_PT_TX_BUF_ST_SET) \
+ SW_API_DESC(SW_API_QOS_PT_TX_BUF_ST_GET) \
+ SW_API_DESC(SW_API_QOS_PT_RED_EN_SET)\
+ SW_API_DESC(SW_API_QOS_PT_RED_EN_GET)\
+ SW_API_DESC(SW_API_QOS_PT_TX_BUF_NR_SET) \
+ SW_API_DESC(SW_API_QOS_PT_TX_BUF_NR_GET) \
+ SW_API_DESC(SW_API_QOS_PT_RX_BUF_NR_SET) \
+ SW_API_DESC(SW_API_QOS_PT_RX_BUF_NR_GET) \
+ SW_API_DESC(SW_API_COSMAP_UP_QU_SET) \
+ SW_API_DESC(SW_API_COSMAP_UP_QU_GET) \
+ SW_API_DESC(SW_API_COSMAP_DSCP_QU_SET) \
+ SW_API_DESC(SW_API_COSMAP_DSCP_QU_GET) \
+ SW_API_DESC(SW_API_QOS_PT_MODE_SET) \
+ SW_API_DESC(SW_API_QOS_PT_MODE_GET) \
+ SW_API_DESC(SW_API_QOS_PT_MODE_PRI_SET) \
+ SW_API_DESC(SW_API_QOS_PT_MODE_PRI_GET) \
+ SW_API_DESC(SW_API_QOS_PORT_DEF_UP_SET) \
+ SW_API_DESC(SW_API_QOS_PORT_DEF_UP_GET) \
+ SW_API_DESC(SW_API_QOS_PORT_SCH_MODE_SET) \
+ SW_API_DESC(SW_API_QOS_PORT_SCH_MODE_GET) \
+ SW_API_DESC(SW_API_QOS_PT_DEF_SPRI_SET) \
+ SW_API_DESC(SW_API_QOS_PT_DEF_SPRI_GET) \
+ SW_API_DESC(SW_API_QOS_PT_DEF_CPRI_SET) \
+ SW_API_DESC(SW_API_QOS_PT_DEF_CPRI_GET) \
+ SW_API_DESC(SW_API_QOS_PT_FORCE_SPRI_ST_SET) \
+ SW_API_DESC(SW_API_QOS_PT_FORCE_SPRI_ST_GET) \
+ SW_API_DESC(SW_API_QOS_PT_FORCE_CPRI_ST_SET) \
+ SW_API_DESC(SW_API_QOS_PT_FORCE_CPRI_ST_GET) \
+ SW_API_DESC(SW_API_QOS_QUEUE_REMARK_SET) \
+ SW_API_DESC(SW_API_QOS_QUEUE_REMARK_GET)
+#else
+#define QOS_API
+#define QOS_API_PARAM
+#endif
+
+#ifdef IN_IGMP
+#define IGMP_API \
+ SW_API_DEF(SW_API_PT_IGMPS_MODE_SET, fal_port_igmps_status_set), \
+ SW_API_DEF(SW_API_PT_IGMPS_MODE_GET, fal_port_igmps_status_get), \
+ SW_API_DEF(SW_API_IGMP_MLD_CMD_SET, fal_igmp_mld_cmd_set), \
+ SW_API_DEF(SW_API_IGMP_MLD_CMD_GET, fal_igmp_mld_cmd_get), \
+ SW_API_DEF(SW_API_IGMP_PT_JOIN_SET, fal_port_igmp_mld_join_set), \
+ SW_API_DEF(SW_API_IGMP_PT_JOIN_GET, fal_port_igmp_mld_join_get), \
+ SW_API_DEF(SW_API_IGMP_PT_LEAVE_SET, fal_port_igmp_mld_leave_set), \
+ SW_API_DEF(SW_API_IGMP_PT_LEAVE_GET, fal_port_igmp_mld_leave_get), \
+ SW_API_DEF(SW_API_IGMP_RP_SET, fal_igmp_mld_rp_set), \
+ SW_API_DEF(SW_API_IGMP_RP_GET, fal_igmp_mld_rp_get), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_CREAT_SET, fal_igmp_mld_entry_creat_set), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_CREAT_GET, fal_igmp_mld_entry_creat_get), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_STATIC_SET, fal_igmp_mld_entry_static_set), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_STATIC_GET, fal_igmp_mld_entry_static_get), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_LEAKY_SET, fal_igmp_mld_entry_leaky_set), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_LEAKY_GET, fal_igmp_mld_entry_leaky_get), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_V3_SET, fal_igmp_mld_entry_v3_set), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_V3_GET, fal_igmp_mld_entry_v3_get), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_QUEUE_SET, fal_igmp_mld_entry_queue_set), \
+ SW_API_DEF(SW_API_IGMP_ENTRY_QUEUE_GET, fal_igmp_mld_entry_queue_get), \
+ SW_API_DEF(SW_API_PT_IGMP_LEARN_LIMIT_SET, fal_port_igmp_mld_learn_limit_set), \
+ SW_API_DEF(SW_API_PT_IGMP_LEARN_LIMIT_GET, fal_port_igmp_mld_learn_limit_get), \
+ SW_API_DEF(SW_API_PT_IGMP_LEARN_EXCEED_CMD_SET, fal_port_igmp_mld_learn_exceed_cmd_set), \
+ SW_API_DEF(SW_API_PT_IGMP_LEARN_EXCEED_CMD_GET, fal_port_igmp_mld_learn_exceed_cmd_get), \
+ SW_API_DEF(SW_API_IGMP_SG_ENTRY_SET, fal_igmp_sg_entry_set), \
+ SW_API_DEF(SW_API_IGMP_SG_ENTRY_CLEAR, fal_igmp_sg_entry_clear), \
+ SW_API_DEF(SW_API_IGMP_SG_ENTRY_SHOW, fal_igmp_sg_entry_show), \
+ SW_API_DEF(SW_API_IGMP_SG_ENTRY_QUERY, fal_igmp_sg_entry_query),
+
+#define IGMP_API_PARAM \
+ SW_API_DESC(SW_API_PT_IGMPS_MODE_SET) \
+ SW_API_DESC(SW_API_PT_IGMPS_MODE_GET) \
+ SW_API_DESC(SW_API_IGMP_MLD_CMD_SET) \
+ SW_API_DESC(SW_API_IGMP_MLD_CMD_GET) \
+ SW_API_DESC(SW_API_IGMP_PT_JOIN_SET) \
+ SW_API_DESC(SW_API_IGMP_PT_JOIN_GET) \
+ SW_API_DESC(SW_API_IGMP_PT_LEAVE_SET) \
+ SW_API_DESC(SW_API_IGMP_PT_LEAVE_GET) \
+ SW_API_DESC(SW_API_IGMP_RP_SET) \
+ SW_API_DESC(SW_API_IGMP_RP_GET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_CREAT_SET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_CREAT_GET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_STATIC_SET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_STATIC_GET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_LEAKY_SET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_LEAKY_GET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_V3_SET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_V3_GET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_QUEUE_SET) \
+ SW_API_DESC(SW_API_IGMP_ENTRY_QUEUE_GET) \
+ SW_API_DESC(SW_API_PT_IGMP_LEARN_LIMIT_SET) \
+ SW_API_DESC(SW_API_PT_IGMP_LEARN_LIMIT_GET) \
+ SW_API_DESC(SW_API_PT_IGMP_LEARN_EXCEED_CMD_SET) \
+ SW_API_DESC(SW_API_PT_IGMP_LEARN_EXCEED_CMD_GET) \
+ SW_API_DESC(SW_API_IGMP_SG_ENTRY_SET) \
+ SW_API_DESC(SW_API_IGMP_SG_ENTRY_CLEAR) \
+ SW_API_DESC(SW_API_IGMP_SG_ENTRY_SHOW) \
+ SW_API_DESC(SW_API_IGMP_SG_ENTRY_QUERY)
+#else
+#define IGMP_API
+#define IGMP_API_PARAM
+#endif
+
+#ifdef IN_LEAKY
+#define LEAKY_API \
+ SW_API_DEF(SW_API_UC_LEAKY_MODE_SET, fal_uc_leaky_mode_set), \
+ SW_API_DEF(SW_API_UC_LEAKY_MODE_GET, fal_uc_leaky_mode_get), \
+ SW_API_DEF(SW_API_MC_LEAKY_MODE_SET, fal_mc_leaky_mode_set), \
+ SW_API_DEF(SW_API_MC_LEAKY_MODE_GET, fal_mc_leaky_mode_get), \
+ SW_API_DEF(SW_API_ARP_LEAKY_MODE_SET, fal_port_arp_leaky_set), \
+ SW_API_DEF(SW_API_ARP_LEAKY_MODE_GET, fal_port_arp_leaky_get), \
+ SW_API_DEF(SW_API_PT_UC_LEAKY_MODE_SET, fal_port_uc_leaky_set), \
+ SW_API_DEF(SW_API_PT_UC_LEAKY_MODE_GET, fal_port_uc_leaky_get), \
+ SW_API_DEF(SW_API_PT_MC_LEAKY_MODE_SET, fal_port_mc_leaky_set), \
+ SW_API_DEF(SW_API_PT_MC_LEAKY_MODE_GET, fal_port_mc_leaky_get),
+
+#define LEAKY_API_PARAM \
+ SW_API_DESC(SW_API_UC_LEAKY_MODE_SET) \
+ SW_API_DESC(SW_API_UC_LEAKY_MODE_GET) \
+ SW_API_DESC(SW_API_MC_LEAKY_MODE_SET) \
+ SW_API_DESC(SW_API_MC_LEAKY_MODE_GET) \
+ SW_API_DESC(SW_API_ARP_LEAKY_MODE_SET)\
+ SW_API_DESC(SW_API_ARP_LEAKY_MODE_GET) \
+ SW_API_DESC(SW_API_PT_UC_LEAKY_MODE_SET) \
+ SW_API_DESC(SW_API_PT_UC_LEAKY_MODE_GET) \
+ SW_API_DESC(SW_API_PT_MC_LEAKY_MODE_SET) \
+ SW_API_DESC(SW_API_PT_MC_LEAKY_MODE_GET)
+#else
+#define LEAKY_API
+#define LEAKY_API_PARAM
+#endif
+
+#ifdef IN_MIRROR
+#define MIRROR_API \
+ SW_API_DEF(SW_API_MIRROR_ANALY_PT_SET, fal_mirr_analysis_port_set), \
+ SW_API_DEF(SW_API_MIRROR_ANALY_PT_GET, fal_mirr_analysis_port_get), \
+ SW_API_DEF(SW_API_MIRROR_IN_PT_SET, fal_mirr_port_in_set), \
+ SW_API_DEF(SW_API_MIRROR_IN_PT_GET, fal_mirr_port_in_get), \
+ SW_API_DEF(SW_API_MIRROR_EG_PT_SET, fal_mirr_port_eg_set), \
+ SW_API_DEF(SW_API_MIRROR_EG_PT_GET, fal_mirr_port_eg_get),
+
+#define MIRROR_API_PARAM \
+ SW_API_DESC(SW_API_MIRROR_ANALY_PT_SET) \
+ SW_API_DESC(SW_API_MIRROR_ANALY_PT_GET) \
+ SW_API_DESC(SW_API_MIRROR_IN_PT_SET) \
+ SW_API_DESC(SW_API_MIRROR_IN_PT_GET) \
+ SW_API_DESC(SW_API_MIRROR_EG_PT_SET) \
+ SW_API_DESC(SW_API_MIRROR_EG_PT_GET)
+#else
+#define MIRROR_API
+#define MIRROR_API_PARAM
+#endif
+
+#ifdef IN_RATE
+#define RATE_API \
+ SW_API_DEF(SW_API_RATE_QU_EGRL_SET, fal_rate_queue_egrl_set), \
+ SW_API_DEF(SW_API_RATE_QU_EGRL_GET, fal_rate_queue_egrl_get), \
+ SW_API_DEF(SW_API_RATE_PT_EGRL_SET, fal_rate_port_egrl_set), \
+ SW_API_DEF(SW_API_RATE_PT_EGRL_GET, fal_rate_port_egrl_get), \
+ SW_API_DEF(SW_API_RATE_PT_INRL_SET, fal_rate_port_inrl_set), \
+ SW_API_DEF(SW_API_RATE_PT_INRL_GET, fal_rate_port_inrl_get), \
+ SW_API_DEF(SW_API_STORM_CTRL_FRAME_SET, fal_storm_ctrl_frame_set), \
+ SW_API_DEF(SW_API_STORM_CTRL_FRAME_GET, fal_storm_ctrl_frame_get), \
+ SW_API_DEF(SW_API_STORM_CTRL_RATE_SET, fal_storm_ctrl_rate_set), \
+ SW_API_DEF(SW_API_STORM_CTRL_RATE_GET, fal_storm_ctrl_rate_get), \
+ SW_API_DEF(SW_API_RATE_PORT_POLICER_SET, fal_rate_port_policer_set), \
+ SW_API_DEF(SW_API_RATE_PORT_POLICER_GET, fal_rate_port_policer_get), \
+ SW_API_DEF(SW_API_RATE_PORT_SHAPER_SET, fal_rate_port_shaper_set), \
+ SW_API_DEF(SW_API_RATE_PORT_SHAPER_GET, fal_rate_port_shaper_get), \
+ SW_API_DEF(SW_API_RATE_QUEUE_SHAPER_SET, fal_rate_queue_shaper_set), \
+ SW_API_DEF(SW_API_RATE_QUEUE_SHAPER_GET, fal_rate_queue_shaper_get), \
+ SW_API_DEF(SW_API_RATE_ACL_POLICER_SET, fal_rate_acl_policer_set), \
+ SW_API_DEF(SW_API_RATE_ACL_POLICER_GET, fal_rate_acl_policer_get), \
+ SW_API_DEF(SW_API_RATE_PT_ADDRATEBYTE_SET, fal_rate_port_add_rate_byte_set), \
+ SW_API_DEF(SW_API_RATE_PT_ADDRATEBYTE_GET, fal_rate_port_add_rate_byte_get), \
+ SW_API_DEF(SW_API_RATE_PT_GOL_FLOW_EN_SET, fal_rate_port_gol_flow_en_set), \
+ SW_API_DEF(SW_API_RATE_PT_GOL_FLOW_EN_GET, fal_rate_port_gol_flow_en_get),
+
+#define RATE_API_PARAM \
+ SW_API_DESC(SW_API_RATE_QU_EGRL_SET) \
+ SW_API_DESC(SW_API_RATE_QU_EGRL_GET) \
+ SW_API_DESC(SW_API_RATE_PT_EGRL_SET) \
+ SW_API_DESC(SW_API_RATE_PT_EGRL_GET) \
+ SW_API_DESC(SW_API_RATE_PT_INRL_SET) \
+ SW_API_DESC(SW_API_RATE_PT_INRL_GET) \
+ SW_API_DESC(SW_API_STORM_CTRL_FRAME_SET) \
+ SW_API_DESC(SW_API_STORM_CTRL_FRAME_GET) \
+ SW_API_DESC(SW_API_STORM_CTRL_RATE_SET) \
+ SW_API_DESC(SW_API_STORM_CTRL_RATE_GET) \
+ SW_API_DESC(SW_API_RATE_PORT_POLICER_SET) \
+ SW_API_DESC(SW_API_RATE_PORT_POLICER_GET) \
+ SW_API_DESC(SW_API_RATE_PORT_SHAPER_SET) \
+ SW_API_DESC(SW_API_RATE_PORT_SHAPER_GET) \
+ SW_API_DESC(SW_API_RATE_QUEUE_SHAPER_SET) \
+ SW_API_DESC(SW_API_RATE_QUEUE_SHAPER_GET) \
+ SW_API_DESC(SW_API_RATE_ACL_POLICER_SET) \
+ SW_API_DESC(SW_API_RATE_ACL_POLICER_GET) \
+ SW_API_DESC(SW_API_RATE_PT_ADDRATEBYTE_SET) \
+ SW_API_DESC(SW_API_RATE_PT_ADDRATEBYTE_GET) \
+ SW_API_DESC(SW_API_RATE_PT_GOL_FLOW_EN_SET) \
+ SW_API_DESC(SW_API_RATE_PT_GOL_FLOW_EN_GET)
+#else
+#define RATE_API
+#define RATE_API_PARAM
+#endif
+
+#ifdef IN_STP
+#define STP_API \
+ SW_API_DEF(SW_API_STP_PT_STATE_SET, fal_stp_port_state_set), \
+ SW_API_DEF(SW_API_STP_PT_STATE_GET, fal_stp_port_state_get),
+
+#define STP_API_PARAM \
+ SW_API_DESC(SW_API_STP_PT_STATE_SET) \
+ SW_API_DESC(SW_API_STP_PT_STATE_GET)
+#else
+#define STP_API
+#define STP_API_PARAM
+#endif
+
+#ifdef IN_MIB
+#define MIB_API \
+ SW_API_DEF(SW_API_PT_MIB_GET, fal_get_mib_info), \
+ SW_API_DEF(SW_API_MIB_STATUS_SET, fal_mib_status_set), \
+ SW_API_DEF(SW_API_MIB_STATUS_GET, fal_mib_status_get), \
+ SW_API_DEF(SW_API_PT_MIB_FLUSH_COUNTERS, fal_mib_port_flush_counters), \
+ SW_API_DEF(SW_API_MIB_CPU_KEEP_SET, fal_mib_cpukeep_set), \
+ SW_API_DEF(SW_API_MIB_CPU_KEEP_GET, fal_mib_cpukeep_get),
+
+#define MIB_API_PARAM \
+ SW_API_DESC(SW_API_PT_MIB_GET) \
+ SW_API_DESC(SW_API_MIB_STATUS_SET) \
+ SW_API_DESC(SW_API_MIB_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_MIB_FLUSH_COUNTERS) \
+ SW_API_DESC(SW_API_MIB_CPU_KEEP_SET) \
+ SW_API_DESC(SW_API_MIB_CPU_KEEP_GET)
+#else
+#define MIB_API
+#define MIB_API_PARAM
+#endif
+
+#ifdef IN_MISC
+#define MISC_API \
+ SW_API_DEF(SW_API_ARP_STATUS_SET, fal_arp_status_set), \
+ SW_API_DEF(SW_API_ARP_STATUS_GET, fal_arp_status_get), \
+ SW_API_DEF(SW_API_FRAME_MAX_SIZE_SET, fal_frame_max_size_set), \
+ SW_API_DEF(SW_API_FRAME_MAX_SIZE_GET, fal_frame_max_size_get), \
+ SW_API_DEF(SW_API_PT_UNK_SA_CMD_SET, fal_port_unk_sa_cmd_set), \
+ SW_API_DEF(SW_API_PT_UNK_SA_CMD_GET, fal_port_unk_sa_cmd_get), \
+ SW_API_DEF(SW_API_PT_UNK_UC_FILTER_SET, fal_port_unk_uc_filter_set), \
+ SW_API_DEF(SW_API_PT_UNK_UC_FILTER_GET, fal_port_unk_uc_filter_get), \
+ SW_API_DEF(SW_API_PT_UNK_MC_FILTER_SET, fal_port_unk_mc_filter_set), \
+ SW_API_DEF(SW_API_PT_UNK_MC_FILTER_GET, fal_port_unk_mc_filter_get), \
+ SW_API_DEF(SW_API_PT_BC_FILTER_SET, fal_port_bc_filter_set), \
+ SW_API_DEF(SW_API_PT_BC_FILTER_GET, fal_port_bc_filter_get), \
+ SW_API_DEF(SW_API_CPU_PORT_STATUS_SET, fal_cpu_port_status_set), \
+ SW_API_DEF(SW_API_CPU_PORT_STATUS_GET, fal_cpu_port_status_get), \
+ SW_API_DEF(SW_API_BC_TO_CPU_PORT_SET, fal_bc_to_cpu_port_set), \
+ SW_API_DEF(SW_API_BC_TO_CPU_PORT_GET, fal_bc_to_cpu_port_get), \
+ SW_API_DEF(SW_API_PPPOE_CMD_SET, fal_pppoe_cmd_set), \
+ SW_API_DEF(SW_API_PPPOE_CMD_GET, fal_pppoe_cmd_get), \
+ SW_API_DEF(SW_API_PPPOE_STATUS_SET, fal_pppoe_status_set), \
+ SW_API_DEF(SW_API_PPPOE_STATUS_GET, fal_pppoe_status_get), \
+ SW_API_DEF(SW_API_PT_DHCP_SET, fal_port_dhcp_set), \
+ SW_API_DEF(SW_API_PT_DHCP_GET, fal_port_dhcp_get), \
+ SW_API_DEF(SW_API_ARP_CMD_SET, fal_arp_cmd_set), \
+ SW_API_DEF(SW_API_ARP_CMD_GET, fal_arp_cmd_get), \
+ SW_API_DEF(SW_API_EAPOL_CMD_SET, fal_eapol_cmd_set), \
+ SW_API_DEF(SW_API_EAPOL_CMD_GET, fal_eapol_cmd_get), \
+ SW_API_DEF(SW_API_PPPOE_SESSION_ADD, fal_pppoe_session_add), \
+ SW_API_DEF(SW_API_PPPOE_SESSION_DEL, fal_pppoe_session_del), \
+ SW_API_DEF(SW_API_PPPOE_SESSION_GET, fal_pppoe_session_get), \
+ SW_API_DEF(SW_API_EAPOL_STATUS_SET, fal_eapol_status_set), \
+ SW_API_DEF(SW_API_EAPOL_STATUS_GET, fal_eapol_status_get), \
+ SW_API_DEF(SW_API_RIPV1_STATUS_SET, fal_ripv1_status_set), \
+ SW_API_DEF(SW_API_RIPV1_STATUS_GET, fal_ripv1_status_get), \
+ SW_API_DEF(SW_API_PT_ARP_REQ_STATUS_SET, fal_port_arp_req_status_set), \
+ SW_API_DEF(SW_API_PT_ARP_REQ_STATUS_GET, fal_port_arp_req_status_get), \
+ SW_API_DEF(SW_API_PT_ARP_ACK_STATUS_SET, fal_port_arp_ack_status_set), \
+ SW_API_DEF(SW_API_PT_ARP_ACK_STATUS_GET, fal_port_arp_ack_status_get), \
+ SW_API_DEF(SW_API_PPPOE_SESSION_TABLE_ADD, fal_pppoe_session_table_add), \
+ SW_API_DEF(SW_API_PPPOE_SESSION_TABLE_DEL, fal_pppoe_session_table_del), \
+ SW_API_DEF(SW_API_PPPOE_SESSION_TABLE_GET, fal_pppoe_session_table_get), \
+ SW_API_DEF(SW_API_PPPOE_SESSION_ID_SET, fal_pppoe_session_id_set), \
+ SW_API_DEF(SW_API_PPPOE_SESSION_ID_GET, fal_pppoe_session_id_get), \
+ SW_API_DEF(SW_API_INTR_MASK_SET, fal_intr_mask_set), \
+ SW_API_DEF(SW_API_INTR_MASK_GET, fal_intr_mask_get), \
+ SW_API_DEF(SW_API_INTR_STATUS_GET, fal_intr_status_get), \
+ SW_API_DEF(SW_API_INTR_STATUS_CLEAR, fal_intr_status_clear), \
+ SW_API_DEF(SW_API_INTR_PORT_LINK_MASK_SET, fal_intr_port_link_mask_set), \
+ SW_API_DEF(SW_API_INTR_PORT_LINK_MASK_GET, fal_intr_port_link_mask_get), \
+ SW_API_DEF(SW_API_INTR_PORT_LINK_STATUS_GET, fal_intr_port_link_status_get), \
+ SW_API_DEF(SW_API_INTR_MASK_MAC_LINKCHG_SET, fal_intr_mask_mac_linkchg_set), \
+ SW_API_DEF(SW_API_INTR_MASK_MAC_LINKCHG_GET, fal_intr_mask_mac_linkchg_get), \
+ SW_API_DEF(SW_API_INTR_STATUS_MAC_LINKCHG_GET, fal_intr_status_mac_linkchg_get), \
+ SW_API_DEF(SW_API_INTR_STATUS_MAC_LINKCHG_CLEAR, fal_intr_status_mac_linkchg_clear), \
+ SW_API_DEF(SW_API_CPU_VID_EN_SET, fal_cpu_vid_en_set), \
+ SW_API_DEF(SW_API_CPU_VID_EN_GET, fal_cpu_vid_en_get), \
+ SW_API_DEF(SW_API_RTD_PPPOE_EN_SET, fal_rtd_pppoe_en_set), \
+ SW_API_DEF(SW_API_RTD_PPPOE_EN_GET, fal_rtd_pppoe_en_get),
+
+
+
+#define MISC_API_PARAM \
+ SW_API_DESC(SW_API_ARP_STATUS_SET) \
+ SW_API_DESC(SW_API_ARP_STATUS_GET) \
+ SW_API_DESC(SW_API_FRAME_MAX_SIZE_SET) \
+ SW_API_DESC(SW_API_FRAME_MAX_SIZE_GET) \
+ SW_API_DESC(SW_API_PT_UNK_SA_CMD_SET) \
+ SW_API_DESC(SW_API_PT_UNK_SA_CMD_GET) \
+ SW_API_DESC(SW_API_PT_UNK_UC_FILTER_SET) \
+ SW_API_DESC(SW_API_PT_UNK_UC_FILTER_GET) \
+ SW_API_DESC(SW_API_PT_UNK_MC_FILTER_SET) \
+ SW_API_DESC(SW_API_PT_UNK_MC_FILTER_GET) \
+ SW_API_DESC(SW_API_PT_BC_FILTER_SET) \
+ SW_API_DESC(SW_API_PT_BC_FILTER_GET) \
+ SW_API_DESC(SW_API_CPU_PORT_STATUS_SET) \
+ SW_API_DESC(SW_API_CPU_PORT_STATUS_GET) \
+ SW_API_DESC(SW_API_BC_TO_CPU_PORT_SET) \
+ SW_API_DESC(SW_API_BC_TO_CPU_PORT_GET) \
+ SW_API_DESC(SW_API_PPPOE_CMD_SET) \
+ SW_API_DESC(SW_API_PPPOE_CMD_GET) \
+ SW_API_DESC(SW_API_PPPOE_STATUS_SET) \
+ SW_API_DESC(SW_API_PPPOE_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_DHCP_SET) \
+ SW_API_DESC(SW_API_PT_DHCP_GET) \
+ SW_API_DESC(SW_API_ARP_CMD_SET) \
+ SW_API_DESC(SW_API_ARP_CMD_GET) \
+ SW_API_DESC(SW_API_EAPOL_CMD_SET) \
+ SW_API_DESC(SW_API_EAPOL_CMD_GET) \
+ SW_API_DESC(SW_API_PPPOE_SESSION_ADD) \
+ SW_API_DESC(SW_API_PPPOE_SESSION_DEL) \
+ SW_API_DESC(SW_API_PPPOE_SESSION_GET) \
+ SW_API_DESC(SW_API_EAPOL_STATUS_SET) \
+ SW_API_DESC(SW_API_EAPOL_STATUS_GET) \
+ SW_API_DESC(SW_API_RIPV1_STATUS_SET) \
+ SW_API_DESC(SW_API_RIPV1_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_ARP_REQ_STATUS_SET) \
+ SW_API_DESC(SW_API_PT_ARP_REQ_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_ARP_ACK_STATUS_SET) \
+ SW_API_DESC(SW_API_PT_ARP_ACK_STATUS_GET) \
+ SW_API_DESC(SW_API_PPPOE_SESSION_TABLE_ADD) \
+ SW_API_DESC(SW_API_PPPOE_SESSION_TABLE_DEL) \
+ SW_API_DESC(SW_API_PPPOE_SESSION_TABLE_GET) \
+ SW_API_DESC(SW_API_PPPOE_SESSION_ID_SET) \
+ SW_API_DESC(SW_API_PPPOE_SESSION_ID_GET) \
+ SW_API_DESC(SW_API_INTR_MASK_SET) \
+ SW_API_DESC(SW_API_INTR_MASK_GET) \
+ SW_API_DESC(SW_API_INTR_STATUS_GET) \
+ SW_API_DESC(SW_API_INTR_STATUS_CLEAR) \
+ SW_API_DESC(SW_API_INTR_PORT_LINK_MASK_SET) \
+ SW_API_DESC(SW_API_INTR_PORT_LINK_MASK_GET) \
+ SW_API_DESC(SW_API_INTR_PORT_LINK_STATUS_GET) \
+ SW_API_DESC(SW_API_INTR_MASK_MAC_LINKCHG_SET) \
+ SW_API_DESC(SW_API_INTR_MASK_MAC_LINKCHG_GET) \
+ SW_API_DESC(SW_API_INTR_STATUS_MAC_LINKCHG_GET) \
+ SW_API_DESC(SW_API_INTR_STATUS_MAC_LINKCHG_CLEAR) \
+ SW_API_DESC(SW_API_CPU_VID_EN_SET) \
+ SW_API_DESC(SW_API_CPU_VID_EN_GET) \
+ SW_API_DESC(SW_API_RTD_PPPOE_EN_SET) \
+ SW_API_DESC(SW_API_RTD_PPPOE_EN_GET)
+
+
+#else
+#define MISC_API
+#define MISC_API_PARAM
+#endif
+
+#ifdef IN_LED
+#define LED_API \
+ SW_API_DEF(SW_API_LED_PATTERN_SET, fal_led_ctrl_pattern_set), \
+ SW_API_DEF(SW_API_LED_PATTERN_GET, fal_led_ctrl_pattern_get),
+
+#define LED_API_PARAM \
+ SW_API_DESC(SW_API_LED_PATTERN_SET) \
+ SW_API_DESC(SW_API_LED_PATTERN_GET)
+#else
+#define LED_API
+#define LED_API_PARAM
+#endif
+
+#ifdef IN_COSMAP
+#define COSMAP_API \
+ SW_API_DEF(SW_API_COSMAP_DSCP_TO_PRI_SET, fal_cosmap_dscp_to_pri_set), \
+ SW_API_DEF(SW_API_COSMAP_DSCP_TO_PRI_GET, fal_cosmap_dscp_to_pri_get), \
+ SW_API_DEF(SW_API_COSMAP_DSCP_TO_DP_SET, fal_cosmap_dscp_to_dp_set), \
+ SW_API_DEF(SW_API_COSMAP_DSCP_TO_DP_GET, fal_cosmap_dscp_to_dp_get), \
+ SW_API_DEF(SW_API_COSMAP_UP_TO_PRI_SET, fal_cosmap_up_to_pri_set), \
+ SW_API_DEF(SW_API_COSMAP_UP_TO_PRI_GET, fal_cosmap_up_to_pri_get), \
+ SW_API_DEF(SW_API_COSMAP_UP_TO_DP_SET, fal_cosmap_up_to_dp_set), \
+ SW_API_DEF(SW_API_COSMAP_UP_TO_DP_GET, fal_cosmap_up_to_dp_get), \
+ SW_API_DEF(SW_API_COSMAP_PRI_TO_QU_SET, fal_cosmap_pri_to_queue_set), \
+ SW_API_DEF(SW_API_COSMAP_PRI_TO_QU_GET, fal_cosmap_pri_to_queue_get), \
+ SW_API_DEF(SW_API_COSMAP_PRI_TO_EHQU_SET, fal_cosmap_pri_to_ehqueue_set), \
+ SW_API_DEF(SW_API_COSMAP_PRI_TO_EHQU_GET, fal_cosmap_pri_to_ehqueue_get), \
+ SW_API_DEF(SW_API_COSMAP_EG_REMARK_SET, fal_cosmap_egress_remark_set), \
+ SW_API_DEF(SW_API_COSMAP_EG_REMARK_GET, fal_cosmap_egress_remark_get),
+
+#define COSMAP_API_PARAM \
+ SW_API_DESC(SW_API_COSMAP_DSCP_TO_PRI_SET) \
+ SW_API_DESC(SW_API_COSMAP_DSCP_TO_PRI_GET) \
+ SW_API_DESC(SW_API_COSMAP_DSCP_TO_DP_SET) \
+ SW_API_DESC(SW_API_COSMAP_DSCP_TO_DP_GET) \
+ SW_API_DESC(SW_API_COSMAP_UP_TO_PRI_SET) \
+ SW_API_DESC(SW_API_COSMAP_UP_TO_PRI_GET) \
+ SW_API_DESC(SW_API_COSMAP_UP_TO_DP_SET) \
+ SW_API_DESC(SW_API_COSMAP_UP_TO_DP_GET) \
+ SW_API_DESC(SW_API_COSMAP_PRI_TO_QU_SET) \
+ SW_API_DESC(SW_API_COSMAP_PRI_TO_QU_GET) \
+ SW_API_DESC(SW_API_COSMAP_PRI_TO_EHQU_SET) \
+ SW_API_DESC(SW_API_COSMAP_PRI_TO_EHQU_GET) \
+ SW_API_DESC(SW_API_COSMAP_EG_REMARK_SET) \
+ SW_API_DESC(SW_API_COSMAP_EG_REMARK_GET)
+#else
+#define COSMAP_API
+#define COSMAP_API_PARAM
+#endif
+
+#ifdef IN_SEC
+#define SEC_API \
+ SW_API_DEF(SW_API_SEC_NORM_SET, fal_sec_norm_item_set), \
+ SW_API_DEF(SW_API_SEC_NORM_GET, fal_sec_norm_item_get), \
+ SW_API_DEF(SW_API_SEC_MAC_SET, fal_sec_norm_item_set), \
+ SW_API_DEF(SW_API_SEC_MAC_GET, fal_sec_norm_item_get), \
+ SW_API_DEF(SW_API_SEC_IP_SET, fal_sec_norm_item_set), \
+ SW_API_DEF(SW_API_SEC_IP_GET, fal_sec_norm_item_get), \
+ SW_API_DEF(SW_API_SEC_IP4_SET, fal_sec_norm_item_set), \
+ SW_API_DEF(SW_API_SEC_IP4_GET, fal_sec_norm_item_get), \
+ SW_API_DEF(SW_API_SEC_IP6_SET, fal_sec_norm_item_set), \
+ SW_API_DEF(SW_API_SEC_IP6_GET, fal_sec_norm_item_get), \
+ SW_API_DEF(SW_API_SEC_TCP_SET, fal_sec_norm_item_set), \
+ SW_API_DEF(SW_API_SEC_TCP_GET, fal_sec_norm_item_get), \
+ SW_API_DEF(SW_API_SEC_UDP_SET, fal_sec_norm_item_set), \
+ SW_API_DEF(SW_API_SEC_UDP_GET, fal_sec_norm_item_get), \
+ SW_API_DEF(SW_API_SEC_ICMP4_SET, fal_sec_norm_item_set), \
+ SW_API_DEF(SW_API_SEC_ICMP4_GET, fal_sec_norm_item_get), \
+ SW_API_DEF(SW_API_SEC_ICMP6_SET, fal_sec_norm_item_set), \
+ SW_API_DEF(SW_API_SEC_ICMP6_GET, fal_sec_norm_item_get),
+
+#define SEC_API_PARAM \
+ SW_API_DESC(SW_API_SEC_NORM_SET) \
+ SW_API_DESC(SW_API_SEC_NORM_GET) \
+ SW_API_DESC(SW_API_SEC_MAC_SET) \
+ SW_API_DESC(SW_API_SEC_MAC_GET) \
+ SW_API_DESC(SW_API_SEC_IP_SET) \
+ SW_API_DESC(SW_API_SEC_IP_GET) \
+ SW_API_DESC(SW_API_SEC_IP4_SET) \
+ SW_API_DESC(SW_API_SEC_IP4_GET) \
+ SW_API_DESC(SW_API_SEC_IP6_SET) \
+ SW_API_DESC(SW_API_SEC_IP6_GET) \
+ SW_API_DESC(SW_API_SEC_TCP_SET) \
+ SW_API_DESC(SW_API_SEC_TCP_GET) \
+ SW_API_DESC(SW_API_SEC_UDP_SET) \
+ SW_API_DESC(SW_API_SEC_UDP_GET) \
+ SW_API_DESC(SW_API_SEC_ICMP4_SET) \
+ SW_API_DESC(SW_API_SEC_ICMP4_GET) \
+ SW_API_DESC(SW_API_SEC_ICMP6_SET) \
+ SW_API_DESC(SW_API_SEC_ICMP6_GET)
+#else
+#define SEC_API
+#define SEC_API_PARAM
+#endif
+
+#ifdef IN_IP
+#define IP_API \
+ SW_API_DEF(SW_API_IP_HOST_ADD, fal_ip_host_add), \
+ SW_API_DEF(SW_API_IP_HOST_DEL, fal_ip_host_del), \
+ SW_API_DEF(SW_API_IP_HOST_GET, fal_ip_host_get), \
+ SW_API_DEF(SW_API_IP_HOST_NEXT, fal_ip_host_next), \
+ SW_API_DEF(SW_API_IP_HOST_COUNTER_BIND, fal_ip_host_counter_bind), \
+ SW_API_DEF(SW_API_IP_HOST_PPPOE_BIND, fal_ip_host_pppoe_bind), \
+ SW_API_DEF(SW_API_IP_PT_ARP_LEARN_SET, fal_ip_pt_arp_learn_set), \
+ SW_API_DEF(SW_API_IP_PT_ARP_LEARN_GET, fal_ip_pt_arp_learn_get), \
+ SW_API_DEF(SW_API_IP_ARP_LEARN_SET, fal_ip_arp_learn_set), \
+ SW_API_DEF(SW_API_IP_ARP_LEARN_GET, fal_ip_arp_learn_get), \
+ SW_API_DEF(SW_API_IP_SOURCE_GUARD_SET, fal_ip_source_guard_set), \
+ SW_API_DEF(SW_API_IP_SOURCE_GUARD_GET, fal_ip_source_guard_get), \
+ SW_API_DEF(SW_API_IP_ARP_GUARD_SET, fal_ip_arp_guard_set), \
+ SW_API_DEF(SW_API_IP_ARP_GUARD_GET, fal_ip_arp_guard_get), \
+ SW_API_DEF(SW_API_IP_ROUTE_STATUS_SET, fal_ip_route_status_set), \
+ SW_API_DEF(SW_API_IP_ROUTE_STATUS_GET, fal_ip_route_status_get), \
+ SW_API_DEF(SW_API_IP_INTF_ENTRY_ADD, fal_ip_intf_entry_add), \
+ SW_API_DEF(SW_API_IP_INTF_ENTRY_DEL, fal_ip_intf_entry_del), \
+ SW_API_DEF(SW_API_IP_INTF_ENTRY_NEXT, fal_ip_intf_entry_next), \
+ SW_API_DEF(SW_API_IP_UNK_SOURCE_CMD_SET, fal_ip_unk_source_cmd_set), \
+ SW_API_DEF(SW_API_IP_UNK_SOURCE_CMD_GET, fal_ip_unk_source_cmd_get), \
+ SW_API_DEF(SW_API_ARP_UNK_SOURCE_CMD_SET, fal_arp_unk_source_cmd_set), \
+ SW_API_DEF(SW_API_ARP_UNK_SOURCE_CMD_GET, fal_arp_unk_source_cmd_get), \
+ SW_API_DEF(SW_API_IP_AGE_TIME_SET, fal_ip_age_time_set), \
+ SW_API_DEF(SW_API_IP_AGE_TIME_GET, fal_ip_age_time_get), \
+ SW_API_DEF(SW_API_WCMP_HASH_MODE_SET, fal_ip_wcmp_hash_mode_set), \
+ SW_API_DEF(SW_API_WCMP_HASH_MODE_GET, fal_ip_wcmp_hash_mode_get),
+
+#define IP_API_PARAM \
+ SW_API_DESC(SW_API_IP_HOST_ADD) \
+ SW_API_DESC(SW_API_IP_HOST_DEL) \
+ SW_API_DESC(SW_API_IP_HOST_GET) \
+ SW_API_DESC(SW_API_IP_HOST_NEXT) \
+ SW_API_DESC(SW_API_IP_HOST_COUNTER_BIND) \
+ SW_API_DESC(SW_API_IP_HOST_PPPOE_BIND) \
+ SW_API_DESC(SW_API_IP_PT_ARP_LEARN_SET) \
+ SW_API_DESC(SW_API_IP_PT_ARP_LEARN_GET) \
+ SW_API_DESC(SW_API_IP_ARP_LEARN_SET) \
+ SW_API_DESC(SW_API_IP_ARP_LEARN_GET) \
+ SW_API_DESC(SW_API_IP_SOURCE_GUARD_SET) \
+ SW_API_DESC(SW_API_IP_SOURCE_GUARD_GET) \
+ SW_API_DESC(SW_API_IP_ARP_GUARD_SET) \
+ SW_API_DESC(SW_API_IP_ARP_GUARD_GET) \
+ SW_API_DESC(SW_API_IP_ROUTE_STATUS_SET) \
+ SW_API_DESC(SW_API_IP_ROUTE_STATUS_GET) \
+ SW_API_DESC(SW_API_IP_INTF_ENTRY_ADD) \
+ SW_API_DESC(SW_API_IP_INTF_ENTRY_DEL) \
+ SW_API_DESC(SW_API_IP_INTF_ENTRY_NEXT) \
+ SW_API_DESC(SW_API_IP_UNK_SOURCE_CMD_SET) \
+ SW_API_DESC(SW_API_IP_UNK_SOURCE_CMD_GET) \
+ SW_API_DESC(SW_API_ARP_UNK_SOURCE_CMD_SET) \
+ SW_API_DESC(SW_API_ARP_UNK_SOURCE_CMD_GET) \
+ SW_API_DESC(SW_API_IP_AGE_TIME_SET) \
+ SW_API_DESC(SW_API_IP_AGE_TIME_GET) \
+ SW_API_DESC(SW_API_WCMP_HASH_MODE_SET) \
+ SW_API_DESC(SW_API_WCMP_HASH_MODE_GET)
+#else
+#define IP_API
+#define IP_API_PARAM
+#endif
+
+#ifdef IN_NAT
+#define NAT_API \
+ SW_API_DEF(SW_API_NAT_ADD, fal_nat_add), \
+ SW_API_DEF(SW_API_NAT_DEL, fal_nat_del), \
+ SW_API_DEF(SW_API_NAT_GET, fal_nat_get), \
+ SW_API_DEF(SW_API_NAT_NEXT, fal_nat_next), \
+ SW_API_DEF(SW_API_NAT_COUNTER_BIND, fal_nat_counter_bind), \
+ SW_API_DEF(SW_API_NAPT_ADD, fal_napt_add), \
+ SW_API_DEF(SW_API_NAPT_DEL, fal_napt_del), \
+ SW_API_DEF(SW_API_NAPT_GET, fal_napt_get), \
+ SW_API_DEF(SW_API_NAPT_NEXT, fal_napt_next), \
+ SW_API_DEF(SW_API_NAPT_COUNTER_BIND, fal_napt_counter_bind), \
+ SW_API_DEF(SW_API_NAT_STATUS_SET, fal_nat_status_set), \
+ SW_API_DEF(SW_API_NAT_STATUS_GET, fal_nat_status_get), \
+ SW_API_DEF(SW_API_NAT_HASH_MODE_SET, fal_nat_hash_mode_set), \
+ SW_API_DEF(SW_API_NAT_HASH_MODE_GET, fal_nat_hash_mode_get), \
+ SW_API_DEF(SW_API_NAPT_STATUS_SET, fal_napt_status_set), \
+ SW_API_DEF(SW_API_NAPT_STATUS_GET, fal_napt_status_get), \
+ SW_API_DEF(SW_API_NAPT_MODE_SET, fal_napt_mode_set), \
+ SW_API_DEF(SW_API_NAPT_MODE_GET, fal_napt_mode_get), \
+ SW_API_DEF(SW_API_PRV_BASE_ADDR_SET, fal_nat_prv_base_addr_set), \
+ SW_API_DEF(SW_API_PRV_BASE_ADDR_GET, fal_nat_prv_base_addr_get), \
+ SW_API_DEF(SW_API_PRV_ADDR_MODE_SET, fal_nat_prv_addr_mode_set), \
+ SW_API_DEF(SW_API_PRV_ADDR_MODE_GET, fal_nat_prv_addr_mode_get), \
+ SW_API_DEF(SW_API_PUB_ADDR_ENTRY_ADD, fal_nat_pub_addr_add), \
+ SW_API_DEF(SW_API_PUB_ADDR_ENTRY_DEL, fal_nat_pub_addr_del), \
+ SW_API_DEF(SW_API_PUB_ADDR_ENTRY_NEXT, fal_nat_pub_addr_next), \
+ SW_API_DEF(SW_API_NAT_UNK_SESSION_CMD_SET, fal_nat_unk_session_cmd_set), \
+ SW_API_DEF(SW_API_NAT_UNK_SESSION_CMD_GET, fal_nat_unk_session_cmd_get), \
+ SW_API_DEF(SW_API_PRV_BASE_MASK_SET, fal_nat_prv_base_mask_set), \
+ SW_API_DEF(SW_API_PRV_BASE_MASK_GET, fal_nat_prv_base_mask_get), \
+ SW_API_DEF(SW_API_NAT_GLOBAL_SET, fal_nat_global_set),
+
+#define NAT_API_PARAM \
+ SW_API_DESC(SW_API_NAT_ADD) \
+ SW_API_DESC(SW_API_NAT_DEL) \
+ SW_API_DESC(SW_API_NAT_GET) \
+ SW_API_DESC(SW_API_NAT_NEXT) \
+ SW_API_DESC(SW_API_NAT_COUNTER_BIND) \
+ SW_API_DESC(SW_API_NAPT_ADD) \
+ SW_API_DESC(SW_API_NAPT_DEL) \
+ SW_API_DESC(SW_API_NAPT_GET) \
+ SW_API_DESC(SW_API_NAPT_NEXT) \
+ SW_API_DESC(SW_API_NAPT_COUNTER_BIND) \
+ SW_API_DESC(SW_API_NAT_STATUS_SET) \
+ SW_API_DESC(SW_API_NAT_STATUS_GET) \
+ SW_API_DESC(SW_API_NAT_HASH_MODE_SET) \
+ SW_API_DESC(SW_API_NAT_HASH_MODE_GET) \
+ SW_API_DESC(SW_API_NAPT_STATUS_SET) \
+ SW_API_DESC(SW_API_NAPT_STATUS_GET) \
+ SW_API_DESC(SW_API_NAPT_MODE_SET) \
+ SW_API_DESC(SW_API_NAPT_MODE_GET) \
+ SW_API_DESC(SW_API_PRV_BASE_ADDR_SET) \
+ SW_API_DESC(SW_API_PRV_BASE_ADDR_GET) \
+ SW_API_DESC(SW_API_PRV_ADDR_MODE_SET) \
+ SW_API_DESC(SW_API_PRV_ADDR_MODE_GET) \
+ SW_API_DESC(SW_API_PUB_ADDR_ENTRY_ADD) \
+ SW_API_DESC(SW_API_PUB_ADDR_ENTRY_DEL) \
+ SW_API_DESC(SW_API_PUB_ADDR_ENTRY_NEXT) \
+ SW_API_DESC(SW_API_NAT_UNK_SESSION_CMD_SET) \
+ SW_API_DESC(SW_API_NAT_UNK_SESSION_CMD_GET) \
+ SW_API_DESC(SW_API_PRV_BASE_MASK_SET) \
+ SW_API_DESC(SW_API_PRV_BASE_MASK_GET) \
+ SW_API_DESC(SW_API_NAT_GLOBAL_SET)
+#else
+#define NAT_API
+#define NAT_API_PARAM
+#endif
+
+#ifdef IN_TRUNK
+#define TRUNK_API \
+ SW_API_DEF(SW_API_TRUNK_GROUP_SET, fal_trunk_group_set), \
+ SW_API_DEF(SW_API_TRUNK_GROUP_GET, fal_trunk_group_get), \
+ SW_API_DEF(SW_API_TRUNK_HASH_SET, fal_trunk_hash_mode_set), \
+ SW_API_DEF(SW_API_TRUNK_HASH_GET, fal_trunk_hash_mode_get), \
+ SW_API_DEF(SW_API_TRUNK_MAN_SA_SET, fal_trunk_manipulate_sa_set), \
+ SW_API_DEF(SW_API_TRUNK_MAN_SA_GET, fal_trunk_manipulate_sa_get),
+
+#define TRUNK_API_PARAM \
+ SW_API_DESC(SW_API_TRUNK_GROUP_SET) \
+ SW_API_DESC(SW_API_TRUNK_GROUP_GET) \
+ SW_API_DESC(SW_API_TRUNK_HASH_SET) \
+ SW_API_DESC(SW_API_TRUNK_HASH_GET) \
+ SW_API_DESC(SW_API_TRUNK_MAN_SA_SET)\
+ SW_API_DESC(SW_API_TRUNK_MAN_SA_GET)
+#else
+#define TRUNK_API
+#define TRUNK_API_PARAM
+#endif
+
+#ifdef IN_INTERFACECONTROL
+#define INTERFACECTRL_API \
+ SW_API_DEF(SW_API_MAC_MODE_SET, fal_interface_mac_mode_set), \
+ SW_API_DEF(SW_API_MAC_MODE_GET, fal_interface_mac_mode_get), \
+ SW_API_DEF(SW_API_PORT_3AZ_STATUS_SET, fal_port_3az_status_set), \
+ SW_API_DEF(SW_API_PORT_3AZ_STATUS_GET, fal_port_3az_status_get), \
+ SW_API_DEF(SW_API_PHY_MODE_SET, fal_interface_phy_mode_set), \
+ SW_API_DEF(SW_API_PHY_MODE_GET, fal_interface_phy_mode_get), \
+ SW_API_DEF(SW_API_FX100_CTRL_SET, fal_interface_fx100_ctrl_set), \
+ SW_API_DEF(SW_API_FX100_CTRL_GET, fal_interface_fx100_ctrl_get), \
+ SW_API_DEF(SW_API_FX100_STATUS_GET, fal_interface_fx100_status_get),\
+ SW_API_DEF(SW_API_MAC06_EXCH_SET, fal_interface_mac06_exch_set),\
+ SW_API_DEF(SW_API_MAC06_EXCH_GET, fal_interface_mac06_exch_get),
+
+#define INTERFACECTRL_API_PARAM \
+ SW_API_DESC(SW_API_MAC_MODE_SET) \
+ SW_API_DESC(SW_API_MAC_MODE_GET) \
+ SW_API_DESC(SW_API_PORT_3AZ_STATUS_SET) \
+ SW_API_DESC(SW_API_PORT_3AZ_STATUS_GET) \
+ SW_API_DESC(SW_API_PHY_MODE_SET) \
+ SW_API_DESC(SW_API_PHY_MODE_GET) \
+ SW_API_DESC(SW_API_FX100_CTRL_SET) \
+ SW_API_DESC(SW_API_FX100_CTRL_GET) \
+ SW_API_DESC(SW_API_FX100_STATUS_GET) \
+ SW_API_DESC(SW_API_MAC06_EXCH_SET) \
+ SW_API_DESC(SW_API_MAC06_EXCH_GET)
+
+#else
+#define INTERFACECTRL_API
+#define INTERFACECTRL_API_PARAM
+#endif
+
+#define REG_API \
+ SW_API_DEF(SW_API_PHY_GET, fal_phy_get), \
+ SW_API_DEF(SW_API_PHY_SET, fal_phy_set), \
+ SW_API_DEF(SW_API_REG_GET, fal_reg_get), \
+ SW_API_DEF(SW_API_REG_SET, fal_reg_set), \
+ SW_API_DEF(SW_API_REG_FIELD_GET, fal_reg_field_get), \
+ SW_API_DEF(SW_API_REG_FIELD_SET, fal_reg_field_set),
+
+#define REG_API_PARAM \
+ SW_API_DESC(SW_API_PHY_GET) \
+ SW_API_DESC(SW_API_PHY_SET) \
+ SW_API_DESC(SW_API_REG_GET) \
+ SW_API_DESC(SW_API_REG_SET) \
+ SW_API_DESC(SW_API_REG_FIELD_GET) \
+ SW_API_DESC(SW_API_REG_FIELD_SET)
+
+
+#define SSDK_API \
+ SW_API_DEF(SW_API_SWITCH_RESET, fal_reset), \
+ SW_API_DEF(SW_API_SSDK_CFG, fal_ssdk_cfg), \
+ PORTCONTROL_API \
+ VLAN_API \
+ PORTVLAN_API \
+ FDB_API \
+ ACL_API \
+ QOS_API \
+ IGMP_API \
+ LEAKY_API \
+ MIRROR_API \
+ RATE_API \
+ STP_API \
+ MIB_API \
+ MISC_API \
+ LED_API \
+ COSMAP_API \
+ SEC_API \
+ IP_API \
+ NAT_API \
+ TRUNK_API \
+ INTERFACECTRL_API \
+ REG_API \
+ SW_API_DEF(SW_API_MAX, NULL),
+
+
+#define SSDK_PARAM \
+ SW_PARAM_DEF(SW_API_SWITCH_RESET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SSDK_CFG, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_SSDK_CFG, SW_SSDK_CFG, sizeof(ssdk_cfg_t), SW_PARAM_PTR|SW_PARAM_OUT, "ssdk configuration"), \
+ MIB_API_PARAM \
+ LEAKY_API_PARAM \
+ MISC_API_PARAM \
+ IGMP_API_PARAM \
+ MIRROR_API_PARAM \
+ PORTCONTROL_API_PARAM \
+ PORTVLAN_API_PARAM \
+ VLAN_API_PARAM \
+ FDB_API_PARAM \
+ QOS_API_PARAM \
+ RATE_API_PARAM \
+ STP_API_PARAM \
+ ACL_API_PARAM \
+ LED_API_PARAM \
+ COSMAP_API_PARAM \
+ SEC_API_PARAM \
+ IP_API_PARAM \
+ NAT_API_PARAM \
+ TRUNK_API_PARAM \
+ INTERFACECTRL_API_PARAM \
+ REG_API_PARAM \
+ SW_PARAM_DEF(SW_API_MAX, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _FAL_API_H_ */
diff --git a/include/fal/fal_cosmap.h b/include/fal/fal_cosmap.h
new file mode 100755
index 0000000..6e13f40
--- /dev/null
+++ b/include/fal/fal_cosmap.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_cosmap FAL_COSMAP
+ * @{
+ */
+#ifndef _FAL_COSMAP_H_
+#define _FAL_COSMAP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ typedef struct
+ {
+ a_bool_t remark_dscp;
+ a_bool_t remark_up;
+ a_uint8_t g_dscp;
+ a_uint8_t y_dscp;
+ a_uint8_t g_up;
+ a_uint8_t y_up;
+ } fal_egress_remark_table_t;
+
+ sw_error_t
+ fal_cosmap_dscp_to_pri_set(a_uint32_t dev_id, a_uint32_t dscp,
+ a_uint32_t pri);
+
+ sw_error_t
+ fal_cosmap_dscp_to_pri_get(a_uint32_t dev_id, a_uint32_t dscp,
+ a_uint32_t * pri);
+
+ sw_error_t
+ fal_cosmap_dscp_to_dp_set(a_uint32_t dev_id, a_uint32_t dscp,
+ a_uint32_t dp);
+
+ sw_error_t
+ fal_cosmap_dscp_to_dp_get(a_uint32_t dev_id, a_uint32_t dscp,
+ a_uint32_t * dp);
+
+ sw_error_t
+ fal_cosmap_up_to_pri_set(a_uint32_t dev_id, a_uint32_t up,
+ a_uint32_t pri);
+
+ sw_error_t
+ fal_cosmap_up_to_pri_get(a_uint32_t dev_id, a_uint32_t up,
+ a_uint32_t * pri);
+
+ sw_error_t
+ fal_cosmap_up_to_dp_set(a_uint32_t dev_id, a_uint32_t up,
+ a_uint32_t dp);
+
+ sw_error_t
+ fal_cosmap_up_to_dp_get(a_uint32_t dev_id, a_uint32_t up,
+ a_uint32_t * dp);
+
+ sw_error_t
+ fal_cosmap_pri_to_queue_set(a_uint32_t dev_id, a_uint32_t pri,
+ a_uint32_t queue);
+
+ sw_error_t
+ fal_cosmap_pri_to_queue_get(a_uint32_t dev_id, a_uint32_t pri,
+ a_uint32_t * queue);
+
+ sw_error_t
+ fal_cosmap_pri_to_ehqueue_set(a_uint32_t dev_id, a_uint32_t pri,
+ a_uint32_t queue);
+
+ sw_error_t
+ fal_cosmap_pri_to_ehqueue_get(a_uint32_t dev_id, a_uint32_t pri,
+ a_uint32_t * queue);
+
+ sw_error_t
+ fal_cosmap_egress_remark_set(a_uint32_t dev_id, a_uint32_t tbl_id,
+ fal_egress_remark_table_t * tbl);
+
+ sw_error_t
+ fal_cosmap_egress_remark_get(a_uint32_t dev_id, a_uint32_t tbl_id,
+ fal_egress_remark_table_t * tbl);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_COSMAP_H_ */
+
+/**
+ * @}
+ */
+
diff --git a/include/fal/fal_fdb.h b/include/fal/fal_fdb.h
new file mode 100755
index 0000000..df2bb54
--- /dev/null
+++ b/include/fal/fal_fdb.h
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_fdb FAL_FDB
+ * @{
+ */
+#ifndef _FAL_FDB_H_
+#define _FAL_FDB_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ /**
+ @details Fields description:
+
+ portmap_en - If value of portmap_en is A_TRUE then port.map is valid
+ otherwise port.id is valid.
+
+
+ leaky_en - If value of leaky_en is A_TRUE then packets which
+ destination address equals addr in this entry would be leaky.
+
+
+ mirror_en - If value of mirror_en is A_TRUE then packets which
+ destination address equals addr in this entry would be mirrored.
+
+
+ clone_en - If value of clone_en is A_TRUE which means this address is
+ a mac clone address.
+ @brief This structure defines the Fdb entry.
+
+ */
+ typedef struct
+ {
+ fal_mac_addr_t addr;
+ a_uint16_t fid;
+ fal_fwd_cmd_t dacmd;
+ fal_fwd_cmd_t sacmd;
+ union
+ {
+ a_uint32_t id;
+ fal_pbmp_t map;
+ } port;
+ a_bool_t portmap_en;
+ a_bool_t is_multicast;
+ a_bool_t static_en;
+ a_bool_t leaky_en;
+ a_bool_t mirror_en;
+ a_bool_t clone_en;
+ a_bool_t cross_pt_state;
+ a_bool_t da_pri_en;
+ a_uint8_t da_queue;
+ a_bool_t white_list_en;
+ } fal_fdb_entry_t;
+
+#define FAL_FDB_DEL_STATIC 0x1
+
+ typedef struct
+ {
+ a_bool_t port_en;
+ a_bool_t fid_en;
+ a_bool_t multicast_en;
+ } fal_fdb_op_t;
+
+ typedef enum
+ {
+ INVALID_VLAN_SVL=0,
+ INVALID_VLAN_IVL
+ } fal_fdb_smode;
+
+ sw_error_t
+ fal_fdb_add(a_uint32_t dev_id, const fal_fdb_entry_t * entry);
+
+
+
+ sw_error_t
+ fal_fdb_del_all(a_uint32_t dev_id, a_uint32_t flag);
+
+
+
+ sw_error_t
+ fal_fdb_del_by_port(a_uint32_t dev_id, a_uint32_t port_id, a_uint32_t flag);
+
+
+
+ sw_error_t
+ fal_fdb_del_by_mac(a_uint32_t dev_id, const fal_fdb_entry_t *entry);
+
+
+
+ sw_error_t
+ fal_fdb_first(a_uint32_t dev_id, fal_fdb_entry_t * entry);
+
+
+
+ sw_error_t
+ fal_fdb_next(a_uint32_t dev_id, fal_fdb_entry_t * entry);
+
+
+
+ sw_error_t
+ fal_fdb_find(a_uint32_t dev_id, fal_fdb_entry_t * entry);
+
+
+
+ sw_error_t
+ fal_fdb_port_learn_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_fdb_port_learn_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable);
+
+
+
+ sw_error_t
+ fal_fdb_age_ctrl_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_fdb_age_ctrl_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_fdb_vlan_ivl_svl_set(a_uint32_t dev_id, fal_fdb_smode smode);
+
+
+ sw_error_t
+ fal_fdb_vlan_ivl_svl_get(a_uint32_t dev_id, fal_fdb_smode * smode);
+
+
+ sw_error_t
+ fal_fdb_age_time_set(a_uint32_t dev_id, a_uint32_t * time);
+
+
+
+ sw_error_t
+ fal_fdb_age_time_get(a_uint32_t dev_id, a_uint32_t * time);
+
+
+ sw_error_t
+ fal_fdb_iterate(a_uint32_t dev_id, a_uint32_t * iterator, fal_fdb_entry_t * entry);
+
+
+ sw_error_t
+ fal_fdb_extend_next(a_uint32_t dev_id, fal_fdb_op_t * option,
+ fal_fdb_entry_t * entry);
+
+
+ sw_error_t
+ fal_fdb_extend_first(a_uint32_t dev_id, fal_fdb_op_t * option,
+ fal_fdb_entry_t * entry);
+
+
+ sw_error_t
+ fal_fdb_transfer(a_uint32_t dev_id, fal_port_t old_port, fal_port_t new_port,
+ a_uint32_t fid, fal_fdb_op_t * option);
+
+
+ sw_error_t
+ fal_port_fdb_learn_limit_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable, a_uint32_t cnt);
+
+
+ sw_error_t
+ fal_port_fdb_learn_limit_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable, a_uint32_t * cnt);
+
+
+ sw_error_t
+ fal_port_fdb_learn_exceed_cmd_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t cmd);
+
+
+ sw_error_t
+ fal_port_fdb_learn_exceed_cmd_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t * cmd);
+
+
+ sw_error_t
+ fal_fdb_learn_limit_set(a_uint32_t dev_id, a_bool_t enable, a_uint32_t cnt);
+
+
+ sw_error_t
+ fal_fdb_learn_limit_get(a_uint32_t dev_id, a_bool_t * enable, a_uint32_t * cnt);
+
+
+ sw_error_t
+ fal_fdb_learn_exceed_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd);
+
+
+ sw_error_t
+ fal_fdb_learn_exceed_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd);
+
+
+ sw_error_t
+ fal_fdb_resv_add(a_uint32_t dev_id, fal_fdb_entry_t * entry);
+
+ sw_error_t
+ fal_fdb_resv_del(a_uint32_t dev_id, fal_fdb_entry_t * entry);
+
+
+ sw_error_t
+ fal_fdb_resv_find(a_uint32_t dev_id, fal_fdb_entry_t * entry);
+
+
+ sw_error_t
+ fal_fdb_resv_iterate(a_uint32_t dev_id, a_uint32_t * iterator, fal_fdb_entry_t * entry);
+
+
+ sw_error_t
+ fal_fdb_port_learn_static_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_fdb_port_learn_static_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+ sw_error_t
+ fal_fdb_port_add(a_uint32_t dev_id, a_uint32_t fid, fal_mac_addr_t * addr, fal_port_t port_id);
+
+ sw_error_t
+ fal_fdb_port_del(a_uint32_t dev_id, a_uint32_t fid, fal_mac_addr_t * addr, fal_port_t port_id);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_FDB_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_igmp.h b/include/fal/fal_igmp.h
new file mode 100755
index 0000000..f41fdf7
--- /dev/null
+++ b/include/fal/fal_igmp.h
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_igmp FAL_IGMP
+ * @{
+ */
+#ifndef _FAL_IGMP_H_
+#define _FAL_IGMP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+#include "fal/fal_multi.h"
+
+
+ sw_error_t
+ fal_port_igmps_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_igmps_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable);
+
+
+
+ sw_error_t
+ fal_igmp_mld_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd);
+
+
+
+ sw_error_t
+ fal_igmp_mld_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd);
+
+
+
+ sw_error_t
+ fal_port_igmp_mld_join_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_igmp_mld_join_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_port_igmp_mld_leave_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_igmp_mld_leave_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_igmp_mld_rp_set(a_uint32_t dev_id, fal_pbmp_t pts);
+
+
+
+ sw_error_t
+ fal_igmp_mld_rp_get(a_uint32_t dev_id, fal_pbmp_t * pts);
+
+
+
+ sw_error_t
+ fal_igmp_mld_entry_creat_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_igmp_mld_entry_creat_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_igmp_mld_entry_static_set(a_uint32_t dev_id, a_bool_t static_en);
+
+
+ sw_error_t
+ fal_igmp_mld_entry_static_get(a_uint32_t dev_id, a_bool_t * static_en);
+
+
+ sw_error_t
+ fal_igmp_mld_entry_leaky_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_igmp_mld_entry_leaky_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_igmp_mld_entry_v3_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_igmp_mld_entry_v3_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_igmp_mld_entry_queue_set(a_uint32_t dev_id, a_bool_t enable, a_uint32_t queue);
+
+
+ sw_error_t
+ fal_igmp_mld_entry_queue_get(a_uint32_t dev_id, a_bool_t * enable, a_uint32_t * queue);
+
+
+ sw_error_t
+ fal_port_igmp_mld_learn_limit_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable, a_uint32_t cnt);
+
+
+ sw_error_t
+ fal_port_igmp_mld_learn_limit_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable, a_uint32_t * cnt);
+
+
+ sw_error_t
+ fal_port_igmp_mld_learn_exceed_cmd_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t cmd);
+
+
+ sw_error_t
+ fal_port_igmp_mld_learn_exceed_cmd_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t * cmd);
+
+ sw_error_t
+ fal_igmp_sg_entry_set(a_uint32_t dev_id, fal_igmp_sg_entry_t * entry);
+
+ sw_error_t
+ fal_igmp_sg_entry_clear(a_uint32_t dev_id, fal_igmp_sg_entry_t * entry);
+
+ sw_error_t
+ fal_igmp_sg_entry_show(a_uint32_t dev_id);
+
+ sw_error_t
+ fal_igmp_sg_entry_query(a_uint32_t dev_id, fal_igmp_sg_info_t * info);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_IGMP_H_ */
+
+/**
+ * @}
+ */
diff --git a/include/fal/fal_init.h b/include/fal/fal_init.h
new file mode 100755
index 0000000..b218361
--- /dev/null
+++ b/include/fal/fal_init.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_init FAL_INIT
+ * @{
+ */
+#ifndef _FAL_INIT_H_
+#define _FAL_INIT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "init/ssdk_init.h"
+
+
+
+ sw_error_t fal_init(a_uint32_t dev_id, ssdk_init_cfg * cfg);
+
+
+
+ sw_error_t
+ fal_reduced_init(a_uint32_t dev_id, hsl_init_mode cpu_mode,
+ hsl_access_mode reg_mode);
+
+
+ sw_error_t fal_reset(a_uint32_t dev_id);
+ sw_error_t fal_ssdk_cfg(a_uint32_t dev_id, ssdk_cfg_t *ssdk_cfg);
+ sw_error_t fal_cleanup(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_INIT_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_interface_ctrl.h b/include/fal/fal_interface_ctrl.h
new file mode 100755
index 0000000..23ad46f
--- /dev/null
+++ b/include/fal/fal_interface_ctrl.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_interface_ctrl FAL_INTERFACE_CONTROL
+ * @{
+ */
+#ifndef _FAL_INTERFACECTRL_H_
+#define _FAL_INTERFACECTRL_H_
+
+#ifdef __cplusplus
+extern "c" {
+#endif
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ typedef enum {
+ FAL_MAC_MODE_RGMII = 0,
+ FAL_MAC_MODE_GMII,
+ FAL_MAC_MODE_MII,
+ FAL_MAC_MODE_SGMII,
+ FAL_MAC_MODE_FIBER,
+ FAL_MAC_MODE_RMII,
+ FAL_MAC_MODE_DEFAULT
+ }
+ fal_interface_mac_mode_t;
+
+ typedef enum
+ {
+ FAL_INTERFACE_CLOCK_MAC_MODE = 0,
+ FAL_INTERFACE_CLOCK_PHY_MODE = 1,
+ } fal_interface_clock_mode_t;
+
+ typedef struct
+ {
+ a_bool_t txclk_delay_cmd;
+ a_bool_t rxclk_delay_cmd;
+ a_uint32_t txclk_delay_sel;
+ a_uint32_t rxclk_delay_sel;
+ } fal_mac_rgmii_config_t;
+
+ typedef struct
+ {
+ a_bool_t master_mode;
+ a_bool_t slave_mode;
+ a_bool_t clock_inverse;
+ a_bool_t pipe_rxclk_sel;
+ } fal_mac_rmii_config_t;
+
+ typedef struct
+ {
+ fal_interface_clock_mode_t clock_mode;
+ a_uint32_t txclk_select;
+ a_uint32_t rxclk_select;
+ } fal_mac_gmii_config_t;
+
+ typedef struct
+ {
+ fal_interface_clock_mode_t clock_mode;
+ a_uint32_t txclk_select;
+ a_uint32_t rxclk_select;
+ } fal_mac_mii_config_t;
+
+ typedef struct
+ {
+ fal_interface_clock_mode_t clock_mode;
+ a_bool_t auto_neg;
+ a_bool_t force_speed;
+ a_bool_t prbs_enable;
+ a_bool_t rem_phy_lpbk;
+ } fal_mac_sgmii_config_t;
+
+ typedef struct
+ {
+ a_bool_t auto_neg;
+ a_bool_t fx100_enable;
+ } fal_mac_fiber_config_t;
+
+ typedef struct
+ {
+ fal_interface_mac_mode_t mac_mode;
+ union
+ {
+ fal_mac_rgmii_config_t rgmii;
+ fal_mac_gmii_config_t gmii;
+ fal_mac_mii_config_t mii;
+ fal_mac_sgmii_config_t sgmii;
+ fal_mac_rmii_config_t rmii;
+ fal_mac_fiber_config_t fiber;
+ } config;
+ } fal_mac_config_t;
+
+ typedef struct
+ {
+ fal_interface_mac_mode_t mac_mode;
+ a_bool_t txclk_delay_cmd;
+ a_bool_t rxclk_delay_cmd;
+ a_uint32_t txclk_delay_sel;
+ a_uint32_t rxclk_delay_sel;
+ } fal_phy_config_t;
+
+ typedef enum
+ {
+ Fx100BASE_MODE = 2,
+ } fx100_ctrl_link_mode_t;
+
+ typedef enum
+ {
+ FX100_SERDS_MODE = 1,
+ } sgmii_fiber_mode_t;
+
+#define FX100_HALF_DUPLEX 0
+#define FX100_FULL_DUPLEX 1
+
+ typedef struct
+ {
+ fx100_ctrl_link_mode_t link_mode;
+ a_bool_t overshoot;
+ a_bool_t loopback;
+ a_bool_t fd_mode;
+ a_bool_t col_test;
+ sgmii_fiber_mode_t sgmii_fiber_mode;
+ a_bool_t crs_ctrl;
+ a_bool_t loopback_ctrl;
+ a_bool_t crs_col_100_ctrl;
+ a_bool_t loop_en;
+ } fal_fx100_ctrl_config_t;
+
+ sw_error_t
+ fal_port_3az_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+ sw_error_t
+ fal_port_3az_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+ sw_error_t
+ fal_interface_mac_mode_set(a_uint32_t dev_id, fal_port_t port_id, fal_mac_config_t * config);
+
+ sw_error_t
+ fal_interface_mac_mode_get(a_uint32_t dev_id, fal_port_t port_id, fal_mac_config_t * config);
+
+ sw_error_t
+ fal_interface_phy_mode_set(a_uint32_t dev_id, a_uint32_t phy_id, fal_phy_config_t * config);
+
+ sw_error_t
+ fal_interface_phy_mode_get(a_uint32_t dev_id, a_uint32_t phy_id, fal_phy_config_t * config);
+
+ sw_error_t
+ fal_interface_fx100_ctrl_set(a_uint32_t dev_id, fal_fx100_ctrl_config_t * config);
+
+ sw_error_t
+ fal_interface_fx100_ctrl_get(a_uint32_t dev_id, fal_fx100_ctrl_config_t * config);
+
+ sw_error_t
+ fal_interface_fx100_status_get(a_uint32_t dev_id, a_uint32_t* status);
+
+ sw_error_t
+ fal_interface_mac06_exch_set(a_uint32_t dev_id, a_bool_t enable);
+
+ sw_error_t
+ fal_interface_mac06_exch_get(a_uint32_t dev_id, a_bool_t* enable);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_INTERFACECTRL_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_ip.h b/include/fal/fal_ip.h
new file mode 100755
index 0000000..c1015a5
--- /dev/null
+++ b/include/fal/fal_ip.h
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_ip FAL_IP
+ * @{
+ */
+#ifndef _FAL_IP_H_
+#define _FAL_IP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ /* IP WCMP hash key flags */
+#define FAL_WCMP_HASH_KEY_SIP 0x1
+#define FAL_WCMP_HASH_KEY_DIP 0x2
+#define FAL_WCMP_HASH_KEY_SPORT 0x4
+#define FAL_WCMP_HASH_KEY_DPORT 0x8
+
+ /* IP entry operation flags */
+#define FAL_IP_ENTRY_ID_EN 0x1
+#define FAL_IP_ENTRY_INTF_EN 0x2
+#define FAL_IP_ENTRY_PORT_EN 0x4
+#define FAL_IP_ENTRY_STATUS_EN 0x8
+#define FAL_IP_ENTRY_IPADDR_EN 0x10
+
+ /* IP host entry structure flags field */
+#define FAL_IP_IP4_ADDR 0x1
+#define FAL_IP_IP6_ADDR 0x2
+#define FAL_IP_CPU_ADDR 0x4
+
+ typedef struct
+ {
+ a_uint32_t entry_id;
+ a_uint32_t flags;
+ a_uint32_t status;
+ fal_ip4_addr_t ip4_addr;
+ fal_ip6_addr_t ip6_addr;
+ fal_mac_addr_t mac_addr;
+ a_uint32_t intf_id;
+ a_uint32_t expect_vid;
+ fal_port_t port_id;
+ a_bool_t mirror_en;
+ a_bool_t counter_en;
+ a_uint32_t counter_id;
+ a_uint32_t packet;
+ a_uint32_t byte;
+ a_bool_t pppoe_en;
+ a_uint32_t pppoe_id;
+ fal_fwd_cmd_t action;
+ } fal_host_entry_t;
+
+ typedef enum
+ {
+ FAL_MAC_IP_GUARD = 0,
+ FAL_MAC_IP_PORT_GUARD,
+ FAL_MAC_IP_VLAN_GUARD,
+ FAL_MAC_IP_PORT_VLAN_GUARD,
+ FAL_NO_SOURCE_GUARD,
+ } fal_source_guard_mode_t;
+
+ typedef enum
+ {
+ FAL_ARP_LEARN_LOCAL = 0,
+ FAL_ARP_LEARN_ALL,
+ } fal_arp_learn_mode_t;
+
+ /* IP host entry auto learn arp packets type */
+#define FAL_ARP_LEARN_REQ 0x1
+#define FAL_ARP_LEARN_ACK 0x2
+
+ typedef struct
+ {
+ a_uint32_t entry_id;
+ a_uint16_t vid_low;
+ a_uint16_t vid_high;
+ fal_mac_addr_t mac_addr;
+ a_bool_t ip4_route;
+ a_bool_t ip6_route;
+ } fal_intf_mac_entry_t;
+
+ typedef struct
+ {
+ a_uint32_t nh_nr;
+ a_uint32_t nh_id[16];
+ } fal_ip_wcmp_t;
+
+ sw_error_t
+ fal_ip_host_add(a_uint32_t dev_id, fal_host_entry_t * host_entry);
+
+ sw_error_t
+ fal_ip_host_del(a_uint32_t dev_id, a_uint32_t del_mode,
+ fal_host_entry_t * host_entry);
+
+ sw_error_t
+ fal_ip_host_get(a_uint32_t dev_id, a_uint32_t get_mode,
+ fal_host_entry_t * host_entry);
+
+ sw_error_t
+ fal_ip_host_next(a_uint32_t dev_id, a_uint32_t next_mode,
+ fal_host_entry_t * host_entry);
+
+ sw_error_t
+ fal_ip_host_counter_bind(a_uint32_t dev_id, a_uint32_t entry_id,
+ a_uint32_t cnt_id, a_bool_t enable);
+
+ sw_error_t
+ fal_ip_host_pppoe_bind(a_uint32_t dev_id, a_uint32_t entry_id,
+ a_uint32_t pppoe_id, a_bool_t enable);
+
+ sw_error_t
+ fal_ip_pt_arp_learn_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t flags);
+
+ sw_error_t
+ fal_ip_pt_arp_learn_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * flags);
+
+ sw_error_t
+ fal_ip_arp_learn_set(a_uint32_t dev_id, fal_arp_learn_mode_t mode);
+
+ sw_error_t
+ fal_ip_arp_learn_get(a_uint32_t dev_id, fal_arp_learn_mode_t * mode);
+
+ sw_error_t
+ fal_ip_source_guard_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_source_guard_mode_t mode);
+
+ sw_error_t
+ fal_ip_source_guard_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_source_guard_mode_t * mode);
+
+ sw_error_t
+ fal_ip_arp_guard_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_source_guard_mode_t mode);
+
+ sw_error_t
+ fal_ip_arp_guard_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_source_guard_mode_t * mode);
+
+ sw_error_t
+ fal_ip_route_status_set(a_uint32_t dev_id, a_bool_t enable);
+
+ sw_error_t
+ fal_ip_route_status_get(a_uint32_t dev_id, a_bool_t * enable);
+
+ sw_error_t
+ fal_ip_intf_entry_add(a_uint32_t dev_id, fal_intf_mac_entry_t * entry);
+
+ sw_error_t
+ fal_ip_intf_entry_del(a_uint32_t dev_id, a_uint32_t del_mode,
+ fal_intf_mac_entry_t * entry);
+
+ sw_error_t
+ fal_ip_intf_entry_next(a_uint32_t dev_id, a_uint32_t next_mode,
+ fal_intf_mac_entry_t * entry);
+
+ sw_error_t
+ fal_ip_unk_source_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd);
+
+ sw_error_t
+ fal_ip_unk_source_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd);
+
+ sw_error_t
+ fal_arp_unk_source_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd);
+
+ sw_error_t
+ fal_arp_unk_source_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd);
+
+ sw_error_t
+ fal_ip_age_time_set(a_uint32_t dev_id, a_uint32_t * time);
+
+ sw_error_t
+ fal_ip_age_time_get(a_uint32_t dev_id, a_uint32_t * time);
+
+ sw_error_t
+ fal_ip_wcmp_entry_set(a_uint32_t dev_id, a_uint32_t wcmp_id, fal_ip_wcmp_t * wcmp);
+
+ sw_error_t
+ fal_ip_wcmp_entry_get(a_uint32_t dev_id, a_uint32_t wcmp_id, fal_ip_wcmp_t * wcmp);
+
+ sw_error_t
+ fal_ip_wcmp_hash_mode_set(a_uint32_t dev_id, a_uint32_t hash_mode);
+
+ sw_error_t
+ fal_ip_wcmp_hash_mode_get(a_uint32_t dev_id, a_uint32_t * hash_mode);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_IP_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_leaky.h b/include/fal/fal_leaky.h
new file mode 100755
index 0000000..255eac4
--- /dev/null
+++ b/include/fal/fal_leaky.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_leaky FAL_LEAKY
+ * @{
+ */
+#ifndef _FAL_LEAKY_H_
+#define _FAL_LEAKY_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ /**
+ @brief This enum defines the leaky control mode.
+ */
+ typedef enum {
+ FAL_LEAKY_PORT_CTRL = 0, /**< control leaky through port which packets received*/
+ FAL_LEAKY_FDB_CTRL, /**< control leaky through fdb entry*/
+ FAL_LEAKY_CTRL_MODE_BUTT
+ }
+ fal_leaky_ctrl_mode_t;
+
+
+
+ sw_error_t
+ fal_uc_leaky_mode_set(a_uint32_t dev_id,
+ fal_leaky_ctrl_mode_t ctrl_mode);
+
+
+
+ sw_error_t
+ fal_uc_leaky_mode_get(a_uint32_t dev_id,
+ fal_leaky_ctrl_mode_t * ctrl_mode);
+
+
+
+ sw_error_t
+ fal_mc_leaky_mode_set(a_uint32_t dev_id,
+ fal_leaky_ctrl_mode_t ctrl_mode);
+
+
+
+ sw_error_t
+ fal_mc_leaky_mode_get(a_uint32_t dev_id,
+ fal_leaky_ctrl_mode_t * ctrl_mode);
+
+
+
+ sw_error_t
+ fal_port_arp_leaky_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_arp_leaky_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_port_uc_leaky_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_uc_leaky_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_port_mc_leaky_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_mc_leaky_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_LEAKY_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_led.h b/include/fal/fal_led.h
new file mode 100755
index 0000000..ce04033
--- /dev/null
+++ b/include/fal/fal_led.h
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_led FAL_LED
+ * @{
+ */
+#ifndef _FAL_LED_H_
+#define _FAL_LED_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ /**
+ @brief This enum defines the led group.
+ */
+ typedef enum {
+ LED_LAN_PORT_GROUP = 0, /**< control lan ports*/
+ LED_WAN_PORT_GROUP, /**< control wan ports*/
+ LED_MAC_PORT_GROUP, /**< control mac ports*/
+ LED_GROUP_BUTT
+ }
+ led_pattern_group_t;
+
+ /**
+ @brief This enum defines the led pattern id, each ports has three led
+ and pattern0 relates to led0, pattern1 relates to led1, pattern2 relates to led2.
+ */
+ typedef a_uint32_t led_pattern_id_t;
+
+
+ /**
+ @brief This enum defines the led control pattern mode.
+ */
+ typedef enum
+ {
+ LED_ALWAYS_OFF = 0,
+ LED_ALWAYS_BLINK,
+ LED_ALWAYS_ON,
+ LED_PATTERN_MAP_EN,
+ LED_PATTERN_MODE_BUTT
+ } led_pattern_mode_t;
+
+
+#define FULL_DUPLEX_LIGHT_EN 0
+#define HALF_DUPLEX_LIGHT_EN 1
+#define POWER_ON_LIGHT_EN 2
+#define LINK_1000M_LIGHT_EN 3
+#define LINK_100M_LIGHT_EN 4
+#define LINK_10M_LIGHT_EN 5
+#define COLLISION_BLINK_EN 6
+#define RX_TRAFFIC_BLINK_EN 7
+#define TX_TRAFFIC_BLINK_EN 8
+#define LINKUP_OVERRIDE_EN 9
+
+
+ /**
+ @brief This enum defines the led control pattern map.
+ */
+ typedef a_uint32_t led_pattern_map_t;
+
+
+ /**
+ @brief This enum defines the led control pattern mode.
+ */
+ typedef enum
+ {
+ LED_BLINK_2HZ = 0,
+ LED_BLINK_4HZ,
+ LED_BLINK_8HZ,
+ LED_BLINK_TXRX, /**< Frequency relates to speed, 1000M-8HZ,100M->4HZ,10M->2HZ,Others->4HZ */
+ LED_BLINK_FREQ_BUTT
+ } led_blink_freq_t;
+
+
+ typedef struct
+ {
+ led_pattern_mode_t mode;
+ led_pattern_map_t map;
+ led_blink_freq_t freq;
+ } led_ctrl_pattern_t;
+
+
+
+
+
+ sw_error_t
+ fal_led_ctrl_pattern_set(a_uint32_t dev_id, led_pattern_group_t group,
+ led_pattern_id_t id, led_ctrl_pattern_t * pattern);
+
+
+
+ sw_error_t
+ fal_led_ctrl_pattern_get(a_uint32_t dev_id, led_pattern_group_t group,
+ led_pattern_id_t id, led_ctrl_pattern_t * pattern);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_LED_H_ */
+/**
+ * @}
+ */
+
diff --git a/include/fal/fal_mib.h b/include/fal/fal_mib.h
new file mode 100755
index 0000000..f8ae964
--- /dev/null
+++ b/include/fal/fal_mib.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_mib FAL_MIB
+ * @{
+ */
+#ifndef _FAL_MIB_H
+#define _FAL_MIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ /**@brief This structure defines the mib infomation.
+ */
+ typedef struct
+ {
+ a_uint32_t RxBroad;
+ a_uint32_t RxPause;
+ a_uint32_t RxMulti;
+ a_uint32_t RxFcsErr;
+ a_uint32_t RxAllignErr;
+ a_uint32_t RxRunt;
+ a_uint32_t RxFragment;
+ a_uint32_t Rx64Byte;
+ a_uint32_t Rx128Byte;
+ a_uint32_t Rx256Byte;
+ a_uint32_t Rx512Byte;
+ a_uint32_t Rx1024Byte;
+ a_uint32_t Rx1518Byte;
+ a_uint32_t RxMaxByte;
+ a_uint32_t RxTooLong;
+ a_uint32_t RxGoodByte_lo; /**< low 32 bits of RxGoodByte statistc item */
+ a_uint32_t RxGoodByte_hi; /**< high 32 bits of RxGoodByte statistc item*/
+ a_uint32_t RxBadByte_lo; /**< low 32 bits of RxBadByte statistc item */
+ a_uint32_t RxBadByte_hi; /**< high 32 bits of RxBadByte statistc item */
+ a_uint32_t RxOverFlow;
+ a_uint32_t Filtered;
+ a_uint32_t TxBroad;
+ a_uint32_t TxPause;
+ a_uint32_t TxMulti;
+ a_uint32_t TxUnderRun;
+ a_uint32_t Tx64Byte;
+ a_uint32_t Tx128Byte;
+ a_uint32_t Tx256Byte;
+ a_uint32_t Tx512Byte;
+ a_uint32_t Tx1024Byte;
+ a_uint32_t Tx1518Byte;
+ a_uint32_t TxMaxByte;
+ a_uint32_t TxOverSize;
+ a_uint32_t TxByte_lo; /**< low 32 bits of TxByte statistc item */
+ a_uint32_t TxByte_hi; /**< high 32 bits of TxByte statistc item */
+ a_uint32_t TxCollision;
+ a_uint32_t TxAbortCol;
+ a_uint32_t TxMultiCol;
+ a_uint32_t TxSingalCol;
+ a_uint32_t TxExcDefer;
+ a_uint32_t TxDefer;
+ a_uint32_t TxLateCol;
+ a_uint32_t RxUniCast;
+ a_uint32_t TxUniCast;
+ } fal_mib_info_t;
+
+
+ sw_error_t
+ fal_get_mib_info(a_uint32_t dev_id, fal_port_t port_id,
+ fal_mib_info_t * mib_info );
+
+
+
+ sw_error_t
+ fal_mib_status_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_mib_status_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_mib_port_flush_counters(a_uint32_t dev_id, fal_port_t port_id);
+
+
+ sw_error_t
+ fal_mib_cpukeep_set(a_uint32_t dev_id, a_bool_t enable);
+
+ sw_error_t
+ fal_mib_cpukeep_get(a_uint32_t dev_id, a_bool_t * enable);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _FAL_MIB_H */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_mirror.h b/include/fal/fal_mirror.h
new file mode 100755
index 0000000..c434765
--- /dev/null
+++ b/include/fal/fal_mirror.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_mirror FAL_MIRROR
+ * @{
+ */
+#ifndef _FAL_MIRROR_H_
+#define _FAL_MIRROR_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+
+
+ sw_error_t fal_mirr_analysis_port_set(a_uint32_t dev_id, fal_port_t port_id);
+
+
+
+ sw_error_t fal_mirr_analysis_port_get(a_uint32_t dev_id, fal_port_t * port_id);
+
+
+
+ sw_error_t
+ fal_mirr_port_in_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_mirr_port_in_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_mirr_port_eg_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_mirr_port_eg_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _PORT_MIRROR_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_misc.h b/include/fal/fal_misc.h
new file mode 100755
index 0000000..82f0e04
--- /dev/null
+++ b/include/fal/fal_misc.h
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_gen FAL_MISC
+ * @{
+ */
+#ifndef _FAL_MISC_H_
+#define _FAL_MISC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+
+ typedef struct
+ {
+ a_uint32_t entry_id;
+ a_uint32_t session_id;
+ a_bool_t multi_session;
+ a_bool_t uni_session;
+ } fal_pppoe_session_t;
+
+ typedef enum
+ {
+ FAL_LOOP_CHECK_1MS = 0,
+ FAL_LOOP_CHECK_10MS,
+ FAL_LOOP_CHECK_100MS,
+ FAL_LOOP_CHECK_500MS,
+ } fal_loop_check_time_t;
+
+ /* define switch interrupt type bitmap */
+#define FAL_SWITCH_INTR_LINK_STATUS 0x1 /* up/down/speed/duplex status */
+
+ sw_error_t fal_arp_status_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+
+ sw_error_t fal_arp_status_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+
+ sw_error_t fal_frame_max_size_set(a_uint32_t dev_id, a_uint32_t size);
+
+
+
+ sw_error_t fal_frame_max_size_get(a_uint32_t dev_id, a_uint32_t * size);
+
+
+
+ sw_error_t
+ fal_port_unk_sa_cmd_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t cmd);
+
+
+
+ sw_error_t
+ fal_port_unk_sa_cmd_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t * cmd);
+
+
+
+ sw_error_t
+ fal_port_unk_uc_filter_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_unk_uc_filter_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_port_unk_mc_filter_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_unk_mc_filter_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_bc_filter_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_bc_filter_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+ sw_error_t
+ fal_cpu_port_status_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_cpu_port_status_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_bc_to_cpu_port_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_bc_to_cpu_port_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_pppoe_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd);
+
+
+
+ sw_error_t
+ fal_pppoe_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd);
+
+
+
+ sw_error_t
+ fal_pppoe_status_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_pppoe_status_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_port_dhcp_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_dhcp_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_arp_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd);
+
+
+ sw_error_t
+ fal_arp_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd);
+
+
+ sw_error_t
+ fal_eapol_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd);
+
+
+ sw_error_t
+ fal_eapol_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd);
+
+
+ sw_error_t
+ fal_pppoe_session_add(a_uint32_t dev_id, a_uint32_t session_id, a_bool_t strip_hdr);
+
+
+ sw_error_t
+ fal_pppoe_session_del(a_uint32_t dev_id, a_uint32_t session_id);
+
+
+ sw_error_t
+ fal_pppoe_session_get(a_uint32_t dev_id, a_uint32_t session_id, a_bool_t * strip_hdr);
+
+ sw_error_t
+ fal_eapol_status_set(a_uint32_t dev_id, a_uint32_t port_id, a_bool_t enable);
+
+ sw_error_t
+ fal_eapol_status_get(a_uint32_t dev_id, a_uint32_t port_id, a_bool_t * enable);
+
+ sw_error_t
+ fal_ripv1_status_set(a_uint32_t dev_id, a_bool_t enable);
+
+ sw_error_t
+ fal_ripv1_status_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_arp_req_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_arp_req_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable);
+
+
+ sw_error_t
+ fal_port_arp_ack_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_arp_ack_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable);
+
+
+ sw_error_t
+ fal_pppoe_session_table_add(a_uint32_t dev_id, fal_pppoe_session_t * session_tbl);
+
+
+ sw_error_t
+ fal_pppoe_session_table_del(a_uint32_t dev_id, fal_pppoe_session_t * session_tbl);
+
+
+ sw_error_t
+ fal_pppoe_session_table_get(a_uint32_t dev_id, fal_pppoe_session_t * session_tbl);
+
+
+ sw_error_t
+ fal_pppoe_session_id_set(a_uint32_t dev_id, a_uint32_t index,
+ a_uint32_t id);
+
+
+ sw_error_t
+ fal_pppoe_session_id_get(a_uint32_t dev_id, a_uint32_t index,
+ a_uint32_t * id);
+
+
+ sw_error_t
+ fal_intr_mask_set(a_uint32_t dev_id, a_uint32_t intr_mask);
+
+
+ sw_error_t
+ fal_intr_mask_get(a_uint32_t dev_id, a_uint32_t * intr_mask);
+
+
+ sw_error_t
+ fal_intr_status_get(a_uint32_t dev_id, a_uint32_t * intr_status);
+
+
+ sw_error_t
+ fal_intr_status_clear(a_uint32_t dev_id, a_uint32_t intr_status);
+
+
+ sw_error_t
+ fal_intr_port_link_mask_set(a_uint32_t dev_id, a_uint32_t port_id, a_uint32_t intr_mask);
+
+
+ sw_error_t
+ fal_intr_port_link_mask_get(a_uint32_t dev_id, a_uint32_t port_id, a_uint32_t * intr_mask);
+
+
+ sw_error_t
+ fal_intr_port_link_status_get(a_uint32_t dev_id, a_uint32_t port_id, a_uint32_t * intr_mask);
+
+
+ sw_error_t
+ fal_intr_mask_mac_linkchg_set(a_uint32_t dev_id, a_uint32_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_intr_mask_mac_linkchg_get(a_uint32_t dev_id, a_uint32_t port_id, a_bool_t * enable);
+
+ sw_error_t
+ fal_intr_status_mac_linkchg_get(a_uint32_t dev_id, fal_pbmp_t *port_bitmap);
+
+ sw_error_t
+ fal_cpu_vid_en_set(a_uint32_t dev_id, a_bool_t enable);
+
+ sw_error_t
+ fal_cpu_vid_en_get(a_uint32_t dev_id, a_bool_t * enable);
+
+ sw_error_t
+ fal_rtd_pppoe_en_set(a_uint32_t dev_id, a_bool_t enable);
+
+ sw_error_t
+ fal_rtd_pppoe_en_get(a_uint32_t dev_id, a_bool_t * enable);
+
+ sw_error_t
+ fal_intr_status_mac_linkchg_clear(a_uint32_t dev_id);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_MISC_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_multi.h b/include/fal/fal_multi.h
new file mode 100755
index 0000000..eaa90bc
--- /dev/null
+++ b/include/fal/fal_multi.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#ifndef _FAL_MULTI_H_
+#define _FAL_MULTI_H_
+
+/*supports 32 entries*/
+#define FAL_IGMP_SG_ENTRY_MAX 32
+
+typedef enum
+{
+ FAL_ADDR_IPV4 = 0,
+ FAL_ADDR_IPV6
+} fal_addr_type_t;
+
+typedef struct
+{
+ fal_addr_type_t type;
+ union
+ {
+ fal_ip4_addr_t ip4_addr;
+ fal_ip6_addr_t ip6_addr;
+ } u;
+} fal_igmp_sg_addr_t;
+
+typedef struct
+{
+ fal_igmp_sg_addr_t source;
+ fal_igmp_sg_addr_t group;
+ fal_pbmp_t port_map;
+} fal_igmp_sg_entry_t;
+
+//#define MULTI_DEBUG_
+#ifdef MULTI_DEBUG_
+#define MULTI_DEBUG(x...) aos_printk(x)
+#else
+#define MULTI_DEBUG(x...)
+#endif
+
+#define FAL_ACL_LIST_MULTICAST 55
+#define FAL_MULTICAST_PRI 5
+
+#define MULT_ACTION_SET 0
+#define MULT_ACTION_CLEAR 1
+
+// static a_uint32_t rule_nr=1;
+
+typedef struct
+{
+ a_uint8_t index; //MAX is 32
+ fal_igmp_sg_entry_t entry; //Stores the specific ACL rule info
+} multi_acl_info_t;
+
+typedef struct
+{
+ a_uint8_t cnt; //MAX is 32
+ multi_acl_info_t acl_info[FAL_IGMP_SG_ENTRY_MAX]; //Stores the all ACL rule info
+} fal_igmp_sg_info_t;
+
+#endif
diff --git a/include/fal/fal_nat.h b/include/fal/fal_nat.h
new file mode 100755
index 0000000..420c11a
--- /dev/null
+++ b/include/fal/fal_nat.h
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_nat FAL_NAT
+ * @{
+ */
+#ifndef _FAL_NAT_H_
+#define _FAL_NAT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+
+#define FAL_NAT_ENTRY_PROTOCOL_TCP 0x1
+#define FAL_NAT_ENTRY_PROTOCOL_UDP 0x2
+#define FAL_NAT_ENTRY_PROTOCOL_PPTP 0x4
+#define FAL_NAT_ENTRY_PROTOCOL_ANY 0x8
+#define FAL_NAT_ENTRY_TRANS_IPADDR_INDEX 0x10
+#define FAL_NAT_ENTRY_PORT_CHECK 0x20
+#define FAL_NAT_HASH_KEY_PORT 0x40
+#define FAL_NAT_HASH_KEY_IPADDR 0x80
+
+
+ /* NAT entry operation flags */
+#define FAL_NAT_ENTRY_ID_EN 0x1
+#define FAL_NAT_ENTRY_SRC_IPADDR_EN 0x2
+#define FAL_NAT_ENTRY_TRANS_IPADDR_EN 0x4
+#define FAL_NAT_ENTRY_KEY_EN 0x8
+#define FAL_NAT_ENTRY_PUBLIC_IP_EN 0x10
+#define FAL_NAT_ENTRY_SOURCE_IP_EN 0x20
+#define FAL_NAT_ENTRY_AGE_EN 0x40
+
+
+ typedef struct
+ {
+ a_uint32_t entry_id;
+ a_uint32_t flags;
+ a_uint32_t status;
+ fal_ip4_addr_t src_addr;
+ fal_ip4_addr_t dst_addr;
+ a_uint16_t src_port;
+ a_uint16_t dst_port;
+ fal_ip4_addr_t trans_addr;
+ a_uint16_t trans_port;
+ a_uint16_t rsv;
+ a_bool_t mirror_en;
+ a_bool_t counter_en;
+ a_uint32_t counter_id;
+ a_uint32_t ingress_packet;
+ a_uint32_t ingress_byte;
+ a_uint32_t egress_packet;
+ a_uint32_t egress_byte;
+ fal_fwd_cmd_t action;
+ } fal_napt_entry_t;
+
+
+ typedef struct
+ {
+ a_uint32_t entry_id;
+ a_uint32_t flags;
+ a_uint32_t status;
+ fal_ip4_addr_t src_addr;
+ fal_ip4_addr_t trans_addr;
+ a_uint16_t port_num;
+ a_uint16_t port_range;
+ a_uint32_t slct_idx;
+ a_bool_t mirror_en;
+ a_bool_t counter_en;
+ a_uint32_t counter_id;
+ a_uint32_t ingress_packet;
+ a_uint32_t ingress_byte;
+ a_uint32_t egress_packet;
+ a_uint32_t egress_byte;
+ fal_fwd_cmd_t action;
+ } fal_nat_entry_t;
+
+
+ typedef enum
+ {
+ FAL_NAPT_FULL_CONE = 0,
+ FAL_NAPT_STRICT_CONE,
+ FAL_NAPT_PORT_STRICT,
+ FAL_NAPT_SYNMETRIC,
+ } fal_napt_mode_t;
+
+
+ typedef struct
+ {
+ a_uint32_t entry_id;
+ fal_ip4_addr_t pub_addr;
+ } fal_nat_pub_addr_t;
+
+
+ sw_error_t
+ fal_nat_add(a_uint32_t dev_id, fal_nat_entry_t * nat_entry);
+
+
+ sw_error_t
+ fal_nat_del(a_uint32_t dev_id, a_uint32_t del_mode, fal_nat_entry_t * nat_entry);
+
+
+ sw_error_t
+ fal_nat_get(a_uint32_t dev_id, a_uint32_t get_mode, fal_nat_entry_t * nat_entry);
+
+
+ sw_error_t
+ fal_nat_next(a_uint32_t dev_id, a_uint32_t get_mode, fal_nat_entry_t * nat_entry);
+
+
+ sw_error_t
+ fal_nat_counter_bind(a_uint32_t dev_id, a_uint32_t entry_id, a_uint32_t cnt_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_napt_add(a_uint32_t dev_id, fal_napt_entry_t * napt_entry);
+
+
+ sw_error_t
+ fal_napt_del(a_uint32_t dev_id, a_uint32_t del_mode, fal_napt_entry_t * napt_entry);
+
+
+ sw_error_t
+ fal_napt_get(a_uint32_t dev_id, a_uint32_t get_mode, fal_napt_entry_t * napt_entry);
+
+
+ sw_error_t
+ fal_napt_next(a_uint32_t dev_id, a_uint32_t next_mode, fal_napt_entry_t * napt_entry);
+
+
+ sw_error_t
+ fal_napt_counter_bind(a_uint32_t dev_id, a_uint32_t entry_id, a_uint32_t cnt_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_nat_status_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_nat_status_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_nat_hash_mode_set(a_uint32_t dev_id, a_uint32_t mode);
+
+
+ sw_error_t
+ fal_nat_hash_mode_get(a_uint32_t dev_id, a_uint32_t * mode);
+
+
+ sw_error_t
+ fal_napt_status_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_napt_status_get(a_uint32_t dev_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_napt_mode_set(a_uint32_t dev_id, fal_napt_mode_t mode);
+
+
+ sw_error_t
+ fal_napt_mode_get(a_uint32_t dev_id, fal_napt_mode_t * mode);
+
+
+ sw_error_t
+ fal_napt_mode_get(a_uint32_t dev_id, fal_napt_mode_t * mode);
+
+
+ sw_error_t
+ fal_nat_prv_base_addr_set(a_uint32_t dev_id, fal_ip4_addr_t addr);
+
+
+ sw_error_t
+ fal_nat_prv_base_addr_get(a_uint32_t dev_id, fal_ip4_addr_t * addr);
+
+ sw_error_t
+ fal_nat_prv_base_mask_set(a_uint32_t dev_id, fal_ip4_addr_t addr);
+
+ sw_error_t
+ fal_nat_prv_base_mask_get(a_uint32_t dev_id, fal_ip4_addr_t * addr);
+
+
+ sw_error_t
+ fal_nat_prv_addr_mode_set(a_uint32_t dev_id, a_bool_t map_en);
+
+
+ sw_error_t
+ fal_nat_prv_addr_mode_get(a_uint32_t dev_id, a_bool_t * map_en);
+
+
+ sw_error_t
+ fal_nat_pub_addr_add(a_uint32_t dev_id, fal_nat_pub_addr_t * entry);
+
+
+ sw_error_t
+ fal_nat_pub_addr_del(a_uint32_t dev_id, a_uint32_t del_mode, fal_nat_pub_addr_t * entry);
+
+
+ sw_error_t
+ fal_nat_pub_addr_next(a_uint32_t dev_id, a_uint32_t next_mode, fal_nat_pub_addr_t * entry);
+
+
+ sw_error_t
+ fal_nat_unk_session_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd);
+
+
+ sw_error_t
+ fal_nat_unk_session_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd);
+
+ sw_error_t
+ fal_nat_global_set(a_uint32_t dev_id, a_bool_t enable);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_NAT_H_ */
+
+/**
+ * @}
+ */
+
diff --git a/include/fal/fal_port_ctrl.h b/include/fal/fal_port_ctrl.h
new file mode 100755
index 0000000..3ce9e79
--- /dev/null
+++ b/include/fal/fal_port_ctrl.h
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_port_ctrl FAL_PORT_CONTROL
+ * @{
+ */
+#ifndef _FAL_PORTCTRL_H_
+#define _FAL_PORTCTRL_H_
+
+#ifdef __cplusplus
+extern "c" {
+#endif
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ typedef enum {
+ FAL_HALF_DUPLEX = 0,
+ FAL_FULL_DUPLEX,
+ FAL_DUPLEX_BUTT = 0xffff
+ }
+ fal_port_duplex_t;
+
+ typedef enum
+ {
+ FAL_SPEED_10 = 10,
+ FAL_SPEED_100 = 100,
+ FAL_SPEED_1000 = 1000,
+ FAL_SPEED_10000 = 10000,
+ FAL_SPEED_BUTT = 0xffff,
+ } fal_port_speed_t;
+
+ typedef enum
+ {
+ FAL_CABLE_STATUS_NORMAL = 0,
+ FAL_CABLE_STATUS_SHORT = 1,
+ FAL_CABLE_STATUS_OPENED = 2,
+ FAL_CABLE_STATUS_INVALID = 3,
+ FAL_CABLE_STATUS_BUTT = 0xffff,
+ } fal_cable_status_t;
+
+#define FAL_ENABLE 1
+#define FAL_DISABLE 0
+
+//phy autoneg adv
+#define FAL_PHY_ADV_10T_HD 0x01
+#define FAL_PHY_ADV_10T_FD 0x02
+#define FAL_PHY_ADV_100TX_HD 0x04
+#define FAL_PHY_ADV_100TX_FD 0x08
+//#define FAL_PHY_ADV_1000T_HD 0x100
+#define FAL_PHY_ADV_1000T_FD 0x200
+#define FAL_PHY_ADV_FE_SPEED_ALL \
+ (FAL_PHY_ADV_10T_HD | FAL_PHY_ADV_10T_FD | FAL_PHY_ADV_100TX_HD |\
+ FAL_PHY_ADV_100TX_FD)
+
+#define FAL_PHY_ADV_GE_SPEED_ALL \
+ (FAL_PHY_ADV_10T_HD | FAL_PHY_ADV_10T_FD | FAL_PHY_ADV_100TX_HD |\
+ FAL_PHY_ADV_100TX_FD | FAL_PHY_ADV_1000T_FD)
+
+#define FAL_PHY_ADV_PAUSE 0x10
+#define FAL_PHY_ADV_ASY_PAUSE 0x20
+#define FAL_PHY_FE_ADV_ALL \
+ (FAL_PHY_ADV_FE_SPEED_ALL | FAL_PHY_ADV_PAUSE | FAL_PHY_ADV_ASY_PAUSE)
+#define FAL_PHY_GE_ADV_ALL \
+ (FAL_PHY_ADV_GE_SPEED_ALL | FAL_PHY_ADV_PAUSE | FAL_PHY_ADV_ASY_PAUSE)
+
+//phy capablity
+#define FAL_PHY_AUTONEG_CAPS 0x01
+#define FAL_PHY_100T2_HD_CAPS 0x02
+#define FAL_PHY_100T2_FD_CAPS 0x04
+#define FAL_PHY_10T_HD_CAPS 0x08
+#define FAL_PHY_10T_FD_CAPS 0x10
+#define FAL_PHY_100X_HD_CAPS 0x20
+#define FAL_PHY_100X_FD_CAPS 0x40
+#define FAL_PHY_100T4_CAPS 0x80
+//#define FAL_PHY_1000T_HD_CAPS 0x100
+#define FAL_PHY_1000T_FD_CAPS 0x200
+//#define FAL_PHY_1000X_HD_CAPS 0x400
+#define FAL_PHY_1000X_FD_CAPS 0x800
+
+//phy partner capablity
+#define FAL_PHY_PART_10T_HD 0x1
+#define FAL_PHY_PART_10T_FD 0x2
+#define FAL_PHY_PART_100TX_HD 0x4
+#define FAL_PHY_PART_100TX_FD 0x8
+//#define FAL_PHY_PART_1000T_HD 0x10
+#define FAL_PHY_PART_1000T_FD 0x20
+
+//phy interrupt flag
+#define FAL_PHY_INTR_SPEED_CHANGE 0x1
+#define FAL_PHY_INTR_DUPLEX_CHANGE 0x2
+#define FAL_PHY_INTR_STATUS_UP_CHANGE 0x4
+#define FAL_PHY_INTR_STATUS_DOWN_CHANGE 0x8
+
+ typedef enum
+ {
+ FAL_NO_HEADER_EN = 0,
+ FAL_ONLY_MANAGE_FRAME_EN,
+ FAL_ALL_TYPE_FRAME_EN
+ } fal_port_header_mode_t;
+
+ typedef struct
+ {
+ a_uint16_t pair_a_status;
+ a_uint16_t pair_b_status;
+ a_uint16_t pair_c_status;
+ a_uint16_t pair_d_status;
+ a_uint32_t pair_a_len;
+ a_uint32_t pair_b_len;
+ a_uint32_t pair_c_len;
+ a_uint32_t pair_d_len;
+ } fal_port_cdt_t;
+
+ sw_error_t
+ fal_port_duplex_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_duplex_t duplex);
+
+
+
+ sw_error_t
+ fal_port_duplex_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_duplex_t * pduplex);
+
+
+
+ sw_error_t
+ fal_port_speed_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_speed_t speed);
+
+
+
+ sw_error_t
+ fal_port_speed_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_speed_t * pspeed);
+
+
+
+ sw_error_t
+ fal_port_autoneg_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * status);
+
+
+
+ sw_error_t
+ fal_port_autoneg_enable(a_uint32_t dev_id, fal_port_t port_id);
+
+
+
+ sw_error_t
+ fal_port_autoneg_restart(a_uint32_t dev_id, fal_port_t port_id);
+
+
+
+ sw_error_t
+ fal_port_autoneg_adv_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t autoadv);
+
+
+
+ sw_error_t
+ fal_port_autoneg_adv_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * autoadv);
+
+
+
+ sw_error_t
+ fal_port_hdr_status_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_hdr_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_port_flowctrl_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_flowctrl_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable);
+
+
+ sw_error_t
+ fal_port_flowctrl_forcemode_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_flowctrl_forcemode_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_powersave_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_powersave_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable);
+
+
+ sw_error_t
+ fal_port_hibernate_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_hibernate_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable);
+
+
+ sw_error_t
+ fal_port_cdt(a_uint32_t dev_id, fal_port_t port_id, a_uint32_t mdi_pair,
+ fal_cable_status_t *cable_status, a_uint32_t *cable_len);
+
+
+ sw_error_t
+ fal_port_rxhdr_mode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_header_mode_t mode);
+
+
+ sw_error_t
+ fal_port_rxhdr_mode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_header_mode_t * mode);
+
+
+ sw_error_t
+ fal_port_txhdr_mode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_header_mode_t mode);
+
+
+ sw_error_t
+ fal_port_txhdr_mode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_header_mode_t * mode);
+
+
+ sw_error_t
+ fal_header_type_set(a_uint32_t dev_id, a_bool_t enable, a_uint32_t type);
+
+
+ sw_error_t
+ fal_header_type_get(a_uint32_t dev_id, a_bool_t * enable, a_uint32_t * type);
+
+
+ sw_error_t
+ fal_port_txmac_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_txmac_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_rxmac_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_rxmac_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_txfc_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_txfc_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_rxfc_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_rxfc_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_bp_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_bp_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_link_forcemode_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_link_forcemode_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_link_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * status);
+
+ sw_error_t
+ fal_port_mac_loopback_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_mac_loopback_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_PORTCTRL_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_portvlan.h b/include/fal/fal_portvlan.h
new file mode 100755
index 0000000..f53a023
--- /dev/null
+++ b/include/fal/fal_portvlan.h
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+/**
+ * @defgroup fal_port_vlan FAL_PORT_VLAN
+ * @{
+ */
+#ifndef _FAL_PORT_VLAN_H_
+#define _FAL_PORT_VLAN_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ /**
+ @brief This enum defines 802.1q mode type.
+ */
+ typedef enum {
+ FAL_1Q_DISABLE = 0, /**< 802.1q mode disbale, port based vlan */
+ FAL_1Q_SECURE, /**< secure mode, packets which vid isn't in vlan table or source port isn't in vlan port member will be discarded.*/
+ FAL_1Q_CHECK, /**< check mode, packets which vid isn't in vlan table will be discarded, packets which source port isn't in vlan port member will forward base on vlan port member*/
+ FAL_1Q_FALLBACK, /**< fallback mode, packets which vid isn't in vlan table will forwarded base on port vlan, packet's which source port isn't in vlan port member will forward base on vlan port member.*/
+ FAL_1Q_MODE_BUTT
+ }
+ fal_pt_1qmode_t;
+
+ /**
+ @brief This enum defines receive packets tagged mode.
+ */
+ typedef enum
+ {
+ FAL_INVLAN_ADMIT_ALL = 0, /**< receive all packets include tagged and untagged */
+ FAL_INVLAN_ADMIT_TAGGED, /**< only receive tagged packets*/
+ FAL_INVLAN_ADMIT_UNTAGGED, /**< only receive untagged packets include priority tagged */
+ FAL_INVLAN_MODE_BUTT
+ } fal_pt_invlan_mode_t;
+
+ /**
+ @brief This enum defines vlan propagation mode.
+ */
+ typedef enum
+ {
+ FAL_VLAN_PROPAGATION_DISABLE = 0, /**< vlan propagation disable */
+ FAL_VLAN_PROPAGATION_CLONE, /**< vlan paopagation mode is clone */
+ FAL_VLAN_PROPAGATION_REPLACE, /**< vlan paopagation mode is repalce */
+ FAL_VLAN_PROPAGATION_MODE_BUTT
+ } fal_vlan_propagation_mode_t;
+
+ /**
+ @details Fields description:
+
+ o_vid - original vlan id
+ s_vid - service vid id
+ c_vid - custom vid id
+ bi_dir - entry search direction
+ forward_dir - entry search direction only be forward
+ reverse_dir - entry search direction only be reverse
+ o_vid_is_cvid - o_vid in entry means c_vid not s_vid
+ s_vid_enable - s_vid in entry is valid
+ c_vid_enable - c_vid in entry is valid
+ one_2_one_vlan- the entry used for 1:1 vlan
+ @brief This structure defines the vlan translation entry.
+
+ */
+ typedef struct
+ {
+ a_uint32_t o_vid;
+ a_uint32_t s_vid;
+ a_uint32_t c_vid;
+ a_bool_t bi_dir; /**< lookup can be forward and reverse*/
+ a_bool_t forward_dir; /**< lookup direction only can be from o_vid to s_vid and/or c_vid*/
+ a_bool_t reverse_dir; /**< lookup direction only can be from s_vid and/or c_vid to o_vid*/
+ a_bool_t o_vid_is_cvid;
+ a_bool_t s_vid_enable;
+ a_bool_t c_vid_enable;
+ a_bool_t one_2_one_vlan;
+ } fal_vlan_trans_entry_t;
+
+ /**
+ @brief This enum defines qinq working mode.
+ */
+ typedef enum
+ {
+ FAL_QINQ_CTAG_MODE = 0,
+ FAL_QINQ_STAG_MODE,
+ FAL_QINQ_MODE_BUTT
+ } fal_qinq_mode_t;
+
+ /**
+ @brief This enum defines port role in qinq mode.
+ */
+ typedef enum
+ {
+ FAL_QINQ_EDGE_PORT = 0,
+ FAL_QINQ_CORE_PORT,
+ FAL_QINQ_PORT_ROLE_BUTT
+ } fal_qinq_port_role_t;
+
+
+ sw_error_t
+ fal_port_1qmode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_1qmode_t port_1qmode);
+
+
+
+ sw_error_t
+ fal_port_1qmode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_1qmode_t * pport_1qmode);
+
+
+
+ sw_error_t
+ fal_port_egvlanmode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_1q_egmode_t port_egvlanmode);
+
+
+
+ sw_error_t
+ fal_port_egvlanmode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_1q_egmode_t * pport_egvlanmode);
+
+
+
+ sw_error_t
+ fal_portvlan_member_add(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_t mem_port_id);
+
+
+
+ sw_error_t
+ fal_portvlan_member_del(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_t mem_port_id);
+
+
+
+ sw_error_t
+ fal_portvlan_member_update(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pbmp_t mem_port_map);
+
+
+
+ sw_error_t
+ fal_portvlan_member_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pbmp_t * mem_port_map);
+
+
+
+ sw_error_t
+ fal_port_default_vid_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t vid);
+
+
+
+ sw_error_t
+ fal_port_default_vid_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * vid);
+
+
+
+ sw_error_t
+ fal_port_force_default_vid_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_force_default_vid_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_port_force_portvlan_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_force_portvlan_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_port_nestvlan_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_port_nestvlan_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_nestvlan_tpid_set(a_uint32_t dev_id, a_uint32_t tpid);
+
+
+
+ sw_error_t
+ fal_nestvlan_tpid_get(a_uint32_t dev_id, a_uint32_t * tpid);
+
+
+ sw_error_t
+ fal_port_invlan_mode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_invlan_mode_t mode);
+
+
+ sw_error_t
+ fal_port_invlan_mode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_invlan_mode_t * mode);
+
+
+ sw_error_t
+ fal_port_tls_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_tls_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_pri_propagation_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_pri_propagation_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+ sw_error_t
+ fal_port_default_svid_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t vid);
+
+
+ sw_error_t
+ fal_port_default_svid_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * vid);
+
+
+ sw_error_t
+ fal_port_default_cvid_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t vid);
+
+
+ sw_error_t
+ fal_port_default_cvid_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * vid);
+
+
+ sw_error_t
+ fal_port_vlan_propagation_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_vlan_propagation_mode_t mode);
+
+
+ sw_error_t
+ fal_port_vlan_propagation_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_vlan_propagation_mode_t * mode);
+
+
+ sw_error_t
+ fal_port_vlan_trans_add(a_uint32_t dev_id, fal_port_t port_id, fal_vlan_trans_entry_t *entry);
+
+
+ sw_error_t
+ fal_port_vlan_trans_del(a_uint32_t dev_id, fal_port_t port_id, fal_vlan_trans_entry_t *entry);
+
+
+ sw_error_t
+ fal_port_vlan_trans_get(a_uint32_t dev_id, fal_port_t port_id, fal_vlan_trans_entry_t *entry);
+
+
+ sw_error_t
+ fal_qinq_mode_set(a_uint32_t dev_id, fal_qinq_mode_t mode);
+
+
+ sw_error_t
+ fal_qinq_mode_get(a_uint32_t dev_id, fal_qinq_mode_t * mode);
+
+
+ sw_error_t
+ fal_port_qinq_role_set(a_uint32_t dev_id, fal_port_t port_id, fal_qinq_port_role_t role);
+
+
+ sw_error_t
+ fal_port_qinq_role_get(a_uint32_t dev_id, fal_port_t port_id, fal_qinq_port_role_t * role);
+
+
+ sw_error_t
+ fal_port_vlan_trans_iterate(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * iterator, fal_vlan_trans_entry_t * entry);
+
+
+ sw_error_t
+ fal_port_mac_vlan_xlt_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+ sw_error_t
+ fal_port_mac_vlan_xlt_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+ sw_error_t
+ fal_netisolate_set(a_uint32_t dev_id, a_uint32_t enable);
+
+ sw_error_t
+ fal_netisolate_get(a_uint32_t dev_id, a_uint32_t * enable);
+
+ sw_error_t
+ fal_eg_trans_filter_bypass_en_set(a_uint32_t dev_id, a_uint32_t enable);
+
+ sw_error_t
+ fal_eg_trans_filter_bypass_en_get(a_uint32_t dev_id, a_uint32_t * enable);
+
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _PORT_VLAN_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_qos.h b/include/fal/fal_qos.h
new file mode 100755
index 0000000..f6ea979
--- /dev/null
+++ b/include/fal/fal_qos.h
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_qos FAL_QOS
+ * @{
+ */
+#ifndef _FAL_QOS_H_
+#define _FAL_QOS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ /**
+ @brief This enum defines traffic scheduling mode.
+ */
+ typedef enum {
+ FAL_SCH_SP_MODE = 0, /**< strict priority scheduling mode */
+ FAL_SCH_WRR_MODE, /**< weight round robin scheduling mode*/
+ FAL_SCH_MIX_MODE, /**< sp and wrr mixed scheduling mode */
+ FAL_SCH_MIX_PLUS_MODE, /**< sp and wrr mixed plus scheduling mode */
+ FAL_SCH_MODE_BUTT
+ }
+ fal_sch_mode_t;
+
+ /**
+ @brief This enum defines qos assignment mode.
+ */
+ typedef enum
+ {
+ FAL_QOS_DA_MODE = 0, /**< qos assignment based on destination mac address*/
+ FAL_QOS_UP_MODE, /**< qos assignment based on 802.1p field in vlan tag*/
+ FAL_QOS_DSCP_MODE, /**< qos assignment based on dscp field in ip header */
+ FAL_QOS_PORT_MODE, /**< qos assignment based on port */
+ FAL_QOS_MODE_BUTT
+ } fal_qos_mode_t;
+
+#define FAL_DOT1P_MIN 0
+#define FAL_DOT1P_MAX 7
+
+#define FAL_DSCP_MIN 0
+#define FAL_DSCP_MAX 63
+
+
+ sw_error_t
+ fal_qos_sch_mode_set(a_uint32_t dev_id,
+ fal_sch_mode_t mode, const a_uint32_t weight[]);
+
+
+
+ sw_error_t
+ fal_qos_sch_mode_get(a_uint32_t dev_id,
+ fal_sch_mode_t * mode, a_uint32_t weight[]);
+
+
+
+ sw_error_t
+ fal_qos_queue_tx_buf_status_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+ sw_error_t
+ fal_qos_queue_tx_buf_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_qos_queue_tx_buf_nr_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * number);
+
+
+
+ sw_error_t
+ fal_qos_queue_tx_buf_nr_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * number);
+
+
+
+ sw_error_t
+ fal_qos_port_tx_buf_status_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_qos_port_tx_buf_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+ sw_error_t
+ fal_qos_port_red_en_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+
+ sw_error_t
+ fal_qos_port_red_en_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+
+ sw_error_t
+ fal_qos_port_tx_buf_nr_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * number);
+
+
+
+ sw_error_t
+ fal_qos_port_tx_buf_nr_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * number);
+
+ sw_error_t
+ fal_qos_port_rx_buf_nr_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * number);
+
+
+ sw_error_t
+ fal_qos_port_rx_buf_nr_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * number);
+
+
+ sw_error_t
+ fal_cosmap_up_queue_set(a_uint32_t dev_id, a_uint32_t up,
+ fal_queue_t queue);
+
+
+
+ sw_error_t
+ fal_cosmap_up_queue_get(a_uint32_t dev_id, a_uint32_t up,
+ fal_queue_t * queue);
+
+
+
+ sw_error_t
+ fal_cosmap_dscp_queue_set(a_uint32_t dev_id, a_uint32_t dscp,
+ fal_queue_t queue);
+
+
+
+ sw_error_t
+ fal_cosmap_dscp_queue_get(a_uint32_t dev_id, a_uint32_t dscp,
+ fal_queue_t * queue);
+
+
+
+ sw_error_t
+ fal_qos_port_mode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_qos_mode_t mode, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_qos_port_mode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_qos_mode_t mode, a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_qos_port_mode_pri_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_qos_mode_t mode, a_uint32_t pri);
+
+
+
+ sw_error_t
+ fal_qos_port_mode_pri_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_qos_mode_t mode, a_uint32_t * pri);
+
+
+
+ sw_error_t
+ fal_qos_port_default_up_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t up);
+
+
+
+ sw_error_t
+ fal_qos_port_default_up_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * up);
+
+
+ sw_error_t
+ fal_qos_port_sch_mode_set(a_uint32_t dev_id, a_uint32_t port_id,
+ fal_sch_mode_t mode, const a_uint32_t weight[]);
+
+
+ sw_error_t
+ fal_qos_port_sch_mode_get(a_uint32_t dev_id, a_uint32_t port_id,
+ fal_sch_mode_t * mode, a_uint32_t weight[]);
+
+
+ sw_error_t
+ fal_qos_port_default_spri_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t spri);
+
+
+ sw_error_t
+ fal_qos_port_default_spri_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * spri);
+
+
+ sw_error_t
+ fal_qos_port_default_cpri_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t cpri);
+
+
+ sw_error_t
+ fal_qos_port_default_cpri_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * cpri);
+
+ sw_error_t
+ fal_qos_port_force_spri_status_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+ sw_error_t
+ fal_qos_port_force_spri_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t* enable);
+
+ sw_error_t
+ fal_qos_port_force_cpri_status_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+ sw_error_t
+ fal_qos_port_force_cpri_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t* enable);
+
+ sw_error_t
+ fal_qos_queue_remark_table_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t tbl_id, a_bool_t enable);
+
+
+ sw_error_t
+ fal_qos_queue_remark_table_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * tbl_id, a_bool_t * enable);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _PORT_QOS_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_rate.h b/include/fal/fal_rate.h
new file mode 100755
index 0000000..4586cc7
--- /dev/null
+++ b/include/fal/fal_rate.h
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_rate FAL_RATE
+ * @{
+ */
+#ifndef _FAL_RATE_H_
+#define _FAL_RATE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ /**
+ @brief This enum defines storm type
+ */
+ typedef enum {
+ FAL_UNICAST_STORM = 0, /**< storm caused by unknown unicast packets */
+ FAL_MULTICAST_STORM, /**< storm caused by unknown multicast packets */
+ FAL_BROADCAST_STORM, /**< storm caused by broadcast packets */
+ FAL_STORM_TYPE_BUTT
+ }
+ fal_storm_type_t;
+
+
+
+ sw_error_t
+ fal_rate_queue_egrl_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * speed,
+ a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_rate_queue_egrl_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * speed,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_rate_port_egrl_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * speed, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_rate_port_egrl_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * speed, a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_rate_port_inrl_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * speed, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_rate_port_inrl_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * speed, a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_storm_ctrl_frame_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_storm_type_t frame_type, a_bool_t enable);
+
+
+
+ sw_error_t
+ fal_storm_ctrl_frame_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_storm_type_t frame_type,
+ a_bool_t * enable);
+
+
+
+ sw_error_t
+ fal_storm_ctrl_rate_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * rate);
+
+
+
+ sw_error_t
+ fal_storm_ctrl_rate_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * rate);
+
+
+ typedef enum
+ {
+ FAL_RATE_MI_100US = 0,
+ FAL_RATE_MI_1MS,
+ FAL_RATE_MI_10MS,
+ FAL_RATE_MI_100MS,
+ } fal_rate_mt_t;
+
+
+ typedef struct
+ {
+ fal_traffic_unit_t meter_unit;
+ a_uint32_t cir;
+ a_uint32_t eir;
+ a_uint32_t cbs;
+ a_uint32_t ebs;
+ } fal_egress_shaper_t;
+
+
+#define FAL_INGRESS_POLICING_TCP_CTRL 0x2
+#define FAL_INGRESS_POLICING_MANAGEMENT 0x4
+#define FAL_INGRESS_POLICING_BROAD 0x8
+#define FAL_INGRESS_POLICING_UNK_UNI 0x10
+#define FAL_INGRESS_POLICING_UNK_MUL 0x20
+#define FAL_INGRESS_POLICING_UNI 0x40
+#define FAL_INGRESS_POLICING_MUL 0x80
+
+
+ typedef struct
+ {
+ a_bool_t c_enable;
+ a_bool_t e_enable;
+ a_bool_t combine_mode;
+ fal_traffic_unit_t meter_unit;
+ a_bool_t color_mode;
+ a_bool_t couple_flag;
+ a_bool_t deficit_en;
+ a_uint32_t cir;
+ a_uint32_t eir;
+ a_uint32_t cbs;
+ a_uint32_t ebs;
+ a_uint32_t c_rate_flag;
+ a_uint32_t e_rate_flag;
+ fal_rate_mt_t c_meter_interval;
+ fal_rate_mt_t e_meter_interval;
+ } fal_port_policer_t;
+
+
+ typedef struct
+ {
+ a_bool_t counter_mode;
+ fal_traffic_unit_t meter_unit;
+ fal_rate_mt_t meter_interval;
+ a_bool_t color_mode;
+ a_bool_t couple_flag;
+ a_bool_t deficit_en;
+ a_uint32_t cir;
+ a_uint32_t eir;
+ a_uint32_t cbs;
+ a_uint32_t ebs;
+ a_uint32_t counter_high;
+ a_uint32_t counter_low;
+ } fal_acl_policer_t;
+
+
+ sw_error_t
+ fal_rate_port_policer_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_policer_t * policer);
+
+
+ sw_error_t
+ fal_rate_port_policer_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_policer_t * policer);
+
+
+ sw_error_t
+ fal_rate_port_shaper_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable, fal_egress_shaper_t * shaper);
+
+
+ sw_error_t
+ fal_rate_port_shaper_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable, fal_egress_shaper_t * shaper);
+
+
+ sw_error_t
+ fal_rate_queue_shaper_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_bool_t enable,
+ fal_egress_shaper_t * shaper);
+
+
+ sw_error_t
+ fal_rate_queue_shaper_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_bool_t * enable,
+ fal_egress_shaper_t * shaper);
+
+
+ sw_error_t
+ fal_rate_acl_policer_set(a_uint32_t dev_id, a_uint32_t policer_id,
+ fal_acl_policer_t * policer);
+
+
+ sw_error_t
+ fal_rate_acl_policer_get(a_uint32_t dev_id, a_uint32_t policer_id,
+ fal_acl_policer_t * policer);
+
+ sw_error_t
+ fal_rate_port_add_rate_byte_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t number);
+
+ sw_error_t
+ fal_rate_port_add_rate_byte_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t *number);
+
+ sw_error_t
+ fal_rate_port_gol_flow_en_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+ sw_error_t
+ fal_rate_port_gol_flow_en_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t* enable);
+
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_RATE_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_reg_access.h b/include/fal/fal_reg_access.h
new file mode 100755
index 0000000..22c4fc4
--- /dev/null
+++ b/include/fal/fal_reg_access.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_reg_access FAL_REG_ACCESS
+ * @{
+ */
+#ifndef _FAL_REG_ACCESS_H_
+#define _FAL_REG_ACCESS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ sw_error_t
+ fal_phy_get(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint32_t reg, a_uint16_t * value);
+
+ sw_error_t
+ fal_phy_set(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint32_t reg, a_uint16_t value);
+
+ sw_error_t
+ fal_reg_get(a_uint32_t dev_id, a_uint32_t reg_addr, a_uint8_t value[],
+ a_uint32_t value_len);
+
+ sw_error_t
+ fal_reg_set(a_uint32_t dev_id, a_uint32_t reg_addr, a_uint8_t value[],
+ a_uint32_t value_len);
+
+ sw_error_t
+ fal_reg_field_get(a_uint32_t dev_id, a_uint32_t reg_addr,
+ a_uint32_t bit_offset, a_uint32_t field_len,
+ a_uint8_t value[], a_uint32_t value_len);
+
+ sw_error_t
+ fal_reg_field_set(a_uint32_t dev_id, a_uint32_t reg_addr,
+ a_uint32_t bit_offset, a_uint32_t field_len,
+ const a_uint8_t value[], a_uint32_t value_len);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_REG_ACCESS_H_ */
+
+/**
+ * @}
+ */
+
diff --git a/include/fal/fal_sec.h b/include/fal/fal_sec.h
new file mode 100755
index 0000000..aec056e
--- /dev/null
+++ b/include/fal/fal_sec.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_sec FAL_SEC
+ * @{
+ */
+#ifndef _FAL_SEC_H_
+#define _FAL_SEC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+
+ typedef enum {
+ /* define MAC layer related normalization items */
+ FAL_NORM_MAC_RESV_VID_CMD = 0,
+ FAL_NORM_MAC_INVALID_SRC_ADDR_CMD,
+
+ /* define IP layer related normalization items */
+ FAL_NORM_IP_INVALID_VER_CMD,
+ FAL_NROM_IP_SAME_ADDR_CMD,
+ FAL_NROM_IP_TTL_CHANGE_STATUS,
+ FAL_NROM_IP_TTL_VALUE,
+
+ /* define IP4 related normalization items */
+ FAL_NROM_IP4_INVALID_HL_CMD,
+ FAL_NROM_IP4_HDR_OPTIONS_CMD,
+ FAL_NROM_IP4_INVALID_DF_CMD,
+ FAL_NROM_IP4_FRAG_OFFSET_MIN_LEN_CMD,
+ FAL_NROM_IP4_FRAG_OFFSET_MAX_LEN_CMD,
+ FAL_NROM_IP4_INVALID_FRAG_OFFSET_CMD,
+ FAL_NROM_IP4_INVALID_SIP_CMD,
+ FAL_NROM_IP4_INVALID_DIP_CMD,
+ FAL_NROM_IP4_INVALID_CHKSUM_CMD,
+ FAL_NROM_IP4_INVALID_PL_CMD,
+ FAL_NROM_IP4_DF_CLEAR_STATUS,
+ FAL_NROM_IP4_IPID_RANDOM_STATUS,
+ FAL_NROM_IP4_FRAG_OFFSET_MIN_SIZE,
+
+ /* define IP4 related normalization items */
+ FAL_NROM_IP6_INVALID_PL_CMD,
+ FAL_NROM_IP6_INVALID_SIP_CMD,
+ FAL_NROM_IP6_INVALID_DIP_CMD,
+
+ /* define TCP related normalization items */
+ FAL_NROM_TCP_BLAT_CMD,
+ FAL_NROM_TCP_INVALID_HL_CMD,
+ FAL_NROM_TCP_INVALID_SYN_CMD,
+ FAL_NROM_TCP_SU_BLOCK_CMD,
+ FAL_NROM_TCP_SP_BLOCK_CMD,
+ FAL_NROM_TCP_SAP_BLOCK_CMD,
+ FAL_NROM_TCP_XMAS_SCAN_CMD,
+ FAL_NROM_TCP_NULL_SCAN_CMD,
+ FAL_NROM_TCP_SR_BLOCK_CMD,
+ FAL_NROM_TCP_SF_BLOCK_CMD,
+ FAL_NROM_TCP_SAR_BLOCK_CMD,
+ FAL_NROM_TCP_RST_SCAN_CMD,
+ FAL_NROM_TCP_SYN_WITH_DATA_CMD,
+ FAL_NROM_TCP_RST_WITH_DATA_CMD,
+ FAL_NROM_TCP_FA_BLOCK_CMD,
+ FAL_NROM_TCP_PA_BLOCK_CMD,
+ FAL_NROM_TCP_UA_BLOCK_CMD,
+ FAL_NROM_TCP_INVALID_CHKSUM_CMD,
+ FAL_NROM_TCP_INVALID_URGPTR_CMD,
+ FAL_NROM_TCP_INVALID_OPTIONS_CMD,
+ FAL_NROM_TCP_MIN_HDR_SIZE,
+
+ /* define UDP related normalization items */
+ FAL_NROM_UDP_BLAT_CMD,
+ FAL_NROM_UDP_INVALID_LEN_CMD,
+ FAL_NROM_UDP_INVALID_CHKSUM_CMD,
+
+ /* define ICMP related normalization items */
+ FAL_NROM_ICMP4_PING_PL_EXCEED_CMD,
+ FAL_NROM_ICMP6_PING_PL_EXCEED_CMD,
+ FAL_NROM_ICMP4_PING_FRAG_CMD,
+ FAL_NROM_ICMP6_PING_FRAG_CMD,
+ FAL_NROM_ICMP4_PING_MAX_PL_VALUE,
+ FAL_NROM_ICMP6_PING_MAX_PL_VALUE,
+ }
+ fal_norm_item_t;
+
+ sw_error_t
+ fal_sec_norm_item_set(a_uint32_t dev_id, fal_norm_item_t item, void *value);
+
+ sw_error_t
+ fal_sec_norm_item_get(a_uint32_t dev_id, fal_norm_item_t item, void *value);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_SEC_H_ */
+
+/**
+ * @}
+ */
+
diff --git a/include/fal/fal_stp.h b/include/fal/fal_stp.h
new file mode 100755
index 0000000..981f9e1
--- /dev/null
+++ b/include/fal/fal_stp.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_stp FAL_STP
+ * @{
+ */
+#ifndef _FAL_STP_H_
+#define _FAL_STP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+#define FAL_SINGLE_STP_ID 0
+
+ /**
+ @brief This enum defines port state for spanning tree.
+ */
+ typedef enum {
+ FAL_STP_DISABLED = 0, /**< disable state*/
+ FAL_STP_BLOKING, /**< blocking state*/
+ FAL_STP_LISTENING, /**< listening state*/
+ FAL_STP_LEARNING, /**< learning state*/
+ FAL_STP_FARWARDING, /**< forwarding state*/
+ FAL_STP_STATE_BUTT
+ }
+ fal_stp_state_t;
+
+
+
+ sw_error_t
+ fal_stp_port_state_set(a_uint32_t dev_id, a_uint32_t st_id,
+ fal_port_t port_id, fal_stp_state_t state);
+
+
+
+ sw_error_t
+ fal_stp_port_state_get(a_uint32_t dev_id, a_uint32_t st_id,
+ fal_port_t port_id, fal_stp_state_t * state);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_STP_H_ */
+
+/**
+ * @}
+ */
diff --git a/include/fal/fal_trunk.h b/include/fal/fal_trunk.h
new file mode 100755
index 0000000..99aacc8
--- /dev/null
+++ b/include/fal/fal_trunk.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_trunk FAL_TRUNK
+ * @{
+ */
+#ifndef _FAL_TRUNK_H_
+#define _FAL_TRUNK_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+
+#define FAL_TRUNK_HASH_KEY_DA 0x1
+#define FAL_TRUNK_HASH_KEY_SA 0x2
+#define FAL_TRUNK_HASH_KEY_DIP 0x4
+#define FAL_TRUNK_HASH_KEY_SIP 0x8
+
+
+ sw_error_t
+ fal_trunk_group_set(a_uint32_t dev_id, a_uint32_t trunk_id,
+ a_bool_t enable, fal_pbmp_t member);
+
+
+ sw_error_t
+ fal_trunk_group_get(a_uint32_t dev_id, a_uint32_t trunk_id,
+ a_bool_t * enable, fal_pbmp_t * member);
+
+
+ sw_error_t
+ fal_trunk_hash_mode_set(a_uint32_t dev_id, a_uint32_t hash_mode);
+
+
+ sw_error_t
+ fal_trunk_hash_mode_get(a_uint32_t dev_id, a_uint32_t * hash_mode);
+
+
+ sw_error_t
+ fal_trunk_manipulate_sa_set(a_uint32_t dev_id, fal_mac_addr_t * addr);
+
+
+ sw_error_t
+ fal_trunk_manipulate_sa_get(a_uint32_t dev_id, fal_mac_addr_t * addr);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_TRUNK_H_ */
+
+/**
+ * @}
+ */
diff --git a/include/fal/fal_type.h b/include/fal/fal_type.h
new file mode 100755
index 0000000..e4d9939
--- /dev/null
+++ b/include/fal/fal_type.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_type FAL_TYPE
+ * @{
+ */
+#ifndef _FAL_TYPE_H_
+#define _FAL_TYPE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+ typedef a_uint32_t fal_port_t;
+
+#if (SW_MAX_NR_PORT <= 32)
+ typedef a_uint32_t fal_pbmp_t;
+#else
+ typedef a_uint64_t fal_pbmp_t;
+#endif
+
+ typedef struct
+ {
+ a_uint8_t uc[6];
+ } fal_mac_addr_t;
+
+ typedef a_uint32_t fal_ip4_addr_t;
+
+ typedef struct
+ {
+ a_uint32_t ul[4];
+ } fal_ip6_addr_t;
+
+ /**
+ @brief This enum defines several forwarding command type.
+ * Field description:
+ FAL_MAC_FRWRD - packets are normally forwarded
+ FAL_MAC_DROP - packets are dropped
+ FAL_MAC_CPY_TO_CPU - packets are copyed to cpu
+ FAL_MAC_RDT_TO_CPU - packets are redirected to cpu
+ */
+ typedef enum
+ {
+ FAL_MAC_FRWRD = 0, /**< packets are normally forwarded */
+ FAL_MAC_DROP, /**< packets are dropped */
+ FAL_MAC_CPY_TO_CPU, /**< packets are copyed to cpu */
+ FAL_MAC_RDT_TO_CPU /**< packets are redirected to cpu */
+ } fal_fwd_cmd_t;
+
+ typedef enum
+ {
+ FAL_BYTE_BASED = 0,
+ FAL_FRAME_BASED,
+ FAL_RATE_MODE_BUTT
+ } fal_traffic_unit_t;
+
+ typedef a_uint32_t fal_queue_t;
+
+#define FAL_SVL_FID 0xffff
+
+
+ /**
+ @brief This enum defines packets transmitted out vlan tagged mode.
+ */
+ typedef enum
+ {
+ FAL_EG_UNMODIFIED = 0, /**< egress transmit packets unmodified */
+ FAL_EG_UNTAGGED, /**< egress transmit packets without vlan tag*/
+ FAL_EG_TAGGED, /**< egress transmit packets with vlan tag */
+ FAL_EG_HYBRID, /**< egress transmit packets in hybrid tag mode */
+ FAL_EG_UNTOUCHED,
+ FAL_EG_MODE_BUTT
+ } fal_pt_1q_egmode_t;
+
+#define FAL_NEXT_ENTRY_FIRST_ID 0xffffffff
+
+ typedef struct
+ {
+ a_uint32_t counter_id;
+ a_uint32_t ingress_packet;
+ a_uint32_t ingress_byte;
+ a_uint32_t egress_packet;
+ a_uint32_t egress_byte;
+ } fal_counter_entry_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_TYPE_H_ */
+/**
+ * @}
+ */
diff --git a/include/fal/fal_uk_if.h b/include/fal/fal_uk_if.h
new file mode 100755
index 0000000..95cc60d
--- /dev/null
+++ b/include/fal/fal_uk_if.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _FAL_UK_IF_H_
+#define _FAL_UK_IF_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+#include "init/ssdk_init.h"
+
+ sw_error_t
+ sw_uk_exec(a_uint32_t api_id, ...);
+
+ sw_error_t
+ ssdk_init(a_uint32_t dev_id, ssdk_init_cfg * cfg);
+
+ sw_error_t
+ ssdk_cleanup(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _FAL_UK_IF_H_ */
+
+
diff --git a/include/fal/fal_vlan.h b/include/fal/fal_vlan.h
new file mode 100755
index 0000000..a1397a5
--- /dev/null
+++ b/include/fal/fal_vlan.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/**
+ * @defgroup fal_vlan FAL_VLAN
+ * @{
+ */
+#ifndef _FAL_VLAN_H
+#define _FAL_VLAN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+#include "fal/fal_type.h"
+
+ /**
+ @brief This structure defines vlan entry.
+ */
+ typedef struct
+ {
+ a_uint16_t vid; /**< vlan entry id */
+ a_uint16_t fid; /**< filter data base id*/
+ fal_pbmp_t mem_ports; /**< member port bit map */
+ fal_pbmp_t tagged_ports; /**< bit map of tagged infomation for member port*/
+ fal_pbmp_t untagged_ports; /**< bit map of untagged infomation for member port*/
+ fal_pbmp_t unmodify_ports;/**< bit map of unmodified infomation for member port*/
+ fal_pbmp_t u_ports;
+ a_bool_t learn_dis; /**< disable address learning*/
+ a_bool_t vid_pri_en; /**< enable 802.1p*/
+ a_uint8_t vid_pri; /**< vlaue of 802.1p when enable vid_pri_en*/
+ } fal_vlan_t;
+
+
+ sw_error_t
+ fal_vlan_entry_append(a_uint32_t dev_id, fal_vlan_t * vlan_entry);
+
+
+
+ sw_error_t
+ fal_vlan_create(a_uint32_t dev_id, a_uint32_t vlan_id);
+
+
+
+ sw_error_t
+ fal_vlan_next(a_uint32_t dev_id, a_uint32_t vlan_id, fal_vlan_t * p_vlan);
+
+
+
+ sw_error_t
+ fal_vlan_find(a_uint32_t dev_id, a_uint32_t vlan_id, fal_vlan_t * p_vlan);
+
+
+
+ sw_error_t
+ fal_vlan_member_update(a_uint32_t dev_id, a_uint32_t vlan_id,
+ fal_pbmp_t member, fal_pbmp_t u_member);
+
+
+
+ sw_error_t
+ fal_vlan_delete(a_uint32_t dev_id, a_uint32_t vlan_id);
+
+
+
+ sw_error_t
+ fal_vlan_reset(a_uint32_t dev_id);
+
+
+ sw_error_t
+ fal_vlan_flush(a_uint32_t dev_id);
+
+
+ sw_error_t
+ fal_vlan_init(a_uint32_t dev_id);
+
+
+ sw_error_t
+ fal_vlan_cleanup(void);
+
+
+ sw_error_t
+ fal_vlan_fid_set(a_uint32_t dev_id, a_uint32_t vlan_id, a_uint32_t fid);
+
+
+ sw_error_t
+ fal_vlan_fid_get(a_uint32_t dev_id, a_uint32_t vlan_id, a_uint32_t * fid);
+
+
+ sw_error_t
+ fal_vlan_member_add(a_uint32_t dev_id, a_uint32_t vlan_id,
+ fal_port_t port_id, fal_pt_1q_egmode_t port_info);
+
+
+ sw_error_t
+ fal_vlan_member_del(a_uint32_t dev_id, a_uint32_t vlan_id, fal_port_t port_id);
+
+
+ sw_error_t
+ fal_vlan_learning_state_set(a_uint32_t dev_id, a_uint32_t vlan_id,
+ a_bool_t enable);
+
+
+ sw_error_t
+ fal_vlan_learning_state_get(a_uint32_t dev_id, a_uint32_t vlan_id,
+ a_bool_t * enable);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _FAL_VLAN_H */
+/**
+ * @}
+ */
diff --git a/include/init/ssdk_init.h b/include/init/ssdk_init.h
new file mode 100755
index 0000000..a62381a
--- /dev/null
+++ b/include/init/ssdk_init.h
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _SSDK_INIT_H_
+#define _SSDK_INIT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+
+ typedef enum {
+ HSL_MDIO = 1,
+ HSL_HEADER,
+ }
+ hsl_access_mode;
+
+ typedef enum
+ {
+ HSL_NO_CPU = 0,
+ HSL_CPU_1,
+ HSL_CPU_2,
+ HSL_CPU_1_PLUS,
+ } hsl_init_mode;
+
+ typedef sw_error_t
+ (*mdio_reg_set) (a_uint32_t dev_id, a_uint32_t phy_addr, a_uint32_t reg,
+ a_uint16_t data);
+
+ typedef sw_error_t
+ (*mdio_reg_get) (a_uint32_t dev_id, a_uint32_t phy_addr, a_uint32_t reg,
+ a_uint16_t * data);
+
+ typedef sw_error_t
+ (*hdr_reg_set) (a_uint32_t dev_id, a_uint32_t reg_addr, a_uint8_t *reg_data, a_uint32_t len);
+
+ typedef sw_error_t
+ (*hdr_reg_get) (a_uint32_t dev_id, a_uint32_t reg_addr, a_uint8_t *reg_data, a_uint32_t len);
+
+ typedef struct
+ {
+ mdio_reg_set mdio_set;
+ mdio_reg_get mdio_get;
+ hdr_reg_set header_reg_set;
+ hdr_reg_get header_reg_get;
+ } hsl_reg_func;
+
+ typedef struct
+ {
+ a_bool_t mac0_rgmii;
+ a_bool_t mac5_rgmii;
+ a_bool_t rx_delay_s0;
+ a_bool_t rx_delay_s1;
+ a_bool_t tx_delay_s0;
+ a_bool_t tx_delay_s1;
+ a_bool_t rgmii_rxclk_delay;
+ a_bool_t rgmii_txclk_delay;
+ a_bool_t phy4_rx_delay;
+ a_bool_t phy4_tx_delay;
+ } garuda_init_spec_cfg;
+
+ typedef enum
+ {
+ CHIP_UNSPECIFIED = 0,
+ CHIP_ATHENA,
+ CHIP_GARUDA,
+ CHIP_SHIVA,
+ CHIP_HORUS,
+ CHIP_ISIS,
+ CHIP_ISISC,
+ } ssdk_chip_type;
+
+ typedef struct
+ {
+ hsl_init_mode cpu_mode;
+ hsl_access_mode reg_mode;
+ hsl_reg_func reg_func;
+
+ ssdk_chip_type chip_type;
+
+ /* os specific parameter */
+ /* when uk_if based on netlink, it's netlink protocol type*/
+ /* when uk_if based on ioctl, it's minor device number, major number
+ is always 10(misc device) */
+ a_uint32_t nl_prot;
+
+ /* chip specific parameter */
+ void * chip_spec_cfg;
+ } ssdk_init_cfg;
+
+#if defined ATHENA
+#define def_init_cfg {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_2};
+#elif defined GARUDA
+
+#define def_init_cfg_cpu2 {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_2,};
+
+#define def_init_spec_cfg_cpu2 {.mac0_rgmii = A_TRUE, .mac5_rgmii = A_TRUE, \
+ .rx_delay_s0 = A_FALSE, .rx_delay_s1 = A_FALSE, \
+ .tx_delay_s0 = A_TRUE, .tx_delay_s1 = A_FALSE,\
+ .rgmii_rxclk_delay = A_TRUE, .rgmii_txclk_delay = A_TRUE,\
+ .phy4_rx_delay = A_TRUE, .phy4_tx_delay = A_TRUE,}
+
+#define def_init_cfg_cpu1 {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_1,};
+
+#define def_init_spec_cfg_cpu1 {.mac0_rgmii = A_TRUE, .mac5_rgmii = A_FALSE, \
+ .rx_delay_s0 = A_FALSE, .rx_delay_s1 = A_FALSE, \
+ .tx_delay_s0 = A_TRUE, .tx_delay_s1 = A_FALSE,\
+ .rgmii_rxclk_delay = A_TRUE, .rgmii_txclk_delay = A_TRUE, \
+ .phy4_rx_delay = A_TRUE, .phy4_tx_delay = A_TRUE,}
+
+#define def_init_cfg_cpu1plus {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_1_PLUS,};
+
+#define def_init_spec_cfg_cpu1plus {.mac0_rgmii = A_TRUE, .mac5_rgmii = A_FALSE, \
+ .rx_delay_s0 = A_FALSE, .rx_delay_s1 = A_FALSE, \
+ .tx_delay_s0 = A_FALSE, .tx_delay_s1 = A_FALSE,\
+ .rgmii_rxclk_delay = A_TRUE, .rgmii_txclk_delay = A_TRUE, \
+ .phy4_rx_delay = A_TRUE, .phy4_tx_delay = A_TRUE,}
+
+#define def_init_cfg_nocpu {.reg_mode = HSL_MDIO, .cpu_mode = HSL_NO_CPU,};
+
+#define def_init_spec_cfg_nocpu { .mac0_rgmii = A_FALSE, .mac5_rgmii = A_FALSE, \
+ .rx_delay_s0 = A_FALSE, .rx_delay_s1 = A_FALSE, \
+ .tx_delay_s0 = A_FALSE, .tx_delay_s1 = A_FALSE,\
+ .rgmii_rxclk_delay = A_TRUE, .rgmii_txclk_delay = A_TRUE, \
+ .phy4_rx_delay = A_TRUE, .phy4_tx_delay = A_TRUE,}
+
+#define def_init_cfg_cpu1_gmii {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_1,};
+
+#define def_init_spec_cfg_cpu1_gmii {.mac0_rgmii = A_FALSE, .mac5_rgmii = A_FALSE, \
+ .rx_delay_s0 = A_FALSE, .rx_delay_s1 = A_FALSE, \
+ .tx_delay_s0 = A_TRUE, .tx_delay_s1 = A_FALSE,\
+ .rgmii_rxclk_delay = A_TRUE, .rgmii_txclk_delay = A_TRUE, \
+ .phy4_rx_delay = A_TRUE, .phy4_tx_delay = A_TRUE,}
+
+#define def_init_cfg def_init_cfg_cpu2
+#define def_init_spec_cfg def_init_spec_cfg_cpu2
+
+#elif defined SHIVA
+#define def_init_cfg {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_2};
+#elif defined HORUS
+#define def_init_cfg {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_2};
+#elif defined ISIS
+#define def_init_cfg {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_2};
+#elif defined ISISC
+#define def_init_cfg {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_2};
+#endif
+
+ typedef struct
+ {
+ a_bool_t in_acl;
+ a_bool_t in_fdb;
+ a_bool_t in_igmp;
+ a_bool_t in_leaky;
+ a_bool_t in_led;
+ a_bool_t in_mib;
+ a_bool_t in_mirror;
+ a_bool_t in_misc;
+ a_bool_t in_portcontrol;
+ a_bool_t in_portvlan;
+ a_bool_t in_qos;
+ a_bool_t in_rate;
+ a_bool_t in_stp;
+ a_bool_t in_vlan;
+ a_bool_t in_reduced_acl;
+ a_bool_t in_ip;
+ a_bool_t in_nat;
+ a_bool_t in_cosmap;
+ a_bool_t in_sec;
+ a_bool_t in_trunk;
+ a_bool_t in_nathelper;
+ a_bool_t in_interfacectrl;
+ } ssdk_features;
+
+#define CFG_STR_SIZE 20
+ typedef struct
+ {
+ a_uint8_t build_ver[CFG_STR_SIZE];
+ a_uint8_t build_date[CFG_STR_SIZE];
+
+ a_uint8_t chip_type[CFG_STR_SIZE]; //GARUDA
+ a_uint8_t cpu_type[CFG_STR_SIZE]; //mips
+ a_uint8_t os_info[CFG_STR_SIZE]; //OS=linux OS_VER=2_6
+
+ a_bool_t fal_mod;
+ a_bool_t kernel_mode;
+ a_bool_t uk_if;
+
+ ssdk_features features;
+ ssdk_init_cfg init_cfg;
+ } ssdk_cfg_t;
+
+ sw_error_t
+ ssdk_init(a_uint32_t dev_id, ssdk_init_cfg *cfg);
+
+ sw_error_t
+ ssdk_reduced_init(a_uint32_t dev_id, hsl_init_mode cpu_mode,
+ hsl_access_mode reg_mode);
+
+ sw_error_t
+ ssdk_hsl_access_mode_set(a_uint32_t dev_id, hsl_access_mode reg_mode);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _SSDK_INIT_H */
diff --git a/include/init/ssdk_plat.h b/include/init/ssdk_plat.h
new file mode 100755
index 0000000..caaefc0
--- /dev/null
+++ b/include/init/ssdk_plat.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef __SSDK_PLAT_H
+#define __SSDK_PLAT_H
+
+#ifndef BIT
+#define BIT(_n) (1UL << (_n))
+#endif
+
+
+#ifndef BITS
+#define BITS(_s, _n) (((1UL << (_n)) - 1) << _s)
+#endif
+
+/* Atheros specific MII registers */
+#define QCA_MII_MMD_ADDR 0x0d
+#define QCA_MII_MMD_DATA 0x0e
+#define QCA_MII_DBG_ADDR 0x1d
+#define QCA_MII_DBG_DATA 0x1e
+
+#define AR8327_REG_CTRL 0x0000
+#define AR8327_CTRL_REVISION BITS(0, 8)
+#define AR8327_CTRL_REVISION_S 0
+#define AR8327_CTRL_VERSION BITS(8, 8)
+#define AR8327_CTRL_VERSION_S 8
+#define AR8327_CTRL_RESET BIT(31)
+
+#define AR8327_REG_LED_CTRL_0 0x50
+#define AR8327_REG_LED_CTRL_1 0x54
+#define AR8327_REG_LED_CTRL_2 0x58
+#define AR8327_REG_LED_CTRL_3 0x5c
+
+#define AR8327_REG_PORT_STATUS(_i) (0x07c + (_i) * 4)
+
+#define AR8327_PORT_STATUS_SPEED BITS(0,2)
+#define AR8327_PORT_STATUS_SPEED_S 0
+#define AR8327_PORT_STATUS_TXMAC BIT(2)
+#define AR8327_PORT_STATUS_RXMAC BIT(3)
+#define AR8327_PORT_STATUS_TXFLOW BIT(4)
+#define AR8327_PORT_STATUS_RXFLOW BIT(5)
+#define AR8327_PORT_STATUS_DUPLEX BIT(6)
+#define AR8327_PORT_STATUS_LINK_UP BIT(8)
+#define AR8327_PORT_STATUS_LINK_AUTO BIT(9)
+#define AR8327_PORT_STATUS_LINK_PAUSE BIT(10)
+
+#define AR8327_REG_PAD0_CTRL 0x4
+#define AR8327_REG_PAD5_CTRL 0x8
+#define AR8327_REG_PAD6_CTRL 0xc
+#define AR8327_PAD_CTRL_MAC_MII_RXCLK_SEL BIT(0)
+#define AR8327_PAD_CTRL_MAC_MII_TXCLK_SEL BIT(1)
+#define AR8327_PAD_CTRL_MAC_MII_EN BIT(2)
+#define AR8327_PAD_CTRL_MAC_GMII_RXCLK_SEL BIT(4)
+#define AR8327_PAD_CTRL_MAC_GMII_TXCLK_SEL BIT(5)
+#define AR8327_PAD_CTRL_MAC_GMII_EN BIT(6)
+#define AR8327_PAD_CTRL_SGMII_EN BIT(7)
+#define AR8327_PAD_CTRL_PHY_MII_RXCLK_SEL BIT(8)
+#define AR8327_PAD_CTRL_PHY_MII_TXCLK_SEL BIT(9)
+#define AR8327_PAD_CTRL_PHY_MII_EN BIT(10)
+#define AR8327_PAD_CTRL_PHY_GMII_PIPE_RXCLK_SEL BIT(11)
+#define AR8327_PAD_CTRL_PHY_GMII_RXCLK_SEL BIT(12)
+#define AR8327_PAD_CTRL_PHY_GMII_TXCLK_SEL BIT(13)
+#define AR8327_PAD_CTRL_PHY_GMII_EN BIT(14)
+#define AR8327_PAD_CTRL_PHYX_GMII_EN BIT(16)
+#define AR8327_PAD_CTRL_PHYX_RGMII_EN BIT(17)
+#define AR8327_PAD_CTRL_PHYX_MII_EN BIT(18)
+#define AR8327_PAD_CTRL_RGMII_RXCLK_DELAY_SEL BITS(20, 2)
+#define AR8327_PAD_CTRL_RGMII_RXCLK_DELAY_SEL_S 20
+#define AR8327_PAD_CTRL_RGMII_TXCLK_DELAY_SEL BITS(22, 2)
+#define AR8327_PAD_CTRL_RGMII_TXCLK_DELAY_SEL_S 22
+#define AR8327_PAD_CTRL_RGMII_RXCLK_DELAY_EN BIT(24)
+#define AR8327_PAD_CTRL_RGMII_TXCLK_DELAY_EN BIT(25)
+#define AR8327_PAD_CTRL_RGMII_EN BIT(26)
+
+#define AR8327_REG_POS 0x10
+#define AR8327_POS_POWER_ON_SEL BIT(31)
+#define AR8327_POS_LED_OPEN_EN BIT(24)
+#define AR8327_POS_SERDES_AEN BIT(7)
+
+#define AR8327_REG_PAD_SGMII_CTRL 0xe0
+#define AR8327_PAD_SGMII_CTRL_MODE_CTRL BITS(22, 2)
+#define AR8327_PAD_SGMII_CTRL_MODE_CTRL_S 22
+#define AR8327_PAD_SGMII_CTRL_EN_SD BIT(4)
+#define AR8327_PAD_SGMII_CTRL_EN_TX BIT(3)
+#define AR8327_PAD_SGMII_CTRL_EN_RX BIT(2)
+#define AR8327_PAD_SGMII_CTRL_EN_PLL BIT(1)
+#define AR8327_PAD_SGMII_CTRL_EN_LCKDT BIT(0)
+
+#define AR8327_REG_PAD_MAC_PWR_SEL 0x0e4
+#define AR8327_PAD_MAC_PWR_RGMII0_1_8V BIT(19)
+#define AR8327_PAD_MAC_PWR_RGMII1_1_8V BIT(18)
+
+#define AR8327_NUM_PHYS 5
+#define AR8327_PORT_CPU 0
+#define AR8327_NUM_PORTS 7
+#define AR8327_MAX_VLANS 128
+
+enum {
+ AR8327_PORT_SPEED_10M = 0,
+ AR8327_PORT_SPEED_100M = 1,
+ AR8327_PORT_SPEED_1000M = 2,
+ AR8327_PORT_SPEED_NONE = 3,
+};
+
+enum {
+ QCA_VER_AR8216 = 0x01,
+ QCA_VER_AR8236 = 0x03,
+ QCA_VER_AR8316 = 0x10,
+ QCA_VER_AR8327 = 0x12,
+ QCA_VER_AR8337 = 0x13
+};
+
+/*poll mib per 2secs*/
+#define QCA_PHY_MIB_WORK_DELAY 20000
+#define QCA_MIB_ITEM_NUMBER 41
+
+struct qca_phy_priv {
+ struct phy_device *phy;
+ struct switch_dev sw_dev;
+ a_uint8_t version;
+ a_uint8_t revision;
+ a_uint32_t (*mii_read)(a_uint32_t reg);
+ void (*mii_write)(a_uint32_t reg, a_uint32_t val);
+ void (*phy_dbg_write)(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint16_t dbg_addr, a_uint16_t dbg_data);
+ void (*phy_mmd_write)(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint16_t addr, a_uint16_t data);
+ void (*phy_write)(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint32_t reg, a_uint16_t data);
+
+ bool init;
+ struct mutex reg_mutex;
+ struct mutex mib_lock;
+ struct delayed_work mib_dwork;
+ u64 *mib_counters;
+ /* dump buf */
+ a_uint8_t buf[2048];
+
+ /* VLAN database */
+ bool vlan; /* True: 1q vlan mode, False: port vlan mode */
+ a_uint16_t vlan_id[AR8327_MAX_VLANS];
+ a_uint8_t vlan_table[AR8327_MAX_VLANS];
+ a_uint8_t vlan_tagged;
+ a_uint16_t pvid[AR8327_NUM_PORTS];
+
+};
+
+
+#define qca_phy_priv_get(_dev) \
+ container_of(_dev, struct qca_phy_priv, sw_dev)
+
+static int
+miibus_get(void);
+uint32_t
+qca_ar8216_mii_read(int reg);
+void
+qca_ar8216_mii_write(int reg, uint32_t val);
+static sw_error_t
+qca_ar8327_phy_write(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint32_t reg, a_uint16_t data);
+static void
+qca_ar8327_mmd_write(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint16_t addr, a_uint16_t data);
+static void
+qca_ar8327_phy_dbg_write(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint16_t dbg_addr, a_uint16_t dbg_data);
+#endif
diff --git a/include/sal/os/aos_lock.h b/include/sal/os/aos_lock.h
new file mode 100755
index 0000000..d09f012
--- /dev/null
+++ b/include/sal/os/aos_lock.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _AOS_LOCK_H
+#define _AOS_LOCK_H
+
+
+#ifdef KERNEL_MODULE
+#include "sal/os/linux/aos_lock_pvt.h"
+#else
+#include "sal/os/linux_user/aos_lock_pvt.h"
+#endif
+
+
+typedef aos_lock_pvt_t aos_lock_t;
+
+
+#define aos_lock_init(lock) __aos_lock_init(lock)
+
+
+#define aos_lock(lock) __aos_lock(lock)
+
+
+#define aos_unlock(lock) __aos_unlock(lock)
+
+
+#define aos_irq_save(flags) __aos_irq_save(flags)
+
+
+#define aos_irq_restore(flags) __aos_irq_restore(flags)
+
+
+#define aos_default_unlock __aos_default_unlock
+
+
+#endif
diff --git a/include/sal/os/aos_mem.h b/include/sal/os/aos_mem.h
new file mode 100755
index 0000000..23034a1
--- /dev/null
+++ b/include/sal/os/aos_mem.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _AOS_MEM_H
+#define _AOS_MEM_H
+
+#include "sal/os/aos_types.h"
+#ifdef KERNEL_MODULE
+#include "sal/os/linux/aos_mem_pvt.h"
+#else
+#include "sal/os/linux_user/aos_mem_pvt.h"
+#endif
+
+/**
+ * @g aos_mem mem
+ * @{
+ *
+ * @ig shim_ext
+ */
+
+/**
+ * @brief Allocate a memory buffer. Note it's a non-blocking call.
+ * This call can block.
+ *
+ * @param[in] size buffer size
+ *
+ * @return Buffer pointer or NULL if there's not enough memory.
+ */
+static inline void *
+aos_mem_alloc(aos_size_t size)
+{
+ return __aos_mem_alloc(size);
+}
+
+/**
+ * @brief Free malloc'ed buffer
+ *
+ * @param[in] buf buffer pointer allocated by aos_alloc()
+ * @param[in] size buffer size
+ */
+static inline void
+aos_mem_free(void *buf)
+{
+ __aos_mem_free(buf);
+}
+
+/**
+ * @brief Move a memory buffer
+ *
+ * @param[in] dst destination address
+ * @param[in] src source address
+ * @param[in] size buffer size
+ */
+static inline void
+aos_mem_copy(void *dst, void *src, aos_size_t size)
+{
+ __aos_mem_copy(dst, src, size);
+}
+
+/**
+ * @brief Fill a memory buffer
+ *
+ * @param[in] buf buffer to be filled
+ * @param[in] b byte to fill
+ * @param[in] size buffer size
+ */
+static inline void
+aos_mem_set(void *buf, a_uint8_t b, aos_size_t size)
+{
+ __aos_mem_set(buf, b, size);
+}
+
+/**
+ * @brief Zero a memory buffer
+ *
+ * @param[in] buf buffer to be zeroed
+ * @param[in] size buffer size
+ */
+static inline void
+aos_mem_zero(void *buf, aos_size_t size)
+{
+ __aos_mem_zero(buf, size);
+}
+
+/**
+ * @brief Compare two memory buffers
+ *
+ * @param[in] buf1 first buffer
+ * @param[in] buf2 second buffer
+ * @param[in] size buffer size
+ *
+ * @retval 0 equal
+ * @retval 1 not equal
+ */
+static inline int
+aos_mem_cmp(void *buf1, void *buf2, aos_size_t size)
+{
+ return __aos_mem_cmp(buf1, buf2, size);
+}
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/include/sal/os/aos_timer.h b/include/sal/os/aos_timer.h
new file mode 100755
index 0000000..81aa0bf
--- /dev/null
+++ b/include/sal/os/aos_timer.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#ifndef _AOS_TIMER_H
+#define _AOS_TIMER_H
+
+#include "sal/os/aos_types.h"
+#ifdef KERNEL_MODULE
+#include "sal/os/linux/aos_timer_pvt.h"
+#else
+#include "sal/os/linux_user/aos_timer_pvt.h"
+#endif
+
+
+typedef __aos_timer_t aos_timer_t;
+
+
+/*
+ * Delay in microseconds
+ */
+static inline void
+aos_udelay(int usecs)
+{
+ return __aos_udelay(usecs);
+}
+
+/*
+ * Delay in milliseconds.
+ */
+static inline void
+aos_mdelay(int msecs)
+{
+ return __aos_mdelay(msecs);
+}
+
+
+#endif
+
diff --git a/include/sal/os/aos_types.h b/include/sal/os/aos_types.h
new file mode 100755
index 0000000..961114c
--- /dev/null
+++ b/include/sal/os/aos_types.h
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _AOS_TYPES_H
+#define _AOS_TYPES_H
+
+#ifdef KERNEL_MODULE
+#include "sal/os/linux/aos_types_pvt.h"
+#else
+#include "sal/os/linux_user/aos_types_pvt.h"
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/**
+ * @g aos_types types
+ * @{
+ *
+ * @ig shim_ext
+ */
+/*
+ *@ basic data types.
+ */
+typedef enum
+{
+ A_FALSE,
+ A_TRUE
+} a_bool_t;
+
+typedef __a_uint8_t a_uint8_t;
+typedef __a_int8_t a_int8_t;
+typedef __a_uint16_t a_uint16_t;
+typedef __a_int16_t a_int16_t;
+typedef __a_uint32_t a_uint32_t;
+typedef __a_int32_t a_int32_t;
+typedef __a_uint64_t a_uint64_t;
+typedef __a_int64_t a_int64_t;
+
+
+typedef void * acore_t;
+
+/**
+ * @brief Platform/bus generic handle. Used for bus specific functions.
+ */
+typedef __aos_device_t aos_device_t;
+
+/**
+ * @brief size of an object
+ */
+typedef __aos_size_t aos_size_t;
+
+/**
+ * @brief Generic status to be used by acore.
+ */
+typedef enum
+{
+ A_STATUS_OK,
+ A_STATUS_FAILED,
+ A_STATUS_ENOENT,
+ A_STATUS_ENOMEM,
+ A_STATUS_EINVAL,
+ A_STATUS_EINPROGRESS,
+ A_STATUS_ENOTSUPP,
+ A_STATUS_EBUSY,
+} a_status_t;
+
+/*
+ * An ecore needs to provide a table of all pci device/vendor id's it
+ * supports
+ *
+ * This table should be terminated by a NULL entry , i.e. {0}
+ */
+typedef struct
+{
+ a_uint32_t vendor;
+ a_uint32_t device;
+ a_uint32_t subvendor;
+ a_uint32_t subdevice;
+} aos_pci_dev_id_t;
+
+#define AOS_PCI_ANY_ID (~0)
+
+/*
+ * Typically core's can use this macro to create a table of various device
+ * ID's
+ */
+#define AOS_PCI_DEVICE(_vendor, _device) \
+ (_vendor), (_device), AOS_PCI_ANY_ID, AOS_PCI_ANY_ID
+
+
+typedef __aos_iomem_t aos_iomem_t;
+/*
+ * These define the hw resources the OS has allocated for the device
+ * Note that start defines a mapped area.
+ */
+typedef enum
+{
+ AOS_RESOURCE_TYPE_MEM,
+ AOS_RESOURCE_TYPE_IO,
+} aos_resource_type_t;
+
+typedef struct
+{
+ a_uint32_t start;
+ a_uint32_t end;
+ aos_resource_type_t type;
+} aos_resource_t;
+
+#define AOS_DEV_ID_TABLE_MAX 256
+
+typedef union
+{
+ aos_pci_dev_id_t *pci;
+ void *raw;
+} aos_bus_reg_data_t;
+
+typedef void *aos_attach_data_t;
+
+#define AOS_REGIONS_MAX 5
+
+typedef enum
+{
+ AOS_BUS_TYPE_PCI = 1,
+ AOS_BUS_TYPE_GENERIC,
+} aos_bus_type_t;
+
+typedef enum
+{
+ AOS_IRQ_NONE,
+ AOS_IRQ_HANDLED,
+} aos_irq_resp_t;
+
+typedef enum
+{
+ AOS_DMA_MASK_32BIT,
+ AOS_DMA_MASK_64BIT,
+} aos_dma_mask_t;
+
+
+/**
+ * @brief DMA directions
+ */
+typedef enum
+{
+ AOS_DMA_TO_DEVICE = 0, /**< Data is transfered from device to memory */
+ AOS_DMA_FROM_DEVICE, /**< Data is transfered from memory to device */
+} aos_dma_dir_t;
+
+/*
+ * Protoypes shared between public and private headers
+ */
+
+
+/*
+ * work queue(kernel thread) function callback
+ */
+typedef void (*aos_work_func_t)(void *);
+
+/**
+ * @brief Prototype of the critical region function that is to be
+ * executed with spinlock held and interrupt disalbed
+ */
+typedef a_bool_t (*aos_irqlocked_func_t)(void *);
+
+/**
+ * @brief Prototype of timer function
+ */
+typedef void (*aos_timer_func_t)(void *);
+
+#endif
diff --git a/include/sal/os/linux_user/aos_lock_pvt.h b/include/sal/os/linux_user/aos_lock_pvt.h
new file mode 100755
index 0000000..a889476
--- /dev/null
+++ b/include/sal/os/linux_user/aos_lock_pvt.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _AOS_LOCK_PVT_H
+#define _AOS_LOCK_PVT_H
+
+#include <pthread.h>
+#include "sal/os/aos_types.h"
+
+
+typedef pthread_mutex_t aos_lock_pvt_t;
+
+
+#define __aos_lock_init(lock) \
+ pthread_mutex_init(lock, NULL); \
+ pthread_mutexattr_setpshared(lock, PTHREAD_PROCESS_SHARED)
+
+
+#define __aos_lock(lock) pthread_mutex_lock(lock)
+
+
+#define __aos_unlock(lock) pthread_mutex_unlock(lock)
+
+
+#define __aos_irq_save(flags)
+
+
+#define __aos_irq_restore(flags)
+
+
+#define __aos_default_unlock PTHREAD_MUTEX_INITIALIZER
+
+
+#endif /*_AOS_LOCK_PVT_H*/
+
diff --git a/include/sal/os/linux_user/aos_mem_pvt.h b/include/sal/os/linux_user/aos_mem_pvt.h
new file mode 100755
index 0000000..281e65d
--- /dev/null
+++ b/include/sal/os/linux_user/aos_mem_pvt.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _AOS_MEM_PVT_H
+#define _AOS_MEM_PVT_H
+
+#include <stdlib.h>
+#include <string.h>
+
+static inline void *__aos_mem_alloc(aos_size_t size)
+{
+ return (malloc(size));
+}
+
+static inline void __aos_mem_free(void *buf)
+{
+ free(buf);
+}
+
+/* move a memory buffer */
+static inline void
+__aos_mem_copy(void *dst, void *src, aos_size_t size)
+{
+ memcpy(dst, src, size);
+}
+
+/* set a memory buffer */
+static inline void
+__aos_mem_set(void *buf, a_uint8_t b, aos_size_t size)
+{
+ memset(buf, b, size);
+}
+
+/* zero a memory buffer */
+static inline void
+__aos_mem_zero(void *buf, aos_size_t size)
+{
+ memset(buf, 0, size);
+}
+
+/* compare two memory buffers */
+static inline int
+__aos_mem_cmp(void *buf1, void *buf2, aos_size_t size)
+{
+ return (memcmp(buf1, buf2, size) == 0) ? 0 : 1;
+}
+
+
+
+#endif /*_AOS_MEM_PVT_H*/
diff --git a/include/sal/os/linux_user/aos_timer_pvt.h b/include/sal/os/linux_user/aos_timer_pvt.h
new file mode 100755
index 0000000..58055eb
--- /dev/null
+++ b/include/sal/os/linux_user/aos_timer_pvt.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _AOS_TIMER_PVT_H
+#define _AOS_TIMER_PVT_H
+
+#include <unistd.h>
+
+typedef int __aos_timer_t;
+
+static inline void
+__aos_udelay(int usecs)
+{
+ usleep(usecs);
+ return;
+}
+
+static inline void
+__aos_mdelay(int msecs)
+{
+ usleep(1000*msecs);
+ return;
+}
+
+#endif /*_AOS_TIMER_PVT_H*/
diff --git a/include/sal/os/linux_user/aos_types_pvt.h b/include/sal/os/linux_user/aos_types_pvt.h
new file mode 100755
index 0000000..fc71a87
--- /dev/null
+++ b/include/sal/os/linux_user/aos_types_pvt.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _AOS_PVTTYPES_H
+#define _AOS_PVTTYPES_H
+
+#include <asm/types.h>
+#include <stdio.h>
+/*
+ * Private definitions of general data types
+ */
+
+typedef void* __aos_device_t;
+typedef int __aos_size_t;
+typedef int __aos_iomem_t;
+
+typedef __u8 __a_uint8_t;
+typedef __s8 __a_int8_t;
+typedef __u16 __a_uint16_t;
+typedef __s16 __a_int16_t;
+typedef __u32 __a_uint32_t;
+typedef __s32 __a_int32_t;
+typedef __u64 __a_uint64_t;
+typedef __s64 __a_int64_t;
+
+
+#define aos_printk printf
+
+
+#endif
diff --git a/include/sal/sd/linux/uk_interface/sw_api_us.h b/include/sal/sd/linux/uk_interface/sw_api_us.h
new file mode 100755
index 0000000..7e95e32
--- /dev/null
+++ b/include/sal/sd/linux/uk_interface/sw_api_us.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _SW_API_US_H
+#define _SW_API_US_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "common/sw.h"
+
+ sw_error_t sw_uk_init(a_uint32_t nl_prot);
+
+ sw_error_t sw_uk_cleanup(void);
+
+ sw_error_t sw_uk_if(a_uint32_t arg_val[SW_MAX_API_PARAM]);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _SW_API_INTERFACE_H */
diff --git a/include/sal/sd/sd.h b/include/sal/sd/sd.h
new file mode 100755
index 0000000..f24ef31
--- /dev/null
+++ b/include/sal/sd/sd.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#ifndef _SD_H_
+#define _SD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+ sw_error_t
+ sd_reg_mdio_set(a_uint32_t dev_id, a_uint32_t phy, a_uint32_t reg,
+ a_uint16_t data);
+
+ sw_error_t
+ sd_reg_mdio_get(a_uint32_t dev_id, a_uint32_t phy, a_uint32_t reg,
+ a_uint16_t * data);
+
+ sw_error_t
+ sd_reg_hdr_set(a_uint32_t dev_id, a_uint32_t reg_addr,
+ a_uint8_t * reg_data, a_uint32_t len);
+
+ sw_error_t
+ sd_reg_hdr_get(a_uint32_t dev_id, a_uint32_t reg_addr,
+ a_uint8_t * reg_data, a_uint32_t len);
+
+ sw_error_t sd_init(a_uint32_t dev_id, ssdk_init_cfg * cfg);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _SD_H_ */
diff --git a/include/shell/shell.h b/include/shell/shell.h
new file mode 100755
index 0000000..33b390c
--- /dev/null
+++ b/include/shell/shell.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SW_SHELL_H
+#define _SW_SHELL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "sw.h"
+#include "sw_api.h"
+#include "ssdk_init.h"
+
+ extern a_uint32_t *ioctl_buf;
+ extern ssdk_init_cfg init_cfg;
+
+#define IOCTL_BUF_SIZE 2048
+#define CMDSTR_BUF_SIZE 1024
+#define CMDSTR_ARGS_MAX 128
+#define dprintf cmd_print
+ extern sw_error_t cmd_exec_api(a_uint32_t *arg_val);
+ extern void cmd_print(char *fmt, ...);
+ void cmd_print_error(sw_error_t rtn);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _SW_SHELL_H */
diff --git a/include/shell/shell_config.h b/include/shell/shell_config.h
new file mode 100755
index 0000000..978f10a
--- /dev/null
+++ b/include/shell/shell_config.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SHELL_CONFIG_H_
+#define _SHELL_CONFIG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "sw_api.h"
+
+#define SW_CMD_SET_DEVID (SW_API_MAX + 1)
+#define SW_CMD_VLAN_SHOW (SW_API_MAX + 2)
+#define SW_CMD_FDB_SHOW (SW_API_MAX + 3)
+#define SW_CMD_RESV_FDB_SHOW (SW_API_MAX + 4)
+#define SW_CMD_HOST_SHOW (SW_API_MAX + 5)
+#define SW_CMD_NAT_SHOW (SW_API_MAX + 6)
+#define SW_CMD_NAPT_SHOW (SW_API_MAX + 7)
+#define SW_CMD_INTFMAC_SHOW (SW_API_MAX + 8)
+#define SW_CMD_PUBADDR_SHOW (SW_API_MAX + 9)
+#define SW_CMD_MAX (SW_API_MAX + 10)
+
+#define MAX_SUB_CMD_DES_NUM 60
+
+ struct sub_cmd_des_t
+ {
+ char *sub_name;
+ char *sub_act;
+ char *sub_memo;
+ char *sub_usage;
+ int sub_api;
+ sw_error_t (*sub_func) ();
+ };
+ struct cmd_des_t
+ {
+ char *name;
+ char *memo;
+ struct sub_cmd_des_t sub_cmd_des[MAX_SUB_CMD_DES_NUM];
+ };
+ extern struct cmd_des_t gcmd_des[];
+
+#define GCMD_DES gcmd_des
+
+#define GCMD_NAME(cmd_nr) GCMD_DES[cmd_nr].name
+#define GCMD_MEMO(cmd_nr) GCMD_DES[cmd_nr].memo
+
+#define GCMD_SUB_NAME(cmd_nr, sub_cmd_nr) GCMD_DES[cmd_nr].sub_cmd_des[sub_cmd_nr].sub_name
+#define GCMD_SUB_ACT(cmd_nr, sub_cmd_nr) GCMD_DES[cmd_nr].sub_cmd_des[sub_cmd_nr].sub_act
+#define GCMD_SUB_MEMO(cmd_nr, sub_cmd_nr) GCMD_DES[cmd_nr].sub_cmd_des[sub_cmd_nr].sub_memo
+#define GCMD_SUB_USAGE(cmd_nr, sub_cmd_nr) GCMD_DES[cmd_nr].sub_cmd_des[sub_cmd_nr].sub_usage
+#define GCMD_SUB_API(cmd_nr, sub_cmd_nr) GCMD_DES[cmd_nr].sub_cmd_des[sub_cmd_nr].sub_api
+#define GCMD_SUB_FUNC(cmd_nr, sub_cmd_nr) GCMD_DES[cmd_nr].sub_cmd_des[sub_cmd_nr].sub_func
+
+#define GCMD_DESC_VALID(cmd_nr) GCMD_NAME(cmd_nr)
+#define GCMD_SUB_DESC_VALID(cmd_nr, sub_cmd_nr) GCMD_SUB_API(cmd_nr, sub_cmd_nr)
+
+
+#define GCMD_DESC_NO_MATCH 0xffffffff
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _SHELL_CONFIG_H_ */
diff --git a/include/shell/shell_io.h b/include/shell/shell_io.h
new file mode 100755
index 0000000..2f7dafa
--- /dev/null
+++ b/include/shell/shell_io.h
@@ -0,0 +1,323 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SHELL_IO_H
+#define _SHELL_IO_H
+
+#include "sw.h"
+#include "sw_api.h"
+#include "fal.h"
+
+#define SW_TYPE_DEF(type, parser, show) {type, parser, show}
+typedef struct
+{
+ sw_data_type_e data_type;
+ sw_error_t(*param_check) ();
+ void (*show_func) ();
+} sw_data_type_t;
+
+void set_talk_mode(int mode);
+int get_talk_mode(void);
+void set_full_cmdstrp(char **cmdstrp);
+sw_data_type_t * cmd_data_type_find(sw_data_type_e type);
+void cmd_strtol(char *str, a_uint32_t * arg_val);
+
+
+sw_error_t cmd_data_check_portmap(char *cmdstr, fal_pbmp_t * val, a_uint32_t size);
+sw_error_t cmd_data_check_confirm(char *cmdstr, a_bool_t def, a_bool_t * val, a_uint32_t size);
+
+sw_error_t cmd_data_check_uint32(char *cmd_str, a_uint32_t * arg_val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_uint16(char *cmd_str, a_uint32_t * arg_val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_enable(char *cmd_str, a_uint32_t * arg_val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_pbmp(char *cmd_str, a_uint32_t * arg_val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_duplex(char *cmd_str, a_uint32_t * arg_val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_speed(char *cmd_str, a_uint32_t * arg_val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_1qmode(char *cmd_str, a_uint32_t * arg_val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_egmode(char *cmd_str, a_uint32_t * arg_val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_capable(char *cmd_str, a_uint32_t * arg_val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_fdbentry(char *cmdstr, void *val, a_uint32_t size);
+sw_error_t cmd_data_check_macaddr(char *cmdstr, void *val, a_uint32_t size);
+
+void cmd_data_print_uint32(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_uint16(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_enable(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_pbmp(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_duplex(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_speed(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+sw_error_t cmd_data_check_vlan(char *cmdstr, fal_vlan_t * val, a_uint32_t size);
+void cmd_data_print_vlan(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_mib(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_1qmode(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_egmode(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_capable(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_fdbentry(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+void cmd_data_print_macaddr(char * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+sw_error_t cmd_data_check_qos_sch(char *cmdstr, fal_sch_mode_t * val,
+ a_uint32_t size);
+void cmd_data_print_qos_sch(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+sw_error_t cmd_data_check_qos_pt(char *cmdstr, fal_qos_mode_t * val,
+ a_uint32_t size);
+void cmd_data_print_qos_pt(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+sw_error_t cmd_data_check_storm(char *cmdstr, fal_storm_type_t * val,
+ a_uint32_t size);
+void cmd_data_print_storm(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+sw_error_t cmd_data_check_stp_state(char *cmdstr, fal_stp_state_t * val,
+ a_uint32_t size);
+void cmd_data_print_stp_state(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+sw_error_t cmd_data_check_leaky(char *cmdstr, fal_leaky_ctrl_mode_t * val,
+ a_uint32_t size);
+void cmd_data_print_leaky(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+sw_error_t cmd_data_check_uinta(char *cmdstr, a_uint32_t * val,
+ a_uint32_t size);
+void cmd_data_print_uinta(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+sw_error_t cmd_data_check_maccmd(char *cmdstr, fal_fwd_cmd_t * val,
+ a_uint32_t size);
+void cmd_data_print_maccmd(char * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+
+sw_error_t cmd_data_check_aclrule(char *info, void *val, a_uint32_t size);
+
+void cmd_data_print_aclrule(char * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+
+sw_error_t
+cmd_data_check_ledpattern(char *info, void * val, a_uint32_t size);
+
+void
+cmd_data_print_ledpattern(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+
+sw_error_t
+cmd_data_check_invlan_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+void
+cmd_data_print_invlan_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+sw_error_t
+cmd_data_check_vlan_propagation(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+void
+cmd_data_print_vlan_propagation(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+sw_error_t
+cmd_data_check_vlan_translation(char *info, fal_vlan_trans_entry_t *val, a_uint32_t size);
+void
+cmd_data_print_vlan_translation(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+sw_error_t
+cmd_data_check_qinq_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+void
+cmd_data_print_qinq_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+sw_error_t
+cmd_data_check_qinq_role(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+void
+cmd_data_print_qinq_role(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+void
+cmd_data_print_cable_status(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+void
+cmd_data_print_cable_len(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+void
+cmd_data_print_ssdk_cfg(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_hdrmode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+void
+cmd_data_print_hdrmode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_fdboperation(char *cmd_str, void * val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_pppoe(char *cmd_str, void * val, a_uint32_t size);
+
+void
+cmd_data_print_pppoe(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_udf_type(char *cmdstr, fal_acl_udf_type_t * arg_val, a_uint32_t size);
+
+void
+cmd_data_print_udf_type(char * param_name, a_uint32_t * buf,
+ a_uint32_t size);
+
+sw_error_t
+cmd_data_check_host_entry(char *cmd_str, void * val, a_uint32_t size);
+
+void
+cmd_data_print_host_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_arp_learn_mode(char *cmd_str, fal_arp_learn_mode_t * arg_val,
+ a_uint32_t size);
+
+void
+cmd_data_print_arp_learn_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_ip_guard_mode(char *cmd_str, fal_source_guard_mode_t * arg_val, a_uint32_t size);
+
+void
+cmd_data_print_ip_guard_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_nat_entry(char *cmd_str, void * val, a_uint32_t size);
+
+void
+cmd_data_print_nat_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_napt_entry(char *cmd_str, void * val, a_uint32_t size);
+
+void
+cmd_data_print_napt_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_napt_mode(char *cmd_str, fal_napt_mode_t * arg_val, a_uint32_t size);
+
+void
+cmd_data_print_napt_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_intf_mac_entry(char *cmd_str, void * val, a_uint32_t size);
+
+void
+cmd_data_print_intf_mac_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_ip4addr(char *cmdstr, void * val, a_uint32_t size);
+
+void
+cmd_data_print_ip4addr(char * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_ip6addr(char *cmdstr, void * val, a_uint32_t size);
+
+void
+cmd_data_print_ip6addr(char * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_pub_addr_entry(char *cmd_str, void * val, a_uint32_t size);
+
+
+void
+cmd_data_print_pub_addr_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+
+sw_error_t
+cmd_data_check_egress_shaper(char *cmd_str, void * val, a_uint32_t size);
+
+
+void
+cmd_data_print_egress_shaper(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+
+sw_error_t
+cmd_data_check_acl_policer(char *cmd_str, void * val, a_uint32_t size);
+
+
+void
+cmd_data_print_acl_policer(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+
+sw_error_t
+cmd_data_check_port_policer(char *cmd_str, void * val, a_uint32_t size);
+
+void
+cmd_data_print_port_policer(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_mac_config(char *cmd_str, void * val, a_uint32_t size);
+
+void
+cmd_data_print_mac_config(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_phy_config(char *cmd_str, void * val, a_uint32_t size);
+
+void
+cmd_data_print_phy_config(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_fdb_smode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+void
+cmd_data_print_fdb_smode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_fx100_config(char *cmd_str, void * arg_val, a_uint32_t size);
+
+void
+cmd_data_print_fx100_config(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_multi(char *info, void *val, a_uint32_t size);
+void
+cmd_data_print_multi(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_sec_mac(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_sec_ip(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_sec_ip4(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_sec_ip6(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_sec_tcp(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_sec_udp(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_sec_icmp4(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_sec_icmp6(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_remark_entry(char *info, void *val, a_uint32_t size);
+
+void
+cmd_data_print_remark_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size);
+
+#endif
+
diff --git a/include/shell/shell_lib.h b/include/shell/shell_lib.h
new file mode 100755
index 0000000..a6f824a
--- /dev/null
+++ b/include/shell/shell_lib.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SW_SHELL_LIB_H
+#define _SW_SHELL_LIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ int next_cmd(char *out_cmd);
+ ssize_t getline(char **lineptr, size_t *n, FILE *stream);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _SW_SHELL_LIB_H */
+
diff --git a/include/shell/shell_sw.h b/include/shell/shell_sw.h
new file mode 100755
index 0000000..24c113e
--- /dev/null
+++ b/include/shell/shell_sw.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SHELL_SW_H_
+#define _SHELL_SW_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "sw.h"
+
+ int get_devid(void);
+ sw_error_t cmd_set_devid(a_uint32_t *arg_val);
+ sw_error_t cmd_show_fdb(a_uint32_t *arg_val);
+ sw_error_t cmd_show_vlan(a_uint32_t *arg_val);
+ sw_error_t cmd_show_resv_fdb(a_uint32_t *arg_val);
+ sw_error_t cmd_show_host(a_uint32_t *arg_val);
+ sw_error_t cmd_show_nat(a_uint32_t *arg_val);
+ sw_error_t cmd_show_napt(a_uint32_t *arg_val);
+ sw_error_t cmd_show_intfmac(a_uint32_t *arg_val);
+ sw_error_t cmd_show_pubaddr(a_uint32_t *arg_val);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _SHELL_SW_H_ */
diff --git a/make/components.mk b/make/components.mk
new file mode 100755
index 0000000..1c0dfba
--- /dev/null
+++ b/make/components.mk
@@ -0,0 +1,36 @@
+
+ifeq (linux, $(OS))
+ ifeq (KSLIB, $(MODULE_TYPE))
+ ifeq (TRUE, $(KERNEL_MODE))
+ COMPONENTS = HSL SAL INIT UTIL REF
+ ifeq (TRUE, $(FAL))
+ COMPONENTS += FAL
+ endif
+ else
+ COMPONENTS = HSL SAL INIT REF
+ endif
+
+ ifeq (TRUE, $(UK_IF))
+ COMPONENTS += API
+ endif
+ endif
+
+ ifeq (USLIB, $(MODULE_TYPE))
+ ifneq (TRUE, $(KERNEL_MODE))
+ COMPONENTS = HSL SAL INIT UTIL REF
+ ifeq (TRUE, $(FAL))
+ COMPONENTS += FAL
+ endif
+ else
+ COMPONENTS = UK_IF SAL
+ endif
+
+ ifeq (TRUE, $(UK_IF))
+ COMPONENTS += API
+ endif
+ endif
+
+ ifeq (SHELL, $(MODULE_TYPE))
+ COMPONENTS = SHELL
+ endif
+endif
diff --git a/make/config.mk b/make/config.mk
new file mode 100755
index 0000000..4a55061
--- /dev/null
+++ b/make/config.mk
@@ -0,0 +1,91 @@
+
+include $(PRJ_PATH)/config
+
+ifndef SYS_PATH
+ $(error SYS_PATH isn't defined!)
+endif
+
+ifndef TOOL_PATH
+ $(error TOOL_PATH isn't defined!)
+endif
+
+#define cpu type such as PPC MIPS ARM X86
+ifndef CPU
+ CPU=mips
+endif
+
+#define os type such as linux netbsd vxworks
+ifndef OS
+ OS=linux
+endif
+
+ifndef OS_VER
+ OS_VER=2_6
+endif
+
+#support chip type such as ATHENA GARUDA
+ifndef CHIP_TYPE
+ SUPPORT_CHIP = GARUDA
+else
+ ifeq (GARUDA, $(CHIP_TYPE))
+ SUPPORT_CHIP = GARUDA
+ endif
+
+ ifeq (ATHENA, $(CHIP_TYPE))
+ SUPPORT_CHIP = ATHENA
+ endif
+
+ ifeq (SHIVA, $(CHIP_TYPE))
+ SUPPORT_CHIP = SHIVA
+ endif
+
+ ifeq (HORUS, $(CHIP_TYPE))
+ SUPPORT_CHIP = HORUS
+ endif
+
+ ifeq (ISIS, $(CHIP_TYPE))
+ SUPPORT_CHIP = ISIS
+ endif
+
+ ifeq (ISISC, $(CHIP_TYPE))
+ SUPPORT_CHIP = ISISC
+ endif
+
+ ifeq (ALL_CHIP, $(CHIP_TYPE))
+ ifneq (TRUE, $(FAL))
+ $(error FAL must be TRUE when CHIP_TYPE is defined as ALL_CHIP!)
+ endif
+ SUPPORT_CHIP = GARUDA SHIVA HORUS ISIS ISISC
+ endif
+
+ ifndef SUPPORT_CHIP
+ $(error defined CHIP_TYPE isn't supported!)
+ endif
+endif
+
+#define compile tool prefix
+ifndef TOOLPREFIX
+ TOOLPREFIX=$(CPU)-$(OS)-uclibc-
+endif
+
+DEBUG_ON=FALSE
+OPT_FLAG=
+LD_FLAG=
+
+SHELLOBJ=ssdk_sh
+US_MOD=ssdk_us
+KS_MOD=ssdk_ks
+
+ifeq (TRUE, $(KERNEL_MODE))
+ RUNMODE=km
+else
+ RUNMODE=um
+endif
+
+BLD_DIR=$(PRJ_PATH)/build/$(OS)
+BIN_DIR=$(PRJ_PATH)/build/bin
+
+VER=1.2.0
+BUILD_NUMBER=$(shell cat $(PRJ_PATH)/make/.build_number)
+VERSION=$(VER).$(BUILD_NUMBER)
+BUILD_DATE=$(shell date -u +%F-%T)
diff --git a/make/defs.mk b/make/defs.mk
new file mode 100755
index 0000000..7d1c75b
--- /dev/null
+++ b/make/defs.mk
@@ -0,0 +1,28 @@
+DST_DIR=$(BLD_DIR)/$(MODULE_TYPE)
+
+SUB_DIR=$(patsubst %/, %, $(dir $(wildcard ./*/Makefile)))
+
+ifeq (,$(findstring $(LIB), $(COMPONENTS)))
+ SRC_LIST=
+endif
+
+SRC_FILE=$(addprefix $(PRJ_PATH)/$(LOC_DIR)/, $(SRC_LIST))
+
+OBJ_LIST=$(SRC_LIST:.c=.o)
+OBJ_FILE=$(addprefix $(DST_DIR)/, $(OBJ_LIST))
+
+DEP_LIST=$(SRC_LIST:.c=.d)
+DEP_FILE=$(addprefix $(DST_DIR)/, $(DEP_LIST))
+
+vpath %.c $(PRJ_PATH)/$(LOC_DIR)
+vpath %.c $(PRJ_PATH)/app/nathelper/linux
+vpath %.c $(PRJ_PATH)/app/nathelper/linux/lib
+vpath %.o $(DST_DIR)
+vpath %.d $(DST_DIR)
+
+DEP_LOOP=$(foreach i, $(SUB_DIR), $(MAKE) -C $(i) dep || exit 1;)
+OBJ_LOOP=$(foreach i, $(SUB_DIR), $(MAKE) -C $(i) obj || exit 1;)
+CLEAN_LOOP=$(foreach i, $(SUB_DIR), $(MAKE) -C $(i) clean;)
+CLEAN_OBJ_LOOP=$(foreach i, $(SUB_DIR), $(MAKE) -C $(i) clean_o;)
+CLEAN_DEP_LOOP=$(foreach i, $(SUB_DIR), $(MAKE) -C $(i) clean_d;)
+
diff --git a/make/linux_opt.mk b/make/linux_opt.mk
new file mode 100755
index 0000000..135b588
--- /dev/null
+++ b/make/linux_opt.mk
@@ -0,0 +1,279 @@
+ifeq (TRUE, $(IN_ACL))
+ MODULE_CFLAG += -DIN_ACL
+endif
+
+ifeq (TRUE, $(IN_FDB))
+ MODULE_CFLAG += -DIN_FDB
+endif
+
+ifeq (TRUE, $(IN_IGMP))
+ MODULE_CFLAG += -DIN_IGMP
+endif
+
+ifeq (TRUE, $(IN_LEAKY))
+ MODULE_CFLAG += -DIN_LEAKY
+endif
+
+ifeq (TRUE, $(IN_LED))
+ MODULE_CFLAG += -DIN_LED
+endif
+
+ifeq (TRUE, $(IN_MIB))
+ MODULE_CFLAG += -DIN_MIB
+endif
+
+ifeq (TRUE, $(IN_MIRROR))
+ MODULE_CFLAG += -DIN_MIRROR
+endif
+
+ifeq (TRUE, $(IN_MISC))
+ MODULE_CFLAG += -DIN_MISC
+endif
+
+ifeq (TRUE, $(IN_PORTCONTROL))
+ MODULE_CFLAG += -DIN_PORTCONTROL
+endif
+
+ifeq (TRUE, $(IN_PORTVLAN))
+ MODULE_CFLAG += -DIN_PORTVLAN
+endif
+
+ifeq (TRUE, $(IN_QOS))
+ MODULE_CFLAG += -DIN_QOS
+endif
+
+ifeq (TRUE, $(IN_RATE))
+ MODULE_CFLAG += -DIN_RATE
+endif
+
+ifeq (TRUE, $(IN_STP))
+ MODULE_CFLAG += -DIN_STP
+endif
+
+ifeq (TRUE, $(IN_VLAN))
+ MODULE_CFLAG += -DIN_VLAN
+endif
+
+ifeq (TRUE, $(IN_REDUCED_ACL))
+ MODULE_CFLAG += -DIN_REDUCED_ACL
+endif
+
+ifeq (TRUE, $(IN_COSMAP))
+ MODULE_CFLAG += -DIN_COSMAP
+endif
+
+ifeq (TRUE, $(IN_IP))
+ MODULE_CFLAG += -DIN_IP
+endif
+
+ifeq (TRUE, $(IN_NAT))
+ MODULE_CFLAG += -DIN_NAT
+endif
+
+ifeq (TRUE, $(IN_TRUNK))
+ MODULE_CFLAG += -DIN_TRUNK
+endif
+
+ifeq (TRUE, $(IN_SEC))
+ MODULE_CFLAG += -DIN_SEC
+endif
+
+ifeq (TRUE, $(IN_NAT_HELPER))
+ MODULE_CFLAG += -DIN_NAT_HELPER
+endif
+
+ifeq (TRUE, $(IN_INTERFACECONTROL))
+ MODULE_CFLAG += -DIN_INTERFACECONTROL
+endif
+
+ifeq (TRUE, $(IN_MACBLOCK))
+ MODULE_CFLAG += -DIN_MACBLOCK
+endif
+
+ifneq (TRUE, $(FAL))
+ MODULE_CFLAG += -DHSL_STANDALONG
+endif
+
+ifeq (TRUE, $(UK_IF))
+ MODULE_CFLAG += -DUK_IF
+endif
+
+#ifdef UK_NL_PROT
+ MODULE_CFLAG += -DUK_NL_PROT=$(UK_NL_PROT)
+#endif
+
+#ifdef UK_MINOR_DEV
+ MODULE_CFLAG += -DUK_MINOR_DEV=$(UK_MINOR_DEV)
+#endif
+
+ifeq (TRUE, $(API_LOCK))
+ MODULE_CFLAG += -DAPI_LOCK
+endif
+
+ifeq (TRUE, $(REG_ACCESS_SPEEDUP))
+ MODULE_CFLAG += -DREG_ACCESS_SPEEDUP
+endif
+
+ifeq (TRUE, $(DEBUG_ON))
+ MODULE_CFLAG += -g
+endif
+
+MODULE_CFLAG += $(OPT_FLAG) -Wall -DVERSION=\"$(VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\" -DCPU=\"$(CPU)\" -DOS=\"$(OS)\"
+
+MODULE_INC += -I$(PRJ_PATH)/include \
+ -I$(PRJ_PATH)/include/common \
+ -I$(PRJ_PATH)/include/api \
+ -I$(PRJ_PATH)/include/fal \
+ -I$(PRJ_PATH)/include/ref \
+ -I$(PRJ_PATH)/include/hsl \
+ -I$(PRJ_PATH)/include/hsl/phy \
+ -I$(PRJ_PATH)/include/sal/os \
+ -I$(PRJ_PATH)/include/sal/sd \
+ -I$(PRJ_PATH)/include/sal/sd/linux/hydra_howl \
+ -I$(PRJ_PATH)/include/sal/sd/linux/uk_interface \
+ -I$(PRJ_PATH)/include/init
+
+ifneq (,$(findstring ATHENA, $(SUPPORT_CHIP)))
+ MODULE_INC += -I$(PRJ_PATH)/include/hsl/athena
+ MODULE_CFLAG += -DATHENA
+endif
+
+ifneq (,$(findstring GARUDA, $(SUPPORT_CHIP)))
+ MODULE_INC += -I$(PRJ_PATH)/include/hsl/garuda
+ MODULE_CFLAG += -DGARUDA
+endif
+
+ifneq (,$(findstring SHIVA, $(SUPPORT_CHIP)))
+ MODULE_INC += -I$(PRJ_PATH)/include/hsl/shiva
+ MODULE_CFLAG += -DSHIVA
+endif
+
+ifneq (,$(findstring HORUS, $(SUPPORT_CHIP)))
+ MODULE_INC += -I$(PRJ_PATH)/include/hsl/horus
+ MODULE_CFLAG += -DHORUS
+endif
+
+ifneq (,$(findstring ISIS, $(SUPPORT_CHIP)))
+ ifneq (ISISC, $(SUPPORT_CHIP))
+ MODULE_INC += -I$(PRJ_PATH)/include/hsl/isis
+ MODULE_CFLAG += -DISIS
+ endif
+endif
+
+ifneq (,$(findstring ISISC, $(SUPPORT_CHIP)))
+ MODULE_INC += -I$(PRJ_PATH)/include/hsl/isisc
+ MODULE_CFLAG += -DISISC
+endif
+
+# check for GCC version
+ifeq (4, $(GCC_VER))
+ MODULE_CFLAG += -DGCCV4
+endif
+
+ifeq (KSLIB, $(MODULE_TYPE))
+
+ ifeq (3_4, $(OS_VER))
+ MODULE_CFLAG += -DKVER34
+ MODULE_CFLAG += -DKVER32
+ MODULE_CFLAG += -DLNX26_22
+ MODULE_INC += -I$(SYS_PATH) \
+ -I$(SYS_PATH)/include \
+ -I$(SYS_PATH)/source/include \
+ -I$(SYS_PATH)/source/arch/arm/mach-msm/include \
+ -I$(SYS_PATH)/source/arch/arm/include \
+ -I$(SYS_PATH)/source/arch/arm/include/asm \
+ -I$(SYS_PATH)/arch/arm/include/generated \
+ -I$(SYS_PATH)/source/arch/arm/include/asm/mach \
+ -I$(SYS_PATH)/usr/include
+
+ endif
+
+ ifeq (3_2, $(OS_VER))
+ MODULE_CFLAG += -DKVER32
+ MODULE_CFLAG += -DLNX26_22
+ ifeq (mips, $(CPU))
+ MODULE_INC += -I$(SYS_PATH) \
+ -I$(SYS_PATH)/include \
+ -I$(SYS_PATH)/arch/mips/include \
+ -I$(SYS_PATH)/arch/mips/include/asm/mach-ar7240 \
+ -I$(SYS_PATH)/arch/mips/include/asm/mach-generic \
+ -I$(SYS_PATH)/arch/mips/include/asm/mach-ar7 \
+ -I$(SYS_PATH)/usr/include
+
+ #CPU_CFLAG = -G 0 -mno-abicalls -fno-pic -pipe -mabi=32 -march=mips32r2
+ ifndef CPU_CFLAG
+ CPU_CFLAG = -Wstrict-prototypes -fomit-frame-pointer -G 0 -mno-abicalls -fno-strict-aliasing \
+ -O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB
+ endif
+ else
+ MODULE_INC += -I$(SYS_PATH) \
+ -I$(SYS_PATH)/include \
+ -I$(SYS_PATH)/arch/arm/include \
+ -I$(SYS_PATH)/arch/arm/include/asm \
+ -I$(SYS_PATH)/arch/arm/mach-fv16xx/include \
+ -I$(SYS_PATH)/arch/arm/include/generated \
+ -I$(SYS_PATH)/include/generated \
+ -I$(SYS_PATH)/usr/include
+ endif
+
+
+ endif
+
+ ifeq (2_6, $(OS_VER))
+ MODULE_CFLAG += -DKVER26
+ MODULE_CFLAG += -DLNX26_22
+ ifeq (mips, $(CPU))
+ MODULE_INC += -I$(SYS_PATH) \
+ -I$(SYS_PATH)/include \
+ -I$(SYS_PATH)/arch/mips/include \
+ -I$(SYS_PATH)/arch/mips/include/asm/mach-ar7240 \
+ -I$(SYS_PATH)/arch/mips/include/asm/mach-generic \
+ -I$(SYS_PATH)/usr/include
+
+ #CPU_CFLAG = -G 0 -mno-abicalls -fno-pic -pipe -mabi=32 -march=mips32r2
+ ifndef CPU_CFLAG
+ CPU_CFLAG = -Wstrict-prototypes -fomit-frame-pointer -G 0 -mno-abicalls -fno-strict-aliasing \
+ -O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB
+ endif
+ else
+ MODULE_INC += -I$(SYS_PATH) \
+ -I$(SYS_PATH)/include \
+ -I$(SYS_PATH)/arch/arm/include \
+ -I$(SYS_PATH)/arch/arm/include/asm \
+ -I$(SYS_PATH)/arch/arm/mach-fv16xx/include \
+ -I$(SYS_PATH)/arch/arm/include/generated \
+ -I$(SYS_PATH)/include/generated \
+ -I$(SYS_PATH)/usr/include
+ endif
+
+
+ endif
+
+ MODULE_CFLAG += -D__KERNEL__ -DKERNEL_MODULE $(CPU_CFLAG)
+
+
+endif
+
+ifeq (SHELL, $(MODULE_TYPE))
+ MODULE_INC += -I$(PRJ_PATH)/include/shell
+
+ ifeq (2_6, $(OS_VER))
+ MODULE_CFLAG += -DKVER26
+ else
+ MODULE_CFLAG += -DKVER24
+ endif
+
+ ifeq (TRUE, $(KERNEL_MODE))
+ MODULE_CFLAG += -static
+ else
+ MODULE_CFLAG += -static -DUSER_MODE
+ endif
+endif
+
+ifneq (TRUE, $(KERNEL_MODE))
+ ifneq (SHELL, $(MODULE_TYPE))
+ MODULE_CFLAG += -DUSER_MODE
+ endif
+endif
+
+CFLAGS += $(MODULE_INC) $(MODULE_CFLAG)
diff --git a/make/target.mk b/make/target.mk
new file mode 100755
index 0000000..a72c239
--- /dev/null
+++ b/make/target.mk
@@ -0,0 +1,49 @@
+
+include $(PRJ_PATH)/make/$(OS)_opt.mk
+
+include $(PRJ_PATH)/make/tools.mk
+
+obj: $(OBJ_LIST)
+ $(OBJ_LOOP)
+
+dep: build_dir $(DEP_LIST)
+ $(DEP_LOOP)
+
+$(OBJ_LIST): %.o : %.c %.d
+ $(CC) $(CFLAGS) -c $< -o $(DST_DIR)/$@
+
+$(DEP_LIST) : %.d : %.c
+ $(CC) $(CFLAGS) -MM $< > $(DST_DIR)/$@.tmp
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $(DST_DIR)/$@.tmp > $(DST_DIR)/$@
+ $(RM) -f $(DST_DIR)/$@.tmp;
+
+build_dir: $(DST_DIR)
+
+$(DST_DIR):
+ $(MKDIR) -p $(DST_DIR)
+
+.PHONY: clean
+clean: clean_o clean_d
+ $(CLEAN_LOOP)
+
+.PHONY: clean_o
+clean_o: clean_obj
+ $(CLEAN_OBJ_LOOP)
+
+.PHONY: clean_d
+clean_d: clean_dep
+ $(CLEAN_DEP_LOOP)
+
+clean_obj:
+ifneq (,$(word 1, $(OBJ_FILE)))
+ $(RM) -f $(OBJ_FILE)
+endif
+
+clean_dep:
+ifneq (,$(word 1, $(DEP_FILE)))
+ $(RM) -f $(DEP_FILE)
+endif
+
+ifneq (,$(word 1, $(DEP_FILE)))
+ sinclude $(DEP_FILE)
+endif
diff --git a/make/tools.mk b/make/tools.mk
new file mode 100755
index 0000000..6ed3872
--- /dev/null
+++ b/make/tools.mk
@@ -0,0 +1,12 @@
+
+ifeq (linux, $(OS))
+ CC=$(TOOL_PATH)/$(TOOLPREFIX)gcc
+ AR=$(TOOL_PATH)/$(TOOLPREFIX)ar
+ LD=$(TOOL_PATH)/$(TOOLPREFIX)ld
+ STRIP=$(TOOL_PATH)/$(TOOLPREFIX)strip
+ MAKE=make -S
+ CP=cp
+ MKDIR=mkdir
+ RM=rm
+ PERL=perl
+endif
diff --git a/src/api/Makefile b/src/api/Makefile
new file mode 100755
index 0000000..25c788a
--- /dev/null
+++ b/src/api/Makefile
@@ -0,0 +1,12 @@
+LOC_DIR=src/sal
+LIB=API
+
+include $(PRJ_PATH)/make/config.mk
+
+SRC_LIST=$(wildcard *.c)
+
+include $(PRJ_PATH)/make/components.mk
+include $(PRJ_PATH)/make/defs.mk
+include $(PRJ_PATH)/make/target.mk
+
+all: dep obj
\ No newline at end of file
diff --git a/src/api/api_access.c b/src/api/api_access.c
new file mode 100755
index 0000000..f2f6186
--- /dev/null
+++ b/src/api/api_access.c
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "sw.h"
+#include "fal.h"
+#if (defined(KERNEL_MODULE))
+#include "hsl.h"
+#include "hsl_dev.h"
+#if defined ATHENA
+#include "fal_igmp.h"
+#include "fal_leaky.h"
+#include "athena_mib.h"
+#include "athena_port_ctrl.h"
+#include "athena_portvlan.h"
+#include "athena_fdb.h"
+#include "athena_vlan.h"
+#include "athena_init.h"
+#include "athena_reg_access.h"
+#include "athena_reg.h"
+#elif defined GARUDA
+#include "garuda_mib.h"
+#include "garuda_qos.h"
+#include "garuda_rate.h"
+#include "garuda_port_ctrl.h"
+#include "garuda_portvlan.h"
+#include "garuda_fdb.h"
+#include "garuda_vlan.h"
+#include "garuda_mirror.h"
+#include "garuda_stp.h"
+#include "garuda_misc.h"
+#include "garuda_leaky.h"
+#include "garuda_igmp.h"
+#include "garuda_acl.h"
+#include "garuda_led.h"
+#include "garuda_init.h"
+#include "garuda_reg_access.h"
+#include "garuda_reg.h"
+#elif defined SHIVA
+#include "shiva_mib.h"
+#include "shiva_qos.h"
+#include "shiva_rate.h"
+#include "shiva_port_ctrl.h"
+#include "shiva_portvlan.h"
+#include "shiva_fdb.h"
+#include "shiva_vlan.h"
+#include "shiva_mirror.h"
+#include "shiva_stp.h"
+#include "shiva_misc.h"
+#include "shiva_leaky.h"
+#include "shiva_igmp.h"
+#include "shiva_acl.h"
+#include "shiva_led.h"
+#include "shiva_init.h"
+#include "shiva_reg_access.h"
+#include "shiva_reg.h"
+#elif defined HORUS
+#include "horus_mib.h"
+#include "horus_qos.h"
+#include "horus_rate.h"
+#include "horus_port_ctrl.h"
+#include "horus_portvlan.h"
+#include "horus_fdb.h"
+#include "horus_vlan.h"
+#include "horus_mirror.h"
+#include "horus_stp.h"
+#include "horus_misc.h"
+#include "horus_leaky.h"
+#include "horus_igmp.h"
+#include "horus_led.h"
+#include "horus_init.h"
+#include "horus_reg_access.h"
+#include "horus_reg.h"
+#elif defined ISIS
+#include "isis_mib.h"
+#include "isis_qos.h"
+#include "isis_cosmap.h"
+#include "isis_rate.h"
+#include "isis_port_ctrl.h"
+#include "isis_portvlan.h"
+#include "isis_fdb.h"
+#include "isis_vlan.h"
+#include "isis_mirror.h"
+#include "isis_stp.h"
+#include "isis_misc.h"
+#include "isis_leaky.h"
+#include "isis_igmp.h"
+#include "isis_acl.h"
+#include "isis_led.h"
+#include "isis_cosmap.h"
+#include "isis_ip.h"
+#include "isis_nat.h"
+#include "isis_trunk.h"
+#include "isis_sec.h"
+#include "isis_interface_ctrl.h"
+#include "isis_init.h"
+#include "isis_reg_access.h"
+#include "isis_reg.h"
+#elif defined ISISC
+#include "isisc_mib.h"
+#include "isisc_qos.h"
+#include "isisc_cosmap.h"
+#include "isisc_rate.h"
+#include "isisc_port_ctrl.h"
+#include "isisc_portvlan.h"
+#include "isisc_fdb.h"
+#include "isisc_vlan.h"
+#include "isisc_mirror.h"
+#include "isisc_stp.h"
+#include "isisc_misc.h"
+#include "isisc_leaky.h"
+#include "isisc_igmp.h"
+#include "isisc_acl.h"
+#include "isisc_led.h"
+#include "isisc_cosmap.h"
+#include "isisc_ip.h"
+#include "isisc_nat.h"
+#include "isisc_trunk.h"
+#include "isisc_sec.h"
+#include "isisc_interface_ctrl.h"
+#include "isisc_init.h"
+#include "isisc_reg_access.h"
+#include "isisc_reg.h"
+#endif
+#endif
+
+#include "sw_api.h"
+#include "api_desc.h"
+#if (((!defined(USER_MODE)) && defined(KERNEL_MODULE)) || (defined(USER_MODE) && (!defined(KERNEL_MODULE))))
+#ifdef HSL_STANDALONG
+#if defined ATHENA
+#include "athena_api.h"
+#elif defined GARUDA
+#include "garuda_api.h"
+#elif defined SHIVA
+#include "shiva_api.h"
+#elif defined HORUS
+#include "horus_api.h"
+#elif defined ISIS
+#include "isis_api.h"
+#elif defined ISISC
+#include "isisc_api.h"
+#endif
+#else
+#include "fal_api.h"
+#endif
+#elif (defined(USER_MODE))
+#if defined ATHENA
+#include "athena_api.h"
+#elif defined GARUDA
+#include "garuda_api.h"
+#elif defined SHIVA
+#include "shiva_api.h"
+#elif defined HORUS
+#include "horus_api.h"
+#elif defined ISIS
+#include "isis_api.h"
+#elif defined ISISC
+#include "isisc_api.h"
+#endif
+#else
+#include "fal_api.h"
+#endif
+
+
+static sw_api_func_t sw_api_func[] = { SSDK_API };
+static sw_api_param_t sw_api_param[] = { SSDK_PARAM };
+
+sw_api_func_t *
+sw_api_func_find(a_uint32_t api_id)
+{
+ a_uint32_t i = 0;
+ static a_uint32_t save = 0;
+
+ if(api_id == sw_api_func[save].api_id)
+ return &sw_api_func[save];
+
+ do
+ {
+ if (api_id == sw_api_func[i].api_id)
+ {
+ save = i;
+ return &sw_api_func[i];
+ }
+
+ }
+ while (++i < (sizeof(sw_api_func)/sizeof(sw_api_func[0])));
+
+ return NULL;
+}
+
+sw_api_param_t *
+sw_api_param_find(a_uint32_t api_id)
+{
+ a_uint32_t i = 0;
+ static a_uint32_t save = 0;
+
+ if(api_id == sw_api_param[save].api_id)
+ return &sw_api_param[save];
+
+ do
+ {
+ if (api_id == sw_api_param[i].api_id)
+ {
+ save = i;
+ return &sw_api_param[i];
+ }
+ }
+ while (++i < (sizeof(sw_api_param)/sizeof(sw_api_param[0])));
+
+ return NULL;
+}
+
+a_uint32_t
+sw_api_param_nums(a_uint32_t api_id)
+{
+ a_uint32_t i = 0;
+ sw_api_param_t *p = NULL;
+ static sw_api_param_t *savep = NULL;
+ static a_uint32_t save = 0;
+
+ p = sw_api_param_find(api_id);
+ if (!p)
+ {
+ return 0;
+ }
+
+ if (p == savep)
+ {
+ return save;
+ }
+
+ savep = p;
+ while (api_id == p->api_id)
+ {
+ p++;
+ i++;
+ }
+
+ /*error*/
+ if(i >= sizeof(sw_api_param)/sizeof(sw_api_param[0]))
+ {
+ savep = NULL;
+ save = 0;
+ return 0;
+ }
+ save = i;
+
+ return i;
+}
+
+sw_error_t
+sw_api_get(sw_api_t *sw_api)
+{
+ if(!sw_api)
+ return SW_FAIL;
+
+ if ((sw_api->api_fp = sw_api_func_find(sw_api->api_id)) == NULL)
+ return SW_NOT_SUPPORTED;
+
+ if ((sw_api->api_pp = sw_api_param_find(sw_api->api_id)) == NULL)
+ return SW_NOT_SUPPORTED;
+
+ if((sw_api->api_nr = sw_api_param_nums(sw_api->api_id)) == 0)
+ return SW_NOT_SUPPORTED;
+
+ return SW_OK;
+}
diff --git a/src/fal_uk/Makefile b/src/fal_uk/Makefile
new file mode 100755
index 0000000..66d4270
--- /dev/null
+++ b/src/fal_uk/Makefile
@@ -0,0 +1,92 @@
+LOC_DIR=src/fal_uk
+LIB=UK_IF
+
+include $(PRJ_PATH)/make/config.mk
+
+SRC_LIST=fal_init.c fal_uk_if.c fal_reg_access.c
+
+ifeq (TRUE, $(IN_ACL))
+ SRC_LIST += fal_acl.c
+endif
+
+ifeq (TRUE, $(IN_FDB))
+ SRC_LIST += fal_fdb.c
+endif
+
+ifeq (TRUE, $(IN_IGMP))
+ SRC_LIST += fal_igmp.c
+endif
+
+ifeq (TRUE, $(IN_LEAKY))
+ SRC_LIST += fal_leaky.c
+endif
+
+ifeq (TRUE, $(IN_LED))
+ SRC_LIST += fal_led.c
+endif
+
+ifeq (TRUE, $(IN_MIB))
+ SRC_LIST += fal_mib.c
+endif
+
+ifeq (TRUE, $(IN_MIRROR))
+ SRC_LIST += fal_mirror.c
+endif
+
+ifeq (TRUE, $(IN_MISC))
+ SRC_LIST += fal_misc.c
+endif
+
+ifeq (TRUE, $(IN_PORTCONTROL))
+ SRC_LIST += fal_port_ctrl.c
+endif
+
+ifeq (TRUE, $(IN_PORTVLAN))
+ SRC_LIST += fal_portvlan.c
+endif
+
+ifeq (TRUE, $(IN_QOS))
+ SRC_LIST += fal_qos.c
+endif
+
+ifeq (TRUE, $(IN_RATE))
+ SRC_LIST += fal_rate.c
+endif
+
+ifeq (TRUE, $(IN_STP))
+ SRC_LIST += fal_stp.c
+endif
+
+ifeq (TRUE, $(IN_VLAN))
+ SRC_LIST += fal_vlan.c
+endif
+
+ifeq (TRUE, $(IN_COSMAP))
+ SRC_LIST += fal_cosmap.c
+endif
+
+ifeq (TRUE, $(IN_IP))
+ SRC_LIST += fal_ip.c
+endif
+
+ifeq (TRUE, $(IN_NAT))
+ SRC_LIST += fal_nat.c
+endif
+
+ifeq (TRUE, $(IN_SEC))
+ SRC_LIST += fal_sec.c
+endif
+
+ifeq (TRUE, $(IN_TRUNK))
+ SRC_LIST += fal_trunk.c
+endif
+
+ifeq (TRUE, $(IN_INTERFACECONTROL))
+ SRC_LIST += fal_interface_ctrl.c
+endif
+
+include $(PRJ_PATH)/make/components.mk
+include $(PRJ_PATH)/make/defs.mk
+include $(PRJ_PATH)/make/target.mk
+
+all: dep obj
\ No newline at end of file
diff --git a/src/fal_uk/fal_acl.c b/src/fal_uk/fal_acl.c
new file mode 100755
index 0000000..cb5d979
--- /dev/null
+++ b/src/fal_uk/fal_acl.c
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#include "sw_ioctl.h"
+#include "fal_acl.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_acl_list_creat(a_uint32_t dev_id, a_uint32_t list_id, a_uint32_t prio)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_LIST_CREAT, dev_id, list_id, prio);
+ return rv;
+}
+
+sw_error_t
+fal_acl_list_destroy(a_uint32_t dev_id, a_uint32_t list_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_LIST_DESTROY, dev_id, list_id);
+ return rv;
+}
+
+sw_error_t
+fal_acl_rule_add(a_uint32_t dev_id, a_uint32_t list_id, a_uint32_t rule_id,
+ a_uint32_t rule_nr, fal_acl_rule_t * rule)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_RULE_ADD, dev_id, list_id, rule_id,
+ rule_nr, (a_uint32_t) rule);
+ return rv;
+}
+
+sw_error_t
+fal_acl_rule_delete(a_uint32_t dev_id, a_uint32_t list_id, a_uint32_t rule_id,
+ a_uint32_t rule_nr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_RULE_DELETE, dev_id, list_id, rule_id, rule_nr);
+ return rv;
+}
+
+sw_error_t
+fal_acl_rule_query(a_uint32_t dev_id, a_uint32_t list_id, a_uint32_t rule_id,
+ fal_acl_rule_t * rule)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_RULE_QUERY, dev_id, list_id, rule_id, (a_uint32_t) rule);
+ return rv;
+}
+
+sw_error_t
+fal_acl_list_bind(a_uint32_t dev_id, a_uint32_t list_id,
+ fal_acl_direc_t direc, fal_acl_bind_obj_t obj_t,
+ a_uint32_t obj_idx)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_LIST_BIND, dev_id, list_id, direc, obj_t, obj_idx);
+ return rv;
+}
+
+sw_error_t
+fal_acl_list_unbind(a_uint32_t dev_id, a_uint32_t list_id,
+ fal_acl_direc_t direc, fal_acl_bind_obj_t obj_t,
+ a_uint32_t obj_idx)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_LIST_UNBIND, dev_id, list_id, direc, obj_t, obj_idx);
+ return rv;
+}
+
+sw_error_t
+fal_acl_status_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_STATUS_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_acl_status_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_STATUS_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_acl_list_dump(a_uint32_t dev_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_LIST_DUMP, dev_id);
+ return rv;
+}
+
+sw_error_t
+fal_acl_rule_dump(a_uint32_t dev_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_RULE_DUMP, dev_id);
+ return rv;
+}
+
+sw_error_t
+fal_acl_port_udf_profile_set(a_uint32_t dev_id, fal_port_t port_id, fal_acl_udf_type_t udf_type, a_uint32_t offset, a_uint32_t length)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_PT_UDF_PROFILE_SET, dev_id, port_id, udf_type, offset, length);
+ return rv;
+}
+
+sw_error_t
+fal_acl_port_udf_profile_get(a_uint32_t dev_id, fal_port_t port_id, fal_acl_udf_type_t udf_type, a_uint32_t * offset, a_uint32_t * length)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_PT_UDF_PROFILE_GET, dev_id, port_id, udf_type, (a_uint32_t)offset, (a_uint32_t)length);
+ return rv;
+}
+
+sw_error_t
+fal_acl_rule_active(a_uint32_t dev_id, a_uint32_t list_id,
+ a_uint32_t rule_id, a_uint32_t rule_nr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_RULE_ACTIVE, dev_id, list_id, rule_id, rule_nr);
+ return rv;
+}
+
+sw_error_t
+fal_acl_rule_deactive(a_uint32_t dev_id, a_uint32_t list_id,
+ a_uint32_t rule_id, a_uint32_t rule_nr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_RULE_DEACTIVE, dev_id, list_id, rule_id, rule_nr);
+ return rv;
+}
+
+sw_error_t
+fal_acl_rule_src_filter_sts_set(a_uint32_t dev_id,
+ a_uint32_t rule_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_RULE_SRC_FILTER_STS_SET, dev_id, rule_id, enable);
+ return rv;
+}
+
+sw_error_t
+fal_acl_rule_src_filter_sts_get(a_uint32_t dev_id,
+ a_uint32_t rule_id, a_bool_t* enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ACL_RULE_SRC_FILTER_STS_GET, dev_id, rule_id, enable);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_cosmap.c b/src/fal_uk/fal_cosmap.c
new file mode 100755
index 0000000..28a541f
--- /dev/null
+++ b/src/fal_uk/fal_cosmap.c
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_cosmap.h"
+#include "fal_uk_if.h"
+
+
+sw_error_t
+fal_cosmap_dscp_to_pri_set(a_uint32_t dev_id, a_uint32_t dscp, a_uint32_t pri)
+{
+ sw_error_t rv;
+
+ rv= sw_uk_exec(SW_API_COSMAP_DSCP_TO_PRI_SET, dev_id, dscp, pri);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_dscp_to_pri_get(a_uint32_t dev_id, a_uint32_t dscp, a_uint32_t * pri)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_DSCP_TO_PRI_GET, dev_id, dscp, (a_uint32_t)pri);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_dscp_to_dp_set(a_uint32_t dev_id, a_uint32_t dscp, a_uint32_t dp)
+{
+ sw_error_t rv;
+
+ rv= sw_uk_exec(SW_API_COSMAP_DSCP_TO_DP_SET, dev_id, dscp, dp);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_dscp_to_dp_get(a_uint32_t dev_id, a_uint32_t dscp, a_uint32_t * dp)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_DSCP_TO_DP_GET, dev_id, dscp, (a_uint32_t)dp);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_up_to_pri_set(a_uint32_t dev_id, a_uint32_t up, a_uint32_t pri)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_UP_TO_PRI_SET, dev_id, up, pri);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_up_to_pri_get(a_uint32_t dev_id, a_uint32_t up, a_uint32_t * pri)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_UP_TO_PRI_GET, dev_id, up, (a_uint32_t)pri);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_up_to_dp_set(a_uint32_t dev_id, a_uint32_t up, a_uint32_t dp)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_UP_TO_DP_SET, dev_id, up, dp);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_up_to_dp_get(a_uint32_t dev_id, a_uint32_t up, a_uint32_t * dp)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_UP_TO_DP_GET, dev_id, up, (a_uint32_t)dp);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_pri_to_queue_set(a_uint32_t dev_id, a_uint32_t pri,
+ a_uint32_t queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_PRI_TO_QU_SET, dev_id, pri, queue);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_pri_to_queue_get(a_uint32_t dev_id, a_uint32_t pri,
+ a_uint32_t * queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_PRI_TO_QU_GET, dev_id, pri, (a_uint32_t)queue);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_pri_to_ehqueue_set(a_uint32_t dev_id, a_uint32_t pri,
+ a_uint32_t queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_PRI_TO_EHQU_SET, dev_id, pri, queue);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_pri_to_ehqueue_get(a_uint32_t dev_id, a_uint32_t pri,
+ a_uint32_t * queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_PRI_TO_EHQU_GET, dev_id, pri, (a_uint32_t)queue);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_egress_remark_set(a_uint32_t dev_id, a_uint32_t tbl_id,
+ fal_egress_remark_table_t * tbl)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_EG_REMARK_SET, dev_id, tbl_id, tbl);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_egress_remark_get(a_uint32_t dev_id, a_uint32_t tbl_id,
+ fal_egress_remark_table_t * tbl)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_EG_REMARK_GET, dev_id, tbl_id, tbl);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_fdb.c b/src/fal_uk/fal_fdb.c
new file mode 100755
index 0000000..eecbca7
--- /dev/null
+++ b/src/fal_uk/fal_fdb.c
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_fdb.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_fdb_add(a_uint32_t dev_id, const fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_ADD, dev_id, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_del_all(a_uint32_t dev_id, a_uint32_t flag)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_DELALL, dev_id, flag);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_del_by_port(a_uint32_t dev_id, fal_port_t port_id, a_uint32_t flag)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_DELPORT, dev_id, port_id, flag);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_del_by_mac(a_uint32_t dev_id, const fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_DELMAC, dev_id, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_first(a_uint32_t dev_id, fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_FIRST, dev_id, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_next(a_uint32_t dev_id, fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_NEXT, dev_id, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_find(a_uint32_t dev_id, fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_FIND, dev_id, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_port_learn_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_PT_LEARN_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_port_learn_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_PT_LEARN_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_age_ctrl_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_AGE_CTRL_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_age_ctrl_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_AGE_CTRL_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_vlan_ivl_svl_set(a_uint32_t dev_id, fal_fdb_smode smode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_VLAN_IVL_SVL_SET, dev_id, (a_uint32_t) smode);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_vlan_ivl_svl_get(a_uint32_t dev_id, fal_fdb_smode* smode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_VLAN_IVL_SVL_GET, dev_id, (a_uint32_t) smode);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_age_time_set(a_uint32_t dev_id, a_uint32_t * time)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_AGE_TIME_SET, dev_id, (a_uint32_t) time);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_age_time_get(a_uint32_t dev_id, a_uint32_t * time)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_AGE_TIME_GET, dev_id, (a_uint32_t) time);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_iterate(a_uint32_t dev_id, a_uint32_t * iterator, fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_ITERATE, dev_id, (a_uint32_t) iterator, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_extend_next(a_uint32_t dev_id, fal_fdb_op_t * option,
+ fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_EXTEND_NEXT, dev_id, (a_uint32_t)option, (a_uint32_t)entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_extend_first(a_uint32_t dev_id, fal_fdb_op_t * option,
+ fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_EXTEND_FIRST, dev_id, (a_uint32_t)option, (a_uint32_t)entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_transfer(a_uint32_t dev_id, fal_port_t old_port, fal_port_t new_port,
+ a_uint32_t fid, fal_fdb_op_t * option)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_TRANSFER, dev_id, old_port, new_port, fid, (a_uint32_t)option);
+ return rv;
+}
+
+sw_error_t
+fal_port_fdb_learn_limit_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable, a_uint32_t cnt)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FDB_LEARN_LIMIT_SET, dev_id, port_id, enable, cnt);
+ return rv;
+}
+
+sw_error_t
+fal_port_fdb_learn_limit_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable, a_uint32_t * cnt)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FDB_LEARN_LIMIT_GET, dev_id, port_id, (a_uint32_t)enable, (a_uint32_t)cnt);
+ return rv;
+}
+
+sw_error_t
+fal_port_fdb_learn_exceed_cmd_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FDB_LEARN_EXCEED_CMD_SET, dev_id, port_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_port_fdb_learn_exceed_cmd_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FDB_LEARN_EXCEED_CMD_GET, dev_id, port_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_learn_limit_set(a_uint32_t dev_id, a_bool_t enable, a_uint32_t cnt)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_LEARN_LIMIT_SET, dev_id, enable, cnt);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_learn_limit_get(a_uint32_t dev_id, a_bool_t * enable, a_uint32_t * cnt)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_LEARN_LIMIT_GET, dev_id, (a_uint32_t)enable, (a_uint32_t)cnt);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_learn_exceed_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_LEARN_EXCEED_CMD_SET, dev_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_learn_exceed_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_LEARN_EXCEED_CMD_GET, dev_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_resv_add(a_uint32_t dev_id, fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_RESV_ADD, dev_id, (a_uint32_t)entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_resv_del(a_uint32_t dev_id, fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_RESV_DEL, dev_id, (a_uint32_t)entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_resv_find(a_uint32_t dev_id, fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_RESV_FIND, dev_id, (a_uint32_t)entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_resv_iterate(a_uint32_t dev_id, a_uint32_t * iterator, fal_fdb_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_RESV_ITERATE, dev_id, (a_uint32_t)iterator, (a_uint32_t)entry);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_port_learn_static_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_PT_LEARN_STATIC_SET, dev_id, port_id, enable);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_port_learn_static_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_PT_LEARN_STATIC_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_port_add(a_uint32_t dev_id, a_uint32_t fid, fal_mac_addr_t * addr, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_PORT_ADD, dev_id, fid, addr, port_id);
+ return rv;
+}
+
+sw_error_t
+fal_fdb_port_del(a_uint32_t dev_id, a_uint32_t fid, fal_mac_addr_t * addr, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FDB_PORT_DEL, dev_id, fid, addr, port_id);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_igmp.c b/src/fal_uk/fal_igmp.c
new file mode 100755
index 0000000..d77733a
--- /dev/null
+++ b/src/fal_uk/fal_igmp.c
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_igmp.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_port_igmps_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_IGMPS_MODE_SET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_igmps_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_IGMPS_MODE_GET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_MLD_CMD_SET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_MLD_CMD_GET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_port_igmp_mld_join_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_PT_JOIN_SET, dev_id, (a_uint32_t) port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_igmp_mld_join_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_PT_JOIN_GET, dev_id, (a_uint32_t) port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_igmp_mld_leave_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_PT_LEAVE_SET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_igmp_mld_leave_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_PT_LEAVE_GET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_rp_set(a_uint32_t dev_id, fal_pbmp_t pts)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_RP_SET, dev_id, (a_uint32_t) pts);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_rp_get(a_uint32_t dev_id, fal_pbmp_t * pts)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_RP_GET, dev_id, (a_uint32_t) pts);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_creat_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_CREAT_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_creat_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_CREAT_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_static_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_STATIC_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_static_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_STATIC_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_leaky_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_LEAKY_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_leaky_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_LEAKY_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_v3_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_V3_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_v3_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_V3_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_queue_set(a_uint32_t dev_id, a_bool_t enable, a_uint32_t queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_QUEUE_SET, dev_id, (a_uint32_t)enable, (a_uint32_t)queue);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_mld_entry_queue_get(a_uint32_t dev_id, a_bool_t * enable, a_uint32_t * queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_ENTRY_QUEUE_GET, dev_id, (a_uint32_t)enable, (a_uint32_t)queue);
+ return rv;
+}
+
+sw_error_t
+fal_port_igmp_mld_learn_limit_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable, a_uint32_t cnt)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_IGMP_LEARN_LIMIT_SET, dev_id, port_id, enable, cnt);
+ return rv;
+}
+
+sw_error_t
+fal_port_igmp_mld_learn_limit_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable, a_uint32_t * cnt)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_IGMP_LEARN_LIMIT_GET, dev_id, port_id, (a_uint32_t)enable, (a_uint32_t)cnt);
+ return rv;
+}
+
+sw_error_t
+fal_port_igmp_mld_learn_exceed_cmd_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_IGMP_LEARN_EXCEED_CMD_SET, dev_id, port_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_port_igmp_mld_learn_exceed_cmd_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_IGMP_LEARN_EXCEED_CMD_GET, dev_id, port_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_sg_entry_set(a_uint32_t dev_id, fal_igmp_sg_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_SG_ENTRY_SET, dev_id, entry);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_sg_entry_clear(a_uint32_t dev_id, fal_igmp_sg_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_SG_ENTRY_CLEAR, dev_id, entry);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_sg_entry_show(a_uint32_t dev_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_SG_ENTRY_SHOW, dev_id);
+ return rv;
+}
+
+sw_error_t
+fal_igmp_sg_entry_query(a_uint32_t dev_id, fal_igmp_sg_info_t * info)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IGMP_SG_ENTRY_QUERY, dev_id, info);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_init.c b/src/fal_uk/fal_init.c
new file mode 100755
index 0000000..9579fe5
--- /dev/null
+++ b/src/fal_uk/fal_init.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "ssdk_init.h"
+#include "fal_init.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_reset(a_uint32_t dev_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_SWITCH_RESET, dev_id);
+ return rv;
+}
+
+sw_error_t
+fal_ssdk_cfg(a_uint32_t dev_id, ssdk_cfg_t *ssdk_cfg)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_SSDK_CFG, dev_id, ssdk_cfg);
+ return rv;
+}
diff --git a/src/fal_uk/fal_interface_ctrl.c b/src/fal_uk/fal_interface_ctrl.c
new file mode 100755
index 0000000..b650272
--- /dev/null
+++ b/src/fal_uk/fal_interface_ctrl.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_interface_ctrl.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_port_3az_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PORT_3AZ_STATUS_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_3az_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PORT_3AZ_STATUS_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_interface_mac_mode_set(a_uint32_t dev_id, fal_port_t port_id, fal_mac_config_t * config)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MAC_MODE_SET, dev_id, port_id, (a_uint32_t)config);
+ return rv;
+}
+
+sw_error_t
+fal_interface_mac_mode_get(a_uint32_t dev_id, fal_port_t port_id, fal_mac_config_t * config)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MAC_MODE_GET, dev_id, port_id, (a_uint32_t)config);
+ return rv;
+}
+
+sw_error_t
+fal_interface_phy_mode_set(a_uint32_t dev_id, a_uint32_t phy_id, fal_phy_config_t * config)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PHY_MODE_SET, dev_id, phy_id, (a_uint32_t)config);
+ return rv;
+}
+
+sw_error_t
+fal_interface_phy_mode_get(a_uint32_t dev_id, a_uint32_t phy_id, fal_phy_config_t * config)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PHY_MODE_GET, dev_id, phy_id, (a_uint32_t)config);
+ return rv;
+}
+
+sw_error_t
+fal_interface_fx100_ctrl_set(a_uint32_t dev_id, fal_fx100_ctrl_config_t * config)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FX100_CTRL_SET, dev_id, (a_uint32_t)config);
+ return rv;
+}
+
+sw_error_t
+fal_interface_fx100_ctrl_get(a_uint32_t dev_id, fal_fx100_ctrl_config_t * config)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FX100_CTRL_GET, dev_id, (a_uint32_t)config);
+ return rv;
+}
+
+sw_error_t
+fal_interface_fx100_status_get(a_uint32_t dev_id, a_uint32_t *status)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FX100_STATUS_GET, dev_id, (a_uint32_t)status);
+ return rv;
+}
+
+sw_error_t
+fal_interface_mac06_exch_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MAC06_EXCH_SET, dev_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_interface_mac06_exch_get(a_uint32_t dev_id, a_bool_t* enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MAC06_EXCH_GET, dev_id, (a_uint32_t)enable);
+ return rv;
+}
diff --git a/src/fal_uk/fal_ip.c b/src/fal_uk/fal_ip.c
new file mode 100755
index 0000000..369c630
--- /dev/null
+++ b/src/fal_uk/fal_ip.c
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_ip.h"
+#include "fal_uk_if.h"
+
+
+sw_error_t
+fal_ip_host_add(a_uint32_t dev_id, fal_host_entry_t * host_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_HOST_ADD, dev_id, (a_uint32_t) host_entry);
+ return rv;
+}
+
+sw_error_t
+fal_ip_host_del(a_uint32_t dev_id, a_uint32_t del_mode, fal_host_entry_t * host_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_HOST_DEL, dev_id, del_mode, (a_uint32_t) host_entry);
+ return rv;
+}
+
+sw_error_t
+fal_ip_host_get(a_uint32_t dev_id, a_uint32_t get_mode, fal_host_entry_t * host_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_HOST_GET, dev_id, get_mode, (a_uint32_t) host_entry);
+ return rv;
+}
+
+sw_error_t
+fal_ip_host_next(a_uint32_t dev_id, a_uint32_t next_mode, fal_host_entry_t * host_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_HOST_NEXT, dev_id, next_mode, (a_uint32_t) host_entry);
+ return rv;
+}
+
+sw_error_t
+fal_ip_host_counter_bind(a_uint32_t dev_id, a_uint32_t entry_id, a_uint32_t cnt_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_HOST_COUNTER_BIND, dev_id, entry_id, cnt_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_ip_host_pppoe_bind(a_uint32_t dev_id, a_uint32_t entry_id, a_uint32_t pppoe_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_HOST_PPPOE_BIND, dev_id, entry_id, pppoe_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_ip_pt_arp_learn_set(a_uint32_t dev_id, fal_port_t port_id, a_uint32_t flags)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_PT_ARP_LEARN_SET, dev_id, port_id, flags);
+ return rv;
+}
+
+sw_error_t
+fal_ip_pt_arp_learn_get(a_uint32_t dev_id, fal_port_t port_id, a_uint32_t * flags)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_PT_ARP_LEARN_GET, dev_id, port_id, (a_uint32_t)flags);
+ return rv;
+}
+
+sw_error_t
+fal_ip_arp_learn_set(a_uint32_t dev_id, fal_arp_learn_mode_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_ARP_LEARN_SET, dev_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_ip_arp_learn_get(a_uint32_t dev_id, fal_arp_learn_mode_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_ARP_LEARN_GET, dev_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_ip_source_guard_set(a_uint32_t dev_id, fal_port_t port_id, fal_source_guard_mode_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_SOURCE_GUARD_SET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_ip_source_guard_get(a_uint32_t dev_id, fal_port_t port_id, fal_source_guard_mode_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_SOURCE_GUARD_GET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_ip_arp_guard_set(a_uint32_t dev_id, fal_port_t port_id, fal_source_guard_mode_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_ARP_GUARD_SET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_ip_arp_guard_get(a_uint32_t dev_id, fal_port_t port_id, fal_source_guard_mode_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_ARP_GUARD_GET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_ip_route_status_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_ROUTE_STATUS_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_ip_route_status_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_ROUTE_STATUS_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_ip_intf_entry_add(a_uint32_t dev_id, fal_intf_mac_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_INTF_ENTRY_ADD, dev_id, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_ip_intf_entry_del(a_uint32_t dev_id, a_uint32_t del_mode, fal_intf_mac_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_INTF_ENTRY_DEL, dev_id, del_mode, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_ip_intf_entry_next(a_uint32_t dev_id, a_uint32_t next_mode, fal_intf_mac_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_INTF_ENTRY_NEXT, dev_id, next_mode, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_ip_unk_source_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_UNK_SOURCE_CMD_SET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_ip_unk_source_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_UNK_SOURCE_CMD_GET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_arp_unk_source_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ARP_UNK_SOURCE_CMD_SET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_arp_unk_source_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ARP_UNK_SOURCE_CMD_GET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_ip_age_time_set(a_uint32_t dev_id, a_uint32_t * time)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_AGE_TIME_SET, dev_id, (a_uint32_t) time);
+ return rv;
+}
+
+sw_error_t
+fal_ip_age_time_get(a_uint32_t dev_id, a_uint32_t * time)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_IP_AGE_TIME_GET, dev_id, (a_uint32_t) time);
+ return rv;
+}
+
+sw_error_t
+fal_ip_wcmp_hash_mode_set(a_uint32_t dev_id, a_uint32_t hash_mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_WCMP_HASH_MODE_SET, dev_id, hash_mode);
+ return rv;
+}
+
+sw_error_t
+fal_ip_wcmp_hash_mode_get(a_uint32_t dev_id, a_uint32_t * hash_mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_WCMP_HASH_MODE_GET, dev_id, (a_uint32_t) hash_mode);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_leaky.c b/src/fal_uk/fal_leaky.c
new file mode 100755
index 0000000..7580273
--- /dev/null
+++ b/src/fal_uk/fal_leaky.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_leaky.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_uc_leaky_mode_set(a_uint32_t dev_id, fal_leaky_ctrl_mode_t ctrl_mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_UC_LEAKY_MODE_SET, dev_id, (a_uint32_t) ctrl_mode);
+ return rv;
+}
+
+sw_error_t
+fal_uc_leaky_mode_get(a_uint32_t dev_id, fal_leaky_ctrl_mode_t * ctrl_mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_UC_LEAKY_MODE_GET, dev_id, (a_uint32_t) ctrl_mode);
+ return rv;
+}
+
+sw_error_t
+fal_mc_leaky_mode_set(a_uint32_t dev_id, fal_leaky_ctrl_mode_t ctrl_mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MC_LEAKY_MODE_SET, dev_id, (a_uint32_t) ctrl_mode);
+ return rv;
+}
+
+sw_error_t
+fal_mc_leaky_mode_get(a_uint32_t dev_id, fal_leaky_ctrl_mode_t * ctrl_mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MC_LEAKY_MODE_GET, dev_id, (a_uint32_t) ctrl_mode);
+ return rv;
+}
+
+sw_error_t
+fal_port_arp_leaky_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ARP_LEAKY_MODE_SET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_arp_leaky_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ARP_LEAKY_MODE_GET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_uc_leaky_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_UC_LEAKY_MODE_SET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_uc_leaky_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_UC_LEAKY_MODE_GET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_mc_leaky_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_MC_LEAKY_MODE_SET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_mc_leaky_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_MC_LEAKY_MODE_GET, dev_id, (a_uint32_t) port_id, (a_uint32_t) enable);
+ return rv;
+}
diff --git a/src/fal_uk/fal_led.c b/src/fal_uk/fal_led.c
new file mode 100755
index 0000000..ad03467
--- /dev/null
+++ b/src/fal_uk/fal_led.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_led.h"
+#include "fal_uk_if.h"
+
+
+sw_error_t
+fal_led_ctrl_pattern_set(a_uint32_t dev_id, led_pattern_group_t group,
+ led_pattern_id_t id, led_ctrl_pattern_t * pattern)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_LED_PATTERN_SET, dev_id, (a_uint32_t)group,
+ (a_uint32_t)id, (a_uint32_t)pattern);
+ return rv;
+}
+
+sw_error_t
+fal_led_ctrl_pattern_get(a_uint32_t dev_id, led_pattern_group_t group,
+ led_pattern_id_t id, led_ctrl_pattern_t * pattern)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_LED_PATTERN_GET, dev_id, (a_uint32_t)group,
+ (a_uint32_t)id, (a_uint32_t)pattern);
+ return rv;
+}
diff --git a/src/fal_uk/fal_mib.c b/src/fal_uk/fal_mib.c
new file mode 100755
index 0000000..2e7e44a
--- /dev/null
+++ b/src/fal_uk/fal_mib.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_mib.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_get_mib_info(a_uint32_t dev_id, fal_port_t port_id,
+ fal_mib_info_t * mib_Info)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_MIB_GET, dev_id, port_id,
+ (a_uint32_t) mib_Info);
+ return rv;
+}
+
+sw_error_t
+fal_mib_status_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIB_STATUS_SET, dev_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_mib_status_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIB_STATUS_GET, dev_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_mib_port_flush_counters(a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_MIB_FLUSH_COUNTERS, dev_id, port_id);
+ return rv;
+}
+
+sw_error_t
+fal_mib_cpukeep_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIB_CPU_KEEP_SET, dev_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_mib_cpukeep_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIB_CPU_KEEP_GET, dev_id, (a_uint32_t)enable);
+ return rv;
+}
\ No newline at end of file
diff --git a/src/fal_uk/fal_mirror.c b/src/fal_uk/fal_mirror.c
new file mode 100755
index 0000000..79e8f6e
--- /dev/null
+++ b/src/fal_uk/fal_mirror.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_mirror.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_mirr_analysis_port_set(a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIRROR_ANALY_PT_SET, dev_id, port_id);
+ return rv;
+}
+
+sw_error_t
+fal_mirr_analysis_port_get(a_uint32_t dev_id, fal_port_t * port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIRROR_ANALY_PT_GET, dev_id,
+ (a_uint32_t) port_id);
+ return rv;
+}
+
+sw_error_t
+fal_mirr_port_in_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIRROR_IN_PT_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_mirr_port_in_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIRROR_IN_PT_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_mirr_port_eg_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIRROR_EG_PT_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_mirr_port_eg_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_MIRROR_EG_PT_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
diff --git a/src/fal_uk/fal_misc.c b/src/fal_uk/fal_misc.c
new file mode 100755
index 0000000..6ba7deb
--- /dev/null
+++ b/src/fal_uk/fal_misc.c
@@ -0,0 +1,555 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_misc.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_arp_status_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ARP_STATUS_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_arp_status_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ARP_STATUS_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_frame_max_size_set(a_uint32_t dev_id, a_uint32_t size)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FRAME_MAX_SIZE_SET, dev_id, size);
+ return rv;
+}
+
+sw_error_t
+fal_frame_max_size_get(a_uint32_t dev_id, a_uint32_t * size)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_FRAME_MAX_SIZE_GET, dev_id, (a_uint32_t) size);
+ return rv;
+}
+
+sw_error_t
+fal_port_unk_sa_cmd_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_UNK_SA_CMD_SET, dev_id, port_id,
+ (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_port_unk_sa_cmd_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_UNK_SA_CMD_GET, dev_id, port_id,
+ (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_port_unk_uc_filter_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_UNK_UC_FILTER_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_unk_uc_filter_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_UNK_UC_FILTER_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_unk_mc_filter_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_UNK_MC_FILTER_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_unk_mc_filter_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_UNK_MC_FILTER_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_bc_filter_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_BC_FILTER_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_bc_filter_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_BC_FILTER_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_cpu_port_status_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_CPU_PORT_STATUS_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_cpu_port_status_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_CPU_PORT_STATUS_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_bc_to_cpu_port_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_BC_TO_CPU_PORT_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_bc_to_cpu_port_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_BC_TO_CPU_PORT_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_CMD_SET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_CMD_GET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_status_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_STATUS_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_status_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_STATUS_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_dhcp_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DHCP_SET, dev_id, (a_uint32_t)port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_dhcp_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DHCP_GET, dev_id, (a_uint32_t)port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_arp_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ARP_CMD_SET, dev_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_arp_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_ARP_CMD_GET, dev_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_eapol_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_EAPOL_CMD_SET, dev_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_eapol_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_EAPOL_CMD_GET, dev_id, (a_uint32_t)cmd);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_session_add(a_uint32_t dev_id, a_uint32_t session_id, a_bool_t strip_hdr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_SESSION_ADD, dev_id, session_id, (a_uint32_t)strip_hdr);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_session_del(a_uint32_t dev_id, a_uint32_t session_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_SESSION_DEL, dev_id, session_id);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_session_get(a_uint32_t dev_id, a_uint32_t session_id, a_bool_t * strip_hdr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_SESSION_GET, dev_id, session_id, (a_uint32_t)strip_hdr);
+ return rv;
+}
+
+sw_error_t
+fal_eapol_status_set(a_uint32_t dev_id, a_uint32_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_EAPOL_STATUS_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_eapol_status_get(a_uint32_t dev_id, a_uint32_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_EAPOL_STATUS_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_ripv1_status_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RIPV1_STATUS_SET, dev_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_ripv1_status_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RIPV1_STATUS_GET, dev_id, (a_uint32_t)enable);
+ return rv;
+}
+
+
+sw_error_t
+fal_port_arp_req_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_ARP_REQ_STATUS_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+
+sw_error_t
+fal_port_arp_req_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_ARP_REQ_STATUS_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+
+sw_error_t
+fal_port_arp_ack_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_ARP_ACK_STATUS_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_arp_ack_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_ARP_ACK_STATUS_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_session_table_add(a_uint32_t dev_id, fal_pppoe_session_t * session_tbl)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_SESSION_TABLE_ADD, dev_id, (a_uint32_t)session_tbl);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_session_table_del(a_uint32_t dev_id, fal_pppoe_session_t * session_tbl)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_SESSION_TABLE_DEL, dev_id, (a_uint32_t)session_tbl);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_session_table_get(a_uint32_t dev_id, fal_pppoe_session_t * session_tbl)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_SESSION_TABLE_GET, dev_id, (a_uint32_t)session_tbl);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_session_id_set(a_uint32_t dev_id, a_uint32_t index,
+ a_uint32_t id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_SESSION_ID_SET, dev_id, index, id);
+ return rv;
+}
+
+sw_error_t
+fal_pppoe_session_id_get(a_uint32_t dev_id, a_uint32_t index,
+ a_uint32_t * id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PPPOE_SESSION_ID_GET, dev_id, index, (a_uint32_t)id);
+ return rv;
+}
+
+sw_error_t
+fal_intr_mask_set(a_uint32_t dev_id, a_uint32_t intr_mask)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_MASK_SET, dev_id, intr_mask);
+ return rv;
+}
+
+sw_error_t
+fal_intr_mask_get(a_uint32_t dev_id, a_uint32_t * intr_mask)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_MASK_GET, dev_id, (a_uint32_t)intr_mask);
+ return rv;
+}
+
+sw_error_t
+fal_intr_status_get(a_uint32_t dev_id, a_uint32_t * intr_status)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_STATUS_GET, dev_id, (a_uint32_t)intr_status);
+ return rv;
+}
+
+sw_error_t
+fal_intr_status_clear(a_uint32_t dev_id, a_uint32_t intr_status)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_STATUS_CLEAR, dev_id, intr_status);
+ return rv;
+}
+
+sw_error_t
+fal_intr_port_link_mask_set(a_uint32_t dev_id, a_uint32_t port_id, a_uint32_t intr_mask)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_PORT_LINK_MASK_SET, dev_id, port_id, intr_mask);
+ return rv;
+}
+
+sw_error_t
+fal_intr_port_link_mask_get(a_uint32_t dev_id, a_uint32_t port_id, a_uint32_t * intr_mask)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_PORT_LINK_MASK_GET, dev_id, port_id, (a_uint32_t)intr_mask);
+ return rv;
+}
+
+sw_error_t
+fal_intr_port_link_status_get(a_uint32_t dev_id, a_uint32_t port_id, a_uint32_t * intr_mask)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_PORT_LINK_STATUS_GET, dev_id, port_id, (a_uint32_t)intr_mask);
+ return rv;
+}
+
+sw_error_t
+fal_intr_mask_mac_linkchg_set(a_uint32_t dev_id, a_uint32_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_MASK_MAC_LINKCHG_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+
+sw_error_t
+fal_intr_mask_mac_linkchg_get(a_uint32_t dev_id, a_uint32_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_MASK_MAC_LINKCHG_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_intr_status_mac_linkchg_get(a_uint32_t dev_id, fal_pbmp_t *port_bitmap)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_STATUS_MAC_LINKCHG_GET, dev_id, (a_uint32_t)port_bitmap);
+ return rv;
+}
+
+sw_error_t
+fal_cpu_vid_en_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_CPU_VID_EN_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_cpu_vid_en_get(a_uint32_t dev_id, a_bool_t *enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_CPU_VID_EN_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_rtd_pppoe_en_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RTD_PPPOE_EN_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_rtd_pppoe_en_get(a_uint32_t dev_id, a_bool_t *enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RTD_PPPOE_EN_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_intr_status_mac_linkchg_clear(a_uint32_t dev_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_INTR_STATUS_MAC_LINKCHG_CLEAR, dev_id);
+ return rv;
+}
\ No newline at end of file
diff --git a/src/fal_uk/fal_nat.c b/src/fal_uk/fal_nat.c
new file mode 100755
index 0000000..9ebe0b6
--- /dev/null
+++ b/src/fal_uk/fal_nat.c
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_nat.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_nat_add(a_uint32_t dev_id, fal_nat_entry_t * nat_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_ADD, dev_id, (a_uint32_t) nat_entry);
+ return rv;
+}
+
+
+sw_error_t
+fal_nat_del(a_uint32_t dev_id, a_uint32_t del_mode, fal_nat_entry_t * nat_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_DEL, dev_id, del_mode, (a_uint32_t) nat_entry);
+ return rv;
+}
+
+
+sw_error_t
+fal_nat_get(a_uint32_t dev_id, a_uint32_t get_mode, fal_nat_entry_t * nat_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_GET, dev_id, get_mode, (a_uint32_t) nat_entry);
+ return rv;
+}
+
+sw_error_t
+fal_nat_next(a_uint32_t dev_id, a_uint32_t next_mode, fal_nat_entry_t * nat_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_NEXT, dev_id, next_mode, (a_uint32_t) nat_entry);
+ return rv;
+}
+
+sw_error_t
+fal_nat_counter_bind(a_uint32_t dev_id, a_uint32_t entry_id, a_uint32_t cnt_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_COUNTER_BIND, dev_id, entry_id, cnt_id, (a_uint32_t) enable);
+ return rv;
+}
+
+
+sw_error_t
+fal_napt_add(a_uint32_t dev_id, fal_napt_entry_t * napt_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAPT_ADD, dev_id, (a_uint32_t) napt_entry);
+ return rv;
+}
+
+sw_error_t
+fal_napt_del(a_uint32_t dev_id, a_uint32_t del_mode, fal_napt_entry_t * napt_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAPT_DEL, dev_id, del_mode, (a_uint32_t) napt_entry);
+ return rv;
+}
+
+sw_error_t
+fal_napt_get(a_uint32_t dev_id, a_uint32_t get_mode, fal_napt_entry_t * napt_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAPT_GET, dev_id, get_mode, (a_uint32_t) napt_entry);
+ return rv;
+}
+
+sw_error_t
+fal_napt_next(a_uint32_t dev_id, a_uint32_t next_mode, fal_napt_entry_t * napt_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAPT_NEXT, dev_id, next_mode, (a_uint32_t) napt_entry);
+ return rv;
+}
+
+sw_error_t
+fal_napt_counter_bind(a_uint32_t dev_id, a_uint32_t entry_id, a_uint32_t cnt_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAPT_COUNTER_BIND, dev_id, entry_id, cnt_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_nat_status_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_STATUS_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_nat_status_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_STATUS_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_nat_hash_mode_set(a_uint32_t dev_id, a_uint32_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_HASH_MODE_SET, dev_id, mode);
+ return rv;
+}
+
+sw_error_t
+fal_nat_hash_mode_get(a_uint32_t dev_id, a_uint32_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_HASH_MODE_GET, dev_id, (a_uint32_t) mode);
+ return rv;
+}
+
+sw_error_t
+fal_napt_status_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAPT_STATUS_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_napt_status_get(a_uint32_t dev_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAPT_STATUS_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_napt_mode_set(a_uint32_t dev_id, fal_napt_mode_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAPT_MODE_SET, dev_id, (a_uint32_t) mode);
+ return rv;
+}
+
+sw_error_t
+fal_napt_mode_get(a_uint32_t dev_id, fal_napt_mode_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAPT_MODE_GET, dev_id, (a_uint32_t) mode);
+ return rv;
+}
+
+sw_error_t
+fal_nat_prv_base_addr_set(a_uint32_t dev_id, fal_ip4_addr_t addr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PRV_BASE_ADDR_SET, dev_id, (a_uint32_t) addr);
+ return rv;
+}
+
+sw_error_t
+fal_nat_prv_base_addr_get(a_uint32_t dev_id, fal_ip4_addr_t * addr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PRV_BASE_ADDR_GET, dev_id, (a_uint32_t) addr);
+ return rv;
+}
+
+sw_error_t
+fal_nat_prv_base_mask_set(a_uint32_t dev_id, fal_ip4_addr_t addr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PRV_BASE_MASK_SET, dev_id, (a_uint32_t) addr);
+ return rv;
+}
+
+sw_error_t
+fal_nat_prv_base_mask_get(a_uint32_t dev_id, fal_ip4_addr_t * addr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PRV_BASE_MASK_GET, dev_id, (a_uint32_t) addr);
+ return rv;
+}
+
+sw_error_t
+fal_nat_prv_addr_mode_set(a_uint32_t dev_id, a_bool_t map_en)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PRV_ADDR_MODE_SET, dev_id, (a_uint32_t) map_en);
+ return rv;
+}
+
+sw_error_t
+fal_nat_prv_addr_mode_get(a_uint32_t dev_id, a_bool_t * map_en)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PRV_ADDR_MODE_GET, dev_id, (a_uint32_t) map_en);
+ return rv;
+}
+
+sw_error_t
+fal_nat_pub_addr_add(a_uint32_t dev_id, fal_nat_pub_addr_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PUB_ADDR_ENTRY_ADD, dev_id, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_nat_pub_addr_del(a_uint32_t dev_id, a_uint32_t del_mode, fal_nat_pub_addr_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PUB_ADDR_ENTRY_DEL, dev_id, del_mode, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_nat_pub_addr_next(a_uint32_t dev_id, a_uint32_t next_mode, fal_nat_pub_addr_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PUB_ADDR_ENTRY_NEXT, dev_id, next_mode, (a_uint32_t) entry);
+ return rv;
+}
+
+sw_error_t
+fal_nat_unk_session_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_UNK_SESSION_CMD_SET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_nat_unk_session_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_UNK_SESSION_CMD_GET, dev_id, (a_uint32_t) cmd);
+ return rv;
+}
+
+sw_error_t
+fal_nat_global_set(a_uint32_t dev_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NAT_GLOBAL_SET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
diff --git a/src/fal_uk/fal_port_ctrl.c b/src/fal_uk/fal_port_ctrl.c
new file mode 100755
index 0000000..40d8911
--- /dev/null
+++ b/src/fal_uk/fal_port_ctrl.c
@@ -0,0 +1,423 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_port_ctrl.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_port_duplex_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_duplex_t duplex)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DUPLEX_SET, dev_id, port_id,
+ (a_uint32_t) duplex);
+ return rv;
+}
+
+sw_error_t
+fal_port_duplex_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_duplex_t * pduplex)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DUPLEX_GET, dev_id, port_id,
+ (a_uint32_t) pduplex);
+ return rv;
+}
+
+sw_error_t
+fal_port_speed_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_speed_t speed)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_SPEED_SET, dev_id, port_id,
+ (a_uint32_t) speed);
+ return rv;
+}
+
+sw_error_t
+fal_port_speed_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_speed_t * pspeed)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_SPEED_GET, dev_id, port_id,
+ (a_uint32_t) pspeed);
+ return rv;
+}
+
+sw_error_t
+fal_port_autoneg_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * status)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_AN_GET, dev_id, port_id, (a_uint32_t) status);
+ return rv;
+}
+
+sw_error_t
+fal_port_autoneg_enable(a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_AN_ENABLE, dev_id, port_id);
+ return rv;
+}
+
+sw_error_t
+fal_port_autoneg_restart(a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_AN_RESTART, dev_id, port_id);
+ return rv;
+}
+
+sw_error_t
+fal_port_autoneg_adv_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t autoadv)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_AN_ADV_SET, dev_id, port_id, autoadv);
+ return rv;
+}
+
+sw_error_t
+fal_port_autoneg_adv_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * autoadv)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_AN_ADV_GET, dev_id, port_id,
+ (a_uint32_t) autoadv);
+ return rv;
+}
+
+sw_error_t
+fal_port_hdr_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_HDR_SET, dev_id, port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_hdr_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_HDR_GET, dev_id, port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_flowctrl_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FLOWCTRL_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_flowctrl_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FLOWCTRL_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_flowctrl_forcemode_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FLOWCTRL_MODE_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_flowctrl_forcemode_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FLOWCTRL_MODE_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_powersave_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_POWERSAVE_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_powersave_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_POWERSAVE_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_hibernate_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_HIBERNATE_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_hibernate_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_HIBERNATE_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_cdt(a_uint32_t dev_id, fal_port_t port_id, a_uint32_t mdi_pair,
+ a_uint32_t *cable_status, a_uint32_t *cable_len)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_CDT, dev_id, port_id, mdi_pair,
+ (a_uint32_t) cable_status, (a_uint32_t)cable_len);
+ return rv;
+}
+
+sw_error_t
+fal_port_rxhdr_mode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_header_mode_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_RXHDR_SET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_port_rxhdr_mode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_header_mode_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_RXHDR_GET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_port_txhdr_mode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_header_mode_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_TXHDR_SET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_port_txhdr_mode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_header_mode_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_TXHDR_GET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_header_type_set(a_uint32_t dev_id, a_bool_t enable, a_uint32_t type)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_HEADER_TYPE_SET, dev_id, (a_uint32_t)enable, type);
+ return rv;
+}
+
+sw_error_t
+fal_header_type_get(a_uint32_t dev_id, a_bool_t * enable, a_uint32_t * type)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_HEADER_TYPE_GET, dev_id, (a_uint32_t)enable, (a_uint32_t)type);
+ return rv;
+}
+
+sw_error_t
+fal_port_txmac_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TXMAC_STATUS_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_txmac_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TXMAC_STATUS_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_rxmac_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RXMAC_STATUS_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_rxmac_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RXMAC_STATUS_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_txfc_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TXFC_STATUS_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_txfc_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TXFC_STATUS_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_rxfc_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RXFC_STATUS_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_rxfc_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RXFC_STATUS_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_bp_status_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_BP_STATUS_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_bp_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_BP_STATUS_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_link_forcemode_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_LINK_MODE_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_link_forcemode_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_LINK_MODE_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_link_status_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * status)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_LINK_STATUS_GET, dev_id, port_id, (a_uint32_t)status);
+ return rv;
+}
+
+sw_error_t
+fal_port_mac_loopback_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_MAC_LOOPBACK_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+
+sw_error_t
+fal_port_mac_loopback_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_MAC_LOOPBACK_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
diff --git a/src/fal_uk/fal_portvlan.c b/src/fal_uk/fal_portvlan.c
new file mode 100755
index 0000000..7e4a624
--- /dev/null
+++ b/src/fal_uk/fal_portvlan.c
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_portvlan.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_port_1qmode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_1qmode_t port_1qmode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_ING_MODE_SET, dev_id, port_id,
+ (a_uint32_t) port_1qmode);
+ return rv;
+}
+
+sw_error_t
+fal_port_1qmode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_1qmode_t * pport_1qmode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_ING_MODE_GET, dev_id, port_id,
+ (a_uint32_t) pport_1qmode);
+ return rv;
+}
+
+sw_error_t
+fal_port_egvlanmode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_1q_egmode_t port_egvlanmode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_EG_MODE_SET, dev_id, port_id,
+ (a_uint32_t) port_egvlanmode);
+ return rv;
+}
+
+sw_error_t
+fal_port_egvlanmode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_1q_egmode_t * pport_egvlanmode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_EG_MODE_GET, dev_id, port_id,
+ (a_uint32_t) pport_egvlanmode);
+ return rv;
+}
+
+sw_error_t
+fal_portvlan_member_add(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t mem_port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_MEM_ADD, dev_id, port_id,
+ (a_uint32_t) mem_port_id);
+ return rv;
+}
+
+sw_error_t
+fal_portvlan_member_del(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t mem_port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_MEM_DEL, dev_id, port_id,
+ (a_uint32_t) mem_port_id);
+ return rv;
+}
+
+sw_error_t
+fal_portvlan_member_update(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pbmp_t mem_port_map)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_MEM_UPDATE, dev_id, port_id,
+ (a_uint32_t) mem_port_map);
+ return rv;
+}
+
+sw_error_t
+fal_portvlan_member_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pbmp_t * mem_port_map)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_MEM_GET, dev_id, port_id,
+ (a_uint32_t) mem_port_map);
+ return rv;
+}
+
+sw_error_t
+fal_port_default_vid_set(a_uint32_t dev_id, fal_port_t port_id, a_uint32_t vid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DEF_VID_SET, dev_id, port_id,
+ vid);
+ return rv;
+}
+
+sw_error_t
+fal_port_default_vid_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * vid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DEF_VID_GET, dev_id, port_id,
+ (a_uint32_t) vid);
+ return rv;
+}
+
+sw_error_t
+fal_port_force_default_vid_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FORCE_DEF_VID_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_force_default_vid_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FORCE_DEF_VID_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_force_portvlan_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FORCE_PORTVLAN_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_force_portvlan_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_FORCE_PORTVLAN_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_nestvlan_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_NESTVLAN_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_nestvlan_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_NESTVLAN_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_nestvlan_tpid_set(a_uint32_t dev_id, a_uint32_t tpid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NESTVLAN_TPID_SET, dev_id, tpid);
+ return rv;
+}
+
+sw_error_t
+fal_nestvlan_tpid_get(a_uint32_t dev_id, a_uint32_t * tpid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NESTVLAN_TPID_GET, dev_id, (a_uint32_t) tpid);
+ return rv;
+}
+
+sw_error_t
+fal_port_invlan_mode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_invlan_mode_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_IN_VLAN_MODE_SET, dev_id, port_id, (a_uint32_t) mode);
+ return rv;
+}
+
+sw_error_t
+fal_port_invlan_mode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_pt_invlan_mode_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_IN_VLAN_MODE_GET, dev_id, port_id, (a_uint32_t) mode);
+ return rv;
+}
+
+sw_error_t
+fal_port_tls_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_TLS_SET, dev_id, port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_tls_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_TLS_GET, dev_id, port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_pri_propagation_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_PRI_PROPAGATION_SET, dev_id, port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_pri_propagation_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_PRI_PROPAGATION_GET, dev_id, port_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_default_svid_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t vid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DEF_SVID_SET, dev_id, port_id, vid);
+ return rv;
+}
+
+sw_error_t
+fal_port_default_svid_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * vid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DEF_SVID_GET, dev_id, port_id, (a_uint32_t)vid);
+ return rv;
+}
+
+sw_error_t
+fal_port_default_cvid_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t vid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DEF_CVID_SET, dev_id, port_id, vid);
+ return rv;
+}
+
+sw_error_t
+fal_port_default_cvid_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * vid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_DEF_CVID_GET, dev_id, port_id, (a_uint32_t)vid);
+ return rv;
+}
+
+sw_error_t
+fal_port_vlan_propagation_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_vlan_propagation_mode_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_PROPAGATION_SET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_port_vlan_propagation_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_vlan_propagation_mode_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_PROPAGATION_GET, dev_id, port_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_port_vlan_trans_add(a_uint32_t dev_id, fal_port_t port_id, fal_vlan_trans_entry_t *entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_TRANS_ADD, dev_id, port_id, entry);
+ return rv;
+}
+
+sw_error_t
+fal_port_vlan_trans_del(a_uint32_t dev_id, fal_port_t port_id, fal_vlan_trans_entry_t *entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_TRANS_DEL, dev_id, port_id, entry);
+ return rv;
+}
+
+sw_error_t
+fal_port_vlan_trans_get(a_uint32_t dev_id, fal_port_t port_id, fal_vlan_trans_entry_t *entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_TRANS_GET, dev_id, port_id, entry);
+ return rv;
+}
+
+sw_error_t
+fal_qinq_mode_set(a_uint32_t dev_id, fal_qinq_mode_t mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QINQ_MODE_SET, dev_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_qinq_mode_get(a_uint32_t dev_id, fal_qinq_mode_t * mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QINQ_MODE_GET, dev_id, (a_uint32_t)mode);
+ return rv;
+}
+
+sw_error_t
+fal_port_qinq_role_set(a_uint32_t dev_id, fal_port_t port_id, fal_qinq_port_role_t role)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_QINQ_ROLE_SET, dev_id, port_id, (a_uint32_t)role);
+ return rv;
+}
+
+sw_error_t
+fal_port_qinq_role_get(a_uint32_t dev_id, fal_port_t port_id, fal_qinq_port_role_t * role)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_QINQ_ROLE_GET, dev_id, port_id, (a_uint32_t)role);
+ return rv;
+}
+
+sw_error_t
+fal_port_vlan_trans_iterate(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * iterator, fal_vlan_trans_entry_t * entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_VLAN_TRANS_ITERATE, dev_id, port_id,
+ (a_uint32_t)iterator,(a_uint32_t)entry);
+ return rv;
+}
+
+sw_error_t
+fal_port_mac_vlan_xlt_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_MAC_VLAN_XLT_SET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_port_mac_vlan_xlt_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_MAC_VLAN_XLT_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_netisolate_set(a_uint32_t dev_id, a_uint32_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NETISOLATE_SET, dev_id, enable);
+ return rv;
+}
+
+sw_error_t
+fal_netisolate_get(a_uint32_t dev_id, a_uint32_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_NETISOLATE_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_eg_trans_filter_bypass_en_set(a_uint32_t dev_id, a_uint32_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_EG_FLTR_BYPASS_EN_SET, dev_id, enable);
+ return rv;
+}
+
+sw_error_t
+fal_eg_trans_filter_bypass_en_get(a_uint32_t dev_id, a_uint32_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_EG_FLTR_BYPASS_EN_GET, dev_id, (a_uint32_t) enable);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_qos.c b/src/fal_uk/fal_qos.c
new file mode 100755
index 0000000..2870fd3
--- /dev/null
+++ b/src/fal_uk/fal_qos.c
@@ -0,0 +1,402 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_qos.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_qos_sch_mode_set(a_uint32_t dev_id,
+ fal_sch_mode_t mode, const a_uint32_t weight[])
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_SCH_MODE_SET, dev_id, mode,
+ (a_uint32_t) weight);
+ return rv;
+}
+
+sw_error_t
+fal_qos_sch_mode_get(a_uint32_t dev_id,
+ fal_sch_mode_t * mode, a_uint32_t weight[])
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_SCH_MODE_GET, dev_id, mode,
+ (a_uint32_t) weight);
+ return rv;
+}
+
+sw_error_t
+fal_qos_queue_tx_buf_status_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_QU_TX_BUF_ST_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_queue_tx_buf_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_QU_TX_BUF_ST_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_queue_tx_buf_nr_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * number)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_QU_TX_BUF_NR_SET, dev_id, port_id, queue_id,
+ (a_uint32_t) number);
+ return rv;
+}
+
+sw_error_t
+fal_qos_queue_tx_buf_nr_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * number)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_QU_TX_BUF_NR_GET, dev_id, port_id, queue_id,
+ (a_uint32_t) number);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_tx_buf_status_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_TX_BUF_ST_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_tx_buf_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_TX_BUF_ST_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_red_en_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_RED_EN_SET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_red_en_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t* enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_RED_EN_GET, dev_id, port_id,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_tx_buf_nr_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * number)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_TX_BUF_NR_SET, dev_id, port_id,
+ (a_uint32_t) number);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_tx_buf_nr_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * number)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_TX_BUF_NR_GET, dev_id, port_id,
+ (a_uint32_t) number);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_rx_buf_nr_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * number)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_RX_BUF_NR_SET, dev_id, port_id,
+ (a_uint32_t) number);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_rx_buf_nr_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * number)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_RX_BUF_NR_GET, dev_id, port_id,
+ (a_uint32_t) number);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_up_queue_set(a_uint32_t dev_id, a_uint32_t up, fal_queue_t queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_UP_QU_SET, dev_id, up,
+ (a_uint32_t) queue);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_up_queue_get(a_uint32_t dev_id, a_uint32_t up,
+ fal_queue_t * queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_UP_QU_GET, dev_id, up,
+ (a_uint32_t) queue);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_dscp_queue_set(a_uint32_t dev_id, a_uint32_t dscp, fal_queue_t queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_DSCP_QU_SET, dev_id, dscp,
+ (a_uint32_t) queue);
+ return rv;
+}
+
+sw_error_t
+fal_cosmap_dscp_queue_get(a_uint32_t dev_id, a_uint32_t dscp,
+ fal_queue_t * queue)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_COSMAP_DSCP_QU_GET, dev_id, dscp,
+ (a_uint32_t) queue);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_mode_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_qos_mode_t mode, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_MODE_SET, dev_id, port_id, mode,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_mode_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_qos_mode_t mode, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_MODE_GET, dev_id, port_id, mode,
+ (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_mode_pri_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_qos_mode_t mode, a_uint32_t pri)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_MODE_PRI_SET, dev_id, port_id, mode, pri);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_mode_pri_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_qos_mode_t mode, a_uint32_t * pri)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_MODE_PRI_GET, dev_id, port_id, mode,
+ (a_uint32_t) pri);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_default_up_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t up)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PORT_DEF_UP_SET, dev_id, port_id, up);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_default_up_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * up)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PORT_DEF_UP_GET, dev_id, port_id, (a_uint32_t) up);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_sch_mode_set(a_uint32_t dev_id, a_uint32_t port_id,
+ fal_sch_mode_t mode, const a_uint32_t weight[])
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PORT_SCH_MODE_SET, dev_id, port_id, mode,
+ (a_uint32_t) weight);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_sch_mode_get(a_uint32_t dev_id, a_uint32_t port_id,
+ fal_sch_mode_t * mode, a_uint32_t weight[])
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PORT_SCH_MODE_GET, dev_id, port_id, mode,
+ (a_uint32_t) weight);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_default_spri_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t spri)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_DEF_SPRI_SET, dev_id, port_id, spri);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_default_spri_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * spri)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_DEF_SPRI_GET, dev_id, port_id, (a_uint32_t)spri);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_default_cpri_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t cpri)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_DEF_CPRI_SET, dev_id, port_id, cpri);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_default_cpri_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * cpri)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_DEF_CPRI_GET, dev_id, port_id, (a_uint32_t)cpri);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_force_spri_status_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_FORCE_SPRI_ST_SET, dev_id, port_id, enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_force_spri_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t* enable)
+{
+ sw_error_t rv;
+ rv = sw_uk_exec(SW_API_QOS_PT_FORCE_SPRI_ST_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_force_cpri_status_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_FORCE_CPRI_ST_SET, dev_id, port_id, enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_port_force_cpri_status_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t* enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_PT_FORCE_CPRI_ST_GET, dev_id, port_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_qos_queue_remark_table_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t tbl_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_QUEUE_REMARK_SET, dev_id, port_id, queue_id, tbl_id, enable);
+ return rv;
+}
+
+
+sw_error_t
+fal_qos_queue_remark_table_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * tbl_id, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_QOS_QUEUE_REMARK_GET, dev_id, port_id, queue_id, (a_uint32_t)tbl_id, (a_uint32_t)enable);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_rate.c b/src/fal_uk/fal_rate.c
new file mode 100755
index 0000000..2150169
--- /dev/null
+++ b/src/fal_uk/fal_rate.c
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_rate.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_rate_queue_egrl_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * speed,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_QU_EGRL_SET, dev_id, port_id, queue_id,
+ (a_uint32_t) speed, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_rate_queue_egrl_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_uint32_t * speed,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_QU_EGRL_GET, dev_id, port_id, queue_id,
+ (a_uint32_t) speed, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_egrl_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * speed, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PT_EGRL_SET, dev_id, port_id,
+ (a_uint32_t) speed, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_egrl_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * speed, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PT_EGRL_GET, dev_id, port_id,
+ (a_uint32_t) speed, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_inrl_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * speed, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PT_INRL_SET, dev_id, port_id,
+ (a_uint32_t) speed, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_inrl_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * speed, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PT_INRL_GET, dev_id, port_id,
+ (a_uint32_t) speed, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_storm_ctrl_frame_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_storm_type_t frame_type, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_STORM_CTRL_FRAME_SET, dev_id, port_id,
+ (a_uint32_t) frame_type, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_storm_ctrl_frame_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_storm_type_t frame_type, a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_STORM_CTRL_FRAME_GET, dev_id, port_id,
+ (a_uint32_t) frame_type, (a_uint32_t) enable);
+ return rv;
+}
+
+sw_error_t
+fal_storm_ctrl_rate_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * rate)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_STORM_CTRL_RATE_SET, dev_id, port_id,
+ (a_uint32_t) rate);
+ return rv;
+}
+
+sw_error_t
+fal_storm_ctrl_rate_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t * rate)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_STORM_CTRL_RATE_GET, dev_id, port_id,
+ (a_uint32_t) rate);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_policer_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_policer_t * policer)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PORT_POLICER_SET, dev_id, port_id,
+ (a_uint32_t) policer);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_policer_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_policer_t * policer)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PORT_POLICER_GET, dev_id, port_id,
+ (a_uint32_t) policer);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_shaper_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable, fal_egress_shaper_t * shaper)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PORT_SHAPER_SET, dev_id, port_id,
+ (a_uint32_t) enable, (a_uint32_t) shaper);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_shaper_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable, fal_egress_shaper_t * shaper)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PORT_SHAPER_GET, dev_id, port_id,
+ (a_uint32_t) enable, (a_uint32_t) shaper);
+ return rv;
+}
+
+sw_error_t
+fal_rate_queue_shaper_set(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_bool_t enable,
+ fal_egress_shaper_t * shaper)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_QUEUE_SHAPER_SET, dev_id, port_id, queue_id,
+ (a_uint32_t) enable, (a_uint32_t) shaper);
+ return rv;
+}
+
+sw_error_t
+fal_rate_queue_shaper_get(a_uint32_t dev_id, fal_port_t port_id,
+ fal_queue_t queue_id, a_bool_t * enable,
+ fal_egress_shaper_t * shaper)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_QUEUE_SHAPER_GET, dev_id, port_id, queue_id,
+ (a_uint32_t) enable, (a_uint32_t) shaper);
+ return rv;
+}
+
+sw_error_t
+fal_rate_acl_policer_set(a_uint32_t dev_id, a_uint32_t policer_id,
+ fal_acl_policer_t * policer)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_ACL_POLICER_SET, dev_id, policer_id, (a_uint32_t) policer);
+ return rv;
+}
+
+sw_error_t
+fal_rate_acl_policer_get(a_uint32_t dev_id, a_uint32_t policer_id,
+ fal_acl_policer_t * policer)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_ACL_POLICER_GET, dev_id, policer_id, (a_uint32_t) policer);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_add_rate_byte_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t number)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PT_ADDRATEBYTE_SET, dev_id, port_id, number);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_add_rate_byte_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_uint32_t *number)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PT_ADDRATEBYTE_GET, dev_id, port_id, number);
+ return rv;
+}
+
+sw_error_t
+fal_rate_port_gol_flow_en_set(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PT_GOL_FLOW_EN_SET, dev_id, port_id, enable);
+ return rv;
+}
+
+
+sw_error_t
+fal_rate_port_gol_flow_en_get(a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t* enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_RATE_PT_GOL_FLOW_EN_GET, dev_id, port_id, enable);
+ return rv;
+}
+
+
diff --git a/src/fal_uk/fal_reg_access.c b/src/fal_uk/fal_reg_access.c
new file mode 100755
index 0000000..ed06d3b
--- /dev/null
+++ b/src/fal_uk/fal_reg_access.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_reg_access.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_phy_get(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint32_t reg, a_uint16_t * value)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PHY_GET, dev_id, phy_addr, reg, value);
+ return rv;
+}
+
+sw_error_t
+fal_phy_set(a_uint32_t dev_id, a_uint32_t phy_addr,
+ a_uint32_t reg, a_uint16_t value)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PHY_SET, dev_id, phy_addr, reg, value);
+ return rv;
+}
+
+sw_error_t
+fal_reg_get(a_uint32_t dev_id, a_uint32_t reg_addr, a_uint8_t value[],
+ a_uint32_t value_len)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_REG_GET, dev_id, reg_addr, value, value_len);
+ return rv;
+}
+
+sw_error_t
+fal_reg_set(a_uint32_t dev_id, a_uint32_t reg_addr, a_uint8_t value[],
+ a_uint32_t value_len)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_REG_SET, dev_id, reg_addr, value, value_len);
+ return rv;
+}
+
+
+sw_error_t
+fal_reg_field_get(a_uint32_t dev_id, a_uint32_t reg_addr,
+ a_uint32_t bit_offset, a_uint32_t field_len,
+ a_uint8_t value[], a_uint32_t value_len)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_REG_FIELD_GET, dev_id, reg_addr, bit_offset, field_len, value, value_len);
+ return rv;
+}
+
+
+sw_error_t
+fal_reg_field_set(a_uint32_t dev_id, a_uint32_t reg_addr,
+ a_uint32_t bit_offset, a_uint32_t field_len,
+ const a_uint8_t value[], a_uint32_t value_len)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_REG_FIELD_SET, dev_id, reg_addr, bit_offset, field_len, value, value_len);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_sec.c b/src/fal_uk/fal_sec.c
new file mode 100755
index 0000000..5740fc8
--- /dev/null
+++ b/src/fal_uk/fal_sec.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_sec.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_sec_norm_item_set(a_uint32_t dev_id, fal_norm_item_t item, void * value)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_SEC_NORM_SET, dev_id, item, (a_uint32_t) value);
+ return rv;
+}
+
+sw_error_t
+fal_sec_norm_item_get(a_uint32_t dev_id, fal_norm_item_t item, void * value)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_SEC_NORM_GET, dev_id, item, (a_uint32_t) value);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_stp.c b/src/fal_uk/fal_stp.c
new file mode 100755
index 0000000..9369293
--- /dev/null
+++ b/src/fal_uk/fal_stp.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_stp.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_stp_port_state_set(a_uint32_t dev_id, a_uint32_t st_id,
+ fal_port_t port_id, fal_stp_state_t state)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_STP_PT_STATE_SET, dev_id, st_id, port_id,
+ (a_uint32_t) state);
+ return rv;
+}
+
+sw_error_t
+fal_stp_port_state_get(a_uint32_t dev_id, a_uint32_t st_id,
+ fal_port_t port_id, fal_stp_state_t * state)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_STP_PT_STATE_GET, dev_id, st_id, port_id,
+ (a_uint32_t) state);
+ return rv;
+}
diff --git a/src/fal_uk/fal_trunk.c b/src/fal_uk/fal_trunk.c
new file mode 100755
index 0000000..23c029c
--- /dev/null
+++ b/src/fal_uk/fal_trunk.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_trunk.h"
+#include "fal_uk_if.h"
+
+
+sw_error_t
+fal_trunk_group_set(a_uint32_t dev_id, a_uint32_t trunk_id,
+ a_bool_t enable, fal_pbmp_t member)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TRUNK_GROUP_SET, dev_id, trunk_id, enable,
+ (a_uint32_t) member);
+ return rv;
+}
+
+sw_error_t
+fal_trunk_group_get(a_uint32_t dev_id, a_uint32_t trunk_id,
+ a_bool_t * enable, fal_pbmp_t * member)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TRUNK_GROUP_GET, dev_id, trunk_id, enable,
+ (a_uint32_t) member);
+ return rv;
+}
+
+sw_error_t
+fal_trunk_hash_mode_set(a_uint32_t dev_id, a_uint32_t hash_mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TRUNK_HASH_SET, dev_id, hash_mode);
+ return rv;
+}
+
+sw_error_t
+fal_trunk_hash_mode_get(a_uint32_t dev_id, a_uint32_t * hash_mode)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TRUNK_HASH_GET, dev_id, hash_mode);
+ return rv;
+}
+
+sw_error_t
+fal_trunk_manipulate_sa_set(a_uint32_t dev_id, fal_mac_addr_t * addr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TRUNK_MAN_SA_SET, dev_id, addr);
+ return rv;
+}
+
+sw_error_t
+fal_trunk_manipulate_sa_get(a_uint32_t dev_id, fal_mac_addr_t * addr)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_TRUNK_MAN_SA_GET, dev_id, addr);
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_uk_if.c b/src/fal_uk/fal_uk_if.c
new file mode 100755
index 0000000..649bcf0
--- /dev/null
+++ b/src/fal_uk/fal_uk_if.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#include <stdarg.h>
+#include "sw.h"
+#include "ssdk_init.h"
+#include "sw_api.h"
+#include "sw_api_us.h"
+#include "api_access.h"
+
+sw_error_t
+sw_uk_exec(a_uint32_t api_id, ...)
+{
+ a_uint32_t value[SW_MAX_API_PARAM] = { 0 };
+ a_uint32_t rtn = SW_OK, i;
+ sw_error_t rv;
+ va_list arg_ptr;
+ a_uint32_t nr_param = 0;
+
+ if((nr_param = sw_api_param_nums(api_id)) == 0)
+ {
+ return SW_NOT_SUPPORTED;
+ }
+
+ value[0] = api_id;
+ value[1] = (a_uint32_t)&rtn;
+
+ va_start(arg_ptr, api_id);
+ for (i = 0; i < nr_param; i++)
+ {
+ value[i + 2] = va_arg(arg_ptr, a_uint32_t);
+ }
+ va_end(arg_ptr);
+
+ rv = sw_uk_if(value);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+ return rtn;
+}
+
+sw_error_t
+ssdk_init(a_uint32_t dev_id, ssdk_init_cfg * cfg)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_init(cfg->nl_prot);
+ return rv;
+}
+
+sw_error_t
+ssdk_cleanup(void)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_cleanup();
+ return rv;
+}
+
diff --git a/src/fal_uk/fal_vlan.c b/src/fal_uk/fal_vlan.c
new file mode 100755
index 0000000..a3871ad
--- /dev/null
+++ b/src/fal_uk/fal_vlan.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+
+#include "sw.h"
+#include "sw_ioctl.h"
+#include "fal_vlan.h"
+#include "fal_uk_if.h"
+
+sw_error_t
+fal_vlan_entry_append(a_uint32_t dev_id, fal_vlan_t * vlan_entry)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_APPEND, dev_id, (a_uint32_t) vlan_entry);
+ return rv;
+}
+
+
+sw_error_t
+fal_vlan_create(a_uint32_t dev_id, a_uint32_t vlan_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_ADD, dev_id, vlan_id);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_next(a_uint32_t dev_id, a_uint32_t vlan_id, fal_vlan_t * p_vlan)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_NEXT, dev_id, vlan_id, (a_uint32_t) p_vlan);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_find(a_uint32_t dev_id, a_uint32_t vlan_id, fal_vlan_t * p_vlan)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_FIND, dev_id, vlan_id, (a_uint32_t) p_vlan);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_member_update(a_uint32_t dev_id, a_uint32_t vlan_id,
+ fal_pbmp_t member, fal_pbmp_t u_member)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_MEM_UPDATE, dev_id, vlan_id, member,
+ u_member);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_delete(a_uint32_t dev_id, a_uint32_t vlan_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_DEL, dev_id, vlan_id);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_flush(a_uint32_t dev_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_FLUSH, dev_id);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_fid_set(a_uint32_t dev_id, a_uint32_t vlan_id, a_uint32_t fid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_FID_SET, dev_id, vlan_id, fid);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_fid_get(a_uint32_t dev_id, a_uint32_t vlan_id, a_uint32_t * fid)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_FID_GET, dev_id, vlan_id, (a_uint32_t)fid);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_member_add(a_uint32_t dev_id, a_uint32_t vlan_id,
+ fal_port_t port_id, fal_pt_1q_egmode_t port_info)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_MEMBER_ADD, dev_id, vlan_id, port_id, port_info);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_member_del(a_uint32_t dev_id, a_uint32_t vlan_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_MEMBER_DEL, dev_id, vlan_id, port_id);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_learning_state_set(a_uint32_t dev_id, a_uint32_t vlan_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_LEARN_STATE_SET, dev_id, vlan_id, (a_uint32_t)enable);
+ return rv;
+}
+
+sw_error_t
+fal_vlan_learning_state_get(a_uint32_t dev_id, a_uint32_t vlan_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_VLAN_LEARN_STATE_GET, dev_id, vlan_id, (a_uint32_t)enable);
+ return rv;
+}
+
+
diff --git a/src/sal/Makefile b/src/sal/Makefile
new file mode 100755
index 0000000..805ae0f
--- /dev/null
+++ b/src/sal/Makefile
@@ -0,0 +1,12 @@
+LOC_DIR=src/sal
+LIB=SAL
+
+include $(PRJ_PATH)/make/config.mk
+
+SRC_LIST=$(wildcard *.c)
+
+include $(PRJ_PATH)/make/components.mk
+include $(PRJ_PATH)/make/defs.mk
+include $(PRJ_PATH)/make/target.mk
+
+all: dep obj
diff --git a/src/sal/sd/Makefile b/src/sal/sd/Makefile
new file mode 100755
index 0000000..74c50e2
--- /dev/null
+++ b/src/sal/sd/Makefile
@@ -0,0 +1,12 @@
+LOC_DIR=src/sal/sd
+LIB=SAL
+
+include $(PRJ_PATH)/make/config.mk
+
+SRC_LIST=$(wildcard *.c)
+
+include $(PRJ_PATH)/make/components.mk
+include $(PRJ_PATH)/make/defs.mk
+include $(PRJ_PATH)/make/target.mk
+
+all: dep obj
\ No newline at end of file
diff --git a/src/sal/sd/linux/Makefile b/src/sal/sd/linux/Makefile
new file mode 100755
index 0000000..a038efc
--- /dev/null
+++ b/src/sal/sd/linux/Makefile
@@ -0,0 +1,12 @@
+LOC_DIR=src/sal/sd/linux
+LIB=SAL
+
+include $(PRJ_PATH)/make/config.mk
+
+SRC_LIST=$(wildcard *.c)
+
+include $(PRJ_PATH)/make/components.mk
+include $(PRJ_PATH)/make/defs.mk
+include $(PRJ_PATH)/make/target.mk
+
+all: dep obj
\ No newline at end of file
diff --git a/src/sal/sd/linux/uk_interface/Makefile b/src/sal/sd/linux/uk_interface/Makefile
new file mode 100755
index 0000000..a4bac32
--- /dev/null
+++ b/src/sal/sd/linux/uk_interface/Makefile
@@ -0,0 +1,34 @@
+LOC_DIR=src/sal/sd/linux/uk_interface
+LIB=SAL
+
+include $(PRJ_PATH)/make/config.mk
+
+SRC_LIST=
+
+ifeq (TRUE, $(UK_IF))
+ifeq (KSLIB, $(MODULE_TYPE))
+ ifeq (TRUE, $(UK_NETLINK))
+ SRC_LIST=sw_api_ks_netlink.c
+ endif
+
+ ifeq (TRUE, $(UK_IOCTL))
+ SRC_LIST=sw_api_ks_ioctl.c
+ endif
+endif
+
+ifeq (USLIB, $(MODULE_TYPE))
+ ifeq (TRUE, $(UK_NETLINK))
+ SRC_LIST=sw_api_us_netlink.c
+ endif
+
+ ifeq (TRUE, $(UK_IOCTL))
+ SRC_LIST=sw_api_us_ioctl.c
+ endif
+endif
+endif
+
+include $(PRJ_PATH)/make/components.mk
+include $(PRJ_PATH)/make/defs.mk
+include $(PRJ_PATH)/make/target.mk
+
+all: dep obj
\ No newline at end of file
diff --git a/src/sal/sd/linux/uk_interface/sw_api_us_ioctl.c b/src/sal/sd/linux/uk_interface/sw_api_us_ioctl.c
new file mode 100755
index 0000000..e3f0af0
--- /dev/null
+++ b/src/sal/sd/linux/uk_interface/sw_api_us_ioctl.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include "sw.h"
+#include "sw_api.h"
+#include "sw_api_us.h"
+
+#define MISC_CHR_DEV 10
+static int glb_socket_fd = 0;
+
+sw_error_t
+sw_uk_if(a_uint32_t arg_val[SW_MAX_API_PARAM])
+{
+ ioctl(glb_socket_fd, SIOCDEVPRIVATE, arg_val);
+ return SW_OK;
+}
+
+sw_error_t
+sw_uk_init(a_uint32_t nl_prot)
+{
+ if (!glb_socket_fd)
+ {
+ /* even mknod fail we not quit, perhaps the device node exist already */
+#if defined UK_MINOR_DEV
+ mknod("/dev/switch_ssdk", S_IFCHR, makedev(MISC_CHR_DEV, UK_MINOR_DEV));
+#else
+ mknod("/dev/switch_ssdk", S_IFCHR, makedev(MISC_CHR_DEV, nl_prot));
+#endif
+ if ((glb_socket_fd = open("/dev/switch_ssdk", O_RDWR)) < 0)
+ {
+ return SW_INIT_ERROR;
+ }
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+sw_uk_cleanup(void)
+{
+ close(glb_socket_fd);
+ glb_socket_fd = 0;
+#if 0
+ remove("/dev/switch_ssdk");
+#endif
+ return SW_OK;
+}
+
diff --git a/src/sal/sd/linux/uk_interface/sw_api_us_netlink.c b/src/sal/sd/linux/uk_interface/sw_api_us_netlink.c
new file mode 100755
index 0000000..d3a4480
--- /dev/null
+++ b/src/sal/sd/linux/uk_interface/sw_api_us_netlink.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/socket.h>
+#include <linux/types.h>
+#include <linux/netlink.h>
+#include "sw.h"
+#include "sw_api.h"
+#include "sw_api_us.h"
+
+#define SSDK_SOCK_SEND_TRY_NUM 1000
+#define SSDK_SOCK_RCV_TRY_NUM 1000
+#define SSDK_SOCK_FD_NUM 16
+typedef struct
+{
+ a_uint32_t ssdk_sock_pid;
+ a_int32_t ssdk_sock_fd;
+} ssdk_sock_t;
+ssdk_sock_t ssdk_sock[SSDK_SOCK_FD_NUM];
+
+static a_uint32_t ssdk_sock_prot = 0;
+static struct nlmsghdr *nl_hdr = NULL;
+#if defined(API_LOCK)
+static aos_lock_t ssdk_sock_lock;
+#define SOCK_LOCKER_INIT aos_lock_init(&ssdk_sock_lock)
+#define SOCK_LOCKER_LOCK aos_lock(&ssdk_sock_lock)
+#define SOCK_LOCKER_UNLOCK aos_unlock(&ssdk_sock_lock)
+#else
+#define SOCK_LOCKER_INIT
+#define SOCK_LOCKER_LOCK
+#define SOCK_LOCKER_UNLOCK
+#endif
+
+static ssdk_sock_t *
+ssdk_sock_alloc(a_uint32_t pid)
+{
+ a_uint32_t i;
+
+ for (i = 0; i < SSDK_SOCK_FD_NUM; i++)
+ {
+ if (!ssdk_sock[i].ssdk_sock_pid)
+ {
+ return &ssdk_sock[i];
+ }
+ else
+ {
+ if (0 != kill(ssdk_sock[i].ssdk_sock_pid, 0))
+ {
+ return &ssdk_sock[i];
+ }
+ }
+ }
+
+ return NULL;
+}
+
+static ssdk_sock_t *
+ssdk_sock_find(a_uint32_t pid)
+{
+ a_uint32_t i;
+
+ for (i = 0; i < SSDK_SOCK_FD_NUM; i++)
+ {
+ if (ssdk_sock[i].ssdk_sock_pid == pid)
+ {
+ return &ssdk_sock[i];
+ }
+ }
+
+ return NULL;
+}
+
+sw_error_t
+sw_uk_if(a_uint32_t arg_val[SW_MAX_API_PARAM])
+{
+ struct sockaddr_nl src_addr;
+ struct sockaddr_nl dest_addr;
+ struct msghdr msg;
+ struct iovec iov;
+ struct nlmsghdr *nlh;
+ ssdk_sock_t * sock;
+ a_int32_t sock_fd;
+ a_uint32_t curr_pid;
+ sw_error_t rv = SW_OK;
+ a_uint32_t i, j, flag;
+
+ curr_pid = getpid();
+
+ SOCK_LOCKER_LOCK;
+ sock = ssdk_sock_find(curr_pid);
+ if (!sock)
+ {
+ sock = ssdk_sock_alloc(curr_pid);
+ if (!sock)
+ {
+ SW_OUT_ON_ERROR(SW_NO_RESOURCE);
+ }
+
+ sock_fd = socket(PF_NETLINK, SOCK_RAW, ssdk_sock_prot);
+ aos_mem_set(&src_addr, 0, sizeof(src_addr));
+ src_addr.nl_family = AF_NETLINK;
+ src_addr.nl_pid = curr_pid;
+ src_addr.nl_groups = 0;
+ bind(sock_fd, (struct sockaddr*)&src_addr, sizeof(src_addr));
+
+ sock->ssdk_sock_fd = sock_fd;
+ sock->ssdk_sock_pid = curr_pid;
+ }
+ else
+ {
+ sock_fd = sock->ssdk_sock_fd;
+ }
+
+ aos_mem_set(&dest_addr, 0, sizeof(dest_addr));
+ dest_addr.nl_family = AF_NETLINK;
+ dest_addr.nl_pid = 0;
+ dest_addr.nl_groups = 0;
+
+ nlh = nl_hdr;
+ aos_mem_set(nlh, 0, NLMSG_SPACE(SW_MAX_PAYLOAD));
+ nlh->nlmsg_len = NLMSG_SPACE(SW_MAX_PAYLOAD);
+ nlh->nlmsg_pid = curr_pid;
+ nlh->nlmsg_flags = 0;
+ aos_mem_copy(NLMSG_DATA(nlh), arg_val, SW_MAX_PAYLOAD);
+
+ iov.iov_base = (void *)nlh;
+ iov.iov_len = nlh->nlmsg_len;
+
+ aos_mem_set(&msg, 0, sizeof(msg));
+ msg.msg_name = (void *)&dest_addr;
+ msg.msg_namelen = sizeof(dest_addr);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+ for (i = 0; i < SSDK_SOCK_SEND_TRY_NUM; i++)
+ {
+ if (0 < sendmsg(sock_fd, &msg, MSG_DONTWAIT))
+ {
+ break;
+ }
+ }
+
+ if (SSDK_SOCK_SEND_TRY_NUM <= i)
+ {
+ SW_OUT_ON_ERROR(SW_TIMEOUT);
+ }
+
+ flag = 0;
+ aos_mem_set(nlh, 0, NLMSG_SPACE(SW_MAX_PAYLOAD));
+ for (i = 0; i < SSDK_SOCK_RCV_TRY_NUM; i++)
+ {
+ for (j = 0; j < 1000; j++)
+ {
+ if (0 < recvmsg(sock_fd, &msg, MSG_DONTWAIT))
+ {
+ flag = 1;
+ break;
+ }
+ }
+
+ if (flag)
+ {
+ break;
+ }
+ else
+ {
+ aos_mdelay(10);
+ }
+ }
+
+ if (SSDK_SOCK_RCV_TRY_NUM <= i)
+ {
+ SW_OUT_ON_ERROR(SW_TIMEOUT);
+ }
+
+out:
+ SOCK_LOCKER_UNLOCK;
+ return rv;
+}
+
+sw_error_t
+sw_uk_init(a_uint32_t nl_prot)
+{
+ if (!nl_hdr)
+ {
+ nl_hdr = (struct nlmsghdr *)aos_mem_alloc(NLMSG_SPACE(SW_MAX_PAYLOAD));
+ }
+
+ if (!nl_hdr)
+ {
+ return SW_NO_RESOURCE;
+ }
+
+#if defined UK_NL_PROT
+ ssdk_sock_prot = UK_NL_PROT;
+#else
+ ssdk_sock_prot = nl_prot;
+#endif
+ SOCK_LOCKER_INIT;
+ aos_mem_zero(ssdk_sock, sizeof(ssdk_sock_t) * SSDK_SOCK_FD_NUM);
+ return SW_OK;
+}
+
+sw_error_t
+sw_uk_cleanup(void)
+{
+ aos_mem_zero(ssdk_sock, sizeof(ssdk_sock_t) * SSDK_SOCK_FD_NUM);
+
+ if (nl_hdr)
+ {
+ aos_mem_free(nl_hdr);
+ nl_hdr = NULL;
+ }
+
+ return SW_OK;
+}
+
diff --git a/src/sal/sd/sd.c b/src/sal/sd/sd.c
new file mode 100755
index 0000000..8f1cded
--- /dev/null
+++ b/src/sal/sd/sd.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#include "sw.h"
+#include "ssdk_init.h"
+#include "sd.h"
+#include "sw_api.h"
+#if ((!defined(KERNEL_MODULE)) && defined(UK_IF))
+#include "sw_api_us.h"
+#endif
+
+mdio_reg_set ssdk_mdio_set = NULL;
+mdio_reg_get ssdk_mdio_get = NULL;
+hdr_reg_set ssdk_hdr_reg_set = NULL;
+hdr_reg_get ssdk_hdr_reg_get = NULL;
+
+sw_error_t
+sd_reg_mdio_set(a_uint32_t dev_id, a_uint32_t phy, a_uint32_t reg,
+ a_uint16_t data)
+{
+ sw_error_t rv = SW_OK;
+
+ if (NULL != ssdk_mdio_set)
+ {
+ rv = ssdk_mdio_set(dev_id, phy, reg, data);
+ }
+ else
+ {
+#if ((!defined(KERNEL_MODULE)) && defined(UK_IF))
+ {
+ a_uint32_t args[SW_MAX_API_PARAM];
+
+ args[0] = SW_API_PHY_SET;
+ args[1] = (a_uint32_t) & rv;
+ args[2] = dev_id;
+ args[3] = phy;
+ args[4] = reg;
+ args[5] = data;
+ if (SW_OK != sw_uk_if(args))
+ {
+ return SW_FAIL;
+ }
+ }
+#else
+ return SW_NOT_SUPPORTED;
+#endif
+ }
+
+ return rv;
+}
+
+sw_error_t
+sd_reg_mdio_get(a_uint32_t dev_id, a_uint32_t phy, a_uint32_t reg, a_uint16_t * data)
+{
+ sw_error_t rv = SW_OK;
+
+ if (NULL != ssdk_mdio_get)
+ {
+ rv = ssdk_mdio_get(dev_id, phy, reg, data);
+ }
+ else
+ {
+#if ((!defined(KERNEL_MODULE)) && defined(UK_IF))
+ {
+ a_uint32_t args[SW_MAX_API_PARAM];
+ a_uint32_t tmp;
+
+ args[0] = SW_API_PHY_GET;
+ args[1] = (a_uint32_t) & rv;
+ args[2] = dev_id;
+ args[3] = phy;
+ args[4] = reg;
+ args[5] = (a_uint32_t) & tmp;
+ if (SW_OK != sw_uk_if(args))
+ {
+ return SW_FAIL;
+ }
+ *data = *((a_uint16_t *)&tmp);
+ }
+#else
+ return SW_NOT_SUPPORTED;
+#endif
+ }
+
+ return rv;
+}
+
+sw_error_t
+sd_reg_hdr_set(a_uint32_t dev_id, a_uint32_t reg_addr, a_uint8_t * reg_data, a_uint32_t len)
+{
+ sw_error_t rv;
+
+ if (NULL != ssdk_hdr_reg_set)
+ {
+ rv = ssdk_hdr_reg_set(dev_id, reg_addr, reg_data, len);
+ }
+ else
+ {
+ return SW_NOT_SUPPORTED;
+ }
+
+ return rv;
+}
+
+sw_error_t
+sd_reg_hdr_get(a_uint32_t dev_id, a_uint32_t reg_addr, a_uint8_t * reg_data, a_uint32_t len)
+{
+ sw_error_t rv;
+
+ if (NULL != ssdk_hdr_reg_get)
+ {
+ rv = ssdk_hdr_reg_get(dev_id, reg_addr, reg_data, len);
+ }
+ else
+ {
+ return SW_NOT_SUPPORTED;
+ }
+
+ return rv;
+}
+
+sw_error_t
+sd_init(a_uint32_t dev_id, ssdk_init_cfg * cfg)
+{
+ if (NULL != cfg->reg_func.mdio_set)
+ {
+ ssdk_mdio_set = cfg->reg_func.mdio_set;
+ }
+
+ if (NULL != cfg->reg_func.mdio_get)
+ {
+ ssdk_mdio_get = cfg->reg_func.mdio_get;
+ }
+
+ if (NULL != cfg->reg_func.header_reg_set)
+ {
+ ssdk_hdr_reg_set = cfg->reg_func.header_reg_set;
+ }
+
+ if (NULL != cfg->reg_func.header_reg_get)
+ {
+ ssdk_hdr_reg_get = cfg->reg_func.header_reg_get;
+ }
+
+ return SW_OK;
+}
+
diff --git a/src/shell/Makefile b/src/shell/Makefile
new file mode 100755
index 0000000..a8ec731
--- /dev/null
+++ b/src/shell/Makefile
@@ -0,0 +1,24 @@
+LOC_DIR=src/shell
+LIB=SHELL
+
+include $(PRJ_PATH)/make/config.mk
+include $(PRJ_PATH)/make/components.mk
+
+SRC_LIST=$(wildcard *.c)
+ifeq (,$(findstring SHELL, $(COMPONENTS)))
+all: dep obj
+else
+all: dep obj lib
+endif
+
+include $(PRJ_PATH)/make/defs.mk
+include $(PRJ_PATH)/make/target.mk
+
+ifeq (TRUE, $(API_LOCK))
+ PT_LIB=-lpthread
+else
+ PT_LIB=
+endif
+
+lib:
+ $(CC) $(CFLAGS) $(OBJ_FILE) $(BIN_DIR)/$(US_MOD)_$(RUNMODE).a -o $(DST_DIR)/$(SHELLOBJ) $(PT_LIB)
diff --git a/src/shell/shell.c b/src/shell/shell.c
new file mode 100755
index 0000000..e7053d1
--- /dev/null
+++ b/src/shell/shell.c
@@ -0,0 +1,812 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include "shell.h"
+#include "shell_io.h"
+#include "shell_sw.h"
+#include "shell_lib.h"
+#include "shell_config.h"
+#include "api_access.h"
+
+a_uint32_t *ioctl_buf;
+ssdk_init_cfg init_cfg = def_init_cfg;
+
+static a_uint32_t *ioctl_argp;
+static FILE * out_fd;
+static char *err_info[] =
+{
+ "Operation succeeded", /*SW_OK*/
+ "Operation failed", /*SW_FAIL*/
+ "Illegal value ", /*SW_BAD_VALUE*/
+ "Value is out of range ", /*SW_OUT_OF_RANGE*/
+ "Illegal parameter(s) ", /*SW_BAD_PARAM*/
+ "Illegal pointer value ", /*SW_BAD_PTR*/
+ "Wrong length", /*SW_BAD_LEN*/
+ "Wrong state of state machine ", /*SW_BAD_STATE*/
+ "Read operation failed ", /*SW_READ_ERROR*/
+ "Write operation failed ", /*SW_WRITE_ERROR*/
+ "Fail in creating an entry ", /*SW_CREATE_ERROR*/
+ "Fail in deleteing an entry ", /*SW_DELETE_ERROR*/
+ "Entry not found ", /*SW_NOT_FOUND*/
+ "The parameter(s) is the same ", /*SW_NO_CHANGE*/
+ "No more entry found ", /*SW_NO_MORE*/
+ "No such entry ", /*SW_NO_SUCH*/
+ "Tried to create existing entry ", /*SW_ALREADY_EXIST*/
+ "Table is full ", /*SW_FULL*/
+ "Table is empty ", /*SW_EMPTY*/
+ "This request is not support ", /*SW_NOT_SUPPORTED*/
+ "This request is not implemented", /*SW_NOT_IMPLEMENTED*/
+ "The item is not initialized ", /*SW_NOT_INITIALIZED*/
+ "Operation is still running", /*SW_BUSY*/
+ "Operation Time Out ", /*SW_TIMEOUT*/
+ "Operation is disabled ", /*SW_DISABLE*/
+ "Resource not available (memory ...)", /*SW_NO_RESOURCE*/
+ "Error occured while INIT process", /*SW_INIT_ERROR*/
+ "The other side is not ready yet", /*SW_NOT_READY */
+ "Cpu memory allocation failed. ", /*SW_OUT_OF_MEM */
+ "Operation has been aborted. ", /*SW_ABORTED*/
+} ;
+
+void
+cmd_print_error(sw_error_t rtn)
+{
+ dprintf("\n%s\n\n", err_info[abs(rtn)]);
+}
+
+void
+cmd_print(char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ if(out_fd)
+ vfprintf(out_fd, fmt, args);
+ else
+ vfprintf(stdout, fmt, args);
+ va_end(args);
+}
+
+static sw_error_t
+cmd_input_parser(a_uint32_t *arg_val, a_uint32_t arg_index, sw_api_param_t *pp)
+{
+ a_int16_t i;
+ a_uint32_t *pbuf;
+ a_uint16_t rtn_size = 1;
+ sw_api_param_t *pptmp;
+
+ pbuf = ioctl_buf + rtn_size; /*reserve for return value */
+
+ for (i = 0; i < arg_index; i++)
+ {
+ pptmp = pp + i;
+ if (pptmp->param_type & SW_PARAM_PTR)
+ {
+ pbuf += (pptmp->data_size + 3) / 4;
+ }
+ }
+ if ((pbuf - ioctl_buf + (pptmp->data_size + 3) / 4) > (IOCTL_BUF_SIZE/4))
+ {
+ return SW_NO_RESOURCE;
+ }
+
+ *arg_val = (a_uint32_t) pbuf;
+
+ return SW_OK;
+}
+
+static sw_error_t
+cmd_api_func(sw_api_func_t *fp, a_uint32_t nr_param, a_uint32_t * args)
+{
+ a_uint32_t *p = &args[2];
+ sw_error_t rv;
+ sw_error_t(*func) ();
+
+ func = fp->func;
+
+ switch (nr_param)
+ {
+ case 0:
+ rv = (func) ();
+ break;
+ case 1:
+ rv = (func) (p[0]);
+ break;
+ case 2:
+ rv = (func) (p[0], p[1]);
+ break;
+ case 3:
+ rv = (func) (p[0], p[1], p[2]);
+ break;
+ case 4:
+ rv = (func) (p[0], p[1], p[2], p[3]);
+ break;
+ case 5:
+ rv = (func) (p[0], p[1], p[2], p[3], p[4]);
+ break;
+ case 6:
+ rv = (func) (p[0], p[1], p[2], p[3], p[4], p[5]);
+ break;
+ case 7:
+ rv = (func) (p[0], p[1], p[2], p[3], p[4], p[5], p[6]);
+ break;
+ case 8:
+ rv = (func) (p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
+ break;
+ case 9:
+ rv = (func) (p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]);
+ break;
+ case 10:
+ rv = (func) (p[0], p[1], p[2], p[3], p[4], p[5],
+ p[6], p[7], p[8], p[9]);
+ break;
+ default:
+ rv = SW_OUT_OF_RANGE;
+ }
+
+ *(a_uint32_t *) args[1] = rv;
+
+ return rv;
+}
+
+static sw_error_t
+cmd_api_output(sw_api_param_t *pp, a_uint32_t nr_param, a_uint32_t * args)
+{
+ a_uint16_t i;
+ a_uint32_t *pbuf;
+ a_uint16_t rtn_size = 1;
+ sw_error_t rtn = (sw_error_t) (*ioctl_buf);
+ sw_api_param_t *pptmp = NULL;
+
+ if (rtn != SW_OK)
+ {
+ cmd_print_error(rtn);
+ return rtn;
+ }
+
+ pbuf = ioctl_buf + rtn_size;
+ for (i = 0; i < nr_param; i++)
+ {
+ pptmp = pp + i;
+ if (pptmp->param_type & SW_PARAM_PTR)
+ {
+
+ if (pptmp->param_type & SW_PARAM_OUT)
+ {
+
+ sw_data_type_t *data_type;
+ if (!(data_type = cmd_data_type_find(pptmp->data_type)))
+ return SW_NO_SUCH;
+
+ if (data_type->show_func)
+ {
+ data_type->show_func(pptmp->param_name, pbuf, pptmp->data_size);
+ }
+ else
+ {
+ dprintf("\n Error, not define output print function!");
+ }
+ }
+
+ if ((pbuf - ioctl_buf +
+ (pptmp->data_size + 3) / 4) > (IOCTL_BUF_SIZE/4))
+ return SW_NO_RESOURCE;
+
+ pbuf += (pptmp->data_size + 3) / 4;
+
+ }
+ }
+ return SW_OK;
+}
+
+void
+cmd_strtol(char *str, a_uint32_t * arg_val)
+{
+ if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
+ sscanf(str, "%x", arg_val);
+ else
+ sscanf(str, "%d", arg_val);
+}
+
+static sw_error_t
+cmd_parse_api(char **cmd_str, a_uint32_t * arg_val)
+{
+ char *tmp_str;
+ a_uint32_t arg_index, arg_start = 2, reserve_index = 1; /*reserve for dev_id */
+ a_uint32_t last_param_in = 0;
+ a_uint32_t *temp;
+ void *pentry;
+ sw_api_param_t *pptmp = NULL;
+ sw_api_t sw_api;
+ a_uint32_t ignorecnt = 0;
+ sw_api.api_id = arg_val[0];
+ SW_RTN_ON_ERROR(sw_api_get(&sw_api));
+
+ /*set device id */
+ arg_val[arg_start] = get_devid();
+
+ for (arg_index = reserve_index; arg_index < sw_api.api_nr; arg_index++)
+ {
+ tmp_str = NULL;
+ pptmp = sw_api.api_pp + arg_index;
+
+ if (!(pptmp->param_type & SW_PARAM_IN))
+ {
+ ignorecnt++;
+ }
+
+ if (pptmp->param_type & SW_PARAM_IN)
+ {
+ tmp_str = cmd_str[arg_index - reserve_index - ignorecnt];
+ last_param_in = arg_index;
+ if((pptmp->api_id == 314) && last_param_in == 2) last_param_in = 4;//SW_API_FDB_EXTEND_NEXT wr
+ if((pptmp->api_id == 327) && last_param_in == 2) last_param_in = 4;//SW_API_FDB_EXTEND_FIRST wr
+ }
+ temp = &arg_val[arg_start + arg_index];
+
+ sw_data_type_t *data_type;
+ if (!(data_type = cmd_data_type_find(pptmp->data_type)))
+ return SW_NO_SUCH;
+
+ pentry = temp;
+ if (pptmp->param_type & SW_PARAM_PTR)
+ {
+ if (cmd_input_parser(temp, arg_index, sw_api.api_pp) != SW_OK)
+ return SW_NO_RESOURCE;
+
+ pentry = (void *) *temp;
+ }
+
+ if (pptmp->param_type & SW_PARAM_IN)
+ {
+#if 1
+ if(pptmp->param_type & SW_PARAM_PTR) //quiet mode
+ {
+ if(!get_talk_mode())
+ set_full_cmdstrp((char **)(cmd_str + (last_param_in - reserve_index)));
+ }
+#endif
+ /*check and convert input param */
+ if (data_type->param_check != NULL)
+ {
+ if (data_type->param_check(tmp_str, pentry, pptmp->data_size) != SW_OK)
+ return SW_BAD_PARAM;
+ }
+ }
+ }
+
+ /*superfluous args */
+ /*
+ if(cmd_str[last_param_in] != NULL)
+ return SW_BAD_PARAM;
+ */
+
+ return SW_OK;
+}
+
+static sw_error_t
+cmd_parse_sw(char **cmd_str, a_uint32_t * arg_val)
+{
+ char *tmp_str;
+ a_uint32_t arg_index = 0;
+ a_uint32_t api_id = arg_val[0];
+
+ tmp_str = cmd_str[arg_index];
+ while (tmp_str)
+ {
+ arg_index++;
+ cmd_strtol(tmp_str, &arg_val[arg_index]);
+ tmp_str = cmd_str[arg_index];
+ }
+
+ /*args number check */
+ if ( (arg_index == 0 && ( api_id == SW_CMD_VLAN_SHOW ||
+ api_id == SW_CMD_FDB_SHOW ||
+ api_id == SW_CMD_RESV_FDB_SHOW ||
+ api_id == SW_CMD_HOST_SHOW ||
+ api_id == SW_CMD_NAT_SHOW ||
+ api_id == SW_CMD_NAPT_SHOW ||
+ api_id == SW_CMD_INTFMAC_SHOW ||
+ api_id == SW_CMD_PUBADDR_SHOW )) ||
+ ( arg_index == 1 && api_id == SW_CMD_SET_DEVID) )
+ return SW_OK;
+
+ return SW_BAD_PARAM;
+}
+
+/*user command api*/
+sw_error_t
+cmd_exec_api(a_uint32_t *arg_val)
+{
+ sw_error_t rv;
+ sw_api_t sw_api;
+
+ sw_api.api_id = arg_val[0];
+ SW_RTN_ON_ERROR(sw_api_get(&sw_api));
+
+ /*save cmd return value */
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ /*save set device id */
+ arg_val[2] = get_devid();
+
+ rv = cmd_api_func(sw_api.api_fp, sw_api.api_nr, arg_val);
+ SW_RTN_ON_ERROR(rv);
+
+ rv = cmd_api_output(sw_api.api_pp, sw_api.api_nr, arg_val);
+ SW_RTN_ON_ERROR(rv);
+
+ return rv;
+}
+
+
+void
+cmd_print_usage (int cmd_index, int cmd_index_sub)
+{
+ if(GCMD_NAME(cmd_index))
+ dprintf("usage: %s", GCMD_NAME(cmd_index));
+
+ if (GCMD_SUB_NAME(cmd_index, cmd_index_sub))
+ dprintf(" %s", GCMD_SUB_NAME(cmd_index, cmd_index_sub));
+
+ if(GCMD_SUB_ACT(cmd_index, cmd_index_sub) && GCMD_SUB_USAGE(cmd_index, cmd_index_sub))
+ dprintf(" %s %s\n\n", GCMD_SUB_ACT(cmd_index, cmd_index_sub),
+ GCMD_SUB_USAGE(cmd_index, cmd_index_sub));
+}
+/*
+ main function
+ input args:
+ arg_val[0] = cmd_num
+ arg_val[1] = rtn_code
+ arg_val[2] = dev_id
+ arg_val[3] = dbg_cmd_num or other
+*/
+
+/*command string lookup*/
+a_uint32_t
+cmd_lookup(char **cmd_str, int *cmd_index, int *cmd_index_sub)
+{
+ a_uint32_t no, sub_no;
+ a_uint32_t cmd_deepth = 0;
+
+ *cmd_index = GCMD_DESC_NO_MATCH;
+ *cmd_index_sub = GCMD_DESC_NO_MATCH;
+
+ if (cmd_str[0] == NULL)
+ return cmd_deepth;
+
+ for (no = 0; GCMD_DESC_VALID(no); no++)
+ {
+ if (strcasecmp(cmd_str[0], GCMD_NAME(no)))
+ continue;
+
+ for (sub_no = 0; GCMD_SUB_DESC_VALID(no, sub_no); sub_no++)
+ {
+ if (cmd_str[1] != NULL && cmd_str[2] != NULL)
+ {
+
+ if (GCMD_SUB_NAME(no, sub_no) && GCMD_SUB_ACT(no, sub_no)
+ && !strcasecmp(cmd_str[1], GCMD_SUB_NAME(no, sub_no))
+ && !strcasecmp(cmd_str[2], GCMD_SUB_ACT(no, sub_no)))
+ {
+ *cmd_index = no;
+ *cmd_index_sub = sub_no;
+ cmd_deepth = 3;
+ return cmd_deepth;
+ }
+
+ else if (!GCMD_SUB_NAME(no, sub_no) && GCMD_SUB_ACT(no, sub_no)
+ && !strcasecmp(cmd_str[1], GCMD_SUB_ACT(no, sub_no)))
+ {
+ *cmd_index = no;
+ *cmd_index_sub = sub_no;
+ cmd_deepth = 2;
+ return cmd_deepth;
+ }
+ }
+ else if (cmd_str[1] != NULL && cmd_str[2] == NULL)
+ {
+
+ if (!GCMD_SUB_NAME(no, sub_no) && GCMD_SUB_ACT(no, sub_no)
+ && !strcasecmp(cmd_str[1], GCMD_SUB_ACT(no, sub_no)))
+ {
+ *cmd_index = no;
+ *cmd_index_sub = sub_no;
+ cmd_deepth = 2;
+ return cmd_deepth;
+ }
+ }
+ }
+ }
+
+ return cmd_deepth;
+}
+
+static a_uint32_t *
+cmd_parse(char *cmd_str, int *cmd_index, int *cmd_index_sub)
+{
+ int cmd_nr = 0;
+ a_uint32_t *arg_val = ioctl_argp;
+ char *tmp_str[CMDSTR_ARGS_MAX];
+
+ if (cmd_str == NULL)
+ return NULL;
+
+ memset(arg_val, 0, CMDSTR_ARGS_MAX * sizeof (a_uint32_t));
+
+ /* split string into array */
+ if ((tmp_str[cmd_nr] = (void *) strtok(cmd_str, " ")) == NULL)
+ return NULL;
+
+ /*handle help */
+ if (!strcasecmp(tmp_str[cmd_nr], "help"))
+ {
+ dprintf("input ? get help\n\n");
+ return NULL;
+ }
+
+ while (tmp_str[cmd_nr])
+ {
+ if (++cmd_nr == 3)
+ break;
+ tmp_str[cmd_nr] = (void *) strtok(NULL, " ");
+ }
+
+ /*commond string lookup */
+ int cmd_depth = cmd_lookup(tmp_str, cmd_index, cmd_index_sub);
+
+ if (*cmd_index == GCMD_DESC_NO_MATCH || *cmd_index_sub == GCMD_DESC_NO_MATCH)
+ {
+ dprintf("invalid or incomplete command.\n\n");
+ return NULL;
+ }
+
+ /*parse param */
+ cmd_nr = 0;
+ if (cmd_depth == 2)
+ {
+ tmp_str[cmd_nr] = tmp_str[2];
+ cmd_nr++;
+ }
+
+ tmp_str[cmd_nr] = (void *) strtok(NULL, " ");
+ while (tmp_str[cmd_nr])
+ {
+ if (++cmd_nr == CMDSTR_ARGS_MAX)
+ break;
+ tmp_str[cmd_nr] = (void *) strtok(NULL, " ");
+ }
+
+ arg_val[0] = GCMD_SUB_API(*cmd_index, *cmd_index_sub);
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+
+ int rtn_code;
+ if (arg_val[0] < SW_API_MAX)
+ {
+ /*api command parse */
+ rtn_code = cmd_parse_api(tmp_str, arg_val);
+
+ }
+ else if (arg_val[0] > SW_API_MAX)
+ {
+ /*user command parse */
+ rtn_code = cmd_parse_sw(tmp_str, arg_val);
+
+ }
+ else
+ {
+ rtn_code = SW_BAD_PARAM;
+ }
+
+ if(rtn_code != SW_OK)
+ {
+ cmd_print_error(rtn_code);
+
+ if(rtn_code == SW_BAD_PARAM)
+ cmd_print_usage(*cmd_index, *cmd_index_sub);
+
+ return NULL;
+ }
+
+ return arg_val;
+}
+
+static int
+cmd_exec(a_uint32_t *arg_val, int cmd_index, int cmd_index_sub)
+{
+ a_uint32_t api_id = arg_val[0];
+ sw_error_t rtn;
+
+ if( api_id < SW_API_MAX )
+ {
+ rtn = cmd_exec_api(arg_val);
+
+ }
+ else if ((api_id > SW_API_MAX ) && (api_id < SW_CMD_MAX))
+ {
+ if (GCMD_SUB_FUNC(cmd_index, cmd_index_sub))
+ rtn = GCMD_SUB_FUNC(cmd_index, cmd_index_sub)(arg_val);
+ }
+ else
+ {
+ rtn = SW_BAD_PARAM;
+ }
+
+ if(rtn != SW_OK)
+ cmd_print_error(rtn);
+ else
+ dprintf("\noperate done.\n\n");
+
+ return 0;
+}
+
+static int
+cmd_socket_init()
+{
+ sw_error_t rv;
+ garuda_init_spec_cfg chip_spec_cfg;
+
+ aos_mem_set(&chip_spec_cfg, 0 ,sizeof(garuda_init_spec_cfg));
+
+ init_cfg.cpu_mode = HSL_CPU_1;
+ init_cfg.reg_mode = HSL_MDIO;
+#if defined UK_MINOR_DEV
+ init_cfg.nl_prot = UK_MINOR_DEV;
+#else
+ init_cfg.nl_prot = 30;
+#endif
+ init_cfg.chip_type=CHIP_UNSPECIFIED;
+ init_cfg.reg_func.mdio_set = NULL;
+ init_cfg.reg_func.mdio_get = NULL;
+ init_cfg.chip_spec_cfg = &chip_spec_cfg;
+
+ rv = ssdk_init(0, &init_cfg);
+ if (SW_OK == rv)
+ {
+ dprintf("\n SSDK Init OK!");
+ }
+ else
+ {
+ dprintf("\n SSDK Init Fail! RV[%d]", rv);
+ }
+ return (int)rv;
+}
+
+static sw_error_t
+cmd_init(void)
+{
+ ioctl_buf = (a_uint32_t *) malloc(IOCTL_BUF_SIZE);
+ ioctl_argp = (a_uint32_t *) malloc(CMDSTR_ARGS_MAX * sizeof (a_uint32_t));
+ cmd_socket_init();
+
+ return SW_OK;
+}
+
+static sw_error_t
+cmd_exit(void)
+{
+ free(ioctl_buf);
+ free(ioctl_argp);
+ ssdk_cleanup();
+ return SW_OK;
+}
+
+static sw_error_t
+cmd_run_one(char *cmd_str)
+{
+ a_uint32_t *arg_list;
+ int cmd_index = 0, cmd_index_sub = 0;
+
+ if ((arg_list = cmd_parse(cmd_str, &cmd_index, &cmd_index_sub)) != NULL)
+ {
+ cmd_exec(arg_list, cmd_index, cmd_index_sub);
+ }
+
+ return SW_OK;
+}
+
+int
+cmd_is_batch(const char *cmd_str)
+{
+ char batch_cmd[] = "run";
+
+ if(!strncmp(cmd_str, batch_cmd, strlen(batch_cmd)))
+ return 1;
+ return 0;
+}
+
+static void
+cmd_batch_help(void)
+{
+ dprintf("usage:run <cmd_file> <result_file>\n");
+}
+
+static sw_error_t
+cmd_run_batch (char *cmd_str)
+{
+ FILE *in_fd = NULL;
+ char * line = NULL;
+ char *tmp_str[3];
+
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ /*usage: run cmd result*/
+ if((tmp_str[0] = (void *) strtok(cmd_str, " ")) == NULL)
+ return SW_BAD_PARAM;
+
+ /*check again*/
+ if(!cmd_is_batch(tmp_str[0]))
+ return SW_BAD_PARAM;
+
+ if((tmp_str[1] = (void *) strtok(NULL, " "))== NULL)
+ return SW_BAD_PARAM;
+ if((tmp_str[2] = (void *) strtok(NULL, " "))== NULL)
+ return SW_BAD_PARAM;
+
+ if((in_fd = fopen(tmp_str[1], "r")) == NULL)
+ {
+ dprintf("can't open cmd file %s\n", tmp_str[1]);
+ return SW_FAIL;
+ }
+ if((out_fd = fopen(tmp_str[2], "w+")) == NULL)
+ {
+ dprintf("can't open result file %s\n", tmp_str[2]);
+ return SW_FAIL;
+ }
+
+ size_t len = 0;
+ ssize_t read;
+
+ set_talk_mode(0);
+ while ((read = getline(&line, &len, in_fd)) != -1)
+ {
+ //dprintf("(%d)%s",read, line);
+ if(read <= 1 ) continue;
+
+ if(line[strlen(line)-1] == '\n');
+ line[strlen(line)-1] = '\0';
+
+ if(!strncmp(line, "echo", 4))
+ {
+ dprintf("%s\n", line+strlen("echo "));
+ continue;
+ }
+ else
+ {
+ dprintf("%s\n", line);
+ }
+ cmd_run_one(line);
+ }
+ set_talk_mode(1);
+
+ if (line) free(line);
+
+ fclose(out_fd);
+ fclose(in_fd);
+ out_fd = 0;
+ in_fd =0;
+
+ return SW_OK;
+
+}
+
+static sw_error_t
+cmd_args(char *cmd_str, int argc, const char *argv[])
+{
+ /*quiet mode*/
+ set_talk_mode(0);
+
+ if(cmd_is_batch(argv[1]))
+ {
+ if(argc != 4)
+ {
+ cmd_batch_help();
+ return SW_FAIL;
+ }
+
+ sprintf(cmd_str, "%s %s %s", argv[1], argv[2], argv[3]);
+ cmd_run_batch(cmd_str);
+
+ }
+ else
+ {
+ int argi;
+ for(argi = 1; argi < argc; argi++)
+ {
+ strcat(cmd_str, argv[argi]);
+ strcat(cmd_str, " ");
+ }
+ cmd_run_one(cmd_str);
+ }
+
+ return SW_OK;
+}
+
+int
+cmd_is_exit(char *cmd_str)
+{
+ if ((!strcasecmp(cmd_str, "q")) || (!strcasecmp(cmd_str, "quit")))
+ {
+ return 1;
+ }
+ return 0;
+}
+
+void cmd_welcome()
+{
+ char *ver = "", *date = "";
+#ifdef VERSION
+ ver = VERSION;
+#endif
+
+#ifdef BUILD_DATE
+ date = BUILD_DATE;
+#endif
+
+ dprintf("\n Welcome to SSDK Shell version: %s, at %s.\n", ver, date);
+}
+
+/* Dummy function to avoid linker complaints */
+void __aeabi_unwind_cpp_pr0(void)
+{
+};
+void __aeabi_unwind_cpp_pr1(void)
+{
+};
+
+int
+main(int argc, const char *argv[])
+{
+ char cmd_str[CMDSTR_BUF_SIZE];
+
+ cmd_init();
+
+ if(argc > 1)
+ {
+ memset(cmd_str, 0, sizeof(cmd_str));
+ cmd_args(cmd_str, argc, argv);
+ cmd_exit();
+ return 0;
+ }
+
+ cmd_welcome();
+
+ /*main loop*/
+ while (1)
+ {
+ memset(cmd_str, 0, sizeof(cmd_str));
+
+ if(next_cmd(cmd_str) == 0)/*loop through if '\n'*/
+ continue;
+
+ if (cmd_is_exit(cmd_str))
+ break;
+
+ if(cmd_is_batch(cmd_str))
+ {
+ if(cmd_run_batch(cmd_str)!= SW_OK)
+ cmd_batch_help();
+ }
+ else
+ {
+ cmd_run_one(cmd_str);
+ }
+ }
+
+ cmd_exit();
+ return 0;
+}
+
diff --git a/src/shell/shell_config.c b/src/shell/shell_config.c
new file mode 100755
index 0000000..34f06e7
--- /dev/null
+++ b/src/shell/shell_config.c
@@ -0,0 +1,683 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "shell_config.h"
+#include "shell_sw.h"
+
+
+/*cmdline tree descript*/
+struct cmd_des_t gcmd_des[] =
+{
+ /*port ctrl*/
+#ifdef IN_PORTCONTROL
+ {
+ "port", "config port control",
+ {
+ {"duplex", "get", "get duplex mode of a port", "<port_id>" , SW_API_PT_DUPLEX_GET, NULL},
+ {"duplex", "set", "set duplex mode of a port", "<port_id> <half|full>", SW_API_PT_DUPLEX_SET, NULL},
+ {"speed", "get", "get speed mode of a port", "<port_id>", SW_API_PT_SPEED_GET, NULL},
+ {"speed", "set", "set speed mode of a port", "<port_id> <10|100|1000>", SW_API_PT_SPEED_SET, NULL},
+ {"autoAdv", "get", "get auto-negotiation advertisement of a port", "<port_id>", SW_API_PT_AN_ADV_GET, NULL},
+ {"autoAdv", "set", "set auto-negotiation advertisement of a port", "<port_id> <cap_bitmap>", SW_API_PT_AN_ADV_SET, NULL},
+ {"autoNeg", "get", "get auto-negotiation status of a port", "<port_id>", SW_API_PT_AN_GET, NULL},
+ {"autoNeg", "enable", "enable auto-negotiation of a port", "<port_id>", SW_API_PT_AN_ENABLE, NULL},
+ {"autoNeg", "restart", "restart auto-negotiation process of a port", "<port_id>", SW_API_PT_AN_RESTART, NULL},
+ {"header", "set", "set atheros header/tag status of a port", "<port_id> <enable|disable>", SW_API_PT_HDR_SET, NULL},
+ {"header", "get", "get atheros header/tag status of a port", "<port_id>", SW_API_PT_HDR_GET, NULL},
+ {"txhdr", "set", "set tx frame atheros header/tag status of a port", "<port_id> <noheader|onlymanagement|allframe>", SW_API_PT_TXHDR_SET, NULL},
+ {"txhdr", "get", "get tx frame atheros header/tag status of a port", "<port_id>", SW_API_PT_TXHDR_GET, NULL},
+ {"rxhdr", "set", "set rx frame atheros header/tag status of a port", "<port_id> <noheader|onlymanagement|allframe>", SW_API_PT_RXHDR_SET, NULL},
+ {"rxhdr", "get", "get rx frame atheros header/tag status of a port", "<port_id>", SW_API_PT_RXHDR_GET, NULL},
+ {"hdrtype", "set", "set atheros header/tag type", "<enable|disable> <type 0x-0xffff>", SW_API_HEADER_TYPE_SET, NULL},
+ {"hdrtype", "get", "get atheros header/tag type", "", SW_API_HEADER_TYPE_GET, NULL},
+ {"flowCtrl", "set", "set flow control status of a port", "<port_id> <enable|disable>", SW_API_PT_FLOWCTRL_SET, NULL},
+ {"flowCtrl", "get", "get flow control status of a port", "<port_id>", SW_API_PT_FLOWCTRL_GET, NULL},
+ {"flowCtrlforcemode", "set", "set flow control force mode of a port", "<port_id> <enable|disable>", SW_API_PT_FLOWCTRL_MODE_SET, NULL},
+ {"flowCtrlforcemode", "get", "get flow control force mode of a port", "<port_id>", SW_API_PT_FLOWCTRL_MODE_GET, NULL},
+ {"powersave", "set", "set powersave status of a port", "<port_id> <enable|disable>", SW_API_PT_POWERSAVE_SET, NULL},
+ {"powersave", "get", "get powersave status of a port", "<port_id>", SW_API_PT_POWERSAVE_GET, NULL},
+ {"hibernate", "set", "set hibernate status of a port", "<port_id> <enable|disable>", SW_API_PT_HIBERNATE_SET, NULL},
+ {"hibernate", "get", "get hibernate status of a port", "<port_id>", SW_API_PT_HIBERNATE_GET, NULL},
+ {"cdt", "run", "run cable diagnostic test of a port", "<port_id> <mdi_pair>", SW_API_PT_CDT, NULL},
+ {"txmacstatus", "set", "set txmac status of a port", "<port_id> <enable|disable>", SW_API_TXMAC_STATUS_SET, NULL},
+ {"txmacstatus", "get", "get txmac status of a port", "<port_id>", SW_API_TXMAC_STATUS_GET, NULL},
+ {"rxmacstatus", "set", "set rxmac status of a port", "<port_id> <enable|disable>", SW_API_RXMAC_STATUS_SET, NULL},
+ {"rxmacstatus", "get", "get rxmac status of a port", "<port_id>", SW_API_RXMAC_STATUS_GET, NULL},
+ {"txfcstatus", "set", "set tx flow control status of a port", "<port_id> <enable|disable>", SW_API_TXFC_STATUS_SET, NULL},
+ {"txfcstatus", "get", "get tx flow control status of a port", "<port_id>", SW_API_TXFC_STATUS_GET, NULL},
+ {"rxfcstatus", "set", "set rx flow control status of a port", "<port_id> <enable|disable>", SW_API_RXFC_STATUS_SET, NULL},
+ {"rxfcstatus", "get", "get rx flow control status of a port", "<port_id>", SW_API_RXFC_STATUS_GET, NULL},
+ {"bpstatus", "set", "set back pressure status of a port", "<port_id> <enable|disable>", SW_API_BP_STATUS_SET, NULL},
+ {"bpstatus", "get", "get back pressure status of a port", "<port_id>", SW_API_BP_STATUS_GET, NULL},
+ {"linkforcemode", "set", "set link force mode of a port", "<port_id> <enable|disable>", SW_API_PT_LINK_MODE_SET, NULL},
+ {"linkforcemode", "get", "get link force mode of a port", "<port_id>", SW_API_PT_LINK_MODE_GET, NULL},
+ {"linkstatus", "get", "get link status of a port", "<port_id>", SW_API_PT_LINK_STATUS_GET, NULL},
+ {"macLoopback", "set", "set mac level loop back mode of port", "<port_id> <enable|disable>", SW_API_PT_MAC_LOOPBACK_SET, NULL},
+ {"macLoopback", "get", "get mac level loop back mode of port", "<port_id>", SW_API_PT_MAC_LOOPBACK_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL},/*end of desc*/
+ },
+ },
+#endif
+
+ /*vlan*/
+#ifdef IN_VLAN
+ {
+ "vlan", "config VLAN table",
+ {
+ {"entry", "create", "create a VLAN entry", "<vlan_id>", SW_API_VLAN_ADD, NULL},
+ {"entry", "del", "delete a VLAN entryn", "<vlan_id>", SW_API_VLAN_DEL, NULL},
+ {"entry", "update", "update port member of a VLAN entry", "<vlan_id> <member_bitmap> <0>", SW_API_VLAN_MEM_UPDATE, NULL},
+ {"entry", "find", "find a VLAN entry by VLAN id", "<vlan_id>", SW_API_VLAN_FIND, NULL},
+ {"entry", "next", "find next VLAN entry by VLAN id", "<vlan_id>",SW_API_VLAN_NEXT, NULL},
+ {"entry", "append", "append a VLAN entry", "", SW_API_VLAN_APPEND, NULL},
+ {"entry", "flush", "flush all VLAN entries", "",SW_API_VLAN_FLUSH, NULL},
+ {"entry", "show", "show whole VLAN entries", "", SW_CMD_VLAN_SHOW, cmd_show_vlan},
+ {"fid", "set", "set VLAN entry fid", "<vlan_id> <fid>",SW_API_VLAN_FID_SET, NULL},
+ {"fid", "get", "get VLAN entry fid", "<vlan_id>",SW_API_VLAN_FID_GET, NULL},
+ {"member", "add", "add VLAN entry member", "<vlan_id> <port_id> <unmodified|untagged|tagged>",SW_API_VLAN_MEMBER_ADD, NULL},
+ {"member", "del", "del VLAN entry member", "<vlan_id> <port_id>",SW_API_VLAN_MEMBER_DEL, NULL},
+ {"learnsts", "set", "set VLAN entry learn status", "<vlan_id> <enable|disable>",SW_API_VLAN_LEARN_STATE_SET, NULL},
+ {"learnsts", "get", "get VLAN entry learn status", "<vlan_id>",SW_API_VLAN_LEARN_STATE_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*portvlan*/
+#ifdef IN_PORTVLAN
+ {
+ "portVlan", "config port base VLAN",
+ {
+ {"ingress", "get", "get ingress VLAN mode of a port", "<port_id>", SW_API_PT_ING_MODE_GET, NULL},
+ {"ingress", "set", "set ingress VLAN mode of a port", "<port_id> <disable|secure|check|fallback>", SW_API_PT_ING_MODE_SET, NULL},
+ {"egress", "get", "get egress VLAN mode of a port", "<port_id>", SW_API_PT_EG_MODE_GET, NULL},
+ {"egress", "set", "set egress VLAN mode of a port", "<port_id> <unmodified|untagged|tagged|hybrid|untouched>", SW_API_PT_EG_MODE_SET, NULL},
+ {"member", "add", "add a member to the port based VLAN of a port", "<port_id> <memport_id>", SW_API_PT_VLAN_MEM_ADD, NULL},
+ {"member", "del", "delete a member from the port based VLAN of a port", "<port_id> <memport_id>", SW_API_PT_VLAN_MEM_DEL, NULL},
+ {"member", "update", "update members of the port based VLAN of a port", "<port_id> <port_bitmap>", SW_API_PT_VLAN_MEM_UPDATE, NULL},
+ {"member", "get", "get members of the port based VLAN of a port", "<port_id>", SW_API_PT_VLAN_MEM_GET, NULL},
+ {"defaultVid", "get", "get default VLAN id of a port", "<port_id>", SW_API_PT_DEF_VID_GET, NULL},
+ {"defaultVid", "set", "set default VLAN id of a port", "<port_id> <vid>", SW_API_PT_DEF_VID_SET, NULL},
+ {"forceVid", "set", "set VLAN id enforcement status of a port", "<port_id> <enable|disable>", SW_API_PT_FORCE_DEF_VID_SET, NULL},
+ {"forceVid", "get", "get VLAN id enforcement status of a port", "<port_id>", SW_API_PT_FORCE_DEF_VID_GET, NULL},
+ {"forceMode", "set", "set port based VLAN enforcement status of a port", "<port_id> <enable|disable>", SW_API_PT_FORCE_PORTVLAN_SET, NULL},
+ {"forceMode", "get", "get port based VLAN enforcement status of a port", "<port_id>", SW_API_PT_FORCE_PORTVLAN_GET, NULL},
+ {"nestVlan", "set", "set nest VLAN status of a port", "<port_id> <enable|disable>", SW_API_PT_NESTVLAN_SET, NULL},
+ {"nestVlan", "get", "get nest VLAN status of a port", "<port_id>", SW_API_PT_NESTVLAN_GET, NULL},
+ {"sVlanTPID", "set", "set service VLAN tpid", "<tpid>", SW_API_NESTVLAN_TPID_SET, NULL},
+ {"sVlanTPID", "get", "get service VLAN tpid", "", SW_API_NESTVLAN_TPID_GET, NULL},
+ /*shiva*/
+ {"invlan", "set", "set port invlan mode", "<port_id> <admit_all|admit_tagged|admit_untagged>", SW_API_PT_IN_VLAN_MODE_SET, NULL},
+ {"invlan", "get", "get port invlan mode", "<port_id>", SW_API_PT_IN_VLAN_MODE_GET, NULL},
+ {"tlsMode", "set", "set TLS mode", "<port_id> <enable|disable>", SW_API_PT_TLS_SET, NULL},
+ {"tlsMode", "get", "get TLS mode", "<port_id>", SW_API_PT_TLS_GET, NULL},
+ {"priPropagation", "set", "set priority propagation", "<port_id> <enable|disable>", SW_API_PT_PRI_PROPAGATION_SET, NULL},
+ {"priPropagation", "get", "get priority propagation", "<port_id>", SW_API_PT_PRI_PROPAGATION_GET, NULL},
+ {"defaultSVid", "set", "set default SVID", "<port_id> <vlan_id>", SW_API_PT_DEF_SVID_SET, NULL},
+ {"defaultSVid", "get", "get default SVID", "<port_id>", SW_API_PT_DEF_SVID_GET, NULL},
+ {"defaultCVid", "set", "set default CVID", "<port_id> <vlan_id>", SW_API_PT_DEF_CVID_SET, NULL},
+ {"defaultCVid", "get", "get default CVID", "<port_id>", SW_API_PT_DEF_CVID_GET, NULL},
+ {"vlanPropagation", "set", "set vlan propagation", "<port_id> <disable|clone|replace>", SW_API_PT_VLAN_PROPAGATION_SET, NULL},
+ {"vlanPropagation", "get", "get vlan propagation", "<port_id>", SW_API_PT_VLAN_PROPAGATION_GET, NULL},
+ {"translation", "add", "add vlan translation", "<port_id>", SW_API_PT_VLAN_TRANS_ADD, NULL},
+ {"translation", "del", "del vlan translation", "<port_id>", SW_API_PT_VLAN_TRANS_DEL, NULL},
+ {"translation", "get", "get vlan translation", "<port_id>", SW_API_PT_VLAN_TRANS_GET, NULL},
+ {"translation", "iterate", "iterate vlan translation tables", "<port_id> <iterator>", SW_API_PT_VLAN_TRANS_ITERATE, NULL},
+ {"qinqMode", "set", "set qinq mode", "<ctag|stag>", SW_API_QINQ_MODE_SET, NULL},
+ {"qinqMode", "get", "get qinq mode", "", SW_API_QINQ_MODE_GET, NULL},
+ {"qinqRole", "set", "set qinq role", "<port_id> <edge|core>", SW_API_PT_QINQ_ROLE_SET, NULL},
+ {"qinqRole", "get", "get qinq role", "<port_id>", SW_API_PT_QINQ_ROLE_GET, NULL},
+ {"macvlanxlt", "set", "set mac vlan xlt status", "<port_id> <enable|disable>", SW_API_PT_MAC_VLAN_XLT_SET, NULL},
+ {"macvlanxlt", "get", "set mac vlan xlt status", "<port_id>", SW_API_PT_MAC_VLAN_XLT_GET, NULL},
+ {"netiso", "set", "enable public/private net isolate", "<enable|disable>", SW_API_NETISOLATE_SET, NULL},
+ {"netiso", "get", "get public/private net isolate status", "", SW_API_NETISOLATE_GET, NULL},
+ {"egbypass", "set", "enable egress translation filter bypass", "<enable|disable>", SW_API_EG_FLTR_BYPASS_EN_SET, NULL},
+ {"egbypass", "get", "get the status of egress translation filter bypass", "", SW_API_EG_FLTR_BYPASS_EN_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*fdb*/
+#ifdef IN_FDB
+ {
+ "fdb", "config FDB table",
+ {
+ {"entry", "add", "add a FDB entry", "", SW_API_FDB_ADD, NULL},
+ {"entry", "del", "delete a FDB entry", "", SW_API_FDB_DELMAC, NULL},
+ {"entry", "flush", "flush all FDB entries", "<0:dynamic only|1:dynamic and static>", SW_API_FDB_DELALL, NULL},
+ {"entry", "show", "show whole FDB entries", "", SW_CMD_FDB_SHOW, cmd_show_fdb},
+ {"entry", "find", "find a FDB entry", "", SW_API_FDB_FIND, NULL},
+ {"entry", "iterate", "iterate all FDB entries", "<iterator>", SW_API_FDB_ITERATE, NULL},
+ {"entry", "extendnext", "find next FDB entry in extend mode", "", SW_API_FDB_EXTEND_NEXT, NULL},
+ {"entry", "extendfirst", "find first FDB entry in extend mode", "", SW_API_FDB_EXTEND_FIRST, NULL},
+ {"entry", "transfer", "transfer port info in FDB entry", "<old port_id> <new port_id> <fid>", SW_API_FDB_TRANSFER, NULL},
+ {"portEntry", "flush", "flush all FDB entries by a port", "<port_id> <0:dynamic only|1:dynamic and static>", SW_API_FDB_DELPORT, NULL},
+ {"firstEntry", "find", "find the first FDB entry", "", SW_API_FDB_FIRST, NULL},
+ {"nextEntry", "find", "find next FDB entry", "", SW_API_FDB_NEXT, NULL},
+ {"portLearn", "set", "set FDB entry learning status of a port", "<port_id> <enable|disable>", SW_API_FDB_PT_LEARN_SET, NULL},
+ {"portLearn", "get", "get FDB entry learning status of a port", "<port_id>", SW_API_FDB_PT_LEARN_GET, NULL},
+ {"ageCtrl", "set", "set FDB entry aging status", "<enable|disable>", SW_API_FDB_AGE_CTRL_SET, NULL},
+ {"ageCtrl", "get", "get FDB entry aging status", "", SW_API_FDB_AGE_CTRL_GET, NULL},
+ {"vlansmode", "set", "set FDB vlan search mode", "<ivl|svl>", SW_API_FDB_VLAN_IVL_SVL_SET, NULL},
+ {"vlansmode", "get", "get FDB vlan search mode", "", SW_API_FDB_VLAN_IVL_SVL_GET, NULL},
+ {"ageTime", "set", "set FDB entry aging time", "<time:s>", SW_API_FDB_AGE_TIME_SET, NULL},
+ {"ageTime", "get", "get FDB entry aging time", "", SW_API_FDB_AGE_TIME_GET, NULL},
+ {"ptlearnlimit", "set", "set port FDB entry learn limit", "<port_id> <enable|disable> <limitcounter>", SW_API_PT_FDB_LEARN_LIMIT_SET, NULL},
+ {"ptlearnlimit", "get", "get port FDB entry learn limit", "<port_id>", SW_API_PT_FDB_LEARN_LIMIT_GET, NULL},
+ {"ptlearnexceedcmd", "set", "set port forwarding cmd when exceed learn limit", "<port_id> <forward|drop|cpycpu|rdtcpu>", SW_API_PT_FDB_LEARN_EXCEED_CMD_SET, NULL},
+ {"ptlearnexceedcmd", "get", "get port forwarding cmd when exceed learn limit", "<port_id>", SW_API_PT_FDB_LEARN_EXCEED_CMD_GET, NULL},
+ {"learnlimit", "set", "set FDB entry learn limit", "<enable|disable> <limitcounter>", SW_API_FDB_LEARN_LIMIT_SET, NULL},
+ {"learnlimit", "get", "get FDB entry learn limit", "", SW_API_FDB_LEARN_LIMIT_GET, NULL},
+ {"learnexceedcmd", "set", "set forwarding cmd when exceed learn limit", "<forward|drop|cpycpu|rdtcpu>", SW_API_FDB_LEARN_EXCEED_CMD_SET, NULL},
+ {"learnexceedcmd", "get", "get forwarding cmd when exceed learn limit", "", SW_API_FDB_LEARN_EXCEED_CMD_GET, NULL},
+ {"resventry", "add", "add a reserve FDB entry", "", SW_API_FDB_RESV_ADD, NULL},
+ {"resventry", "del", "delete reserve a FDB entry", "", SW_API_FDB_RESV_DEL, NULL},
+ {"resventry", "find", "find a reserve FDB entry", "", SW_API_FDB_RESV_FIND, NULL},
+ {"resventry", "iterate", "iterate all reserve FDB entries", "<iterator>", SW_API_FDB_RESV_ITERATE, NULL},
+ {"resventry", "show", "show whole resv FDB entries", "", SW_CMD_RESV_FDB_SHOW, cmd_show_resv_fdb},
+ {"ptLearnstatic", "set", "set FDB entry learning static status of a port", "<port_id> <enable|disable>", SW_API_FDB_PT_LEARN_STATIC_SET, NULL},
+ {"ptLearnStatic", "get", "get FDB entry learning static status of a port", "<port_id>", SW_API_FDB_PT_LEARN_STATIC_GET, NULL},
+ {"port", "add", "add one port to a FDB entry", "<fid> <macaddr> <port_id>", SW_API_FDB_PORT_ADD, NULL},
+ {"port", "del", "del one port from a FDB entry", "<fid> <macaddr> <port_id>", SW_API_FDB_PORT_DEL, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*acl*/
+#ifdef IN_ACL
+ {
+ "acl", "config ACL",
+ {
+ {"list", "create", "create an ACL list", "<list_id> <priority>", SW_API_ACL_LIST_CREAT, NULL},
+ {"list", "destroy", "destroy an ACL list", "<list_id>", SW_API_ACL_LIST_DESTROY, NULL},
+ {"list", "bind", "bind an ACL list to a port", "<list_id> <0-0:direction> <0-0:objtype> <objindex>", SW_API_ACL_LIST_BIND, NULL},
+ {"list", "unbind", "unbind an ACL list from a port", "<list_id> <0-0:direction> <0-0:objtype> <objindex>", SW_API_ACL_LIST_UNBIND, NULL},
+ {"rule", "add", "add ACL rules to an ACL list", "<list_id> <rule_id> <rule_nr>", SW_API_ACL_RULE_ADD, NULL},
+ {"rule", "del", "delete ACL rules from an ACL list", "<list_id> <rule_id> <rule_nr>", SW_API_ACL_RULE_DELETE, NULL},
+ {"rule", "query", "query a ACL rule", "<list_id> <rule_id>", SW_API_ACL_RULE_QUERY, NULL},
+ {"rule", "active", "active ACL rules in an ACL list", "<list_id> <rule_id> <rule_nr>", SW_API_ACL_RULE_ACTIVE, NULL},
+ {"rule", "deactive", "deactive ACL rules in an ACL list", "<list_id> <rule_id> <rule_nr>", SW_API_ACL_RULE_DEACTIVE, NULL},
+ {"srcfiltersts", "set", "set status of ACL rules source filter", "<rule_id> <enable|disable>", SW_API_ACL_RULE_SRC_FILTER_STS_SET, NULL},
+ {"srcfiltersts", "get", "get status of ACL rules source filter", "<rule_id>", SW_API_ACL_RULE_SRC_FILTER_STS_GET, NULL},
+ {"status", "set", "set status of ACL engine", "<enable|disable>", SW_API_ACL_STATUS_SET, NULL},
+ {"status", "get", "get status of ACL engine", "", SW_API_ACL_STATUS_GET, NULL},
+ {"udfprofile", "set", "set port udf profile", "<port_id> <l2/l2snap/l3/l3plus/l4> <offset> <length>", SW_API_ACL_PT_UDF_PROFILE_SET, NULL},
+ {"udfprofile", "get", "get port udf profile", "<port_id> <l2/l2snap/l3/l3plus/l4>", SW_API_ACL_PT_UDF_PROFILE_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*qos*/
+#ifdef IN_QOS
+ {
+ "qos", "config Qos",
+ {
+ {"schMode", "set", "set traffic scheduling mode", "<sp|wrr|mix|mix_plus> <q0,q1,q3,q4>", SW_API_QOS_SCH_MODE_SET, NULL},
+ {"schMode", "get", "get traffic scheduling mode", "", SW_API_QOS_SCH_MODE_GET, NULL},
+ {"qTxBufSts", "set", "set queue tx buffer counting status of a port", "<port_id> <enable|disable>", SW_API_QOS_QU_TX_BUF_ST_SET, NULL},
+ {"qTxBufSts", "get", "get queue tx buffer counting status of a port", "<port_id>", SW_API_QOS_QU_TX_BUF_ST_GET, NULL},
+ {"qTxBufNr", "set", "set queue tx buffer number", "<port_id> <queueid:0-3> <number:0-120>", SW_API_QOS_QU_TX_BUF_NR_SET, NULL},
+ {"qTxBufNr", "get", "get queue tx buffer number", "<port_id> <queueid:0-3>", SW_API_QOS_QU_TX_BUF_NR_GET, NULL},
+ {"ptTxBufSts", "set", "set port tx buffer counting status of a port", "<port_id> <enable|disable>", SW_API_QOS_PT_TX_BUF_ST_SET, NULL},
+ {"ptTxBufSts", "get", "get port tx buffer counting status of a port", "<port_id>", SW_API_QOS_PT_TX_BUF_ST_GET, NULL},
+ {"ptRedEn", "set", "set status of port wred of a port", "<port_id> <enable|disable>", SW_API_QOS_PT_RED_EN_SET, NULL},
+ {"ptRedEn", "get", "get status of port wred of a port", "<port_id>", SW_API_QOS_PT_RED_EN_GET, NULL},
+ {"ptTxBufNr", "set", "set port tx buffer number", "<port_id> <number:0-504>", SW_API_QOS_PT_TX_BUF_NR_SET, NULL},
+ {"ptTxBufNr", "get", "get port tx buffer number", "<port_id>", SW_API_QOS_PT_TX_BUF_NR_GET, NULL},
+ {"ptRxBufNr", "set", "set port rx buffer number", "<port_id> <number:0-120>", SW_API_QOS_PT_RX_BUF_NR_SET, NULL},
+ {"ptRxBufNr", "get", "get port rx buffer number", "<port_id>", SW_API_QOS_PT_RX_BUF_NR_GET, NULL},
+ {"up2q", "set", "set user priority to queue mapping", "<up:0-7> <queueid:0-3>", SW_API_COSMAP_UP_QU_SET, NULL},
+ {"up2q", "get", "get user priority to queue mapping", "<up:0-7>", SW_API_COSMAP_UP_QU_GET, NULL},
+ {"dscp2q", "set", "set dscp to queue mapping", "<dscp:0-63> <queueid:0-3>", SW_API_COSMAP_DSCP_QU_SET, NULL},
+ {"dscp2q", "get", "get dscp to queue mapping", "<dscp:0-63>", SW_API_COSMAP_DSCP_QU_GET, NULL},
+ {"ptMode", "set", "set Qos mode of a port", "<port_id> <da|up|dscp> <enable|disable>", SW_API_QOS_PT_MODE_SET, NULL},
+ {"ptMode", "get", "get Qos mode of a port", "<port_id> <da|up|dscp>", SW_API_QOS_PT_MODE_GET, NULL},
+ {"ptModePri", "set", "set the priority of Qos modes of a port", "<port_id> <da|up|dscp> <priority:0-3>", SW_API_QOS_PT_MODE_PRI_SET, NULL},
+ {"ptModePri", "get", "get the priority of Qos modes of a port", "<port_id> <da|up|dscp>", SW_API_QOS_PT_MODE_PRI_GET, NULL},
+ {"ptDefaultUp", "set", "set default user priority for received frames of a port", "<port_id> <up:0-7>", SW_API_QOS_PORT_DEF_UP_SET, NULL},
+ {"ptDefaultUp", "get", "get default user priority for received frames of a port", "<port_id>", SW_API_QOS_PORT_DEF_UP_GET, NULL},
+ {"ptschMode", "set", "set port traffic scheduling mode", "<port_id> <sp|wrr|mix|mixplus> <q0,q1,q2,q3,q4,q5>", SW_API_QOS_PORT_SCH_MODE_SET, NULL},
+ {"ptschMode", "get", "get port traffic scheduling mode", "<port_id>", SW_API_QOS_PORT_SCH_MODE_GET, NULL},
+ {"ptDefaultSpri", "set", "set default stag priority for received frames of a port", "<port_id> <spri:0-7>", SW_API_QOS_PT_DEF_SPRI_SET, NULL},
+ {"ptDefaultSpri", "get", "get default stag priority for received frames of a port", "<port_id>", SW_API_QOS_PT_DEF_SPRI_GET, NULL},
+ {"ptDefaultCpri", "set", "set default ctag priority for received frames of a port", "<port_id> <cpri:0-7>", SW_API_QOS_PT_DEF_CPRI_SET, NULL},
+ {"ptDefaultCpri", "get", "get default ctag priority for received frames of a port", "<port_id>", SW_API_QOS_PT_DEF_CPRI_GET, NULL},
+ {"ptFSpriSts", "set", "set port force Stag priority status for received frames of a port", "<port_id> <enable|disable>", SW_API_QOS_PT_FORCE_SPRI_ST_SET, NULL},
+ {"ptFSpriSts", "get", "get port force Stag priority status for received frames of a port", "<port_id>", SW_API_QOS_PT_FORCE_SPRI_ST_GET, NULL},
+ {"ptFCpriSts", "set", "set port force Ctag priority status for received frames of a port", "<port_id> <enable|disable>", SW_API_QOS_PT_FORCE_CPRI_ST_SET, NULL},
+ {"ptFCpriSts", "get", "get port force Ctag priority status for received frames of a port", "<port_id>", SW_API_QOS_PT_FORCE_CPRI_ST_GET, NULL},
+ {"ptQuRemark", "set", "set egress queue based remark", "<port_id> <queue_id> <table_id> <enable|disable>", SW_API_QOS_QUEUE_REMARK_SET, NULL},
+ {"ptQuRemark", "get", "get egress queue based remark", "<port_id> <queue_id>", SW_API_QOS_QUEUE_REMARK_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*igmp*/
+#ifdef IN_IGMP
+ {
+ "igmp", "config IGMP/MLD",
+ {
+ {"mode", "set", "set IGMP/MLD snooping status of a port", "<port_id> <enable|disable>", SW_API_PT_IGMPS_MODE_SET, NULL},
+ {"mode", "get", "get port IGMP/MLD snooping status", "<port_id>", SW_API_PT_IGMPS_MODE_GET, NULL},
+ {"cmd", "set", "set IGMP/MLD frames forwarding command", "<forward|drop|cpycpu|rdtcpu>", SW_API_IGMP_MLD_CMD_SET, NULL},
+ {"cmd", "get", "get IGMP/MLD frames forwarding command", "", SW_API_IGMP_MLD_CMD_GET, NULL},
+ {"portJoin", "set", "set IGMP/MLD hardware joining status", "<port_id> <enable|disable>", SW_API_IGMP_PT_JOIN_SET, NULL},
+ {"portJoin", "get", "get IGMP/MLD hardware joining status", "<port_id>", SW_API_IGMP_PT_JOIN_GET, NULL},
+ {"portLeave", "set", "set IGMP/MLD hardware leaving status", "<port_id> <enable|disable>", SW_API_IGMP_PT_LEAVE_SET, NULL},
+ {"portLeave", "get", "get IGMP/MLD hardware leaving status", "<port_id>", SW_API_IGMP_PT_LEAVE_GET, NULL},
+ {"rp", "set", "set IGMP/MLD router ports", "<port_bit_map>", SW_API_IGMP_RP_SET, NULL},
+ {"rp", "get", "get IGMP/MLD router ports", "", SW_API_IGMP_RP_GET, NULL},
+ {"createStatus", "set", "set IGMP/MLD ability for creating entry", "<enable|disable>", SW_API_IGMP_ENTRY_CREAT_SET, NULL},
+ {"createStatus", "get", "get IGMP/MLD ability for creating entry", "", SW_API_IGMP_ENTRY_CREAT_GET, NULL},
+ {"static", "set", "set IGMP/MLD static status for creating entry", "<enable|disable>", SW_API_IGMP_ENTRY_STATIC_SET, NULL},
+ {"static", "get", "get IGMP/MLD static status for creating entry", "", SW_API_IGMP_ENTRY_STATIC_GET, NULL},
+ {"leaky", "set", "set IGMP/MLD leaky status for creating entry", "<enable|disable>", SW_API_IGMP_ENTRY_LEAKY_SET, NULL},
+ {"leaky", "get", "get IGMP/MLD leaky status for creating entry", "", SW_API_IGMP_ENTRY_LEAKY_GET, NULL},
+ {"version3", "set", "set IGMP v3/MLD v2 status for creating entry", "<enable|disable>", SW_API_IGMP_ENTRY_V3_SET, NULL},
+ {"version3", "get", "get IGMP v3/MLD v2 status for creating entry", "", SW_API_IGMP_ENTRY_V3_GET, NULL},
+ {"queue", "set", "set IGMP/MLD queue status for creating entry", "<enable|disable> <queue_id>", SW_API_IGMP_ENTRY_QUEUE_SET, NULL},
+ {"queue", "get", "get IGMP/MLD queue status for creating entry", "", SW_API_IGMP_ENTRY_QUEUE_GET, NULL},
+ {"ptlearnlimit", "set", "set port Multicast entry learn limit", "<port_id> <enable|disable> <limitcounter>", SW_API_PT_IGMP_LEARN_LIMIT_SET, NULL},
+ {"ptlearnlimit", "get", "get port Multicast entry learn limit", "<port_id>", SW_API_PT_IGMP_LEARN_LIMIT_GET, NULL},
+ {"ptlearnexceedcmd", "set", "set port forwarding cmd when exceed multicast learn limit", "<port_id> <forward|drop|cpycpu|rdtcpu>", SW_API_PT_IGMP_LEARN_EXCEED_CMD_SET, NULL},
+ {"ptlearnexceedcmd", "get", "get port forwarding cmd when exceed multicast learn limit", "<port_id>", SW_API_PT_IGMP_LEARN_EXCEED_CMD_GET, NULL},
+ {"multi", "set", "set igmp/mld entry", "<entry>", SW_API_IGMP_SG_ENTRY_SET, NULL},
+ {"multi", "clear", "clear igmp/mld entry", "<entry>", SW_API_IGMP_SG_ENTRY_CLEAR, NULL},
+ {"multi", "show", "show all igmp/mld entry", "", SW_API_IGMP_SG_ENTRY_SHOW, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*leaky*/
+#ifdef IN_LEAKY
+ {
+ "leaky", "config leaky",
+ {
+ {"ucMode", "set", "set unicast packets leaky mode", "<port|fdb>", SW_API_UC_LEAKY_MODE_SET, NULL},
+ {"ucMode", "get", "get unicast packets leaky mode", "", SW_API_UC_LEAKY_MODE_GET, NULL},
+ {"mcMode", "set", "set multicast packets leaky mode", "<port|fdb>", SW_API_MC_LEAKY_MODE_SET, NULL},
+ {"mcMode", "get", "get multicast packets leaky mode", "", SW_API_MC_LEAKY_MODE_GET, NULL},
+ {"arpMode", "set", "set arp packets leaky mode", "<port_id> <enable|disable>", SW_API_ARP_LEAKY_MODE_SET, NULL},
+ {"arpMode", "get", "get arp packets leaky mode", "<port_id>", SW_API_ARP_LEAKY_MODE_GET, NULL},
+ {"ptUcMode", "set", "set unicast packets leaky status of a port", "<port_id> <enable|disable>", SW_API_PT_UC_LEAKY_MODE_SET, NULL},
+ {"ptUcMode", "get", "get unicast packets leaky status of a port", "<port_id>", SW_API_PT_UC_LEAKY_MODE_GET, NULL},
+ {"ptMcMode", "set", "set multicast packets leaky status of a port", "<port_id> <enable|disable>", SW_API_PT_MC_LEAKY_MODE_SET, NULL},
+ {"ptMcMode", "get", "get multicast packets leaky status of a port", "<port_id>", SW_API_PT_MC_LEAKY_MODE_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*mirror*/
+#ifdef IN_MIRROR
+ {
+ "mirror", "config mirror",
+ {
+ {"analyPt", "set", "set mirror analysis port", "<port_id>", SW_API_MIRROR_ANALY_PT_SET, NULL},
+ {"analyPt", "get", "get mirror analysis port", "", SW_API_MIRROR_ANALY_PT_GET, NULL},
+ {"ptIngress", "set", "set ingress mirror status of a port", "<port_id> <enable|disable>", SW_API_MIRROR_IN_PT_SET, NULL},
+ {"ptIngress", "get", "get ingress mirror status of a port", "<port_id>", SW_API_MIRROR_IN_PT_GET, NULL},
+ {"ptEgress", "set", "set egress mirror status of a port", "<port_id> <enable|disable>", SW_API_MIRROR_EG_PT_SET, NULL},
+ {"ptEgress", "get", "get egress mirror status of a port", "<port_id>", SW_API_MIRROR_EG_PT_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*rate*/
+#ifdef IN_RATE
+ {
+ "rate", "config rate limit",
+ {
+ {"qEgress", "set", "set egress rate limit of a queue", "<port_id> <queueid:0-3> <speed:(kbps)> <enable|disable>", SW_API_RATE_QU_EGRL_SET, NULL},
+ {"qEgress", "get", "get egress rate limit of a queue", "<port_id> <queueid:0-3>", SW_API_RATE_QU_EGRL_GET, NULL},
+ {"ptEgress", "set", "set egress rate limit of a port", "<port_id> <speed:(kbps)> <enable|disable>", SW_API_RATE_PT_EGRL_SET, NULL},
+ {"ptEgress", "get", "get egress rate limit of a port", "<port_id>", SW_API_RATE_PT_EGRL_GET, NULL},
+ {"ptIngress", "set", "set ingress rate limit of a port", "<port_id> <speed:(kbps)> <enable|disable>", SW_API_RATE_PT_INRL_SET, NULL},
+ {"ptIngress", "get", "get ingress rate limit of a port", "<port_id>", SW_API_RATE_PT_INRL_GET, NULL},
+ {"stormCtrl", "set", "set storm control status of a particular frame type", "<port_id> <unicast|multicast|broadcast> <enable|disable>", SW_API_STORM_CTRL_FRAME_SET, NULL},
+ {"stormCtrl", "get", "get storm control status of a particular frame type", "<port_id> <unicast|multicast|broadcast>", SW_API_STORM_CTRL_FRAME_GET, NULL},
+ {"stormCtrlRate", "set", "set storm ctrl rate", "<port_id> <rate:(packets/s)>", SW_API_STORM_CTRL_RATE_SET, NULL},
+ {"stormCtrlRate", "get", "get storm ctrl rate", "<port_id>", SW_API_STORM_CTRL_RATE_GET, NULL},
+ {"portpolicer", "set", "set port policer", "<port_id>", SW_API_RATE_PORT_POLICER_SET, NULL},
+ {"portpolicer", "get", "get port policer", "<port_id>", SW_API_RATE_PORT_POLICER_GET, NULL},
+ {"portshaper", "set", "set port egress shaper", "<port_id> <enable|disable>", SW_API_RATE_PORT_SHAPER_SET, NULL},
+ {"portshaper", "get", "get port egress shaper", "<port_id>", SW_API_RATE_PORT_SHAPER_GET, NULL},
+ {"queueshaper", "set", "set queue egress shaper", "<port_id> <queue_id> <enable|disable>", SW_API_RATE_QUEUE_SHAPER_SET, NULL},
+ {"queueshaper", "get", "get queue egress shaper", "<port_id> <queue_id>", SW_API_RATE_QUEUE_SHAPER_GET, NULL},
+ {"aclpolicer", "set", "set acl policer", "<policer_id>", SW_API_RATE_ACL_POLICER_SET, NULL},
+ {"aclpolicer", "get", "get acl policer", "<policer_id>", SW_API_RATE_ACL_POLICER_GET, NULL},
+ {"ptAddRateByte", "set", "set add_rate_byte when cal rate ", "<port_id> <number:0-255>", SW_API_RATE_PT_ADDRATEBYTE_SET, NULL},
+ {"ptAddRateByte", "get", "get add_rate_byte when cal rate ", "<port_id>", SW_API_RATE_PT_ADDRATEBYTE_GET, NULL},
+ {"ptgolflowen", "set", "set status of port globle flow control", "<port_id> <enable|disable>", SW_API_RATE_PT_GOL_FLOW_EN_SET, NULL},
+ {"ptgolflowen", "get", "get status of port globle flow control", "<port_id>", SW_API_RATE_PT_GOL_FLOW_EN_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+#ifdef IN_SEC
+#ifdef ISISC
+ {
+ "sec", "config security",
+ {
+ {"mac", "set", "set MAC layer related security", "<resv_vid/invalid_src_addr> <value>", SW_API_SEC_MAC_SET, NULL},
+ {"mac", "get", "get MAC layer related security", "<resv_vid/invalid_src_addr>", SW_API_SEC_MAC_GET, NULL},
+ {"ip", "set", "set IP layer related security", "<invalid_ver/same_addr/ttl_change_status/ttl_val> <value>", SW_API_SEC_IP_SET, NULL},
+ {"ip", "get", "get IP layer related security", "<invalid_ver/same_addr/ttl_change_status/ttl_val>", SW_API_SEC_IP_GET, NULL},
+ {"ip4", "set", "set IP4 related security", "<invalid_hl/hdr_opts/invalid_df/frag_offset_min_len/frag_offset_min_size/frag_offset_max_len/invalid_frag_offset/invalid_sip/invalid_dip/invalid_chksum/invalid_pl/df_clear_status/ipid_random_status> <value>", SW_API_SEC_IP4_SET, NULL},
+ {"ip4", "get", "get IP4 related security", "<invalid_hl/hdr_opts/invalid_df/frag_offset_min_len/frag_offset_min_size/frag_offset_max_len/invalid_frag_offset/invalid_sip/invalid_dip/invalid_chksum/invalid_pl/df_clear_status/ipid_random_status>", SW_API_SEC_IP4_GET, NULL},
+ {"ip6", "set", "set IP6 related security", "<invalid_dip/invalid_sip/invalid_pl> <value>", SW_API_SEC_IP6_SET, NULL},
+ {"ip6", "get", "get IP6 related security", "<invalid_dip/invalid_sip/invalid_pl>", SW_API_SEC_IP6_GET, NULL},
+ {"tcp", "set", "set TCP related security", "<blat/invalid_hl/min_hdr_size/invalid_syn/su_block/sp_block/sap_block/xmas_scan/null_scan/sr_block/sf_block/sar_block/rst_scan/rst_with_data/fa_block/pa_block/ua_block/invalid_chksum/invalid_urgptr/invalid_opts> <value>", SW_API_SEC_TCP_SET, NULL},
+ {"tcp", "get", "get TCP related security", "<blat/invalid_hl/min_hdr_size/invalid_syn/su_block/sp_block/sap_block/xmas_scan/null_scan/sr_block/sf_block/sar_block/rst_scan/rst_with_data/fa_block/pa_block/ua_block/invalid_chksum/invalid_urgptr/invalid_opts>", SW_API_SEC_TCP_GET, NULL},
+ {"udp", "set", "set UDP related security", "<blat/invalid_len/invalid_chksum> <value>", SW_API_SEC_UDP_SET, NULL},
+ {"udp", "get", "get UDP related security", "<blat/invalid_len/invalid_chksum>", SW_API_SEC_UDP_GET, NULL},
+ {"icmp4", "set", "set ICMP4 related security", "<ping_pl_exceed/ping_frag/ping_max_pl> <value>", SW_API_SEC_ICMP4_SET, NULL},
+ {"icmp4", "get", "get ICMP4 related security", "<ping_pl_exceed/ping_frag/ping_max_pl>", SW_API_SEC_ICMP4_GET, NULL},
+ {"icmp6", "set", "set ICMP6 related security", "<ping_pl_exceed/ping_frag/ping_max_pl> <value>", SW_API_SEC_ICMP6_SET, NULL},
+ {"icmp6", "get", "get ICMP6 related security", "<ping_pl_exceed/ping_frag/ping_max_pl>", SW_API_SEC_ICMP6_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+#endif
+
+ /*stp*/
+#ifdef IN_STP
+ {
+ "stp", "config STP",
+ {
+ {"portState", "set", "set STP state of a port", "<st_id> <port_id> <disable|block|listen|learn|forward>", SW_API_STP_PT_STATE_SET, NULL},
+ {"portState", "get", "get STP state of a port", "<st_id> <port_id>", SW_API_STP_PT_STATE_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*mib*/
+#ifdef IN_MIB
+ {
+ "mib", "show MIB statistics information",
+ {
+ {"statistics", "get", "get statistics information of a port", "<port_id>", SW_API_PT_MIB_GET, NULL},
+ {"status", "set", "set mib status", "<enable|disable>", SW_API_MIB_STATUS_SET, NULL},
+ {"status", "get", "get mib status", "", SW_API_MIB_STATUS_GET, NULL},
+ {"counters", "flush", "flush counters of a port", "<port_id>", SW_API_PT_MIB_FLUSH_COUNTERS, NULL},
+ {"cpuKeep", "set", "set cpu keep bit", "<enable|disable>", SW_API_MIB_CPU_KEEP_SET, NULL},
+ {"cpuKeep", "get", "get cpu keep bit", "", SW_API_MIB_CPU_KEEP_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /* led */
+#ifdef IN_LED
+ {
+ "led", "set/get led control pattern",
+ {
+ {"ctrlpattern", "set", "set led control pattern", "<group_id> <led_id>", SW_API_LED_PATTERN_SET, NULL},
+ {"ctrlpattern", "get", "get led control pattern", "<group_id> <led_id>", SW_API_LED_PATTERN_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /* cosmap */
+#ifdef IN_COSMAP
+ {
+ "cosmap", "set/get cosmap table",
+ {
+ {"dscp2pri", "set", "set dscp to priority map table", "<dscp> <priority>", SW_API_COSMAP_DSCP_TO_PRI_SET, NULL},
+ {"dscp2pri", "get", "get dscp to priority map table", "<dscp>", SW_API_COSMAP_DSCP_TO_PRI_GET, NULL},
+ {"dscp2dp", "set", "set dscp to dp map table", "<dscp> <dp>", SW_API_COSMAP_DSCP_TO_DP_SET, NULL},
+ {"dscp2dp", "get", "get dscp to dp map table", "<dscp>", SW_API_COSMAP_DSCP_TO_DP_GET, NULL},
+ {"up2pri", "set", "set dot1p to priority map table", "<up> <priority>", SW_API_COSMAP_UP_TO_PRI_SET, NULL},
+ {"up2pri", "get", "get dot1p to priority map table", "<up>", SW_API_COSMAP_UP_TO_PRI_GET, NULL},
+ {"up2dp", "set", "set dot1p to dp map table", "<up> <dp>", SW_API_COSMAP_UP_TO_DP_SET, NULL},
+ {"up2dp", "get", "get dot1p to dp map table", "<up>", SW_API_COSMAP_UP_TO_DP_GET, NULL},
+ {"pri2q", "set", "set priority to queue mapping", "<priority> <queueid>", SW_API_COSMAP_PRI_TO_QU_SET, NULL},
+ {"pri2q", "get", "get priority to queue mapping", "<priority>", SW_API_COSMAP_PRI_TO_QU_GET, NULL},
+ {"pri2ehq", "set", "set priority to enhanced queue mapping", "<priority> <queueid>", SW_API_COSMAP_PRI_TO_EHQU_SET, NULL},
+ {"pri2ehq", "get", "get priority to enhanced queue mapping", "<priority>", SW_API_COSMAP_PRI_TO_EHQU_GET, NULL},
+ {"egRemark", "set", "set egress remark table", "<tableid>", SW_API_COSMAP_EG_REMARK_SET, NULL},
+ {"egRemark", "get", "get egress remark table", "<tableid>", SW_API_COSMAP_EG_REMARK_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*misc*/
+#ifdef IN_MISC
+ {
+ "misc", "config miscellaneous",
+ {
+ {"arp", "set", "set arp packets hardware identification status", "<enable|disable>", SW_API_ARP_STATUS_SET, NULL},
+ {"arp", "get", "get arp packets hardware identification status", "", SW_API_ARP_STATUS_GET, NULL},
+ {"frameMaxSize", "set", "set the maximal received frame size of the device", "<size:byte>", SW_API_FRAME_MAX_SIZE_SET, NULL},
+ {"frameMaxSize", "get", "get the maximal received frame size of the device", "", SW_API_FRAME_MAX_SIZE_GET, NULL},
+ {"ptUnkSaCmd", "set", "set forwarding command for frames with unknown source address", "<port_id> <forward|drop|cpycpu|rdtcpu>", SW_API_PT_UNK_SA_CMD_SET, NULL},
+ {"ptUnkSaCmd", "get", "get forwarding command for frames with unknown source address", "<port_id>", SW_API_PT_UNK_SA_CMD_GET, NULL},
+ {"ptUnkUcFilter", "set", "set flooding status of unknown unicast frames", "<port_id> <enable|disable>", SW_API_PT_UNK_UC_FILTER_SET, NULL},
+ {"ptUnkUcFilter", "get", "get flooding status of unknown unicast frames", "<port_id>", SW_API_PT_UNK_UC_FILTER_GET, NULL},
+ {"ptUnkMcFilter", "set", "set flooding status of unknown multicast frames", "<port_id> <enable|disable>", SW_API_PT_UNK_MC_FILTER_SET, NULL},
+ {"ptUnkMcFilter", "get", "get flooding status of unknown multicast frames", "<port_id>", SW_API_PT_UNK_MC_FILTER_GET, NULL},
+ {"ptBcFilter", "set", "set flooding status of broadcast frames", "<port_id> <enable|disable>", SW_API_PT_BC_FILTER_SET, NULL},
+ {"ptBcFilter", "get", "get flooding status of broadcast frames", "<port_id>", SW_API_PT_BC_FILTER_GET, NULL},
+ {"cpuPort", "set", "set cpu port status", "<enable|disable>", SW_API_CPU_PORT_STATUS_SET, NULL},
+ {"cpuPort", "get", "get cpu port status", "", SW_API_CPU_PORT_STATUS_GET, NULL},
+ {"bctoCpu", "set", "set broadcast frames to Cpu port status", "<enable|disable>", SW_API_BC_TO_CPU_PORT_SET, NULL},
+ {"bctoCpu", "get", "get broadcast frames to Cpu port status", "", SW_API_BC_TO_CPU_PORT_GET, NULL},
+ {"PppoeCmd", "set", "set pppoe frames forwarding command", "<forward|rdtcpu>", SW_API_PPPOE_CMD_SET, NULL},
+ {"PppoeCmd", "get", "get pppoe frames forwarding command", "", SW_API_PPPOE_CMD_GET, NULL},
+ {"Pppoe", "set", "set pppoe frames hardware identification status", "<enable|disable>", SW_API_PPPOE_STATUS_SET, NULL},
+ {"Pppoe", "get", "get pppoe frames hardware identification status", "", SW_API_PPPOE_STATUS_GET, NULL},
+ {"ptDhcp", "set", "set dhcp frames hardware identification status", "<port_id> <enable|disable>", SW_API_PT_DHCP_SET, NULL},
+ {"ptDhcp", "get", "get dhcp frames hardware identification status", "<port_id>", SW_API_PT_DHCP_GET, NULL},
+ {"arpcmd", "set", "set arp packets forwarding command", "<forward|cpycpu|rdtcpu>", SW_API_ARP_CMD_SET, NULL},
+ {"arpcmd", "get", "get arp packets forwarding command", "", SW_API_ARP_CMD_GET, NULL},
+ {"eapolcmd", "set", "set eapol packets forwarding command", "<cpycpu|rdtcpu>", SW_API_EAPOL_CMD_SET, NULL},
+ {"eapolcmd", "get", "get eapol packets forwarding command", "", SW_API_EAPOL_CMD_GET, NULL},
+ {"pppoesession", "add", "add a pppoe session entry", "<session_id> <enable|disable>", SW_API_PPPOE_SESSION_ADD, NULL},
+ {"pppoesession", "del", "del a pppoe session entry", "<session_id>", SW_API_PPPOE_SESSION_DEL, NULL},
+ {"pppoesession", "get", "get a pppoe session entry", "<session_id>", SW_API_PPPOE_SESSION_GET, NULL},
+ {"eapolstatus", "set", "set eapol frames hardware identification status", "<port_id> <enable|disable>", SW_API_EAPOL_STATUS_SET, NULL},
+ {"eapolstatus", "get", "get eapol frames hardware identification status", "<port_id>", SW_API_EAPOL_STATUS_GET, NULL},
+ {"rip", "set", "set rip packets hardware identification status", "<enable|disable>", SW_API_RIPV1_STATUS_SET, NULL},
+ {"rip", "get", "get rip packets hardware identification status", "", SW_API_RIPV1_STATUS_GET, NULL},
+ {"ptarpreq", "set", "set arp request packets hardware identification status", "<port_id> <enable|disable>", SW_API_PT_ARP_REQ_STATUS_SET, NULL},
+ {"ptarpreq", "get", "get arp request packets hardware identification status", "<port_id>", SW_API_PT_ARP_REQ_STATUS_GET, NULL},
+ {"ptarpack", "set", "set arp ack packets hardware identification status", "<port_id> <enable|disable>", SW_API_PT_ARP_ACK_STATUS_SET, NULL},
+ {"ptarpack", "get", "get arp ack packets hardware identification status", "<port_id>", SW_API_PT_ARP_ACK_STATUS_GET, NULL},
+ {"extendpppoe", "add", "add a pppoe session entry", "", SW_API_PPPOE_SESSION_TABLE_ADD, NULL},
+ {"extendpppoe", "del", "del a pppoe session entry", "", SW_API_PPPOE_SESSION_TABLE_DEL, NULL},
+ {"extendpppoe", "get", "get a pppoe session entry", "", SW_API_PPPOE_SESSION_TABLE_GET, NULL},
+ {"pppoeid", "set", "set a pppoe session id entry", "<index> <id>", SW_API_PPPOE_SESSION_ID_SET, NULL},
+ {"pppoeid", "get", "get a pppoe session id entry", "<index>", SW_API_PPPOE_SESSION_ID_GET, NULL},
+ {"intrmask", "set", "set switch interrupt mask", "<intr_mask>", SW_API_INTR_MASK_SET, NULL},
+ {"intrmask", "get", "get switch interrupt mask", "", SW_API_INTR_MASK_GET, NULL},
+ {"intrstatus", "get", "get switch interrupt status", "", SW_API_INTR_STATUS_GET, NULL},
+ {"intrstatus", "clear", "clear switch interrupt status", "<intr_mask>", SW_API_INTR_STATUS_CLEAR, NULL},
+ {"intrportlinkmask", "set", "set link interrupt mask of a port", "<port_id> <intr_mask>", SW_API_INTR_PORT_LINK_MASK_SET, NULL},
+ {"intrportlinkmask", "get", "get link interrupt mask of a port", "<port_id>", SW_API_INTR_PORT_LINK_MASK_GET, NULL},
+ {"intrportlinkstatus", "get", "get link interrupt status of a port", "<port_id>", SW_API_INTR_PORT_LINK_STATUS_GET, NULL},
+ {"intrmaskmaclinkchg", "set", "set switch interrupt mask for mac link change", "<port_id> <enable | disable>", SW_API_INTR_MASK_MAC_LINKCHG_SET, NULL},
+ {"intrmaskmaclinkchg", "get", "get switch interrupt mask for mac link change", "<port_id>", SW_API_INTR_MASK_MAC_LINKCHG_GET, NULL},
+ {"intrstatusmaclinkchg", "get", "get switch interrupt status for mac link change", "", SW_API_INTR_STATUS_MAC_LINKCHG_GET, NULL},
+ {"intrstatusmaclinkchg", "clear", "clear switch interrupt status for mac link change", "", SW_API_INTR_STATUS_MAC_LINKCHG_CLEAR, NULL},
+ {"cpuVid", "set", "set to_cpu vid status", "<enable|disable>", SW_API_CPU_VID_EN_SET, NULL},
+ {"cpuVid", "get", "get to_cpu vid status", "", SW_API_CPU_VID_EN_GET, NULL},
+ {"rtdPppoe", "set", "set RM_RTD_PPPOE_EN status", "<enable|disable>", SW_API_RTD_PPPOE_EN_SET, NULL},
+ {"rtdPppoe", "get", "get RM_RTD_PPPOE_EN status", "", SW_API_RTD_PPPOE_EN_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /* IP */
+#ifdef IN_IP
+ {
+ "ip", "config ip",
+ {
+ {"hostentry", "add", "add host entry", "", SW_API_IP_HOST_ADD, NULL},
+ {"hostentry", "del", "del host entry", "<del_mode>", SW_API_IP_HOST_DEL, NULL},
+ {"hostentry", "get", "get host entry", "<get_mode>", SW_API_IP_HOST_GET, NULL},
+ {"hostentry", "next", "next host entry", "<next_mode>", SW_API_IP_HOST_NEXT, NULL},
+ {"hostentry", "show", "show whole host entries", "", SW_CMD_HOST_SHOW, cmd_show_host},
+ {"hostentry", "bindcnt", "bind counter to host entry", "<host entry id> <cnt id> <enable|disable>", SW_API_IP_HOST_COUNTER_BIND, NULL},
+ {"hostentry", "bindpppoe", "bind pppoe to host entry", "<host entry id> <pppoe id> <enable|disable>", SW_API_IP_HOST_PPPOE_BIND, NULL},
+ {"ptarplearn", "set", "set port arp learn flag, bit0 req bit1 ack", "<port_id> <flag>", SW_API_IP_PT_ARP_LEARN_SET, NULL},
+ {"ptarplearn", "get", "get port arp learn flag, bit0 req bit1 ack", "<port_id>", SW_API_IP_PT_ARP_LEARN_GET, NULL},
+ {"arplearn", "set", "set arp learn mode", "<learnlocal|learnall>", SW_API_IP_ARP_LEARN_SET, NULL},
+ {"arplearn", "get", "get arp learn mode", "", SW_API_IP_ARP_LEARN_GET, NULL},
+ {"ptipsrcguard", "set", "set ip source guard mode", "<port_id> <mac_ip|mac_ip_port|mac_ip_vlan|mac_ip_port_vlan|no_guard>", SW_API_IP_SOURCE_GUARD_SET, NULL},
+ {"ptipsrcguard", "get", "get ip source guard mode", "", SW_API_IP_SOURCE_GUARD_GET, NULL},
+ {"ptarpsrcguard", "set", "set arp source guard mode", "<port_id> <mac_ip|mac_ip_port|mac_ip_vlan|mac_ip_port_vlan|no_guard>", SW_API_IP_ARP_GUARD_SET, NULL},
+ {"ptarpsrcguard", "get", "get arp source guard mode", "", SW_API_IP_ARP_GUARD_GET, NULL},
+ {"routestatus", "set", "set ip route status", "<enable|disable>", SW_API_IP_ROUTE_STATUS_SET, NULL},
+ {"routestatus", "get", "get ip route status", "", SW_API_IP_ROUTE_STATUS_GET, NULL},
+ {"intfentry", "add", "add interface mac address", "", SW_API_IP_INTF_ENTRY_ADD, NULL},
+ {"intfentry", "del", "del interface mac address", "", SW_API_IP_INTF_ENTRY_DEL, NULL},
+ {"intfentry", "show", "show whole interface mac entries", "", SW_CMD_INTFMAC_SHOW, cmd_show_intfmac},
+ {"ipunksrc", "set", "set ip unkown source command", "<forward|drop|cpycpu|rdtcpu>", SW_API_IP_UNK_SOURCE_CMD_SET, NULL},
+ {"ipunksrc", "get", "get ip unkown source command", "", SW_API_IP_UNK_SOURCE_CMD_GET, NULL},
+ {"arpunksrc", "set", "set arp unkown source command", "<forward|drop|cpycpu|rdtcpu>", SW_API_ARP_UNK_SOURCE_CMD_SET, NULL},
+ {"arpunksrc", "get", "get arp unkown source command", "", SW_API_ARP_UNK_SOURCE_CMD_GET, NULL},
+ {"ipagetime", "set", "set dynamic ip entry age time", "<time>", SW_API_IP_AGE_TIME_SET, NULL},
+ {"ipagetime", "get", "get dynamic ip entry age time", "", SW_API_IP_AGE_TIME_GET, NULL},
+ {"wcmphashmode", "set", "set wcmp hash mode", "<hashmode>", SW_API_WCMP_HASH_MODE_SET, NULL},
+ {"wcmphashmode", "get", "get wcmp hash mode", "", SW_API_WCMP_HASH_MODE_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /* NAT */
+#ifdef IN_NAT
+ {
+ "nat", "config nat",
+ {
+ {"natentry", "add", "add nat entry", "", SW_API_NAT_ADD, NULL},
+ {"natentry", "del", "del nat entry", "<del_mode>", SW_API_NAT_DEL, NULL},
+ {"natentry", "get", "get nat entry", "<get_mode>", SW_API_NAT_GET, NULL},
+ {"natentry", "next", "next nat entry", "<next_mode>", SW_API_NAT_NEXT, NULL},
+ {"natentry", "show", "show whole nat entries", "", SW_CMD_NAT_SHOW, cmd_show_nat},
+ {"natentry", "bindcnt", "bind counter to nat entry", "<nat entry id> <cnt id> <enable|disable>", SW_API_NAT_COUNTER_BIND, NULL},
+ {"naptentry", "add", "add napt entry", "", SW_API_NAPT_ADD, NULL},
+ {"naptentry", "del", "del napt entry", "<del_mode>", SW_API_NAPT_DEL, NULL},
+ {"naptentry", "get", "get napt entry", "<get_mode>", SW_API_NAPT_GET, NULL},
+ {"naptentry", "next", "next napt entry", "<next_mode>", SW_API_NAPT_NEXT, NULL},
+ {"naptentry", "show", "show whole napt entries", "", SW_CMD_NAPT_SHOW, cmd_show_napt},
+ {"naptentry", "bindcnt", "bind counter to napt entry", "<napt entry id> <cnt id> <enable|disable>", SW_API_NAPT_COUNTER_BIND, NULL},
+ {"natstatus", "set", "set nat status", "<enable|disable>", SW_API_NAT_STATUS_SET, NULL},
+ {"natstatus", "get", "get nat status", "", SW_API_NAT_STATUS_GET, NULL},
+ {"naptstatus", "set", "set napt status", "<enable|disable>", SW_API_NAPT_STATUS_SET, NULL},
+ {"naptstatus", "get", "get napt status", "", SW_API_NAPT_STATUS_GET, NULL},
+ {"nathash", "set", "set nat hash mode", "<flag>", SW_API_NAT_HASH_MODE_SET, NULL},
+ {"nathash", "get", "get nat hash mode", "", SW_API_NAT_HASH_MODE_GET, NULL},
+ {"naptmode", "set", "set napt mode", "<fullcone|strictcone|portstrict|synmatric>", SW_API_NAPT_MODE_SET, NULL},
+ {"naptmode", "get", "get napt mode", "", SW_API_NAPT_MODE_GET, NULL},
+ {"prvbaseaddr", "set", "set nat prv base address", "<ip4 addr>", SW_API_PRV_BASE_ADDR_SET, NULL},
+ {"prvbaseaddr", "get", "get nat prv base address", "", SW_API_PRV_BASE_ADDR_GET, NULL},
+ {"prvaddrmode", "set", "set nat prv address map mode", "<enable|disable>", SW_API_PRV_ADDR_MODE_SET, NULL},
+ {"prvaddrmode", "get", "get nat prv address map mode", "", SW_API_PRV_ADDR_MODE_GET, NULL},
+ {"pubaddr", "add", "add pub address", "", SW_API_PUB_ADDR_ENTRY_ADD, NULL},
+ {"pubaddr", "del", "del pub address", "<del_mode>", SW_API_PUB_ADDR_ENTRY_DEL, NULL},
+ {"pubaddr", "show", "show whole pub address entries", "", SW_CMD_PUBADDR_SHOW, cmd_show_pubaddr},
+ {"natunksess", "set", "set nat unkown session command", "<forward|drop|cpycpu|rdtcpu>", SW_API_NAT_UNK_SESSION_CMD_SET, NULL},
+ {"natunksess", "get", "get nat unkown session command", "", SW_API_NAT_UNK_SESSION_CMD_GET, NULL},
+ {"prvbasemask", "set", "set nat prv base mask", "<ip4 mask>", SW_API_PRV_BASE_MASK_SET, NULL},
+ {"prvbasemask", "get", "get nat prv base mask", "", SW_API_PRV_BASE_MASK_GET, NULL},
+ {"global", "set", "set global nat function", "<enable|disable>", SW_API_NAT_GLOBAL_SET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*Trunk*/
+#ifdef IN_TRUNK
+ {
+ "trunk", "config trunk",
+ {
+ {"group", "set", "set trunk group member info", "<trunk_id> <disable|enable> <port_bitmap>", SW_API_TRUNK_GROUP_SET, NULL},
+ {"group", "get", "get trunk group member info", "<trunk_id>", SW_API_TRUNK_GROUP_GET, NULL},
+ {"hashmode", "set", "set trunk hash mode", "<hash_mode>", SW_API_TRUNK_HASH_SET, NULL},
+ {"hashmode", "get", "get trunk hash mode", "", SW_API_TRUNK_HASH_GET, NULL},
+ {"mansa", "set", "set trunk manipulable sa", "<macaddr>", SW_API_TRUNK_MAN_SA_SET, NULL},
+ {"mansa", "get", "get trunk manipulable sa", "", SW_API_TRUNK_MAN_SA_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /*Interface Control*/
+#ifdef IN_INTERFACECONTROL
+ {
+ "interface", "config interface",
+ {
+ {"macmode", "set", "set mac mode info", "<port_id>", SW_API_MAC_MODE_SET, NULL},
+ {"macmode", "get", "get mac mode info", "<port_id>", SW_API_MAC_MODE_GET, NULL},
+ {"pt3azstatus", "set", "get mac mode info", "<port_id> <enable/disable>", SW_API_PORT_3AZ_STATUS_SET, NULL},
+ {"pt3azstatus", "get", "get mac mode info", "<port_id>", SW_API_PORT_3AZ_STATUS_GET, NULL},
+ {"phymode", "set", "set phy mode info", "<phy_id>", SW_API_PHY_MODE_SET, NULL},
+ {"phymode", "get", "get phy mode info", "<phy_id>", SW_API_PHY_MODE_GET, NULL},
+ {"fx100ctrl", "set", "set fx100 config", "", SW_API_FX100_CTRL_SET, NULL},
+ {"fx100ctrl", "get", "get fx100 config", "", SW_API_FX100_CTRL_GET, NULL},
+ {"fx100status", "get", "get fx100 status", "", SW_API_FX100_STATUS_GET, NULL},
+ {"mac06exch", "set", "set mac0 and mac6 exchange status", "<enable/disable>", SW_API_MAC06_EXCH_SET, NULL},
+ {"mac06exch", "get", "get mac0 and mac6 exchange status", "", SW_API_MAC06_EXCH_GET, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+#endif
+
+ /* debug */
+ {
+ "debug", "read/write register",
+ {
+ {"phy", "get", "read phy register", "<ph_id> <reg_addr>", SW_API_PHY_GET, NULL},
+ {"phy", "set", "write phy register", "<ph_id> <reg_addr> <value>", SW_API_PHY_SET, NULL},
+ {"reg", "get", "read switch register", "<reg_addr> <4>", SW_API_REG_GET, NULL},
+ {"reg", "set", "write switch register", "<reg_addr> <value> <4>", SW_API_REG_SET, NULL},
+ {"field", "get", "read switch register field", "<reg_addr> <offset> <len> <4>", SW_API_REG_FIELD_GET, NULL},
+ {"field", "set", "write switch register field", "<reg_addr> <offset> <len> <value> <4>", SW_API_REG_FIELD_SET, NULL},
+ {"aclList", "dump", "dump all acl list", "", SW_API_ACL_LIST_DUMP, NULL},
+ {"aclRule", "dump", "dump all acl rule", "", SW_API_ACL_RULE_DUMP, NULL},
+ {"device", "reset", "reset device", "", SW_API_SWITCH_RESET, NULL},
+ {"ssdk", "config", "show ssdk configuration", "", SW_API_SSDK_CFG, NULL},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+
+ /*debug*/
+ {
+ "device", "set device id",
+ {
+ {"id", "set", "set device id", "<dev_id>", SW_CMD_SET_DEVID, cmd_set_devid},
+ {NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
+ },
+ },
+
+ {"help", "type ? get help", {{NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/}},
+
+ {"quit", "type quit/q quit shell", {{NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/}},
+
+ {NULL, NULL, {{NULL, NULL, NULL, NULL, (int)NULL, NULL}}} /*end of desc*/
+};
+
diff --git a/src/shell/shell_io.c b/src/shell/shell_io.c
new file mode 100755
index 0000000..3586b43
--- /dev/null
+++ b/src/shell/shell_io.c
@@ -0,0 +1,9133 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include "shell_io.h"
+#include "shell.h"
+
+#define SW_RTN_ON_NULL_PARAM(rtn) \
+ do { if ((rtn) == NULL) return SW_BAD_PARAM; } while(0);
+
+#define DEFAULT_FLAG "default"
+static char **full_cmdstrp;
+static int talk_mode = 1;
+
+int
+get_talk_mode(void)
+{
+ return talk_mode ;
+}
+
+void
+set_talk_mode(int mode)
+{
+ talk_mode = mode;
+}
+
+void
+set_full_cmdstrp(char **cmdstrp)
+{
+ full_cmdstrp = cmdstrp;
+}
+
+static char *
+get_cmd_buf(char *tag, char *defval)
+{
+ if(!full_cmdstrp || !(*full_cmdstrp))
+ {
+ dprintf("parameter (%s) or default (%s) absent\n", tag, defval);
+ exit(1);
+ }
+
+ if (!strcasecmp(*(full_cmdstrp), DEFAULT_FLAG))
+ {
+ full_cmdstrp++;
+ return defval;
+ }
+ else
+ {
+ return *(full_cmdstrp++);
+ }
+}
+
+static char *
+get_cmd_stdin(char *tag, char *defval)
+{
+ static char gsubcmdstr[128];
+ int pos = 0;
+ int c;
+
+ if(defval)
+ {
+ dprintf("%s(%s): ", tag, defval);
+ }
+ else
+ {
+ dprintf("%s: ", tag);
+ }
+
+ memset(gsubcmdstr, 0, 128);
+
+ while ((c = getchar()) != '\n')
+ {
+ gsubcmdstr[pos++] = c;
+ if (pos == 127)
+ {
+ dprintf("too long command\n");
+ return NULL;
+ }
+ }
+
+ gsubcmdstr[pos] = '\0';
+ if ('\0' == gsubcmdstr[0])
+ {
+ return defval;
+ }
+ else
+ {
+ return gsubcmdstr;
+ }
+}
+
+static char *
+get_sub_cmd(char *tag, char *defval)
+{
+ if(talk_mode)
+ return get_cmd_stdin(tag, defval);
+ else
+ return get_cmd_buf(tag, defval);
+}
+
+
+static inline a_bool_t
+is_hex(char c)
+{
+ if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')
+ || (c >= 'A' && c <= 'F'))
+ return A_TRUE;
+
+ return A_FALSE;
+}
+
+static inline a_bool_t
+is_dec(char c)
+{
+ if ((c >= '0') && (c <= '9'))
+ return A_TRUE;
+
+ return A_FALSE;
+}
+
+static sw_data_type_t sw_data_type[] =
+{
+ SW_TYPE_DEF(SW_UINT8, NULL, NULL),
+ SW_TYPE_DEF(SW_INT8, NULL, NULL),
+ SW_TYPE_DEF(SW_UINT16, cmd_data_check_uint16, cmd_data_print_uint16),
+ SW_TYPE_DEF(SW_INT16, NULL, NULL),
+ SW_TYPE_DEF(SW_UINT32, cmd_data_check_uint32, cmd_data_print_uint32),
+ SW_TYPE_DEF(SW_INT32, NULL, NULL),
+ SW_TYPE_DEF(SW_UINT64, NULL, NULL),
+ SW_TYPE_DEF(SW_INT64, NULL, NULL),
+ SW_TYPE_DEF(SW_CAP, cmd_data_check_capable, cmd_data_print_capable),
+ SW_TYPE_DEF(SW_DUPLEX, cmd_data_check_duplex, cmd_data_print_duplex),
+ SW_TYPE_DEF(SW_SPEED, cmd_data_check_speed, cmd_data_print_speed),
+ SW_TYPE_DEF(SW_1QMODE, cmd_data_check_1qmode, cmd_data_print_1qmode),
+ SW_TYPE_DEF(SW_EGMODE, cmd_data_check_egmode, cmd_data_print_egmode),
+ SW_TYPE_DEF(SW_MIB, NULL, cmd_data_print_mib),
+ SW_TYPE_DEF(SW_VLAN, cmd_data_check_vlan, cmd_data_print_vlan),
+ SW_TYPE_DEF(SW_PBMP, cmd_data_check_pbmp, cmd_data_print_pbmp),
+ SW_TYPE_DEF(SW_ENABLE, cmd_data_check_enable, cmd_data_print_enable),
+ SW_TYPE_DEF(SW_MACADDR, cmd_data_check_macaddr, cmd_data_print_macaddr),
+ SW_TYPE_DEF(SW_FDBENTRY, cmd_data_check_fdbentry, cmd_data_print_fdbentry),
+ SW_TYPE_DEF(SW_SCH, cmd_data_check_qos_sch, cmd_data_print_qos_sch),
+ SW_TYPE_DEF(SW_QOS, cmd_data_check_qos_pt, cmd_data_print_qos_pt),
+ SW_TYPE_DEF(SW_STORM, cmd_data_check_storm, cmd_data_print_storm),
+ SW_TYPE_DEF(SW_STP, cmd_data_check_stp_state, cmd_data_print_stp_state),
+ SW_TYPE_DEF(SW_LEAKY, cmd_data_check_leaky, cmd_data_print_leaky),
+ SW_TYPE_DEF(SW_MACCMD, cmd_data_check_maccmd, cmd_data_print_maccmd),
+ SW_TYPE_DEF(SW_UINT_A, cmd_data_check_uinta, cmd_data_print_uinta),
+ SW_TYPE_DEF(SW_ACLRULE, cmd_data_check_aclrule, cmd_data_print_aclrule),
+ SW_TYPE_DEF(SW_LEDPATTERN, cmd_data_check_ledpattern, cmd_data_print_ledpattern),
+ SW_TYPE_DEF(SW_INVLAN, cmd_data_check_invlan_mode, cmd_data_print_invlan_mode),
+ SW_TYPE_DEF(SW_VLANPROPAGATION, cmd_data_check_vlan_propagation, cmd_data_print_vlan_propagation),
+ SW_TYPE_DEF(SW_VLANTRANSLATION, cmd_data_check_vlan_translation, cmd_data_print_vlan_translation),
+ SW_TYPE_DEF(SW_QINQMODE, cmd_data_check_qinq_mode, cmd_data_print_qinq_mode),
+ SW_TYPE_DEF(SW_QINQROLE, cmd_data_check_qinq_role, cmd_data_print_qinq_role),
+ SW_TYPE_DEF(SW_CABLESTATUS, NULL, cmd_data_print_cable_status),
+ SW_TYPE_DEF(SW_CABLELEN, NULL, cmd_data_print_cable_len),
+ SW_TYPE_DEF(SW_SSDK_CFG, NULL, cmd_data_print_ssdk_cfg),
+ SW_TYPE_DEF(SW_HDRMODE, cmd_data_check_hdrmode, cmd_data_print_hdrmode),
+ SW_TYPE_DEF(SW_FDBOPRATION, cmd_data_check_fdboperation, NULL),
+ SW_TYPE_DEF(SW_PPPOE, cmd_data_check_pppoe, cmd_data_print_pppoe),
+ SW_TYPE_DEF(SW_ACL_UDF_TYPE, cmd_data_check_udf_type, cmd_data_print_udf_type),
+ SW_TYPE_DEF(SW_IP_HOSTENTRY, cmd_data_check_host_entry, cmd_data_print_host_entry),
+ SW_TYPE_DEF(SW_ARP_LEARNMODE, cmd_data_check_arp_learn_mode, cmd_data_print_arp_learn_mode),
+ SW_TYPE_DEF(SW_IP_GUARDMODE, cmd_data_check_ip_guard_mode, cmd_data_print_ip_guard_mode),
+ SW_TYPE_DEF(SW_NATENTRY, cmd_data_check_nat_entry, cmd_data_print_nat_entry),
+ SW_TYPE_DEF(SW_NAPTENTRY, cmd_data_check_napt_entry, cmd_data_print_napt_entry),
+ SW_TYPE_DEF(SW_NAPTMODE, cmd_data_check_napt_mode, cmd_data_print_napt_mode),
+ SW_TYPE_DEF(SW_IP4ADDR, cmd_data_check_ip4addr, cmd_data_print_ip4addr),
+ SW_TYPE_DEF(SW_IP6ADDR, cmd_data_check_ip6addr, cmd_data_print_ip6addr),
+ SW_TYPE_DEF(SW_INTFMACENTRY, cmd_data_check_intf_mac_entry, cmd_data_print_intf_mac_entry),
+ SW_TYPE_DEF(SW_PUBADDRENTRY, cmd_data_check_pub_addr_entry, cmd_data_print_pub_addr_entry),
+ SW_TYPE_DEF(SW_INGPOLICER, cmd_data_check_port_policer, cmd_data_print_port_policer),
+ SW_TYPE_DEF(SW_EGSHAPER, cmd_data_check_egress_shaper, cmd_data_print_egress_shaper),
+ SW_TYPE_DEF(SW_ACLPOLICER, cmd_data_check_acl_policer, cmd_data_print_acl_policer),
+ SW_TYPE_DEF(SW_MACCONFIG, cmd_data_check_mac_config, cmd_data_print_mac_config),
+ SW_TYPE_DEF(SW_PHYCONFIG, cmd_data_check_phy_config, cmd_data_print_phy_config),
+ SW_TYPE_DEF(SW_FDBSMODE, cmd_data_check_fdb_smode, cmd_data_print_fdb_smode),
+ SW_TYPE_DEF(SW_FX100CONFIG, cmd_data_check_fx100_config, cmd_data_print_fx100_config),
+ SW_TYPE_DEF(SW_SGENTRY, cmd_data_check_multi, cmd_data_print_multi),
+ SW_TYPE_DEF(SW_SEC_MAC, cmd_data_check_sec_mac, NULL),
+ SW_TYPE_DEF(SW_SEC_IP, cmd_data_check_sec_ip, NULL),
+ SW_TYPE_DEF(SW_SEC_IP4, cmd_data_check_sec_ip4, NULL),
+ SW_TYPE_DEF(SW_SEC_IP6, cmd_data_check_sec_ip6, NULL),
+ SW_TYPE_DEF(SW_SEC_TCP, cmd_data_check_sec_tcp, NULL),
+ SW_TYPE_DEF(SW_SEC_UDP, cmd_data_check_sec_udp, NULL),
+ SW_TYPE_DEF(SW_SEC_ICMP4, cmd_data_check_sec_icmp4, NULL),
+ SW_TYPE_DEF(SW_SEC_ICMP6, cmd_data_check_sec_icmp6, NULL),
+ SW_TYPE_DEF(SW_REMARKENTRY, cmd_data_check_remark_entry, cmd_data_print_remark_entry),
+};
+
+sw_data_type_t *
+cmd_data_type_find(sw_data_type_e type)
+{
+ a_uint16_t i = 0;
+
+ do
+ {
+ if (type == sw_data_type[i].data_type)
+ return &sw_data_type[i];
+ }
+ while ( ++i < sizeof(sw_data_type)/sizeof(sw_data_type[0]));
+
+ return NULL;
+}
+
+sw_error_t
+cmd_data_check_uint32(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (0 == cmd_str[0])
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (strspn(cmd_str, "1234567890abcdefABCDEFXx") != strlen(cmd_str)){
+ return SW_BAD_VALUE;
+ }
+
+ if (cmd_str[0] == '0' && (cmd_str[1] == 'x' || cmd_str[1] == 'X'))
+ sscanf(cmd_str, "%x", arg_val);
+ else
+ sscanf(cmd_str, "%d", arg_val);
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_uint32(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:0x%x", param_name, *(a_uint32_t *) buf);
+}
+
+sw_error_t
+cmd_data_check_uint16(char *cmd_str, a_uint32_t *arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (0 == cmd_str[0])
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (cmd_str[0] == '0' && (cmd_str[1] == 'x' || cmd_str[1] == 'X'))
+ sscanf(cmd_str, "%x", arg_val);
+ else
+ sscanf(cmd_str, "%d", arg_val);
+
+ if (65535 < *arg_val)
+ {
+ return SW_BAD_PARAM;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_uint16(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:0x%04x", param_name, *(a_uint16_t *) buf);
+
+}
+
+sw_error_t
+cmd_data_check_pbmp(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (cmd_str[0] == '0' && (cmd_str[1] == 'x' || cmd_str[1] == 'X'))
+ sscanf(cmd_str, "%x", arg_val);
+ else
+ sscanf(cmd_str, "%d", arg_val);
+
+ return SW_OK;
+
+}
+
+void
+cmd_data_print_pbmp(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:0x%x", param_name, *(a_uint32_t *) buf);
+
+}
+
+sw_error_t
+cmd_data_check_enable(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "disable"))
+ *arg_val = FAL_DISABLE;
+ else if (!strcasecmp(cmd_str, "enable"))
+ *arg_val = FAL_ENABLE;
+ else
+ {
+ //dprintf("input error");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_enable(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == 1)
+ {
+ dprintf("ENABLE");
+ }
+ else if (*(a_uint32_t *) buf == 0)
+ {
+ dprintf("DISABLE");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+/*mib*/
+static char *mib_regname[] =
+{
+ "RxBroad",
+ "RxPause",
+ "RxMulti",
+ "RxFcsErr",
+ "RxAlignErr",
+ "RxRunt",
+ "RxFragment",
+ "Rx64Byte",
+ "Rx128Byte",
+ "Rx256Byte",
+ "Rx512Byte",
+ "Rx1024Byte",
+ "Rx1518Byte",
+ "RxMaxByte",
+ "RxTooLong",
+ "RxGoodByte",
+ "RxGoodByte1",
+ "RxBadByte",
+ "RxBadByte1",
+ "RxOverFlow",
+ "Filtered",
+ "TxBroad",
+ "TxPause",
+ "TxMulti",
+ "TxUnderRun",
+ "Tx64Byte",
+ "Tx128Byte",
+ "Tx256Byte",
+ "Tx512Byte",
+ "Tx1024Byte",
+ "Tx1518Byte",
+ "TxMaxByte",
+ "TxOverSize",
+ "TxByte",
+ "TxByte1",
+ "TxCollision",
+ "TxAbortCol",
+ "TxMultiCol",
+ "TxSingleCol",
+ "TxExcDefer",
+ "TxDefer",
+ "TxLateCol",
+ "RxUniCast",
+ "TxUniCast"
+};
+
+void
+cmd_data_print_mib(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("\n[%s] \n", param_name);
+ a_uint32_t offset = 0;
+ for (offset = 0; offset < (sizeof (fal_mib_info_t) / sizeof (a_uint32_t));
+ offset++)
+ {
+
+ dprintf("%-12s<0x%08x> ", mib_regname[offset], *(buf + offset));
+ if ((offset + 1) % 3 == 0)
+ dprintf("\n");
+ }
+}
+
+/*port ctrl*/
+sw_error_t
+cmd_data_check_duplex(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "half"))
+ *arg_val = FAL_HALF_DUPLEX;
+ else if (!strcasecmp(cmd_str, "full"))
+ *arg_val = FAL_FULL_DUPLEX;
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_duplex(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == 0)
+ {
+ dprintf("HALF");
+ }
+ else if (*(a_uint32_t *) buf == 1)
+ {
+ dprintf("FULL");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_speed(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strncasecmp(cmd_str, "10", 3))
+ *arg_val = FAL_SPEED_10;
+ else if (!strncasecmp(cmd_str, "100", 4))
+ *arg_val = FAL_SPEED_100;
+ else if (!strncasecmp(cmd_str, "1000", 5))
+ *arg_val = FAL_SPEED_1000;
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_speed(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_SPEED_10)
+ {
+ dprintf("10(Mbps)");
+ }
+ else if (*(a_uint32_t *) buf == FAL_SPEED_100)
+ {
+ dprintf("100(Mbps)");
+ }
+ else if (*(a_uint32_t *) buf == FAL_SPEED_1000)
+ {
+ dprintf("1000(Mbps)");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_capable(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ cmd_strtol(cmd_str, arg_val);
+ if (*arg_val & (~FAL_PHY_GE_ADV_ALL))
+ {
+ //dprintf("input error should be within 0x3f\n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_capable(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+
+ if (*(a_uint32_t *) buf == 0)
+ {
+ dprintf("None Capable");
+ return;
+ }
+
+ if (*(a_uint32_t *) buf & FAL_PHY_ADV_1000T_FD)
+ {
+ dprintf("1000T_FD|");
+ }
+ if (*(a_uint32_t *) buf & FAL_PHY_ADV_100TX_FD)
+ {
+ dprintf("100TX_FD|");
+ }
+ if (*(a_uint32_t *) buf & FAL_PHY_ADV_100TX_HD)
+ {
+ dprintf("100TX_HD|");
+ }
+ if (*(a_uint32_t *) buf & FAL_PHY_ADV_10T_HD)
+ {
+ dprintf("10T_HD|");
+ }
+ if (*(a_uint32_t *) buf & FAL_PHY_ADV_10T_FD)
+ {
+ dprintf("10T_FD|");
+ }
+ if (*(a_uint32_t *) buf & FAL_PHY_ADV_PAUSE)
+ {
+ dprintf("PAUSE|");
+ }
+ if (*(a_uint32_t *) buf & FAL_PHY_ADV_ASY_PAUSE)
+ {
+ dprintf("ASY_PAUSE|");
+ }
+}
+
+/*portvlan*/
+sw_error_t
+cmd_data_check_1qmode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "disable"))
+ {
+ *arg_val = FAL_1Q_DISABLE;
+ }
+ else if (!strcasecmp(cmd_str, "secure"))
+ {
+ *arg_val = FAL_1Q_SECURE;
+ }
+ else if (!strcasecmp(cmd_str, "check"))
+ {
+ *arg_val = FAL_1Q_CHECK;
+ }
+ else if (!strcasecmp(cmd_str, "fallback"))
+ {
+ *arg_val = FAL_1Q_FALLBACK;
+ }
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_1qmode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_1Q_DISABLE)
+ {
+ dprintf("DISABLE\n");
+ }
+ else if (*(a_uint32_t *) buf == FAL_1Q_SECURE)
+ {
+ dprintf("SECURE\n");
+ }
+ else if (*(a_uint32_t *) buf == FAL_1Q_CHECK)
+ {
+ dprintf("CHECK\n");
+ }
+ else if (*(a_uint32_t *) buf == FAL_1Q_FALLBACK)
+ {
+ dprintf("FALLBACK\n");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_egmode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "unmodified"))
+ {
+ *arg_val = FAL_EG_UNMODIFIED;
+ }
+ else if (!strcasecmp(cmd_str, "untagged"))
+ {
+ *arg_val = FAL_EG_UNTAGGED;
+ }
+ else if (!strcasecmp(cmd_str, "tagged"))
+ {
+ *arg_val = FAL_EG_TAGGED;
+ }
+ else if (!strcasecmp(cmd_str, "hybrid"))
+ {
+ *arg_val = FAL_EG_HYBRID;
+ }
+ else if (!strcasecmp(cmd_str, "untouched"))
+ {
+ *arg_val = FAL_EG_UNTOUCHED;
+ }
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_egmode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_EG_UNMODIFIED)
+ {
+ dprintf("UNMODIFIED");
+ }
+ else if (*(a_uint32_t *) buf == FAL_EG_UNTAGGED)
+ {
+ dprintf("UNTAGGED");
+ }
+ else if (*(a_uint32_t *) buf == FAL_EG_TAGGED)
+ {
+ dprintf("TAGGED");
+ }
+ else if (*(a_uint32_t *) buf == FAL_EG_HYBRID)
+ {
+ dprintf("HYBRID");
+ }
+ else if (*(a_uint32_t *) buf == FAL_EG_UNTOUCHED)
+ {
+ dprintf("UNTOUCHED");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+/*vlan*/
+sw_error_t
+cmd_data_check_vlan(char *cmdstr, fal_vlan_t * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ fal_vlan_t entry;
+ a_uint32_t tmp;
+
+ memset(&entry, 0, sizeof (fal_vlan_t));
+
+ do
+ {
+ cmd = get_sub_cmd("vlanid", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 4095\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: the range is 0 -- 4095\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.vid = tmp & 0xffff;
+
+ do
+ {
+ cmd = get_sub_cmd("fid", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 4095 or 65535\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: the range is 0 -- 4095 or 65535\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.fid = tmp & 0xffff;
+
+ do
+ {
+ cmd = get_sub_cmd("port member", "null");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: input port number such as 1,3\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_portmap(cmd, &entry.mem_ports,
+ sizeof (fal_pbmp_t));
+ if (SW_OK != rv)
+ dprintf("usage: input port number such as 1,3\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("tagged member", "null");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: input port number such as 1,3\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_portmap(cmd, &entry.tagged_ports,
+ sizeof (fal_pbmp_t));
+ if (SW_OK != rv)
+ dprintf("usage: input port number such as 1,3\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("untagged member", "null");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: input port number such as 1,3\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_portmap(cmd, &entry.untagged_ports,
+ sizeof (fal_pbmp_t));
+ if (SW_OK != rv)
+ dprintf("usage: input port number such as 1,3\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("unmodify member", "null");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: input port number such as 1,3\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_portmap(cmd, &entry.unmodify_ports,
+ sizeof (fal_pbmp_t));
+ if (SW_OK != rv)
+ dprintf("usage: input port number such as 1,3\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("learn disable", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.learn_dis,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("queue override", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.vid_pri_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if (A_TRUE == entry.vid_pri_en)
+ {
+ do
+ {
+ cmd = get_sub_cmd("queue", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: input number such as <0/1/2/3>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: input number such as <0/1/2/3>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.vid_pri = tmp;
+ }
+
+ *val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_vlan(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_vlan_t *sw_vlan = (fal_vlan_t *) buf;
+
+ dprintf("\n[vid]:%-4d [fid]:%-5d [member]:0x%-4x",
+ sw_vlan->vid, sw_vlan->fid, sw_vlan->mem_ports);
+
+ dprintf("\n[tagged_member]:0x%-4x [untagged_member]:0x%-4x [unmodify_member]:0x%-4x ",
+ sw_vlan->tagged_ports, sw_vlan->untagged_ports, sw_vlan->unmodify_ports);
+
+ if (sw_vlan->learn_dis == 1)
+ {
+ dprintf("[learn_dis]:enable ");
+ }
+ else
+ {
+ dprintf("[learn_dis]:disable ");
+ }
+
+ if (sw_vlan->vid_pri_en == 1)
+ {
+ dprintf("[pri_en]:enable [pri]:0x%-4x\n", sw_vlan->vid_pri);
+ }
+ else
+ {
+ dprintf("[pri_en]:disable [pri]:0x%-4x\n", 0);
+ }
+}
+
+/*qos*/
+sw_error_t
+cmd_data_check_qos_sch(char *cmdstr, fal_sch_mode_t * val, a_uint32_t size)
+{
+ if (cmdstr == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmdstr, "sp"))
+ {
+ *val = FAL_SCH_SP_MODE;
+ }
+ else if (!strcasecmp(cmdstr, "wrr"))
+ {
+ *val = FAL_SCH_WRR_MODE;
+ }
+ else if (!strcasecmp(cmdstr, "mixplus"))
+ {
+ *val = FAL_SCH_MIX_PLUS_MODE;
+ }
+ else if (!strcasecmp(cmdstr, "mix"))
+ {
+ *val = FAL_SCH_MIX_MODE;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_qos_sch(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_SCH_SP_MODE)
+ {
+ dprintf("SP");
+ }
+ else if (*(a_uint32_t *) buf == FAL_SCH_WRR_MODE)
+ {
+ dprintf("WRR");
+ }
+ else if (*(a_uint32_t *) buf == FAL_SCH_MIX_MODE)
+ {
+ dprintf("MIX");
+ }
+ else if (*(a_uint32_t *) buf == FAL_SCH_MIX_PLUS_MODE)
+ {
+ dprintf("MIXPLUS");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_qos_pt(char *cmdstr, fal_qos_mode_t * val, a_uint32_t size)
+{
+ if (cmdstr == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmdstr, "da"))
+ {
+ *val = FAL_QOS_DA_MODE;
+ }
+ else if (!strcasecmp(cmdstr, "up"))
+ {
+ *val = FAL_QOS_UP_MODE;
+ }
+ else if (!strcasecmp(cmdstr, "dscp"))
+ {
+ *val = FAL_QOS_DSCP_MODE;
+ }
+ else if (!strcasecmp(cmdstr, "port"))
+ {
+ *val = FAL_QOS_PORT_MODE;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_qos_pt(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_QOS_DA_MODE)
+ {
+ dprintf("DA");
+ }
+ else if (*(a_uint32_t *) buf == FAL_QOS_UP_MODE)
+ {
+ dprintf("UP");
+ }
+ else if (*(a_uint32_t *) buf == FAL_QOS_DSCP_MODE)
+ {
+ dprintf("DSCP");
+ }
+ else if (*(a_uint32_t *) buf == FAL_QOS_PORT_MODE)
+ {
+ dprintf("PORT");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+/*rate*/
+sw_error_t
+cmd_data_check_storm(char *cmdstr, fal_storm_type_t * val, a_uint32_t size)
+{
+ if (cmdstr == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmdstr, "unicast"))
+ {
+ *val = FAL_UNICAST_STORM;
+ }
+ else if (!strcasecmp(cmdstr, "multicast"))
+ {
+ *val = FAL_MULTICAST_STORM;
+ }
+ else if (!strcasecmp(cmdstr, "broadcast"))
+ {
+ *val = FAL_BROADCAST_STORM;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_storm(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_UNICAST_STORM)
+ {
+ dprintf("UNICAST");
+ }
+ else if (*(a_uint32_t *) buf == FAL_MULTICAST_STORM)
+ {
+ dprintf("MULTICAST");
+ }
+ else if (*(a_uint32_t *) buf == FAL_BROADCAST_STORM)
+ {
+ dprintf("BROADCAST");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+/*stp*/
+sw_error_t
+cmd_data_check_stp_state(char *cmdstr, fal_stp_state_t * val, a_uint32_t size)
+{
+ if (cmdstr == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmdstr, "disable"))
+ {
+ *val = FAL_STP_DISABLED;
+ }
+ else if (!strcasecmp(cmdstr, "block"))
+ {
+ *val = FAL_STP_BLOKING;
+ }
+ else if (!strcasecmp(cmdstr, "listen"))
+ {
+ *val = FAL_STP_LISTENING;
+ }
+ else if (!strcasecmp(cmdstr, "learn"))
+ {
+ *val = FAL_STP_LEARNING;
+ }
+ else if (!strcasecmp(cmdstr, "forward"))
+ {
+ *val = FAL_STP_FARWARDING;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_stp_state(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_STP_DISABLED)
+ {
+ dprintf("DISABLE");
+ }
+ else if (*(a_uint32_t *) buf == FAL_STP_BLOKING)
+ {
+ dprintf("BLOCK");
+ }
+ else if (*(a_uint32_t *) buf == FAL_STP_LISTENING)
+ {
+ dprintf("LISTEN");
+ }
+ else if (*(a_uint32_t *) buf == FAL_STP_LEARNING)
+ {
+ dprintf("LEARN");
+ }
+ else if (*(a_uint32_t *) buf == FAL_STP_FARWARDING)
+ {
+ dprintf("FORWARD");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+/*general*/
+sw_error_t
+cmd_data_check_leaky(char *cmdstr, fal_leaky_ctrl_mode_t * val, a_uint32_t size)
+{
+ if (cmdstr == NULL)
+ return SW_BAD_VALUE;
+
+ if (!strcasecmp(cmdstr, "port"))
+ {
+ *val = FAL_LEAKY_PORT_CTRL;
+ }
+ else if (!strcasecmp(cmdstr, "fdb"))
+ {
+ *val = FAL_LEAKY_FDB_CTRL;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_leaky(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_LEAKY_PORT_CTRL)
+ {
+ dprintf("PORT");
+ }
+ else if (*(a_uint32_t *) buf == FAL_LEAKY_FDB_CTRL)
+ {
+ dprintf("FDB");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_uinta(char *cmdstr, a_uint32_t * val, a_uint32_t size)
+{
+ char *tmp_str = NULL;
+ a_uint32_t *tmp_ptr = val;
+ a_uint32_t i = 0;
+
+ tmp_str = (void *) strtok(cmdstr, ",");
+ while (tmp_str)
+ {
+ if (i >= (size / 4))
+ {
+ return SW_BAD_VALUE;
+ }
+
+ sscanf(tmp_str, "%d", tmp_ptr);
+ tmp_ptr++;
+
+ i++;
+ tmp_str = (void *) strtok(NULL, ",");
+ }
+
+ if (i != (size / 4))
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_uinta(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ a_uint32_t i;
+ a_uint32_t *tmp_ptr;
+
+ dprintf("[%s]:", param_name);
+
+ tmp_ptr = buf;
+ for (i = 0; i < (size / 4); i++)
+ {
+ dprintf(" %d, ", *tmp_ptr);
+ tmp_ptr++;
+ }
+}
+
+/*fdb*/
+sw_error_t
+cmd_data_check_maccmd(char *cmdstr, fal_fwd_cmd_t * val, a_uint32_t size)
+{
+ if (NULL == cmdstr)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (0 == cmdstr[0])
+ {
+ *val = FAL_MAC_FRWRD; //defualt
+ }
+ else if (!strcasecmp(cmdstr, "forward"))
+ {
+ *val = FAL_MAC_FRWRD;
+ }
+ else if (!strcasecmp(cmdstr, "drop"))
+ {
+ *val = FAL_MAC_DROP;
+ }
+ else if (!strcasecmp(cmdstr, "cpycpu"))
+ {
+ *val = FAL_MAC_CPY_TO_CPU;
+ }
+ else if (!strcasecmp(cmdstr, "rdtcpu"))
+ {
+ *val = FAL_MAC_RDT_TO_CPU;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_maccmd(char * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_MAC_FRWRD)
+ {
+ dprintf("FORWARD");
+ }
+ else if (*(a_uint32_t *) buf == FAL_MAC_DROP)
+ {
+ dprintf("DROP");
+ }
+ else if (*(a_uint32_t *) buf == FAL_MAC_CPY_TO_CPU)
+ {
+ dprintf("CPYCPU");
+ }
+ else if (*(a_uint32_t *) buf == FAL_MAC_RDT_TO_CPU)
+ {
+ dprintf("RDTCPU");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_confirm(char *cmdstr, a_bool_t def, a_bool_t * val,
+ a_uint32_t size)
+{
+ if (0 == cmdstr[0])
+ {
+ *val = def;
+ }
+ else if ((!strcasecmp(cmdstr, "yes")) || (!strcasecmp(cmdstr, "y")))
+ {
+ *val = A_TRUE;
+ }
+ else if ((!strcasecmp(cmdstr, "no")) || (!strcasecmp(cmdstr, "n")))
+ {
+ *val = A_FALSE;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_confirm(char * param_name, a_bool_t val, a_uint32_t size)
+{
+ dprintf("%s", param_name);
+ if (A_TRUE == val)
+ {
+ dprintf("YES");
+ }
+ else if (A_FALSE == val)
+ {
+ dprintf("NO");
+ }
+ else
+ {
+ dprintf("UNKNOW");
+ }
+
+ return;
+}
+
+sw_error_t
+cmd_data_check_portmap(char *cmdstr, fal_pbmp_t * val, a_uint32_t size)
+{
+ char *tmp = NULL;
+ a_uint32_t i = 0;
+ a_uint32_t port;
+
+ *val = 0;
+ //default input null
+ if(!strcasecmp(cmdstr, "null"))
+ {
+ return SW_OK;
+ }
+
+ tmp = (void *) strtok(cmdstr, ",");
+ while (tmp)
+ {
+ if (SW_MAX_NR_PORT <= i)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ sscanf(tmp, "%d", &port);
+ if (SW_MAX_NR_PORT <= port)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ *val |= (0x1 << port);
+ tmp = (void *) strtok(NULL, ",");
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_portmap(char * param_name, fal_pbmp_t val, a_uint32_t size)
+{
+ a_uint32_t i;
+ char tmp[16];
+ tmp[0] = '\0';
+
+ dprintf("%s", param_name);
+ for (i = 0; i < SW_MAX_NR_PORT; i++)
+ {
+ if (val & (0x1 << i))
+ {
+ if(strlen(tmp) == 0)
+ sprintf(tmp, "%d", i);
+ else
+ sprintf(tmp+strlen(tmp), ",%d", i);
+ }
+ }
+ dprintf("%s ", tmp);
+ return;
+}
+
+sw_error_t
+cmd_data_check_macaddr(char *cmdstr, void *val, a_uint32_t size)
+{
+ char *tmp = NULL;
+ a_uint32_t i = 0, j;
+ a_uint32_t addr;
+ fal_mac_addr_t mac;
+
+ memset(&mac, 0, sizeof (fal_mac_addr_t));
+ if (NULL == cmdstr)
+ {
+ *(fal_mac_addr_t *) val = mac;
+ return SW_BAD_VALUE; /*was: SW_OK;*/
+ }
+
+ if (0 == cmdstr[0])
+ {
+ *(fal_mac_addr_t *) val = mac;
+ return SW_OK;
+ }
+
+ tmp = (void *) strtok(cmdstr, "-");
+ while (tmp)
+ {
+ if (6 <= i)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if ((2 < strlen(tmp)) || (0 == strlen(tmp)))
+ {
+ return SW_BAD_VALUE;
+ }
+
+ for (j = 0; j < strlen(tmp); j++)
+ {
+ if (A_FALSE == is_hex(tmp[j]))
+ return SW_BAD_VALUE;
+ }
+
+ sscanf(tmp, "%x", &addr);
+ if (0xff < addr)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ mac.uc[i++] = addr;
+ tmp = (void *) strtok(NULL, "-");
+ }
+
+ if (6 != i)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ *(fal_mac_addr_t *) val = mac;
+ return SW_OK;
+}
+
+void
+cmd_data_print_macaddr(char * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ a_uint32_t i;
+ fal_mac_addr_t *val;
+
+ val = (fal_mac_addr_t *) buf;
+ dprintf("%s", param_name);
+ for (i = 0; i < 5; i++)
+ {
+ dprintf("%02x-", val->uc[i]);
+ }
+ dprintf("%02x", val->uc[5]);
+
+}
+
+sw_error_t
+cmd_data_check_fdbentry(char *info, void *val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ fal_fdb_entry_t entry;
+ a_uint32_t tmp;
+
+ memset(&entry, 0, sizeof (fal_fdb_entry_t));
+
+ do
+ {
+ cmd = get_sub_cmd("addr", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the format is xx-xx-xx-xx-xx-xx \n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_macaddr(cmd, &entry.addr,
+ sizeof (fal_mac_addr_t));
+ if (SW_OK != rv)
+ dprintf("usage: the format is xx-xx-xx-xx-xx-xx \n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("fid", "65535");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 1 -- 4095 or 65535\n");
+ rv = SW_BAD_VALUE;
+ }
+ else if (0 == cmd[0])
+ {
+ entry.fid = 65535;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: the range is 1 -- 4095 or 65535\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.fid = tmp & 0xffff;
+
+ do
+ {
+ cmd = get_sub_cmd("dacmd", "forward");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_maccmd(cmd, &entry.dacmd,
+ sizeof (fal_fwd_cmd_t));
+ if (SW_OK != rv)
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("sacmd", "forward");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_maccmd(cmd, &entry.sacmd,
+ sizeof (fal_fwd_cmd_t));
+ if (SW_OK != rv)
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("dest port", "null");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: input port number such as 1,3\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_portmap(cmd, &entry.port.map,
+ sizeof (fal_pbmp_t));
+ if (SW_OK != rv)
+ dprintf("usage: input port number such as 1,3\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.portmap_en = A_TRUE;
+
+ do
+ {
+ cmd = get_sub_cmd("static", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &entry.static_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("leaky", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.leaky_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("mirror", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.mirror_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("clone", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.clone_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("queue override", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.da_pri_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if (A_TRUE == entry.da_pri_en)
+ {
+ do
+ {
+ cmd = get_sub_cmd("queue", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: input number such as <0/1/2/3>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: input number such as <0/1/2/3>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.da_queue = tmp;
+ }
+
+ do
+ {
+ cmd = get_sub_cmd("cross_pt_state", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.cross_pt_state,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("white_list_en", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.white_list_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *(fal_fdb_entry_t *) val = entry;
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_fdbentry(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ a_uint32_t tmp;
+ fal_fdb_entry_t *entry;
+
+ entry = (fal_fdb_entry_t *) buf;
+ dprintf("\n");
+ cmd_data_print_macaddr("[addr]:", (a_uint32_t *) & (entry->addr),
+ sizeof (fal_mac_addr_t));
+ dprintf(" ");
+ dprintf("[fid]:%d", entry->fid);
+ dprintf(" ");
+ cmd_data_print_confirm("[static]:", entry->static_en, sizeof (a_bool_t));
+ dprintf(" ");
+ cmd_data_print_portmap("[dest_port]:", entry->port.map,
+ sizeof (fal_pbmp_t));
+ dprintf(" \n");
+ cmd_data_print_maccmd("dacmd", (a_uint32_t *) & (entry->dacmd),
+ sizeof (fal_fwd_cmd_t));
+ dprintf(" ");
+ cmd_data_print_maccmd("sacmd", (a_uint32_t *) & (entry->sacmd),
+ sizeof (fal_fwd_cmd_t));
+ dprintf(" ");
+ cmd_data_print_confirm("[leaky]:", entry->leaky_en, sizeof (a_bool_t));
+ dprintf(" ");
+ cmd_data_print_confirm("[mirror]:", entry->mirror_en, sizeof (a_bool_t));
+ dprintf(" ");
+ cmd_data_print_confirm("[clone]:", entry->clone_en, sizeof (a_bool_t));
+ dprintf(" ");
+ cmd_data_print_confirm("[da_pri]:", entry->da_pri_en, sizeof (a_bool_t));
+ dprintf(" ");
+ if (A_TRUE == entry->da_pri_en)
+ {
+ tmp = entry->da_queue;
+ dprintf("[queue]:%d", tmp);
+ }
+ else
+ {
+ dprintf("[queue]:0");
+ }
+ dprintf(" ");
+ cmd_data_print_confirm("[cross_pt_state]:", entry->cross_pt_state, sizeof (a_bool_t));
+ dprintf(" ");
+ cmd_data_print_confirm("[white_list_en]:", entry->white_list_en, sizeof (a_bool_t));
+ dprintf("\n");
+
+ return;
+}
+
+#define cmd_data_check_element(info, defval, usage, chk_func, param) \
+{\
+ sw_error_t ret;\
+ do {\
+ cmd = get_sub_cmd(info, defval);\
+ SW_RTN_ON_NULL_PARAM(cmd);\
+ \
+ if (!strncasecmp(cmd, "quit", 4)) {\
+ return SW_BAD_VALUE;\
+ } else if (!strncasecmp(cmd, "help", 4)) {\
+ dprintf("%s", usage);\
+ ret = SW_BAD_VALUE;\
+ } else {\
+ ret = chk_func param; \
+ if (SW_OK != ret)\
+ dprintf("%s", usage);\
+ }\
+ } while (talk_mode && (SW_OK != ret));\
+}
+
+sw_error_t
+cmd_data_check_integer(char *cmd_str, a_uint32_t * arg_val, a_uint32_t max_val,
+ a_uint32_t min_val)
+{
+ a_uint32_t tmp;
+ a_uint32_t i;
+
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_PARAM;
+ }
+
+ if (0 == cmd_str[0])
+ {
+ return SW_BAD_PARAM;
+ }
+
+ if ((cmd_str[0] == '0') && ((cmd_str[1] == 'x') || (cmd_str[1] == 'X')))
+ {
+ for (i = 2; i < strlen(cmd_str); i++)
+ {
+ if (A_FALSE == is_hex(cmd_str[i]))
+ {
+ return SW_BAD_VALUE;
+ }
+ }
+ sscanf(cmd_str, "%x", &tmp);
+ }
+ else
+ {
+ for (i = 0; i < strlen(cmd_str); i++)
+ {
+ if (A_FALSE == is_dec(cmd_str[i]))
+ {
+ return SW_BAD_VALUE;
+ }
+ }
+ sscanf(cmd_str, "%d", &tmp);
+ }
+
+ if ((tmp > max_val) || (tmp < min_val))
+ return SW_BAD_PARAM;
+
+ *arg_val = tmp;
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_ruletype(char *cmd_str, fal_acl_rule_type_t * arg_val,
+ a_uint32_t size)
+{
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (!strcasecmp(cmd_str, "mac"))
+ {
+ *arg_val = FAL_ACL_RULE_MAC;
+ }
+ else if (!strcasecmp(cmd_str, "ip4"))
+ {
+ *arg_val = FAL_ACL_RULE_IP4;
+ }
+ else if (!strcasecmp(cmd_str, "ip6"))
+ {
+ *arg_val = FAL_ACL_RULE_IP6;
+ }
+ else if (!strcasecmp(cmd_str, "udf"))
+ {
+ *arg_val = FAL_ACL_RULE_UDF;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_ruletype(char * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ fal_acl_rule_type_t *val;
+
+ val = (fal_acl_rule_type_t *) buf;
+ dprintf("%s", param_name);
+
+ if (FAL_ACL_RULE_MAC == *val)
+ {
+ dprintf("mac");
+ }
+ else if (FAL_ACL_RULE_IP4 == *val)
+ {
+ dprintf("ip4");
+ }
+ else if (FAL_ACL_RULE_IP6 == *val)
+ {
+ dprintf("ip6");
+ }
+ else if (FAL_ACL_RULE_UDF == *val)
+ {
+ dprintf("udf");
+ }
+ else
+ {
+ dprintf("unknow");
+ }
+}
+
+sw_error_t
+cmd_data_check_fieldop(char *cmdstr, fal_acl_field_op_t def,
+ fal_acl_field_op_t * val)
+{
+ if (0 == cmdstr[0])
+ {
+ *val = def;
+ }
+ else if ((!strcasecmp(cmdstr, "mask")) || (!strcasecmp(cmdstr, "m")))
+ {
+ *val = FAL_ACL_FIELD_MASK;
+ }
+ else if ((!strcasecmp(cmdstr, "range")) || (!strcasecmp(cmdstr, "r")))
+ {
+ *val = FAL_ACL_FIELD_RANGE;
+ }
+ else if ((!strcasecmp(cmdstr, "le")) || (!strcasecmp(cmdstr, "l")))
+ {
+ *val = FAL_ACL_FIELD_LE;
+ }
+ else if ((!strcasecmp(cmdstr, "ge")) || (!strcasecmp(cmdstr, "g")))
+ {
+ *val = FAL_ACL_FIELD_GE;
+ }
+ else if ((!strcasecmp(cmdstr, "ne")) || (!strcasecmp(cmdstr, "n")))
+ {
+ *val = FAL_ACL_FIELD_NE;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_fieldop(char * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ fal_acl_field_op_t *val;
+
+ val = (fal_acl_field_op_t *) buf;
+ dprintf("%s", param_name);
+
+ if (FAL_ACL_FIELD_MASK == *val)
+ {
+ dprintf("mask");
+ }
+ else if (FAL_ACL_FIELD_RANGE == *val)
+ {
+ dprintf("range");
+ }
+ else if (FAL_ACL_FIELD_LE == *val)
+ {
+ dprintf("le");
+ }
+ else if (FAL_ACL_FIELD_GE == *val)
+ {
+ dprintf("ge");
+ }
+ else if (FAL_ACL_FIELD_NE == *val)
+ {
+ dprintf("ne");
+ }
+ else
+ {
+ dprintf("unknow");
+ }
+}
+
+sw_error_t
+cmd_data_check_ip4addr(char *cmdstr, void * val, a_uint32_t size)
+{
+ char *tmp = NULL;
+ a_uint32_t i = 0, j;
+ a_uint32_t addr;
+ fal_ip4_addr_t ip4;
+ char cmd[128+1] = { 0 };
+
+ memset(&ip4, 0, sizeof (fal_ip4_addr_t));
+ if (NULL == cmdstr)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (0 == cmdstr[0])
+ {
+ return SW_BAD_VALUE;
+ }
+
+ for (i = 0; i < 128; i++)
+ {
+ if (0 == cmdstr[i])
+ {
+ break;
+ }
+ }
+
+ i++;
+ if (128 < i)
+ {
+ i = 128;
+ }
+
+ memcpy(cmd, cmdstr, i);
+
+ /* make sure the string can be terminated */
+ cmd[i] = '\0';
+ tmp = (void *) strtok(cmd, ".");
+ i = 0;
+ while (tmp)
+ {
+ if (4 <= i)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if ((3 < strlen(tmp)) || (0 == strlen(tmp)))
+ {
+ return SW_BAD_VALUE;
+ }
+
+ for (j = 0; j < strlen(tmp); j++)
+ {
+ if (A_FALSE == is_dec(tmp[j]))
+ {
+ return SW_BAD_VALUE;
+ }
+ }
+
+ sscanf(tmp, "%d", &addr);
+ if (255 < addr)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ ip4 |= ((addr & 0xff) << (24 - i * 8));
+ i++;
+ tmp = (void *) strtok(NULL, ".");
+ }
+
+ if (4 != i)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ *(fal_ip4_addr_t*)val = ip4;
+ return SW_OK;
+}
+
+void
+cmd_data_print_ip4addr(char * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ a_uint32_t i;
+ fal_ip4_addr_t ip4;
+
+ ip4 = *((fal_ip4_addr_t *) buf);
+ dprintf("%s", param_name);
+ for (i = 0; i < 3; i++)
+ {
+ dprintf("%d.", (ip4 >> (24 - i * 8)) & 0xff);
+ }
+ dprintf("%d", (ip4 & 0xff));
+}
+
+sw_error_t
+cmd_data_check_multi(char *info, void *val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ fal_igmp_sg_entry_t entry;
+
+ memset(&entry, 0, sizeof (fal_igmp_sg_entry_t));
+
+ do
+ {
+ cmd = get_sub_cmd("group type", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.group.type), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if(entry.group.type==0)
+ {
+ cmd_data_check_element("group ip4 addr", "0.0.0.0",
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd, &(entry.group.u.ip4_addr), 4));
+ }
+ else
+ cmd_data_check_element("group ip6 addr", NULL,
+ "usage: the format is xxxx::xxxx \n",
+ cmd_data_check_ip6addr, (cmd, &(entry.group.u.ip6_addr), 16));
+
+ do
+ {
+ cmd = get_sub_cmd("source type", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.source.type), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if(entry.source.type==0)
+ {
+ cmd_data_check_element("source ip4 addr", "0.0.0.0",
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd, &(entry.source.u.ip4_addr), 4));
+ }
+ else
+ cmd_data_check_element("source ip6 addr", NULL,
+ "usage: the format is xxxx::xxxx \n",
+ cmd_data_check_ip6addr, (cmd, &(entry.source.u.ip6_addr), 16));
+
+ do
+ {
+ cmd = get_sub_cmd("portmap", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.port_map), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *(fal_igmp_sg_entry_t *)val = entry;
+
+ return SW_OK;
+}
+void
+cmd_data_print_multi(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_igmp_sg_entry_t *entry;
+
+ entry = (fal_igmp_sg_entry_t *) buf;
+
+ dprintf("\n[multicast info]: [group type]:%x [source type]:%x ", entry->group.type, entry->source.type);
+
+ if(entry->group.type == 0)
+ cmd_data_print_ip4addr("\n[group ip4 addr]:",
+ (a_uint32_t *) & (entry->group.u.ip4_addr),
+ sizeof (fal_ip4_addr_t));
+ else
+ cmd_data_print_ip6addr("\n[group ip6 addr]:",
+ (a_uint32_t *) & (entry->group.u.ip6_addr),
+ sizeof (fal_ip6_addr_t));
+
+ if(entry->source.type == 0)
+ cmd_data_print_ip4addr("\n[source ip4 addr]:",
+ (a_uint32_t *) & (entry->source.u.ip4_addr),
+ sizeof (fal_ip4_addr_t));
+ else
+ cmd_data_print_ip6addr("\n[source ip6 addr]:",
+ (a_uint32_t *) & (entry->source.u.ip6_addr),
+ sizeof (fal_ip6_addr_t));
+
+ dprintf("\n[entry portmap]: [portmap]:0x%x ", entry->port_map);
+
+}
+
+sw_error_t
+cmd_data_check_ip6addr(char *cmdstr, void * val, a_uint32_t size)
+{
+ char *tmp = NULL;
+ a_uint32_t j;
+ a_uint32_t i = 0, cnt = 0, rep = 0, loc = 0;
+ a_uint32_t data;
+ a_uint32_t addr[8];
+ fal_ip6_addr_t ip6;
+
+ if (NULL == cmdstr)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (0 == cmdstr[0])
+ {
+ return SW_BAD_VALUE;
+ }
+
+ for (i = 0; i < 8; i++)
+ {
+ addr[i] = 0;
+ }
+
+ for (i = 0; i < strlen(cmdstr); i++)
+ {
+ if (':' == cmdstr[i])
+ {
+ if ((i == (strlen(cmdstr) - 1))
+ || (0 == i))
+ {
+ return SW_BAD_VALUE;
+ }
+ cnt++;
+
+ if (':' == cmdstr[i - 1])
+ {
+ rep++;
+ loc = cnt - 1;
+ }
+ }
+ }
+
+ if (1 < rep)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ tmp = (void *) strtok(cmdstr, ":");
+ i = 0;
+ while (tmp)
+ {
+ if (8 <= i)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if ((4 < strlen(tmp)) || (0 == strlen(tmp)))
+ {
+ return SW_BAD_VALUE;
+ }
+
+ for (j = 0; j < strlen(tmp); j++)
+ {
+ if (A_FALSE == is_hex(tmp[j]))
+ {
+ return SW_BAD_VALUE;
+ }
+ }
+
+ sscanf(tmp, "%x", &data);
+ if (65535 < data)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ addr[i++] = data;
+ tmp = (void *) strtok(NULL, ":");
+ }
+
+ if (0 == rep)
+ {
+ if (8 != i)
+ {
+ return SW_BAD_VALUE;
+ }
+ }
+ else
+ {
+ if (8 <= i)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ for (j = i - 1; j >= loc; j--)
+ {
+ addr[8 - i + j] = addr[j];
+ addr[j] = 0;
+ }
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ ip6.ul[i] = (addr[i * 2] << 16) | addr[i * 2 + 1];
+ }
+
+ dprintf("\n");
+ for (i = 0; i < 4; i++)
+ {
+ dprintf("%08x ", ip6.ul[i]);
+ }
+ dprintf("\n");
+
+ *(fal_ip6_addr_t*)val = ip6;
+ return SW_OK;
+}
+
+void
+cmd_data_print_ip6addr(char * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ a_uint32_t i;
+ fal_ip6_addr_t ip6;
+
+ ip6 = *(fal_ip6_addr_t *) buf;
+ dprintf("%s", param_name);
+ for (i = 0; i < 3; i++)
+ {
+ dprintf("%x:%x:", (ip6.ul[i] >> 16) & 0xffff, ip6.ul[i] & 0xffff);
+ }
+ dprintf("%x:%x", (ip6.ul[3] >> 16) & 0xffff, ip6.ul[3] & 0xffff);
+}
+
+sw_error_t
+cmd_data_check_mac_field(fal_acl_rule_t * entry)
+{
+ char *cmd;
+ a_uint32_t tmpdata;
+
+ /* get destination mac address field configuration */
+ cmd_data_check_element("mac dst addr field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("dst mac addr", NULL,
+ "usage: the format is xx-xx-xx-xx-xx-xx \n",
+ cmd_data_check_macaddr, (cmd,
+ &(entry->dest_mac_val),
+ sizeof
+ (fal_mac_addr_t)));
+
+ cmd_data_check_element("dst mac addr mask", NULL,
+ "usage: the format is xx-xx-xx-xx-xx-xx \n",
+ cmd_data_check_macaddr, (cmd,
+ &(entry->dest_mac_mask),
+ sizeof
+ (fal_mac_addr_t)));
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_DA);
+ }
+
+ /* get source mac address field configuration */
+ cmd_data_check_element("mac src addr field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("src mac addr", NULL,
+ "usage: the format is xx-xx-xx-xx-xx-xx \n",
+ cmd_data_check_macaddr, (cmd,
+ &(entry->src_mac_val),
+ sizeof
+ (fal_mac_addr_t)));
+
+ cmd_data_check_element("src mac addr mask", NULL,
+ "usage: the format is xx-xx-xx-xx-xx-xx \n",
+ cmd_data_check_macaddr, (cmd,
+ &(entry->src_mac_mask),
+ sizeof
+ (fal_mac_addr_t)));
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_SA);
+ }
+
+ /* get ethernet type field configuration */
+ cmd_data_check_element("ethernet type field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ethernet type", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535\n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xffff,
+ 0x0));
+ entry->ethtype_val = tmpdata & 0xffff;
+
+ cmd_data_check_element("ethernet type mask", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535\n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xffff,
+ 0x0));
+ entry->ethtype_mask = tmpdata & 0xffff;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_ETHTYPE);
+ }
+
+ /* get vlanid field configuration */
+ cmd_data_check_element("vlanid field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("vlanid opration", "mask",
+ "usage: <mask/range/le/ge/ne> \n",
+ cmd_data_check_fieldop, (cmd, FAL_ACL_FIELD_MASK,
+ &(entry->vid_op)));
+
+ if (FAL_ACL_FIELD_MASK == entry->vid_op)
+ {
+ cmd_data_check_element("vlanid", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->vid_val = tmpdata & 0xfff;
+
+ cmd_data_check_element("vlanid mask", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->vid_mask = tmpdata & 0xfff;
+ }
+ else if (FAL_ACL_FIELD_RANGE == entry->vid_op)
+ {
+ cmd_data_check_element("vlanid low", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->vid_val = tmpdata & 0xfff;
+
+ cmd_data_check_element("vlanid high", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->vid_mask = tmpdata & 0xfff;
+ }
+ else
+ {
+ cmd_data_check_element("vlanid", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->vid_val = tmpdata & 0xfff;
+ }
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_VID);
+ }
+
+ /* get vlan tagged field configuration */
+ cmd_data_check_element("vlan tagged field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("tagged", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->tagged_val = tmpdata & 0x1;
+
+ cmd_data_check_element("tagged mask", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->tagged_mask = tmpdata & 0x1;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_TAGGED);
+ }
+
+ /* get up field configuration */
+ cmd_data_check_element("up field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("up", NULL,
+ "usage: the format is 0x0-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->up_val = tmpdata & 0x7;
+
+ cmd_data_check_element("up mask", NULL,
+ "usage: the format is 0x0-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->up_mask = tmpdata & 0x7;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_UP);
+ }
+
+ /* get cfi field configuration */
+ cmd_data_check_element("cfi field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("cfi", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->cfi_val = tmpdata & 0x1;
+
+ cmd_data_check_element("cfi mask", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->cfi_mask = tmpdata & 0x1;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_CFI);
+ }
+
+ /* get svlan tagged field configuration */
+ cmd_data_check_element("svlan tagged field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("stagged", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->stagged_val = tmpdata & 0x1;
+
+ cmd_data_check_element("stagged mask", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->stagged_mask = tmpdata & 0x1;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_STAGGED);
+ }
+
+ /* get stag vlanid field configuration */
+ cmd_data_check_element("stag vid field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("stag vid opration", "mask",
+ "usage: <mask/range/le/ge/ne> \n",
+ cmd_data_check_fieldop, (cmd, FAL_ACL_FIELD_MASK,
+ &(entry->stag_vid_op)));
+
+ if (FAL_ACL_FIELD_MASK == entry->stag_vid_op)
+ {
+ cmd_data_check_element("stag vid", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->stag_vid_val = tmpdata & 0xfff;
+
+ cmd_data_check_element("stag vid mask", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->stag_vid_mask = tmpdata & 0xfff;
+ }
+ else if (FAL_ACL_FIELD_RANGE == entry->stag_vid_op)
+ {
+ cmd_data_check_element("stag vid low", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->stag_vid_val = tmpdata & 0xfff;
+
+ cmd_data_check_element("stag vid high", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->stag_vid_mask = tmpdata & 0xfff;
+ }
+ else
+ {
+ cmd_data_check_element("stag vid", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->stag_vid_val = tmpdata & 0xfff;
+ }
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_STAG_VID);
+ }
+
+
+ /* get stag priority field configuration */
+ cmd_data_check_element("stag pri field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("stag pri", NULL,
+ "usage: the format is 0x0-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->stag_pri_val = tmpdata & 0x7;
+
+ cmd_data_check_element("stag pri mask", NULL,
+ "usage: the format is 0x0-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->stag_pri_mask = tmpdata & 0x7;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_STAG_PRI);
+ }
+
+ /* get stag dei field configuration */
+ cmd_data_check_element("stag dei field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("stag dei", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->stag_dei_val = tmpdata & 0x1;
+
+ cmd_data_check_element("stag dei mask", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->stag_dei_mask = tmpdata & 0x1;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_STAG_DEI);
+ }
+
+ /* get cvlan tagged field configuration */
+ cmd_data_check_element("cvlan tagged field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ctagged", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->ctagged_val = tmpdata & 0x1;
+
+ cmd_data_check_element("ctagged mask", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->ctagged_mask = tmpdata & 0x1;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_CTAGGED);
+ }
+
+ /* get ctag vlanid field configuration */
+ cmd_data_check_element("ctag vid field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ctag vid opration", "mask",
+ "usage: <mask/range/le/ge/ne> \n",
+ cmd_data_check_fieldop, (cmd, FAL_ACL_FIELD_MASK,
+ &(entry->ctag_vid_op)));
+
+ if (FAL_ACL_FIELD_MASK == entry->ctag_vid_op)
+ {
+ cmd_data_check_element("ctag vid", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->ctag_vid_val = tmpdata & 0xfff;
+
+ cmd_data_check_element("ctag vid mask", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->ctag_vid_mask = tmpdata & 0xfff;
+ }
+ else if (FAL_ACL_FIELD_RANGE == entry->ctag_vid_op)
+ {
+ cmd_data_check_element("ctag vid low", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->ctag_vid_val = tmpdata & 0xfff;
+
+ cmd_data_check_element("ctag vid high", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->ctag_vid_mask = tmpdata & 0xfff;
+ }
+ else
+ {
+ cmd_data_check_element("ctag vid", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xfff, 0x0));
+ entry->ctag_vid_val = tmpdata & 0xfff;
+ }
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_CTAG_VID);
+ }
+
+ /* get ctag priority field configuration */
+ cmd_data_check_element("ctag pri field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ctag pri", NULL,
+ "usage: the format is 0x0-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->ctag_pri_val = tmpdata & 0x7;
+
+ cmd_data_check_element("ctag pri mask", NULL,
+ "usage: the format is 0x0-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->ctag_pri_mask = tmpdata & 0x7;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_CTAG_PRI);
+ }
+
+ /* get ctag cfi field configuration */
+ cmd_data_check_element("ctag cfi field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ctag cfi", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->ctag_cfi_val = tmpdata & 0x1;
+
+ cmd_data_check_element("ctag cfi mask", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->ctag_cfi_mask = tmpdata & 0x1;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_MAC_CTAG_CFI);
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_ip4_field(fal_acl_rule_t * entry)
+{
+ char *cmd;
+ a_uint32_t tmpdata;
+
+ /* get ip4 source address field configuration */
+ cmd_data_check_element("ip4 src address field", "no",
+ "usage: <yes/no/y/n>\n", cmd_data_check_confirm,
+ (cmd, A_FALSE, &tmpdata, sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ip4 src addr", NULL,
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd,
+ &(entry->src_ip4_val), 4));
+
+ cmd_data_check_element("ip4 src addr mask", NULL,
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd,
+ &(entry->src_ip4_mask), 4));
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_IP4_SIP);
+ }
+
+ /* get ip4 destination address field configuration */
+ cmd_data_check_element("ip4 dst address field", "no",
+ "usage: <yes/no/y/n>\n", cmd_data_check_confirm,
+ (cmd, A_FALSE, &tmpdata, sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ip4 dst addr", NULL,
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd,
+ &(entry->
+ dest_ip4_val), 4));
+
+ cmd_data_check_element("ip4 dst addr mask", NULL,
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd,
+ &(entry->
+ dest_ip4_mask), 4));
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_IP4_DIP);
+ }
+
+ /* get ripv1 field configuration */
+ cmd_data_check_element("ripv1 field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ripv1", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->ripv1_val = tmpdata & 0x1;
+
+ cmd_data_check_element("ripv1 mask", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->ripv1_mask = tmpdata & 0x1;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_RIPV1);
+ }
+
+ /* get dhcpv4 field configuration */
+ cmd_data_check_element("dhcpv4 field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("dhcpv4", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->dhcpv4_val = tmpdata & 0x1;
+
+ cmd_data_check_element("dhcpv4 mask", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->dhcpv4_mask = tmpdata & 0x1;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_DHCPV4);
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_ip6_field(fal_acl_rule_t * entry)
+{
+ char *cmd;
+ a_uint32_t tmpdata;
+
+ /* get ip6 source address field configuration */
+ cmd_data_check_element("ip6 src address field", "no",
+ "usage: <yes/no/y/n>\n", cmd_data_check_confirm,
+ (cmd, A_FALSE, &tmpdata, sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ip6 src addr", NULL,
+ "usage: the format is xxxx::xxxx \n",
+ cmd_data_check_ip6addr, (cmd,
+ &(entry->src_ip6_val), 16));
+
+ cmd_data_check_element("ip6 src addr mask", NULL,
+ "usage: the format is xxxx::xxxx \n",
+ cmd_data_check_ip6addr, (cmd,
+ &(entry->
+ src_ip6_mask), 16));
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_IP6_SIP);
+ }
+
+ /* get ip6 destination address field configuration */
+ cmd_data_check_element("ip6 dst address field", "no",
+ "usage: <yes/no/y/n>\n", cmd_data_check_confirm,
+ (cmd, A_FALSE, &tmpdata, sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ip6 dst addr", NULL,
+ "usage: the format is xxxx::xxxx \n",
+ cmd_data_check_ip6addr, (cmd,
+ &(entry->
+ dest_ip6_val), 16));
+
+ cmd_data_check_element("ip6 dst addr mask", NULL,
+ "usage: the format is xxxx::xxxx \n",
+ cmd_data_check_ip6addr, (cmd,
+ &(entry->
+ dest_ip6_mask), 16));
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_IP6_DIP);
+ }
+
+ /* get ip6 flow label field configuration */
+ cmd_data_check_element("ip6 flow label field", "no",
+ "usage: <yes/no/y/n>\n", cmd_data_check_confirm,
+ (cmd, A_FALSE, &tmpdata, sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ip6 label", NULL,
+ "usage: the format is 0x0-0xfffff or 0-1048575\n",
+ cmd_data_check_integer, (cmd,
+ &(entry->ip6_lable_val),
+ 0xfffff, 0x0));
+
+ cmd_data_check_element("ip6 label mask", NULL,
+ "usage: the format is 0x0-0xfffff or 0-1048575\n",
+ cmd_data_check_integer, (cmd,
+ &(entry->
+ ip6_lable_mask),
+ 0xfffff, 0x0));
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_IP6_LABEL);
+ }
+
+ /* get dhcpv6 field configuration */
+ cmd_data_check_element("dhcpv6 field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("dhcpv6", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->dhcpv6_val = tmpdata & 0xff;
+
+ cmd_data_check_element("dhcpv6 mask", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->dhcpv6_mask = tmpdata & 0xff;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_DHCPV6);
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_ip_field(fal_acl_rule_t * entry)
+{
+ char *cmd;
+ a_uint32_t tmpdata;
+
+ /* get ip protocol field configuration */
+ cmd_data_check_element("ip protocol field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ip protocol", NULL,
+ "usage: the format is 0x0-0xff or 0-255 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->ip_proto_val = tmpdata & 0xff;
+
+ cmd_data_check_element("ip protocol mask", NULL,
+ "usage: the format is 0x0-0xff or 0-255 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->ip_proto_mask = tmpdata & 0xff;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_IP_PROTO);
+ }
+
+ /* get ip dscp field configuration */
+ cmd_data_check_element("ip dscp field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (tmpdata)
+ {
+ cmd_data_check_element("ip dscp", NULL,
+ "usage: the format is 0x0-0xff or 0-255 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->ip_dscp_val = tmpdata & 0xff;
+
+ cmd_data_check_element("ip dscp mask", NULL,
+ "usage: the format is 0x0-0xff or 0-255 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->ip_dscp_mask = tmpdata & 0xff;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_IP_DSCP);
+ }
+
+ /* get ip l4 destination port field configuration */
+ cmd_data_check_element("ip l4 dst port field", "no",
+ "usage: <yes/no/y/n>\n", cmd_data_check_confirm,
+ (cmd, A_FALSE, &tmpdata, sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ip l4 dst port opration", "mask",
+ "usage: <mask/range/le/ge/ne> \n",
+ cmd_data_check_fieldop, (cmd, FAL_ACL_FIELD_MASK,
+ &(entry->
+ dest_l4port_op)));
+
+ if (FAL_ACL_FIELD_MASK == entry->dest_l4port_op)
+ {
+ cmd_data_check_element("ip l4 dst port", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->dest_l4port_val = tmpdata & 0xffff;
+
+ cmd_data_check_element("ip l4 dst port mask", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->dest_l4port_mask = tmpdata & 0xffff;
+ }
+ else if (FAL_ACL_FIELD_RANGE == entry->dest_l4port_op)
+ {
+ cmd_data_check_element("ip l4 dst port low", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->dest_l4port_val = tmpdata & 0xffff;
+
+ cmd_data_check_element("ip l4 dst port high", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->dest_l4port_mask = tmpdata & 0xffff;
+ }
+ else
+ {
+ cmd_data_check_element("ip l4 dst port", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->dest_l4port_val = tmpdata & 0xffff;
+ }
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_L4_DPORT);
+ }
+
+ /* get ip l4 source port field configuration */
+ cmd_data_check_element("ip l4 src port field", "no",
+ "usage: <yes/no/y/n>\n", cmd_data_check_confirm,
+ (cmd, A_FALSE, &tmpdata, sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("ip l4 src port opration", "mask",
+ "usage: <mask/range/le/ge/ne> \n",
+ cmd_data_check_fieldop, (cmd, FAL_ACL_FIELD_MASK,
+ &(entry->
+ src_l4port_op)));
+
+ if (FAL_ACL_FIELD_MASK == entry->src_l4port_op)
+ {
+ cmd_data_check_element("ip l4 src port", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->src_l4port_val = tmpdata & 0xffff;
+
+ cmd_data_check_element("ip l4 src port mask", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->src_l4port_mask = tmpdata & 0xffff;
+ }
+ else if (FAL_ACL_FIELD_RANGE == entry->src_l4port_op)
+ {
+ cmd_data_check_element("ip l4 src port low", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->src_l4port_val = tmpdata & 0xffff;
+
+ cmd_data_check_element("ip l4 src port high", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->src_l4port_mask = tmpdata & 0xffff;
+ }
+ else
+ {
+ cmd_data_check_element("ip l4 src port", NULL,
+ "usage: the format is 0x0-0xffff or 0-65535 \n",
+ cmd_data_check_integer, (cmd, &tmpdata,
+ 0xffff, 0x0));
+ entry->src_l4port_val = tmpdata & 0xffff;
+ }
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_L4_SPORT);
+ }
+
+ /* get tcp flags field configuration */
+ cmd_data_check_element("tcp flags field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("tcp flags", NULL,
+ "usage: the format is 0x0-0x3f or 0-63 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x3f,
+ 0x0));
+ entry->tcp_flag_val = tmpdata & 0x3f;
+
+ cmd_data_check_element("tcp flags mask", NULL,
+ "usage: the format is 0x0-0x3f or 0-63 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x3f,
+ 0x0));
+ entry->tcp_flag_mask = tmpdata & 0x3f;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_TCP_FLAG);
+ }
+
+ /* get icmp type field configuration */
+ cmd_data_check_element("icmp type field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("icmp type", NULL,
+ "usage: the format is 0x0-0xff or 0-255 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->icmp_type_val = tmpdata & 0xff;
+
+ cmd_data_check_element("icmp type mask", NULL,
+ "usage: the format is 0x0-0xff or 0-255 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->icmp_type_mask = tmpdata & 0xff;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_ICMP_TYPE);
+ }
+
+ /* get icmp code field configuration */
+ cmd_data_check_element("icmp code field", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("icmp code", NULL,
+ "usage: the format is 0x0-0xff or 0-255 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->icmp_code_val = tmpdata & 0xff;
+
+ cmd_data_check_element("icmp code mask", NULL,
+ "usage: the format is 0x0-0xff or 0-255 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xff,
+ 0x0));
+ entry->icmp_code_mask = tmpdata & 0xff;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_ICMP_CODE);
+ }
+
+ return SW_OK;
+}
+
+
+sw_error_t
+cmd_data_check_udf_type(char *cmdstr, fal_acl_udf_type_t * arg_val, a_uint32_t size)
+{
+ if (NULL == cmdstr)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (!strcasecmp(cmdstr, "l2"))
+ {
+ *arg_val = FAL_ACL_UDF_TYPE_L2;
+ }
+ else if (!strcasecmp(cmdstr, "l2snap"))
+ {
+ *arg_val = FAL_ACL_UDF_TYPE_L2_SNAP;
+ }
+ else if (!strcasecmp(cmdstr, "l3"))
+ {
+ *arg_val = FAL_ACL_UDF_TYPE_L3;
+ }
+ else if (!strcasecmp(cmdstr, "l3plus"))
+ {
+ *arg_val = FAL_ACL_UDF_TYPE_L3_PLUS;
+ }
+ else if (!strcasecmp(cmdstr, "l4"))
+ {
+ *arg_val = FAL_ACL_UDF_TYPE_L4;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_udf_type(char * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ fal_acl_udf_type_t *val;
+
+ val = (fal_acl_udf_type_t *) buf;
+ dprintf("%s", param_name);
+
+ if (FAL_ACL_UDF_TYPE_L2 == *val)
+ {
+ dprintf("l2");
+ }
+ else if (FAL_ACL_UDF_TYPE_L2_SNAP == *val)
+ {
+ dprintf("l2snap");
+ }
+ else if (FAL_ACL_UDF_TYPE_L3 == *val)
+ {
+ dprintf("l3");
+ }
+ else if (FAL_ACL_UDF_TYPE_L3_PLUS == *val)
+ {
+ dprintf("l3plus");
+ }
+ else if (FAL_ACL_UDF_TYPE_L4 == *val)
+ {
+ dprintf("l4");
+ }
+ else
+ {
+ dprintf("unknow");
+ }
+}
+
+sw_error_t
+cmd_data_check_udf_element(char *cmdstr, a_uint8_t * val, a_uint32_t * len)
+{
+ char *tmp = NULL;
+ a_uint32_t i = 0, j;
+ a_uint32_t data;
+
+ memset(val, 0, 16);
+ if (NULL == cmdstr)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (0 == cmdstr[0])
+ {
+ return SW_BAD_VALUE;
+ }
+
+ tmp = (void *) strtok(cmdstr, "-");
+ while (tmp)
+ {
+ if (16 <= i)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if ((2 < strlen(tmp)) || (0 == strlen(tmp)))
+ {
+ return SW_BAD_VALUE;
+ }
+
+ for (j = 0; j < strlen(tmp); j++)
+ {
+ if (A_FALSE == is_hex(tmp[j]))
+ {
+ return SW_BAD_VALUE;
+ }
+ }
+
+ sscanf(tmp, "%x", &data);
+
+ val[i++] = data & 0xff;
+ tmp = (void *) strtok(NULL, "-");
+ }
+
+ if (0 == i)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ *len = i;
+ return SW_OK;
+}
+
+void
+cmd_data_print_udf_element(char * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ a_uint8_t *val, i;
+
+ if (size)
+ {
+ val = (a_uint8_t *) buf;
+ dprintf("%s", param_name);
+
+ for (i = 0; i < (size - 1); i++)
+ {
+ dprintf("%02x-", *val);
+ val++;
+ }
+ dprintf("%02x", *val);
+ }
+}
+
+
+sw_error_t
+cmd_data_check_udf_field(fal_acl_rule_t * entry)
+{
+ char *cmd;
+ a_uint32_t tmpdata, vlen, mlen;
+
+ /* get udf field configuration */
+ cmd_data_check_element("user define field", "no",
+ "usage: <yes/no/y/n>\n", cmd_data_check_confirm,
+ (cmd, A_FALSE, &tmpdata, sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("udf type", NULL,
+ "usage: <l2/l3>\n",
+ cmd_data_check_udf_type, (cmd,
+ &(entry->udf_type), 4));
+
+ cmd_data_check_element("udf offset", NULL,
+ "usage: <0-126, must be even>\n",
+ cmd_data_check_uint32, (cmd, &tmpdata, vlen));
+ entry->udf_offset = tmpdata;
+
+ cmd_data_check_element("udf value", NULL,
+ "usage: the format is xx-xx-xx-xx-xx\n",
+ cmd_data_check_udf_element, (cmd,
+ &(entry->udf_val[0]), &vlen));
+
+ cmd_data_check_element("udf mask", NULL,
+ "usage: the format is xx-xx-xx-xx-xx\n",
+ cmd_data_check_udf_element, (cmd,
+ &(entry->udf_mask[0]), &mlen));
+
+ if (vlen != mlen)
+ {
+ return SW_BAD_VALUE;
+ }
+ entry->udf_len = vlen;
+
+ FAL_FIELD_FLG_SET(entry->field_flg, FAL_ACL_FIELD_UDF);
+ }
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_acl_action(fal_acl_rule_t * entry)
+{
+ char *cmd;
+ a_uint32_t tmpdata;
+
+ /* get permit action configuration */
+ cmd_data_check_element("permit", "yes", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_TRUE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_PERMIT);
+ }
+
+ /* get deny action configuration */
+ cmd_data_check_element("deny", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_DENY);
+ }
+
+ /* get redirect to cpu action configuration */
+ cmd_data_check_element("rdt to cpu", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_RDTCPU);
+ }
+
+ /* get port redirection action configuration */
+ cmd_data_check_element("rdt to port", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("dst port", "null",
+ "usage: input port number such as 1,3\n",
+ cmd_data_check_portmap, (cmd, &entry->ports,
+ sizeof (fal_pbmp_t)));
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REDPT);
+ }
+
+ /* get copy to cpu action configuration */
+ cmd_data_check_element("copy to cpu", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_CPYCPU);
+ }
+
+ /* get mirror action configuration */
+ cmd_data_check_element("mirror", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_MIRROR);
+ }
+
+ /* get remark dscp action configuration */
+ cmd_data_check_element("remark dscp", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("dscp", NULL,
+ "usage: the format is 0x0-0x3f or 0-63 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x3f,
+ 0x0));
+ entry->dscp = tmpdata & 0x3f;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_DSCP);
+ }
+
+ /* get remark up action configuration */
+ cmd_data_check_element("remark up", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("up", NULL,
+ "usage: the format is 0x0-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->up = tmpdata & 0x7;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_UP);
+ }
+
+ /* get remark queue action configuration */
+ cmd_data_check_element("remark queue", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ cmd_data_check_element("queue", NULL,
+ "usage: the format is 0x0-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->queue = tmpdata & 0x7;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_QUEUE);
+ }
+
+ /* get modify vlan action configuration */
+ cmd_data_check_element("modify vlan", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("vlan", NULL,
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xfff,
+ 0x0));
+ entry->vid = tmpdata & 0xfff;
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_MODIFY_VLAN);
+
+ if (!FAL_ACTION_FLG_TST(entry->action_flg, FAL_ACL_ACTION_REDPT))
+ {
+ cmd_data_check_element("port member", "null",
+ "usage: input port number such as 1,3\n",
+ cmd_data_check_portmap, (cmd, &entry->ports,
+ sizeof (fal_pbmp_t)));
+ }
+ }
+
+ /* get nest vlan action configuration */
+ cmd_data_check_element("nest vlan", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("vlan", NULL,
+ "usage: the format is 0x1-0xfff or 1-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xfff,
+ 0x1));
+ entry->vid = tmpdata & 0xfff;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_NEST_VLAN);
+ }
+
+ cmd_data_check_element("stag vid", "0",
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xfff,
+ 0x0));
+ entry->stag_vid = tmpdata & 0xfff;
+
+ cmd_data_check_element("ctag vid", "0",
+ "usage: the format is 0x0-0xfff or 0-4095 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xfff,
+ 0x0));
+ entry->ctag_vid = tmpdata & 0xfff;
+
+ /* chang lookup vid action configuration */
+ cmd_data_check_element("lookup vid change", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_LOOKUP_VID);
+ }
+
+ /* chang stag vid action configuration */
+ cmd_data_check_element("stag vid change", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_STAG_VID);
+ }
+
+ /* chang stag pri action configuration */
+ cmd_data_check_element("stag pri change", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("stag pri", NULL,
+ "usage: the format is 0x1-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->stag_pri = tmpdata & 0x7;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_STAG_PRI);
+ }
+
+ /* chang stag dei action configuration */
+ cmd_data_check_element("stag dei change", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("stag dei", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->stag_dei = tmpdata & 0x1;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_STAG_DEI);
+ }
+
+ /* chang ctag vid action configuration */
+ cmd_data_check_element("ctag vid change", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_CTAG_VID);
+ }
+
+
+ /* chang ctag pri action configuration */
+ cmd_data_check_element("ctag pri change", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("ctag pri", NULL,
+ "usage: the format is 0x1-0x7 or 0-7 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x7,
+ 0x0));
+ entry->ctag_pri = tmpdata & 0x7;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_CTAG_PRI);
+ }
+
+ /* chang ctag cfi action configuration */
+ cmd_data_check_element("ctag cfi change", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("ctag cfi", NULL,
+ "usage: the format is 0x0-0x1 or 0-1 \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0x1,
+ 0x0));
+ entry->ctag_cfi = tmpdata & 0x1;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_REMARK_CTAG_CFI);
+ }
+
+ /* police action configuration */
+ cmd_data_check_element("police en", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("policer ptr", NULL,
+ "usage: the format is integer \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xffffffff,
+ 0x0));
+ entry->policer_ptr = tmpdata;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_POLICER_EN);
+ }
+
+ /* wcmp action configuration */
+ cmd_data_check_element("wcmp en", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("wcmp ptr", NULL,
+ "usage: the format is integer \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xffffffff,
+ 0x0));
+ entry->wcmp_ptr = tmpdata;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_WCMP_EN);
+ }
+
+ /* arp action configuration */
+ cmd_data_check_element("arp en", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("arp ptr", "0",
+ "usage: the format is integer \n",
+ cmd_data_check_integer, (cmd, &tmpdata, 0xffffffff,
+ 0x0));
+ entry->arp_ptr = tmpdata;
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_ARP_EN);
+ }
+
+ /* policy forward action configuration */
+ cmd_data_check_element("policy en", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (A_TRUE == tmpdata)
+ {
+ cmd_data_check_element("route", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (tmpdata)
+ {
+ entry->policy_fwd = FAL_ACL_POLICY_ROUTE;
+ }
+
+ cmd_data_check_element("snat", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (tmpdata)
+ {
+ entry->policy_fwd = FAL_ACL_POLICY_SNAT;
+ }
+
+ cmd_data_check_element("dnat", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (tmpdata)
+ {
+ entry->policy_fwd = FAL_ACL_POLICY_DNAT;
+ }
+
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_POLICY_FORWARD_EN);
+ }
+
+ cmd_data_check_element("eg bypass", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_BYPASS_EGRESS_TRANS);
+ }
+
+ cmd_data_check_element("trigger intr", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ FAL_ACTION_FLG_SET(entry->action_flg, FAL_ACL_ACTION_MATCH_TRIGGER_INTR);
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_aclrule(char *info, void *val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ fal_acl_rule_t entry;
+ a_uint32_t tmpdata;
+
+ memset(&entry, 0, sizeof (fal_acl_rule_t));
+
+ dprintf("\n");
+
+ /* get rule type configuration */
+ cmd_data_check_element("rule type", NULL, "usage: <mac/ip4/ip6/udf> \n",
+ cmd_data_check_ruletype, (cmd, &entry.rule_type,
+ sizeof
+ (fal_acl_rule_type_t)));
+
+ if (FAL_ACL_RULE_MAC == entry.rule_type)
+ {
+ rv = cmd_data_check_mac_field(&entry);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+ }
+
+ if (FAL_ACL_RULE_IP4 == entry.rule_type)
+ {
+ rv = cmd_data_check_mac_field(&entry);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+
+ rv = cmd_data_check_ip4_field(&entry);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+
+ rv = cmd_data_check_ip_field(&entry);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+ }
+
+ if (FAL_ACL_RULE_IP6 == entry.rule_type)
+ {
+ rv = cmd_data_check_mac_field(&entry);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+
+ rv = cmd_data_check_ip6_field(&entry);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+
+ rv = cmd_data_check_ip_field(&entry);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+ }
+
+ rv = cmd_data_check_udf_field(&entry);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+
+ /* get rule inverse configuration */
+ cmd_data_check_element("rule inverse", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+
+ if (tmpdata)
+ {
+ FAL_FIELD_FLG_SET(entry.field_flg, FAL_ACL_FIELD_INVERSE_ALL);
+ }
+
+ rv = cmd_data_check_acl_action(&entry);
+ if (SW_OK != rv)
+ {
+ return rv;
+ }
+
+ *(fal_acl_rule_t *) val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_aclrule(char * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ fal_acl_rule_t *rule;
+
+ rule = (fal_acl_rule_t *) buf;
+
+ cmd_data_print_ruletype("\n[rule_type]:",
+ (a_uint32_t *) & (rule->rule_type),
+ sizeof (fal_acl_rule_type_t));
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_DA))
+ {
+ cmd_data_print_macaddr("\n[mac_dst_addr]:",
+ (a_uint32_t *) & (rule->dest_mac_val),
+ sizeof (fal_mac_addr_t));
+ cmd_data_print_macaddr(" [mac_dst_addr_mask]:",
+ (a_uint32_t *) & (rule->dest_mac_mask),
+ sizeof (fal_mac_addr_t));
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_SA))
+ {
+ cmd_data_print_macaddr("\n[mac_src_addr]:",
+ (a_uint32_t *) & (rule->src_mac_val),
+ sizeof (fal_mac_addr_t));
+ cmd_data_print_macaddr(" [mac_src_addr_mask]:",
+ (a_uint32_t *) & (rule->src_mac_mask),
+ sizeof (fal_mac_addr_t));
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_ETHTYPE))
+ {
+ dprintf("\n[mac_eth_type]:0x%x", rule->ethtype_val);
+ dprintf(" [mac_eth_type_mask]:0x%x", rule->ethtype_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_TAGGED))
+ {
+ dprintf("\n[mac_tagged]:0x%x", rule->tagged_val);
+ dprintf(" [mac_tagged_mask]:0x%x", rule->tagged_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_UP))
+ {
+ dprintf("\n[mac_up]:0x%x", rule->up_val);
+ dprintf(" [mac_up_mask]:0x%x", rule->up_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_CFI))
+ {
+ dprintf("\n[mac_cfi]:0x%x", rule->cfi_val);
+ dprintf(" [mac_cfi_mask]:0x%x", rule->cfi_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_VID))
+ {
+ cmd_data_print_fieldop("\n[mac_vlanid_op]:",
+ (a_uint32_t *) & (rule->vid_op),
+ sizeof (fal_acl_field_op_t));
+ if (FAL_ACL_FIELD_MASK == rule->vid_op)
+ {
+ dprintf(" [vlanid]:0x%x", rule->vid_val);
+ dprintf(" [vlanid_mask]:0x%x", rule->vid_mask);
+ }
+ else
+ {
+ dprintf(" [vlanid_low]:0x%x", rule->vid_val);
+ dprintf(" [vlanid_high]:0x%x", rule->vid_mask);
+ }
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_STAGGED))
+ {
+ dprintf("\n[mac_stagged]:0x%x", rule->stagged_val);
+ dprintf(" [mac_stagged_mask]:0x%x", rule->stagged_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_STAG_PRI))
+ {
+ dprintf("\n[mac_stag_pri]:0x%x", rule->stag_pri_val);
+ dprintf(" [mac_stag_pri_mask]:0x%x", rule->stag_pri_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_STAG_DEI))
+ {
+ dprintf("\n[mac_stag_dei]:0x%x", rule->stag_dei_val);
+ dprintf(" [mac_stag_dei_mask]:0x%x", rule->stag_dei_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_STAG_VID))
+ {
+ cmd_data_print_fieldop("\n[mac_stag_vlanid_op]:",
+ (a_uint32_t *) & (rule->stag_vid_op),
+ sizeof (fal_acl_field_op_t));
+ if (FAL_ACL_FIELD_MASK == rule->stag_vid_op)
+ {
+ dprintf(" [stag_vlanid]:0x%x", rule->stag_vid_val);
+ dprintf(" [stag_vlanid_mask]:0x%x", rule->stag_vid_mask);
+ }
+ else
+ {
+ dprintf(" [stag_vlanid_low]:0x%x", rule->stag_vid_val);
+ dprintf(" [stag_vlanid_high]:0x%x", rule->stag_vid_mask);
+ }
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_CTAGGED))
+ {
+ dprintf("\n[mac_ctagged]:0x%x", rule->ctagged_val);
+ dprintf(" [mac_ctagged_mask]:0x%x", rule->ctagged_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_CTAG_PRI))
+ {
+ dprintf("\n[mac_ctag_pri]:0x%x", rule->ctag_pri_val);
+ dprintf(" [mac_ctag_pri_mask]:0x%x", rule->ctag_pri_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_CTAG_CFI))
+ {
+ dprintf("\n[mac_ctag_cfi]:0x%x", rule->ctag_cfi_val);
+ dprintf(" [mac_ctag_cfi_mask]:0x%x", rule->ctag_cfi_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_MAC_CTAG_VID))
+ {
+ cmd_data_print_fieldop("\n[mac_ctag_vlanid_op]:",
+ (a_uint32_t *) & (rule->ctag_vid_op),
+ sizeof (fal_acl_field_op_t));
+ if (FAL_ACL_FIELD_MASK == rule->ctag_vid_op)
+ {
+ dprintf(" [ctag_vlanid]:0x%x", rule->ctag_vid_val);
+ dprintf(" [ctag_vlanid_mask]:0x%x", rule->ctag_vid_mask);
+ }
+ else
+ {
+ dprintf(" [ctag_vlanid_low]:0x%x", rule->ctag_vid_val);
+ dprintf(" [ctag_vlanid_high]:0x%x", rule->ctag_vid_mask);
+ }
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_IP4_DIP))
+ {
+ cmd_data_print_ip4addr("\n[ip4_dst_addr]:",
+ (a_uint32_t *) & (rule->dest_ip4_val),
+ sizeof (fal_ip4_addr_t));
+ cmd_data_print_ip4addr(" [ip4_dst_addr_mask]:",
+ (a_uint32_t *) & (rule->dest_ip4_mask),
+ sizeof (fal_ip4_addr_t));
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_IP4_SIP))
+ {
+ cmd_data_print_ip4addr("\n[ip4_src_addr]:",
+ (a_uint32_t *) & (rule->src_ip4_val),
+ sizeof (fal_ip4_addr_t));
+ cmd_data_print_ip4addr(" [ip4_src_addr_mask]:",
+ (a_uint32_t *) & (rule->src_ip4_mask),
+ sizeof (fal_ip4_addr_t));
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_RIPV1))
+ {
+ dprintf("\n[ip4_ripv1]:0x%x", rule->ripv1_val);
+ dprintf(" [ip4_ripv1_mask]:0x%x", rule->ripv1_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_DHCPV4))
+ {
+ dprintf("\n[ip4_dhcpv4]:0x%x", rule->dhcpv4_val);
+ dprintf(" [ip4_dhcpv4_mask]:0x%x", rule->dhcpv4_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_IP6_DIP))
+ {
+ cmd_data_print_ip6addr("\n[ip6_dst_addr]:",
+ (a_uint32_t *) & (rule->dest_ip6_val),
+ sizeof (fal_ip6_addr_t));
+ cmd_data_print_ip6addr("\n[ip6_dst_addr_mask]:",
+ (a_uint32_t *) & (rule->dest_ip6_mask),
+ sizeof (fal_ip6_addr_t));
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_IP6_SIP))
+ {
+ cmd_data_print_ip6addr("\n[ip6_src_addr]:",
+ (a_uint32_t *) & (rule->src_ip6_val),
+ sizeof (fal_ip6_addr_t));
+ cmd_data_print_ip6addr("\n[ip6_src_addr_mask]:",
+ (a_uint32_t *) & (rule->src_ip6_mask),
+ sizeof (fal_ip6_addr_t));
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_IP6_LABEL))
+ {
+ dprintf("\n[ip6_flow_label]:0x%x", rule->ip6_lable_val);
+ dprintf(" [ip6_flow_label_mask]:0x%x", rule->ip6_lable_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_DHCPV6))
+ {
+ dprintf("\n[ip6_dhcpv6]:0x%x", rule->dhcpv6_val);
+ dprintf(" [ip6_dhcpv6_mask]:0x%x", rule->dhcpv6_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_IP_PROTO))
+ {
+ dprintf("\n[ip_proto]:0x%x", rule->ip_proto_val);
+ dprintf(" [ip_proto_mask]:0x%x", rule->ip_proto_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_IP_DSCP))
+ {
+ dprintf("\n[ip_dscp]:0x%x", rule->ip_dscp_val);
+ dprintf(" [ip_dscp_mask]:0x%x", rule->ip_dscp_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_L4_DPORT))
+ {
+ cmd_data_print_fieldop("\n[ip_l4_dport_op]:",
+ (a_uint32_t *) & (rule->dest_l4port_op),
+ sizeof (fal_acl_field_op_t));
+ if (FAL_ACL_FIELD_MASK == rule->dest_l4port_op)
+ {
+ dprintf(" [dport]:0x%x", rule->dest_l4port_val);
+ dprintf(" [dport_mask]:0x%x", rule->dest_l4port_mask);
+ }
+ else
+ {
+ dprintf(" [dport_low]:0x%x", rule->dest_l4port_val);
+ dprintf(" [dport_high]:0x%x", rule->dest_l4port_mask);
+ }
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_L4_SPORT))
+ {
+ cmd_data_print_fieldop("\n[ip_l4_sport_op]:",
+ (a_uint32_t *) & (rule->src_l4port_op),
+ sizeof (fal_acl_field_op_t));
+ if (FAL_ACL_FIELD_MASK == rule->src_l4port_op)
+ {
+ dprintf(" [sport]:0x%x", rule->src_l4port_val);
+ dprintf(" [sport_mask]:0x%x", rule->src_l4port_mask);
+ }
+ else
+ {
+ dprintf(" [sport_low]:0x%x", rule->src_l4port_val);
+ dprintf(" [sport_high]:0x%x", rule->src_l4port_mask);
+ }
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_TCP_FLAG))
+ {
+ dprintf("\n[ip_tcp_flags]:0x%x", rule->tcp_flag_val);
+ dprintf(" [ip_tcp_flags_mask]:0x%x", rule->tcp_flag_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_ICMP_TYPE))
+ {
+ dprintf("\n[ip_icmp_type]:0x%x", rule->icmp_type_val);
+ dprintf(" [ip_icmp_type_mask]:0x%x", rule->icmp_type_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_ICMP_CODE))
+ {
+ dprintf("\n[ip_icmp_code]:0x%x", rule->icmp_code_val);
+ dprintf(" [ip_icmp_code_mask]:0x%x", rule->icmp_code_mask);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_UDF))
+ {
+ cmd_data_print_udf_type("\n[udf_type]:",
+ (a_uint32_t *) & (rule->udf_type),
+ sizeof (fal_acl_udf_type_t));
+
+ dprintf(" [offset]:%d", rule->udf_offset);
+
+ cmd_data_print_udf_element("\n[udf_value]:",
+ (a_uint32_t *) & (rule->udf_val[0]),
+ rule->udf_len);
+
+ cmd_data_print_udf_element("\n[udf_mask]:",
+ (a_uint32_t *) & (rule->udf_mask[0]),
+ rule->udf_len);
+ }
+
+ if (FAL_FIELD_FLG_TST(rule->field_flg, FAL_ACL_FIELD_INVERSE_ALL))
+ {
+ dprintf("\n[rule_inverse]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_PERMIT))
+ {
+ dprintf("\n[permit]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_DENY))
+ {
+ dprintf("\n[deny]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_RDTCPU))
+ {
+ dprintf("\n[rdt_to_cpu]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_CPYCPU))
+ {
+ dprintf("\n[cpy_to_cpu]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_MIRROR))
+ {
+ dprintf("\n[mirror]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REDPT))
+ {
+ dprintf("\n[rdt_to_port]:yes");
+ cmd_data_print_portmap(" [dest_port]:", rule->ports,
+ sizeof (fal_pbmp_t));
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_MODIFY_VLAN))
+ {
+ dprintf("\n[modify_vlan_id]:yes");
+ dprintf(" [vlan_id]:%d", rule->vid);
+ if (!FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REDPT))
+ {
+ cmd_data_print_portmap(" [port_member]:", rule->ports,
+ sizeof (fal_pbmp_t));
+ }
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_NEST_VLAN))
+ {
+ dprintf("\n[nest_vlan]:yes");
+ dprintf(" [vlan_id]:%d", rule->vid);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_DSCP))
+ {
+ dprintf("\n[remark_dscp]:yes");
+ dprintf(" [dscp]:%d", rule->dscp);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_UP))
+ {
+ dprintf("\n[remark_up]:yes");
+ dprintf(" [up]:%d", rule->up);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_QUEUE))
+ {
+ dprintf("\n[remark_queue]:yes");
+ dprintf(" [queue]:%d", rule->queue);
+ }
+
+ dprintf("\n[stag_vid]:%d", rule->stag_vid);
+ dprintf("\n[ctag_vid]:%d", rule->ctag_vid);
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_LOOKUP_VID))
+ {
+ dprintf("\n[change_lookup_vid]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_STAG_VID))
+ {
+ dprintf("\n[change_stag_vid]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_CTAG_VID))
+ {
+ dprintf("\n[change_ctag_vid]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_STAG_PRI))
+ {
+ dprintf("\n[change_stag_pri]:yes");
+ dprintf(" [stag_pri]:%d", rule->stag_pri);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_STAG_DEI))
+ {
+ dprintf("\n[change_stag_dei]:yes");
+ dprintf(" [stag_dei]:%d", rule->stag_dei);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_CTAG_PRI))
+ {
+ dprintf("\n[change_ctag_pri]:yes");
+ dprintf(" [ctag_pri]:%d", rule->ctag_pri);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_REMARK_CTAG_CFI))
+ {
+ dprintf("\n[change_ctag_cfi]:yes");
+ dprintf(" [ctag_cfi]:%d", rule->ctag_cfi);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_POLICER_EN))
+ {
+ dprintf("\n[police_en]:yes");
+ dprintf(" [policer_ptr]:%d", rule->policer_ptr);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_WCMP_EN))
+ {
+ dprintf("\n[wcmp_en]:yes");
+ dprintf(" [wcmp_ptr]:%d", rule->wcmp_ptr);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_ARP_EN))
+ {
+ dprintf("\n[arp_en]:yes");
+ dprintf(" [arp_ptr]:%d", rule->arp_ptr);
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_POLICY_FORWARD_EN))
+ {
+ if (FAL_ACL_POLICY_ROUTE == rule->policy_fwd)
+ {
+ dprintf("\n[policy_forward]:route");
+ }
+
+ if (FAL_ACL_POLICY_SNAT == rule->policy_fwd)
+ {
+ dprintf("\n[policy_forward]:snat");
+ }
+
+ if (FAL_ACL_POLICY_DNAT == rule->policy_fwd)
+ {
+ dprintf("\n[policy_forward]:dnat");
+ }
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_BYPASS_EGRESS_TRANS))
+ {
+ dprintf("\n[eg_bypass]:yes");
+ }
+
+ if (FAL_ACTION_FLG_TST(rule->action_flg, FAL_ACL_ACTION_MATCH_TRIGGER_INTR))
+ {
+ dprintf("\n[trigger_intr]:yes");
+ }
+
+ dprintf("\n[match_counter]:%d", rule->match_cnt);
+
+ return;
+}
+
+sw_error_t
+cmd_data_check_patternmode(char *cmd_str, led_pattern_mode_t * arg_val,
+ a_uint32_t size)
+{
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (!strcasecmp(cmd_str, "always_off"))
+ {
+ *arg_val = LED_ALWAYS_OFF;
+ }
+ else if (!strcasecmp(cmd_str, "always_blink"))
+ {
+ *arg_val = LED_ALWAYS_BLINK;
+ }
+ else if (!strcasecmp(cmd_str, "always_on"))
+ {
+ *arg_val = LED_ALWAYS_ON;
+ }
+ else if (!strcasecmp(cmd_str, "map"))
+ {
+ *arg_val = LED_PATTERN_MAP_EN;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_blinkfreq(char *cmd_str, led_blink_freq_t * arg_val,
+ a_uint32_t size)
+{
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (!strcasecmp(cmd_str, "2HZ"))
+ {
+ *arg_val = LED_BLINK_2HZ;
+ }
+ else if (!strcasecmp(cmd_str, "4HZ"))
+ {
+ *arg_val = LED_BLINK_4HZ;
+ }
+ else if (!strcasecmp(cmd_str, "8HZ"))
+ {
+ *arg_val = LED_BLINK_8HZ;
+ }
+ else if (!strcasecmp(cmd_str, "TXRX"))
+ {
+ *arg_val = LED_BLINK_TXRX;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_ledpattern(char *info, void * val, a_uint32_t size)
+{
+ char *cmd;
+ led_ctrl_pattern_t pattern;
+ a_uint32_t tmpdata;
+
+ memset(&pattern, 0, sizeof (led_ctrl_pattern_t));
+
+ dprintf("\n");
+
+ /* get pattern mode configuration */
+ cmd_data_check_element("pattern_mode", NULL, "usage: <always_off/always_blink/always_on/map>\n",
+ cmd_data_check_patternmode, (cmd, &pattern.mode,
+ sizeof(led_pattern_mode_t)));
+
+ if (LED_PATTERN_MAP_EN == pattern.mode)
+ {
+ cmd_data_check_element("full_duplex_light", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << FULL_DUPLEX_LIGHT_EN);
+ }
+
+ cmd_data_check_element("half_duplex_light", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << HALF_DUPLEX_LIGHT_EN);
+ }
+
+ cmd_data_check_element("power_on_light", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << POWER_ON_LIGHT_EN);
+ }
+
+ cmd_data_check_element("link_1000m_light", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << LINK_1000M_LIGHT_EN);
+ }
+
+ cmd_data_check_element("link_100m_light", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << LINK_100M_LIGHT_EN);
+ }
+
+ cmd_data_check_element("link_10m_light", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << LINK_10M_LIGHT_EN);
+ }
+
+ cmd_data_check_element("conllision_light", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << COLLISION_BLINK_EN);
+ }
+
+ cmd_data_check_element("rx_traffic_blink", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << RX_TRAFFIC_BLINK_EN);
+ }
+
+ cmd_data_check_element("tx_traffic_blink", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << TX_TRAFFIC_BLINK_EN);
+ }
+
+ cmd_data_check_element("linkup_override_light", "no", "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &tmpdata,
+ sizeof (a_bool_t)));
+ if (1 == tmpdata)
+ {
+ pattern.map |= (1 << LINKUP_OVERRIDE_EN);
+ }
+
+ cmd_data_check_element("blink freq", NULL, "usage: <2HZ/4HZ/8HZ/TXRX> \n",
+ cmd_data_check_blinkfreq, (cmd, &pattern.freq,
+ sizeof(led_blink_freq_t)));
+ }
+
+ *(led_ctrl_pattern_t *)val = pattern;
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_ledpattern(a_uint8_t * param_name, a_uint32_t * buf,
+ a_uint32_t size)
+{
+ led_ctrl_pattern_t *pattern;
+
+ pattern = (led_ctrl_pattern_t *) buf;
+
+ if (LED_ALWAYS_OFF == pattern->mode)
+ {
+ dprintf("[pattern_mode]:always_off");
+ }
+ else if (LED_ALWAYS_BLINK == pattern->mode)
+ {
+ dprintf("[pattern_mode]:always_blink");
+ }
+ else if (LED_ALWAYS_ON == pattern->mode)
+ {
+ dprintf("[pattern_mode]:always_on");
+ }
+ else
+ {
+ dprintf("[pattern_mode]:map");
+ }
+ dprintf("\n");
+
+ if (LED_PATTERN_MAP_EN == pattern->mode)
+ {
+ if (pattern->map & (1 << FULL_DUPLEX_LIGHT_EN))
+ {
+ cmd_data_print_confirm("[full_duplex_light]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (pattern->map & (1 << HALF_DUPLEX_LIGHT_EN))
+ {
+ cmd_data_print_confirm("[half_duplex_light]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (pattern->map & (1 << POWER_ON_LIGHT_EN))
+ {
+ cmd_data_print_confirm("[power_on_light]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (pattern->map & (1 << LINK_1000M_LIGHT_EN))
+ {
+ cmd_data_print_confirm("[link_1000m_light]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (pattern->map & (1 << LINK_100M_LIGHT_EN))
+ {
+ cmd_data_print_confirm("[link_100m_light]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (pattern->map & (1 << LINK_10M_LIGHT_EN))
+ {
+ cmd_data_print_confirm("[link_10m_light]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (pattern->map & (1 << COLLISION_BLINK_EN))
+ {
+ cmd_data_print_confirm("[conllision_blink]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (pattern->map & (1 << RX_TRAFFIC_BLINK_EN))
+ {
+ cmd_data_print_confirm("[rx_traffic_blink]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (pattern->map & (1 << TX_TRAFFIC_BLINK_EN))
+ {
+ cmd_data_print_confirm("[tx_traffic_blink]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (pattern->map & (1 << LINKUP_OVERRIDE_EN))
+ {
+ cmd_data_print_confirm("[linkup_override]:", A_TRUE, sizeof (a_bool_t));
+ dprintf("\n");
+ }
+
+ if (LED_BLINK_2HZ == pattern->freq)
+ {
+ dprintf("[blink_frequency]:2HZ\n");
+ }
+ else if (LED_BLINK_4HZ == pattern->freq)
+ {
+ dprintf("[blink_frequency]:4HZ\n");
+ }
+ else if (LED_BLINK_8HZ == pattern->freq)
+ {
+ dprintf("[blink_frequency]:8HZ\n");
+ }
+ else
+ {
+ dprintf("[blink_frequency]:TXRX\n");
+ }
+ }
+}
+
+/*Shiva*/
+sw_error_t
+cmd_data_check_invlan_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "admit_all"))
+ {
+ *arg_val = FAL_INVLAN_ADMIT_ALL;
+ }
+ else if (!strcasecmp(cmd_str, "admit_tagged"))
+ {
+ *arg_val = FAL_INVLAN_ADMIT_TAGGED;
+ }
+ else if (!strcasecmp(cmd_str, "admit_untagged"))
+ {
+ *arg_val = FAL_INVLAN_ADMIT_UNTAGGED;
+ }
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_invlan_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+
+ if (*(a_uint32_t *) buf == FAL_INVLAN_ADMIT_ALL)
+ {
+ dprintf("ADMIT_ALL");
+ }
+ else if (*(a_uint32_t *) buf == FAL_INVLAN_ADMIT_TAGGED)
+ {
+ dprintf("ADMIT_TAGGED");
+ }
+ else if (*(a_uint32_t *) buf == FAL_INVLAN_ADMIT_UNTAGGED)
+ {
+ dprintf("ADMIT_UNTAGGED");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_vlan_propagation(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "disable"))
+ {
+ *arg_val = FAL_VLAN_PROPAGATION_DISABLE;
+ }
+ else if (!strcasecmp(cmd_str, "clone"))
+ {
+ *arg_val = FAL_VLAN_PROPAGATION_CLONE;
+ }
+ else if (!strcasecmp(cmd_str, "replace"))
+ {
+ *arg_val = FAL_VLAN_PROPAGATION_REPLACE;
+ }
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_vlan_propagation(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+
+ if (*(a_uint32_t *) buf == FAL_VLAN_PROPAGATION_DISABLE)
+ {
+ dprintf("DISABLE");
+ }
+ else if (*(a_uint32_t *) buf == FAL_VLAN_PROPAGATION_CLONE)
+ {
+ dprintf("CLONE");
+ }
+ else if (*(a_uint32_t *) buf == FAL_VLAN_PROPAGATION_REPLACE)
+ {
+ dprintf("REPLACE");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_vlan_translation(char *info, fal_vlan_trans_entry_t *val, a_uint32_t size)
+{
+ char *cmd = NULL;
+ sw_error_t rv;
+ fal_vlan_trans_entry_t entry;
+
+ memset(&entry, 0, sizeof (fal_vlan_trans_entry_t));
+
+ do
+ {
+ cmd = get_sub_cmd("ovid", "1");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 4095\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.o_vid, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: the range is 0 -- 4095\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("bi direction", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &entry.bi_dir,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("forward direction", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &entry.forward_dir,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("reverse direction", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &entry.reverse_dir,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("svid", "1");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 4095\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.s_vid, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: the range is 0 -- 4095\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("cvid", "1");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 4095\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.c_vid, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: the range is 0 -- 4095\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("ovid_is_cvid", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &entry.o_vid_is_cvid,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("svid_enable", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &entry.s_vid_enable,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("cvid_enable", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &entry.c_vid_enable,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("one_2_one_vlan", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.one_2_one_vlan,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_vlan_translation(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_vlan_trans_entry_t *entry;
+
+ entry = (fal_vlan_trans_entry_t *) buf;
+ dprintf("[Ovid]:0x%x [Svid]:0x%x [Cvid]:0x%x [BiDirect]:%s [ForwardDirect]:%s [ReverseDirect]:%s ",
+ entry->o_vid, entry->s_vid, entry->c_vid,
+ entry->bi_dir?"ENABLE":"DISABLE",
+ entry->forward_dir?"ENABLE":"DISABLE",
+ entry->reverse_dir?"ENABLE":"DISABLE");
+
+ dprintf("[OvidIsCvid]:%s [SvidEnable]:%s [CvidEnable]:%s [One2OneVlan]:%s",
+ entry->o_vid_is_cvid?"YES":"NO",
+ entry->s_vid_enable?"YES":"NO",
+ entry->c_vid_enable?"YES":"NO",
+ entry->one_2_one_vlan?"YES":"NO");
+
+}
+
+sw_error_t
+cmd_data_check_qinq_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "ctag"))
+ {
+ *arg_val = FAL_QINQ_CTAG_MODE;
+ }
+ else if (!strcasecmp(cmd_str, "stag"))
+ {
+ *arg_val = FAL_QINQ_STAG_MODE;
+ }
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_qinq_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+
+ if (*(a_uint32_t *) buf == FAL_QINQ_CTAG_MODE)
+ {
+ dprintf("CTAG");
+ }
+ else if (*(a_uint32_t *) buf == FAL_QINQ_STAG_MODE)
+ {
+ dprintf("STAG");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_qinq_role(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "edge"))
+ {
+ *arg_val = FAL_QINQ_EDGE_PORT;
+ }
+ else if (!strcasecmp(cmd_str, "core"))
+ {
+ *arg_val = FAL_QINQ_CORE_PORT;
+ }
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_qinq_role(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+
+ if (*(a_uint32_t *) buf == FAL_QINQ_EDGE_PORT)
+ {
+ dprintf("EDGE");
+ }
+ else if (*(a_uint32_t *) buf == FAL_QINQ_CORE_PORT)
+ {
+ dprintf("CORE");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+void
+cmd_data_print_cable_status(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+
+ if (*(a_uint32_t *) buf == FAL_CABLE_STATUS_NORMAL)
+ {
+ dprintf("NORMAL");
+ }
+ else if (*(a_uint32_t *) buf == FAL_CABLE_STATUS_SHORT)
+ {
+ dprintf("SHORT");
+ }
+ else if (*(a_uint32_t *) buf == FAL_CABLE_STATUS_OPENED)
+ {
+ dprintf("OPENED");
+ }
+ else if (*(a_uint32_t *) buf == FAL_CABLE_STATUS_INVALID)
+ {
+ dprintf("INVALID");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+void
+cmd_data_print_cable_len(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:%d", param_name, *(a_uint32_t *) buf);
+}
+
+inline char*
+cmd_cpu_mode(hsl_init_mode mode)
+{
+ switch (mode)
+ {
+ case HSL_NO_CPU:
+ return "no_cpu";
+ case HSL_CPU_1:
+ return "cpu_1";
+ case HSL_CPU_2:
+ return "cpu_2";
+ case HSL_CPU_1_PLUS:
+ return "cpu_1_plus";
+ }
+
+ return "unknow";
+}
+
+inline char*
+cmd_access_mode(hsl_access_mode mode)
+{
+ switch (mode)
+ {
+ case HSL_MDIO:
+ return "mdio";
+ case HSL_HEADER:
+ return "header";
+ }
+
+ return "unknow";
+}
+
+static void
+_cmd_collect_shell_cfg(ssdk_cfg_t *shell_cfg)
+{
+ memset(shell_cfg, 0, sizeof(ssdk_cfg_t));
+ shell_cfg->init_cfg = init_cfg;
+
+#ifdef VERSION
+ aos_mem_copy(shell_cfg->build_ver, VERSION, sizeof(VERSION));
+#endif
+
+#ifdef BUILD_DATE
+ aos_mem_copy(shell_cfg->build_date, BUILD_DATE, sizeof(BUILD_DATE));
+#endif
+
+#if defined ATHENA
+ aos_mem_copy(shell_cfg->chip_type, "athena", sizeof("athena"));
+#elif defined GARUDA
+ aos_mem_copy(shell_cfg->chip_type, "garuda", sizeof("garuda"));
+#elif defined SHIVA
+ aos_mem_copy(shell_cfg->chip_type, "shiva", sizeof("shiva"));
+#elif defined HORUS
+ aos_mem_copy(shell_cfg->chip_type, "horus", sizeof("horus"));
+#elif defined ISIS
+ aos_mem_copy(shell_cfg->chip_type, "isis", sizeof("isis"));
+#elif defined ISISC
+ aos_mem_copy(shell_cfg->chip_type, "isisc", sizeof("isisc"));
+#endif
+
+#ifdef CPU
+ aos_mem_copy(shell_cfg->cpu_type, CPU, sizeof(CPU));
+#endif
+
+#ifdef OS
+ aos_mem_copy(shell_cfg->os_info, OS, sizeof(OS));
+#if defined KVER26
+ aos_mem_copy(shell_cfg->os_info+sizeof(OS)-1, " version 2.6", sizeof(" version 2.6"));
+#elif defined KVER24
+ aos_mem_copy(shell_cfg->os_info+sizeof(OS)-1, " version 2.4", sizeof(" version 2.4"));
+#else
+ aos_mem_copy(shell_cfg->os_info+sizeof(OS)-1, " version unknown", sizeof(" version unknown"));
+#endif
+#endif
+
+#ifdef HSL_STANDALONG
+ shell_cfg->fal_mod = A_FALSE;
+#else
+ shell_cfg->fal_mod = A_TRUE;
+#endif
+
+#ifdef USER_MODE
+ shell_cfg->kernel_mode = A_FALSE;
+#else
+ shell_cfg->kernel_mode = A_TRUE;
+#endif
+
+#ifdef UK_IF
+ shell_cfg->uk_if = A_TRUE;
+#else
+ shell_cfg->uk_if = A_FALSE;
+#endif
+
+ return;
+}
+
+#define BOOL2STR(val_bool) (((val_bool)==A_TRUE)?"true":"false" )
+#define BOOL2NAME(val_bool) (((feature->in_##val_bool)==A_TRUE)?(#val_bool):"" )
+#define DEFINED2STR(name) (((init->reg_func.name))?"y":"n" )
+
+static void
+_cmd_data_print_cfg(ssdk_cfg_t *entry)
+{
+ ssdk_init_cfg *init = &(entry->init_cfg);
+
+ dprintf("[build verison]:%-10s [build date]:%s\n", entry->build_ver, entry->build_date);
+ dprintf("[chip type]:%-14s [arch]:%-12s [os]:%s\n", entry->chip_type, entry->cpu_type, entry->os_info);
+ dprintf("[fal]:%-20s [kernel mode]:%-5s [uk if]:%s\n",
+ BOOL2STR(entry->fal_mod), BOOL2STR(entry->kernel_mode), BOOL2STR(entry->uk_if));
+
+ dprintf("[cpu mode]:%-15s [reg access]:%-6s [ioctl minor]:%d\n",
+ cmd_cpu_mode(init->cpu_mode), cmd_access_mode(init->reg_mode),
+ init->nl_prot);
+
+ dprintf("[inf defined]:mdio_set(%s) mdio_get(%s) header_reg_set(%s) header_reg_get(%s)\n",
+ DEFINED2STR(mdio_set), DEFINED2STR(mdio_get), DEFINED2STR(header_reg_set), DEFINED2STR(header_reg_get));
+
+}
+
+void
+cmd_data_print_ssdk_cfg(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ ssdk_cfg_t *ssdk_cfg = (ssdk_cfg_t *) buf;
+ dprintf("1.SSDK CONFIGURATION:\n");
+ _cmd_data_print_cfg(ssdk_cfg);
+
+ dprintf("\n2.DEMO SHELL CONFIGURATION:\n");
+ ssdk_cfg_t shell_cfg;
+ _cmd_collect_shell_cfg(&shell_cfg);
+ _cmd_data_print_cfg(&shell_cfg);
+
+ dprintf("\n3.SSDK FEATURES LIST:\n");
+ ssdk_features *feature = &(ssdk_cfg->features);
+ dprintf("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
+ BOOL2NAME(acl), BOOL2NAME(fdb), BOOL2NAME(igmp), BOOL2NAME(leaky),
+ BOOL2NAME(led), BOOL2NAME(mib), BOOL2NAME(mirror), BOOL2NAME(misc),
+ BOOL2NAME(portcontrol), BOOL2NAME(portvlan), BOOL2NAME(qos), BOOL2NAME(rate),
+ BOOL2NAME(stp), BOOL2NAME(vlan), BOOL2NAME(reduced_acl),
+ BOOL2NAME(cosmap), BOOL2NAME(ip), BOOL2NAME(nat), BOOL2NAME(sec), BOOL2NAME(trunk), BOOL2NAME(interfacectrl));
+
+}
+
+sw_error_t
+cmd_data_check_hdrmode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "noheader"))
+ {
+ *arg_val = FAL_NO_HEADER_EN;
+ }
+ else if (!strcasecmp(cmd_str, "onlymanagement"))
+ {
+ *arg_val = FAL_ONLY_MANAGE_FRAME_EN;
+ }
+ else if (!strcasecmp(cmd_str, "allframe"))
+ {
+ *arg_val = FAL_ALL_TYPE_FRAME_EN;
+ }
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_hdrmode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_NO_HEADER_EN)
+ {
+ dprintf("NOHEADER");
+ }
+ else if (*(a_uint32_t *) buf == FAL_ONLY_MANAGE_FRAME_EN)
+ {
+ dprintf("ONLYMANAGEMENT");
+ }
+ else if (*(a_uint32_t *) buf == FAL_ALL_TYPE_FRAME_EN)
+ {
+ dprintf("ALLFRAME");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_fdboperation(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ fal_fdb_op_t entry;
+
+ memset(&entry, 0, sizeof (fal_fdb_op_t));
+
+ do
+ {
+ cmd = get_sub_cmd("port_en", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.port_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("fid_en", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.fid_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("multi_en", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.multicast_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *(fal_fdb_op_t *) val = entry;
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_pppoe(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ fal_pppoe_session_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_pppoe_session_t));
+
+ do
+ {
+ cmd = get_sub_cmd("entryid", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.entry_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("sessionid", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 65535\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &entry.session_id, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: the range is 0 -- 65535\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("multi_session", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.multi_session,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("uni_session", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.uni_session,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *(fal_pppoe_session_t*)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_pppoe(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_pppoe_session_t *entry;
+
+ entry = (fal_pppoe_session_t *) buf;
+ dprintf("[EntryID]:0x%x [SessionID]:0x%x [MultiSession]:%s [UniSession]:%s",
+ entry->entry_id,
+ entry->session_id,
+ entry->multi_session ? "YES":"NO",
+ entry->uni_session ? "YES":"NO");
+}
+
+sw_error_t
+cmd_data_check_host_entry(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ fal_host_entry_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_host_entry_t));
+
+ do
+ {
+ cmd = get_sub_cmd("entryid", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.entry_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("entryflags", "0x1");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: bitmap for host entry\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.flags), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: bitmap for host entry\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("entrystatus", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.status), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if (FAL_IP_IP4_ADDR & (entry.flags))
+ {
+ cmd_data_check_element("ip4 addr", NULL,
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd, &(entry.ip4_addr), 4));
+ }
+ else
+ {
+ cmd_data_check_element("ip6 addr", NULL,
+ "usage: the format is xxxx::xxxx \n",
+ cmd_data_check_ip6addr, (cmd, &(entry.ip6_addr), 16));
+ }
+
+ cmd_data_check_element("mac addr", NULL,
+ "usage: the format is xx-xx-xx-xx-xx-xx \n",
+ cmd_data_check_macaddr, (cmd,
+ &(entry.mac_addr),
+ sizeof (fal_mac_addr_t)));
+
+ do
+ {
+ cmd = get_sub_cmd("interface id", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.intf_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("port id", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.port_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("action", "forward");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_maccmd(cmd, &(entry.action),
+ sizeof (fal_fwd_cmd_t));
+ if (SW_OK != rv)
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("mirror", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.mirror_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("counter", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.counter_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if (A_TRUE == entry.counter_en)
+ {
+ do
+ {
+ cmd = get_sub_cmd("counter id", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.counter_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ }
+
+ *(fal_host_entry_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_host_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_host_entry_t *entry;
+
+ entry = (fal_host_entry_t *) buf;
+ dprintf("\n[entryid]:0x%x [entryflags]:0x%x [entrystatus]:0x%x",
+ entry->entry_id, entry->flags, entry->status);
+
+ if (FAL_IP_IP4_ADDR & entry->flags)
+ {
+ cmd_data_print_ip4addr("\n[ip_addr]:",
+ (a_uint32_t *) & (entry->ip4_addr),
+ sizeof (fal_ip4_addr_t));
+ }
+ else
+ {
+ cmd_data_print_ip6addr("\n[ip_addr]:",
+ (a_uint32_t *) & (entry->ip6_addr),
+ sizeof (fal_ip6_addr_t));
+ }
+
+ cmd_data_print_macaddr(" [mac_addr]:",
+ (a_uint32_t *) & (entry->mac_addr),
+ sizeof (fal_mac_addr_t));
+
+ dprintf("\n[interfaceid]:0x%x [portid]:0x%x ", entry->intf_id, entry->port_id);
+
+ cmd_data_print_maccmd("action", (a_uint32_t *) & (entry->action),
+ sizeof (fal_fwd_cmd_t));
+
+ if (A_TRUE == entry->mirror_en)
+ {
+ dprintf("\n[mirror]:Enable ");
+ }
+ else
+ {
+ dprintf("\n[mirror]:Disable ");
+ }
+
+ if (A_TRUE == entry->counter_en)
+ {
+ dprintf("\n[counter]:Enable [counter_id]:%d [pkt]%d [byte]%d",
+ entry->counter_id, entry->packet, entry->byte);
+ }
+ else
+ {
+ dprintf("\n[couter]:Disable ");
+ }
+
+ if (A_TRUE == entry->pppoe_en)
+ {
+ dprintf("\n[pppoe]:Enable [pppoe_id]:%d", entry->pppoe_id);
+ }
+ else
+ {
+ dprintf("\n[pppoe]:Disable ");
+ }
+}
+
+sw_error_t
+cmd_data_check_arp_learn_mode(char *cmd_str, fal_arp_learn_mode_t * arg_val,
+ a_uint32_t size)
+{
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (!strcasecmp(cmd_str, "learnlocal"))
+ {
+ *arg_val = FAL_ARP_LEARN_LOCAL;
+ }
+ else if (!strcasecmp(cmd_str, "learnall"))
+ {
+ *arg_val = FAL_ARP_LEARN_ALL;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_arp_learn_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_ARP_LEARN_LOCAL)
+ {
+ dprintf("LearnLocal");
+ }
+ else if (*(a_uint32_t *) buf == FAL_ARP_LEARN_ALL)
+ {
+ dprintf("LearnAll");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_ip_guard_mode(char *cmd_str, fal_source_guard_mode_t * arg_val, a_uint32_t size)
+{
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (!strcasecmp(cmd_str, "mac_ip"))
+ {
+ *arg_val = FAL_MAC_IP_GUARD;
+ }
+ else if (!strcasecmp(cmd_str, "mac_ip_port"))
+ {
+ *arg_val = FAL_MAC_IP_PORT_GUARD;
+ }
+ else if (!strcasecmp(cmd_str, "mac_ip_vlan"))
+ {
+ *arg_val = FAL_MAC_IP_VLAN_GUARD;
+ }
+ else if (!strcasecmp(cmd_str, "mac_ip_port_vlan"))
+ {
+ *arg_val = FAL_MAC_IP_PORT_VLAN_GUARD;
+ }
+ else if (!strcasecmp(cmd_str, "no_guard"))
+ {
+ *arg_val = FAL_NO_SOURCE_GUARD;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_ip_guard_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_MAC_IP_GUARD)
+ {
+ dprintf("MAC_IP_GUARD");
+ }
+ else if (*(a_uint32_t *) buf == FAL_MAC_IP_PORT_GUARD)
+ {
+ dprintf("MAC_IP_PORT_GUARD");
+ }
+ else if (*(a_uint32_t *) buf == FAL_MAC_IP_VLAN_GUARD)
+ {
+ dprintf("MAC_IP_VLAN_GUARD");
+ }
+ else if (*(a_uint32_t *) buf == FAL_MAC_IP_PORT_VLAN_GUARD)
+ {
+ dprintf("MAC_IP_PORT_VLAN_GUARD");
+ }
+ else if (*(a_uint32_t *) buf == FAL_NO_SOURCE_GUARD)
+ {
+ dprintf("NO_GUARD");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_nat_entry(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ a_uint32_t tmp;
+ fal_nat_entry_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_nat_entry_t));
+
+ do
+ {
+ cmd = get_sub_cmd("entryid", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.entry_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("entryflags", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: bitmap for host entry\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.flags), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: bitmap for host entry\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("entrystatus", "0xf");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.status), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("select_idx", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.slct_idx), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ cmd_data_check_element("src addr", "0.0.0.0",
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd, &(entry.src_addr), 4));
+
+ cmd_data_check_element("trans addr", "0.0.0.0",
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd, &(entry.trans_addr), 4));
+
+ do
+ {
+ cmd = get_sub_cmd("port num", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: 0- 65535\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: 0- 65535\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.port_num = tmp & 0xffff;
+
+ do
+ {
+ cmd = get_sub_cmd("port range", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: 0- 65535\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: 0- 65535\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.port_range = tmp & 0xffff;
+
+ do
+ {
+ cmd = get_sub_cmd("action", "forward");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_maccmd(cmd, &entry.action,
+ sizeof (fal_fwd_cmd_t));
+ if (SW_OK != rv)
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("mirror", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.mirror_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("counter", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.counter_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if (A_TRUE == entry.counter_en)
+ {
+ do
+ {
+ cmd = get_sub_cmd("counter id", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.counter_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ }
+
+ *(fal_nat_entry_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_nat_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_nat_entry_t *entry;
+
+ entry = (fal_nat_entry_t *) buf;
+ dprintf("\n[entryid]:0x%x [entryflags]:0x%x [entrystatus]:0x%x [select_idx]:0x%x",
+ entry->entry_id, entry->flags, entry->status, entry->slct_idx);
+
+ cmd_data_print_ip4addr("\n[src_addr]:",
+ (a_uint32_t *) & (entry->src_addr),
+ sizeof (fal_ip4_addr_t));
+
+ cmd_data_print_ip4addr("\n[trans_addr]:",
+ (a_uint32_t *) & (entry->trans_addr),
+ sizeof (fal_ip4_addr_t));
+
+ dprintf("\n[port_num]:0x%x [port_range]:0x%x ", entry->port_num, entry->port_range);
+
+ cmd_data_print_maccmd("action", (a_uint32_t *) & (entry->action),
+ sizeof (fal_fwd_cmd_t));
+
+ if (A_TRUE == entry->mirror_en)
+ {
+ dprintf("\n[mirror]:Enable ");
+ }
+ else
+ {
+ dprintf("\n[mirror]:Disable ");
+ }
+
+ if (A_TRUE == entry->counter_en)
+ {
+ dprintf("\n[counter]:Enable [counter_id]:%d [in_pkt]%d [in_byte]%d [eg_pkt]%d [eg_byte]%d ",
+ entry->counter_id, entry->ingress_packet, entry->ingress_byte,
+ entry->egress_packet, entry->egress_byte);
+ }
+ else
+ {
+ dprintf("\n[couter]:Disable ");
+ }
+}
+
+sw_error_t
+cmd_data_check_napt_entry(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ a_uint32_t tmp;
+ fal_napt_entry_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_napt_entry_t));
+
+ do
+ {
+ cmd = get_sub_cmd("entryid", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.entry_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("entryflags", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: bitmap for host entry\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.flags), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: bitmap for host entry\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("entrystatus", "0xf");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.status), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ cmd_data_check_element("src addr", "0.0.0.0",
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd, &(entry.src_addr), 4));
+
+ cmd_data_check_element("dst addr", "0.0.0.0",
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd, &(entry.dst_addr), 4));
+
+ if (FAL_NAT_ENTRY_TRANS_IPADDR_INDEX & (entry.flags))
+ {
+ do
+ {
+ cmd = get_sub_cmd("trans addr index", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.trans_addr), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ }
+ else
+ {
+ cmd_data_check_element("trans addr", "0.0.0.0",
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd, &(entry.trans_addr), 4));
+ }
+
+ do
+ {
+ cmd = get_sub_cmd("src port", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: 0- 65535\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: 0- 65535\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.src_port = tmp & 0xffff;
+
+ do
+ {
+ cmd = get_sub_cmd("dst port", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: 0- 65535\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: 0- 65535\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.dst_port = tmp & 0xffff;
+
+ do
+ {
+ cmd = get_sub_cmd("trans port", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: 0- 65535\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: 0- 65535\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.trans_port = tmp & 0xffff;
+
+ do
+ {
+ cmd = get_sub_cmd("action", "forward");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_maccmd(cmd, &(entry.action),
+ sizeof (fal_fwd_cmd_t));
+ if (SW_OK != rv)
+ dprintf("usage: <forward/drop/cpycpu/rdtcpu>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("mirror", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.mirror_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("counter", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &entry.counter_en,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if (A_TRUE == entry.counter_en)
+ {
+ do
+ {
+ cmd = get_sub_cmd("counter id", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.counter_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ }
+
+ *(fal_napt_entry_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_napt_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_napt_entry_t *entry;
+
+ entry = (fal_napt_entry_t *) buf;
+ dprintf("\n[entryid]:0x%x [entryflags]:0x%x [entrystatus]:0x%x",
+ entry->entry_id, entry->flags, entry->status);
+
+ cmd_data_print_ip4addr("\n[src_addr]:",
+ (a_uint32_t *) & (entry->src_addr),
+ sizeof (fal_ip4_addr_t));
+
+ cmd_data_print_ip4addr("\n[dst_addr]:",
+ (a_uint32_t *) & (entry->dst_addr),
+ sizeof (fal_ip4_addr_t));
+
+ if (FAL_NAT_ENTRY_TRANS_IPADDR_INDEX & entry->flags)
+ {
+ dprintf("\n[trans_addr_index]:0x%x", entry->trans_addr);
+ }
+ else
+ {
+ cmd_data_print_ip4addr("\n[trans_addr]:",
+ (a_uint32_t *) & (entry->trans_addr),
+ sizeof (fal_ip4_addr_t));
+ }
+
+ dprintf("\n[src_port]:0x%x [dst_port]:0x%x [trans_port]:0x%x ", entry->src_port, entry->dst_port, entry->trans_port);
+
+ cmd_data_print_maccmd("action", (a_uint32_t *) & (entry->action),
+ sizeof (fal_fwd_cmd_t));
+
+ if (A_TRUE == entry->mirror_en)
+ {
+ dprintf("\n[mirror]:Enable ");
+ }
+ else
+ {
+ dprintf("\n[mirror]:Disable ");
+ }
+
+ if (A_TRUE == entry->counter_en)
+ {
+ dprintf("\n[counter]:Enable [counter_id]:%d [in_pkt]%d [in_byte]%d [eg_pkt]%d [eg_byte]%d ",
+ entry->counter_id, entry->ingress_packet, entry->ingress_byte,
+ entry->egress_packet, entry->egress_byte);
+ }
+ else
+ {
+ dprintf("\n[couter]:Disable ");
+ }
+}
+
+sw_error_t
+cmd_data_check_napt_mode(char *cmd_str, fal_napt_mode_t * arg_val,
+ a_uint32_t size)
+{
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (!strcasecmp(cmd_str, "fullcone"))
+ {
+ *arg_val = FAL_NAPT_FULL_CONE;
+ }
+ else if (!strcasecmp(cmd_str, "strictcone"))
+ {
+ *arg_val = FAL_NAPT_STRICT_CONE;
+ }
+ else if (!strcasecmp(cmd_str, "portstrict"))
+ {
+ *arg_val = FAL_NAPT_PORT_STRICT;
+ }
+ else if (!strcasecmp(cmd_str, "synmatric"))
+ {
+ *arg_val = FAL_NAPT_SYNMETRIC;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_napt_mode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_NAPT_FULL_CONE)
+ {
+ dprintf("FullCone");
+ }
+ else if (*(a_uint32_t *) buf == FAL_NAPT_STRICT_CONE)
+ {
+ dprintf("StrictCone");
+ }
+ else if (*(a_uint32_t *) buf == FAL_NAPT_PORT_STRICT)
+ {
+ dprintf("PortStrict");
+ }
+ else if (*(a_uint32_t *) buf == FAL_NAPT_SYNMETRIC)
+ {
+ dprintf("Synmatric");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_intf_mac_entry(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ a_uint32_t tmp;
+ sw_error_t rv;
+ fal_intf_mac_entry_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_intf_mac_entry_t));
+
+ do
+ {
+ cmd = get_sub_cmd("entryid", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.entry_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("vid low", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: low vlan id\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: low vlan id\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.vid_low = tmp & 0xffff;
+
+ do
+ {
+ cmd = get_sub_cmd("vid high", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: high vlan id\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: high vlan id\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ entry.vid_high = tmp & 0xffff;
+
+ cmd_data_check_element("mac addr", NULL,
+ "usage: the format is xx-xx-xx-xx-xx-xx \n",
+ cmd_data_check_macaddr, (cmd, &(entry.mac_addr),
+ sizeof (fal_mac_addr_t)));
+
+ do
+ {
+ cmd = get_sub_cmd("ip4_route", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &entry.ip4_route,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("ip6_route", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &entry.ip6_route,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *(fal_intf_mac_entry_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_intf_mac_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_intf_mac_entry_t *entry;
+
+ entry = (fal_intf_mac_entry_t *) buf;
+ dprintf("\n[entryid]:0x%x [vid_low]:0x%x [vid_high]:0x%x",
+ entry->entry_id, entry->vid_low, entry->vid_high);
+
+ cmd_data_print_macaddr("\n[mac_addr]:",
+ (a_uint32_t *) & (entry->mac_addr),
+ sizeof (fal_mac_addr_t));
+
+ if (A_TRUE == entry->ip4_route)
+ {
+ dprintf("\n[ip4_route]:TRUE");
+ }
+ else
+ {
+ dprintf("\n[ip4_route]:FALSE");
+ }
+
+ if (A_TRUE == entry->ip6_route)
+ {
+ dprintf(" [ip6_route]:TRUE");
+ }
+ else
+ {
+ dprintf(" [ip6_route]:FALSE");
+ }
+}
+
+sw_error_t
+cmd_data_check_pub_addr_entry(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ fal_nat_pub_addr_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_nat_pub_addr_t));
+
+ do
+ {
+ cmd = get_sub_cmd("entryid", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.entry_id), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ cmd_data_check_element("pub addr", NULL,
+ "usage: the format is xx.xx.xx.xx \n",
+ cmd_data_check_ip4addr, (cmd, &(entry.pub_addr), 4));
+
+ *(fal_nat_pub_addr_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_pub_addr_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_nat_pub_addr_t *entry;
+
+ entry = (fal_nat_pub_addr_t *) buf;
+ dprintf("[entryid]:0x%x ", entry->entry_id);
+ cmd_data_print_ip4addr("[pub_addr]:",
+ (a_uint32_t *) & (entry->pub_addr),
+ sizeof (fal_ip4_addr_t));
+
+}
+
+sw_error_t
+cmd_data_check_egress_shaper(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ a_bool_t bool;
+ fal_egress_shaper_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_egress_shaper_t));
+
+ do
+ {
+ cmd = get_sub_cmd("bytebased", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &bool,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if (A_TRUE == bool)
+ {
+ entry.meter_unit = FAL_BYTE_BASED;
+ }
+ else
+ {
+ entry.meter_unit = FAL_FRAME_BASED;
+ }
+
+ do
+ {
+ cmd = get_sub_cmd("cir", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.cir), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("cbs", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.cbs), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("eir", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.eir), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("ebs", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.ebs), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *(fal_egress_shaper_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_egress_shaper(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_egress_shaper_t *entry;
+
+ entry = (fal_egress_shaper_t *) buf;
+
+ if (FAL_BYTE_BASED == entry->meter_unit)
+ {
+ dprintf("\n[byte_based]:yes ");
+ }
+ else
+ {
+ dprintf("\n[byte_based]:no ");
+ }
+
+ dprintf("[cir]:0x%08x [cbs]:0x%08x [eir]:0x%08x [ebs]:0x%08x",
+ entry->cir, entry->cbs, entry->eir, entry->ebs);
+}
+
+sw_error_t
+cmd_data_check_policer_timesslot(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strncasecmp(cmd_str, "100us", 5))
+ *arg_val = FAL_RATE_MI_100US;
+ else if (!strncasecmp(cmd_str, "1ms", 3))
+ *arg_val = FAL_RATE_MI_1MS;
+ else if (!strncasecmp(cmd_str, "10ms", 4))
+ *arg_val = FAL_RATE_MI_10MS;
+ else if (!strncasecmp(cmd_str, "100ms", 5))
+ *arg_val = FAL_RATE_MI_100MS;
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_policer_timesslot(char * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == FAL_RATE_MI_100US)
+ {
+ dprintf("100us");
+ }
+ else if (*(a_uint32_t *) buf == FAL_RATE_MI_1MS)
+ {
+ dprintf("1ms");
+ }
+ else if (*(a_uint32_t *) buf == FAL_RATE_MI_10MS)
+ {
+ dprintf("10ms");
+ }
+ else if (*(a_uint32_t *) buf == FAL_RATE_MI_100MS)
+ {
+ dprintf("100ms");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+
+sw_error_t
+cmd_data_check_acl_policer(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ a_bool_t bool;
+ fal_acl_policer_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_acl_policer_t));
+
+ do
+ {
+ cmd = get_sub_cmd("counter_mode", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.counter_mode),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("bytebased", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &bool,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if (A_TRUE == bool)
+ {
+ entry.meter_unit = FAL_BYTE_BASED;
+ }
+ else
+ {
+ entry.meter_unit = FAL_FRAME_BASED;
+ }
+
+ if (A_TRUE == entry.counter_mode)
+ {
+ *(fal_acl_policer_t *)val = entry;
+ return SW_OK;
+ }
+
+ do
+ {
+ cmd = get_sub_cmd("couple_flag", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.couple_flag),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("color_aware", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.color_mode),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("deficit_flag", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.deficit_en),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("cir", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.cir), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("cbs", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.cbs), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("eir", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.eir), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("ebs", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.ebs), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("meter_interval", "1ms");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the format <100us/1ms/10ms/100ms>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_policer_timesslot(cmd, &(entry.meter_interval),
+ sizeof (fal_rate_mt_t));
+ if (SW_OK != rv)
+ dprintf("usage: the format <100us/1ms/10ms/100ms>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *(fal_acl_policer_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_acl_policer(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_acl_policer_t *entry;
+
+ entry = (fal_acl_policer_t *) buf;
+
+ if (A_TRUE == entry->counter_mode)
+ {
+ dprintf("[counter_mode]:yes ");
+ }
+ else
+ {
+ dprintf("[counter_mode]:no ");
+ }
+
+ if (FAL_BYTE_BASED == entry->meter_unit)
+ {
+ dprintf("[meter_unit]:byte_based ");
+ }
+ else
+ {
+ dprintf("[meter_unit]:frame_based ");
+ }
+
+ if (A_TRUE == entry->counter_mode)
+ {
+ dprintf("[counter_lo]:0x%x [counter_hi]", entry->counter_low, entry->counter_high);
+ }
+ else
+ {
+ if (A_TRUE == entry->color_mode)
+ {
+ dprintf("[color_aware]:yes ");
+ }
+ else
+ {
+ dprintf("[color_aware]:no ");
+ }
+
+ if (A_TRUE == entry->couple_flag)
+ {
+ dprintf("[couple_falg]:yes ");
+ }
+ else
+ {
+ dprintf("[couple_falg]:no ");
+ }
+
+ if (A_TRUE == entry->deficit_en)
+ {
+ dprintf("[deficit_falg]:yes ");
+ }
+ else
+ {
+ dprintf("[deficit_falg]:no ");
+ }
+
+ cmd_data_print_policer_timesslot("meter_interval",
+ (a_uint32_t *) & (entry->meter_interval),
+ sizeof (fal_rate_mt_t));
+
+ dprintf("\n[cir]:0x%08x [cbs]:0x%08x [eir]:0x%08x [ebs]:0x%08x",
+ entry->cir, entry->cbs, entry->eir, entry->ebs);
+ }
+
+ return;
+}
+
+sw_error_t
+cmd_data_check_port_policer(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ a_bool_t bool;
+ fal_port_policer_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_port_policer_t));
+
+ do
+ {
+ cmd = get_sub_cmd("combine_enable", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.combine_mode),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("bytebased", "yes");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_TRUE, &bool,
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ if (A_TRUE == bool)
+ {
+ entry.meter_unit = FAL_BYTE_BASED;
+ }
+ else
+ {
+ entry.meter_unit = FAL_FRAME_BASED;
+ }
+
+ do
+ {
+ cmd = get_sub_cmd("couple_flag", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.couple_flag),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("color_aware", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.color_mode),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("deficit_flag", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.deficit_en),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("c_enable", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.c_enable),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("cir", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.cir), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("cbs", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.cbs), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("c_rate_flag", "0xfe");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.c_rate_flag), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("c_meter_interval", "1ms");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the format <100us/1ms/10ms/100ms>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_policer_timesslot(cmd, &(entry.c_meter_interval),
+ sizeof (fal_rate_mt_t));
+ if (SW_OK != rv)
+ dprintf("usage: the format <100us/1ms/10ms/100ms>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("e_enable", "no");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <yes/no/y/n>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_confirm(cmd, A_FALSE, &(entry.e_enable),
+ sizeof (a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <yes/no/y/n>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("eir", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.eir), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("ebs", "0");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.ebs), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("e_rate_flag", "0xfe");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: integer\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint32(cmd, &(entry.e_rate_flag), sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ dprintf("usage: integer\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ do
+ {
+ cmd = get_sub_cmd("e_meter_interval", "1ms");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the format <100us/1ms/10ms/100ms>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_policer_timesslot(cmd, &(entry.e_meter_interval),
+ sizeof (fal_rate_mt_t));
+ if (SW_OK != rv)
+ dprintf("usage: the format <100us/1ms/10ms/100ms>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ *(fal_port_policer_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_port_policer(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_port_policer_t *entry;
+
+ entry = (fal_port_policer_t *) buf;
+
+ if (A_TRUE == entry->combine_mode)
+ {
+ dprintf("[combine_mode]:yes ");
+ }
+ else
+ {
+ dprintf("[combine_mode]:no ");
+ }
+
+ if (FAL_BYTE_BASED == entry->meter_unit)
+ {
+ dprintf("[meter_unit]:byte_based ");
+ }
+ else
+ {
+ dprintf("[meter_unit]:frame_based ");
+ }
+
+ if (A_TRUE == entry->color_mode)
+ {
+ dprintf("[color_aware]:yes ");
+ }
+ else
+ {
+ dprintf("[color_aware]:no ");
+ }
+
+ if (A_TRUE == entry->couple_flag)
+ {
+ dprintf("[couple_falg]:yes ");
+ }
+ else
+ {
+ dprintf("[couple_falg]:no ");
+ }
+
+ if (A_TRUE == entry->deficit_en)
+ {
+ dprintf("[deficit_falg]:yes ");
+ }
+ else
+ {
+ dprintf("[deficit_falg]:no ");
+ }
+
+ if (A_TRUE == entry->c_enable)
+ {
+ dprintf("\n[c_enable]:yes ");
+ }
+ else
+ {
+ dprintf("\n[c_enable]:no ");
+ }
+
+ dprintf("[cir]:0x%08x [cbs]:0x%08x ", entry->cir,entry->cbs);
+
+
+
+ dprintf("[c_rate_flag]:0x%08x ", entry->c_rate_flag);
+
+ cmd_data_print_policer_timesslot("c_meter_interval",
+ (a_uint32_t *) & (entry->c_meter_interval),
+ sizeof (fal_rate_mt_t));
+
+ if (A_TRUE == entry->e_enable)
+ {
+ dprintf("\n[e_enable]:yes ");
+ }
+ else
+ {
+ dprintf("\n[e_enable]:no ");
+ }
+
+ dprintf("[eir]:0x%08x [ebs]:0x%08x ", entry->eir, entry->ebs);
+
+ dprintf("[e_rate_flag]:0x%08x ", entry->e_rate_flag);
+
+ cmd_data_print_policer_timesslot("e_meter_interval",
+ (a_uint32_t *) & (entry->e_meter_interval),
+ sizeof (fal_rate_mt_t));
+ return;
+}
+
+sw_error_t
+cmd_data_check_mac_mode(char *cmd_str, fal_interface_mac_mode_t * arg_val,
+ a_uint32_t size)
+{
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (0 == cmd_str[0])
+ {
+ *arg_val = FAL_MAC_MODE_RGMII;
+ }
+ else if (!strcasecmp(cmd_str, "rgmii"))
+ {
+ *arg_val = FAL_MAC_MODE_RGMII;
+ }
+ else if (!strcasecmp(cmd_str, "rmii"))
+ {
+ *arg_val = FAL_MAC_MODE_RMII;
+ }
+ else if (!strcasecmp(cmd_str, "gmii"))
+ {
+ *arg_val = FAL_MAC_MODE_GMII;
+ }
+ else if (!strcasecmp(cmd_str, "mii"))
+ {
+ *arg_val = FAL_MAC_MODE_MII;
+ }
+ else if (!strcasecmp(cmd_str, "sgmii"))
+ {
+ *arg_val = FAL_MAC_MODE_SGMII;
+ }
+ else if (!strcasecmp(cmd_str, "fiber"))
+ {
+ *arg_val = FAL_MAC_MODE_FIBER;
+ }
+ else if (!strcasecmp(cmd_str, "default"))
+ {
+ *arg_val = FAL_MAC_MODE_DEFAULT;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_clock_mode(char *cmd_str, fal_interface_clock_mode_t * arg_val,
+ a_uint32_t size)
+{
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (0 == cmd_str[0])
+ {
+ *arg_val = FAL_INTERFACE_CLOCK_MAC_MODE;
+ }
+ if (!strcasecmp(cmd_str, "mac"))
+ {
+ *arg_val = FAL_INTERFACE_CLOCK_MAC_MODE;
+ }
+ else if (!strcasecmp(cmd_str, "phy"))
+ {
+ *arg_val = FAL_INTERFACE_CLOCK_PHY_MODE;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+
+sw_error_t
+cmd_data_check_mac_config(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ fal_mac_config_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_mac_config_t));
+
+ cmd_data_check_element("mac_mode", "rgmii",
+ "usage: port0 <rgmii/rmii/gmii/mii/sgmii/fiber/default>\nport6 <rgmii/mii/sgmii/fiber/default>\n",
+ cmd_data_check_mac_mode, (cmd, &(entry.mac_mode), 4));
+
+ if (FAL_MAC_MODE_RGMII == entry.mac_mode)
+ {
+ cmd_data_check_element("txclk_delay_cmd", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.rgmii.txclk_delay_cmd), 4));
+
+ cmd_data_check_element("txclk_delay_select", "0",
+ "usage: <0-3>\n",
+ cmd_data_check_uint32, (cmd, &(entry.config.rgmii.txclk_delay_sel), 4));
+
+ cmd_data_check_element("rxclk_delay_cmd", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.rgmii.rxclk_delay_cmd), 4));
+
+ cmd_data_check_element("rxclk_delay_select", "0",
+ "usage: <0-3>\n",
+ cmd_data_check_uint32, (cmd, &(entry.config.rgmii.rxclk_delay_sel), 4));
+ }
+
+ if (FAL_MAC_MODE_RMII == entry.mac_mode)
+ {
+ cmd_data_check_element("master_mode", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.rmii.master_mode), 4));
+
+ cmd_data_check_element("slave_mode", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.rmii.slave_mode), 4));
+
+ cmd_data_check_element("clock_inverse", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.rmii.clock_inverse), 4));
+ cmd_data_check_element("pipe_rxclk_sel", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.rmii.pipe_rxclk_sel), 4));
+
+ }
+
+ if ((FAL_MAC_MODE_GMII == entry.mac_mode)
+ || (FAL_MAC_MODE_MII == entry.mac_mode))
+ {
+ cmd_data_check_element("clock_mode", "mac",
+ "usage: <phy/mac>\n",
+ cmd_data_check_clock_mode, (cmd, &(entry.config.gmii.clock_mode), 4));
+
+ cmd_data_check_element("txclk_select", "0",
+ "usage: <0-1>\n",
+ cmd_data_check_uint32, (cmd, &(entry.config.gmii.txclk_select), 4));
+
+ cmd_data_check_element("rxclk_select", "0",
+ "usage: <0-1>\n",
+ cmd_data_check_uint32, (cmd, &(entry.config.gmii.rxclk_select), 4));
+ }
+
+ if (FAL_MAC_MODE_SGMII == entry.mac_mode)
+ {
+ cmd_data_check_element("clock_mode", "mac",
+ "usage: <phy/mac>\n",
+ cmd_data_check_clock_mode, (cmd, &(entry.config.sgmii.clock_mode), 4));
+
+ cmd_data_check_element("auto_neg", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.sgmii.auto_neg), 4));
+
+ cmd_data_check_element("force_speed", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.sgmii.force_speed), 4));
+
+ cmd_data_check_element("prbs_enable", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.sgmii.prbs_enable), 4));
+
+ cmd_data_check_element("rem_phy_lpbk", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.sgmii.rem_phy_lpbk), 4));
+ }
+
+ if (FAL_MAC_MODE_FIBER == entry.mac_mode)
+ {
+ cmd_data_check_element("auto_neg", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.fiber.auto_neg), 4));
+
+ cmd_data_check_element("fx100_enable", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.config.fiber.fx100_enable), 4));
+ }
+
+ *(fal_mac_config_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_mac_config(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_mac_config_t *entry;
+
+ entry = (fal_mac_config_t *) buf;
+
+ if (FAL_MAC_MODE_RGMII == entry->mac_mode)
+ {
+ dprintf("[mac_mode]:rgmii");
+ }
+ else if (FAL_MAC_MODE_RMII == entry->mac_mode)
+ {
+ dprintf("[mac_mode]:rmii");
+ }
+ else if (FAL_MAC_MODE_GMII == entry->mac_mode)
+ {
+ dprintf("[mac_mode]:gmii");
+ }
+ else if (FAL_MAC_MODE_MII == entry->mac_mode)
+ {
+ dprintf("[mac_mode]:mii");
+ }
+ else if (FAL_MAC_MODE_SGMII == entry->mac_mode)
+ {
+ dprintf("[mac_mode]:sgmii");
+ }
+ else if (FAL_MAC_MODE_FIBER == entry->mac_mode)
+ {
+ dprintf("[mac_mode]:fiber");
+ }
+ else
+ {
+ dprintf("[mac_mode]:default");
+ }
+
+ if (FAL_MAC_MODE_RGMII == entry->mac_mode)
+ {
+ if (A_TRUE == entry->config.rgmii.txclk_delay_cmd)
+ {
+ dprintf("\n[txclk_delay_cmd]:yes [txclk_delay_select]:%d", entry->config.rgmii.txclk_delay_sel);
+ }
+ else
+ {
+ dprintf("\n[txclk_delay_cmd]:no");
+ }
+
+ if (A_TRUE == entry->config.rgmii.rxclk_delay_cmd)
+ {
+ dprintf("\n[rxclk_delay_cmd]:yes [rxclk_delay_select]:%d", entry->config.rgmii.rxclk_delay_sel);
+ }
+ else
+ {
+ dprintf("\n[rxclk_delay_cmd]:no");
+ }
+
+ }
+ else if (FAL_MAC_MODE_RMII == entry->mac_mode)
+ {
+ if (A_TRUE == entry->config.rmii.master_mode)
+ {
+ dprintf("\n[master_mode]:yes");
+ }
+ else
+ {
+ dprintf("\n[master_mode]:no");
+ }
+
+ if (A_TRUE == entry->config.rmii.slave_mode)
+ {
+ dprintf("\n[slave_mode]:yes");
+ }
+ else
+ {
+ dprintf("\n[slave_mode]:no");
+ }
+
+ if (A_TRUE == entry->config.rmii.clock_inverse)
+ {
+ dprintf("\n[clock_inverse]:yes");
+ }
+ else
+ {
+ dprintf("\n[clock_inverse]:no");
+ }
+
+ if (A_TRUE == entry->config.rmii.pipe_rxclk_sel)
+ {
+ dprintf("\n[pipe_rxclk_sel]:yes");
+ }
+ else
+ {
+ dprintf("\n[pipe_rxclk_sel]:no");
+ }
+
+
+ }
+ else if ((FAL_MAC_MODE_GMII == entry->mac_mode)
+ || (FAL_MAC_MODE_MII == entry->mac_mode))
+ {
+
+ if (FAL_INTERFACE_CLOCK_PHY_MODE == entry->config.gmii.clock_mode)
+ {
+ dprintf("\n[clock_mode]:phy [txclk_select]:%d [rxclk_select]:%d", entry->config.gmii.txclk_select, entry->config.gmii.rxclk_select);
+ }
+ else
+ {
+ dprintf("\n[clock_mode]:mac [txclk_select]:%d [rxclk_select]:%d", entry->config.gmii.txclk_select, entry->config.gmii.rxclk_select);
+ }
+ }
+ else if (FAL_MAC_MODE_SGMII == entry->mac_mode)
+ {
+ if (FAL_INTERFACE_CLOCK_PHY_MODE == entry->config.sgmii.clock_mode)
+ {
+ dprintf("\n[clock_mode]:phy");
+ }
+ else
+ {
+ dprintf("\n[clock_mode]:mac");
+ }
+
+ if (A_TRUE == entry->config.sgmii.auto_neg)
+ {
+ dprintf("\n[auto_neg]:yes");
+ }
+ else
+ {
+ dprintf("\n[auto_neg]:no");
+ }
+ if (A_TRUE == entry->config.sgmii.force_speed)
+ {
+ dprintf("\n[force_speed]:yes");
+ }
+ else
+ {
+ dprintf("\n[force_speed]:no");
+ }
+ if (A_TRUE == entry->config.sgmii.prbs_enable)
+ {
+ dprintf("\n[prbs_enable]:yes");
+ }
+ else
+ {
+ dprintf("\n[prbs_enable]:no");
+ }
+ if (A_TRUE == entry->config.sgmii.rem_phy_lpbk)
+ {
+ dprintf("\n[rem_phy_lpbk]:yes");
+ }
+ else
+ {
+ dprintf("\n[rem_phy_lpbk]:no");
+ }
+ }
+ else if (FAL_MAC_MODE_FIBER == entry->mac_mode)
+ {
+ if (A_TRUE == entry->config.fiber.auto_neg)
+ {
+ dprintf("\n[auto_neg]:yes");
+ }
+ else
+ {
+ dprintf("\n[auto_neg]:no");
+ }
+ if (A_TRUE == entry->config.fiber.fx100_enable)
+ {
+ dprintf("\n[fx100_enable]:yes");
+ }
+ else
+ {
+ dprintf("\n[fx100_enable]:no");
+ }
+ }
+
+ return;
+}
+
+sw_error_t
+cmd_data_check_phy_config(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ fal_phy_config_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_phy_config_t));
+
+ cmd_data_check_element("mac_mode", "rgmii",
+ "usage: <rgmii/default>\n",
+ cmd_data_check_mac_mode, (cmd, &(entry.mac_mode), 4));
+
+ if (FAL_MAC_MODE_RGMII == entry.mac_mode)
+ {
+
+ cmd_data_check_element("txclk_delay_cmd", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.txclk_delay_cmd), 4));
+
+ cmd_data_check_element("txclk_delay_select", "0",
+ "usage: <0-3>\n",
+ cmd_data_check_uint32, (cmd, &(entry.txclk_delay_sel), 4));
+
+ cmd_data_check_element("rxclk_delay_cmd", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.rxclk_delay_cmd), 4));
+
+ cmd_data_check_element("rxclk_delay_select", "0",
+ "usage: <0-3>\n",
+ cmd_data_check_uint32, (cmd, &(entry.rxclk_delay_sel), 4));
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ *(fal_phy_config_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_phy_config(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_phy_config_t *entry;
+
+ entry = (fal_phy_config_t *) buf;
+
+ if (FAL_MAC_MODE_RGMII == entry->mac_mode)
+ {
+ dprintf("[mac_mode]:rgmii");
+ }
+ else
+ {
+ dprintf("[mac_mode]:default");
+ }
+
+ if (FAL_MAC_MODE_RGMII == entry->mac_mode)
+ {
+ if (A_TRUE == entry->txclk_delay_cmd)
+ {
+ dprintf("\n[txclk_delay_cmd]:yes [txclk_delay_select]:%d", entry->txclk_delay_sel);
+ }
+ else
+ {
+ dprintf("\n[txclk_delay_cmd]:no");
+ }
+
+ if (A_TRUE == entry->rxclk_delay_cmd)
+ {
+ dprintf("\n[rxclk_delay_cmd]:yes [rxclk_delay_select]:%d", entry->rxclk_delay_sel);
+ }
+ else
+ {
+ dprintf("\n[rxclk_delay_cmd]:no");
+ }
+ }
+ return;
+}
+
+sw_error_t
+cmd_data_check_fdb_smode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "ivl"))
+ *arg_val = INVALID_VLAN_IVL;
+ else if (!strcasecmp(cmd_str, "svl"))
+ *arg_val = INVALID_VLAN_SVL;
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+void
+cmd_data_print_fdb_smode(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ dprintf("[%s]:", param_name);
+ if (*(a_uint32_t *) buf == 1)
+ {
+ dprintf("IVL");
+ }
+ else if (*(a_uint32_t *) buf == 0)
+ {
+ dprintf("SVL");
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ }
+}
+
+sw_error_t
+cmd_data_check_fx100_link_mode(char* cmd_str, fx100_ctrl_link_mode_t* arg_val)
+{
+ if (0 == cmd_str[0])
+ {
+ *arg_val = Fx100BASE_MODE;
+ }
+ else if (!strcasecmp(cmd_str, "fx100base"))
+ {
+ *arg_val = Fx100BASE_MODE;
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_fx100_fd_mode(char *cmd_str, a_uint32_t * arg_val)
+{
+ if (0 == cmd_str[0])
+ {
+ *arg_val = FX100_FULL_DUPLEX;
+ }
+ else if (!strcasecmp(cmd_str, "fullduplex"))
+ {
+ *arg_val = FX100_FULL_DUPLEX;
+ }
+ else if (!strcasecmp(cmd_str, "halfduplex"))
+ {
+ *arg_val = FX100_HALF_DUPLEX;
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_sgmii_fiber_mode(char *cmd_str, a_uint32_t * arg_val)
+{
+ if (0 == cmd_str[0])
+ {
+ *arg_val = FX100_SERDS_MODE;
+ }
+ else if (!strcasecmp(cmd_str, "fx100serds"))
+ {
+ *arg_val = FX100_SERDS_MODE;
+ }
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ return SW_BAD_VALUE;
+ }
+ return SW_OK;
+}
+
+
+
+sw_error_t
+cmd_data_check_fx100_config(char *cmd_str, void * val, a_uint32_t size)
+{
+ char *cmd;
+ fal_fx100_ctrl_config_t entry;
+
+ aos_mem_zero(&entry, sizeof (fal_fx100_ctrl_config_t));
+
+ cmd_data_check_element("link_mode", "fx100base",
+ "usage: <fx100base>\n",
+ cmd_data_check_fx100_link_mode, (cmd, &(entry.link_mode)));
+
+ cmd_data_check_element("overshoot", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.overshoot), 4));
+
+ cmd_data_check_element("loopback_mode", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.loopback), 4));
+
+ cmd_data_check_element("fd_mode", "fullduplex",
+ "usage: <fullduplex/halfduplex>\n",
+ cmd_data_check_fx100_fd_mode, (cmd, &(entry.fd_mode)));
+
+ cmd_data_check_element("col_test", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.col_test), 4));
+
+ cmd_data_check_element("sgmii_fiber", "fx100serds",
+ "usage: <fx100serds>\n",
+ cmd_data_check_sgmii_fiber_mode, (cmd, &(entry.sgmii_fiber_mode)));
+
+ cmd_data_check_element("crs_ctrl", "yes",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_TRUE, &(entry.crs_ctrl), 4));
+
+ cmd_data_check_element("loopback_ctrl", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.loopback_ctrl), 4));
+
+ cmd_data_check_element("crs_col_100_ctrl", "yes",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_TRUE, &(entry.crs_col_100_ctrl), 4));
+
+ cmd_data_check_element("loop_en", "no",
+ "usage: <yes/no/y/n>\n",
+ cmd_data_check_confirm, (cmd, A_FALSE, &(entry.loop_en), 4));
+
+
+
+ *(fal_fx100_ctrl_config_t *)val = entry;
+ return SW_OK;
+}
+
+void
+cmd_data_print_fx100_config(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_fx100_ctrl_config_t* entry;
+
+ entry = (fal_fx100_ctrl_config_t*)buf;
+
+ if (Fx100BASE_MODE == entry->link_mode)
+ {
+ dprintf("[link_mode]: fx100base\n");
+ }
+
+ if (A_TRUE == entry->overshoot)
+ {
+ dprintf("[overshoot]: yes\n");
+ }
+ else
+ {
+ dprintf("[overshoot]: no\n");
+ }
+
+ if (A_TRUE == entry->loopback)
+ {
+ dprintf("[loopback_mode]: yes\n");
+ }
+ else
+ {
+ dprintf("[loopback_mode]: no\n");
+ }
+
+ if (FX100_FULL_DUPLEX == entry->fd_mode)
+ {
+ dprintf("[fd_mode]: fullduplex\n");
+ }
+ else
+ {
+ dprintf("[fd_mode]: halfduplex\n");
+ }
+
+ if (A_TRUE == entry->col_test)
+ {
+ dprintf("[col_test]: yes\n");
+ }
+ else
+ {
+ dprintf("[col_test]: no\n");
+ }
+
+ if (FX100_SERDS_MODE == entry->sgmii_fiber_mode)
+ {
+ dprintf("[sgmii_fiber]: fx100_serds\n");
+ }
+
+ if (A_TRUE == entry->crs_ctrl)
+ {
+ dprintf("[crs_ctrl]: yes\n");
+ }
+ else
+ {
+ dprintf("[crs_ctrl]: no\n");
+ }
+
+ if (A_TRUE == entry->loopback_ctrl)
+ {
+ dprintf("[loopback_ctrl]: yes\n");
+ }
+ else
+ {
+ dprintf("[loopback_ctrl]: no\n");
+ }
+
+ if (A_TRUE == entry->crs_col_100_ctrl)
+ {
+ dprintf("[crs_col_100_ctrl]: yes\n");
+ }
+ else
+ {
+ dprintf("[crs_col_100_ctrl]: no\n");
+ }
+
+ if (A_TRUE == entry->loop_en)
+ {
+ dprintf("[loop_en]: yes\n");
+ }
+ else
+ {
+ dprintf("[loop_en]: no\n");
+ }
+
+}
+
+sw_error_t
+cmd_data_check_sec_mac(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "resv_vid"))
+ *arg_val = FAL_NORM_MAC_RESV_VID_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_src_addr"))
+ *arg_val = FAL_NORM_MAC_INVALID_SRC_ADDR_CMD;
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_sec_ip(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "invalid_ver"))
+ *arg_val = FAL_NORM_IP_INVALID_VER_CMD;
+ else if (!strcasecmp(cmd_str, "same_addr"))
+ *arg_val = FAL_NROM_IP_SAME_ADDR_CMD;
+ else if (!strcasecmp(cmd_str, "ttl_change_status"))
+ *arg_val = FAL_NROM_IP_TTL_CHANGE_STATUS;
+ else if (!strcasecmp(cmd_str, "ttl_val"))
+ *arg_val = FAL_NROM_IP_TTL_VALUE;
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+
+sw_error_t
+cmd_data_check_sec_ip4(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "invalid_hl"))
+ *arg_val = FAL_NROM_IP4_INVALID_HL_CMD;
+ else if (!strcasecmp(cmd_str, "hdr_opts"))
+ *arg_val = FAL_NROM_IP4_HDR_OPTIONS_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_df"))
+ *arg_val = FAL_NROM_IP4_INVALID_DF_CMD;
+ else if (!strcasecmp(cmd_str, "frag_offset_min_len"))
+ *arg_val = FAL_NROM_IP4_FRAG_OFFSET_MIN_LEN_CMD;
+ else if (!strcasecmp(cmd_str, "frag_offset_min_size"))
+ *arg_val = FAL_NROM_IP4_FRAG_OFFSET_MIN_SIZE;
+ else if (!strcasecmp(cmd_str, "frag_offset_max_len"))
+ *arg_val = FAL_NROM_IP4_FRAG_OFFSET_MAX_LEN_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_frag_offset"))
+ *arg_val = FAL_NROM_IP4_INVALID_FRAG_OFFSET_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_sip"))
+ *arg_val = FAL_NROM_IP4_INVALID_SIP_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_dip"))
+ *arg_val = FAL_NROM_IP4_INVALID_DIP_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_chksum"))
+ *arg_val = FAL_NROM_IP4_INVALID_CHKSUM_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_pl"))
+ *arg_val = FAL_NROM_IP4_INVALID_PL_CMD;
+ else if (!strcasecmp(cmd_str, "df_clear_status"))
+ *arg_val = FAL_NROM_IP4_DF_CLEAR_STATUS;
+ else if (!strcasecmp(cmd_str, "ipid_random_status"))
+ *arg_val = FAL_NROM_IP4_IPID_RANDOM_STATUS;
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_sec_ip6(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "invalid_dip"))
+ *arg_val = FAL_NROM_IP6_INVALID_DIP_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_sip"))
+ *arg_val = FAL_NROM_IP6_INVALID_SIP_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_pl"))
+ *arg_val = FAL_NROM_IP6_INVALID_PL_CMD;
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+
+sw_error_t
+cmd_data_check_sec_tcp(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "blat"))
+ *arg_val = FAL_NROM_TCP_BLAT_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_hl"))
+ *arg_val = FAL_NROM_TCP_INVALID_HL_CMD;
+ else if (!strcasecmp(cmd_str, "min_hdr_size"))
+ *arg_val = FAL_NROM_TCP_MIN_HDR_SIZE;
+ else if (!strcasecmp(cmd_str, "invalid_syn"))
+ *arg_val = FAL_NROM_TCP_INVALID_SYN_CMD;
+ else if (!strcasecmp(cmd_str, "su_block"))
+ *arg_val = FAL_NROM_TCP_SU_BLOCK_CMD;
+ else if (!strcasecmp(cmd_str, "sp_block"))
+ *arg_val = FAL_NROM_TCP_SP_BLOCK_CMD;
+ else if (!strcasecmp(cmd_str, "sap_block"))
+ *arg_val = FAL_NROM_TCP_SAP_BLOCK_CMD;
+ else if (!strcasecmp(cmd_str, "xmas_scan"))
+ *arg_val = FAL_NROM_TCP_XMAS_SCAN_CMD;
+ else if (!strcasecmp(cmd_str, "null_scan"))
+ *arg_val = FAL_NROM_TCP_NULL_SCAN_CMD;
+ else if (!strcasecmp(cmd_str, "sr_block"))
+ *arg_val = FAL_NROM_TCP_SR_BLOCK_CMD;
+ else if (!strcasecmp(cmd_str, "sf_block"))
+ *arg_val = FAL_NROM_TCP_SF_BLOCK_CMD;
+ else if (!strcasecmp(cmd_str, "sar_block"))
+ *arg_val = FAL_NROM_TCP_SAR_BLOCK_CMD;
+ else if (!strcasecmp(cmd_str, "rst_scan"))
+ *arg_val = FAL_NROM_TCP_RST_SCAN_CMD;
+ else if (!strcasecmp(cmd_str, "rst_with_data"))
+ *arg_val = FAL_NROM_TCP_RST_WITH_DATA_CMD;
+ else if (!strcasecmp(cmd_str, "fa_block"))
+ *arg_val = FAL_NROM_TCP_FA_BLOCK_CMD;
+ else if (!strcasecmp(cmd_str, "pa_block"))
+ *arg_val = FAL_NROM_TCP_PA_BLOCK_CMD;
+ else if (!strcasecmp(cmd_str, "ua_block"))
+ *arg_val = FAL_NROM_TCP_UA_BLOCK_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_chksum"))
+ *arg_val = FAL_NROM_TCP_INVALID_CHKSUM_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_urgptr"))
+ *arg_val = FAL_NROM_TCP_INVALID_URGPTR_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_opts"))
+ *arg_val = FAL_NROM_TCP_INVALID_OPTIONS_CMD;
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+
+sw_error_t
+cmd_data_check_sec_udp(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "blat"))
+ *arg_val = FAL_NROM_UDP_BLAT_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_len"))
+ *arg_val = FAL_NROM_UDP_INVALID_LEN_CMD;
+ else if (!strcasecmp(cmd_str, "invalid_chksum"))
+ *arg_val = FAL_NROM_UDP_INVALID_CHKSUM_CMD;
+ else
+ {
+ dprintf("UNKNOWN VALUE");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_sec_icmp4(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "ping_pl_exceed"))
+ *arg_val = FAL_NROM_ICMP4_PING_PL_EXCEED_CMD;
+ else if (!strcasecmp(cmd_str, "ping_frag"))
+ *arg_val = FAL_NROM_ICMP4_PING_FRAG_CMD;
+ else if (!strcasecmp(cmd_str, "ping_max_pl"))
+ *arg_val = FAL_NROM_ICMP4_PING_MAX_PL_VALUE;
+ else
+ {
+ //dprintf("input error");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_sec_icmp6(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strcasecmp(cmd_str, "ping_pl_exceed"))
+ *arg_val = FAL_NROM_ICMP6_PING_PL_EXCEED_CMD;
+ else if (!strcasecmp(cmd_str, "ping_frag"))
+ *arg_val = FAL_NROM_ICMP6_PING_FRAG_CMD;
+ else if (!strcasecmp(cmd_str, "ping_max_pl"))
+ *arg_val = FAL_NROM_ICMP6_PING_MAX_PL_VALUE;
+ else
+ {
+ //dprintf("input error");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_remark_entry(char *info, void *val, a_uint32_t size)
+{
+ char *cmd;
+ sw_error_t rv;
+ fal_egress_remark_table_t *pEntry = (fal_egress_remark_table_t *)val;
+ a_uint32_t tmp;
+
+ memset(pEntry, 0, sizeof(fal_egress_remark_table_t));
+
+ /* get remark_dscp */
+ do
+ {
+ cmd = get_sub_cmd("remark dscp", "enable");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <enable/disable>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_enable(cmd, &(pEntry->remark_dscp), sizeof(a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <enable/disable>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ /* get remark_up */
+ do
+ {
+ cmd = get_sub_cmd("remark up", "enable");
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: <enable/disable>\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_enable(cmd, &(pEntry->remark_up), sizeof(a_bool_t));
+ if (SW_OK != rv)
+ dprintf("usage: <enable/disable>\n");
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+
+ /* get g_dscp */
+ do
+ {
+ cmd = get_sub_cmd("green dscp", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 63\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ {
+ dprintf("usage: the range is 0 -- 63\n");
+ }
+
+ if (tmp > 63)
+ {
+ dprintf("usage: the range is 0 -- 63\n");
+ rv = SW_OUT_OF_RANGE;
+ }
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ pEntry->g_dscp = tmp;
+
+ /* get y_dscp */
+ do
+ {
+ cmd = get_sub_cmd("yellow dscp", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 63\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ {
+ dprintf("usage: the range is 0 -- 63\n");
+ }
+
+ if (tmp > 63)
+ {
+ dprintf("usage: the range is 0 -- 63\n");
+ rv = SW_OUT_OF_RANGE;
+ }
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ pEntry->y_dscp = tmp;
+
+ /* get g_up */
+ do
+ {
+ cmd = get_sub_cmd("green up", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 63\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ {
+ dprintf("usage: the range is 0 -- 7\n");
+ }
+
+ if (tmp > 63)
+ {
+ dprintf("usage: the range is 0 -- 7\n");
+ rv = SW_OUT_OF_RANGE;
+ }
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ pEntry->g_up = tmp;
+
+ /* get y_up */
+ do
+ {
+ cmd = get_sub_cmd("yellow up", NULL);
+ SW_RTN_ON_NULL_PARAM(cmd);
+
+ if (!strncasecmp(cmd, "quit", 4))
+ {
+ return SW_BAD_VALUE;
+ }
+ else if (!strncasecmp(cmd, "help", 4))
+ {
+ dprintf("usage: the range is 0 -- 63\n");
+ rv = SW_BAD_VALUE;
+ }
+ else
+ {
+ rv = cmd_data_check_uint16(cmd, &tmp, sizeof (a_uint32_t));
+ if (SW_OK != rv)
+ {
+ dprintf("usage: the range is 0 -- 7\n");
+ }
+
+ if (tmp > 63)
+ {
+ dprintf("usage: the range is 0 -- 7\n");
+ rv = SW_OUT_OF_RANGE;
+ }
+ }
+ }
+ while (talk_mode && (SW_OK != rv));
+ pEntry->y_up = tmp;
+
+/*
+ dprintf("remark_dscp=%d, remark_up=%d, g_dscp=%d, y_dscp=%d\n",
+ pEntry->remark_dscp,
+ pEntry->remark_up,
+ pEntry->g_dscp,
+ pEntry->y_dscp);
+
+ *(fal_egress_remark_table_t *) val = entry;
+*/
+ return SW_OK;
+}
+
+void
+cmd_data_print_remark_entry(a_uint8_t * param_name, a_uint32_t * buf, a_uint32_t size)
+{
+ fal_egress_remark_table_t *entry;
+
+ entry = (fal_egress_remark_table_t *) buf;
+ dprintf("\n");
+ dprintf("[remark dscp]:%s\n", entry->remark_dscp?"enabled":"disabled");
+ dprintf("[remark up]:%s\n", entry->remark_up?"enabled":"disabled");
+ dprintf("[green dscp]:%d\n", entry->g_dscp);
+ dprintf("[yellow dscp]:%d\n", entry->y_dscp);
+ dprintf("[green up]:%d\n", entry->g_up);
+ dprintf("[yellow up]:%d\n", entry->y_up);
+
+ return;
+}
+
+
diff --git a/src/shell/shell_lib.c b/src/shell/shell_lib.c
new file mode 100755
index 0000000..e7f00e4
--- /dev/null
+++ b/src/shell/shell_lib.c
@@ -0,0 +1,903 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <signal.h>
+#include <termios.h>
+#include "shell_config.h"
+
+#define printc(isPrint, fmt, args...) if(isPrint == 1) printf(fmt, ##args)
+
+static char *cmd_promptp = "dev0@qca>"; /*command prompt pointer */
+static struct termios term_save; /* terminal setting saved */
+static int term_cursor; /*terminal position */
+static int cmd_cursor; /*command position */
+static char *cmd_strp; /*command string pointer */
+static int cmd_strlen; /*command string length */
+
+#define HISTORY_MAX_SIZE 20
+static char *history_buf[HISTORY_MAX_SIZE + 1]; /* history buffer */
+static int history_nr; /* saved history lines */
+static int history_cur; /* current pointer to history line */
+
+static void term_config(void);
+static void term_restore(void);
+static void term_sig_handler(int sig);
+static void term_init(char *out_cmd);
+static void term_echo(void);
+static void cursor_backward(void);
+static void cursor_forward(void);
+static void handle_backward(void);
+static void handle_delete(void);
+static void handle_tab(void);
+static void handle_up(void);
+static void handle_down(void);
+static void handle_left(void);
+static void handle_right(void);
+static void handle_normal(char *out_cmd, char c);
+static void handle_help(void);
+static void prompt_print(void);
+static void out_cmd_print(void);
+static int history_prev(void);
+static int history_next(void);
+static void history_record(char *out_cmd);
+
+
+struct key_bind_t
+{
+ int is_eseq; /*is escape sequence */
+ int key_last; /*relative key or escape sequence last character */
+ void (*func) ();
+};
+
+struct key_bind_t key_bind[] =
+{
+ {0, '\b', handle_backward},
+ {0, 127, handle_delete},
+ {0, '\t', handle_tab},
+ {0, '?', handle_help},
+ {1, 'A', handle_up},
+ {1, 'B', handle_down},
+ {1, 'C', handle_right},
+ {1, 'D', handle_left},
+};
+
+/* saving orignal setting and set new attrib to terminal*/
+static void
+term_config(void)
+{
+ struct termios term_tmp;
+ tcgetattr(0, (void *) &term_save);
+ memcpy(&term_tmp, &term_save, sizeof (struct termios));
+
+ /*unbuffered input and turn off echo */
+ term_tmp.c_lflag &= ~(ICANON | ECHO | ECHONL);
+
+ tcsetattr(0, TCSANOW, (void *) &term_tmp);
+}
+
+/*restore termial setting*/
+static void
+term_restore(void)
+{
+ tcsetattr(0, TCSANOW, (void *) &term_save);
+}
+
+/*termial signal handler*/
+static void
+term_sig_handler(int sig)
+{
+ switch (sig)
+ {
+ case SIGINT:
+ if (cmd_promptp)
+ printf("\n%s", cmd_promptp);
+
+ while (cmd_strlen-- > 0)
+ cmd_strp[cmd_strlen] = '\0';
+
+ cmd_strp[0] = '\0';
+ cmd_strlen = 0;
+ if (cmd_promptp)
+ term_cursor = strlen(cmd_promptp);
+ cmd_cursor = 0;
+
+ fflush(stdout);
+
+ break;
+
+ case SIGUSR1:
+ case SIGKILL:
+ case SIGABRT:
+ case SIGTERM:
+ case SIGHUP:
+ printf("exit.\n");
+ term_restore();
+ exit(0);
+ default:
+ break;
+ }
+}
+
+/*termial initial*/
+static void
+term_init(char *out_cmd)
+{
+ term_cursor = 0;
+ cmd_cursor = 0;
+
+ cmd_strp = out_cmd;
+ cmd_strlen = strlen(out_cmd);
+
+ // Initialize signal
+ signal(SIGINT, term_sig_handler);
+ signal(SIGUSR1, term_sig_handler);
+ signal(SIGKILL, term_sig_handler);
+ signal(SIGABRT, term_sig_handler);
+ signal(SIGTERM, term_sig_handler);
+ signal(SIGHUP, term_sig_handler);
+ //signal(SIGQUIT, SIG_IGN);
+
+ prompt_print();
+}
+
+/* printf current char*/
+static void
+term_echo(void)
+{
+
+ if (cmd_strp[cmd_cursor])
+ {
+ putchar(cmd_strp[cmd_cursor]);
+ }
+ else
+ {
+ putchar(' ');
+ }
+
+ term_cursor++;
+ cmd_cursor++;
+}
+
+/* cursor move back one character */
+static void
+cursor_backward(void)
+{
+ if (cmd_cursor > 0 && term_cursor > 0)
+ {
+ cmd_cursor--;
+ term_cursor--;
+ putchar('\b');
+ }
+}
+
+/* cursor move forward one character */
+static void
+cursor_forward(void)
+{
+ if (cmd_cursor < cmd_strlen)
+ term_echo();
+}
+
+/* move backward one characters. */
+static void
+handle_backward(void)
+{
+ if (cmd_cursor > 0)
+ {
+ cursor_backward();
+ handle_delete();
+ }
+}
+
+/*delete one character in front of cursor */
+static void
+handle_delete(void)
+{
+ int cur_tmp = cmd_cursor;
+
+ /*when cursour at the end of string */
+ if (cmd_cursor >= cmd_strlen)
+ return;
+
+ /*delete one character from string */
+ strcpy(cmd_strp + cur_tmp, cmd_strp + cur_tmp + 1);
+ cmd_strlen--;
+
+ /*clear characters after cursor */
+ printf("\033[J");
+
+ /*re-print from delete position */
+ while (cmd_cursor < cmd_strlen)
+ term_echo();
+
+ /*move cursor back to delete position */
+ cur_tmp = cmd_cursor - cur_tmp;
+ while (cur_tmp--)
+ cursor_backward();
+}
+
+/* deal with up arrow*/
+static void
+handle_up(void)
+{
+ /*get previous history */
+ if (history_prev() < 0)
+ return;
+
+ /*copy current history cmd to out_cmd */
+ strcpy(cmd_strp, history_buf[history_cur]);
+
+ /*print out_cmd */
+ out_cmd_print();
+}
+
+/* deal with down arrow*/
+static void
+handle_down(void)
+{
+ /*get previous history */
+ if (history_next() < 0)
+ return;
+
+ /*copy current history cmd to out_cmd */
+ strcpy(cmd_strp, history_buf[history_cur]);
+
+ /*print out_cmd */
+ out_cmd_print();
+}
+
+/* deal with left arrow*/
+static void
+handle_left(void)
+{
+ cursor_backward();
+}
+
+/* deal with right arrow*/
+static void
+handle_right(void)
+{
+ cursor_forward();
+}
+
+static void
+print_cmd_all (void)
+{
+ int cmd_no = 0;
+ for (cmd_no = 0; GCMD_DESC_VALID(cmd_no); cmd_no++)
+ {
+ if (!GCMD_NAME(cmd_no))
+ continue;
+
+ printf("%-10s%s\n", GCMD_NAME(cmd_no), GCMD_MEMO(cmd_no));
+ }
+}
+
+
+static void
+print_sub_all (int cmd_id)
+{
+ int cmd_sub_no = 0, cmd_sub_nr = 0;
+ for (cmd_sub_no = 0; GCMD_SUB_DESC_VALID(cmd_id, cmd_sub_no); cmd_sub_no++)
+ {
+
+ if (!GCMD_SUB_NAME(cmd_id, cmd_sub_no))
+ continue;
+ if(cmd_sub_no == 0 || strcasecmp(GCMD_SUB_NAME(cmd_id, cmd_sub_no),
+ GCMD_SUB_NAME(cmd_id, cmd_sub_no-1)))
+ {
+ printf("%-10s\t", GCMD_SUB_NAME(cmd_id, cmd_sub_no));
+ if(cmd_sub_nr && !((cmd_sub_nr+1) %5))
+ {
+ printf("\n");
+ }
+ cmd_sub_nr++;
+ }
+ }
+ printf("\n");
+}
+
+/*
+1. partly_cmd_nr = 0 && index = no match: none
+2. partly_cmd_nr = 0 && index = matched: full matched
+3. partly_cmd_nr = 1 && index = matched: partly matched & to be completed
+4. partly_cmd_nr > 1 && index = matched: partly matched & to be list them
+*/
+#define NONE_MATCHED(pmatch_nr, pmatch_id) ( (pmatch_nr == 0) && (pmatch_id == GCMD_DESC_NO_MATCH) )
+#define FULL_MATCHED(pmatch_nr, pmatch_id) ( (pmatch_nr == 0) && (pmatch_id != GCMD_DESC_NO_MATCH) )
+#define ONE_PART_MATCHED(pmatch_nr, pmatch_id) ( (pmatch_nr == 1) && (pmatch_id != GCMD_DESC_NO_MATCH) )
+#define MULTI_PART_MATCHED(pmatch_nr, pmatch_id) ( (pmatch_nr > 1 ) && (pmatch_id != GCMD_DESC_NO_MATCH) )
+
+
+static int
+search_cmd_type(char *name, int *pmatch_id, int is_print)
+{
+ int cmd_no = 0, pmatch_nr = 0;
+
+ *pmatch_id = GCMD_DESC_NO_MATCH;
+
+ /*search type in glb_num_types print matched */
+ for (cmd_no = 0; GCMD_DESC_VALID(cmd_no); cmd_no++)
+ {
+
+ if (!GCMD_NAME(cmd_no))
+ continue;
+
+ if (!strcasecmp(name, GCMD_NAME(cmd_no)))
+ {
+ /*full matched */
+ *pmatch_id = cmd_no;
+ break;
+ }
+ else if (!strncasecmp(name, GCMD_NAME(cmd_no), strlen(name)))
+ {
+ /*partly matched */
+ printc(is_print, "%-10s%s\n", GCMD_NAME(cmd_no), GCMD_MEMO(cmd_no));
+ pmatch_nr++;
+ *pmatch_id = cmd_no;
+ }
+ }
+
+ return pmatch_nr;
+}
+
+static int
+search_cmd_sub(int cmd_id, int *pmatch_sub_id, char *sub_name, int is_print)
+{
+
+ int cmd_sub_no, pmatch_sub_nr = 0, fmatch_sub_save = GCMD_DESC_NO_MATCH;
+
+ *pmatch_sub_id = GCMD_DESC_NO_MATCH;
+
+ /*search for full matched */
+ for (cmd_sub_no = 0; GCMD_SUB_DESC_VALID(cmd_id, cmd_sub_no); cmd_sub_no++)
+ {
+ if (!GCMD_SUB_NAME(cmd_id, cmd_sub_no))
+ continue;
+
+ if (!strcasecmp(sub_name, GCMD_SUB_NAME(cmd_id, cmd_sub_no)))
+ {
+ /*full matched */
+ printc(is_print, "%-10s\t%s\n", GCMD_SUB_ACT(cmd_id, cmd_sub_no), GCMD_SUB_MEMO(cmd_id, cmd_sub_no));
+ //*pmatch_sub_id = cmd_sub_no;
+ if(fmatch_sub_save == GCMD_DESC_NO_MATCH)
+ {
+ *pmatch_sub_id = fmatch_sub_save = cmd_sub_no;
+ }
+
+ }
+ else if (!strncasecmp(sub_name, GCMD_SUB_NAME(cmd_id, cmd_sub_no), strlen(sub_name)))
+ {
+ if(fmatch_sub_save != GCMD_DESC_NO_MATCH)
+ continue;
+
+ /*partly matched */
+ if (*pmatch_sub_id == GCMD_DESC_NO_MATCH || (GCMD_SUB_NAME(cmd_id, cmd_sub_no-1) &&
+ strcasecmp(GCMD_SUB_NAME(cmd_id, cmd_sub_no), GCMD_SUB_NAME(cmd_id, cmd_sub_no-1))))
+ {
+ printc(is_print, "%-10s\t", GCMD_SUB_NAME(cmd_id, cmd_sub_no));
+ pmatch_sub_nr++;
+ *pmatch_sub_id = cmd_sub_no;
+ }
+ }
+ }
+
+ if (pmatch_sub_nr > 1)
+ printc(is_print, "\n");
+
+ return pmatch_sub_nr;
+}
+
+static int
+search_cmd_action(int cmd_id, int *pmatch_act_id, char *sub_name, char *action, int is_print)
+{
+ int cmd_act_no = 0, pmatch_act_nr = 0;
+
+ *pmatch_act_id = GCMD_DESC_NO_MATCH;
+
+ /*search for full matched */
+ for (cmd_act_no = 0; GCMD_SUB_DESC_VALID(cmd_id, cmd_act_no); cmd_act_no++)
+ {
+
+ if (strcasecmp(sub_name, GCMD_SUB_NAME(cmd_id, cmd_act_no)))
+ continue;
+
+ if (!GCMD_SUB_ACT(cmd_id, cmd_act_no))
+ continue;
+
+ if (!strcasecmp(action, GCMD_SUB_ACT(cmd_id, cmd_act_no)))
+ {
+ /*full matched */
+ if (*pmatch_act_id == GCMD_DESC_NO_MATCH)
+ {
+ printc(is_print, "%-10s\n", GCMD_SUB_USAGE(cmd_id, cmd_act_no));
+ }
+
+ *pmatch_act_id = cmd_act_no;
+ break;
+ }
+ else if (!strncasecmp(action, GCMD_SUB_ACT(cmd_id, cmd_act_no), strlen(action)))
+ {
+ /*partly matched */
+ if (*pmatch_act_id == GCMD_DESC_NO_MATCH ||( GCMD_SUB_ACT(cmd_id, cmd_act_no-1) &&
+ strcasecmp(GCMD_SUB_ACT(cmd_id, cmd_act_no), GCMD_SUB_ACT(cmd_id, cmd_act_no-1))))
+ {
+ printc(is_print, "%-10s\t%s\n", GCMD_SUB_ACT(cmd_id, cmd_act_no), GCMD_SUB_MEMO(cmd_id, cmd_act_no));
+ pmatch_act_nr++;
+ *pmatch_act_id = cmd_act_no;
+ }
+ }
+ }
+
+ return pmatch_act_nr;
+}
+
+/*print help info*/
+static void
+handle_help(void)
+{
+ int pmatch_id = GCMD_DESC_NO_MATCH, pmatch_sub_id = GCMD_DESC_NO_MATCH, pmatch_act_id = GCMD_DESC_NO_MATCH;
+ int cmd_nr = 0, pmatch_nr = 0, pmatch_sub_nr = 0;
+ char *tmp_str[3], *cmd_strp_cp = strdup(cmd_strp);
+
+ /* split command string into temp array */
+ tmp_str[cmd_nr] = (void *) strtok(cmd_strp_cp, " ");
+
+ while (tmp_str[cmd_nr])
+ {
+ if (++cmd_nr == 3)
+ break;
+ tmp_str[cmd_nr] = (void *) strtok(NULL, " ");
+ }
+
+ /*echo input ? */
+ printf("?\n");
+
+ int is_print = 0;
+
+ /* print matched command */
+ switch (cmd_nr)
+ {
+ case 3:
+ pmatch_nr = search_cmd_type(tmp_str[0], &pmatch_id, is_print);
+ if(FULL_MATCHED(pmatch_nr, pmatch_id))
+ pmatch_sub_nr = search_cmd_sub(pmatch_id, &pmatch_sub_id, tmp_str[1], is_print);
+
+ if(FULL_MATCHED(pmatch_sub_nr, pmatch_sub_id))
+ {
+ is_print = 1;
+ search_cmd_action(pmatch_id, &pmatch_act_id, tmp_str[1], tmp_str[2], is_print);
+ }
+ break;
+
+ case 2:
+ pmatch_nr = search_cmd_type(tmp_str[0], &pmatch_id, is_print);
+ if(FULL_MATCHED(pmatch_nr, pmatch_id))
+ {
+ is_print = 1;
+ search_cmd_sub(pmatch_id, &pmatch_sub_id, tmp_str[1], is_print);
+ }
+ break;
+
+ case 1:
+ is_print = 1;
+ pmatch_nr = search_cmd_type(tmp_str[0], &pmatch_id, is_print);
+
+ if(NONE_MATCHED(pmatch_nr, pmatch_id))
+ {
+ print_cmd_all();
+ }
+ else if(FULL_MATCHED(pmatch_nr, pmatch_id))
+ {
+ print_sub_all(pmatch_id);
+ }
+ break;
+
+ case 0:
+ print_cmd_all();
+ break;
+
+ default:
+ break;
+ }
+
+ printf("\n");
+
+ /* re-print prompt */
+ prompt_print();
+
+ /* re-print from cursor */
+ while (cmd_cursor < cmd_strlen)
+ term_echo();
+
+ if(cmd_strp_cp)
+ free(cmd_strp_cp);
+}
+
+static void
+_cmd_complete(char *matchBuf, char *fullName)
+{
+ //printf ("***%s-%s****", matchBuf, fullName);
+ int offset = cmd_strlen - cmd_cursor;
+ int diff = strlen(fullName) - strlen(matchBuf);;
+
+ /*print prompt */
+ if (cmd_promptp)
+ printf("\n%s", cmd_promptp);
+
+ /*give position to new char */
+ memmove(cmd_strp + cmd_cursor + diff, cmd_strp + cmd_cursor, offset);
+ /*insert new char */
+ if (cmd_promptp)
+ memcpy(cmd_strp + cmd_cursor, fullName + strlen(matchBuf), diff);
+ else
+ memcpy(cmd_strp + cmd_cursor, fullName, diff);
+ /*caculate new cursor */
+ cmd_cursor += diff;
+
+ /*set new cursor and len */
+ cmd_strlen = strlen(cmd_strp);
+ if (cmd_promptp)
+ term_cursor = cmd_strlen + strlen(cmd_promptp);
+ else
+ term_cursor = cmd_strlen;
+
+ /*re-print command */
+ printf("%s", cmd_strp);
+
+ /*set terminal cursor */
+ if (cmd_strlen - cmd_cursor)
+ printf("\033[%dD", cmd_strlen - cmd_cursor); /*move cursor left */
+}
+
+void _cursor_recover(void)
+{
+ if(strlen(cmd_strp) != cmd_cursor)
+ {
+ int clear = strlen(cmd_strp) - cmd_cursor;
+ while(clear--)
+ {
+ printf("\b");
+ }
+ }
+}
+
+/* deal with tab completion*/
+#define MATCH_BUF_MAX 100
+static void
+handle_tab(void)
+{
+
+ int cmd_nr = 0;
+ char matchBuf[MATCH_BUF_MAX];
+ char *tmp_str[3];
+
+ memset(matchBuf, 0, MATCH_BUF_MAX);
+
+ if(cmd_cursor < MATCH_BUF_MAX)
+ strncpy(matchBuf, cmd_strp, cmd_cursor);
+ else {
+ strncpy(matchBuf, cmd_strp, MATCH_BUF_MAX-1);
+ matchBuf[MATCH_BUF_MAX-1] = '\0';
+ }
+
+ printf("\n");
+
+ /* split command string into temp array */
+ tmp_str[cmd_nr] = (void *) strtok(matchBuf, " ");
+
+ if(!tmp_str[cmd_nr])
+ {
+ print_cmd_all();
+ if (cmd_promptp)
+ printf("\n%s%s", cmd_promptp, cmd_strp);
+ _cursor_recover();
+ return;
+ }
+
+ while (tmp_str[cmd_nr])
+ {
+ if (++cmd_nr == 3)
+ break;
+ tmp_str[cmd_nr] = (void *) strtok(NULL, " ");
+ }
+
+ int is_print = 1, is_completed = 0;
+ int pmatch_nr = 0, pmatch_id = GCMD_DESC_NO_MATCH;
+
+ pmatch_nr = search_cmd_type(tmp_str[0], &pmatch_id, is_print);
+
+ if (cmd_nr == 1)
+ {
+ if (ONE_PART_MATCHED(pmatch_nr, pmatch_id))
+ {
+ _cmd_complete(tmp_str[0], GCMD_NAME(pmatch_id));
+ is_completed = 1;
+ }
+
+ if(NONE_MATCHED(pmatch_nr, pmatch_id))
+ {
+ print_cmd_all();
+
+ }
+ else if(FULL_MATCHED(pmatch_nr, pmatch_id))
+ {
+ print_sub_all(pmatch_id);
+ }
+
+ }
+ else if (cmd_nr > 1)
+ {
+ if (FULL_MATCHED(pmatch_nr, pmatch_id))
+ {
+
+ int pmatch_sub_nr = 0, pmatch_sub_id = GCMD_DESC_NO_MATCH;
+
+ if(cmd_nr == 3) is_print = 0;
+ pmatch_sub_nr = search_cmd_sub(pmatch_id, &pmatch_sub_id, tmp_str[1], is_print);
+
+ if(cmd_nr == 2)
+ {
+ if (ONE_PART_MATCHED(pmatch_sub_nr, pmatch_sub_id))
+ {
+ _cmd_complete(tmp_str[1], GCMD_SUB_NAME(pmatch_id, pmatch_sub_id));
+ is_completed = 1;
+ }
+
+ }
+ else if (cmd_nr == 3)
+ {
+ int pmatch_act_nr = 0, pmatch_act_id = GCMD_DESC_NO_MATCH;
+ pmatch_act_nr = search_cmd_action(pmatch_id, &pmatch_act_id, tmp_str[1], tmp_str[2], is_print);
+
+ if (ONE_PART_MATCHED(pmatch_act_nr, pmatch_act_id))
+ {
+ _cmd_complete(tmp_str[2], GCMD_SUB_ACT(pmatch_id, pmatch_act_id));
+ is_completed = 1;
+
+ }
+ else if (FULL_MATCHED(pmatch_act_nr, pmatch_act_id))
+ {
+ is_print = 1;
+ printc(is_print, "%-10s\n", GCMD_SUB_USAGE(pmatch_id, pmatch_act_id));
+ }
+ }
+ }
+ }
+
+ if (is_completed == 0)
+ {
+ /*re-echo */
+ if (cmd_promptp)
+ printf("\n%s%s", cmd_promptp, cmd_strp);
+ _cursor_recover();
+ }
+ //_cursor_recover();
+}
+
+/*deal with normal character*/
+static void
+handle_normal(char *out_cmd, char c)
+{
+ int tmp_cursor = cmd_cursor;
+
+ /*buffer full */
+ if (++cmd_strlen > (MATCH_BUF_MAX - 2))
+ return;
+
+ /*append operation */
+ if (cmd_cursor == (cmd_strlen - 1))
+ {
+ *(out_cmd + cmd_cursor) = c;
+ *(out_cmd + cmd_cursor + 1) = 0;
+ term_echo();
+ }
+ else
+ {
+ /* Insert operation */
+ /*give position to new char */
+ memmove(out_cmd + tmp_cursor + 1, out_cmd + tmp_cursor,
+ cmd_strlen - tmp_cursor);
+ *(out_cmd + tmp_cursor) = c;
+
+ /* re-print from cursor */
+ while (cmd_cursor < cmd_strlen)
+ term_echo();
+
+ /* restore curor to insert position */
+ tmp_cursor = cmd_cursor - tmp_cursor - 1;
+ while (tmp_cursor--)
+ cursor_backward();
+ }
+}
+
+/*print prompt info*/
+static void
+prompt_print(void)
+{
+ if (cmd_promptp)
+ printf("%s", cmd_promptp);
+
+ if (cmd_promptp)
+ term_cursor = strlen(cmd_promptp);
+ cmd_cursor = 0;
+ fflush(stdout);
+}
+
+/*print current output command*/
+static void
+out_cmd_print(void)
+{
+ cmd_strlen = strlen(history_buf[history_cur]);
+
+ putchar('\r');
+ prompt_print();
+
+ while (cmd_cursor < cmd_strlen)
+ term_echo();
+
+ /*clear characters after cursor */
+ printf("\033[J");
+
+}
+
+/* get previous history command*/
+static int
+history_prev(void)
+{
+ if (history_cur > 0)
+ {
+ /*record current*/
+ if (cmd_strp[0] != 0 || history_buf[history_cur] == 0)
+ {
+ if(history_buf[history_cur])
+ free(history_buf[history_cur]);
+ history_buf[history_cur] = strdup(cmd_strp);
+ }
+ history_cur--;
+ return 0;
+ }
+
+ return -1;
+}
+
+/* get next history command*/
+static int
+history_next(void)
+{
+ if ((history_cur >= 0) && (history_cur < history_nr))
+ {
+ history_cur++;
+ return 0;
+ }
+
+ return -1;
+}
+
+/*record history command*/
+static void
+history_record(char *out_cmd)
+{
+ int i;
+
+ /* cleanup may be saved current command line */
+ if (cmd_strlen > 0) /* no put empty line */
+ {
+ i = history_nr;
+
+ free(history_buf[HISTORY_MAX_SIZE]);
+ history_buf[HISTORY_MAX_SIZE] = 0;
+ /* After max history, remove the oldest command */
+ if (i >= HISTORY_MAX_SIZE)
+ {
+ free(history_buf[0]);
+ for (i = 0; i < (HISTORY_MAX_SIZE - 1); i++)
+ history_buf[i] = history_buf[i + 1];
+ }
+ history_buf[i++] = strdup(out_cmd);
+ history_cur = i;
+ history_nr = i;
+ }
+}
+
+int
+_isspace(int ch)
+{
+ return (unsigned int) (ch - 9) < 5u || ch == ' ';
+}
+
+/*call by main*/
+int
+next_cmd(char *out_cmd)
+{
+ unsigned char c = 0;
+ int key_no = 0;
+ int seq_char = 0;
+ int str_valid = 0;
+
+ /*set terminal new attrib */
+ term_config();
+
+ /*termial initial */
+ term_init(out_cmd);
+
+ /*main loop */
+ while ((c = getc(stdin)) != '\n')
+ {
+ key_no = 0;
+ seq_char = 0;
+
+ if (!_isspace(c))
+ {
+ str_valid = 1;
+ }
+
+ if (c == 27) /*escape sequence */
+ {
+ if ((c = getc(stdin)) == '[' || c == 'O')
+ {
+ c = getc(stdin);
+ seq_char = 1;
+ }
+ }
+
+ /*search for bind key handle function */
+ while (key_no < sizeof (key_bind) / sizeof (key_bind[0]))
+ {
+ if ((seq_char == key_bind[key_no].is_eseq)
+ && (c == key_bind[key_no].key_last))
+ {
+ key_bind[key_no].func();
+ break;
+ }
+ key_no++;
+ }
+
+ if (key_no == sizeof (key_bind) / sizeof (key_bind[0]))
+ handle_normal(out_cmd, c);
+
+ }
+
+ /*handle enter when at the end of a line */
+ if (term_cursor)
+ putchar('\n');
+
+ /* record command history without '\n' */
+ history_record(out_cmd);
+#if 0
+ /* add '\n' to out_cmd */
+ if (str_valid)
+ {
+ out_cmd[cmd_strlen++] = '\n';
+ }
+ else
+ {
+ cmd_strlen = 0;
+ out_cmd[cmd_strlen++] = '\n';
+ }
+
+ if (cmd_strlen > 1 && out_cmd[cmd_strlen - 1] == '\n')
+ out_cmd[cmd_strlen - 1] = 0;
+#else
+ if (!str_valid)
+ cmd_strlen = 0;
+#endif
+ /*retore terminal to orginal status */
+ term_restore();
+
+ fflush(stdout);
+
+ return cmd_strlen;
+}
diff --git a/src/shell/shell_sw.c b/src/shell/shell_sw.c
new file mode 100755
index 0000000..22f0a04
--- /dev/null
+++ b/src/shell/shell_sw.c
@@ -0,0 +1,505 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include "shell.h"
+#include "fal.h"
+
+static int sw_devid = 0;
+
+sw_error_t
+cmd_set_devid(a_uint32_t *arg_val)
+{
+ if (arg_val[1] >= SW_MAX_NR_DEV)
+ {
+ dprintf("dev_id should be less than <%d>\n", SW_MAX_NR_DEV);
+ return SW_FAIL;
+ }
+ sw_devid = arg_val[1];
+
+ return SW_OK;
+}
+
+int
+get_devid(void)
+{
+ return sw_devid;
+}
+
+
+#if defined ISIS
+
+sw_error_t
+cmd_show_fdb(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t cnt = 0;
+ fal_fdb_op_t *fdb_op = (fal_fdb_op_t *) (ioctl_buf + sizeof(sw_error_t) / 4);
+ fal_fdb_entry_t *fdb_entry = (fal_fdb_entry_t *) (ioctl_buf + sizeof(sw_error_t) / 4 + sizeof(fal_fdb_op_t) / 4);
+
+ aos_mem_zero(fdb_op, sizeof (fal_fdb_op_t));
+ aos_mem_zero(fdb_entry, sizeof (fal_fdb_entry_t));
+ arg_val[0] = SW_API_FDB_EXTEND_FIRST;
+
+ while (1)
+ {
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = (a_uint32_t) fdb_op;
+ arg_val[4] = (a_uint32_t) fdb_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ arg_val[0] = SW_API_FDB_EXTEND_NEXT;
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+#elif defined ISISC
+
+sw_error_t
+cmd_show_fdb(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t cnt = 0;
+ fal_fdb_op_t *fdb_op = (fal_fdb_op_t *) (ioctl_buf + sizeof(sw_error_t) / 4);
+ fal_fdb_entry_t *fdb_entry = (fal_fdb_entry_t *) (ioctl_buf + sizeof(sw_error_t) / 4 + sizeof(fal_fdb_op_t) / 4);
+
+ aos_mem_zero(fdb_op, sizeof (fal_fdb_op_t));
+ aos_mem_zero(fdb_entry, sizeof (fal_fdb_entry_t));
+ arg_val[0] = SW_API_FDB_EXTEND_FIRST;
+
+ while (1)
+ {
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = (a_uint32_t) fdb_op;
+ arg_val[4] = (a_uint32_t) fdb_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ arg_val[0] = SW_API_FDB_EXTEND_NEXT;
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+#elif defined SHIVA
+
+sw_error_t
+cmd_show_fdb(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t cnt = 0;
+ fal_fdb_entry_t *fdb_entry = (fal_fdb_entry_t *) (ioctl_buf + 2);
+
+ memset(fdb_entry, 0, sizeof (fal_fdb_entry_t));
+ arg_val[0] = SW_API_FDB_ITERATE;
+ *(ioctl_buf + 1) = 0;
+
+ while (1)
+ {
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = (a_uint32_t) (ioctl_buf + 1);
+ arg_val[4] = (a_uint32_t) fdb_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+#else
+
+sw_error_t
+cmd_show_fdb(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t rtn_size = 1, cnt = 0;
+ fal_fdb_entry_t *fdb_entry = (fal_fdb_entry_t *) (ioctl_buf + rtn_size);
+
+ memset(fdb_entry, 0, sizeof (fal_fdb_entry_t));
+ arg_val[0] = SW_API_FDB_FIRST;
+
+ while (1)
+ {
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = (a_uint32_t) fdb_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ arg_val[0] = SW_API_FDB_NEXT;
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+#endif
+
+#if defined ISIS
+
+sw_error_t
+cmd_show_vlan(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t rtn_size = 1 ,tmp_vid = FAL_NEXT_ENTRY_FIRST_ID, cnt = 0;
+ fal_vlan_t *vlan_entry = (fal_vlan_t *) (ioctl_buf + rtn_size);
+
+ while (1)
+ {
+ arg_val[0] = SW_API_VLAN_NEXT;
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = tmp_vid;
+ arg_val[4] = (a_uint32_t) vlan_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+
+ tmp_vid = vlan_entry->vid;
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+#elif defined ISISC
+
+sw_error_t
+cmd_show_vlan(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t rtn_size = 1 ,tmp_vid = FAL_NEXT_ENTRY_FIRST_ID, cnt = 0;
+ fal_vlan_t *vlan_entry = (fal_vlan_t *) (ioctl_buf + rtn_size);
+
+ while (1)
+ {
+ arg_val[0] = SW_API_VLAN_NEXT;
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = tmp_vid;
+ arg_val[4] = (a_uint32_t) vlan_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+
+ tmp_vid = vlan_entry->vid;
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+
+#else
+
+sw_error_t
+cmd_show_vlan(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t rtn_size = 1 ,tmp_vid = 0, cnt = 0;
+ fal_vlan_t *vlan_entry = (fal_vlan_t *) (ioctl_buf + rtn_size);
+
+ while (1)
+ {
+ arg_val[0] = SW_API_VLAN_NEXT;
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = tmp_vid;
+ arg_val[4] = (a_uint32_t) vlan_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+
+ tmp_vid = vlan_entry->vid;
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+#endif
+
+
+sw_error_t
+cmd_show_resv_fdb(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t cnt = 0;
+ a_uint32_t *iterator = ioctl_buf + 1;
+ fal_fdb_entry_t *entry = (fal_fdb_entry_t *) (ioctl_buf + 2);
+
+ *iterator = 0;
+ while (1)
+ {
+ arg_val[0] = SW_API_FDB_RESV_ITERATE;
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = (a_uint32_t) iterator;
+ arg_val[4] = (a_uint32_t) entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ cnt++;
+ dprintf("\n");
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+
+sw_error_t
+cmd_show_host(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t cnt = 0;
+ fal_host_entry_t *host_entry = (fal_host_entry_t *) (ioctl_buf + sizeof(sw_error_t) / 4);
+
+ aos_mem_zero(host_entry, sizeof (fal_host_entry_t));
+ host_entry->entry_id = FAL_NEXT_ENTRY_FIRST_ID;
+ arg_val[0] = SW_API_IP_HOST_NEXT;
+
+ while (1)
+ {
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = 0;
+ arg_val[4] = (a_uint32_t) host_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_show_intfmac(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t cnt = 0;
+ fal_intf_mac_entry_t *intfmac_entry = (fal_intf_mac_entry_t *) (ioctl_buf + sizeof(sw_error_t) / 4);
+
+ aos_mem_zero(intfmac_entry, sizeof (fal_intf_mac_entry_t));
+ intfmac_entry->entry_id = FAL_NEXT_ENTRY_FIRST_ID;
+ arg_val[0] = SW_API_IP_INTF_ENTRY_NEXT;
+
+ while (1)
+ {
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = 0;
+ arg_val[4] = (a_uint32_t) intfmac_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_show_pubaddr(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t cnt = 0;
+ fal_nat_pub_addr_t *pubaddr_entry = (fal_nat_pub_addr_t *) (ioctl_buf + sizeof(sw_error_t) / 4);
+
+ aos_mem_zero(pubaddr_entry, sizeof (fal_nat_pub_addr_t));
+ pubaddr_entry->entry_id = FAL_NEXT_ENTRY_FIRST_ID;
+ arg_val[0] = SW_API_PUB_ADDR_ENTRY_NEXT;
+
+ while (1)
+ {
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = 0;
+ arg_val[4] = (a_uint32_t) pubaddr_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+
+sw_error_t
+cmd_show_nat(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t cnt = 0;
+ fal_nat_entry_t *nat_entry = (fal_nat_entry_t *) (ioctl_buf + sizeof(sw_error_t) / 4);
+
+ aos_mem_zero(nat_entry, sizeof (fal_nat_entry_t));
+ nat_entry->entry_id = FAL_NEXT_ENTRY_FIRST_ID;
+ arg_val[0] = SW_API_NAT_NEXT;
+
+ while (1)
+ {
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = 0;
+ arg_val[4] = (a_uint32_t) nat_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+
+sw_error_t
+cmd_show_napt(a_uint32_t *arg_val)
+{
+ sw_error_t rtn;
+ a_uint32_t cnt = 0;
+ fal_napt_entry_t *napt_entry = (fal_napt_entry_t *) (ioctl_buf + sizeof(sw_error_t) / 4);
+
+ aos_mem_zero(napt_entry, sizeof (fal_napt_entry_t));
+ napt_entry->entry_id = FAL_NEXT_ENTRY_FIRST_ID;
+ arg_val[0] = SW_API_NAPT_NEXT;
+
+ while (1)
+ {
+ arg_val[1] = (a_uint32_t) ioctl_buf;
+ arg_val[2] = get_devid();
+ arg_val[3] = 0;
+ arg_val[4] = (a_uint32_t) napt_entry;
+
+ rtn = cmd_exec_api(arg_val);
+ if ((SW_OK != rtn) || (SW_OK != (sw_error_t) (*ioctl_buf)))
+ {
+ break;
+ }
+ cnt++;
+ }
+
+ if((rtn != SW_OK) && (rtn != SW_NO_MORE))
+ cmd_print_error(rtn);
+ else
+ dprintf("\ntotal %d entries\n", cnt);
+
+ return SW_OK;
+}
+
+