[][openwrt][mt7988][app][Add utility for configuring Mxl series ethernet switchs]
[Description]
Add the 'ethswbox' utility for configuring Mxl series ethernet switchs.
The commands currently supported and successfully verified are as follows:
(1). ./fapi-int-gphy-read phy=0x0 mmd=0x0 reg=0x2
(2). ./fapi-int-gphy-write phy=0x0 mmd=0x7 reg=0x3c data=0x2
(3). ./ssb_smdio_download mxl86282c_1122_1137_1136_0035_signed_dsa_smdio_xfi.bin
[Release-log]
N/A
Change-Id: I6d9d49b4384dbee0343e06270356c7bd942744b3
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9033056
diff --git a/feed/app/ethswbox/Makefile b/feed/app/ethswbox/Makefile
new file mode 100644
index 0000000..d8819df
--- /dev/null
+++ b/feed/app/ethswbox/Makefile
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ethswbox
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/package-defaults.mk
+
+define Package/ethswbox
+ TITLE:=Mxl series Ethernet Switch Configuration Utility
+ SECTION:=MTK Properties
+ CATEGORY:=MTK Properties
+ SUBMENU:=Applications
+endef
+
+define Package/ethswbox/description
+ This package provides utility to control Mxl series switches
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CC)" \
+ CFLAGS="$(TARGET_CFLAGS) -Wall -Wextra" \
+ LDFLAGS="$(TARGET_LDFLAGS)"
+endef
+
+define Package/ethswbox/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/ethswbox $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ethswbox))
diff --git a/feed/app/ethswbox/src/Makefile b/feed/app/ethswbox/src/Makefile
new file mode 100644
index 0000000..0756c79
--- /dev/null
+++ b/feed/app/ethswbox/src/Makefile
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0-or-later */
+#
+
+# Include directories
+INCLUDES := -Iexample/cli/cmds \
+ -Iexample/cli/ \
+ -Iexample/fapi \
+ -Iexample/os \
+ -Iexample \
+ -Iswitch_hostapi/include/gpy \
+ -Iswitch_hostapi/include/gswip \
+ -Iswitch_hostapi/src \
+ -Iswitch_ioctl/src
+
+# Source files
+SRCS := $(wildcard example/cli/cmds/*.c) \
+ $(wildcard example/cli/*.c) \
+ $(wildcard example/fapi/*.c) \
+ $(wildcard switch_ioctl/src/*.c) \
+ switch_hostapi/src/gsw_api.c \
+ switch_hostapi/src/gsw_cli_common.c \
+ switch_hostapi/src/host_adapt.c \
+ switch_hostapi/src/host_api_impl.c \
+ switch_hostapi/src/host_smdio_ssb.c \
+ switch_hostapi/src/mdio_relay.c \
+ switch_hostapi/src/sys_misc.c
+
+# Define the C object files
+OBJS := $(SRCS:.c=.o)
+
+# Define the name of the executable file
+TARGET := ethswbox
+
+.PHONY: clean
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $^
+
+%.o: %.c
+ $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
+
+clean:
+ rm -f $(OBJS) $(TARGET)
diff --git a/feed/app/ethswbox/src/example/CMakeLists.txt b/feed/app/ethswbox/src/example/CMakeLists.txt
new file mode 100644
index 0000000..303d705
--- /dev/null
+++ b/feed/app/ethswbox/src/example/CMakeLists.txt
@@ -0,0 +1,86 @@
+cmake_minimum_required(VERSION 3.1)
+project(EthSwBox VERSION 1.0.0
+ DESCRIPTION "Ethernet SW Toolbox for RPI4 Standalone MxL862xxEthTool"
+ LANGUAGES C)
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
+ ${CMAKE_CURRENT_SOURCE_DIR})
+
+
+
+#####################
+# OS directory #
+#####################
+SET (os_DIR os)
+#add_library (os ${os_SRCS})
+
+
+#####################
+# Example directory #
+#####################
+SET (example_DIR .)
+
+
+#####################
+# CLI directory #
+#####################
+SET (cli_DIR cli)
+SET (cli_SRCS ${cli_DIR}/cmds/cmds.c
+ ${cli_DIR}/cmds/cmds_fapi.c
+ ${cli_DIR}/cmds/cmds_apps_ssb.c
+ )
+
+add_library (cli ${cli_SRCS})
+
+
+#########################
+# FAPI directory #
+#########################
+SET (fapi_DIR fapi)
+SET (fapi_SRCS ${fapi_DIR}/fapi_gsw_hostapi_mdio_relay.c
+ ${fapi_DIR}/fapi_gsw_hostapi.c)
+
+add_library (fapi ${fapi_SRCS})
+
+
+####################
+# GSW HOSTAPI directory #
+####################
+SET (gsw_hostapi_DIR ../switch_hostapi)
+
+SET (gsw_hostapi_SRCS ${gsw_hostapi_DIR}/src/gsw_api.c
+ ${gsw_hostapi_DIR}/src/host_adapt.c
+ ${gsw_hostapi_DIR}/src/host_api_impl.c
+ ${gsw_hostapi_DIR}/src/mdio_relay.c
+ ${gsw_hostapi_DIR}/src/gsw_cli_common.c
+ ${gsw_hostapi_DIR}/src/sys_misc.c
+ ${gsw_hostapi_DIR}/src/host_smdio_ssb.c
+ )
+add_library (gsw_hostapi ${gsw_hostapi_SRCS})
+
+
+#########################
+# Includes path #
+#########################
+include_directories (${example_DIR}
+ ${fapi_DIR}
+ ${cli_DIR}
+ ${cli_DIR}/cmds
+ ${gsw_hostapi_DIR}/src
+ ${gsw_hostapi_DIR}/include/gpy
+ ${gsw_hostapi_DIR}/include/gswip
+ ${os_DIR}
+ )
+
+
+#########################
+# Definition #
+#########################
+#add_definitions(-DCONFIG_GSWIP_EVLAN -DCONFIG_GSWIP_MAC -DCONFIG_GSWIP_MCAST -DCONFIG_GSWIP_STP)
+
+
+#############################
+# ethswbox application #
+#############################
+add_executable(ethswbox ${cli_DIR}/ethswbox.c)
+target_link_libraries(ethswbox cli fapi gsw_hostapi)
diff --git a/feed/app/ethswbox/src/example/LICENSE b/feed/app/ethswbox/src/example/LICENSE
new file mode 100644
index 0000000..71f3550
--- /dev/null
+++ b/feed/app/ethswbox/src/example/LICENSE
@@ -0,0 +1,370 @@
+This source code is distributed under a dual license of GPL and BSD (3-clause).
+Please choose the appropriate license for your intended usage.
+
+1. BSD license (3-clause BSD license)
+
+Copyright (c) 2020, MaxLinear, Inc.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+2. GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/feed/app/ethswbox/src/example/cli/cmds/cmds.c b/feed/app/ethswbox/src/example/cli/cmds/cmds.c
new file mode 100644
index 0000000..08ddf3c
--- /dev/null
+++ b/feed/app/ethswbox/src/example/cli/cmds/cmds.c
@@ -0,0 +1,173 @@
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+/**
+ \file cmds.c
+*/
+
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "os_types.h"
+
+#include "cmds.h"
+#include "cmds_fapi.h"
+#include "cmds_apps_ssb.h"
+
+
+/* ========================================================================== */
+/* Function prototypes */
+/* ========================================================================== */
+static CmdArgs_t* cmds_update_args (int prmc, char *name, char *prmv[]);
+static unsigned long int string2val (char *s);
+static void cmds_help (void);
+
+
+
+/* command arguments */
+static CmdArgs_t cmds_Args;
+
+static CmdArgs_t* cmds_update_args (int prmc, char *name, char *prmv[])
+{
+ int i;
+ memset (&cmds_Args, 0, sizeof (cmds_Args));
+
+ for (i = 0; i < ARG_COUNT; i++)
+ {
+ if (prmc > i)
+ {
+ cmds_Args.prmvi[i] = (int)string2val(prmv[i]);
+ cmds_Args.prmvs[i] = prmv[i];
+ }
+ else
+ break;
+ }
+
+ cmds_Args.name = name;
+ cmds_Args.prmc = prmc;
+
+ return &cmds_Args;
+}
+
+
+/*
+ * string2val:
+ * hexadecimal -> 0x[0-9 AaBbCcDdEeFf]
+ * decimal -> [0-9]
+ * illegal: return 0;
+ */
+static unsigned long int string2val (char *s)
+{
+ int base = 10;
+ char *p = s;
+
+ /* hexadecimal value start with 0x */
+ if (s[0] == '0' && s[1] == 'x')
+ {
+ base = 16;
+ p += 2;
+
+ for ( ; *p; p++)
+ {
+ if ((*p < '0' || *p > 'f') || (*p > '9' && *p < 'A') || (*p > 'F' && *p < 'a'))
+ {
+ printf ("string2val: Illegal hexadecimal value!\n");
+ return 0;
+ }
+ }
+ }
+ else
+ {
+ /* otherwise decimal value */
+ base = 10;
+ for ( ; *p; p++)
+ {
+ if ((*p < '0' || *p > '9'))
+ {
+ return 0;
+ }
+ }
+ }
+
+ /* return the value according to base 10 or 16 */
+ return strtoul (s, &p, base);
+}
+
+
+
+
+OS_boolean_t cmds(char *name, int prmc, char *prmv[],
+ int *err)
+{
+ OS_boolean_t api_executed;
+ int ret;
+ CmdArgs_t* pCmdArgs;
+
+ pCmdArgs = cmds_update_args (prmc, name, prmv);
+
+ if (cmds_fapi (pCmdArgs, &ret) == OS_TRUE)
+ {
+ return ret;
+ }
+ if (cmds_ssb (pCmdArgs, &ret) == OS_TRUE)
+ {
+ return ret;
+ }
+
+ ret = OS_SUCCESS;
+ api_executed = OS_TRUE;
+
+ /*****************************************
+ * CLI CMD *
+ *****************************************/
+ if ((strcmp(name, "cmds-help") == 0 ) || (strcmp(name, "cmds-?") == 0))
+ {
+ cmds_help ();
+ }
+
+
+ /***************
+ * No command *
+ ***************/
+ else
+ {
+ api_executed = OS_FALSE;
+ }
+
+ *err = ret;
+ return api_executed;
+}
+
+
+int cmds_symlink_set (void)
+{
+ int ret = 0;
+
+ /* Create cmds symbolic links */
+ ret |= cmds_fapi_symlink_set ();
+ ret |= cmds_ssb_symlink_set ();
+ return ret;
+}
+
+
+static void cmds_help (void)
+{
+ printf ("+------------------------------------------------------------------+\n");
+ printf ("| HELP ! |\n");
+ printf ("| Ethernet Software Toolbox (%s) |\n", ETHSWBOX_VERSION_STR);
+ printf ("| |\n");
+ printf ("| CMDS |\n");
+ printf ("+------------------------------------------------------------------+\n");
+ printf ("| |\n");
+ printf ("+------------------------------------------------------------------+\n");
+ printf ("\n");
+}
\ No newline at end of file
diff --git a/feed/app/ethswbox/src/example/cli/cmds/cmds.h b/feed/app/ethswbox/src/example/cli/cmds/cmds.h
new file mode 100644
index 0000000..d01b72a
--- /dev/null
+++ b/feed/app/ethswbox/src/example/cli/cmds/cmds.h
@@ -0,0 +1,48 @@
+#ifndef _CMDS_H
+#define _CMDS_H
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+/**
+
+ \file cmds.h
+
+*/
+
+#include "ethswbox_version.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+/* ========================================================================== */
+/* Function prototypes */
+/* ========================================================================== */
+
+extern OS_boolean_t cmds(char *name, int prmc, char *prmv[], int *err);
+extern int cmds_symlink_set (void);
+
+
+#define ARG_COUNT 50
+/* Global command arguments */
+typedef struct {
+ char *name;
+ int prmc;
+ int prmvi[ARG_COUNT];
+ char*prmvs[ARG_COUNT];
+} CmdArgs_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CMDS_H */
diff --git a/feed/app/ethswbox/src/example/cli/cmds/cmds_apps_ssb.c b/feed/app/ethswbox/src/example/cli/cmds/cmds_apps_ssb.c
new file mode 100644
index 0000000..6e9c85f
--- /dev/null
+++ b/feed/app/ethswbox/src/example/cli/cmds/cmds_apps_ssb.c
@@ -0,0 +1,112 @@
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+/**
+ \file cmds_lif.c
+ Implements CLI commands for lif mdio
+
+*/
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "os_types.h"
+
+#include "cmds.h"
+#include "cmds_apps_ssb.h"
+#include "host_smdio_ssb.h"
+
+
+/* ========================================================================== */
+/* Function prototypes */
+/* ========================================================================== */
+static void cmds_ssb_help (void);
+
+
+
+
+OS_boolean_t cmds_ssb (CmdArgs_t* pArgs, int *err)
+{
+ OS_boolean_t api_executed;
+ int32_t ret;
+
+ if (pArgs == NULL)
+ {
+ *err = OS_ERROR;
+ return OS_TRUE;
+ }
+
+ ret = OS_SUCCESS;
+ api_executed = OS_TRUE;
+
+
+ /******************************************
+ * ssb CLI cmds *
+ ******************************************/
+
+ if ((strcmp(pArgs->name, "cmds-lif-help") == 0 ) || (strcmp(pArgs->name, "cmds-lif-?") == 0))
+ {
+ cmds_ssb_help ();
+ }
+
+ /***************************************
+ * cmds_ssb: *
+ * - ssb-read-file *
+ * ************************************/
+
+ else if (strcmp(pArgs->name, "ssb_smdio_download") == 0)
+ {
+ char* file_to_read;
+ unsigned char *pdata;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: ssb_smdio_download\n");
+ printf ("file_path: Path to File\n");
+
+ goto goto_end_help;
+ }
+ file_to_read = pArgs->prmvs [0];
+
+ ssb_load(file_to_read);
+ }
+
+
+
+ /***************
+ * No command *
+ ***************/
+ else
+ {
+ api_executed = OS_FALSE;
+ }
+
+goto_end_help:
+ *err = ( int)ret;
+ return api_executed;
+}
+
+
+int cmds_ssb_symlink_set (void)
+{
+ system ("ln -sf ./ethswbox ssb_smdio_download");
+ return OS_SUCCESS;
+}
+
+
+static void cmds_ssb_help (void)
+{
+ printf ("+------------------------------------------------------------------+\n");
+ printf ("| HELP ! |\n");
+ printf ("| |\n");
+ printf ("+------------------------------------------------------------------+\n");
+ printf ("| ssb_smdio_download : Load FW |\n");
+ printf ("\n");
+}
diff --git a/feed/app/ethswbox/src/example/cli/cmds/cmds_apps_ssb.h b/feed/app/ethswbox/src/example/cli/cmds/cmds_apps_ssb.h
new file mode 100644
index 0000000..aabdb41
--- /dev/null
+++ b/feed/app/ethswbox/src/example/cli/cmds/cmds_apps_ssb.h
@@ -0,0 +1,34 @@
+#ifndef _CMDS_APPS_SSB_H
+#define _CMDS_APPS_SSB_H
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+/**
+
+ \file cmd_apps_ssb.h
+
+*/
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* ========================================================================== */
+/* Function prototypes */
+/* ========================================================================== */
+extern OS_boolean_t cmds_ssb (CmdArgs_t* pArgs, int *err);
+extern int cmds_ssb_symlink_set (void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/feed/app/ethswbox/src/example/cli/cmds/cmds_fapi.c b/feed/app/ethswbox/src/example/cli/cmds/cmds_fapi.c
new file mode 100644
index 0000000..0de4862
--- /dev/null
+++ b/feed/app/ethswbox/src/example/cli/cmds/cmds_fapi.c
@@ -0,0 +1,3111 @@
+
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+/**
+ \file cmds_fapi.c
+ Implements CLI commands for lif mdio
+
+*/
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "os_types.h"
+
+#include "cmds.h"
+#include "cmds_fapi.h"
+#include "host_adapt.h"
+#include "fapi_gsw_hostapi.h"
+#include "fapi_gsw_hostapi_mdio_relay.h"
+
+#define slif_lib ""
+
+/* ========================================================================== */
+/* Function prototypes */
+/* ========================================================================== */
+static void cmds_fapi_help (void);
+
+
+OS_boolean_t cmds_fapi (CmdArgs_t* pArgs, int *err)
+{
+ OS_boolean_t api_executed;
+ int32_t ret;
+
+ if (pArgs == NULL)
+ {
+ *err = OS_ERROR;
+ return OS_TRUE;
+ }
+
+ ret = OS_SUCCESS;
+ api_executed = OS_TRUE;
+
+ /******************************************
+ * lif CLI cmds *
+ ******************************************/
+
+ if ((strcmp(pArgs->name, "cmds-fapi-help") == 0 ) || (strcmp(pArgs->name, "cmds-gsw-?") == 0))
+ {
+ cmds_fapi_help ();
+ }
+
+ /***************************************
+ * gsw_API: *
+ * - api-gsw-internal-read *
+ * - api-gsw-internal-write *
+ * - api-gsw-get-links *
+ * - api-gsw-read *
+ * - api-gsw-write *
+ * ************************************/
+
+ else if (strcmp(pArgs->name, "fapi-int-gphy-write") == 0)
+ {
+
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 4)
+ {
+ printf ("Usage: fapi-int-gphy-write phy=<> mmd=<> reg=<reg> data=<>\n");
+ printf ("phy: phy id\n");
+ printf ("mmd: mmd addres\n");
+ printf ("reg: mdio register\n");
+ printf ("data: value to write\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+
+ api_gsw_get_links(slib);
+ ret = fapi_int_gphy_write(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-int-gphy-read") == 0)
+ {
+
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 3)
+ {
+ printf ("Usage: fapi-int-gphy-read phy=<> mmd=<> reg=<reg>\n");
+ printf ("phy: phy id\n");
+ printf ("mmd: mmd addres\n");
+ printf ("reg: mdio register\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+
+ api_gsw_get_links(slib);
+ ret = fapi_int_gphy_read(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-ext-mdio-write") == 0)
+ {
+
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 4)
+ {
+ printf ("Usage: fapi-ext-mdio-write phy=<> mmd=<> reg=<reg> data=<>\n");
+ printf ("phy: phy address\n");
+ printf ("mmd: mmd addres\n");
+ printf ("reg: mdio register\n");
+ printf ("data: value to write\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+
+ api_gsw_get_links(slib);
+ ret = fapi_ext_mdio_write(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-ext-mdio-read") == 0)
+ {
+
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 3)
+ {
+ printf ("Usage: fapi-ext-mdio-read phy=<> mmd=<> reg=<reg>\n");
+ printf ("phy: phy address\n");
+ printf ("mmd: mmd addres\n");
+ printf ("reg: mdio register\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+
+ api_gsw_get_links(slib);
+ ret = fapi_ext_mdio_read(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-ext-mdio-mod") == 0)
+ {
+
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 4)
+ {
+ printf ("Usage: fapi-ext-mdio-write phy=<> mmd=<> reg=<reg> mask=<> data=<>\n");
+ printf ("phy: phy address\n");
+ printf ("mmd: mmd addres\n");
+ printf ("reg: mdio register\n");
+ printf ("mask: mask\n");
+ printf ("data: data to write\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+
+ api_gsw_get_links(slib);
+ ret = fapi_ext_mdio_mod(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-int-gphy-mod") == 0)
+ {
+
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 3)
+ {
+ printf ("Usage: fapi-ext-mdio-read phy=<> mmd=<> reg=<reg> mask=<> data=<>\n");
+ printf ("phy: phy id\n");
+ printf ("mmd: mmd addres\n");
+ printf ("reg: mdio register\n");
+ printf ("mask: mask\n");
+ printf ("data: data to write\n");
+
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+
+ api_gsw_get_links(slib);
+ ret = fapi_int_gphy_mod(pArgs->prmc, pArgs->prmvs);
+ }
+
+
+ else if (strcmp(pArgs->name, "fapi-GSW-RegisterGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-RegisterGet nRegAddr=<reg>\n");
+ printf ("reg: register\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_RegisterGet(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-RegisterSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-RegisterSet nRegAddr=<reg> nData=<data>\n");
+ printf ("reg: register\n");
+ printf ("data: data to write\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_RegisterSet(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-RegisterMod") == 0)
+ {
+
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-RegisterMod nRegAddr=<reg> nData=<data> nMask=<mask>\n");
+ printf ("nRegAddr: register\n");
+ printf ("nData: data to write\n");
+ printf ("nMask: mask\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_RegisterMod(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-PortLinkCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PortLinkCfgGet nPortId=<port>\n");
+ printf ("port: port index <1-8>\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PortLinkCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-PortLinkCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PortLinkCfgSet nPortId=<port> [bDuplexForce=<> eDuplex=<> bSpeedForce=<> eSpeed=<> bLinkForce=<> eLink=<> eMII_Mode=<> eMII_Type=<> eClkMode=<> bLPI=<>]\n");
+ printf ("port: port index <1-8>\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PortLinkCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-RMON-Clear") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-RMON-Clear nRmonId=<ID> eRmonType=<TYPE>\n");
+ printf ("ID: RMON Counters Identifier\n");
+ printf ("TYPE: RMON Counters Type\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_RMON_Clear(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-MonitorPortCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MonitorPortCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-MonitorPortCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MonitorPortCfgSet nPortId=<port> nSubIfId=<ID>\n");
+ printf ("port: port index <1-8>\n");
+ printf ("ID: Monitoring Sub-IF id\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MonitorPortCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-PortCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-PortCfgGet nPortId=<port>\n");
+ printf ("port: port index <1-8>\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_PortCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-PortCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-PortCfgSet nPortId=<port> eClassMode=<CLASS> nTrafficClass=<TR>\n");
+ printf ("port: port index <1-8>\n");
+ printf ("eClassMode: Select the packet header field\n");
+ printf ("nTrafficClass: Default port priority\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_PortCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-DSCP-ClassGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_DSCP_ClassGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-DSCP-ClassSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-DSCP-ClassSet nTrafficClass=<TC> nDSCP=<DSCP>\n");
+ printf ("nTrafficClass: Configures the DSCP to traffic class mapping\n");
+ printf ("nDSCP: DSCP to drop precedence assignment\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_DSCP_ClassSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-PCP-ClassGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_PCP_ClassGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-PCP-ClassSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-PCP-ClassSet nTrafficClass=<TC> nPCP=<priority>\n");
+ printf ("nTrafficClass: Configures the PCP to traffic class mapping\n");
+ printf ("nPCP: priority to drop precedence assignment\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_PCP_ClassSet(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-SVLAN-PCP-ClassGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_SVLAN_PCP_ClassGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-SVLAN-PCP-ClassSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-SVLAN-PCP-ClassSet nTrafficClass=<TC> nPCP=<priority>\n");
+ printf ("nTrafficClass: Configures the SVLAN PCP to traffic class mapping\n");
+ printf ("nPCP: priority to drop precedence assignment\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_SVLAN_PCP_ClassSet(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-ShaperCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-ShaperCfgGet nRateShaperId=<Id>\n");
+ printf ("id: Rate shaper index\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_ShaperCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-ShaperCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-ShaperCfgSet nRateShaperId=<Id> bEnable=<En> nCbs=<CB> nRate=<Rt>\n");
+ printf ("id: Rate shaper index\n");
+ printf ("En: Enable/Disable the rate shaper\n");
+ printf ("CB: Committed Burst Size\n");
+ printf ("Rt: Rate [kbit/s]\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_ShaperCfgSet(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-ShaperQueueGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-ShaperQueueGet nQueueId=<Id>\n");
+ printf ("id: Rate shaper index\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_ShaperQueueGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-ShaperQueueAssign") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-ShaperQueueAssign nQueueId=<QId> nRateShaperId=<RId>\n");
+ printf ("QId: Queue index\n");
+ printf ("RId: Rate shaper index\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_ShaperQueueAssign(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-ShaperQueueDeassign") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-ShaperQueueDeassign nQueueId=<QId> nRateShaperId=<RId>\n");
+ printf ("QId: Queue index\n");
+ printf ("RId: Rate shaper index\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_ShaperQueueDeassign(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-SchedulerCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-SchedulerCfgGet nQueueId=<QId>\n");
+ printf ("QId: Queue index\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_SchedulerCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-SchedulerCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-SchedulerCfgSet nQueueId=<QId> eType=<Type> nWeight=<We>\n");
+ printf ("QId: Queue index\n");
+ printf ("Type: Scheduler Type\n");
+ printf ("We: Weight in Token. Parameter used for WFQ configuration\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_SchedulerCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-WredCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_WredCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-WredCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-WredCfgSet eProfile=<Prof> eMode=<Md> eThreshMode=<THR> nRed_Min=<RMin> nRed_Max=<RMax> nYellow_Min=<YMin> nYellow_Max=<YMax> nGreen_Min=<GMin> nGreen_Max=<GMax>\n");
+ printf ("Prof: Drop Probability Profile\n");
+ printf ("Md: Automatic or Manual Mode of Thresholds Config\n");
+ printf ("THR: WRED Threshold Mode Config\n");
+ printf ("RMin: WRED Red Threshold Min\n");
+ printf ("RMax: WRED Red Threshold Max\n");
+ printf ("YMin: WRED Yellow Threshold Min\n");
+ printf ("YMax: WRED Yellow Threshold Max\n");
+ printf ("GMin: WRED Green Threshold Min\n");
+ printf ("GMax: WRED Green Threshold Max\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_WredCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-WredQueueCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-WredQueueCfgSet nQueueId=<QId>\n");
+ printf ("QId: Queue Index\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_WredQueueCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-WredQueueCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-WredQueueCfgSet nQueueId=<QId> nRed_Min=<RMin> nRed_Max=<RMax> nYellow_Min=<YMin> nYellow_Max=<YMax> nGreen_Min=<GMin> nGreen_Max=<GMax>\n");
+ printf ("QId: Queue Index\n");
+ printf ("RMin: WRED Red Threshold Min\n");
+ printf ("RMax: WRED Red Threshold Max\n");
+ printf ("YMin: WRED Yellow Threshold Min\n");
+ printf ("YMax: WRED Yellow Threshold Max\n");
+ printf ("GMin: WRED Green Threshold Min\n");
+ printf ("GMax: WRED Green Threshold Max\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_WredQueueCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-WredPortCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-WredPortCfgGet nPortId=<port>\n");
+ printf ("port: Port Index\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_WredPortCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-WredPortCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-WredPortCfgSet nPortId=<port> nRed_Min=<RMin> nRed_Max=<RMax> nYellow_Min=<YMin> nYellow_Max=<YMax> nGreen_Min=<GMin> nGreen_Max=<GMax>\n");
+ printf ("port: Port Index\n");
+ printf ("RMin: WRED Red Threshold Min\n");
+ printf ("RMax: WRED Red Threshold Max\n");
+ printf ("YMin: WRED Yellow Threshold Min\n");
+ printf ("YMax: WRED Yellow Threshold Max\n");
+ printf ("GMin: WRED Green Threshold Min\n");
+ printf ("GMax: WRED Green Threshold Max\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_WredPortCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-TrunkingCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_TrunkingCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-TrunkingCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-TrunkingCfgSet bIP_Src=<bIP_Src> bIP_Dst=<bIP_Dst> bMAC_Src=<bMAC_Src> bMAC_Dst=<bMAC_Dst> bSrc_Port=<bSrc_Port> bDst_Port=<bDst_Port>\n");
+ printf ("bIP_Src: MAC source address Use\n");
+ printf ("bIP_Dst: MAC destination address Use\n");
+ printf ("bMAC_Src: MAC source address Use\n");
+ printf ("bMAC_Dst: MAC destination address Use\n");
+ printf ("bSrc_Port: TCP/UDP source Port Use\n");
+ printf ("bDst_Port: TCP/UDP Destination Port Use\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_TrunkingCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-MAC-TableClear") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MAC_TableClear(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-MAC-TableClear-Cond") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MAC-TableClear-Cond eType=<> nPortId=<>\n");
+ printf ("eType: MAC table clear type\n");
+ printf ("nPortId: Physical port id\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+
+ ret = fapi_GSW_MAC_TableCondClear(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-CfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_CfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-CfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-CfgSet bIP_Src=<bIP_Src> bIP_Dst=<bIP_Dst> bMAC_Src=<bMAC_Src> bMAC_Dst=<bMAC_Dst> bSrc_Port=<bSrc_Port> bDst_Port=<bDst_Port>\n");
+ printf ("eMAC_TableAgeTimer: MAC table aging timer\n");
+ printf ("nAgeTimer: MAC table aging timer in seconds\n");
+ printf ("nMaxPacketLen: Maximum Ethernet packet length\n");
+ printf ("bLearningLimitAction: Automatic MAC address table learning limitation {False: Drop/True: Forward}\n");
+ printf ("bMAC_LockingAction: Accept or discard MAC port locking violation packets {False: Drop/True: Forward}\n");
+ printf ("bMAC_SpoofingAction: Accept or discard MAC spoofing and port MAC locking violation packets {False: Drop/True: Forward}\n");
+ printf ("bDst_bPauseMAC_ModeSrcPort: Pause frame MAC source address mode\n");
+ printf ("nPauseMAC_Src: Pause frame MAC source address\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_CfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-MAC-TableEntryRemove") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MAC-TableEntryRemove nFId=<FId> nMAC=<MAC> nTci=<Tci>\n");
+ printf ("FId: Filtering Identifier (FID)\n");
+ printf ("MAC: MAC Address to be removed from the table\n");
+ printf ("Tci: TCI for (GSWIP-3.2) B-Step\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MAC_TableEntryRemove(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-MAC-TableEntryQuery") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 2)
+ {
+ printf ("Usage: fapi-GSW-TableEntryQuery nFId=<FId> nMAC=<MAC> nTci=<Tci> nFilterFlag=<Flag>\n");
+ printf ("FId: Filtering Identifier (FID)\n");
+ printf ("MAC: MAC Address to be removed from the table\n");
+ printf ("Tci: TCI for (GSWIP-3.2) B-Step\n");
+ printf ("Flag: Source/Destination MAC address filtering flag {Value 0 - not filter, 1 - source address filter, 2 - destination address filter, 3 - both source and destination filter}\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MAC_TableEntryQuery(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-FlowctrlCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_FlowctrlCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-FlowctrlCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-FlowctrlCfgSet nFlowCtrlNonConform_Min=<NCMin> nFlowCtrlNonConform_Max=<NCMax> nFlowCtrlConform_Min=<CMin> nFlowCtrlConform_Max=<CMax>\n");
+ printf ("NCMin: Global Buffer Non Conforming Flow Control Threshold Minimum\n");
+ printf ("NCMax: Global Buffer Non Conforming Flow Control Threshold Maximum\n");
+ printf ("CMin: Global Buffer Conforming Flow Control Threshold Minimum\n");
+ printf ("CMax: Global Buffer Conforming Flow Control Threshold Maximum\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_FlowctrlCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-FlowctrlPortCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-FlowctrlPortCfgGet nPortId=<port>\n");
+ printf ("port: Ethernet Port number\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_FlowctrlPortCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-FlowctrlPortCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-FlowctrlPortCfgSet nPortId=<port> nFlowCtrl_Min=<Min> nFlowCtrl_Max=<Max>\n");
+ printf ("port: Ethernet Port number\n");
+ printf ("Min: Ingress Port occupied Buffer Flow Control Threshold Minimum\n");
+ printf ("Max: Ingress Port occupied Buffer Flow Control Threshold Maximum\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_FlowctrlPortCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-MAC-TableEntryAdd") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MAC-TableEntryAdd\n");
+ printf ("nFId=<> : Filtering Identifier (FID)\n");
+ printf ("nPortId=<> : Ethernet Port number (zero-based counting)\n");
+ printf ("nAgeTimer=<> : Aging Time, given in multiples of 1 second in a range\n");
+ printf ("bStaticEntry=<> : Static Entry (value will be aged out if the entry is not set to static)\n");
+ printf ("nTrafficClass=<> : Egress queue traffic class\n");
+ printf ("bIgmpControlled=<> : Packet is marked as IGMP controlled if destination MAC address matches MAC in this entry\n");
+ printf ("nFilterFlag=<> : Source/Destination MAC address filtering flag\n");
+ printf ("nSVLAN_Id=<> : STAG VLAN Id. Only applicable in case SVLAN support is enabled on the device\n");
+ printf ("nSubIfId=<> : In GSWIP-3.1, this field is sub interface ID for WLAN logical port\n");
+ printf ("nMAC=<> : MAC Address to add to the table\n");
+ printf ("nAssociatedMAC=<> : Associated Mac address\n");
+ printf ("nTci=<> : TCI for (GSWIP-3.2) B-Step\n");
+ printf ("nPortMapValueIndex0=<> : Bridge Port Map 0\n");
+ printf ("nPortMapValueIndex1=<> : Bridge Port Map 1\n");
+ printf ("nPortMapValueIndex2=<> : Bridge Port Map 2\n");
+ printf ("nPortMapValueIndex3=<> : Bridge Port Map 3\n");
+ printf ("nPortMapValueIndex4=<> : Bridge Port Map 4\n");
+ printf ("nPortMapValueIndex5=<> : Bridge Port Map 5\n");
+ printf ("nPortMapValueIndex6=<> : Bridge Port Map 6\n");
+ printf ("nPortMapValueIndex7=<> : Bridge Port Map 7\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MAC_TableEntryAdd(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-MAC-TableEntryRead") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MAC_TableEntryRead(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-QueuePortGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-QueuePortGet nPortId=<> nTrafficClassId=<> bRedirectionBypass=<> bExtrationEnable=<>\n");
+ printf ("nPortId=<> : Ethernet Port number (zero-based counting)\n");
+ printf ("nTrafficClassId=<> : Traffic Class index\n");
+ printf ("bRedirectionBypass=<> : Queue Redirection bypass Option\n");
+ printf ("bExtrationEnable=<> : Forward CPU (extraction) before external QoS queueing \n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_QueuePortGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-QueuePortSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-QueuePortSet nPortId=<> nTrafficClassId=<> bRedirectionBypass=<> bExtrationEnable=<> eQMapMode=<> nQueueId=<> nRedirectPortId=<> bEnableIngressPceBypass=<> bReservedPortMode=<>\n");
+ printf ("nPortId=<> : Ethernet Port number (zero-based counting)\n");
+ printf ("nTrafficClassId=<> : Traffic Class index\n");
+ printf ("bRedirectionBypass=<> : Queue Redirection bypass Option\n");
+ printf ("bExtrationEnable=<> : Forward CPU (extraction) before external QoS queueing \n");
+ printf ("eQMapMode=<> : Ethernet Port number (zero-based counting)\n");
+ printf ("nQueueId=<> : Traffic Class index\n");
+ printf ("nRedirectPortId=<> : Queue Redirection bypass Option\n");
+ printf ("bEnableIngressPceBypass=<> : Forward CPU (extraction) before external QoS queueing \n");
+ printf ("bReservedPortMode=<> : Ethernet Port number (zero-based counting)\n");
+
+
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_QueuePortSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-BridgePortConfigGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-BridgePortConfigGet nBridgePortId=<> eMask=<>\n");
+ printf ("nBridgePortId=<> : Bridge ID\n");
+ printf ("eMask=<> : Mask for updating/retrieving fields\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_BridgePortConfigGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-BridgePortConfigSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-BridgePortConfigGet\n");
+ printf ("nBridgePortId=<> : Bridge ID\n");
+ printf ("nBridgeId=<> : Bridge ID\n");
+ printf ("bIngressExtendedVlanEnable=<>\n");
+ printf ("nIngressExtendedVlanBlockId=<>\n");
+ printf ("bEgressExtendedVlanEnable=<>\n");
+ printf ("nEgressExtendedVlanBlockId=<>\n");
+ printf ("eIngressMarkingMode=<>\n");
+ printf ("eEgressRemarkingMode=<>\n");
+ printf ("bIngressMeteringEnable=<>\n");
+ printf ("nIngressTrafficMeterId=<>\n");
+ printf ("bEgressMeteringEnable=<>\n");
+ printf ("nEgressTrafficMeterId=<>\n");
+ printf ("bEgressBroadcastSubMeteringEnable=<>\n");
+ printf ("bEgressMulticastSubMeteringEnable=<>\n");
+ printf ("bEgressUnknownMulticastIPSubMeteringEnable=<>\n");
+ printf ("bEgressUnknownMulticastNonIPSubMeteringEnable=<>\n");
+ printf ("bEgressUnknownUnicastSubMeteringEnable=<>\n");
+ printf ("nEgressBroadcastSubMeteringId=<>\n");
+ printf ("nEgressMulticastSubMeteringId=<>\n");
+ printf ("nEgressUnknownMulticastIPSubMeteringId=<>\n");
+ printf ("nEgressUnknownMulticastNonIPSubMeteringId=<>\n");
+ printf ("nEgressUnknownUnicastSubMeteringId=<>\n");
+ printf ("nDestLogicalPortId=<>\n");
+ printf ("nDestSubIfIdGroup=<>\n");
+ printf ("bPmapperEnable=<>\n");
+ printf ("ePmapperMappingMode=<>\n");
+ printf ("nPmapperDestSubIfIdGroup=<>\n");
+ printf ("bBridgePortMapEnable=<>\n");
+ printf ("Index=<>\n");
+ printf ("MapValue=<>\n");
+ printf ("bMcDestIpLookupDisable=<>\n");
+ printf ("bMcSrcIpLookupEnable=<>\n");
+ printf ("bDestMacLookupDisable=<>\n");
+ printf ("bSrcMacLearningDisable=<>\n");
+ printf ("bMacSpoofingDetectEnable=<>\n");
+ printf ("bPortLockEnable=<>\n");
+ printf ("bMacLearningLimitEnable=<>\n");
+ printf ("nMacLearningLimit=<>\n");
+ printf ("bIngressVlanFilterEnable=<>\n");
+ printf ("nIngressVlanFilterBlockId=<>\n");
+ printf ("bBypassEgressVlanFilter1=<>\n");
+ printf ("bEgressVlanFilter1Enable=<>\n");
+ printf ("nEgressVlanFilter1BlockId=<>\n");
+ printf ("bEgressVlanFilter2Enable=<>\n");
+ printf ("nEgressVlanFilter2BlockId=<>\n");
+ printf ("bVlanTagSelection=<>\n");
+ printf ("bVlanSrcMacPriorityEnable=<>\n");
+ printf ("bVlanSrcMacDEIEnable=<>\n");
+ printf ("bVlanSrcMacVidEnable=<>\n");
+ printf ("bVlanDstMacPriorityEnable=<>\n");
+ printf ("bVlanDstMacDEIEnable=<>\n");
+ printf ("bVlanDstMacVidEnable=<>\n");
+ printf ("bVlanBasedMultiCastLookup=<>\n");
+ printf ("bVlanMulticastPriorityEnable=<>\n");
+ printf ("bVlanMulticastDEIEnable=<>\n");
+ printf ("bVlanMulticastVidEnable=<>\n");
+ printf ("bForce=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_BridgePortConfigSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-CtpPortConfigGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-CtpPortConfigGet nLogicalPortId=<> nSubIfIdGroup=<> eMask=<>\n");
+ printf ("nLogicalPortId=<> : Bridge ID\n");
+ printf ("nSubIfIdGroup=<> : Sub interface ID group\n");
+ printf ("eMask=<> : Mask for updating/retrieving fields\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_CtpPortConfigGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-CtpPortConfigSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-CtpPortConfigSet\n");
+ printf ("nLogicalPortId=<>\n");
+ printf ("nSubIfIdGroup=<>\n");
+ printf( "nBridgePortId=<>\n");
+ printf( "bForcedTrafficClass=<>\n");
+ printf( "nDefaultTrafficClass=<>\n");
+ printf( "bIngressExtendedVlanEnable=<>\n");
+ printf( "nIngressExtendedVlanBlockId=<>\n");
+ printf( "bIngressExtendedVlanIgmpEnable=<>\n");
+ printf( "nIngressExtendedVlanBlockIdIgmp=<>\n");
+ printf( "bEgressExtendedVlanEnable=<>\n");
+ printf( "nEgressExtendedVlanBlockId=<>\n");
+ printf( "bEgressExtendedVlanIgmpEnable=<>\n");
+ printf( "nEgressExtendedVlanBlockIdIgmp=<>\n");
+ printf( "bIngressNto1VlanEnable=<>\n");
+ printf( "bEgressNto1VlanEnable=<>\n");
+ printf( "eIngressMarkingMode=<>\n");
+ printf( "eEgressMarkingMode=<>\n");
+ printf( "bEgressMarkingOverrideEnable=<>\n");
+ printf( "eEgressMarkingModeOverride=<>\n");
+ printf( "eEgressRemarkingMode=<>\n");
+ printf( "bIngressMeteringEnable=<>\n");
+ printf( "nIngressTrafficMeterId=<>\n");
+ printf( "bEgressMeteringEnable=<>\n");
+ printf( "nEgressTrafficMeterId=<>\n");
+ printf( "bBridgingBypass=<>\n");
+ printf( "nDestLogicalPortId=<>\n");
+ printf( "nDestSubIfIdGroup=<>\n");
+ printf( "bPmapperEnable=<>\n");
+ printf( "ePmapperMappingMode=<>\n");
+ printf( "nFirstFlowEntryIndex=<>\n");
+ printf( "nNumberOfFlowEntries=<>\n");
+ printf( "bIngressLoopbackEnable=<>\n");
+ printf( "bIngressDaSaSwapEnable=<>\n");
+ printf( "bEgressLoopbackEnable=<>\n");
+ printf( "bEgressDaSaSwapEnable=<>\n");
+ printf( "bIngressMirrorEnable=<>\n");
+ printf( "bEgressMirrorEnable=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_CtpPortConfigSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-BridgeAlloc") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_BridgeAlloc(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-BridgeFree") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-BridgeFree nBridgeId=<>\n");
+ printf ("nBridgeId: Bridge ID (FID) to which this bridge port is associated\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_BridgeFree(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-BridgeConfigGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-BridgeConfigGet nBridgeId=<> eMask=<>\n");
+ printf ("nBridgeId: Bridge ID (FID) to which this bridge port is associated\n");
+ printf ("eMask: Mask\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_BridgeConfigGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-BridgeConfigSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-BridgeConfigSet\n");
+ printf("nBridgeId=<>\n");
+ printf("bMacLearningLimitEnable=<>\n");
+ printf("nMacLearningLimit=<>\n");
+ printf("eForwardBroadcast=<>\n");
+ printf("eForwardUnknownMulticastIp=<>\n");
+ printf("eForwardUnknownMulticastNonIp=<>\n");
+ printf("eForwardUnknownUnicast=<>\n");
+ printf("bBroadcastMeterEnable=<>\n");
+ printf("nBroadcastMeterId=<>\n");
+ printf("bMulticastMeterEnable=<>\n");
+ printf("nMulticastMeterId=<>\n");
+ printf("bUnknownMulticastIpMeterEnable=<>\n");
+ printf("nUnknownMulticastIpMeterId=<>\n");
+ printf("bUnknownMulticastNonIpMeterEnable=<>\n");
+ printf("nUnknownMulticastNonIpMeterId=<>\n");
+ printf("bUnknownUniCastMeterEnable=<>\n");
+ printf("nUnknownUniCastMeterId=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_BridgeConfigSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+
+
+ // ###################
+
+
+ else if (strcmp(pArgs->name, "fapi-GSW-ExtendedVlanAlloc") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-ExtendedVlanAlloc nNumberOfEntries=<>\n");
+ printf ("nNumberOfEntries: Total number of extended VLAN entries are requested\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_ExtendedVlanAlloc(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-ExtendedVlanFree") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-ExtendedVlanFree nExtendedVlanBlockId=<>\n");
+ printf ("nExtendedVlanBlockId: Block Id\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_ExtendedVlanFree(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-ExtendedVlanGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-ExtendedVlanGet\n");
+ printf ("nExtendedVlanBlockId=<>\n");
+ printf ("nEntryIndex=<>\n");
+ printf ("bOriginalPacketFilterMode=<>\n");
+ printf ("eFilter_4_Tpid_Mode=<>\n");
+ printf ("eTreatment_4_Tpid_Mode=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_ExtendedVlanGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-ExtendedVlanSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-ExtendedVlanSet\n");
+ printf("nExtendedVlanBlockId=<>\n");
+ printf("nEntryIndex=<>\n");
+ printf("eOuterVlanFilterVlanType=<>\n");
+ printf("bOuterVlanFilterPriorityEnable=<>\n");
+ printf("nOuterVlanFilterPriorityVal=<>\n");
+ printf("bOuterVlanFilterVidEnable=<>\n");
+ printf("nOuterVlanFilterVidVal=<>\n");
+ printf("eOuterVlanFilterTpid=<>\n");
+ printf("eOuterVlanFilterDei=<>\n");
+ printf("eInnerVlanFilterVlanType=<>\n");
+ printf("bInnerVlanFilterPriorityEnable=<>\n");
+ printf("nInnerVlanFilterPriorityVal=<>\n");
+ printf("bInnerVlanFilterVidEnable=<>\n");
+ printf("nInnerVlanFilterVidVal=<>\n");
+ printf("eInnerVlanFilterTpid=<>\n");
+ printf("eInnerVlanFilterDei=<>\n");
+ printf("eEtherType=<>\n");
+ printf("eRemoveTagAction=<>\n");
+ printf("bOuterVlanActionEnable=<>\n");
+ printf("eOuterVlanActionPriorityMode=<>\n");
+ printf("eOuterVlanActionPriorityVal=<>\n");
+ printf("eOuterVlanActionVidMode=<>\n");
+ printf("eOuterVlanActionVidVal=<>\n");
+ printf("eOuterVlanActionTpid=<>\n");
+ printf("eOuterVlanActioneDei=<>\n");
+ printf("bInnerVlanActionEnable=<>\n");
+ printf("eInnerVlanActionPriorityMode=<>\n");
+ printf("eInnerVlanActionPriorityVal=<>\n");
+ printf("eInnerVlanActionVidMode=<>\n");
+ printf("eInnerVlanActionVidVal=<>\n");
+ printf("eInnerVlanActionTpid=<>\n");
+ printf("eInnerVlanActioneDei=<>\n");
+ printf("bReassignBridgePortEnable=<>\n");
+ printf("nNewBridgePortId=<>\n");
+ printf("bNewDscpEnable=<>\n");
+ printf("nNewDscp=<>\n");
+ printf("bNewTrafficClassEnable=<>\n");
+ printf("nNewTrafficClass=<>\n");
+ printf("bNewMeterEnable=<>\n");
+ printf("sNewTrafficMeterId=<>\n");
+ printf("bLoopbackEnable=<>\n");
+ printf("bDaSaSwapEnable=<>\n");
+ printf("bMirrorEnable=<>\n");
+ printf("bDscp2PcpMapEnable=<>\n");
+ printf("nDscp2PcpMapValue=<>\n");
+ printf("bOriginalPacketFilterMode=<>\n");
+ printf("eFilter_4_Tpid_Mode=<>\n");
+ printf("eTreatment_4_Tpid_Mode=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_ExtendedVlanSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-VlanFilterAlloc") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ if (pArgs->prmc < 3)
+ {
+ printf ("Usage: fapi-GSW-VlanFilterAlloc nNumberOfEntries=<> bDiscardUntagged=<> bDiscardUnmatchedTagged=<>\n");
+ printf ("nNumberOfEntries: Total number of extended VLAN entries are requested\n");
+ printf ("bDiscardUntagged: Discard packet without VLAN tag\n");
+ printf ("bDiscardUnmatchedTagged: Discard packet not matching\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_VlanFilterAlloc(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-VlanFilterFree") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-VlanFilterFree nVlanFilterBlockId=<>\n");
+ printf ("nVlanFilterBlockId: Block Id\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_VlanFilterFree(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-VlanFilterGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-VlanFilterGet nVlanFilterBlockId=<> nEntryIndex=<>\n");
+ printf ("nVlanFilterBlockId: Block Id\n");
+ printf ("nEntryIndex: Entry Index\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_VlanFilterGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-VlanFilterSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-VlanFilterSet nVlanFilterBlockId=<> nEntryIndex=<> eVlanFilterMask=<> nVal=<> bDiscardMatched=<>\n");
+ printf("nVlanFilterBlockId=<>\n");
+ printf("nEntryIndex=<>\n");
+ printf("eVlanFilterMask=<>\n");
+ printf("nVal=<>\n");
+ printf("bDiscardMatched=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_VlanFilterSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-STP-PortCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-STP-PortCfgGet nPortId=<>\n");
+ printf ("nPortId: Port Id\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_STP_PortCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-STP-PortCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 2)
+ {
+ printf ("Usage: fapi-GSW-STP-PortCfgSet nPortId=<> ePortState=<>\n");
+ printf("nPortId=<>\n");
+ printf("ePortState=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_STP_PortCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-STP-BPDU-RuleGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_STP_BPDU_RuleGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-STP-BPDU-RuleSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-STP-BPDU-RuleSet eForwardPort=<> nForwardPortId=<>\n");
+ printf("eForwardPort=<>\n");
+ printf("nForwardPortId=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_STP_BPDU_RuleSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-Debug-RMON-Port-Get") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 2)
+ {
+ printf ("Usage: fapi-GSW-Debug-RMON-Port-Get nPortId=<> ePortType=<> b64BitMode=<>\n");
+ printf("nPortId=<>\n");
+ printf("ePortType=<>\n");
+ printf("b64BitMode=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_Debug_RMON_Port_Get(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-QoS-MeterCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-MeterCfgGet nMeterId=<> \n");
+ printf("nMeterId: Meter index (zero-based counting)\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_MeterCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+
+else if (strcmp(pArgs->name, "fapi-GSW-QoS-MeterCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-MeterCfgSet\n");
+ printf("nMeterId: Meter index (zero-based counting)\n");
+ printf("bEnable=<>\n");
+ printf("eMtrType=<>\n");
+ printf("nCbs=<>\n");
+ printf("nEbs=<>\n");
+ printf("nCbs_ls=<>\n");
+ printf("nEbs_ls=<>\n");
+ printf("nRate=<>\n");
+ printf("nPiRate=<>\n");
+ printf("cMeterName=<>\n");
+ printf("nColourBlindMode=<>\n");
+ printf("bPktMode=<>\n");
+ printf("bLocalOverhd=<>\n");
+ printf("nLocaloverhd=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_MeterCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+
+
+else if (strcmp(pArgs->name, "fapi-GSW-MAC-DefaultFilterGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MAC-DefaultFilterGet eType=<>\n");
+ printf("eType: MAC Address Filter Type\n");
+
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MAC_DefaultFilterGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-MAC-DefaultFilterSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MAC-DefaultFilterSet eType=<>\n");
+ printf("eType: MAC Address Filter Type\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MAC_DefaultFilterSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-CTP-PortAssignmentGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-CTP-PortAssignmentGet nLogicalPortId=<>\n");
+ printf("nLogicalPortId=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_CTP_PortAssignmentGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-CTP-PortAssignmentSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-CTP-PortAssignmentSet\n");
+ printf("nLogicalPortId=<>\n");
+ printf("nFirstCtpPortId=<>\n");
+ printf("nNumberOfCtpPort=<>\n");
+ printf("eMode=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_CTP_PortAssignmentSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PMAC-GLBL-CfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PMAC-GLBL-CfgSet\n");
+ printf("nPmacId=<>\n");
+ printf("bRxFCSDis=<>\n");
+ printf("eProcFlagsEgCfg=<>\n");
+ printf("nBslThreshold0=<>\n");
+ printf("nBslThreshold1=<>\n");
+ printf("nBslThreshold2=<>\n");
+ printf("bAPadEna=<>\n");
+ printf("bPadEna=<>\n");
+ printf("bVPadEna=<>\n");
+ printf("bSVPadEna=<>\n");
+ printf("bTxFCSDis=<>\n");
+ printf("bIPTransChkRegDis=<>\n");
+ printf("bIPTransChkVerDis=<>\n");
+ printf("bJumboEna=<>\n");
+ printf("nMaxJumboLen=<>\n");
+ printf("nJumboThreshLen=<>\n");
+ printf("bLongFrmChkDis=<>\n");
+ printf("eShortFrmChkType=<>\n");
+ printf("bProcFlagsEgCfgEna=<>\n");
+
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PMAC_GLBL_CfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PMAC-GLBL-CfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PMAC-GLBL-CfgGet\n");
+ printf("nPmacId=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PMAC_GLBL_CfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PMAC-BM-CfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 2)
+ {
+ printf ("Usage: fapi-GSW-PMAC-BM-CfgSet\n");
+ printf("nTxDmaChanId=<>\n");
+ printf("nPmacId=<>\n");
+ printf("txQMask=<>\n");
+ printf("rxPortMask=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PMAC_BM_CfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PMAC-BM-CfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 2)
+ {
+ printf ("Usage: fapi-GSW-PMAC-BM-CfgGet\n");
+ printf("nTxDmaChanId=<>\n");
+ printf("nPmacId=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PMAC_BM_CfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PMAC-EG-CfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PMAC-EG-CfgSet\n");
+ printf("nPmacId=<>\n");
+ printf("bRedirEnable=<>\n");
+ printf("bBslSegmentDisable=<>\n");
+ printf("nBslTrafficClass=<>\n");;
+ printf("bResDW1Enable=<>\n");
+ printf("bRes2DW0Enable=<>\n");
+ printf("bRes1DW0Enable=<>\n");
+ printf("bTCEnable=<>\n");
+ printf("nDestPortId=<>\n");
+ printf("bProcFlagsSelect=<>\n");
+ printf("nTrafficClass=<>\n");
+ printf("nFlowIDMsb=<>\n");
+ printf("bMpe1Flag=<>\n");
+ printf("bMpe2Flag=<>\n");
+ printf("bEncFlag=<>\n");
+ printf("bDecFlag=<>\n");
+ printf("nRxDmaChanId=<>\n");
+ printf("bRemL2Hdr=<>\n");
+ printf("numBytesRem=<>\n");
+ printf("bFcsEna=<>\n");
+ printf("bPmacEna=<>\n");
+ printf("nResDW1=<>\n");
+ printf("nRes1DW0=<>\n");
+ printf("nRes2DW0=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PMAC_EG_CfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PMAC-EG-CfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PMAC-EG-CfgGet\n");
+ printf("nPmacId=<>\n");
+ printf("nDestPortId=<>\n");
+ printf("bProcFlagsSelect=<>\n");
+ printf("nTrafficClass=<>\n");
+ printf("nFlowIDMsb=<>\n");
+ printf("bMpe1Flag=<>\n");
+ printf("bMpe2Flag=<>\n");
+ printf("bEncFlag=<>\n");
+ printf("bDecFlag=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PMAC_EG_CfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PMAC-IG-CfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PMAC-IG-CfgGet\n");
+ printf("nPmacId=<>\n");
+ printf("nTxDmaChanId=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PMAC_IG_CfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PMAC-IG-CfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PMAC-IG-CfgSet\n");
+ printf("nPmacId=<>\n");
+ printf("nTxDmaChanId=<>\n");
+ printf("bErrPktsDisc=<>\n");
+ printf("bPmapDefault=<>\n");
+ printf("bPmapEna=<>\n");
+ printf("bClassDefault=<>\n");
+ printf("bClassEna=<>\n");
+ printf("eSubId=<>\n");
+ printf("bSpIdDefault=<>\n");
+ printf("bPmacPresent=<>\n");
+ printf("defPmacHdr=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PMAC_IG_CfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+else if (strcmp(pArgs->name, "fapi-GSW-PceRuleRead") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PceRuleRead\n");
+ printf("pattern.nIndex=<>\n");
+ printf("nLogicalPortId=<>\n");
+ printf("nSubIfIdGroup=<>\n");
+ printf("region=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PceRuleRead(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PceRuleWrite") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PceRuleWrite\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PceRuleWrite(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PceRuleDelete") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PceRuleDelete\n");
+ printf("pattern.nIndex=<>\n");
+ printf("nLogicalPortId=<>\n");
+ printf("nSubIfIdGroup=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PceRuleDelete(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PceRuleAlloc") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PceRuleAlloc\n");
+ printf("num_of_rules=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PceRuleAlloc(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PceRuleFree") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PceRuleFree\n");
+ printf("blockid=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PceRuleFree(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PceRuleEnable") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PceRuleEnable\n");
+ printf("nLogicalPortId=<>\n");
+ printf("nSubIfIdGroup=<>\n");
+ printf("region=<>\n");
+ printf("pattern.nIndex=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PceRuleEnable(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-PceRuleDisable") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PceRuleDisable\n");
+ printf("nLogicalPortId=<>\n");
+ printf("nSubIfIdGroup=<>\n");
+ printf("region=<>\n");
+ printf("pattern.nIndex=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PceRuleDisable(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+else if (strcmp(pArgs->name, "fapi-GSW-MulticastRouterPortAdd") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MulticastRouterPortAdd\n");
+ printf("nPortId=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MulticastRouterPortAdd(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-MulticastRouterPortRemove") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MulticastRouterPortRemove\n");
+ printf("nPortId=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MulticastRouterPortRemove(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-MulticastSnoopCfgGet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MulticastSnoopCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-MulticastSnoopCfgSet") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MulticastSnoopCfgSet\n");
+ printf("eIGMP_Mode=<>\n");
+ printf("bCrossVLAN=<>\n");
+ printf("eForwardPort=<>\n");
+ printf("nForwardPortId=<>\n");
+ printf("nClassOfService=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MulticastSnoopCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-MulticastRouterPortRead") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MulticastRouterPortRead(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+else if (strcmp(pArgs->name, "fapi-GSW-MulticastTableEntryAdd") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MulticastTableEntryRemove\n");
+ printf ("nPortId=<> : Bridge Port ID\n");
+ printf ("nSubIfId=<> : Sub-Interface Id\n");
+ printf ("eIPVersion=<> : Selection to use IPv4 or IPv6.\n");
+ printf ("uIP_Gda=<> : Group Destination IP address (GDA).\n");
+ printf ("uIP_Gsa=<> : Group Source IP address.\n");
+ printf ("nFID=<> : Filtering Identifier (FID)\n");
+ printf ("bExclSrcIP=<> : Includes or Excludes Source IP.\n");
+ printf ("eModeMember=<> : Group member filter mode.\n");
+ printf ("nTci=<> : TCI for (GSWIP-3.2) B-Step\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MulticastTableEntryAdd(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-MulticastTableEntryRead") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MulticastTableEntryRead(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-MulticastTableEntryRemove") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-MulticastTableEntryRemove\n");
+ printf ("nPortId=<> : Bridge Port ID\n");
+ printf ("nSubIfId=<> : Sub-Interface Id\n");
+ printf ("eIPVersion=<> : Selection to use IPv4 or IPv6.\n");
+ printf ("uIP_Gda=<> : Group Destination IP address (GDA).\n");
+ printf ("uIP_Gsa=<> : Group Source IP address.\n");
+ printf ("nFID=<> : Filtering Identifier (FID)\n");
+ printf ("bExclSrcIP=<> : Includes or Excludes Source IP.\n");
+ printf ("eModeMember=<> : Group member filter mode.\n");
+ printf ("nTci=<> : TCI for (GSWIP-3.2) B-Step\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_MulticastTableEntryRemove(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-FW-Update") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_FW_Update(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-FW-Version") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_FW_Version(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-PVT-Meas") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PVT_Meas(pArgs->prmc, pArgs->prmvs);
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-Delay") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-Delay\n");
+ printf ("nMsec=<> : Delay Time in milliseconds\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_Delay(pArgs->prmc, pArgs->prmvs);
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-GPIO-Configure") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-GPIO-Configure\n");
+ printf ("nEnableMaskIndex0=<> : GPIO Enable Mask Index 0\n");
+ printf ("nEnableMaskIndex1=<> : GPIO Enable Mask Index 1\n");
+ printf ("nEnableMaskIndex2=<> : GPIO Enable Mask Index 2\n");
+ printf ("nAltSel0Index0=<> : GPIO Alt Select 0 Index 0\n");
+ printf ("nAltSel0Index1=<> : GPIO Alt Select 0 Index 1\n");
+ printf ("nAltSel0Index2=<> : GPIO Alt Select 0 Index 2\n");
+ printf ("nAltSel1Index0=<> : GPIO Alt Select 1 Index 0\n");
+ printf ("nAltSel1Index1=<> : GPIO Alt Select 1 Index 1\n");
+ printf ("nAltSel1Index2=<> : GPIO Alt Select 1 Index 2\n");
+ printf ("nDirIndex0=<> : GPIO Direction Index 0\n");
+ printf ("nDirIndex1=<> : GPIO Direction Index 1\n");
+ printf ("nDirIndex2=<> : GPIO Direction Index 2\n");
+ printf ("nOutValueIndex0=<> : GPIO Out Value Index 0\n");
+ printf ("nOutValueIndex1=<> : GPIO Out Value Index 1\n");
+ printf ("nOutValueIndex2=<> : GPIO Out Value Index 2\n");
+ printf("nTimeoutValue=<> : GPIO Timeout in milliseconds\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_GPIO_Configure(pArgs->prmc, pArgs->prmvs);
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-Reboot") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_Reboot(pArgs->prmc, pArgs->prmvs);
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-SysReg-Rd") == 0)
+ {
+ char* slib ="";
+ uint16_t reg = 0;
+ GSW_Device_t* gsw_dev;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-SysReg-Rd addr=<addr>\n");
+ printf ("reg: register address\n");
+ goto goto_end_help;
+ }
+
+ slib = slif_lib;
+
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_SysReg_Rd(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-VlanCounterMapSet") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-VlanCounterMapSet\n");
+ printf("nCounterIndex=<>\n");
+ printf("nCtpPortId=<>\n");
+ printf("bPriorityEnable=<>\n");
+ printf("nPriorityVal=<>\n");
+ printf("bVidEnable=<>\n");
+ printf("nVidVal=<>\n");
+ printf("bVlanTagSelectionEnable=<>\n");
+ printf("eVlanCounterMappingType=<>\n");
+ printf("eVlanCounterMappingFilterType=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_VlanCounterMapSet(pArgs->prmc, pArgs->prmvs);
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-VlanCounterMapGet") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-VlanCounterMapGet\n");
+ printf("nCounterIndex=<>\n");
+ printf("eVlanCounterMappingType=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_VlanCounterMapGet(pArgs->prmc, pArgs->prmvs);
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-Vlan-RMON-Get") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-Vlan-RMON-Get\n");
+ printf("nVlanCounterIndex=<>\n");
+ printf("eVlanRmonType=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_Vlan_RMON_Get(pArgs->prmc, pArgs->prmvs);
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-Vlan-RMON-Clear") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-Vlan-RMON-Clear\n");
+ printf("nVlanCounterIndex=<>\n");
+ printf("eVlanRmonType=<>\n");
+ printf("eClearAll=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_Vlan_RMON_Clear(pArgs->prmc, pArgs->prmvs);
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-Vlan-RMONControl-Set") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-Vlan-RMONControl-Set\n");
+ printf("bVlanRmonEnable=<>\n");
+ printf("bIncludeBroadCastPktCounting=<>\n");
+ printf("nVlanLastEntry=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_Vlan_RMONControl_Set(pArgs->prmc, pArgs->prmvs);
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-Vlan-RMONControl-Get") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_Vlan_RMONControl_Get(pArgs->prmc, pArgs->prmvs);
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-PBB-TunnelTempate-Config-Get") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PBB-TunnelTempate-Config-Get\n");
+ printf ("nTunnelTemplateId:\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PBB_TunnelTempate_Config_Get(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-PBB-TunnelTempate-Config-Set") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PBB-TunnelTempate-Config-Set\n");
+ printf ("nTunnelTemplateId:\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PBB_TunnelTempate_Config_Set(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-PBB-TunnelTempate-Alloc") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PBB_TunnelTempate_Alloc(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-PBB-TunnelTempate-Free") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PBB-TunnelTempate-Free\n");
+ printf ("nTunnelTemplateId:\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PBB_TunnelTempate_Free(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-CPU-PortCfgGet") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-CPU-PortCfgGet\n");
+ printf ("nPortId:\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_CPU_PortCfgGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-CPU-PortCfgSet") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-CPU-PortCfgSet\n");
+ printf ("nPortId:\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_CPU_PortCfgSet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-RMON-MeterGet") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-RMON-MeterGet\n");
+ printf ("nMeterId:\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_RMON_MeterGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-RMON-FlowGet") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-RMON-FlowGet\n");
+ printf("bIndexd=<>\n");
+ printf("nIndex=<>\n");
+ printf("nPortId=<>\n");
+ printf("nFlowId=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_RMON_FlowGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+ else if (strcmp(pArgs->name, "fapi-GSW-RMON-TFlowClear") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-RMON-TFlowClear\n");
+ printf("bIndexd=<>\n");
+ printf("nIndex=<>\n");
+ printf("nPortId=<>\n");
+ printf("nFlowId=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_RMON_FlowGet(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-BridgePortAlloc") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_BridgePortAlloc(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-BridgePortFree") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-BridgePortFree\n");
+ printf("nBridgePortId:<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_BridgePortFree(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-UnFreeze") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_UnFreeze(pArgs->prmc, pArgs->prmvs);
+
+ }
+ else if (strcmp(pArgs->name, "fapi-GSW-Freeze") == 0)
+ {
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_Freeze(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+else if (strcmp(pArgs->name, "fapi-GSW-QoS-MeterFree") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-QoS-MeterFree nMeterId=<>\n");
+ printf("nMeterId: Meter index (zero-based counting)\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_MeterFree(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-QoS-MeterAlloc") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_QoS_MeterAlloc(pArgs->prmc, pArgs->prmvs);
+
+ }
+
+else if (strcmp(pArgs->name, "fapi-GSW-PMAC-RMON-Get") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-PMAC-RMON-Get\n");
+ printf("nPmacId=<>\n");
+ printf("nPortId=<>\n");
+ printf("b64BitMode=<>\n");
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_PMAC_RMON_Get(pArgs->prmc, pArgs->prmvs);
+
+ }
+else if (strcmp(pArgs->name, "fapi-GSW-Debug-PMAC-RMON-Get-All") == 0)
+ {
+
+ char* slib ="";
+ uint16_t phy = 0;
+ GSW_Device_t* gsw_dev;
+ uint16_t myval;
+
+ if (pArgs->prmc < 1)
+ {
+ printf ("Usage: fapi-GSW-Debug-PMAC-RMON-Get-All\n");
+ printf("nPmacId=<>\n");
+ printf("Start=<>\n");
+ printf("End=<>\n");
+
+ goto goto_end_help;
+ }
+ slib = slif_lib;
+ api_gsw_get_links(slib);
+ ret = fapi_GSW_Debug_PMAC_RMON_Get_All(pArgs->prmc, pArgs->prmvs);
+
+ }
+ // else if (strcmp(pArgs->name, "fapi-GSW-Debug-RMON-Port-GetAll") == 0)
+ // {
+ // char* slib ="";
+ // uint16_t phy = 0;
+ // GSW_Device_t* gsw_dev;
+ // uint16_t myval;
+
+ // if (pArgs->prmc < 1)
+ // {
+ // printf ("Usage: fapi-GSW-Debug-RMON-Port-GetAll ePortType=<> Start=<> End=<>\n");
+ // printf ("ePortType: Port Type\n");
+ // printf ("Start: Start Port\n");
+ // printf ("End: End Port\n");
+ // goto goto_end_help;
+ // }
+ // slib = slif_lib;
+ // api_gsw_get_links(slib);
+ // ret = fapi_GSW_DEBUG_RMON_Port_Get_All(pArgs->prmc, pArgs->prmvs);
+
+ // }
+
+
+ /***************
+ * No command *
+ ***************/
+ else
+ {
+ api_executed = OS_FALSE;
+ }
+
+goto_end_help:
+ *err = ( int)ret;
+ return api_executed;
+}
+
+
+
+
+int cmds_fapi_symlink_set (void)
+{
+ system ("ln -sf ./ethswbox fapi-GSW-RegisterGet");
+ system ("ln -sf ./ethswbox fapi-GSW-RegisterMod");
+ system ("ln -sf ./ethswbox fapi-GSW-RegisterSet");
+ system ("ln -sf ./ethswbox fapi-GSW-PortLinkCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-PortLinkCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-RMON-Clear");
+ system ("ln -sf ./ethswbox fapi-GSW-MonitorPortCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-MonitorPortCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-PortCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-PortCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-DSCP-ClassGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-DSCP-ClassSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-PCP-ClassGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-PCP-ClassSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-SVLAN-PCP-ClassGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-SVLAN-PCP-ClassSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-ShaperCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-ShaperCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-ShaperQueueGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-ShaperQueueAssign");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-ShaperQueueDeassign");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-SchedulerCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-SchedulerCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-WredCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-WredCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-WredQueueCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-WredQueueCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-WredPortCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-WredPortCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-TrunkingCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-TrunkingCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-MAC-TableClear");
+ system ("ln -sf ./ethswbox fapi-GSW-MAC-TableClear-Cond");
+ system ("ln -sf ./ethswbox fapi-GSW-CfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-CfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-MAC-TableEntryRemove");
+ system ("ln -sf ./ethswbox fapi-GSW-MAC-TableEntryQuery");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-FlowctrlCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-FlowctrlCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-FlowctrlPortCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-FlowctrlPortCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-MAC-TableEntryAdd");
+ system ("ln -sf ./ethswbox fapi-GSW-MAC-TableEntryRead");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-QueuePortSet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-QueuePortGet");
+ system ("ln -sf ./ethswbox fapi-GSW-BridgePortConfigGet");
+ system ("ln -sf ./ethswbox fapi-GSW-BridgePortConfigSet");
+ system ("ln -sf ./ethswbox fapi-GSW-CtpPortConfigGet");
+ system ("ln -sf ./ethswbox fapi-GSW-CtpPortConfigSet");
+ system ("ln -sf ./ethswbox fapi-int-gphy-read");
+ system ("ln -sf ./ethswbox fapi-int-gphy-write");
+ system ("ln -sf ./ethswbox fapi-ext-mdio-read");
+ system ("ln -sf ./ethswbox fapi-ext-mdio-write");
+ system ("ln -sf ./ethswbox fapi-int-gphy-mod");
+ system ("ln -sf ./ethswbox fapi-ext-mdio-mod");
+ system ("ln -sf ./ethswbox fapi-GSW-BridgeConfigGet");
+ system ("ln -sf ./ethswbox fapi-GSW-BridgeConfigSet");
+ system ("ln -sf ./ethswbox fapi-GSW-BridgeFree");
+ system ("ln -sf ./ethswbox fapi-GSW-BridgeAlloc");
+ system ("ln -sf ./ethswbox fapi-GSW-ExtendedVlanGet");
+ system ("ln -sf ./ethswbox fapi-GSW-ExtendedVlanSet");
+ system ("ln -sf ./ethswbox fapi-GSW-ExtendedVlanFree");
+ system ("ln -sf ./ethswbox fapi-GSW-ExtendedVlanAlloc");
+ system ("ln -sf ./ethswbox fapi-GSW-VlanFilterGet");
+ system ("ln -sf ./ethswbox fapi-GSW-VlanFilterSet");
+ system ("ln -sf ./ethswbox fapi-GSW-VlanFilterFree");
+ system ("ln -sf ./ethswbox fapi-GSW-VlanFilterAlloc");
+ system ("ln -sf ./ethswbox fapi-GSW-STP-PortCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-STP-PortCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-STP-BPDU-RuleSet");
+ system ("ln -sf ./ethswbox fapi-GSW-STP-BPDU-RuleGet");
+ system ("ln -sf ./ethswbox fapi-GSW-Debug-RMON-Port-Get");
+
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-MeterCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-MeterCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-MAC-DefaultFilterGet");
+ system ("ln -sf ./ethswbox fapi-GSW-MAC-DefaultFilterSet");
+ system ("ln -sf ./ethswbox fapi-GSW-CTP-PortAssignmentGet");
+ system ("ln -sf ./ethswbox fapi-GSW-CTP-PortAssignmentSet");
+
+ system ("ln -sf ./ethswbox fapi-GSW-PMAC-GLBL-CfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-PMAC-GLBL-CfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-PMAC-BM-CfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-PMAC-BM-CfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-PMAC-EG-CfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-PMAC-EG-CfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-PMAC-IG-CfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-PMAC-IG-CfgSet");
+
+ system ("ln -sf ./ethswbox fapi-GSW-PceRuleDelete");
+ system ("ln -sf ./ethswbox fapi-GSW-PceRuleRead");
+ system ("ln -sf ./ethswbox fapi-GSW-PceRuleWrite");
+ system ("ln -sf ./ethswbox fapi-GSW-PceRuleAlloc");
+ system ("ln -sf ./ethswbox fapi-GSW-PceRuleFree");
+ system ("ln -sf ./ethswbox fapi-GSW-PceRuleEnable");
+ system ("ln -sf ./ethswbox fapi-GSW-PceRuleDisable");
+
+ system ("ln -sf ./ethswbox fapi-GSW-MulticastRouterPortAdd");
+ system ("ln -sf ./ethswbox fapi-GSW-MulticastRouterPortRemove");
+ system ("ln -sf ./ethswbox fapi-GSW-MulticastSnoopCfgGet");
+ system ("ln -sf ./ethswbox fapi-GSW-MulticastSnoopCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-MulticastRouterPortRead");
+ system ("ln -sf ./ethswbox fapi-GSW-MulticastTableEntryAdd");
+ system ("ln -sf ./ethswbox fapi-GSW-MulticastTableEntryRead");
+ system ("ln -sf ./ethswbox fapi-GSW-MulticastTableEntryRemove");
+
+ system ("ln -sf ./ethswbox fapi-GSW-FW-Update");
+ system ("ln -sf ./ethswbox fapi-GSW-FW-Version");
+ system ("ln -sf ./ethswbox fapi-GSW-PVT-Meas");
+ system ("ln -sf ./ethswbox fapi-GSW-Delay");
+ system ("ln -sf ./ethswbox fapi-GSW-GPIO-Configure");
+ system ("ln -sf ./ethswbox fapi-GSW-Reboot");
+ system ("ln -sf ./ethswbox fapi-GSW-SysReg-Rd");
+
+ system ("ln -sf ./ethswbox fapi-GSW-VlanCounterMapSet");
+ system ("ln -sf ./ethswbox fapi-GSW-VlanCounterMapGet");
+ system ("ln -sf ./ethswbox fapi-GSW-Vlan-RMON-Get");
+ system ("ln -sf ./ethswbox fapi-GSW-Vlan-RMON-Clear");
+ system ("ln -sf ./ethswbox fapi-GSW-Vlan-RMONControl-Set");
+ system ("ln -sf ./ethswbox fapi-GSW-Vlan-RMONControl-Get");
+
+ system ("ln -sf ./ethswbox fapi-GSW-PBB-TunnelTempate-Config-Set");
+ system ("ln -sf ./ethswbox fapi-GSW-PBB-TunnelTempate-Config-Get");
+ system ("ln -sf ./ethswbox fapi-GSW-PBB-TunnelTempate-Alloc");
+ system ("ln -sf ./ethswbox fapi-GSW-PBB-TunnelTempate-Free");
+ // system ("ln -sf ./ethswbox fapi-GSW-Debug-RMON-Port-GetAll");
+ system ("ln -sf ./ethswbox fapi-GSW-CPU-PortCfgSet");
+ system ("ln -sf ./ethswbox fapi-GSW-CPU-PortCfgGet");
+
+ system ("ln -sf ./ethswbox fapi-GSW-RMON-MeterGet");
+ system ("ln -sf ./ethswbox fapi-GSW-RMON-FlowGet");
+ system ("ln -sf ./ethswbox fapi-GSW-RMON-TFlowClear");
+
+ system ("ln -sf ./ethswbox fapi-GSW-BridgePortAlloc");
+ system ("ln -sf ./ethswbox fapi-GSW-BridgePortFree");
+ system ("ln -sf ./ethswbox fapi-GSW-Freeze");
+ system ("ln -sf ./ethswbox fapi-GSW-UnFreeze");
+
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-MeterFree");
+ system ("ln -sf ./ethswbox fapi-GSW-QoS-MeterAlloc");
+
+ system ("ln -sf ./ethswbox fapi-GSW-PMAC-RMON-Get");
+ system ("ln -sf ./ethswbox fapi-GSW-Debug-PMAC-RMON-Get-All");
+
+ return OS_SUCCESS;
+}
+
+
+static void cmds_fapi_help (void)
+{
+ printf ("+-----------------------------------------------------------------------+\n");
+ printf ("| HELP ! |\n");
+ printf ("| CMDS - gsw |\n");
+ printf ("| |\n");
+ printf ("+-----------------------------------------------------------------------+\n");
+ printf ("| fapi_GSW_RegisterGet |\n");
+ printf ("\n");
+}
diff --git a/feed/app/ethswbox/src/example/cli/cmds/cmds_fapi.h b/feed/app/ethswbox/src/example/cli/cmds/cmds_fapi.h
new file mode 100644
index 0000000..fb450de
--- /dev/null
+++ b/feed/app/ethswbox/src/example/cli/cmds/cmds_fapi.h
@@ -0,0 +1,35 @@
+
+#ifndef _CMDS_FAPI_H
+#define _CMDS_FAPI_H
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+/**
+
+ \file cmds_fapi.h
+
+*/
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* ========================================================================== */
+/* Function prototypes */
+/* ========================================================================== */
+extern OS_boolean_t cmds_fapi (CmdArgs_t* pArgs, int *err);
+extern int cmds_fapi_symlink_set (void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CMDS_FAPI_H */
diff --git a/feed/app/ethswbox/src/example/cli/ethswbox.c b/feed/app/ethswbox/src/example/cli/ethswbox.c
new file mode 100644
index 0000000..adec61a
--- /dev/null
+++ b/feed/app/ethswbox/src/example/cli/ethswbox.c
@@ -0,0 +1,86 @@
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+/**
+
+ \file ethswbox.c
+
+*/
+#include "os_types.h"
+#include "ethswbox_version.h"
+
+#include "cmds.h"
+
+int ethswbox_main(int argc, char *argv[])
+{
+ int ret = OS_ERROR;
+ int prmc;
+ char **prmv;
+
+ char *name = argv[0];
+
+ if (strchr (name, '/') != NULL) do
+ {
+ /* move behind next / */
+ name = strchr (name, '/') + 1;
+
+ if (name == NULL)
+ return ret;
+ }
+ while (strlen(name) > 0 && strchr (name, '/') != NULL);
+ if (name == NULL || strcmp(name, "ethswbox") == 0)
+ {
+ printf ("Ethernet SW Toolbox version %s.55 ... Updating symbolic links!\n", ETHSWBOX_VERSION_STR);
+ ret |= cmds_symlink_set ();
+
+ return (int)ret;
+ }
+
+ /* remove the name parameter from the parameter count */
+ prmc = argc;
+ prmc--;
+ prmv = &argv[1];
+ /*
+ name: command name
+ dev: device number
+ prmc: parameter counter without device number
+ prmv: parameters
+ */
+#if 1
+ {
+ int i;
+ printf ("cmd: %s %d: ", name, prmc);
+ for (i = 0; i< prmc; i++)
+ {
+ printf ("%s ",prmv[i]);
+ }
+ printf ("\n");
+ }
+#endif
+
+ /* invoke CLI command parser */
+ if (cmds (name, prmc, prmv, &ret) == OS_TRUE)
+ {
+ goto end;
+ }
+
+end:
+
+ return ret;
+}
+
+
+int main(int argc, char *argv[])
+{
+ int ret = 0;
+ if (argv != NULL)
+ ret = ethswbox_main (argc, argv);
+ return ret;
+}
diff --git a/feed/app/ethswbox/src/example/ethswbox_version.h b/feed/app/ethswbox/src/example/ethswbox_version.h
new file mode 100644
index 0000000..53c9399
--- /dev/null
+++ b/feed/app/ethswbox/src/example/ethswbox_version.h
@@ -0,0 +1,37 @@
+#ifndef __ETHSWBOX_VERSION_H__
+#define __ETHSWBOX_VERSION_H__
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+
+
+/** ETHSWBOX version, major number */
+#define ETHSWBOX_VER_MAJOR 1
+/** ETHSWBOX version, minor number */
+#define ETHSWBOX_VER_MINOR 0
+/** ETHSWBOX version, build number */
+#define ETHSWBOX_VER_STEP 0
+
+#define ETHSWBOX_VERSION_REG(a,b,c,d) (((a)<<24)|((b)<<16)|(c<<8)|(d))
+#define ETHSWBOX_VERSION ETHSWBOX_VERSION_REG(VIT_VER_MAJOR, \
+ ETHSWBOX_VER_MINOR, \
+ ETHSWBOX_VER_STEP)
+
+#ifndef _MKSTR_1
+#define _MKSTR_1(x) #x
+#define _MKSTR(x) _MKSTR_1(x)
+#endif
+
+/** driver version as string */
+#define ETHSWBOX_VERSION_STR _MKSTR(ETHSWBOX_VER_MAJOR) "." \
+ _MKSTR(ETHSWBOX_VER_MINOR) "." \
+ _MKSTR(ETHSWBOX_VER_STEP)
+
+#endif /* __ETHSWBOX_VERSION_H__ */
diff --git a/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi.c b/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi.c
new file mode 100644
index 0000000..5e72d92
--- /dev/null
+++ b/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi.c
@@ -0,0 +1,5836 @@
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+#include <os_types.h>
+#include <gsw_device.h>
+#include <gsw_api.h>
+#include <host_adapt.h>
+#include <gsw_cli_common.h>
+
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+// #include <gsw_priv.h>
+#define lif_id 0
+#define NUM_TC 16
+#define MAX_NUM_OF_DISPLAY_PORTS 2
+
+// #############################################
+static int multicastParamRead(int argc, char *argv[], GSW_multicastTable_t *param)
+{
+ int ipParamCnt1 = 0;
+ int ipParamCnt2 = 0;
+
+ memset(param, 0, sizeof(GSW_multicastTable_t));
+
+ scanParamArg(argc, argv, "nPortId", sizeof(param->nPortId), ¶m->nPortId);
+ scanParamArg(argc, argv, "nSubIfId", sizeof(param->nSubIfId), ¶m->nSubIfId);
+ scanParamArg(argc, argv, "eIPVersion", sizeof(param->eIPVersion), ¶m->eIPVersion);
+ scanParamArg(argc, argv, "eModeMember", sizeof(param->eModeMember), ¶m->eModeMember);
+ scanParamArg(argc, argv, "nFID", sizeof(param->nFID), ¶m->nFID);
+ scanParamArg(argc, argv, "bExclSrcIP", sizeof(param->bExclSrcIP), ¶m->bExclSrcIP);
+
+ if (param->eIPVersion == GSW_IP_SELECT_IPV4) {
+ ipParamCnt1 = scanIPv4_Arg(argc, argv, "uIP_Gda", ¶m->uIP_Gda.nIPv4);
+ ipParamCnt2 = scanIPv4_Arg(argc, argv, "uIP_Gsa", ¶m->uIP_Gsa.nIPv4);
+ } else {
+ ipParamCnt1 = scanIPv6_Arg(argc, argv, "uIP_Gda", param->uIP_Gda.nIPv6);
+ ipParamCnt2 = scanIPv6_Arg(argc, argv, "uIP_Gsa", param->uIP_Gsa.nIPv6);
+ }
+
+ scanParamArg(argc, argv, "nTci", sizeof(param->nTci), ¶m->nTci);
+
+ if ((param->eModeMember != GSW_IGMP_MEMBER_DONT_CARE) &&
+ (ipParamCnt1 == 0) && (ipParamCnt2 == 0))
+ return (-2);
+
+ if (ipParamCnt1 == 0)
+ return (-3);
+
+ return 0;
+}
+
+
+static void dump_multicast_table_entry(GSW_multicastTableRead_t *ptr)
+{
+ char sipaddr[64], dipaddr[64];
+
+// #ifdef CONFIG_NETWORKING
+ if (ptr->eIPVersion == GSW_IP_SELECT_IPV4) {
+ uint32_t dip = htonl(ptr->uIP_Gda.nIPv4);
+
+ inet_ntop(AF_INET, &dip, dipaddr, sizeof(dipaddr));
+ } else {
+ uint16_t dip[8], i;
+
+ for (i = 0; i < ARRAY_SIZE(dip); i++)
+ dip[i] = htons(ptr->uIP_Gda.nIPv6[i]);
+ inet_ntop(AF_INET6, dip, dipaddr, sizeof(dipaddr));
+ }
+// #endif
+ printf(" %39s |", dipaddr);
+
+ if (ptr->eModeMember != GSW_IGMP_MEMBER_DONT_CARE) {
+// #ifdef CONFIG_NETWORKING
+ if (ptr->eIPVersion == GSW_IP_SELECT_IPV4) {
+ uint32_t sip = htonl(ptr->uIP_Gsa.nIPv4);
+
+ inet_ntop(AF_INET, &sip, sipaddr, sizeof(sipaddr));
+ } else {
+ uint16_t sip[8], i;
+
+ for (i = 0; i < ARRAY_SIZE(sip); i++)
+ sip[i] = htons(ptr->uIP_Gsa.nIPv6[i]);
+ inet_ntop(AF_INET6, sip, sipaddr, sizeof(sipaddr));
+ }
+// #endif
+
+ printf(" %39s |", sipaddr);
+ printf(" %11s |", (ptr->eModeMember == GSW_IGMP_MEMBER_INCLUDE) ? "INCLUDE" : "EXCLUDE");
+ } else {
+ printf(" %39s |", "");
+ printf(" %11s |", "DON'T CARE");
+ }
+
+ printf(" %9d |", ptr->hitstatus);
+
+ if (ptr->nTci) {
+ printf(" Pri %d, CFI/Dei %d, ID %d",
+ ((ptr->nTci & 0xE000) >> 13),
+ ((ptr->nTci & 0x1000) >> 12),
+ (ptr->nTci & 0x0FFF));
+ }
+ printf("\n");
+
+}
+
+
+struct _tbl_dump_ {
+ char *tbl_type;
+ char *tbl_name;
+ u32 entries;
+ u32 tbl_addr;
+};
+
+typedef struct {
+ u16 num_key;
+ u16 num_mask;
+ u16 num_val;
+} gsw_pce_tbl_t;
+
+struct _tbl_dump_ tbl_dump_gsw33[] = {
+ {"PCE", "Tflow Table", 512, 0x0F},
+ {"PCE", "Parser Microcode Table", 256, 0x00},
+ {"PCE", "VLANMAP Table", 1024, 0x02},
+ {"PCE", "PPPoE Table", 16, 0x03},
+ {"PCE", "Protocol Table", 32, 0x04},
+ {"PCE", "Flags Table", 64, 0x18},
+ {"PCE", "App Table", 64, 0x05},
+ {"PCE", "IP MSB Table", 64, 0x06},
+ {"PCE", "IP LSB Table", 64, 0x07},
+ {"PCE", "IP Pktlen Table", 16, 0x08},
+ {"PCE", "CTAG Pcp Table", 16, 0x09},//
+ {"PCE", "Dscp Table", 64, 0x0A},
+ {"PCE", "Mac Br Table", 4096, 0x0B},
+ {"PCE", "Mult Sw Table", 1024, 0x0D},//
+ {"PCE", "Mult Hw Table", 64, 0x0E},
+ {"PCE", "Qmap Table", 576, 0x11},//
+ {"PCE", "IGCTP Table", 288, 0x12},
+ {"PCE", "EGCTP Table", 288, 0x13},
+ {"PCE", "IGBRG Table", 128, 0x14},
+ {"PCE", "EGBRG Table", 128, 0x15},
+ {"PCE", "Mac Da Table", 64, 0x16},
+ {"PCE", "Mac Sa Table", 64, 0x17},
+ {"PCE", "BRGCFG Table", 64, 0x19},
+ {"PCE", "Spcp Table", 16, 0x1A},
+ {"PCE", "COLMARK Table", 128, 0x1B},
+ {"PCE", "REMARK Table", 80, 0x1C},
+ {"PCE", "Payload Table", 64, 0x1D},
+ {"PCE", "Extended VLAN Table", 1024, 0x1E},
+ {"PCE", "P-Mapping Table", 292, 0x1F},
+ {"PCE", "Dscp2Pcp Table", 64, 0xC},
+ {"PCE", "PBB Tunnel Table", 256, 0x10},
+};
+
+static const gsw_pce_tbl_t gsw_pce_tbl_33[] = {
+ {0, 0, 4}, {2, 0, 0}, {1, 0, 1}, {1, 0, 0}, {1, 1, 0}, {1, 1, 0}, {4, 4, 0}, {4, 4, 0},
+ {1, 1, 0}, {0, 0, 1}, {0, 0, 1}, {5, 0, 10}, {0, 0, 2}, {20, 0, 10}, {2, 0, 5}, {34, 0, 31},
+ {0, 0, 11}, {0, 0, 1}, {0, 0, 9}, {0, 0, 7}, {0, 0, 27}, {0, 0, 14}, {3, 1, 0}, {3, 1, 0},
+ {1, 1, 0}, {0, 0, 10}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {1, 1, 0}, {4, 0, 6}, {0, 0, 1}
+};
+
+// #############################################################################################################
+
+GSW_return_t fapi_GSW_RegisterMod(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_register_mod_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nRegAddr", sizeof(param.nRegAddr), ¶m.nRegAddr);
+ if (rret < 1){
+ printf("Parameter not Found: nRegAddr\n");
+ return OS_ERROR;
+ }
+ rret = scanParamArg(prmc, prmv, "nData", sizeof(param.nData), ¶m.nData);
+ if (rret < 1){
+ printf("Parameter not Found: nData\n");
+ return OS_ERROR;
+ }
+ rret = scanParamArg(prmc, prmv, "nMask", sizeof(param.nMask), ¶m.nMask);
+ if (rret < 1){
+ printf("Parameter not Found: nMask\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_RegisterMod(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_RegisterMod failed with ret code", ret);
+ else{
+ printf("fapi_GSW_RegisterMod done\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_RegisterGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_register_t Param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nRegAddr", sizeof(Param.nRegAddr), &Param.nRegAddr);
+ if (rret < 1){
+ printf("Parameter not Found: nRegAddr\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_RegisterGet(gsw_dev, &Param);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_RegisterGet failed with ret code", ret);
+ else
+ printf("fapi_GSW_RegisterGet:\n\t reg=%x val=%x\n",Param.nRegAddr ,Param.nData);
+
+ return ret;
+}
+
+
+
+GSW_return_t fapi_GSW_RegisterSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_register_t Param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nRegAddr", sizeof(Param.nRegAddr), &Param.nRegAddr);
+ if (rret < 1){
+ printf("Parameter not Found: nRegAddr\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nData", sizeof(Param.nData), &Param.nData);
+ if (rret < 1){
+ printf("Parameter not Found: nData\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_RegisterSet(gsw_dev, &Param);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_RegisterSet failed with ret code", ret);
+ else
+ printf("fapi_GSW_RegisterSet:\n\t reg=%x val=%x\n",Param.nRegAddr ,Param.nData);
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PortLinkCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_portLinkCfg_t Param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(Param.nPortId), &Param.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PortLinkCfgGet(gsw_dev, &Param);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PortLinkCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_PortLinkCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "nPortId", Param.nPortId);
+ printf("\t%40s:\t%s\n", "bDuplexForce", Param.bDuplexForce ? "true" : "false");
+ printf("\t%40s:\t0x%x\n", "eDuplex", Param.eDuplex);
+ printf("\t%40s:\t%s\n", "bSpeedForce", Param.bSpeedForce ? "true" : "false");
+ printf("\t%40s:\t0x%x\n", "eSpeed", Param.eSpeed);
+ printf("\t%40s:\t%s\n", "bLinkForce", Param.bLinkForce ? "true" : "false");
+ printf("\t%40s:\t0x%x\n", "eLink", Param.eLink);
+ printf("\t%40s:\t0x%x\n", "eMII_Mode", Param.eMII_Mode);
+ printf("\t%40s:\t0x%x\n", "eMII_Type", Param.eMII_Type);
+ printf("\t%40s:\t0x%x\n", " eClkMode", Param.eClkMode);
+ printf("\t%40s:\t%s\n", "bLPI", Param.bLPI ? "true" : "false");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PortLinkCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_portLinkCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PortLinkCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_PortLinkCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv, "bDuplexForce", sizeof(param.bDuplexForce), ¶m.bDuplexForce);
+ scanParamArg(prmc, prmv, "eDuplex", sizeof(param.eDuplex), ¶m.eDuplex);
+ scanParamArg(prmc, prmv, "bSpeedForce", sizeof(param.bSpeedForce), ¶m.bSpeedForce);
+ scanParamArg(prmc, prmv, "eSpeed", sizeof(param.eSpeed), ¶m.eSpeed);
+ scanParamArg(prmc, prmv, "bLinkForce", sizeof(param.bLinkForce), ¶m.bLinkForce);
+ scanParamArg(prmc, prmv, "eLink", sizeof(param.eLink), ¶m.eLink);
+ scanParamArg(prmc, prmv, "eMII_Mode", sizeof(param.eMII_Mode), ¶m.eMII_Mode);
+ scanParamArg(prmc, prmv, "eMII_Type", sizeof(param.eMII_Type), ¶m.eMII_Type);
+ scanParamArg(prmc, prmv, "eClkMode", sizeof(param.eClkMode), ¶m.eClkMode);
+ scanParamArg(prmc, prmv, "bLPI", sizeof(param.bLPI), ¶m.bLPI);
+
+ ret = GSW_PortLinkCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PortLinkCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_PortLinkCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_RMON_Clear(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_RMON_clear_t param = {0};
+
+ scanParamArg(prmc, prmv, "nRmonId", sizeof(param.nRmonId), ¶m.nRmonId);
+ scanParamArg(prmc, prmv, "eRmonType", sizeof(param.eRmonType), ¶m.eRmonType);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_RMON_Clear(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_RMON_Clear failed with ret code", ret);
+ else{
+ printf("fapi_GSW_RMON_Clear done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MonitorPortCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_monitorPortCfg_t param={0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_monitorPortCfg_t));
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MonitorPortCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MonitorPortCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MonitorPortCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MonitorPortCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_monitorPortCfg_t param;
+
+ memset(¶m, 0, sizeof(GSW_monitorPortCfg_t));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MonitorPortCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MonitorPortCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MonitorPortCfgGet done\n");
+ printf("\t%40s:\t0x%x\n", "nPortId", param.nPortId);
+ printf("\t%40s:\t0x%x\n", "nSubIfId", param.nSubIfId);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_QoS_PortCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_portCfg_t Param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(Param.nPortId), &Param.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_PortCfgGet(gsw_dev, &Param);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_PortCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_PortCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "nPortId", Param.nPortId);
+ printf("\t%40s:\t0x%x\n", "eClassMode", Param.eClassMode);
+ printf("\t%40s:\t0x%x\n", "nTrafficClass", Param.nTrafficClass);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_PortCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_portCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_PortCfgGet(gsw_dev, ¶m);
+ if (ret < 0) {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_PortCfgGet failed with ret code", ret);
+ return ret;
+ }
+ else{
+ printf("fapi_GSW_QoS_PortCfgSet done\n");
+ }
+
+ scanParamArg(prmc, prmv, "eClassMode", sizeof(param.eClassMode), ¶m.eClassMode);
+ scanParamArg(prmc, prmv, "nTrafficClass", sizeof(param.nTrafficClass), ¶m.nTrafficClass);
+
+ ret = GSW_QoS_PortCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_PortCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_PortCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_DSCP_ClassGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_DSCP_ClassCfg_t param = {0};
+ int i;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_DSCP_ClassGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_DSCP_ClassGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_DSCP_ClassGet:\n");
+ for (i = 0; i < 64; i++)
+ printf("\tnTrafficClass[%d] = %d\n", i, param.nTrafficClass[i]);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_DSCP_ClassSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_DSCP_ClassCfg_t param = {0};
+ int rret;
+ unsigned char nTrafficClass;
+ unsigned int nDSCP;
+
+
+ rret = scanParamArg(prmc, prmv, "nTrafficClass", sizeof(nTrafficClass), &nTrafficClass);
+ if (rret < 1){
+ printf("Parameter not Found: nTrafficClass\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nDSCP", sizeof(nDSCP), &nDSCP);
+ if (rret < 1){
+ printf("Parameter not Found: nDSCP\n");
+ return OS_ERROR;
+ }
+
+ if (nDSCP >= 64) {
+ printf("ERROR: Given \"nDSCP\" is out of range (63)\n");
+ return (-3);
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_DSCP_ClassGet(gsw_dev, ¶m);
+ if (ret < 0) {
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_DSCP_ClassSet failed with ret code", ret);
+ return ret;
+ }
+ param.nTrafficClass[nDSCP] = nTrafficClass;
+
+ ret = GSW_QoS_DSCP_ClassSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_DSCP_ClassSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_DSCP_ClassSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_PCP_ClassGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_PCP_ClassCfg_t param = {0};
+ int i;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_PCP_ClassGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_PCP_ClassGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_PCP_ClassGet:\n");
+ for (i = 0; i < 16; i++)
+ printf("\tnTrafficClass[%d] = %d\n", i, (int)param.nTrafficClass[i]);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_PCP_ClassSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_PCP_ClassCfg_t param = {0};
+ int rret;
+ unsigned char nTrafficClass;
+ unsigned int nPCP;
+
+ rret = scanParamArg(prmc, prmv, "nTrafficClass", sizeof(nTrafficClass), &nTrafficClass);
+ if (rret < 1){
+ printf("Parameter not Found: nTrafficClass\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nPCP", sizeof(nPCP), &nPCP);
+ if (rret < 1){
+ printf("Parameter not Found: nPCP\n");
+ return OS_ERROR;
+ }
+
+ if (nPCP >= 16) {
+ printf("ERROR: Given \"nPCP\" is out of range (7)\n");
+ return (-3);
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_PCP_ClassGet(gsw_dev, ¶m);
+ if (ret < 0) {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_PCP_ClassGet failed with ret code", ret);
+ return ret;
+ }
+ param.nTrafficClass[nPCP] = nTrafficClass;
+
+ ret = GSW_QoS_PCP_ClassSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_PCP_ClassSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_PCP_ClassSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_SVLAN_PCP_ClassGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_SVLAN_PCP_ClassCfg_t PCP_ClassCfg = {0};
+ int i;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_SVLAN_PCP_ClassGet(gsw_dev, &PCP_ClassCfg);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_SVLAN_PCP_ClassGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_SVLAN_PCP_ClassGet:\n");
+ for (i = 0; i < 16; i++)
+ printf("\tnTrafficClass[%d] = %d\n", i, (int)PCP_ClassCfg.nTrafficClass[i]);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_SVLAN_PCP_ClassSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_SVLAN_PCP_ClassCfg_t PCP_ClassCfg = {0};
+ int rret;
+ unsigned char nTrafficClass;
+ unsigned int nPCP;
+
+ rret = scanParamArg(prmc, prmv, "nTrafficClass", sizeof(nTrafficClass), &nTrafficClass);
+ if (rret < 1){
+ printf("Parameter not Found: nTrafficClass\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nPCP", sizeof(nPCP), &nPCP);
+ if (rret < 1){
+ printf("Parameter not Found: nPCP\n");
+ return OS_ERROR;
+ }
+
+ if (nPCP >= 16) {
+ printf("ERROR: Given \"nPCP\" is out of range (7)\n");
+ return (-3);
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_SVLAN_PCP_ClassGet(gsw_dev, &PCP_ClassCfg);
+ if (ret < 0) {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_SVLAN_PCP_ClassGet failed with ret code", ret);
+ return ret;
+ }
+ PCP_ClassCfg.nTrafficClass[nPCP] = nTrafficClass;
+
+ ret = GSW_QoS_SVLAN_PCP_ClassSet(gsw_dev, &PCP_ClassCfg);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_SVLAN_PCP_ClassSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_SVLAN_PCP_ClassSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_ShaperCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_ShaperCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nRateShaperId", sizeof(param.nRateShaperId), ¶m.nRateShaperId);
+ if (rret < 1){
+ printf("Parameter not Found: nRateShaperId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_ShaperCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_ShaperCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_ShaperCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "nRateShaperId", param.nRateShaperId);
+ printf("\t%40s:\t%s\n", "bEnable", (param.bEnable > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t0x%x\n", "nCbs", param.nCbs);
+ printf("\t%40s:\t0x%x\n", "nRate", param.nRate);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_ShaperCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_ShaperCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nRateShaperId", sizeof(param.nRateShaperId), ¶m.nRateShaperId);
+ if (rret < 1){
+ printf("Parameter not Found: nRateShaperId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_ShaperCfgGet(gsw_dev, ¶m);
+ if (ret < 0) {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_ShaperCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv, "bEnable", sizeof(param.bEnable), ¶m.bEnable);
+ scanParamArg(prmc, prmv, "nCbs", sizeof(param.nCbs), ¶m.nCbs);
+ scanParamArg(prmc, prmv, "nRate", sizeof(param.nRate), ¶m.nRate);
+
+ ret = GSW_QoS_ShaperCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_ShaperCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_ShaperCfgSet done\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_QoS_ShaperQueueAssign(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_ShaperQueue_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nRateShaperId", sizeof(param.nRateShaperId), ¶m.nRateShaperId);
+ if (rret < 1){
+ printf("Parameter not Found: nRateShaperId\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nQueueId", sizeof(param.nQueueId), ¶m.nQueueId);
+ if (rret < 1){
+ printf("Parameter not Found: nQueueId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_ShaperQueueAssign(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_ShaperQueueAssign failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_ShaperQueueAssign done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_ShaperQueueDeassign(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_ShaperQueue_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nRateShaperId", sizeof(param.nRateShaperId), ¶m.nRateShaperId);
+ if (rret < 1){
+ printf("Parameter not Found: nRateShaperId\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nQueueId", sizeof(param.nQueueId), ¶m.nQueueId);
+ if (rret < 1){
+ printf("Parameter not Found: nQueueId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_ShaperQueueDeassign(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_ShaperQueueDeassign failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_ShaperQueueDeassign done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_ShaperQueueGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_ShaperQueueGet_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nQueueId", sizeof(param.nQueueId), ¶m.nQueueId);
+ if (rret < 1){
+ printf("Parameter not Found: nQueueId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_ShaperQueueGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_ShaperQueueGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_ShaperQueueGet:\n");
+ printf("\t%40s:\t0x%x\n", "nQueueId", param.nQueueId);
+ printf("\t%40s:\t%s\n", "bAssigned", (param.bAssigned > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%u (0x%x)\n", "nRateShaperId", param.nRateShaperId,param.nRateShaperId);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_QoS_SchedulerCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_schedulerCfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_QoS_schedulerCfg_t));
+
+ rret = scanParamArg(prmc, prmv, "nQueueId", sizeof(param.nQueueId), ¶m.nQueueId);
+ if (rret < 1){
+ printf("Parameter not Found: nQueueId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_SchedulerCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_SchedulerCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_SchedulerCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "nQueueId", param.nQueueId);
+ printf("\t%40s:\t0x%x\n", "eType", param.eType);
+ printf("\t%40s:\t%u (0x%x)\n", "nWeight", param.nWeight, param.nWeight);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_SchedulerCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_schedulerCfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_QoS_schedulerCfg_t));
+
+ rret = scanParamArg(prmc, prmv, "nQueueId", sizeof(param.nQueueId), ¶m.nQueueId);
+ if (rret < 1){
+ printf("Parameter not Found: nQueueId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_SchedulerCfgGet(gsw_dev, ¶m);
+ if (ret < 0) {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_SchedulerCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv, "eType", sizeof(param.eType), ¶m.eType);
+ scanParamArg(prmc, prmv, "nWeight", sizeof(param.nWeight), ¶m.nWeight);
+
+ ret = GSW_QoS_SchedulerCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_SchedulerCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_SchedulerCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_WredCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_WRED_Cfg_t param = {0};
+
+ memset(¶m, 0, sizeof(GSW_QoS_WRED_Cfg_t));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_WredCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_WredCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_WredCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "eProfile", param.eProfile);
+ printf("\t%40s:\t0x%x\n", "eMode", param.eMode);
+ printf("\t%40s:\t0x%x\n", "eThreshMode", param.eThreshMode);
+ printf("\t%40s:\t0x%x\n", "nRed_Min", param.nRed_Min);
+ printf("\t%40s:\t0x%x\n", "nRed_Max", param.nRed_Max);
+ printf("\t%40s:\t0x%x\n", "nYellow_Min", param.nYellow_Min);
+ printf("\t%40s:\t0x%x\n", "nYellow_Max", param.nYellow_Max);
+ printf("\t%40s:\t0x%x\n", "nGreen_Min", param.nGreen_Min);
+ printf("\t%40s:\t0x%x\n", "nGreen_Max", param.nGreen_Max);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_WredCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_WRED_Cfg_t param = {0};
+
+ memset(¶m, 0, sizeof(GSW_QoS_WRED_Cfg_t));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_WredCfgGet(gsw_dev, ¶m);
+ if (ret < 0) {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_WredCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv, "eProfile", sizeof(param.eProfile), ¶m.eProfile);
+ scanParamArg(prmc, prmv, "eMode", sizeof(param.eMode), ¶m.eMode);
+ scanParamArg(prmc, prmv, "eThreshMode", sizeof(param.eThreshMode), ¶m.eThreshMode);
+ scanParamArg(prmc, prmv, "nRed_Min", sizeof(param.nRed_Min), ¶m.nRed_Min);
+ scanParamArg(prmc, prmv, "nRed_Max", sizeof(param.nRed_Max), ¶m.nRed_Max);
+ scanParamArg(prmc, prmv, "nYellow_Min", sizeof(param.nYellow_Min), ¶m.nYellow_Min);
+ scanParamArg(prmc, prmv, "nYellow_Max", sizeof(param.nYellow_Max), ¶m.nYellow_Max);
+ scanParamArg(prmc, prmv, "nGreen_Min", sizeof(param.nGreen_Min), ¶m.nGreen_Min);
+ scanParamArg(prmc, prmv, "nGreen_Max", sizeof(param.nGreen_Max), ¶m.nGreen_Max);
+
+ ret = GSW_QoS_WredCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_WredCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_WredCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_WredQueueCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_WRED_QueueCfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_QoS_WRED_QueueCfg_t));
+
+ rret = scanParamArg(prmc, prmv, "nQueueId", sizeof(param.nQueueId), ¶m.nQueueId);
+ if (rret < 1){
+ printf("Parameter not Found: nQueueId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_WredQueueCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_WredQueueCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_WredQueueCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "nQueueId", param.nQueueId);
+ printf("\t%40s:\t0x%x\n", "nRed_Min", param.nRed_Min);
+ printf("\t%40s:\t0x%x\n", "nRed_Max", param.nRed_Max);
+ printf("\t%40s:\t0x%x\n", "nYellow_Min", param.nYellow_Min);
+ printf("\t%40s:\t0x%x\n", "nYellow_Max", param.nYellow_Max);
+ printf("\t%40s:\t0x%x\n", "nGreen_Min", param.nGreen_Min);
+ printf("\t%40s:\t0x%x\n", "nGreen_Max", param.nGreen_Max);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_WredQueueCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_WRED_QueueCfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_QoS_WRED_QueueCfg_t));
+
+ rret = scanParamArg(prmc, prmv, "nQueueId", sizeof(param.nQueueId), ¶m.nQueueId);
+ if (rret < 1){
+ printf("Parameter not Found: nQueueId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_WredQueueCfgGet(gsw_dev, ¶m);
+ if (ret < 0) {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_WredQueueCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv, "nRed_Min", sizeof(param.nRed_Min), ¶m.nRed_Min);
+ scanParamArg(prmc, prmv, "nRed_Max", sizeof(param.nRed_Max), ¶m.nRed_Max);
+ scanParamArg(prmc, prmv, "nYellow_Min", sizeof(param.nYellow_Min), ¶m.nYellow_Min);
+ scanParamArg(prmc, prmv, "nYellow_Max", sizeof(param.nYellow_Max), ¶m.nYellow_Max);
+ scanParamArg(prmc, prmv, "nGreen_Min", sizeof(param.nGreen_Min), ¶m.nGreen_Min);
+ scanParamArg(prmc, prmv, "nGreen_Max", sizeof(param.nGreen_Max), ¶m.nGreen_Max);
+
+ ret = GSW_QoS_WredQueueCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_WredQueueCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_WredQueueCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_WredPortCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_WRED_PortCfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_QoS_WRED_PortCfg_t));
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_WredPortCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_WredPortCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_WredPortCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "nPortId", param.nPortId);
+ printf("\t%40s:\t0x%x\n", "nRed_Min", param.nRed_Min);
+ printf("\t%40s:\t0x%x\n", "nRed_Max", param.nRed_Max);
+ printf("\t%40s:\t0x%x\n", "nYellow_Min", param.nYellow_Min);
+ printf("\t%40s:\t0x%x\n", "nYellow_Max", param.nYellow_Max);
+ printf("\t%40s:\t0x%x\n", "nGreen_Min", param.nGreen_Min);
+ printf("\t%40s:\t0x%x\n", "nGreen_Max", param.nGreen_Max);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_WredPortCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_WRED_PortCfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_QoS_WRED_PortCfg_t));
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_WredPortCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_WredPortCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv, "nRed_Min", sizeof(param.nRed_Min), ¶m.nRed_Min);
+ scanParamArg(prmc, prmv, "nRed_Max", sizeof(param.nRed_Max), ¶m.nRed_Max);
+ scanParamArg(prmc, prmv, "nYellow_Min", sizeof(param.nYellow_Min), ¶m.nYellow_Min);
+ scanParamArg(prmc, prmv, "nYellow_Max", sizeof(param.nYellow_Max), ¶m.nYellow_Max);
+ scanParamArg(prmc, prmv, "nGreen_Min", sizeof(param.nGreen_Min), ¶m.nGreen_Min);
+ scanParamArg(prmc, prmv, "nGreen_Max", sizeof(param.nGreen_Max), ¶m.nGreen_Max);
+
+ ret = GSW_QoS_WredPortCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_WredPortCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_WredPortCfgSet done\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_TrunkingCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_trunkingCfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_trunkingCfg_t));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_TrunkingCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Trunking_CfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_Trunking_CfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "bIP_Src", param.bIP_Src);
+ printf("\t%40s:\t0x%x\n", "bIP_Dst", param.bIP_Dst);
+ printf("\t%40s:\t0x%x\n", "bMAC_Src", param.bMAC_Src);
+ printf("\t%40s:\t0x%x\n", "bMAC_Dst", param.bMAC_Dst);
+ printf("\t%40s:\t0x%x\n", "bSrc_Port", param.bSrc_Port);
+ printf("\t%40s:\t0x%x\n", "bDst_Port", param.bDst_Port);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_TrunkingCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_trunkingCfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_trunkingCfg_t));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_TrunkingCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_TrunkingCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv, "bIP_Src", sizeof(param.bIP_Src), ¶m.bIP_Src);
+ scanParamArg(prmc, prmv, "bIP_Dst", sizeof(param.bIP_Dst), ¶m.bIP_Dst);
+ scanParamArg(prmc, prmv, "bMAC_Src", sizeof(param.bMAC_Src), ¶m.bMAC_Src);
+ scanParamArg(prmc, prmv, "bMAC_Dst", sizeof(param.bMAC_Dst), ¶m.bMAC_Dst);
+ scanParamArg(prmc, prmv, "bSrc_Port", sizeof(param.bSrc_Port), ¶m.bSrc_Port);
+ scanParamArg(prmc, prmv, "bDst_Port", sizeof(param.bDst_Port), ¶m.bDst_Port);
+
+ ret = GSW_TrunkingCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Trunking_CfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_Trunking_CfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MAC_TableClear(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MAC_TableClear(gsw_dev);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MAC_TableClear failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MAC_TableClear done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MAC_TableCondClear(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ GSW_MAC_tableClearCond_t param = {0};
+
+ scanParamArg(prmc, prmv, "eType", sizeof(param.eType), ¶m.eType);
+ scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MAC_TableClearCond(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MAC_TableCondClear failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MAC_TableCondClear done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_CfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_cfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_cfg_t));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_CfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_CfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_CfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "eMAC_TableAgeTimer", param.eMAC_TableAgeTimer);
+ printf("\t%40s:\t%u\n", "nAgeTimer", param.nAgeTimer);
+ printf("\t%40s:\t%u\n", "nMaxPacketLen", param.nMaxPacketLen);
+ printf("\t%40s:\t%d\n", "bLearningLimitAction", param.bLearningLimitAction);
+ printf("\t%40s:\t%d\n", "bMAC_LockingAction", param.bMAC_LockingAction);
+ printf("\t%40s:\t%d\n", "bMAC_SpoofingAction", param.bMAC_SpoofingAction);
+ printf("\t%40s:\t%d\n", "bPauseMAC_ModeSrc", param.bPauseMAC_ModeSrc);
+ printf("\t%40s:\t", "nPauseMAC_Src");
+ printMAC_Address(param.nPauseMAC_Src);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_CfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_cfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_cfg_t));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_CfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_CfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv, "eMAC_TableAgeTimer", sizeof(param.eMAC_TableAgeTimer), ¶m.eMAC_TableAgeTimer);
+ scanParamArg(prmc, prmv, "nAgeTimer", sizeof(param.nAgeTimer), ¶m.nAgeTimer);
+ scanParamArg(prmc, prmv, "nMaxPacketLen", sizeof(param.nMaxPacketLen), ¶m.nMaxPacketLen);
+ scanParamArg(prmc, prmv, "bLearningLimitAction", sizeof(param.bLearningLimitAction), ¶m.bLearningLimitAction);
+ scanParamArg(prmc, prmv, "bMAC_LockingAction", sizeof(param.bLearningLimitAction), ¶m.bMAC_LockingAction);
+ scanParamArg(prmc, prmv, "bMAC_SpoofingAction", sizeof(param.bLearningLimitAction), ¶m.bMAC_SpoofingAction);
+ scanParamArg(prmc, prmv, "bPauseMAC_ModeSrc", sizeof(param.bPauseMAC_ModeSrc), ¶m.bPauseMAC_ModeSrc);
+ scanMAC_Arg(prmc, prmv, "nPauseMAC_Src", param.nPauseMAC_Src);
+
+ ret = GSW_CfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_CfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_CfgSet done\n");
+
+ }
+
+ return ret;
+}
+
+
+
+GSW_return_t fapi_GSW_MAC_TableEntryRemove(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_MAC_tableRemove_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_MAC_tableRemove_t));
+
+ rret = scanMAC_Arg(prmc, prmv, "nMAC", param.nMAC);
+ if (rret < 1){
+ printf("Parameter not Found: nMAC\n");
+ return OS_ERROR;
+ }
+
+ printMAC_Address(param.nMAC);
+ scanParamArg(prmc, prmv, "nFId", sizeof(param.nFId), ¶m.nFId);
+ scanParamArg(prmc, prmv, "nTci", sizeof(param.nTci), ¶m.nTci);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MAC_TableEntryRemove(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MAC_TableEntryRemove failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MAC_TableEntryRemove done\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_MAC_TableEntryQuery(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_MAC_tableQuery_t param = {0};
+ int rret,i=0;
+
+ memset(¶m, 0, sizeof(GSW_MAC_tableQuery_t));
+
+ rret = scanMAC_Arg(prmc, prmv, "nMAC", param.nMAC);
+ if (rret < 1){
+ printf("Parameter not Found: nMAC\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nFId", sizeof(param.nFId), ¶m.nFId);
+ if (rret < 1){
+ printf("Parameter not Found: nFId\n");
+ return OS_ERROR;
+ }
+ scanParamArg(prmc, prmv, "nFilterFlag", sizeof(param.nFilterFlag), ¶m.nFilterFlag);
+ scanParamArg(prmc, prmv, "nTci", sizeof(param.nTci), ¶m.nTci);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MAC_TableEntryQuery(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "GSW_MAC_TableEntryQuery failed with ret code", ret);
+ else{
+ printf("%40s:\t", "nMAC");
+ printMAC_Address(param.nMAC);
+ printf("\n");
+ printf("%40s:\t%d\n", "nFId", param.nFId);
+ printf("%40s:\t%d\n", "nFilterFlag", param.nFilterFlag);
+ printf("%40s:\t%s\n", "bFound", (param.bFound > 0) ? "1" : "0");
+ printf("%40s:\t%s\n", "bStaticEntry", (param.bStaticEntry > 0) ? "TRUE" : "FALSE");
+ printf("%40s:\t%d\n", "nSVLAN_Id", param.nSVLAN_Id);
+
+ if (param.bStaticEntry) {
+ for (i = 0; i < 8; i++) {
+ printf("%35s[ %d ]:\t0x%x\n", "PortMap", i, param.nPortMap[i]);
+ }
+
+ printf("%40s:\t%d\n", "bIgmpControlled", param.bIgmpControlled);
+ printf("%40s:\t%d\n", "Hit Status", param.hitstatus);
+ } else { /*Dynamic Entry*/
+ printf("%40s:\t%u\n", "nPortId", param.nPortId);
+ //printf("%40s:\t%d\n", "nSubIfId", param.nSubIfId); //TODO need use in along with param.nPortId?
+ printf("%40s:\t%d\n", "AgeTimer", param.nAgeTimer);
+ printf("%40s:\t%s\n", "bEntryChanged", (param.bEntryChanged > 0) ? "TRUE" : "FALSE");
+ printf("%40s:\t%d\n", "FirstBridgePortId", param.nFirstBridgePortId);
+ printf("%40s:\t", "nAssociatedMAC");
+ printMAC_Address(param.nAssociatedMAC);
+ printf("\n");
+ }
+
+ if (param.nTci) {
+ printf("\t%40s:\t%d\n", "VLAN PRI", ((param.nTci & 0xE000) >> 13));
+ printf("\t%40s:\t%d\n", "VLAN CFI/DEI", ((param.nTci & 0x1000) >> 12));
+ printf("\t%40s:\t%d\n", "VLAN ID", (param.nTci & 0x0FFF));
+ }
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_QoS_FlowctrlCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_FlowCtrlCfg_t param = {0};
+
+ memset(¶m, 0, sizeof(GSW_QoS_FlowCtrlCfg_t));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_FlowctrlCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_FlowctrlCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_FlowctrlCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "nFlowCtrlNonConform_Min", param.nFlowCtrlNonConform_Min);
+ printf("\t%40s:\t0x%x\n", "nFlowCtrlNonConform_Max", param.nFlowCtrlNonConform_Max);
+ printf("\t%40s:\t0x%x\n", "nFlowCtrlConform_Min", param.nFlowCtrlConform_Min);
+ printf("\t%40s:\t0x%x\n", "nFlowCtrlConform_Max", param.nFlowCtrlConform_Max);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_FlowctrlCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_FlowCtrlCfg_t param = {0};
+ int cnt;
+
+ memset(¶m, 0, sizeof(GSW_QoS_FlowCtrlCfg_t));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_FlowctrlCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_FlowctrlCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ cnt = scanParamArg(prmc, prmv, "nFlowCtrlNonConform_Min", sizeof(param.nFlowCtrlNonConform_Min), ¶m.nFlowCtrlNonConform_Min);
+ cnt += scanParamArg(prmc, prmv, "nFlowCtrlNonConform_Max", sizeof(param.nFlowCtrlNonConform_Max), ¶m.nFlowCtrlNonConform_Max);
+ cnt += scanParamArg(prmc, prmv, "nFlowCtrlConform_Min", sizeof(param.nFlowCtrlConform_Min), ¶m.nFlowCtrlConform_Min);
+ cnt += scanParamArg(prmc, prmv, "nFlowCtrlConform_Max", sizeof(param.nFlowCtrlConform_Max), ¶m.nFlowCtrlConform_Max);
+
+ if (cnt) {
+ ret = GSW_QoS_FlowctrlCfgSet(gsw_dev, ¶m);
+ }
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_FlowctrlCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_FlowctrlCfgSet done\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_QoS_FlowctrlPortCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_FlowCtrlPortCfg_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_QoS_FlowCtrlPortCfg_t));
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_FlowctrlPortCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_FlowctrlPortCfgGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_FlowctrlPortCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "nPortId", param.nPortId);
+ printf("\t%40s:\t0x%x\n", "nFlowCtrl_Min", param.nFlowCtrl_Min);
+ printf("\t%40s:\t0x%x\n", "nFlowCtrl_Max", param.nFlowCtrl_Max);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_FlowctrlPortCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret = 0;
+ GSW_QoS_FlowCtrlPortCfg_t param = {0};
+ int rret,cnt;
+
+ memset(¶m, 0, sizeof(GSW_QoS_FlowCtrlPortCfg_t));
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_FlowctrlPortCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_FlowctrlPortCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ cnt = scanParamArg(prmc, prmv, "nFlowCtrl_Min", sizeof(param.nFlowCtrl_Min), ¶m.nFlowCtrl_Min);
+ cnt += scanParamArg(prmc, prmv, "nFlowCtrl_Max", sizeof(param.nFlowCtrl_Max), ¶m.nFlowCtrl_Max);
+ if (cnt) {
+ ret = GSW_QoS_FlowctrlPortCfgSet(gsw_dev, ¶m);
+ }
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_FlowctrlPortCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_FlowctrlPortCfgSet done\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_MAC_TableEntryAdd(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_MAC_tableAdd_t param = {0};
+
+ memset(¶m, 0, sizeof(GSW_MAC_tableAdd_t));
+
+ scanParamArg(prmc, prmv, "nFId", sizeof(param.nFId), ¶m.nFId);
+ scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ scanParamArg(prmc, prmv, "nAgeTimer", sizeof(param.nAgeTimer), ¶m.nAgeTimer);
+ scanParamArg(prmc, prmv, "bStaticEntry", sizeof(param.bStaticEntry), ¶m.bStaticEntry);
+ scanParamArg(prmc, prmv, "nTrafficClass", sizeof(param.nTrafficClass), ¶m.nTrafficClass);
+ scanParamArg(prmc, prmv, "bIgmpControlled", sizeof(param.bIgmpControlled), ¶m.bIgmpControlled);
+ scanParamArg(prmc, prmv, "nFilterFlag", sizeof(param.nFilterFlag), ¶m.nFilterFlag);
+ scanParamArg(prmc, prmv, "nSVLAN_Id", sizeof(param.bIgmpControlled), ¶m.nSVLAN_Id);
+ scanParamArg(prmc, prmv, "nSubIfId", sizeof(param.nSubIfId), ¶m.nSubIfId);
+ scanMAC_Arg(prmc, prmv, "nMAC", param.nMAC);
+ scanMAC_Arg(prmc, prmv, "nAssociatedMAC", param.nAssociatedMAC);
+ scanParamArg(prmc, prmv, "nTci", sizeof(param.nTci), ¶m.nTci);
+ scanParamArg(prmc, prmv, "nPortMapValueIndex0", sizeof(param.nPortMap[0]), ¶m.nPortMap[0]);
+ scanParamArg(prmc, prmv, "nPortMapValueIndex1", sizeof(param.nPortMap[1]), ¶m.nPortMap[1]);
+ scanParamArg(prmc, prmv, "nPortMapValueIndex2", sizeof(param.nPortMap[2]), ¶m.nPortMap[2]);
+ scanParamArg(prmc, prmv, "nPortMapValueIndex3", sizeof(param.nPortMap[3]), ¶m.nPortMap[3]);
+ scanParamArg(prmc, prmv, "nPortMapValueIndex4", sizeof(param.nPortMap[4]), ¶m.nPortMap[4]);
+ scanParamArg(prmc, prmv, "nPortMapValueIndex5", sizeof(param.nPortMap[5]), ¶m.nPortMap[5]);
+ scanParamArg(prmc, prmv, "nPortMapValueIndex6", sizeof(param.nPortMap[6]), ¶m.nPortMap[6]);
+ scanParamArg(prmc, prmv, "nPortMapValueIndex7", sizeof(param.nPortMap[7]), ¶m.nPortMap[7]);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MAC_TableEntryAdd(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MAC_TableEntryAdd failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MAC_TableEntryAdd done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MAC_TableEntryRead(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int i = 0;
+ GSW_MAC_tableRead_t MAC_tableRead = {0};
+
+ memset(&MAC_tableRead, 0, sizeof(GSW_MAC_tableRead_t));
+
+ for (i = 0; i < 71; i++)
+ printf("-");
+ printf("\n");
+ printf("%-18s|%-5s|%-10s|%-5s|%-5s|%-5s|%-8s\n",
+ "MAC Address", "Port", "Age", "SID", "FID", "Hit", "Stat/Dyn");
+ for (i = 0; i < 71; i++)
+ printf("-");
+ printf("\n");
+
+ MAC_tableRead.bInitial = 1;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ for (;;) {
+ ret = GSW_MAC_TableEntryRead(gsw_dev, &MAC_tableRead);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_MAC_TableEntryRead failed with ret code", ret);
+ return ret;
+ }
+
+ if (MAC_tableRead.bLast == 1)
+ break;
+
+ if (checkValidMAC_Address(MAC_tableRead.nMAC)) {
+ if ((MAC_tableRead.nAgeTimer == 0) && (MAC_tableRead.bStaticEntry == 0)) {
+ /* Do nothing */
+ continue;
+ }
+ }
+
+ if (MAC_tableRead.bStaticEntry) {
+ unsigned int i = 0;
+ printMAC_Address(MAC_tableRead.nMAC);
+ if (MAC_tableRead.nPortId & 0x80000000)
+ printf(" |MAP |");
+ else
+ printf(" |%-5d|", MAC_tableRead.nPortId);
+ printf("%-10d|%-5d|%-5d|%-5d|Static\n",
+ MAC_tableRead.nAgeTimer,
+ MAC_tableRead.nSubIfId,
+ MAC_tableRead.nFId,
+ MAC_tableRead.hitstatus
+ );
+ printf("%-19s%-5s%-10s%-5s%-5s%-9s%-9s|%-9s: 0x%x\n",
+ "", "", "", "", "", "", "",
+ "nFilterFlag(key)", MAC_tableRead.nFilterFlag);
+
+ for (i = 0; i < ARRAY_SIZE(MAC_tableRead.nPortMap); i++) {
+ if (!MAC_tableRead.nPortMap[i])
+ continue;
+
+ printf("%-19s%-5s%-10s%-5s%-5s%-9s%-9s|%-8s[%d]: 0x%x\n",
+ "", "", "", "", "", "", "",
+ "PortMap", i, MAC_tableRead.nPortMap[i]);
+ }
+ } else {
+ printMAC_Address(MAC_tableRead.nMAC);
+ printf(" |%-5d|%-10d|%-5d|%-5d|%-5d|Dynamic\n",
+ MAC_tableRead.nPortId,
+ MAC_tableRead.nAgeTimer,
+ MAC_tableRead.nSubIfId,
+ MAC_tableRead.nFId,
+ MAC_tableRead.hitstatus
+ );
+ }
+
+ if (MAC_tableRead.nTci) {
+ printf("%-19s%-5s%-10s%-5s%-55s%-9s%-9s|%-18s: %d\n",
+ "", "", "", "", "", "", "",
+ "VLAN PRI", ((MAC_tableRead.nTci & 0xE000) >> 13));
+ printf("%-19s%-5s%-10s%-5s%-55s%-9s%-9s|%-18s: %d\n",
+ "", "", "", "", "", "", "",
+ "VLAN CFI/DEI", ((MAC_tableRead.nTci & 0x1000) >> 12));
+ printf("%-19s%-5s%-10s%-5s%-55s%-9s%-9s|%-18s: %d\n",
+ "", "", "", "", "", "", "",
+ "VLAN ID", (MAC_tableRead.nTci & 0x0FFF));
+ }
+ memset(&MAC_tableRead, 0x00, sizeof(MAC_tableRead));
+ }
+
+ for (i = 0; i < 71; i++)
+ printf("-");
+ printf("\n");
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_QoS_QueuePortSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_queuePort_t param = {0};
+ int rret;
+
+ memset(¶m, 0, sizeof(GSW_QoS_queuePort_t));
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+ scanParamArg(prmc, prmv, "nTrafficClassId", sizeof(param.nTrafficClassId), ¶m.nTrafficClassId);
+ scanParamArg(prmc, prmv, "bRedirectionBypass", sizeof(param.bRedirectionBypass), ¶m.bRedirectionBypass);
+ scanParamArg(prmc, prmv, "bExtrationEnable", sizeof(param.bExtrationEnable), ¶m.bExtrationEnable);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_QueuePortGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_QueuePortGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv, "eQMapMode", sizeof(param.eQMapMode), ¶m.eQMapMode);
+ scanParamArg(prmc, prmv, "nQueueId", sizeof(param.nQueueId), ¶m.nQueueId);
+ scanParamArg(prmc, prmv, "nRedirectPortId", sizeof(param.nRedirectPortId), ¶m.nRedirectPortId);
+ scanParamArg(prmc, prmv, "bEnableIngressPceBypass", sizeof(param.bEnableIngressPceBypass),¶m.bEnableIngressPceBypass);
+ scanParamArg(prmc, prmv, "bReservedPortMode", sizeof(param.bReservedPortMode),¶m.bReservedPortMode);
+
+ ret = GSW_QoS_QueuePortSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_QueuePortSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_QueuePortSet done\n");
+ }
+
+ return ret;
+
+}
+
+static int print_queues_gswip32(uint16_t port)
+{
+ GSW_QoS_queuePort_t queuePortParam = {0};
+ int tc;
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ queuePortParam.nPortId = port;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+
+ for (tc = 0; tc < NUM_TC * 4; tc++) {
+ queuePortParam.nTrafficClassId = tc & GENMASK(3, 0);
+ queuePortParam.bRedirectionBypass = (tc & BIT(4)) >> 4;
+ queuePortParam.bExtrationEnable = (tc & BIT(5)) >> 5;
+
+ if (queuePortParam.nTrafficClassId == 0) {
+ printf("\n");
+ printf(" Port | Traffic Class | bRedirectionBypass | bPceIngressBypass | bExtrationEnable | Egress Queue | nRedirectPortId\n");
+ printf("------------------------------------------------------------------------------------------------------------------\n");
+ }
+
+ ret = GSW_QoS_QueuePortGet(gsw_dev, &queuePortParam);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_QueuePortGet failed with ret code", ret);
+ return ret;
+ }
+
+ printf(" %4d | %13d | %18d ",
+ queuePortParam.nPortId,
+ queuePortParam.nTrafficClassId,
+ queuePortParam.bRedirectionBypass);
+
+ if (queuePortParam.bRedirectionBypass)
+ printf("| %17s ", "n/a");
+ else
+ printf("| %17d ", queuePortParam.bEnableIngressPceBypass);
+
+ if (queuePortParam.bRedirectionBypass
+ || !queuePortParam.bEnableIngressPceBypass)
+ printf("| %16d ", queuePortParam.bExtrationEnable);
+ else
+ printf("| %16s ", "n/a");
+
+ printf("| %12d | %15d\n",
+ queuePortParam.nQueueId,
+ queuePortParam.nRedirectPortId);
+
+ if (queuePortParam.nTrafficClassId == NUM_TC - 1)
+ printf("------------------------------------------------------------------------------------------------------------------\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_QueuePortGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret = -1;
+ GSW_QoS_queuePort_t queuePortParam = {0};
+
+ memset(&queuePortParam, 0, sizeof(GSW_QoS_queuePort_t));
+
+
+ if (scanParamArg(prmc, prmv,"nPortId", sizeof(queuePortParam.nPortId), &queuePortParam.nPortId))
+ {
+ if (scanParamArg(prmc, prmv, "nTrafficClassId", sizeof(queuePortParam.nTrafficClassId), &queuePortParam.nTrafficClassId)) {
+ scanParamArg(prmc, prmv, "bRedirectionBypass", sizeof(queuePortParam.bRedirectionBypass), &queuePortParam.bRedirectionBypass);
+
+ scanParamArg(prmc, prmv, "bExtrationEnable", sizeof(queuePortParam.bExtrationEnable), &queuePortParam.bExtrationEnable);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_QueuePortGet(gsw_dev, &queuePortParam);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_QoS_QueuePortGet failed with ret code", ret);
+ return ret;
+ }
+
+ printf("fapi_GSW_QoS_FlowctrlPortCfgGet:\n");
+ printf("\t%40s:\t0x%x\n", "nPortId", queuePortParam.nPortId);
+ printf("\t%40s:\t0x%x\n", "nTrafficClassId", queuePortParam.nTrafficClassId);
+ printf("\t%40s:\t0x%x\n", "bRedirectionBypass", queuePortParam.bRedirectionBypass);
+ printf("\t%40s:\t0x%x\n", "bEnableIngressPceBypass", queuePortParam.bEnableIngressPceBypass);
+ printf("\t%40s:\t0x%x\n", "bExtrationEnable", queuePortParam.bExtrationEnable);
+
+ if (queuePortParam.eQMapMode == GSW_QOS_QMAP_SINGLE_MODE)
+ printf("\t%40s:\tSingle\n", "eQMapMode");
+ else
+ printf("\t%40s:\tSubifid\n", "eQMapMode");
+ printf("\t%40s:\t0x%x\n", "nQueueId", queuePortParam.nQueueId);
+ printf("\t%40s:\t0x%x\n", "nRedirectPortId", queuePortParam.nRedirectPortId);
+ return ret;
+ } else {
+ return print_queues_gswip32(queuePortParam.nPortId);
+ }
+ }
+ printf("Parameter \"nPortId\" is missing.\n");
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_BridgePortConfigGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_BRIDGE_portConfig_t sVar = { 0 };
+ int rret;
+ unsigned int i;
+
+ rret = scanParamArg(prmc, prmv, "nBridgePortId", sizeof(sVar.nBridgePortId), &sVar.nBridgePortId);
+ if (rret < 1){
+ printf("Parameter not Found: nBridgePortId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "eMask", sizeof(sVar.eMask), &sVar.eMask);
+ if (!sVar.eMask)
+ sVar.eMask = 0xFFFFFFFF;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_BridgePortConfigGet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_BridgePortConfigGet failed with ret code", ret);
+ else{
+ printf("\t%40s:\t0x%x\n", "nBridgePortId", sVar.nBridgePortId);
+ printf("\t%40s:\t0x%x\n", "eMask", sVar.eMask);
+ printf("\t%40s:\t0x%x\n", "nBridgeId", sVar.nBridgeId);
+ printf("\t%40s:\t0x%x\n", "bIngressExtendedVlanEnable", sVar.bIngressExtendedVlanEnable);
+ printf("\t%40s:\t0x%x\n", "nIngressExtendedVlanBlockId", sVar.nIngressExtendedVlanBlockId);
+ printf("\t%40s:\t0x%x\n", "bEgressExtendedVlanEnable", sVar.bEgressExtendedVlanEnable);
+ printf("\t%40s:\t0x%x\n", "nEgressExtendedVlanBlockId", sVar.nEgressExtendedVlanBlockId);
+ printf("\t%40s:\t0x%x\n", "eIngressMarkingMode", sVar.eIngressMarkingMode);
+ printf("\t%40s:\t0x%x\n", "eEgressRemarkingMode", sVar.eEgressRemarkingMode);
+ printf("\t%40s:\t0x%x\n", "bIngressMeteringEnable", sVar.bIngressMeteringEnable);
+ printf("\t%40s:\t0x%x\n", "nIngressTrafficMeterId", sVar.nIngressTrafficMeterId);
+ printf("\t%40s:\t0x%x\n", "bEgressMeteringEnable", sVar.bEgressSubMeteringEnable[5]);
+ printf("\t%40s:\t0x%x\n", "nEgressTrafficMeterId", sVar.nEgressTrafficSubMeterId[5]);
+ printf("\t%40s:\t0x%x\n", "bEgressBroadcastSubMeteringEnable", sVar.bEgressSubMeteringEnable[0]);
+ printf("\t%40s:\t0x%x\n", "bEgressMulticastSubMeteringEnable", sVar.bEgressSubMeteringEnable[1]);
+ printf("\t%40s:\t0x%x\n", "bEgressUnknownMulticastIPSubMeteringEnable", sVar.bEgressSubMeteringEnable[2]);
+ printf("\t%40s:\t0x%x\n", "bEgressUnknownMulticastNonIPSubMeteringEnable", sVar.bEgressSubMeteringEnable[3]);
+ printf("\t%40s:\t0x%x\n", "bEgressUnknownUnicastSubMeteringEnable", sVar.bEgressSubMeteringEnable[4]);
+ printf("\t%40s:\t0x%x\n", "nEgressBroadcastSubMeteringId", sVar.nEgressTrafficSubMeterId[0]);
+ printf("\t%40s:\t0x%x\n", "nEgressMulticastSubMeteringId", sVar.nEgressTrafficSubMeterId[1]);
+ printf("\t%40s:\t0x%x\n", "bEgressUnknownMulticastIPSubMeteringEnable", sVar.nEgressTrafficSubMeterId[2]);
+ printf("\t%40s:\t0x%x\n", "bEgressUnknownMulticastNonIPSubMeteringEnable", sVar.nEgressTrafficSubMeterId[3]);
+ printf("\t%40s:\t0x%x\n", "bEgressUnknownUnicastSubMeteringEnable", sVar.nEgressTrafficSubMeterId[4]);
+ printf("\t%40s:\t0x%x\n", "nDestLogicalPortId", sVar.nDestLogicalPortId);
+ printf("\t%40s:\t0x%x\n", "nDestSubIfIdGroup", sVar.nDestSubIfIdGroup);
+ printf("\t%40s:\t0x%x\n", "bPmapperEnable", sVar.bPmapperEnable);
+
+ if (sVar.bPmapperEnable) {
+ printf("\t%40s:\t0x%x\n", "ePmapperMappingMode", sVar.ePmapperMappingMode);
+ printf("\t%40s:\t0x%x\n", "nPmapperId", sVar.sPmapper.nPmapperId);
+ for (i = 0; i < 73; i++)
+ printf("\t%40s[%u]:\t0x%x\n", "nDestSubIfIdGroup",i,sVar.sPmapper.nDestSubIfIdGroup[i]);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(sVar.nBridgePortMap); i++)
+ printf("\t%40s[%u]:\t0x%x\n", "nBridgePortMapIndex",i,sVar.nBridgePortMap[i]);
+
+ printf("\t%40s:\t0x%x\n", "bMcDestIpLookupDisable", sVar.bMcDestIpLookupDisable);
+ printf("\t%40s:\t0x%x\n", "bMcSrcIpLookupEnable", sVar.bMcSrcIpLookupEnable);
+ printf("\t%40s:\t0x%x\n", "bDestMacLookupDisable", sVar.bDestMacLookupDisable);
+ printf("\t%40s:\t0x%x\n", "bSrcMacLearningDisable", sVar.bSrcMacLearningDisable);
+ printf("\t%40s:\t0x%x\n", "bMacSpoofingDetectEnable", sVar.bMacSpoofingDetectEnable);
+ printf("\t%40s:\t0x%x\n", "bPortLockEnable", sVar.bPortLockEnable);
+ printf("\t%40s:\t0x%x\n", "bMacLearningLimitEnable", sVar.bMacLearningLimitEnable);
+ printf("\t%40s:\t0x%x\n", "nMacLearningLimit", sVar.nMacLearningLimit);
+ printf("\t%40s:\t0x%x\n", "nMacLearningCount", sVar.nMacLearningCount);
+ printf("\t%40s:\t0x%x\n", "bIngressVlanFilterEnable", sVar.bIngressVlanFilterEnable);
+ printf("\t%40s:\t0x%x\n", "nIngressVlanFilterBlockId", sVar.nIngressVlanFilterBlockId);
+ printf("\t%40s:\t0x%x\n", "bBypassEgressVlanFilter1", sVar.bBypassEgressVlanFilter1);
+ printf("\t%40s:\t0x%x\n", "bEgressVlanFilter1Enable", sVar.bEgressVlanFilter1Enable);
+ printf("\t%40s:\t0x%x\n", "nEgressVlanFilter1BlockId", sVar.nEgressVlanFilter1BlockId);
+ printf("\t%40s:\t0x%x\n", "bEgressVlanFilter2Enable", sVar.bEgressVlanFilter2Enable);
+ printf("\t%40s:\t0x%x\n", "nEgressVlanFilter2BlockId", sVar.nEgressVlanFilter2BlockId);
+ printf("\t%40s:\t0x%x\n", "bVlanTagSelection", sVar.bVlanTagSelection);
+ printf("\t%40s:\t0x%x\n", "bVlanSrcMacPriorityEnable", sVar.bVlanSrcMacPriorityEnable);
+ printf("\t%40s:\t0x%x\n", "bVlanSrcMacDEIEnable", sVar.bVlanSrcMacDEIEnable);
+ printf("\t%40s:\t0x%x\n", "bVlanSrcMacVidEnable", sVar.bVlanSrcMacVidEnable);
+ printf("\t%40s:\t0x%x\n", "bVlanDstMacPriorityEnable", sVar.bVlanDstMacPriorityEnable);
+ printf("\t%40s:\t0x%x\n", "bVlanDstMacDEIEnable", sVar.bVlanDstMacDEIEnable);
+ printf("\t%40s:\t0x%x\n", "bVlanDstMacVidEnable", sVar.bVlanDstMacVidEnable);
+ printf("\t%40s:\t0x%x\n", "bVlanMulticastPriorityEnable", sVar.bVlanMulticastPriorityEnable);
+ printf("\t%40s:\t0x%x\n", "bVlanMulticastDEIEnable", sVar.bVlanMulticastDEIEnable);
+ printf("\t%40s:\t0x%x\n", "bVlanMulticastVidEnable", sVar.bVlanMulticastVidEnable);
+ printf("\t%40s:\t0x%x\n", "bLoopViolationCounters", sVar.nLoopViolationCount);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_BridgePortConfigSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_BRIDGE_portConfig_t sVar;
+ int rret;
+ unsigned int i, bBridgePortMapEnable = 0,MapValue = 0;
+ u16 Index = 0;
+
+ memset(&sVar, 0x00, sizeof(sVar));
+
+ rret = scanParamArg(prmc, prmv, "nBridgePortId", sizeof(sVar.nBridgePortId), &sVar.nBridgePortId);
+ if (rret < 1){
+ printf("Parameter not Found: nBridgePortId\n");
+ return OS_ERROR;
+ }
+
+ sVar.eMask = 0xFFFFFFFF;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_BridgePortConfigGet(gsw_dev, &sVar);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_BridgePortConfigGet failed with ret code", ret);
+ return ret;
+ }
+ sVar.eMask = 0x0;
+
+ scanParamArg(prmc, prmv, "nBridgeId", sizeof(sVar.eMask), &sVar.nBridgeId);
+ if (findStringParam(prmc, prmv, "nBridgeId"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_BRIDGE_ID;
+
+ scanParamArg(prmc, prmv, "bIngressExtendedVlanEnable", sizeof(sVar.bIngressExtendedVlanEnable), &sVar.bIngressExtendedVlanEnable);
+ if (findStringParam(prmc, prmv, "bIngressExtendedVlanEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_INGRESS_VLAN;
+
+ scanParamArg(prmc, prmv, "nIngressExtendedVlanBlockId", sizeof(sVar.nIngressExtendedVlanBlockId), &sVar.nIngressExtendedVlanBlockId);
+ scanParamArg(prmc, prmv, "bEgressExtendedVlanEnable", sizeof(sVar.bEgressExtendedVlanEnable), &sVar.bEgressExtendedVlanEnable);
+ if (findStringParam(prmc, prmv, "bEgressExtendedVlanEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_VLAN;
+
+ scanParamArg(prmc, prmv, "nEgressExtendedVlanBlockId", sizeof(sVar.nEgressExtendedVlanBlockId), &sVar.nEgressExtendedVlanBlockId);
+ scanParamArg(prmc, prmv, "eIngressMarkingMode", sizeof(sVar.eIngressMarkingMode), &sVar.eIngressMarkingMode);
+ if (findStringParam(prmc, prmv, "eIngressMarkingMode"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_INGRESS_MARKING;
+
+ scanParamArg(prmc, prmv, "eEgressRemarkingMode", sizeof(sVar.eEgressRemarkingMode), &sVar.eEgressRemarkingMode);
+ if (findStringParam(prmc, prmv, "eEgressRemarkingMode"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_REMARKING;
+
+ scanParamArg(prmc, prmv, "bIngressMeteringEnable", sizeof(sVar.bIngressMeteringEnable), &sVar.bIngressMeteringEnable);
+ if (findStringParam(prmc, prmv, "bIngressMeteringEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_INGRESS_METER;
+
+ scanParamArg(prmc, prmv, "nIngressTrafficMeterId", sizeof(sVar.nIngressTrafficMeterId), &sVar.nIngressTrafficMeterId);
+ scanParamArg(prmc, prmv, "bEgressMeteringEnable", sizeof(sVar.bEgressSubMeteringEnable[5]), &sVar.bEgressSubMeteringEnable[5]);
+ if (findStringParam(prmc, prmv, "bEgressMeteringEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_SUB_METER;
+
+ scanParamArg(prmc, prmv, "nEgressTrafficMeterId", sizeof(sVar.nEgressTrafficSubMeterId[5]), &sVar.nEgressTrafficSubMeterId[5]);
+ scanParamArg(prmc, prmv, "bEgressBroadcastSubMeteringEnable", sizeof(sVar.bEgressSubMeteringEnable[0]), &sVar.bEgressSubMeteringEnable[0]);
+ if (findStringParam(prmc, prmv, "bEgressBroadcastSubMeteringEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_SUB_METER;
+
+ scanParamArg(prmc, prmv, "bEgressMulticastSubMeteringEnable", sizeof(sVar.bEgressSubMeteringEnable[1]), &sVar.bEgressSubMeteringEnable[1]);
+ if (findStringParam(prmc, prmv, "bEgressMulticastSubMeteringEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_SUB_METER;
+
+ scanParamArg(prmc, prmv, "bEgressUnknownMulticastIPSubMeteringEnable", sizeof(sVar.bEgressSubMeteringEnable[2]), &sVar.bEgressSubMeteringEnable[2]);
+ if (findStringParam(prmc, prmv, "bEgressUnknownMulticastIPSubMeteringEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_SUB_METER;
+
+ scanParamArg(prmc, prmv, "bEgressUnknownMulticastNonIPSubMeteringEnable", sizeof(sVar.bEgressSubMeteringEnable[3]), &sVar.bEgressSubMeteringEnable[3]);
+ if (findStringParam(prmc, prmv, "bEgressUnknownMulticastNonIPSubMeteringEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_SUB_METER;
+
+ scanParamArg(prmc, prmv, "bEgressUnknownUnicastSubMeteringEnable", sizeof(sVar.bEgressSubMeteringEnable[4]), &sVar.bEgressSubMeteringEnable[4]);
+ if (findStringParam(prmc, prmv, "bEgressUnknownUnicastSubMeteringEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_SUB_METER;
+
+ scanParamArg(prmc, prmv, "nEgressBroadcastSubMeteringId", sizeof(sVar.nEgressTrafficSubMeterId[0]), &sVar.nEgressTrafficSubMeterId[0]);
+ scanParamArg(prmc, prmv, "nEgressMulticastSubMeteringId", sizeof(sVar.nEgressTrafficSubMeterId[1]), &sVar.nEgressTrafficSubMeterId[1]);
+ scanParamArg(prmc, prmv, "nEgressUnknownMulticastIPSubMeteringId", sizeof(sVar.nEgressTrafficSubMeterId[2]), &sVar.nEgressTrafficSubMeterId[2]);
+ scanParamArg(prmc, prmv, "nEgressUnknownMulticastNonIPSubMeteringId", sizeof(sVar.nEgressTrafficSubMeterId[3]), &sVar.nEgressTrafficSubMeterId[3]);
+ scanParamArg(prmc, prmv, "nEgressUnknownUnicastSubMeteringId", sizeof(sVar.nEgressTrafficSubMeterId[4]), &sVar.nEgressTrafficSubMeterId[4]);
+
+ scanParamArg(prmc, prmv, "nDestLogicalPortId", sizeof(sVar.nDestLogicalPortId), &sVar.nDestLogicalPortId);
+ if (findStringParam(prmc, prmv, "nDestLogicalPortId"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_CTP_MAPPING;
+
+ scanParamArg(prmc, prmv, "nDestSubIfIdGroup", sizeof(sVar.nDestSubIfIdGroup), &sVar.nDestSubIfIdGroup);
+ if (findStringParam(prmc, prmv, "nDestSubIfIdGroup"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_CTP_MAPPING;
+
+ scanParamArg(prmc, prmv, "bPmapperEnable", sizeof(sVar.bPmapperEnable), &sVar.bPmapperEnable);
+ if (findStringParam(prmc, prmv, "bPmapperEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_CTP_MAPPING;
+
+ if (sVar.bPmapperEnable) {
+ scanParamArg(prmc, prmv, "ePmapperMappingMode", sizeof(sVar.ePmapperMappingMode), &sVar.ePmapperMappingMode);
+ scanPMAP_Arg(prmc, prmv, "nPmapperDestSubIfIdGroup", sVar.sPmapper.nDestSubIfIdGroup);
+ printf("i. The first entry of each P-mapper index is for Non-IP and Non-VLAN tagging packets\n");
+ printf("ii. The entry 8 to 1 of each P-mapper index is for PCP mapping entries\n");
+ printf("iii.The entry 72 to 9 of each P-mapper index is for DSCP mapping entries\n");
+ printf("User Configured nDestSubIfIdGroup list as below\n");
+
+ for (i = 0; i <= 72; i++)
+ printf("sVar.sPmapper.nDestSubIfIdGroup[%d] = %d\n", i, sVar.sPmapper.nDestSubIfIdGroup[i]);
+ }
+
+ scanParamArg(prmc, prmv, "bBridgePortMapEnable", sizeof(bBridgePortMapEnable), &bBridgePortMapEnable);
+ if (findStringParam(prmc, prmv, "bBridgePortMapEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_BRIDGE_PORT_MAP;
+ if (bBridgePortMapEnable) {
+ scanParamArg(prmc, prmv, "Index", sizeof(Index), &Index);
+ scanParamArg(prmc, prmv, "MapValue", sizeof(MapValue), &MapValue);
+
+ /* refer to gsw.h - u16 nBridgePortMap[8]; max can be 16 */
+ if (Index > 7)
+ Index = 7;
+ sVar.nBridgePortMap[Index] = MapValue;
+ }
+
+ scanParamArg(prmc, prmv, "bMcDestIpLookupDisable", sizeof(sVar.bMcDestIpLookupDisable), &sVar.bMcDestIpLookupDisable);
+ if (findStringParam(prmc, prmv, "bMcDestIpLookupDisable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_MC_DEST_IP_LOOKUP;
+
+ scanParamArg(prmc, prmv, "bMcSrcIpLookupEnable", sizeof(sVar.bMcSrcIpLookupEnable), &sVar.bMcSrcIpLookupEnable);
+ if (findStringParam(prmc, prmv, "bMcSrcIpLookupEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_MC_SRC_IP_LOOKUP;
+
+ scanParamArg(prmc, prmv, "bDestMacLookupDisable", sizeof(sVar.bDestMacLookupDisable), &sVar.bDestMacLookupDisable);
+ if (findStringParam(prmc, prmv, "bDestMacLookupDisable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_MC_DEST_MAC_LOOKUP;
+
+ scanParamArg(prmc, prmv, "bSrcMacLearningDisable", sizeof(sVar.bSrcMacLearningDisable), &sVar.bSrcMacLearningDisable);
+ if (findStringParam(prmc, prmv, "bSrcMacLearningDisable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_MC_SRC_MAC_LEARNING;
+
+ scanParamArg(prmc, prmv, "bMacSpoofingDetectEnable", sizeof(sVar.bMacSpoofingDetectEnable), &sVar.bMacSpoofingDetectEnable);
+ if (findStringParam(prmc, prmv, "bMacSpoofingDetectEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_MAC_SPOOFING;
+
+ scanParamArg(prmc, prmv, "bPortLockEnable", sizeof(sVar.bPortLockEnable), &sVar.bPortLockEnable);
+ if (findStringParam(prmc, prmv, "bPortLockEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_PORT_LOCK;
+
+ scanParamArg(prmc, prmv, "bMacLearningLimitEnable", sizeof(sVar.bMacLearningLimitEnable), &sVar.bMacLearningLimitEnable);
+ if (findStringParam(prmc, prmv, "bMacLearningLimitEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_MAC_LEARNING_LIMIT;
+
+ scanParamArg(prmc, prmv, "nMacLearningLimit", sizeof(sVar.nMacLearningLimit), &sVar.nMacLearningLimit);
+
+ scanParamArg(prmc, prmv, "bIngressVlanFilterEnable", sizeof(sVar.bIngressVlanFilterEnable), &sVar.bIngressVlanFilterEnable);
+ if (findStringParam(prmc, prmv, "bIngressVlanFilterEnable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_INGRESS_VLAN_FILTER;
+
+ scanParamArg(prmc, prmv, "nIngressVlanFilterBlockId", sizeof(sVar.nIngressVlanFilterBlockId), &sVar.nIngressVlanFilterBlockId);
+
+ scanParamArg(prmc, prmv, "bBypassEgressVlanFilter1", sizeof(sVar.bBypassEgressVlanFilter1), &sVar.bBypassEgressVlanFilter1);
+ if (findStringParam(prmc, prmv, "bBypassEgressVlanFilter1"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_INGRESS_VLAN_FILTER;
+
+ scanParamArg(prmc, prmv, "bEgressVlanFilter1Enable", sizeof(sVar.bEgressVlanFilter1Enable), &sVar.bEgressVlanFilter1Enable);
+ if (findStringParam(prmc, prmv, "bEgressVlanFilter1Enable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_VLAN_FILTER1;
+
+ scanParamArg(prmc, prmv, "nEgressVlanFilter1BlockId", sizeof(sVar.nEgressVlanFilter1BlockId), &sVar.nEgressVlanFilter1BlockId);
+
+ scanParamArg(prmc, prmv, "bEgressVlanFilter2Enable", sizeof(sVar.bEgressVlanFilter2Enable), &sVar.bEgressVlanFilter2Enable);
+ if (findStringParam(prmc, prmv, "bEgressVlanFilter2Enable"))
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_VLAN_FILTER2;
+
+ scanParamArg(prmc, prmv, "nEgressVlanFilter2BlockId", sizeof(sVar.nEgressVlanFilter2BlockId), &sVar.nEgressVlanFilter2BlockId);
+
+ scanParamArg(prmc, prmv, "bIngressVlanBasedMacLearningEnable", sizeof(sVar.bIngressVlanBasedMacLearningEnable), &sVar.bIngressVlanBasedMacLearningEnable);
+ if (findStringParam(prmc, prmv, "bIngressVlanBasedMacLearningEnable")) {
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_VLAN_BASED_MAC_LEARNING;
+ }
+
+ scanParamArg(prmc, prmv, "bVlanTagSelection", sizeof(sVar.bVlanTagSelection), &sVar.bVlanTagSelection);
+ scanParamArg(prmc, prmv, "bVlanSrcMacPriorityEnable", sizeof(sVar.bVlanSrcMacPriorityEnable), &sVar.bVlanSrcMacPriorityEnable);
+ scanParamArg(prmc, prmv, "bVlanSrcMacDEIEnable", sizeof(sVar.bVlanSrcMacDEIEnable), &sVar.bVlanSrcMacDEIEnable);
+ scanParamArg(prmc, prmv, "bVlanSrcMacVidEnable", sizeof(sVar.bVlanSrcMacVidEnable), &sVar.bVlanSrcMacVidEnable);
+ scanParamArg(prmc, prmv, "bVlanDstMacPriorityEnable", sizeof(sVar.bVlanDstMacPriorityEnable), &sVar.bVlanDstMacPriorityEnable);
+ scanParamArg(prmc, prmv, "bVlanDstMacDEIEnable", sizeof(sVar.bVlanDstMacDEIEnable), &sVar.bVlanDstMacDEIEnable);
+ scanParamArg(prmc, prmv, "bVlanDstMacVidEnable", sizeof(sVar.bVlanDstMacVidEnable), &sVar.bVlanDstMacVidEnable);
+ scanParamArg(prmc, prmv, "bVlanBasedMultiCastLookup", sizeof(sVar.bVlanBasedMultiCastLookup), &sVar.bVlanBasedMultiCastLookup);
+ if (findStringParam(prmc, prmv, "bVlanBasedMultiCastLookup")) {
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_VLAN_BASED_MULTICAST_LOOKUP;
+ }
+
+ scanParamArg(prmc, prmv, "bVlanMulticastPriorityEnable", sizeof(sVar.bVlanMulticastPriorityEnable), &sVar.bVlanMulticastPriorityEnable);
+ scanParamArg(prmc, prmv, "bVlanMulticastDEIEnable", sizeof(sVar.bVlanMulticastDEIEnable), &sVar.bVlanMulticastDEIEnable);
+ scanParamArg(prmc, prmv, "bVlanMulticastVidEnable", sizeof(sVar.bVlanMulticastVidEnable), &sVar.bVlanMulticastVidEnable);
+
+ if (findStringParam(prmc, prmv, "nLoopViolationCount")) {
+ scanParamArg(prmc, prmv, "nLoopViolationCount", sizeof(sVar.nLoopViolationCount), &sVar.nLoopViolationCount);
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_LOOP_VIOLATION_COUNTER;
+ }
+
+ if (findStringParam(prmc, prmv, "bForce")) {
+ sVar.eMask |= GSW_BRIDGE_PORT_CONFIG_MASK_FORCE;
+ }
+
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_BridgePortConfigSet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_BridgePortConfigSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_BridgePortConfigSet done\n");
+ }
+
+ return ret;
+}
+
+
+
+GSW_return_t fapi_GSW_CtpPortConfigGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_CTP_portConfig_t sVar = { 0 };
+ int rret;
+ unsigned int i;
+
+ memset(&sVar, 0x00, sizeof(sVar));
+
+ rret = scanParamArg(prmc, prmv, "nLogicalPortId", sizeof(sVar.nLogicalPortId), &sVar.nLogicalPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nLogicalPortId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "nSubIfIdGroup", sizeof(sVar.nSubIfIdGroup), &sVar.nSubIfIdGroup);
+ scanParamArg(prmc, prmv, "eMask", sizeof(sVar.eMask), &sVar.eMask);
+ if (!sVar.eMask)
+ sVar.eMask = 0xFFFFFFFF;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_CtpPortConfigGet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_CtpPortConfigGet failed with ret code", ret);
+ else{
+ printf("\t nLogicalPortId = %u", sVar.nLogicalPortId);
+ printf("\n\t nSubIfIdGroup = %u", sVar.nSubIfIdGroup);
+ printf("\n\t eMask = 0x%x", sVar.eMask);
+ printf("\n\t nBridgePortId = %u", sVar.nBridgePortId);
+ printf("\n\t bForcedTrafficClass = %u", sVar.bForcedTrafficClass);
+ printf("\n\t nDefaultTrafficClass = %u", sVar.nDefaultTrafficClass);
+ printf("\n\t bIngressExtendedVlanEnable = %u", sVar.bIngressExtendedVlanEnable);
+ printf("\n\t nIngressExtendedVlanBlockId = %u", sVar.nIngressExtendedVlanBlockId);
+ printf("\n\t bIngressExtendedVlanIgmpEnable = %u", sVar.bIngressExtendedVlanIgmpEnable);
+ printf("\n\t nIngressExtendedVlanBlockIdIgmp = %u", sVar.nIngressExtendedVlanBlockIdIgmp);
+ printf("\n\t bEgressExtendedVlanEnable = %u", sVar.bEgressExtendedVlanEnable);
+ printf("\n\t nEgressExtendedVlanBlockId = %u", sVar.nEgressExtendedVlanBlockId);
+ printf("\n\t bEgressExtendedVlanIgmpEnable = %u", sVar.bEgressExtendedVlanIgmpEnable);
+ printf("\n\t nEgressExtendedVlanBlockIdIgmp = %u", sVar.nEgressExtendedVlanBlockIdIgmp);
+ printf("\n\t bIngressNto1VlanEnable = %u", sVar.bIngressNto1VlanEnable);
+ printf("\n\t bEgressNto1VlanEnable = %u", sVar.bEgressNto1VlanEnable);
+ printf("\n\t eIngressMarkingMode = %u", sVar.eIngressMarkingMode);
+ printf("\n\t eEgressMarkingMode = %u", sVar.eEgressMarkingMode);
+ printf("\n\t bEgressMarkingOverrideEnable = %u", sVar.eEgressMarkingModeOverride);
+ printf("\n\t eEgressRemarkingMode = %u", sVar.eEgressRemarkingMode);
+ printf("\n\t bIngressMeteringEnable = %u", sVar.bIngressMeteringEnable);
+ printf("\n\t nIngressTrafficMeterId = %u", sVar.nIngressTrafficMeterId);
+ printf("\n\t bEgressMeteringEnable = %u", sVar.bEgressMeteringEnable);
+ printf("\n\t nEgressTrafficMeterId = %u", sVar.nEgressTrafficMeterId);
+ printf("\n\t bBridgingBypass = %u", sVar.bBridgingBypass);
+ printf("\n\t nDestLogicalPortId = %u", sVar.nDestLogicalPortId);
+ printf("\n\t nDestSubIfIdGroup = %u", sVar.nDestSubIfIdGroup);
+ printf("\n\t bPmapperEnable = %u", sVar.bPmapperEnable);
+ if (sVar.bPmapperEnable) {
+ printf("\n\t ePmapperMappingMode = %u", sVar.ePmapperMappingMode);
+ printf("\n\t nPmapperId = %u", sVar.sPmapper.nPmapperId);
+
+ for (i = 0; i < 73; i++)
+ printf("\n\t nDestSubIfIdGroup[%u] = %u", i, sVar.sPmapper.nDestSubIfIdGroup[i]);
+ }
+
+ printf("\n\t nFirstFlowEntryIndex = %u", sVar.nFirstFlowEntryIndex);
+ printf("\n\t nNumberOfFlowEntries = %u", sVar.nNumberOfFlowEntries);
+ printf("\n\t bIngressDaSaSwapEnable = %u", sVar.bIngressDaSaSwapEnable);
+ printf("\n\t bEgressDaSaSwapEnable = %u", sVar.bEgressDaSaSwapEnable);
+ printf("\n\t bIngressLoopbackEnable = %u", sVar.bIngressLoopbackEnable);
+ printf("\n\t bEgressLoopbackEnable = %u", sVar.bEgressLoopbackEnable);
+ printf("\n\t bIngressMirrorEnable = %u", sVar.bIngressMirrorEnable);
+ printf("\n\t bEgressMirrorEnable = %u", sVar.bEgressMirrorEnable);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+
+
+GSW_return_t fapi_GSW_CtpPortConfigSet(int prmc, char *prmv[])
+{
+ GSW_CTP_portConfig_t sVar = {0};
+ memset(&sVar, 0x00, sizeof(sVar));
+ unsigned int i;
+ GSW_Device_t *dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nLogicalPortId", sizeof(sVar.nLogicalPortId), &sVar.nLogicalPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nLogicalPortId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "nSubIfIdGroup", sizeof(sVar.nSubIfIdGroup), &sVar.nSubIfIdGroup);
+ sVar.eMask = 0xFFFFFFFF;
+
+ dev = gsw_get_struc(lif_id,0);
+ ret = GSW_CtpPortConfigGet(dev, &sVar);
+ sVar.eMask = 0x0;
+
+ scanParamArg(prmc, prmv, "nBridgePortId", sizeof(sVar.nBridgePortId), &sVar.nBridgePortId);
+ if (findStringParam(prmc, prmv, "nBridgePortId"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_BRIDGE_PORT_ID;
+
+ scanParamArg(prmc, prmv, "bForcedTrafficClass", sizeof(sVar.bForcedTrafficClass), &sVar.bForcedTrafficClass);
+ if (findStringParam(prmc, prmv, "bForcedTrafficClass"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_FORCE_TRAFFIC_CLASS;
+
+ scanParamArg(prmc, prmv, "nDefaultTrafficClass", sizeof(sVar.nDefaultTrafficClass), &sVar.nDefaultTrafficClass);
+ if (findStringParam(prmc, prmv, "nDefaultTrafficClass"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_FORCE_TRAFFIC_CLASS;
+
+ scanParamArg(prmc, prmv, "bIngressExtendedVlanEnable", sizeof(sVar.bIngressExtendedVlanEnable), &sVar.bIngressExtendedVlanEnable);
+ if (findStringParam(prmc, prmv, "bIngressExtendedVlanEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_INGRESS_VLAN;
+
+ scanParamArg(prmc, prmv, "nIngressExtendedVlanBlockId", sizeof(sVar.nIngressExtendedVlanBlockId), &sVar.nIngressExtendedVlanBlockId);
+
+ scanParamArg(prmc, prmv, "bIngressExtendedVlanIgmpEnable", sizeof(sVar.bIngressExtendedVlanIgmpEnable), &sVar.bIngressExtendedVlanIgmpEnable);
+ if (findStringParam(prmc, prmv, "bIngressExtendedVlanIgmpEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_INGRESS_VLAN_IGMP;
+
+ scanParamArg(prmc, prmv, "nIngressExtendedVlanBlockIdIgmp", sizeof(sVar.nIngressExtendedVlanBlockIdIgmp), &sVar.nIngressExtendedVlanBlockIdIgmp);
+
+ scanParamArg(prmc, prmv, "bEgressExtendedVlanEnable", sizeof(sVar.bEgressExtendedVlanEnable), &sVar.bEgressExtendedVlanEnable);
+ if (findStringParam(prmc, prmv, "bEgressExtendedVlanEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_EGRESS_VLAN;
+
+ scanParamArg(prmc, prmv, "nEgressExtendedVlanBlockId", sizeof(sVar.nEgressExtendedVlanBlockId), &sVar.nEgressExtendedVlanBlockId);
+
+ scanParamArg(prmc, prmv, "bEgressExtendedVlanIgmpEnable", sizeof(sVar.bEgressExtendedVlanIgmpEnable), &sVar.bEgressExtendedVlanIgmpEnable);
+ if (findStringParam(prmc, prmv, "bEgressExtendedVlanIgmpEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_EGRESS_VLAN_IGMP;
+
+ scanParamArg(prmc, prmv, "nEgressExtendedVlanBlockIdIgmp", sizeof(sVar.nEgressExtendedVlanBlockIdIgmp), &sVar.nEgressExtendedVlanBlockIdIgmp);
+
+ scanParamArg(prmc, prmv, "bIngressNto1VlanEnable", sizeof(sVar.bIngressNto1VlanEnable), &sVar.bIngressNto1VlanEnable);
+ if (findStringParam(prmc, prmv, "bIngressNto1VlanEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_INRESS_NTO1_VLAN;
+
+ scanParamArg(prmc, prmv, "bEgressNto1VlanEnable", sizeof(sVar.bEgressNto1VlanEnable), &sVar.bEgressNto1VlanEnable);
+ if (findStringParam(prmc, prmv, "bEgressNto1VlanEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_EGRESS_NTO1_VLAN;
+
+ scanParamArg(prmc, prmv, "eIngressMarkingMode", sizeof(sVar.eIngressMarkingMode), &sVar.eIngressMarkingMode);
+ if (findStringParam(prmc, prmv, "eIngressMarkingMode"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_INGRESS_MARKING;
+
+ scanParamArg(prmc, prmv, "eEgressMarkingMode", sizeof(sVar.eEgressMarkingMode), &sVar.eEgressMarkingMode);
+ if (findStringParam(prmc, prmv, "eEgressMarkingMode"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_EGRESS_MARKING;
+
+ scanParamArg(prmc, prmv, "bEgressMarkingOverrideEnable", sizeof(sVar.bEgressMarkingOverrideEnable), &sVar.bEgressMarkingOverrideEnable);
+ if (findStringParam(prmc, prmv, "bEgressMarkingOverrideEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_EGRESS_MARKING_OVERRIDE;
+
+ scanParamArg(prmc, prmv, "eEgressMarkingModeOverride", sizeof(sVar.eEgressMarkingModeOverride), &sVar.eEgressMarkingModeOverride);
+
+ scanParamArg(prmc, prmv, "eEgressRemarkingMode", sizeof(sVar.eEgressRemarkingMode), &sVar.eEgressRemarkingMode);
+ if (findStringParam(prmc, prmv, "eEgressRemarkingMode"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_EGRESS_REMARKING;
+
+ scanParamArg(prmc, prmv, "bIngressMeteringEnable", sizeof(sVar.bIngressMeteringEnable), &sVar.bIngressMeteringEnable);
+
+ if (findStringParam(prmc, prmv, "bIngressMeteringEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_INGRESS_METER;
+
+ scanParamArg(prmc, prmv, "nIngressTrafficMeterId", sizeof(sVar.nIngressTrafficMeterId), &sVar.nIngressTrafficMeterId);
+
+ scanParamArg(prmc, prmv, "bEgressMeteringEnable", sizeof(sVar.bEgressMeteringEnable), &sVar.bEgressMeteringEnable);
+ if (findStringParam(prmc, prmv, "bEgressMeteringEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_EGRESS_METER;
+
+ scanParamArg(prmc, prmv, "nEgressTrafficMeterId", sizeof(sVar.nEgressTrafficMeterId), &sVar.nEgressTrafficMeterId);
+
+ scanParamArg(prmc, prmv, "bBridgingBypass", sizeof(sVar.bBridgingBypass), &sVar.bBridgingBypass);
+ if (findStringParam(prmc, prmv, "bBridgingBypass"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_BRIDGING_BYPASS;
+
+ scanParamArg(prmc, prmv, "nDestLogicalPortId", sizeof(sVar.nDestLogicalPortId), &sVar.nDestLogicalPortId);
+ scanParamArg(prmc, prmv, "nDestSubIfIdGroup", sizeof(sVar.nDestSubIfIdGroup), &sVar.nDestSubIfIdGroup);
+
+ scanParamArg(prmc, prmv, "bPmapperEnable", sizeof(sVar.bPmapperEnable), &sVar.bPmapperEnable);
+ if (sVar.bPmapperEnable) {
+ scanParamArg(prmc, prmv, "ePmapperMappingMode", sizeof(sVar.ePmapperMappingMode), &sVar.ePmapperMappingMode);
+ scanPMAP_Arg(prmc, prmv, "nPmapperDestSubIfIdGroup", sVar.sPmapper.nDestSubIfIdGroup);
+ printf("i. The first entry of each P-mapper index is for Non-IP and Non-VLAN tagging packets\n");
+ printf("ii. The entry 8 to 1 of each P-mapper index is for PCP mapping entries\n");
+ printf("iii.The entry 72 to 9 of each P-mapper index is for DSCP mapping entries\n");
+ printf("User Configured nDestSubIfIdGroup list as below\n");
+
+ for (i = 0; i <= 72; i++)
+ printf("sVar.sPmapper.nDestSubIfIdGroup[%d] = %d\n", i, sVar.sPmapper.nDestSubIfIdGroup[i]);
+ }
+
+ scanParamArg(prmc, prmv, "nFirstFlowEntryIndex", sizeof(sVar.nFirstFlowEntryIndex), &sVar.nFirstFlowEntryIndex);
+ if (findStringParam(prmc, prmv, "nFirstFlowEntryIndex"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_FLOW_ENTRY;
+
+ scanParamArg(prmc, prmv, "nNumberOfFlowEntries", sizeof(sVar.nNumberOfFlowEntries), &sVar.nNumberOfFlowEntries);
+
+ scanParamArg(prmc, prmv, "bIngressLoopbackEnable", sizeof(sVar.bIngressLoopbackEnable), &sVar.bIngressLoopbackEnable);
+ if (findStringParam(prmc, prmv, "bIngressLoopbackEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_LOOPBACK_AND_MIRROR;
+
+ scanParamArg(prmc, prmv, "bIngressDaSaSwapEnable", sizeof(sVar.bIngressDaSaSwapEnable), &sVar.bIngressDaSaSwapEnable);
+ if (findStringParam(prmc, prmv, "bIngressDaSaSwapEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_LOOPBACK_AND_MIRROR;
+
+ scanParamArg(prmc, prmv, "bEgressLoopbackEnable", sizeof(sVar.bEgressLoopbackEnable), &sVar.bEgressLoopbackEnable);
+ if (findStringParam(prmc, prmv, "bEgressLoopbackEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_LOOPBACK_AND_MIRROR;
+
+ scanParamArg(prmc, prmv, "bEgressDaSaSwapEnable", sizeof(sVar.bEgressDaSaSwapEnable), &sVar.bEgressDaSaSwapEnable);
+ if (findStringParam(prmc, prmv, "bEgressDaSaSwapEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_LOOPBACK_AND_MIRROR;
+
+ scanParamArg(prmc, prmv, "bIngressMirrorEnable", sizeof(sVar.bIngressMirrorEnable), &sVar.bIngressMirrorEnable);
+ if (findStringParam(prmc, prmv, "bIngressMirrorEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_LOOPBACK_AND_MIRROR;
+
+ scanParamArg(prmc, prmv, "bEgressMirrorEnable", sizeof(sVar.bEgressMirrorEnable), &sVar.bEgressMirrorEnable);
+ if (findStringParam(prmc, prmv, "bEgressMirrorEnable"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_LOOPBACK_AND_MIRROR;
+
+ if (findStringParam(prmc, prmv, "bForce"))
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_FORCE;
+
+
+ ret = GSW_CtpPortConfigSet(dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_CtpPortConfigSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_CtpPortConfigSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_BridgeAlloc(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_BRIDGE_alloc_t param = {0};
+
+ memset(¶m, 0x00, sizeof(param));
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_BridgeAlloc(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_BridgeAlloc failed with ret code", ret);
+ else{
+ printf("\n\t Allocated Bridge ID = %u\n", param.nBridgeId);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_BridgeFree(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_BRIDGE_alloc_t param = {0};
+ int rret;
+
+ memset(¶m, 0x00, sizeof(param));
+
+ rret = scanParamArg(prmc, prmv, "nBridgeId", sizeof(param.nBridgeId), ¶m.nBridgeId);
+ if (rret < 1){
+ printf("Parameter not Found: nBridgeId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_BridgeFree(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_BridgeFree failed with ret code", ret);
+ else{
+ printf("fapi_GSW_BridgeFree done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_BridgeConfigGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_BRIDGE_config_t param = {0};
+ int rret;
+
+ memset(¶m, 0x00, sizeof(param));
+
+ rret = scanParamArg(prmc, prmv, "nBridgeId", sizeof(param.nBridgeId), ¶m.nBridgeId);
+ if (rret < 1){
+ printf("Parameter not Found: nBridgeId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "eMask", sizeof(param.eMask), ¶m.eMask);
+ if (!param.eMask)
+ param.eMask = 0xFFFFFFFF;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_BridgeConfigGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_BridgeConfigGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_BridgeConfigGet done\n");
+ printf("%40s:\t%u\n", "nBridgeId", param.nBridgeId);
+ printf("%40s:\t0x%x\n", "eMask", param.eMask);
+ printf("%40s:\t%u\n", "bMacLearningLimitEnable", param.bMacLearningLimitEnable);
+ printf("%40s:\t%u\n", "nMacLearningLimit", param.nMacLearningLimit);
+ printf("%40s:\t%u\n", "nMacLearningCount", param.nMacLearningCount);
+ printf("%40s:\t%u\n", "nLearningDiscardEvent", param.nLearningDiscardEvent);
+ printf("%40s:\t%u\n", "eForwardBroadcast", param.eForwardBroadcast );
+ printf("%40s:\t%u\n", "eForwardUnknownMulticastIp", param.eForwardUnknownMulticastIp);
+ printf("%40s:\t%u\n", "eForwardUnknownMulticastNonIp", param.eForwardUnknownMulticastNonIp);
+ printf("%40s:\t%u\n", "eForwardUnknownUnicast", param.eForwardUnknownUnicast);
+ printf("%40s:\t%u\n", "bBroadcastMeterEnable", param.bSubMeteringEnable[0]);
+ printf("%40s:\t%u\n", "nBroadcastMeterId", param.nTrafficSubMeterId[0]);
+ printf("%40s:\t%u\n", "bMulticastMeterEnable", param.bSubMeteringEnable[1]);
+ printf("%40s:\t%u\n", "nMulticastMeterId", param.nTrafficSubMeterId[1]);
+ printf("%40s:\t%u\n", "bUnknownMulticastIpMeterEnable", param.bSubMeteringEnable[2]);
+ printf("%40s:\t%u\n", "nUnknownMulticastIpMeterId", param.nTrafficSubMeterId[2]);
+ printf("%40s:\t%u\n", "bUnknownMulticastNonIpMeterEnable", param.bSubMeteringEnable[3]);
+ printf("%40s:\t%u\n", "nUnknownMulticastNonIpMeterId", param.nTrafficSubMeterId[3]);
+ printf("%40s:\t%u\n", "bUnknownUniCastMeterEnable", param.bSubMeteringEnable[4]);
+ printf("%40s:\t%u\n", "nUnknownUniCastMeterId", param.nTrafficSubMeterId[4]);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_BridgeConfigSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_BRIDGE_config_t sVar = {0};
+ memset(&sVar, 0x00, sizeof(sVar));
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nBridgeId", sizeof(sVar.nBridgeId), &sVar.nBridgeId);
+ if (rret < 1){
+ printf("Parameter not Found: nBridgeId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "bMacLearningLimitEnable", sizeof(sVar.bMacLearningLimitEnable), &sVar.bMacLearningLimitEnable);
+ if (findStringParam(prmc, prmv, "bMacLearningLimitEnable"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_MAC_LEARNING_LIMIT;
+
+ scanParamArg(prmc, prmv, "nMacLearningLimit", sizeof(sVar.nMacLearningLimit), &sVar.nMacLearningLimit);
+
+ scanParamArg(prmc, prmv, "eForwardBroadcast", sizeof(sVar.eForwardBroadcast), &sVar.eForwardBroadcast);
+ if (findStringParam(prmc, prmv, "eForwardBroadcast"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_FORWARDING_MODE;
+
+ scanParamArg(prmc, prmv, "eForwardUnknownMulticastIp", sizeof(sVar.eForwardUnknownMulticastIp), &sVar.eForwardUnknownMulticastIp);
+ if (findStringParam(prmc, prmv, "eForwardUnknownMulticastIp"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_FORWARDING_MODE;
+
+ scanParamArg(prmc, prmv, "eForwardUnknownMulticastNonIp", sizeof(sVar.eForwardUnknownMulticastNonIp), &sVar.eForwardUnknownMulticastNonIp);
+ if (findStringParam(prmc, prmv, "eForwardUnknownMulticastNonIp"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_FORWARDING_MODE;
+
+ scanParamArg(prmc, prmv, "eForwardUnknownUnicast", sizeof(sVar.eForwardUnknownUnicast), &sVar.eForwardUnknownUnicast);
+ if (findStringParam(prmc, prmv, "eForwardUnknownUnicast"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_FORWARDING_MODE;
+
+ scanParamArg(prmc, prmv, "bBroadcastMeterEnable", sizeof(sVar.bSubMeteringEnable[0]), &sVar.bSubMeteringEnable[0]);
+ if (findStringParam(prmc, prmv, "bBroadcastMeterEnable"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_SUB_METER;
+
+ scanParamArg(prmc, prmv, "nBroadcastMeterId", sizeof(sVar.nTrafficSubMeterId[0]), &sVar.nTrafficSubMeterId[0]);
+
+ scanParamArg(prmc, prmv, "bMulticastMeterEnable", sizeof(sVar.bSubMeteringEnable[1]), &sVar.bSubMeteringEnable[1]);
+ if (findStringParam(prmc, prmv, "bMulticastMeterEnable"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_SUB_METER;
+
+ scanParamArg(prmc, prmv, "nMulticastMeterId", sizeof(sVar.nTrafficSubMeterId[1]), &sVar.nTrafficSubMeterId[1]);
+
+ scanParamArg(prmc, prmv, "bUnknownMulticastIpMeterEnable", sizeof(sVar.bSubMeteringEnable[2]), &sVar.bSubMeteringEnable[2]);
+ if (findStringParam(prmc, prmv, "bUnknownMulticastIpMeterEnable"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_SUB_METER;
+
+ scanParamArg(prmc, prmv, "nUnknownMulticastIpMeterId", sizeof(sVar.nTrafficSubMeterId[2]), &sVar.nTrafficSubMeterId[2]);
+
+ scanParamArg(prmc, prmv, "bUnknownMulticastNonIpMeterEnable", sizeof(sVar.bSubMeteringEnable[3]), &sVar.bSubMeteringEnable[3]);
+ if (findStringParam(prmc, prmv, "bUnknownMulticastNonIpMeterEnable"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_SUB_METER;
+
+ scanParamArg(prmc, prmv, "nUnknownMulticastNonIpMeterId", sizeof(sVar.nTrafficSubMeterId[3]), &sVar.nTrafficSubMeterId[3]);
+
+ scanParamArg(prmc, prmv, "bUnknownUniCastMeterEnable", sizeof(sVar.bSubMeteringEnable[4]), &sVar.bSubMeteringEnable[4]);
+ if (findStringParam(prmc, prmv, "bUnknownUniCastMeterEnable"))
+ sVar.eMask |= GSW_BRIDGE_CONFIG_MASK_SUB_METER;
+
+ scanParamArg(prmc, prmv, "nUnknownUniCastMeterId", sizeof(sVar.nTrafficSubMeterId[4]), &sVar.nTrafficSubMeterId[4]);
+ if (findStringParam(prmc, prmv, "bForce")) {
+ sVar.eMask |= GSW_CTP_PORT_CONFIG_MASK_FORCE;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_BridgeConfigSet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_BridgeConfigSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_BridgeConfigSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_ExtendedVlanAlloc(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_EXTENDEDVLAN_alloc_t param = {0};
+ int rret;
+
+ memset(¶m, 0x00, sizeof(param));
+
+ rret = scanParamArg(prmc, prmv, "nNumberOfEntries", sizeof(param.nNumberOfEntries), ¶m.nNumberOfEntries);
+ if (rret < 1){
+ printf("Parameter not Found: nNumberOfEntries\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_ExtendedVlanAlloc(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_ExtendedVlanAlloc failed with ret code", ret);
+ else{
+ printf("\n\tAllocated ExtendedVlanblock = %u", param.nExtendedVlanBlockId);
+ printf("\n\tNumber of block entries associated with ExtendedVlanblock %d = %u\n",
+ param.nExtendedVlanBlockId, param.nNumberOfEntries);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_ExtendedVlanFree(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_EXTENDEDVLAN_alloc_t param = {0};
+ int rret;
+
+ memset(¶m, 0x00, sizeof(param));
+
+ rret = scanParamArg(prmc, prmv, "nExtendedVlanBlockId", sizeof(param.nExtendedVlanBlockId), ¶m.nExtendedVlanBlockId);
+ if (rret < 1){
+ printf("Parameter not Found: nExtendedVlanBlockId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_ExtendedVlanFree(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_ExtendedVlanFree failed with ret code", ret);
+ else{
+ printf("\n\tNumber of deleted entries associated with ExVlanblock %d = %u\n",
+ param.nExtendedVlanBlockId, param.nNumberOfEntries);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_ExtendedVlanGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ unsigned char f = 0;
+ GSW_EXTENDEDVLAN_config_t sVar = {0};
+ int rret;
+
+ memset(&sVar, 0x00, sizeof(sVar));
+
+ rret = scanParamArg(prmc, prmv, "nExtendedVlanBlockId", sizeof(sVar.nExtendedVlanBlockId), &sVar.nExtendedVlanBlockId);
+ if (rret < 1){
+ printf("Parameter not Found: nExtendedVlanBlockId\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nEntryIndex", sizeof(sVar.nEntryIndex), &sVar.nEntryIndex);
+ if (rret < 1){
+ printf("Parameter not Found: nEntryIndex\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_ExtendedVlanGet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_ExtendedVlanGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_ExtendedVlanGet done\n");
+
+ printf("%40s:\t%u\n", "nExtendedVlanBlockId", sVar.nExtendedVlanBlockId);
+ printf("%40s:\t%u\n", "nEntryIndex", sVar.nEntryIndex);
+
+ printf("%40s:\t%u\n", "eOuterVlanFilterVlanType",sVar.sFilter.sOuterVlan.eType);
+ printf("%40s:\t%u\n", "bOuterVlanFilterPriorityEnable",sVar.sFilter.sOuterVlan.bPriorityEnable);
+ printf("%40s:\t%u\n", "nOuterVlanFilterPriorityVal",sVar.sFilter.sOuterVlan.nPriorityVal);
+ printf("%40s:\t%u\n", "bOuterVlanFilterVidEnable",sVar.sFilter.sOuterVlan.bVidEnable);
+ printf("%40s:\t%u\n", "nOuterVlanFilterVidVal",sVar.sFilter.sOuterVlan.nVidVal );
+ printf("%40s:\t%u\n", "eOuterVlanFilterTpid",sVar.sFilter.sOuterVlan.eTpid);
+ printf("%40s:\t%u\n", "eOuterVlanFilterDei",sVar.sFilter.sOuterVlan.eDei);
+
+ printf("%40s:\t%u\n", "eInnerVlanFilterVlanType",sVar.sFilter.sInnerVlan.eType);
+ printf("%40s:\t%u\n", "bInnerVlanFilterPriorityEnable",sVar.sFilter.sInnerVlan.bPriorityEnable);
+ printf("%40s:\t%u\n", "nInnerVlanFilterPriorityVal",sVar.sFilter.sInnerVlan.nPriorityVal);
+ printf("%40s:\t%u\n", "bInnerVlanFilterVidEnable",sVar.sFilter.sInnerVlan.bVidEnable);
+ printf("%40s:\t%u\n", "nInnerVlanFilterVidVal",sVar.sFilter.sInnerVlan.nVidVal);
+ printf("%40s:\t%u\n", "eInnerVlanFilterTpid",sVar.sFilter.sInnerVlan.eTpid);
+ printf("%40s:\t%u\n", "eInnerVlanFilterDei",sVar.sFilter.sInnerVlan.eDei);
+
+ printf("%40s:\t%u\n", "eEtherType",sVar.sFilter.eEtherType);
+ printf("%40s:\t%u\n", "eRemoveTagAction",sVar.sTreatment.eRemoveTag);
+
+ printf("%40s:\t%u\n", "bOuterVlanActionEnable",sVar.sTreatment.bAddOuterVlan);
+
+ printf("%40s:\t%u\n", "eOuterVlanActionPriorityMode",sVar.sTreatment.sOuterVlan.ePriorityMode);
+ printf("%40s:\t%u\n", "eOuterVlanActionPriorityVal",sVar.sTreatment.sOuterVlan.ePriorityVal);
+ printf("%40s:\t%u\n", "eOuterVlanActionVidMode",sVar.sTreatment.sOuterVlan.eVidMode);
+ printf("%40s:\t%u\n", "eOuterVlanActionVidVal",sVar.sTreatment.sOuterVlan.eVidVal);
+ printf("%40s:\t%u\n", "eOuterVlanActionTpid",sVar.sTreatment.sOuterVlan.eTpid );
+ printf("%40s:\t%u\n", "eOuterVlanActioneDei",sVar.sTreatment.sOuterVlan.eDei);
+
+ printf("%40s:\t%u\n", "bInnerVlanActionEnable",sVar.sTreatment.bAddInnerVlan);
+
+ printf("%40s:\t%u\n", "eInnerVlanActionPriorityMode",sVar.sTreatment.sInnerVlan.ePriorityMode);
+ printf("%40s:\t%u\n", "eInnerVlanActionPriorityVal",sVar.sTreatment.sInnerVlan.ePriorityVal);
+ printf("%40s:\t%u\n", "eInnerVlanActionVidMode",sVar.sTreatment.sInnerVlan.eVidMode);
+ printf("%40s:\t%u\n", "eInnerVlanActionVidVal",sVar.sTreatment.sInnerVlan.eVidVal);
+ printf("%40s:\t%u\n", "eInnerVlanActionTpid",sVar.sTreatment.sInnerVlan.eTpid);
+ printf("%40s:\t%u\n", "eInnerVlanActioneDei",sVar.sTreatment.sInnerVlan.eDei );
+
+ printf("%40s:\t%u\n", "bNewDscpEnable",sVar.sTreatment.bNewDscpEnable);
+ printf("%40s:\t%u\n", "nNewDscp",sVar.sTreatment.nNewDscp);
+ printf("%40s:\t%u\n", "bNewTrafficClassEnable",sVar.sTreatment.bNewTrafficClassEnable );
+ printf("%40s:\t%u\n", "nNewTrafficClass",sVar.sTreatment.nNewTrafficClass);
+ printf("%40s:\t%u\n", "bNewMeterEnable",sVar.sTreatment.bNewMeterEnable);
+ printf("%40s:\t%u\n", "sNewTrafficMeterId",sVar.sTreatment.sNewTrafficMeterId);
+ printf("%40s:\t%u\n", "bLoopbackEnable",sVar.sTreatment.bLoopbackEnable);
+ printf("%40s:\t%u\n", "bDaSaSwapEnable",sVar.sTreatment.bDaSaSwapEnable);
+ printf("%40s:\t%u\n", "bMirrorEnable",sVar.sTreatment.bMirrorEnable);
+ printf("%40s:\t%u\n", "bReassignBridgePortEnable",sVar.sTreatment.bReassignBridgePort);
+ printf("%40s:\t%u\n", "nNewBridgePortId",sVar.sTreatment.nNewBridgePortId );
+ if (sVar.sTreatment.sOuterVlan.ePriorityMode == GSW_EXTENDEDVLAN_TREATMENT_DSCP ||
+ sVar.sTreatment.sInnerVlan.ePriorityMode == GSW_EXTENDEDVLAN_TREATMENT_DSCP) {
+ for (f = 0; f < 64; f++)
+ printf("\n\t nDscp2PcpMap[%d] = %u", f, sVar.sTreatment.nDscp2PcpMap[f]);
+ }
+
+ scanParamArg(prmc, prmv, "bOriginalPacketFilterMode", sizeof(sVar.sFilter.bOriginalPacketFilterMode), &sVar.sFilter.bOriginalPacketFilterMode);
+ scanParamArg(prmc, prmv, "eFilter_4_Tpid_Mode", sizeof(sVar.sFilter.eFilter_4_Tpid_Mode), &sVar.sFilter.eFilter_4_Tpid_Mode);
+ scanParamArg(prmc, prmv, "eTreatment_4_Tpid_Mode", sizeof(sVar.sTreatment.eTreatment_4_Tpid_Mode), &sVar.sTreatment.eTreatment_4_Tpid_Mode);
+ printf("%40s:\t%u\n", "bOriginalPacketFilterMode",sVar.sFilter.bOriginalPacketFilterMode);
+ printf("%40s:\t%u\n", "eFilter_4_Tpid_Mode", sVar.sFilter.eFilter_4_Tpid_Mode);
+ printf("%40s:\t%u\n", "eTreatment_4_Tpid_Mode",sVar.sTreatment.eTreatment_4_Tpid_Mode);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_ExtendedVlanSet(int prmc, char *prmv[])
+{
+ unsigned char bDscp2PcpMapEnable = 0, nDscp2PcpMapValue = 0, f = 0;
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_EXTENDEDVLAN_config_t sVar = {0};
+
+ memset(&sVar, 0x00, sizeof(sVar));
+
+ scanParamArg(prmc, prmv, "nExtendedVlanBlockId", sizeof(sVar.nExtendedVlanBlockId), &sVar.nExtendedVlanBlockId);
+ scanParamArg(prmc, prmv, "nEntryIndex", sizeof(sVar.nEntryIndex), &sVar.nEntryIndex);
+
+ scanParamArg(prmc, prmv, "eOuterVlanFilterVlanType", sizeof(sVar.sFilter.sOuterVlan.eType), &sVar.sFilter.sOuterVlan.eType);
+ scanParamArg(prmc, prmv, "bOuterVlanFilterPriorityEnable", sizeof(sVar.sFilter.sOuterVlan.bPriorityEnable), &sVar.sFilter.sOuterVlan.bPriorityEnable);
+ scanParamArg(prmc, prmv, "nOuterVlanFilterPriorityVal", sizeof(sVar.sFilter.sOuterVlan.nPriorityVal), &sVar.sFilter.sOuterVlan.nPriorityVal);
+ scanParamArg(prmc, prmv, "bOuterVlanFilterVidEnable", sizeof(sVar.sFilter.sOuterVlan.bVidEnable), &sVar.sFilter.sOuterVlan.bVidEnable);
+ scanParamArg(prmc, prmv, "nOuterVlanFilterVidVal", sizeof(sVar.sFilter.sOuterVlan.nVidVal), &sVar.sFilter.sOuterVlan.nVidVal);
+ scanParamArg(prmc, prmv, "eOuterVlanFilterTpid", sizeof(sVar.sFilter.sOuterVlan.eTpid), &sVar.sFilter.sOuterVlan.eTpid);
+ scanParamArg(prmc, prmv, "eOuterVlanFilterDei", sizeof(sVar.sFilter.sOuterVlan.eDei), &sVar.sFilter.sOuterVlan.eDei);
+
+ scanParamArg(prmc, prmv, "eInnerVlanFilterVlanType", sizeof(sVar.sFilter.sInnerVlan.eType), &sVar.sFilter.sInnerVlan.eType);
+ scanParamArg(prmc, prmv, "bInnerVlanFilterPriorityEnable", sizeof(sVar.sFilter.sInnerVlan.bPriorityEnable), &sVar.sFilter.sInnerVlan.bPriorityEnable);
+ scanParamArg(prmc, prmv, "nInnerVlanFilterPriorityVal", sizeof(sVar.sFilter.sInnerVlan.nPriorityVal), &sVar.sFilter.sInnerVlan.nPriorityVal);
+ scanParamArg(prmc, prmv, "bInnerVlanFilterVidEnable", sizeof(sVar.sFilter.sInnerVlan.bVidEnable), &sVar.sFilter.sInnerVlan.bVidEnable);
+ scanParamArg(prmc, prmv, "nInnerVlanFilterVidVal", sizeof(sVar.sFilter.sInnerVlan.nVidVal), &sVar.sFilter.sInnerVlan.nVidVal);
+ scanParamArg(prmc, prmv, "eInnerVlanFilterTpid", sizeof(sVar.sFilter.sInnerVlan.eTpid), &sVar.sFilter.sInnerVlan.eTpid);
+ scanParamArg(prmc, prmv, "eInnerVlanFilterDei", sizeof(sVar.sFilter.sInnerVlan.eDei), &sVar.sFilter.sInnerVlan.eDei);
+
+ scanParamArg(prmc, prmv, "eEtherType", sizeof(sVar.sFilter.eEtherType), &sVar.sFilter.eEtherType);
+ scanParamArg(prmc, prmv, "eRemoveTagAction", sizeof(sVar.sTreatment.eRemoveTag), &sVar.sTreatment.eRemoveTag);
+
+ scanParamArg(prmc, prmv, "bOuterVlanActionEnable", sizeof(sVar.sTreatment.bAddOuterVlan), &sVar.sTreatment.bAddOuterVlan);
+ scanParamArg(prmc, prmv, "eOuterVlanActionPriorityMode", sizeof(sVar.sTreatment.sOuterVlan.ePriorityMode), &sVar.sTreatment.sOuterVlan.ePriorityMode);
+ scanParamArg(prmc, prmv, "eOuterVlanActionPriorityVal", sizeof(sVar.sTreatment.sOuterVlan.ePriorityVal), &sVar.sTreatment.sOuterVlan.ePriorityVal);
+ scanParamArg(prmc, prmv, "eOuterVlanActionVidMode", sizeof(sVar.sTreatment.sOuterVlan.eVidMode), &sVar.sTreatment.sOuterVlan.eVidMode);
+ scanParamArg(prmc, prmv, "eOuterVlanActionVidVal", sizeof(sVar.sTreatment.sOuterVlan.eVidVal), &sVar.sTreatment.sOuterVlan.eVidVal);
+ scanParamArg(prmc, prmv, "eOuterVlanActionTpid", sizeof(sVar.sTreatment.sOuterVlan.eTpid), &sVar.sTreatment.sOuterVlan.eTpid);
+ scanParamArg(prmc, prmv, "eOuterVlanActioneDei", sizeof(sVar.sTreatment.sOuterVlan.eDei), &sVar.sTreatment.sOuterVlan.eDei);
+
+ scanParamArg(prmc, prmv, "bInnerVlanActionEnable", sizeof(sVar.sTreatment.bAddInnerVlan), &sVar.sTreatment.bAddInnerVlan);
+ scanParamArg(prmc, prmv, "eInnerVlanActionPriorityMode", sizeof(sVar.sTreatment.sInnerVlan.ePriorityMode), &sVar.sTreatment.sInnerVlan.ePriorityMode);
+ scanParamArg(prmc, prmv, "eInnerVlanActionPriorityVal", sizeof(sVar.sTreatment.sInnerVlan.ePriorityVal), &sVar.sTreatment.sInnerVlan.ePriorityVal);
+ scanParamArg(prmc, prmv, "eInnerVlanActionVidMode", sizeof(sVar.sTreatment.sInnerVlan.eVidMode), &sVar.sTreatment.sInnerVlan.eVidMode);
+ scanParamArg(prmc, prmv, "eInnerVlanActionVidVal", sizeof(sVar.sTreatment.sInnerVlan.eVidVal), &sVar.sTreatment.sInnerVlan.eVidVal);
+ scanParamArg(prmc, prmv, "eInnerVlanActionTpid", sizeof(sVar.sTreatment.sInnerVlan.eTpid), &sVar.sTreatment.sInnerVlan.eTpid);
+ scanParamArg(prmc, prmv, "eInnerVlanActioneDei", sizeof(sVar.sTreatment.sInnerVlan.eDei), &sVar.sTreatment.sInnerVlan.eDei);
+
+ scanParamArg(prmc, prmv, "bReassignBridgePortEnable", sizeof(sVar.sTreatment.bReassignBridgePort), &sVar.sTreatment.bReassignBridgePort);
+ scanParamArg(prmc, prmv, "nNewBridgePortId", sizeof(sVar.sTreatment.nNewBridgePortId), &sVar.sTreatment.nNewBridgePortId);
+
+ scanParamArg(prmc, prmv, "bNewDscpEnable", sizeof(sVar.sTreatment.bNewDscpEnable), &sVar.sTreatment.bNewDscpEnable);
+ scanParamArg(prmc, prmv, "nNewDscp", sizeof(sVar.sTreatment.nNewDscp), &sVar.sTreatment.nNewDscp);
+
+ scanParamArg(prmc, prmv, "bNewTrafficClassEnable", sizeof(sVar.sTreatment.bNewTrafficClassEnable), &sVar.sTreatment.bNewTrafficClassEnable);
+ scanParamArg(prmc, prmv, "nNewTrafficClass", sizeof(sVar.sTreatment.nNewTrafficClass), &sVar.sTreatment.nNewTrafficClass);
+
+ scanParamArg(prmc, prmv, "bNewMeterEnable", sizeof(sVar.sTreatment.bNewMeterEnable), &sVar.sTreatment.bNewMeterEnable);
+ scanParamArg(prmc, prmv, "sNewTrafficMeterId", sizeof(sVar.sTreatment.sNewTrafficMeterId), &sVar.sTreatment.sNewTrafficMeterId);
+
+ scanParamArg(prmc, prmv, "bLoopbackEnable", sizeof(sVar.sTreatment.bLoopbackEnable), &sVar.sTreatment.bLoopbackEnable);
+ scanParamArg(prmc, prmv, "bDaSaSwapEnable", sizeof(sVar.sTreatment.bDaSaSwapEnable), &sVar.sTreatment.bDaSaSwapEnable);
+ scanParamArg(prmc, prmv, "bMirrorEnable", sizeof(sVar.sTreatment.bMirrorEnable), &sVar.sTreatment.bMirrorEnable);
+
+ scanParamArg(prmc, prmv, "bDscp2PcpMapEnable", sizeof(bDscp2PcpMapEnable), &bDscp2PcpMapEnable);
+ scanParamArg(prmc, prmv, "nDscp2PcpMapValue", sizeof(nDscp2PcpMapValue), &nDscp2PcpMapValue);
+ if (bDscp2PcpMapEnable) {
+ for (f = 0; f < 64; f++)
+ sVar.sTreatment.nDscp2PcpMap[f] = nDscp2PcpMapValue;
+ }
+
+ scanParamArg(prmc, prmv, "bOriginalPacketFilterMode", sizeof(sVar.sFilter.bOriginalPacketFilterMode), &sVar.sFilter.bOriginalPacketFilterMode);
+ scanParamArg(prmc, prmv, "eFilter_4_Tpid_Mode", sizeof(sVar.sFilter.eFilter_4_Tpid_Mode), &sVar.sFilter.eFilter_4_Tpid_Mode);
+ scanParamArg(prmc, prmv, "eTreatment_4_Tpid_Mode", sizeof(sVar.sTreatment.eTreatment_4_Tpid_Mode), &sVar.sTreatment.eTreatment_4_Tpid_Mode);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_ExtendedVlanSet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_ExtendedVlanSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_ExtendedVlanSet done\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_VlanFilterAlloc(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_VLANFILTER_alloc_t param = {0};
+ int rret;
+
+ memset(¶m, 0x00, sizeof(param));
+
+ rret = scanParamArg(prmc, prmv, "nNumberOfEntries", sizeof(param.nNumberOfEntries), ¶m.nNumberOfEntries);
+ if (rret < 1){
+ printf("Parameter not Found: nNumberOfEntries\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "bDiscardUntagged", sizeof(param.bDiscardUntagged), ¶m.bDiscardUntagged);
+ if (rret < 1){
+ printf("Parameter not Found: bDiscardUntagged\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "bDiscardUnmatchedTagged", sizeof(param.bDiscardUnmatchedTagged), ¶m.bDiscardUnmatchedTagged);
+ if (rret < 1){
+ printf("Parameter not Found: bDiscardUnmatchedTagged\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_VlanFilterAlloc(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_VlanFilterAlloc failed with ret code", ret);
+ else{
+ printf("\n\tAllocated VlanFilterblock = %u", param.nVlanFilterBlockId);
+ printf("\n\t Number of block entries associated with VlanFilterblock %d = %u\n",
+ param.nVlanFilterBlockId, param.nNumberOfEntries);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_VlanFilterFree(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_VLANFILTER_alloc_t param = {0};
+ int rret;
+
+ memset(¶m, 0x00, sizeof(param));
+
+ rret = scanParamArg(prmc, prmv, "nVlanFilterBlockId", sizeof(param.nVlanFilterBlockId), ¶m.nVlanFilterBlockId);
+ if (rret < 1){
+ printf("Parameter not Found: nVlanFilterBlockId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_VlanFilterFree(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_VlanFilterFree failed with ret code", ret);
+ else{
+ printf("\n\t Number of deleted entries associated with VlanFilterblock %d = %u\n",
+ param.nVlanFilterBlockId, param.nNumberOfEntries);
+ }
+
+ return ret;
+}
+
+
+
+GSW_return_t fapi_GSW_VlanFilterGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ unsigned char f = 0;
+
+ GSW_VLANFILTER_config_t sVar = {0};
+ int rret;
+
+ memset(&sVar, 0x00, sizeof(sVar));
+
+ rret = scanParamArg(prmc, prmv, "nVlanFilterBlockId", sizeof(sVar.nVlanFilterBlockId), &sVar.nVlanFilterBlockId);
+ if (rret < 1){
+ printf("Parameter not Found: nVlanFilterBlockId\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nEntryIndex", sizeof(sVar.nEntryIndex), &sVar.nEntryIndex);
+ if (rret < 1){
+ printf("Parameter not Found: nEntryIndex\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_VlanFilterGet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_VlanFilterGet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_VlanFilterGet done\n");
+ printf("%40s:\t%u\n", "nVlanFilterBlockId", sVar.nVlanFilterBlockId);
+ printf("%40s:\t%u\n", "nEntryIndex", sVar.nEntryIndex);
+ printf("%40s:\t%u\n", "eVlanFilterMask",sVar.eVlanFilterMask);
+ printf("%40s:\t%u\n", "nVal",sVar.nVal);
+ printf("%40s:\t%u\n", "bDiscardMatched",sVar.bDiscardMatched);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_VlanFilterSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ unsigned char f = 0;
+ GSW_VLANFILTER_config_t sVar = {0};
+ int rret;
+
+ memset(&sVar, 0x00, sizeof(sVar));
+
+ rret = scanParamArg(prmc, prmv, "nVlanFilterBlockId", sizeof(sVar.nVlanFilterBlockId), &sVar.nVlanFilterBlockId);
+ if (rret < 1){
+ printf("Parameter not Found: nVlanFilterBlockId\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nEntryIndex", sizeof(sVar.nEntryIndex), &sVar.nEntryIndex);
+ if (rret < 1){
+ printf("Parameter not Found: nEntryIndex\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "eVlanFilterMask", sizeof(sVar.eVlanFilterMask), &sVar.eVlanFilterMask);
+ if (rret < 1){
+ printf("Parameter not Found: eVlanFilterMask\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nVal", sizeof(sVar.nVal), &sVar.nVal);
+ if (rret < 1){
+ printf("Parameter not Found: nVal\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "bDiscardMatched", sizeof(sVar.bDiscardMatched), &sVar.bDiscardMatched);
+ if (rret < 1){
+ printf("Parameter not Found: bDiscardMatched\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_VlanFilterSet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_VlanFilterSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_VlanFilterSet done\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_STP_PortCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_STP_portCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_STP_PortCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_STP_PortCfgGet failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n", "nPortId", param.nPortId );
+ printf("\t%40s:\t%x\n", "ePortState", param.ePortState);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_STP_PortCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_STP_portCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "ePortState", sizeof(param.ePortState), ¶m.ePortState);
+ if (rret < 1){
+ printf("Parameter not Found: ePortState\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_STP_PortCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_STP_PortCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_STP_PortCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_STP_BPDU_RuleGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_STP_BPDU_Rule_t param = {0};
+ int rret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_STP_BPDU_RuleGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_STP_BPDU_RuleGet failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n", "eForwardPort", param.eForwardPort );
+ printf("\t%40s:\t%x\n", "nForwardPortId", param.nForwardPortId);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_STP_BPDU_RuleSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_STP_BPDU_Rule_t param = {0};
+ int rret;
+
+ scanParamArg(prmc, prmv, "eForwardPort", sizeof(param.eForwardPort), ¶m.eForwardPort);
+ scanParamArg(prmc, prmv, "nForwardPortId", sizeof(param.nForwardPortId), ¶m.nForwardPortId);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_STP_BPDU_RuleSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_STP_BPDU_RuleSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_STP_BPDU_RuleSet done\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_QoS_MeterCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_meterCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nMeterId", sizeof(param.nMeterId), ¶m.nMeterId);
+ if (rret < 1){
+ printf("Parameter not Found: nMeterId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_MeterCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_MeterCfgGet failed with ret code", ret);
+ else{
+ printf("Returned values:\n----------------\n");
+ printf("\t%40s:\t%s\n", "bEnable", (param.bEnable > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%x\n", "nMeterId", param.nMeterId);
+ printf("\t%40s:\t%x\n", "eMtrType", param.eMtrType);
+ printf("\t%40s:\t%u (0x%x)\n", "nCbs", param.nCbs,param.nCbs);
+ printf("\t%40s:\t%u (0x%x)\n", "nEbs", param.nEbs,param.nEbs);
+ printf("\t%40s:\t%x\n", "nCbs_ls", param.nCbs_ls);
+ printf("\t%40s:\t%x\n", "nEbs_ls", param.nEbs_ls);
+ printf("\t%40s:\t%u (0x%x)\n", "nRate", param.nRate,param.nRate);
+ printf("\t%40s:\t%u (0x%x)\n", "nPiRate", param.nPiRate,param.nPiRate);
+ //printf("\t%40s:\t%x\n", "cMeterName", param.cMeterName);
+ printf("\t%40s:\t%x\n", "nColourBlindMode", param.nColourBlindMode);
+ printf("\t%40s:\t%x\n", "bPktMode", param.bPktMode);
+ printf("\t%40s:\t%s\n", "bLocalOverhd", (param.bLocalOverhd > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%u (0x%x)\n", "nLocaloverhd", param.nLocaloverhd,param.nLocaloverhd);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_QoS_MeterCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_meterCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nMeterId", sizeof(param.nMeterId), ¶m.nMeterId);
+ if (rret < 1){
+ printf("Parameter not Found: nMeterId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "bEnable", sizeof(param.bEnable), ¶m.bEnable);
+ scanParamArg(prmc, prmv, "eMtrType", sizeof(param.eMtrType), ¶m.eMtrType);
+ scanParamArg(prmc, prmv, "nCbs", sizeof(param.nCbs), ¶m.nCbs);
+ scanParamArg(prmc, prmv, "nEbs", sizeof(param.nEbs), ¶m.nEbs);
+ scanParamArg(prmc, prmv, "nCbs_ls", sizeof(param.nCbs_ls), ¶m.nCbs_ls);
+ scanParamArg(prmc, prmv, "nEbs_ls", sizeof(param.nEbs_ls), ¶m.nEbs_ls);
+ scanParamArg(prmc, prmv, "nRate", sizeof(param.nRate), ¶m.nRate);
+ scanParamArg(prmc, prmv, "nPiRate", sizeof(param.nPiRate), ¶m.nPiRate);
+ scanParamArg(prmc, prmv, "cMeterName", sizeof(param.cMeterName), ¶m.cMeterName);
+ scanParamArg(prmc, prmv, "nColourBlindMode", sizeof(param.nColourBlindMode), ¶m.nColourBlindMode);
+ scanParamArg(prmc, prmv, "bPktMode", sizeof(param.bPktMode), ¶m.bPktMode);
+ scanParamArg(prmc, prmv, "bLocalOverhd", sizeof(param.bLocalOverhd), ¶m.bLocalOverhd);
+ scanParamArg(prmc, prmv, "nLocaloverhd", sizeof(param.nLocaloverhd), ¶m.nLocaloverhd);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QoS_MeterCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_MeterCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_MeterCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MAC_DefaultFilterGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_MACFILTER_default_t param = {0};
+ int rret,i;
+
+ rret = scanParamArg(prmc, prmv, "eType", sizeof(param.eType), ¶m.eType);
+ if (rret < 1){
+ printf("Parameter not Found: eType\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_DefaultMacFilterGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MAC_DefaultFilterGet failed with ret code", ret);
+ else{
+ printf("Returned values:\n----------------\n");
+ for (i = 0; i <= 7; i++)
+ printf("\t nPortmap[%d] = 0x%x\n", i, param.nPortmap[i]);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_MAC_DefaultFilterSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_MACFILTER_default_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "eType", sizeof(param.eType), ¶m.eType);
+ if (rret < 1){
+ printf("Parameter not Found: eType\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_DefaultMacFilterSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MAC_DefaultFilterSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MAC_DefaultFilterSet done\n");
+ }
+
+ return ret;
+}
+
+
+
+
+GSW_return_t fapi_GSW_CTP_PortAssignmentGet(int prmc, char *prmv[])
+{
+ GSW_CTP_portAssignment_t sVar = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nLogicalPortId", sizeof(sVar.nLogicalPortId), &sVar.nLogicalPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nLogicalPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_CTP_PortAssignmentGet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_CTP_PortAssignmentGet failed with ret code", ret);
+ else{
+ printf("\n\t nLogicalPortId = %u", sVar.nLogicalPortId);
+ printf("\n\t nFirstCtpPortId = %u", sVar.nFirstCtpPortId);
+ printf("\n\t nNumberOfCtpPort = %u", sVar.nNumberOfCtpPort);
+ printf("\n\t eMode = %u", sVar.eMode);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_CTP_PortAssignmentSet(int prmc, char *prmv[])
+{
+ GSW_CTP_portAssignment_t sVar = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nLogicalPortId", sizeof(sVar.nLogicalPortId), &sVar.nLogicalPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nLogicalPortId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "nFirstCtpPortId", sizeof(sVar.nFirstCtpPortId), &sVar.nFirstCtpPortId);
+ scanParamArg(prmc, prmv, "nNumberOfCtpPort", sizeof(sVar.nNumberOfCtpPort), &sVar.nNumberOfCtpPort);
+ scanParamArg(prmc, prmv, "eMode", sizeof(sVar.eMode), &sVar.eMode);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_CTP_PortAssignmentSet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_CTP_PortAssignmentSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_CTP_PortAssignmentSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PMAC_IG_CfgSet(int prmc, char *prmv[])
+{
+ GSW_PMAC_Ig_Cfg_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPmacId", sizeof(param.nPmacId), ¶m.nPmacId);
+ if (rret < 1){
+ printf("Parameter not Found: nPmacId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "nTxDmaChanId", sizeof(param.nTxDmaChanId), ¶m.nTxDmaChanId);
+ scanParamArg(prmc, prmv, "bErrPktsDisc", sizeof(param.bErrPktsDisc), ¶m.bErrPktsDisc);
+ scanParamArg(prmc, prmv, "bPmapDefault", sizeof(param.bPmapDefault), ¶m.bPmapDefault);
+ scanParamArg(prmc, prmv, "bPmapEna", sizeof(param.bPmapEna), ¶m.bPmapEna);
+ scanParamArg(prmc, prmv, "bClassDefault", sizeof(param.bClassDefault), ¶m.bClassDefault);
+ scanParamArg(prmc, prmv, "bClassEna", sizeof(param.bClassEna), ¶m.bClassEna);
+ scanParamArg(prmc, prmv, "eSubId", sizeof(param.eSubId), ¶m.eSubId);
+ scanParamArg(prmc, prmv, "bSpIdDefault", sizeof(param.bSpIdDefault), ¶m.bSpIdDefault);
+ scanParamArg(prmc, prmv, "bPmacPresent", sizeof(param.bPmacPresent), ¶m.bPmacPresent);
+ scanPMAC_Arg(prmc, prmv, "defPmacHdr", param.defPmacHdr);
+
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PMAC_IG_CfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PMAC_IG_CfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_PMAC_IG_CfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PMAC_IG_CfgGet(int prmc, char *prmv[])
+{
+ GSW_PMAC_Ig_Cfg_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPmacId", sizeof(param.nPmacId), ¶m.nPmacId);
+ if (rret < 1){
+ printf("Parameter not Found: nPmacId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "nTxDmaChanId", sizeof(param.nTxDmaChanId), ¶m.nTxDmaChanId);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PMAC_IG_CfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PMAC_IG_CfgGet failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n","nPmacId ", param.nPmacId);
+ printf("\t%40s:\t%x\n","nTxDmaChanId", param.nTxDmaChanId);
+ printf("\t%40s:\t%x\n","bErrPktsDisc", param.bErrPktsDisc);
+ printf("\t%40s:\t%x\n","bPmapDefault", param.bPmapDefault);
+ printf("\t%40s:\t%x\n","bPmapEna", param.bPmapEna);
+ printf("\t%40s:\t%x\n","bClassDefault", param.bClassDefault);
+ printf("\t%40s:\t%x\n","bClassEna", param.bClassEna);
+ printf("\t%40s:\t%x\n","eSubId ", param.eSubId);
+ printf("\t%40s:\t%x\n","bSpIdDefault", param.bSpIdDefault);
+ printf("\t%40s:\t%x\n","bPmacPresent", param.bPmacPresent);
+ printf("\t%40s:\t","defPmacHdr");
+ printf("%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
+ param.defPmacHdr[0],
+ param.defPmacHdr[1],
+ param.defPmacHdr[2],
+ param.defPmacHdr[3],
+ param.defPmacHdr[4],
+ param.defPmacHdr[5],
+ param.defPmacHdr[6],
+ param.defPmacHdr[7]);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PMAC_EG_CfgGet(int prmc, char *prmv[])
+{
+ GSW_PMAC_Eg_Cfg_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPmacId", sizeof(param.nPmacId), ¶m.nPmacId);
+ if (rret < 1){
+ printf("Parameter not Found: nPmacId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "nDestPortId", sizeof(param.nDestPortId), ¶m.nDestPortId);
+ scanParamArg(prmc, prmv, "bProcFlagsSelect", sizeof(param.bProcFlagsSelect), ¶m.bProcFlagsSelect);
+ scanParamArg(prmc, prmv, "nTrafficClass", sizeof(param.nTrafficClass), ¶m.nTrafficClass);
+ scanParamArg(prmc, prmv, "nFlowIDMsb", sizeof(param.nFlowIDMsb), ¶m.nFlowIDMsb);
+ scanParamArg(prmc, prmv, "bMpe1Flag", sizeof(param.bMpe1Flag), ¶m.bMpe1Flag);
+ scanParamArg(prmc, prmv, "bMpe2Flag", sizeof(param.bMpe2Flag), ¶m.bMpe2Flag);
+ scanParamArg(prmc, prmv, "bEncFlag", sizeof(param.bEncFlag), ¶m.bEncFlag);
+ scanParamArg(prmc, prmv, "bDecFlag", sizeof(param.bDecFlag), ¶m.bDecFlag);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PMAC_EG_CfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PMAC_EG_CfgGet failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n","nPmacId ", param.nPmacId);
+ printf("\t%40s:\t%x\n","nDestPortId", param.nDestPortId);
+ printf("\t%40s:\t%x\n","nTrafficClass", param.nTrafficClass);
+ printf("\t%40s:\t%x\n","bMpe1Flag", param.bMpe1Flag);
+ printf("\t%40s:\t%x\n","bMpe2Flag", param.bMpe2Flag);
+ printf("\t%40s:\t%x\n","bDecFlag", param.bDecFlag);
+ printf("\t%40s:\t%x\n","bEncFlag", param.bEncFlag);
+ printf("\t%40s:\t%x\n","nFlowIDMsb", param.nFlowIDMsb);
+ printf("\t%40s:\t%x\n","bProcFlagsSelect", param.bProcFlagsSelect);
+ printf("\t%40s:\t%x\n","nRxDmaChanId", param.nRxDmaChanId);
+ printf("\t%40s:\t%x\n","bRemL2Hdr", param.bRemL2Hdr);
+ printf("\t%40s:\t%x\n","numBytesRem", param.numBytesRem);
+ printf("\t%40s:\t%x\n","bFcsEna ", param.bFcsEna);
+ printf("\t%40s:\t%x\n","bPmacEna", param.bPmacEna);
+ printf("\t%40s:\t%x\n","bRedirEnable", param.bRedirEnable);
+ printf("\t%40s:\t%x\n","bBslSegmentDisable", param.bBslSegmentDisable);
+ printf("\t%40s:\t%x\n","nBslTrafficClass", param.nBslTrafficClass);
+ printf("\t%40s:\t%x\n","bResDW1Enable", param.bResDW1Enable);
+ printf("\t%40s:\t%x\n","nResDW1", param.nResDW1);
+ printf("\t%40s:\t%x\n","bRes1DW0Enable", param.bRes1DW0Enable);
+ printf("\t%40s:\t%x\n","nRes1DW0", param.nRes1DW0);
+ printf("\t%40s:\t%x\n","bRes2DW0Enable", param.bRes2DW0Enable);
+ printf("\t%40s:\t%x\n","nRes2DW0", param.nRes2DW0);
+ printf("\t%40s:\t%x\n","bTCEnable", param.bTCEnable);
+ }
+ return ret;
+
+}
+
+
+GSW_return_t fapi_GSW_PMAC_EG_CfgSet(int prmc, char *prmv[])
+{
+ GSW_PMAC_Eg_Cfg_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPmacId", sizeof(param.nPmacId), ¶m.nPmacId);
+ if (rret < 1){
+ printf("Parameter not Found: nPmacId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "bRedirEnable", sizeof(param.bRedirEnable), ¶m.bRedirEnable);
+ scanParamArg(prmc, prmv, "bBslSegmentDisable", sizeof(param.bBslSegmentDisable), ¶m.bBslSegmentDisable);
+ scanParamArg(prmc, prmv, "nBslTrafficClass", sizeof(param.nBslTrafficClass), ¶m.nBslTrafficClass);
+ scanParamArg(prmc, prmv, "bResDW1Enable", sizeof(param.bResDW1Enable), ¶m.bResDW1Enable);
+ scanParamArg(prmc, prmv, "bRes2DW0Enable", sizeof(param.bRes2DW0Enable), ¶m.bRes2DW0Enable);
+ scanParamArg(prmc, prmv, "bRes1DW0Enable", sizeof(param.bRes1DW0Enable), ¶m.bRes1DW0Enable);
+ scanParamArg(prmc, prmv, "bTCEnable", sizeof(param.bTCEnable), ¶m.bTCEnable);
+ scanParamArg(prmc, prmv, "nDestPortId", sizeof(param.nDestPortId), ¶m.nDestPortId);
+ scanParamArg(prmc, prmv, "bProcFlagsSelect", sizeof(param.bProcFlagsSelect), ¶m.bProcFlagsSelect);
+ scanParamArg(prmc, prmv, "nTrafficClass", sizeof(param.nTrafficClass), ¶m.nTrafficClass);
+ scanParamArg(prmc, prmv, "nFlowIDMsb", sizeof(param.nFlowIDMsb), ¶m.nFlowIDMsb);
+ scanParamArg(prmc, prmv, "bMpe1Flag", sizeof(param.bMpe1Flag), ¶m.bMpe1Flag);
+ scanParamArg(prmc, prmv, "bMpe2Flag", sizeof(param.bMpe2Flag), ¶m.bMpe2Flag);
+ scanParamArg(prmc, prmv, "bEncFlag", sizeof(param.bEncFlag), ¶m.bEncFlag);
+ scanParamArg(prmc, prmv, "bDecFlag", sizeof(param.bDecFlag), ¶m.bDecFlag);
+ scanParamArg(prmc, prmv, "nRxDmaChanId", sizeof(param.nRxDmaChanId), ¶m.nRxDmaChanId);
+ scanParamArg(prmc, prmv, "bRemL2Hdr", sizeof(param.bRemL2Hdr), ¶m.bRemL2Hdr);
+ scanParamArg(prmc, prmv, "numBytesRem", sizeof(param.numBytesRem), ¶m.numBytesRem);
+ scanParamArg(prmc, prmv, "bFcsEna", sizeof(param.bFcsEna), ¶m.bFcsEna);
+ scanParamArg(prmc, prmv, "bPmacEna", sizeof(param.bPmacEna), ¶m.bPmacEna);
+ scanParamArg(prmc, prmv, "nResDW1", sizeof(param.nResDW1), ¶m.nResDW1);
+ scanParamArg(prmc, prmv, "nRes1DW0", sizeof(param.nRes1DW0), ¶m.nRes1DW0);
+ scanParamArg(prmc, prmv, "nRes2DW0", sizeof(param.nRes2DW0), ¶m.nRes2DW0);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PMAC_EG_CfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PMAC_EG_CfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_PMAC_EG_CfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PMAC_BM_CfgGet(int prmc, char *prmv[])
+{
+ GSW_PMAC_BM_Cfg_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nTxDmaChanId", sizeof(param.nTxDmaChanId), ¶m.nTxDmaChanId);
+ if (rret < 1){
+ printf("Parameter not Found: nTxDmaChanId\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nPmacId", sizeof(param.nPmacId), ¶m.nPmacId);
+ if (rret < 1){
+ printf("Parameter not Found: nPmacId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PMAC_BM_CfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PMAC_BM_CfgGet failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n","nTxDmaChanId ", param.nTxDmaChanId);
+ printf("\t%40s:\t%x\n","txQMask ", param.txQMask);
+ printf("\t%40s:\t%x\n","rxPortMask ", param.rxPortMask);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PMAC_BM_CfgSet(int prmc, char *prmv[])
+{
+ GSW_PMAC_BM_Cfg_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nTxDmaChanId", sizeof(param.nTxDmaChanId), ¶m.nTxDmaChanId);
+ if (rret < 1){
+ printf("Parameter not Found: nTxDmaChanId\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "nPmacId", sizeof(param.nPmacId), ¶m.nPmacId);
+ if (rret < 1){
+ printf("Parameter not Found: nPmacId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "txQMask", sizeof(param.txQMask), ¶m.txQMask);
+ scanParamArg(prmc, prmv, "rxPortMask", sizeof(param.rxPortMask), ¶m.rxPortMask);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PMAC_BM_CfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PMAC_BM_CfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_PMAC_BM_CfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PMAC_GLBL_CfgGet(int prmc, char *prmv[])
+{
+ GSW_PMAC_Glbl_Cfg_t param = {0};
+ unsigned int i = 0;
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPmacId", sizeof(param.nPmacId), ¶m.nPmacId);
+ if (rret < 1){
+ printf("Parameter not Found: nPmacId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PMAC_GLBL_CfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PMAC_GLBL_CfgGet failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n","nPmacId", param.nPmacId);
+ printf("\t%40s:\t%x\n","bAPadEna", param.bAPadEna);
+ printf("\t%40s:\t%x\n","bPadEna", param.bPadEna);
+ printf("\t%40s:\t%x\n","bVPadEna", param.bVPadEna);
+ printf("\t%40s:\t%x\n","bSVPadEna", param.bSVPadEna);
+ printf("\t%40s:\t%x\n","bRxFCSDis", param.bRxFCSDis);
+ printf("\t%40s:\t%x\n","bTxFCSDis", param.bTxFCSDis);
+ printf("\t%40s:\t%x\n","bIPTransChkRegDis", param.bIPTransChkRegDis);
+ printf("\t%40s:\t%x\n","bIPTransChkVerDis", param.bIPTransChkVerDis);
+ printf("\t%40s:\t%x\n","bJumboEna", param.bJumboEna);
+ printf("\t%40s:\t%u\n","nMaxJumboLen", param.nMaxJumboLen);
+ printf("\t%40s:\t%x\n","nJumboThreshLen", param.nJumboThreshLen);
+ printf("\t%40s:\t%x\n","bLongFrmChkDis", param.bLongFrmChkDis);
+ printf("\t%40s:\t%x\n","eShortFrmChkType", param.eShortFrmChkType);
+ printf("\t%40s:\t%x\n","bProcFlagsEgCfgEna", param.bProcFlagsEgCfgEna);
+ printf("\t%40s:\t%x\n","eProcFlagsEgCfg", param.eProcFlagsEgCfg);
+
+ for (i = 0; i <= 2; i++)
+ printf("\t%40s[%i]:\t%u\n","nBslThreshold", i, param.nBslThreshold[i]);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PMAC_GLBL_CfgSet(int prmc, char *prmv[])
+{
+ GSW_PMAC_Glbl_Cfg_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PMAC_GLBL_CfgGet(gsw_dev, ¶m);
+
+ rret = scanParamArg(prmc, prmv, "nPmacId", sizeof(param.nPmacId), ¶m.nPmacId);
+ if (rret < 1){
+ printf("Parameter not Found: nPmacId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "bRxFCSDis", sizeof(param.bRxFCSDis), ¶m.bRxFCSDis);
+ scanParamArg(prmc, prmv, "eProcFlagsEgCfg", sizeof(param.eProcFlagsEgCfg), ¶m.eProcFlagsEgCfg);
+ scanParamArg(prmc, prmv, "nBslThreshold0", sizeof(param.nBslThreshold[0]), ¶m.nBslThreshold[0]);
+ scanParamArg(prmc, prmv, "nBslThreshold1", sizeof(param.nBslThreshold[1]), ¶m.nBslThreshold[1]);
+ scanParamArg(prmc, prmv, "nBslThreshold2", sizeof(param.nBslThreshold[2]), ¶m.nBslThreshold[2]);
+ scanParamArg(prmc, prmv, "bAPadEna", sizeof(param.bAPadEna), ¶m.bAPadEna);
+ scanParamArg(prmc, prmv, "bPadEna", sizeof(param.bPadEna), ¶m.bPadEna);
+ scanParamArg(prmc, prmv, "bVPadEna", sizeof(param.bVPadEna), ¶m.bVPadEna);
+ scanParamArg(prmc, prmv, "bSVPadEna", sizeof(param.bSVPadEna), ¶m.bSVPadEna);
+ scanParamArg(prmc, prmv, "bTxFCSDis", sizeof(param.bTxFCSDis), ¶m.bTxFCSDis);
+ scanParamArg(prmc, prmv, "bIPTransChkRegDis", sizeof(param.bIPTransChkRegDis), ¶m.bIPTransChkRegDis);
+ scanParamArg(prmc, prmv, "bIPTransChkVerDis", sizeof(param.bIPTransChkVerDis), ¶m.bIPTransChkVerDis);
+ scanParamArg(prmc, prmv, "bJumboEna", sizeof(param.bJumboEna), ¶m.bJumboEna);
+ scanParamArg(prmc, prmv, "nMaxJumboLen", sizeof(param.nMaxJumboLen), ¶m.nMaxJumboLen);
+ scanParamArg(prmc, prmv, "nJumboThreshLen", sizeof(param.nJumboThreshLen), ¶m.nJumboThreshLen);
+ scanParamArg(prmc, prmv, "bLongFrmChkDis", sizeof(param.bLongFrmChkDis), ¶m.bLongFrmChkDis);
+ scanParamArg(prmc, prmv, "eShortFrmChkType", sizeof(param.eShortFrmChkType), ¶m.eShortFrmChkType);
+ scanParamArg(prmc, prmv, "bProcFlagsEgCfgEna", sizeof(param.bProcFlagsEgCfgEna), ¶m.bProcFlagsEgCfgEna);
+
+ ret = GSW_PMAC_GLBL_CfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PMAC_GLBL_CfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_PMAC_GLBL_CfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PceRuleRead(int prmc, char *prmv[])
+{
+ GSW_PCE_rule_t pce_rule = {0};
+ int i;
+
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "pattern.nIndex", sizeof(pce_rule.pattern.nIndex), &pce_rule.pattern.nIndex);
+ if (rret < 1){
+ printf("Parameter not Found: pattern.nIndex\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "nLogicalPortId", sizeof(pce_rule.logicalportid), &pce_rule.logicalportid);
+ scanParamArg(prmc, prmv, "nSubIfIdGroup", sizeof(pce_rule.subifidgroup), &pce_rule.subifidgroup);
+ scanParamArg(prmc, prmv, "region", sizeof(pce_rule.region), &pce_rule.region);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PceRuleRead(gsw_dev, &pce_rule);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PceRuleRead failed with ret code", ret);
+ else {
+ printf("fapi_GSW_PceRuleRead done\n");
+
+ if (pce_rule.pattern.bEnable) {
+ printf("\n\tp.nIndex = %u", pce_rule.pattern.nIndex);
+
+ if (pce_rule.pattern.bMAC_DstEnable) {
+ printf("\n\tp.bMAC_DstEnable = %u", pce_rule.pattern.bMAC_DstEnable);
+ printf("\n\tp.bDstMAC_Exclude = %u", pce_rule.pattern.bDstMAC_Exclude);
+ printf("\n\tp.nMAC_Dst = ");
+
+ for (i = 0; i < 6; i++) {
+ printf("%2.2x", pce_rule.pattern.nMAC_Dst[i]);
+ }
+ printf("\n\tp.nMAC_DstMask = 0x%x", pce_rule.pattern.nMAC_DstMask);
+ }
+
+ if (pce_rule.pattern.bMAC_SrcEnable) {
+ printf("\n\tp.bMAC_SrcEnable = %u", pce_rule.pattern.bMAC_SrcEnable);
+ printf("\n\tp.bSrcMAC_Exclude = %u", pce_rule.pattern.bSrcMAC_Exclude);
+ printf("\n\tp.nMAC_Src = ");
+
+ for (i = 0; i < 6; i++) {
+ printf("%2.2x", pce_rule.pattern.nMAC_Src[i]);
+ }
+ printf("\n\tp.nMAC_SrcMask = 0x%x", pce_rule.pattern.nMAC_SrcMask);
+ }
+
+ if (pce_rule.pattern.eDstIP_Select) {
+ printf("\n\tp.eDstIP_Select = %u", pce_rule.pattern.eDstIP_Select);
+ printf("\n\tp.bDstIP_Exclude = %u", pce_rule.pattern.bDstIP_Exclude);
+
+ if (pce_rule.pattern.eDstIP_Select == GSW_PCE_IP_V4) {
+ printf("\n\tp.nDstIP = 0x%x", pce_rule.pattern.nDstIP.nIPv4);
+ printf("\n\tp.nDstIP_Mask = 0x%x", pce_rule.pattern.nDstIP_Mask);
+ } else if (pce_rule.pattern.eDstIP_Select == GSW_PCE_IP_V6) {
+ printf("\n\tp.nDstIP = ");
+
+ for (i = 0; i < 8; i++) {
+ if (i == 7)
+ printf("%x", pce_rule.pattern.nDstIP.nIPv6[i]);
+ else
+ printf("%x:", pce_rule.pattern.nDstIP.nIPv6[i]);
+ }
+ printf("\n\tp.nDstIP_Mask = 0x%x", pce_rule.pattern.nDstIP_Mask);
+ }
+ }
+
+ if (pce_rule.pattern.eInnerDstIP_Select) {
+ printf("\n\tp.eInnerDstIP_Select = %u", pce_rule.pattern.eInnerDstIP_Select);
+ printf("\n\tp.bInnerDstIP_Exclude = %u", pce_rule.pattern.bInnerDstIP_Exclude);
+
+ if (pce_rule.pattern.eInnerDstIP_Select == GSW_PCE_IP_V4) {
+ printf("\n\tp.nInnerDstIP = 0x%x", pce_rule.pattern.nInnerDstIP.nIPv4);
+ printf("\n\tp.nInnerDstIP_Mask = 0x%x", pce_rule.pattern.nInnerDstIP_Mask);
+ } else if (pce_rule.pattern.eInnerDstIP_Select == GSW_PCE_IP_V6) {
+ printf("\n\tp.nInnerDstIP = ");
+
+ for (i = 0; i < 8; i++) {
+ if (i == 7)
+ printf("%x", pce_rule.pattern.nInnerDstIP.nIPv6[i]);
+ else
+ printf("%x:", pce_rule.pattern.nInnerDstIP.nIPv6[i]);
+ }
+ printf("\n\tp.nInnerDstIP_Mask = 0x%x", pce_rule.pattern.nInnerDstIP_Mask);
+ }
+ }
+
+ if (pce_rule.pattern.eSrcIP_Select) {
+ printf("\n\tp.eSrcIP_Select = %u", pce_rule.pattern.eSrcIP_Select);
+ printf("\n\tp.bSrcIP_Exclude = %u", pce_rule.pattern.bSrcIP_Exclude);
+
+ if (pce_rule.pattern.eSrcIP_Select == GSW_PCE_IP_V4) {
+ printf("\n\tp.nSrcIP = 0x%x", pce_rule.pattern.nSrcIP.nIPv4);
+ printf("\n\tp.nSrcIP_Mask = 0x%x", pce_rule.pattern.nSrcIP_Mask);
+ } else if (pce_rule.pattern.eSrcIP_Select == GSW_PCE_IP_V6) {
+ printf("\n\tp.nSrcIP = ");
+
+ for (i = 0; i < 8; i++) {
+ if (i == 7)
+ printf("%x", pce_rule.pattern.nSrcIP.nIPv6[i]);
+ else
+ printf("%x:", pce_rule.pattern.nSrcIP.nIPv6[i]);
+ }
+ printf("\n\tp.nSrcIP_Mask = 0x%x", pce_rule.pattern.nSrcIP_Mask);
+ }
+ }
+
+ if (pce_rule.pattern.eInnerSrcIP_Select) {
+ printf("\n\tp.eInnerSrcIP_Select = %u", pce_rule.pattern.eInnerSrcIP_Select);
+ printf("\n\tp.bInnerSrcIP_Exclude = %u", pce_rule.pattern.bInnerSrcIP_Exclude);
+
+ if (pce_rule.pattern.eInnerSrcIP_Select == GSW_PCE_IP_V4) {
+ printf("\n\tp.nInnerSrcIP = 0x%x", pce_rule.pattern.nInnerSrcIP.nIPv4);
+ printf("\n\tp.nInnerSrcIP_Mask = 0x%x", pce_rule.pattern.nInnerSrcIP_Mask);
+ } else if (pce_rule.pattern.eInnerSrcIP_Select == GSW_PCE_IP_V6) {
+ printf("\n\tp.nInnerSrcIP = ");
+
+ for (i = 0; i < 8; i++) {
+ if (i == 7)
+ printf("%x", pce_rule.pattern.nInnerSrcIP.nIPv6[i]);
+ else
+ printf("%x:", pce_rule.pattern.nInnerSrcIP.nIPv6[i]);
+ }
+ printf("\n\tp.nInnerSrcIP_Mask = 0x%x", pce_rule.pattern.nInnerSrcIP_Mask);
+ }
+ }
+
+ if (pce_rule.pattern.bVid) {
+ printf("\n\tp.bVid = %u", pce_rule.pattern.bVid);
+ printf("\n\tp.bVid_Exclude = %u", pce_rule.pattern.bVid_Exclude);
+ printf("\n\tp.nVid = %u", pce_rule.pattern.nVid);
+
+ if (pce_rule.pattern.bVidRange_Select)
+ printf("\n\tp.bVidRange_Select = %u (Range Key)", pce_rule.pattern.bVidRange_Select);
+ else
+ printf("\n\tp.bVidRange_Select = %u (Mask Key)", pce_rule.pattern.bVidRange_Select);
+
+ printf("\n\tp.nVidRange = %u", pce_rule.pattern.nVidRange);
+ printf("\n\tp.bVid_Original = %u", pce_rule.pattern.bVid_Original);
+ }
+
+ if (pce_rule.pattern.bSLAN_Vid) {
+ printf("\n\tp.bSLAN_Vid = %u", pce_rule.pattern.bSLAN_Vid);
+ printf("\n\tp.bSLANVid_Exclude = %u", pce_rule.pattern.bSLANVid_Exclude);
+ printf("\n\tp.nSLAN_Vid = %u", pce_rule.pattern.nSLAN_Vid);
+
+ if (pce_rule.pattern.bSVidRange_Select)
+ printf("\n\tp.bSVidRange_Select = %u (Range Key)", pce_rule.pattern.bSVidRange_Select);
+ else
+ printf("\n\tp.bSVidRange_Select = %u (Mask Key)", pce_rule.pattern.bSVidRange_Select);
+
+ printf("\n\tp.nOuterVidRange = %u", pce_rule.pattern.nOuterVidRange);
+ printf("\n\tp.bOuterVid_Original = %u", pce_rule.pattern.bOuterVid_Original);
+ }
+
+ if (pce_rule.pattern.bPortIdEnable) {
+ printf("\n\tp.bPortIdEnable = %u", pce_rule.pattern.bPortIdEnable);
+ printf("\n\tp.bPortId_Exclude = %u", pce_rule.pattern.bPortId_Exclude);
+ printf("\n\tp.nPortId = %u", pce_rule.pattern.nPortId);
+ }
+
+ if (pce_rule.pattern.bSubIfIdEnable) {
+ printf("\n\tp.bSubIfIdEnable = %u", pce_rule.pattern.bSubIfIdEnable);
+ printf("\n\tp.bSubIfId_Exclude = %u", pce_rule.pattern.bSubIfId_Exclude);
+ printf("\n\tp.eSubIfIdType = %u", pce_rule.pattern.eSubIfIdType);
+ printf("\n\tp.nSubIfId = %u", pce_rule.pattern.nSubIfId);
+ }
+
+ if (pce_rule.pattern.bPktLngEnable) {
+ printf("\n\tp.bPktLngEnable = %u", pce_rule.pattern.bPktLngEnable);
+ printf("\n\tp.bPktLng_Exclude = %u", pce_rule.pattern.bPktLng_Exclude);
+ printf("\n\tp.nPktLng = %u", pce_rule.pattern.nPktLng);
+ printf("\n\tp.nPktLngRange = %u", pce_rule.pattern.nPktLngRange);
+ }
+
+ if (pce_rule.pattern.bPayload1_SrcEnable) {
+ printf("\n\tp.bPayload1_Exclude = %u", pce_rule.pattern.bPayload1_Exclude);
+ printf("\n\tp.nPayload1 = 0x%x", pce_rule.pattern.nPayload1);
+ printf("\n\tp.bPayload1MaskRange_Select = %u", pce_rule.pattern.bPayload1MaskRange_Select);
+ printf("\n\tp.nPayload1_Mask = 0x%x", pce_rule.pattern.nPayload1_Mask);
+ }
+
+ if (pce_rule.pattern.bPayload2_SrcEnable) {
+ printf("\n\tp.bPayload2_Exclude = %u", pce_rule.pattern.bPayload2_Exclude);
+ printf("\n\tp.nPayload2 = 0x%x", pce_rule.pattern.nPayload2);
+ printf("\n\tp.bPayload2MaskRange_Select = %u", pce_rule.pattern.bPayload2MaskRange_Select);
+ printf("\n\tp.nPayload2_Mask = 0x%x", pce_rule.pattern.nPayload2_Mask);
+ }
+
+ if (pce_rule.pattern.bParserFlagLSB_Enable) {
+ printf("\n\tp.bParserFlagLSB_Exclude = %u", pce_rule.pattern.bParserFlagLSB_Exclude);
+ printf("\n\tp.nParserFlagLSB = 0x%x", pce_rule.pattern.nParserFlagLSB);
+ printf("\n\tp.nParserFlagLSB_Mask = 0x%x", pce_rule.pattern.nParserFlagLSB_Mask);
+ }
+
+ if (pce_rule.pattern.bParserFlagMSB_Enable) {
+ printf("\n\tp.bParserFlagMSB_Exclude = %u", pce_rule.pattern.bParserFlagMSB_Exclude);
+ printf("\n\tp.nParserFlagMSB = 0x%x", pce_rule.pattern.nParserFlagMSB);
+ printf("\n\tp.nParserFlagMSB_Mask = 0x%x", pce_rule.pattern.nParserFlagMSB_Mask);
+ }
+
+ if (pce_rule.pattern.bParserFlag1LSB_Enable) {
+ printf("\n\tp.bParserFlag1LSB_Exclude = %u", pce_rule.pattern.bParserFlag1LSB_Exclude);
+ printf("\n\tp.nParserFlag1LSB = 0x%x", pce_rule.pattern.nParserFlag1LSB);
+ printf("\n\tp.nParserFlag1LSB_Mask = 0x%x", pce_rule.pattern.nParserFlag1LSB_Mask);
+ }
+
+ if (pce_rule.pattern.bParserFlag1MSB_Enable) {
+ printf("\n\tp.bParserFlag1MSB_Exclude = %u", pce_rule.pattern.bParserFlag1MSB_Exclude);
+ printf("\n\tp.nParserFlag1MSB = 0x%x", pce_rule.pattern.nParserFlag1MSB);
+ printf("\n\tp.nParserFlag1MSB_Mask = 0x%x", pce_rule.pattern.nParserFlag1MSB_Mask);
+ }
+
+ if (pce_rule.action.eVLAN_Action) {
+ printf("\n\ta.eVLAN_Action = %u", pce_rule.action.eVLAN_Action);
+ printf("\n\ta.nVLAN_Id = %u", pce_rule.action.nVLAN_Id);
+ }
+
+ if (pce_rule.action.eSVLAN_Action) {
+ printf("\n\ta.eSVLAN_Action = %u", pce_rule.action.eSVLAN_Action);
+ printf("\n\ta.nSVLAN_Id = %u", pce_rule.action.nSVLAN_Id);
+ }
+
+ if (pce_rule.action.eVLAN_CrossAction)
+ printf("\n\ta.eVLAN_CrossAction = %u", pce_rule.action.eVLAN_CrossAction);
+
+ if (pce_rule.action.bPortBitMapMuxControl)
+ printf("\n\ta.bPortBitMapMuxControl = %u", pce_rule.action.bPortBitMapMuxControl);
+
+ if (pce_rule.action.bCVLAN_Ignore_Control)
+ printf("\n\ta.bCVLAN_Ignore_Control = %u", pce_rule.action.bCVLAN_Ignore_Control);
+
+ if (pce_rule.action.eLearningAction)
+ printf("\n\ta.eLearningAction = %u", pce_rule.action.eLearningAction);
+
+ if (pce_rule.action.eSnoopingTypeAction)
+ printf("\n\ta.eSnoopingTypeAction = %u", pce_rule.action.eSnoopingTypeAction);
+
+ if (pce_rule.pattern.bEtherTypeEnable) {
+ printf("\n\tp.bEtherType_Exclude = 0x%x", pce_rule.pattern.bEtherType_Exclude);
+ printf("\n\tp.nEtherType = 0x%x", pce_rule.pattern.nEtherType);
+ printf("\n\tp.nEtherTypeMask = 0x%x", pce_rule.pattern.nEtherTypeMask);
+ }
+
+ if (pce_rule.pattern.bProtocolEnable) {
+ printf("\n\tp.bProtocol_Exclude = 0x%x", pce_rule.pattern.bProtocol_Exclude);
+ printf("\n\tp.nProtocol = 0x%x", pce_rule.pattern.nProtocol);
+ printf("\n\tp.nProtocolMask = 0x%x", pce_rule.pattern.nProtocolMask);
+ }
+
+ if (pce_rule.pattern.bInnerProtocolEnable) {
+ printf("\n\tp.bInnerProtocol_Exclude = 0x%x", pce_rule.pattern.bInnerProtocol_Exclude);
+ printf("\n\tp.nInnerProtocol = 0x%x", pce_rule.pattern.nInnerProtocol);
+ printf("\n\tp.nInnerProtocolMask = 0x%x", pce_rule.pattern.nInnerProtocolMask);
+ }
+
+ if (pce_rule.pattern.bSessionIdEnable) {
+ printf("\n\tp.bSessionIdEnable = 0x%x", pce_rule.pattern.bSessionIdEnable);
+ printf("\n\tp.bSessionId_Exclude = 0x%x", pce_rule.pattern.bSessionId_Exclude);
+ printf("\n\tp.nSessionId = 0x%x", pce_rule.pattern.nSessionId);
+ }
+
+ if (pce_rule.pattern.bPPP_ProtocolEnable) {
+ printf("\n\tp.bPPP_Protocol_Exclude = 0x%x", pce_rule.pattern.bPPP_Protocol_Exclude);
+ printf("\n\tp.nPPP_Protocol = 0x%x", pce_rule.pattern.nPPP_Protocol);
+ printf("\n\tp.nPPP_ProtocolMask = 0x%x", pce_rule.pattern.nPPP_ProtocolMask);
+ }
+
+ if (pce_rule.pattern.bAppDataMSB_Enable) {
+ printf("\n\tp.bAppMSB_Exclude = 0x%x", pce_rule.pattern.bAppMSB_Exclude);
+ printf("\n\tp.nAppDataMSB = 0x%x", pce_rule.pattern.nAppDataMSB);
+ printf("\n\tp.bAppMaskRangeMSB_Select = %u", pce_rule.pattern.bAppMaskRangeMSB_Select);
+ printf("\n\tp.nAppMaskRangeMSB = 0x%x", pce_rule.pattern.nAppMaskRangeMSB);
+ }
+
+ if (pce_rule.pattern.bAppDataLSB_Enable) {
+ printf("\n\tp.bAppLSB_Exclude = 0x%x", pce_rule.pattern.bAppLSB_Exclude);
+ printf("\n\tp.nAppDataLSB = 0x%x", pce_rule.pattern.nAppDataLSB);
+ printf("\n\tp.bAppMaskRangeLSB_Select = %u", pce_rule.pattern.bAppMaskRangeLSB_Select);
+ printf("\n\tp.nAppMaskRangeLSB = 0x%x", pce_rule.pattern.nAppMaskRangeLSB);
+ }
+
+ if (pce_rule.pattern.bDSCP_Enable) {
+ printf("\n\tp.bDSCP_Exclude = %u", pce_rule.pattern.bDSCP_Exclude);
+ printf("\n\tp.nDSCP = %u", pce_rule.pattern.nDSCP);
+ }
+
+ if (pce_rule.pattern.bInner_DSCP_Enable) {
+ printf("\n\tp.bInnerDSCP_Exclude = %u", pce_rule.pattern.bInnerDSCP_Exclude);
+ printf("\n\tp.nInnerDSCP = %u", pce_rule.pattern.nInnerDSCP);
+ }
+
+ if (pce_rule.action.bRemarkAction)
+ printf("\n\ta.bRemarkAction = Enabled val = %u", pce_rule.action.bRemarkAction);
+
+ if (pce_rule.action.bRemarkPCP)
+ printf("\n\ta.bRemarkPCP = Disabled val = %u", pce_rule.action.bRemarkPCP);
+
+ if (pce_rule.action.bRemarkDSCP)
+ printf("\n\ta.bRemarkDSCP = Disabled val = %u", pce_rule.action.bRemarkDSCP);
+
+ if (pce_rule.action.bRemarkClass)
+ printf("\n\ta.bRemarkClass = Disabled val = %u", pce_rule.action.bRemarkClass);
+
+ if (pce_rule.action.bRemarkSTAG_PCP)
+ printf("\n\ta.bRemarkSTAG_PCP = Disabled val = %u", pce_rule.action.bRemarkSTAG_PCP);
+
+ if (pce_rule.action.bRemarkSTAG_DEI)
+ printf("\n\ta.bRemarkSTAG_DEI = Disabled val = %u", pce_rule.action.bRemarkSTAG_DEI);
+
+ if ((pce_rule.action.bRMON_Action) || (pce_rule.action.bFlowID_Action)) {
+ printf("\n\ta.nFlowID/nRmon_ID = %u", pce_rule.action.nFlowID);
+ }
+
+ if (pce_rule.pattern.bPCP_Enable) {
+ printf("\n\tp.bPCP_Enable = %u", pce_rule.pattern.bPCP_Enable);
+ printf("\n\tp.bCTAG_PCP_DEI_Exclude = %u", pce_rule.pattern.bCTAG_PCP_DEI_Exclude);
+ printf("\n\tp.nPCP = %u", pce_rule.pattern.nPCP);
+ }
+
+ if (pce_rule.pattern.bSTAG_PCP_DEI_Enable) {
+ printf("\n\tp.bSTAG_PCP_DEI_Enable = %u", pce_rule.pattern.bSTAG_PCP_DEI_Enable);
+ printf("\n\tp.bSTAG_PCP_DEI_Exclude = %u", pce_rule.pattern.bSTAG_PCP_DEI_Exclude);
+ printf("\n\tp.nSTAG_PCP_DEI = %u", pce_rule.pattern.nSTAG_PCP_DEI);
+ }
+
+ if (pce_rule.action.ePortMapAction) {
+ printf("\n\ta.ePortMapAction = 0x%x", pce_rule.action.ePortMapAction);
+
+ for (i = 0; i < 8; i++) {
+ if (pce_rule.action.nForwardPortMap[i])
+ printf("\n\ta.nForwardPortMap[%d] = 0x%x", i, pce_rule.action.nForwardPortMap[i]);
+ }
+ }
+
+ if (pce_rule.action.eTrafficClassAction) {
+ printf("\n\ta.eTrafficClassAction = %u", pce_rule.action.eTrafficClassAction);
+ printf("\n\ta.nTrafficClassAlternate = %u", pce_rule.action.nTrafficClassAlternate);
+ }
+
+ if (pce_rule.action.bPortTrunkAction) {
+ printf("\n\ta.bPortTrunkAction = Enabled");
+ printf("\n\ta.bPortLinkSelection = %u", pce_rule.action.bPortLinkSelection);
+ }
+
+ if (pce_rule.action.bExtendedVlanEnable) {
+ printf("\n\ta.bExtendedVlanEnable = Enabled");
+ printf("\n\ta.nExtendedVlanBlockId = %u", pce_rule.action.nExtendedVlanBlockId);
+ }
+
+ if (pce_rule.action.ePortFilterType_Action) {
+ printf("\n\ta.ePortFilterType_Action = %u", pce_rule.action.ePortFilterType_Action);
+
+ for (i = 0; i < 8; i++) {
+ if (pce_rule.action.nForwardPortMap[i])
+ printf("\n\ta.nForwardPortMap[%d] = 0x%x", i, pce_rule.action.nForwardPortMap[i]);
+ }
+ }
+
+ if (pce_rule.action.eProcessPath_Action)
+ printf("\n\ta.eProcessPath_Action = %u", pce_rule.action.eProcessPath_Action);
+
+ if (pce_rule.action.bOamEnable)
+ printf("\n\ta.bOamEnable = %u", pce_rule.action.bOamEnable);
+
+ if (pce_rule.action.bExtractEnable)
+ printf("\n\ta.bExtractEnable = %u", pce_rule.action.bExtractEnable);
+
+ if (pce_rule.action.bOamEnable || pce_rule.action.bExtractEnable)
+ printf("\n\ta.nRecordId = %u", pce_rule.action.nRecordId);
+
+ if (pce_rule.action.eColorFrameAction != GSW_PCE_ACTION_COLOR_FRAME_DISABLE)
+ printf("\n\ta.eColorFrameAction = %u", pce_rule.action.eColorFrameAction);
+
+ if (pce_rule.action.eMeterAction) {
+ printf("\n\ta.eMeterAction = %u", pce_rule.action.eMeterAction);
+ printf("\n\ta.nMeterId = %u", pce_rule.action.nMeterId);
+ }
+
+ if (pce_rule.action.bFidEnable)
+ printf("\n\ta.nFId = %u", pce_rule.action.nFId);
+
+ if (pce_rule.pattern.bInsertionFlag_Enable)
+ printf("\n\tp.nInsertionFlag = %u", pce_rule.pattern.nInsertionFlag);
+
+ if (pce_rule.action.eCrossStateAction == GSW_PCE_ACTION_CROSS_STATE_CROSS)
+ printf("\n\tp.eCrossStateAction = GSW_PCE_ACTION_CROSS_STATE_CROSS");
+ else if (pce_rule.action.eCrossStateAction == GSW_PCE_ACTION_CROSS_STATE_REGULAR)
+ printf("\n\tp.eCrossStateAction = GSW_PCE_ACTION_CROSS_STATE_REGULAR");
+ else
+ printf("\n\tp.eCrossStateAction = GSW_PCE_ACTION_CROSS_STATE_DISABLE");
+
+ /*Applicable only for GSWIP 3.2*/
+ if (pce_rule.pattern.bFlexibleField4Enable) {
+ printf("\n\tp.bFlexibleField4_ExcludeEnable = %u", pce_rule.pattern.bFlexibleField4_ExcludeEnable);
+ printf("\n\tp.bFlexibleField4_RangeEnable = %u", pce_rule.pattern.bFlexibleField4_RangeEnable);
+ printf("\n\tp.nFlexibleField4_ParserIndex = %u", pce_rule.pattern.nFlexibleField4_ParserIndex);
+ printf("\n\tp.nFlexibleField4_Value = %u", pce_rule.pattern.nFlexibleField4_Value);
+ printf("\n\tp.nFlexibleField4_MaskOrRange = %u", pce_rule.pattern.nFlexibleField4_MaskOrRange);
+ }
+
+ if (pce_rule.pattern.bFlexibleField3Enable) {
+ printf("\n\tp.bFlexibleField3_ExcludeEnable = %u", pce_rule.pattern.bFlexibleField3_ExcludeEnable);
+ printf("\n\tp.bFlexibleField3_RangeEnable = %u", pce_rule.pattern.bFlexibleField3_RangeEnable);
+ printf("\n\tp.nFlexibleField3_ParserIndex = %u", pce_rule.pattern.nFlexibleField3_ParserIndex);
+ printf("\n\tp.nFlexibleField3_Value = %u", pce_rule.pattern.nFlexibleField3_Value);
+ printf("\n\tp.nFlexibleField3_MaskOrRange = %u", pce_rule.pattern.nFlexibleField3_MaskOrRange);
+ }
+
+ if (pce_rule.pattern.bFlexibleField2Enable) {
+ printf("\n\tp.bFlexibleField2_ExcludeEnable = %u", pce_rule.pattern.bFlexibleField2_ExcludeEnable);
+ printf("\n\tp.bFlexibleField2_RangeEnable = %u", pce_rule.pattern.bFlexibleField2_RangeEnable);
+ printf("\n\tp.nFlexibleField2_ParserIndex = %u", pce_rule.pattern.nFlexibleField2_ParserIndex);
+ printf("\n\tp.nFlexibleField2_Value = %u", pce_rule.pattern.nFlexibleField2_Value);
+ printf("\n\tp.nFlexibleField2_MaskOrRange = %u", pce_rule.pattern.nFlexibleField2_MaskOrRange);
+ }
+
+ if (pce_rule.pattern.bFlexibleField1Enable) {
+ printf("\n\tp.bFlexibleField1_ExcludeEnable = %u", pce_rule.pattern.bFlexibleField1_ExcludeEnable);
+ printf("\n\tp.bFlexibleField1_RangeEnable = %u", pce_rule.pattern.bFlexibleField1_RangeEnable);
+ printf("\n\tp.nFlexibleField1_ParserIndex = %u", pce_rule.pattern.nFlexibleField1_ParserIndex);
+ printf("\n\tp.nFlexibleField1_Value = %u", pce_rule.pattern.nFlexibleField1_Value);
+ printf("\n\tp.nFlexibleField1_MaskOrRange = %u", pce_rule.pattern.nFlexibleField1_MaskOrRange);
+ }
+
+ if (pce_rule.action.sPBB_Action.bIheaderActionEnable) {
+ printf("\n\ta.sPBB_Action.bIheaderActionEnable = %u", pce_rule.action.sPBB_Action.bIheaderActionEnable);
+
+ switch (pce_rule.action.sPBB_Action.eIheaderOpMode) {
+ case GSW_PCE_I_HEADER_OPERATION_INSERT :
+ printf("\n\ta.sPBB_Action.eIheaderOpMode = GSW_PCE_I_HEADER_OPERATION_INSERT");
+ printf("\n\ta.sPBB_Action.nTunnelIdKnownTraffic = %u", pce_rule.action.sPBB_Action.nTunnelIdKnownTraffic);
+ printf("\n\ta.sPBB_Action.nTunnelIdUnKnownTraffic = %u", pce_rule.action.sPBB_Action.nTunnelIdUnKnownTraffic);
+ printf("\n\ta.sPBB_Action.bB_DstMac_FromMacTableEnable = %u", pce_rule.action.sPBB_Action.bB_DstMac_FromMacTableEnable);
+ break;
+
+ case GSW_PCE_I_HEADER_OPERATION_REPLACE :
+ printf("\n\ta.sPBB_Action.eIheaderOpMode = GSW_PCE_I_HEADER_OPERATION_REPLACE");
+ printf("\n\ta.sPBB_Action.nTunnelIdKnownTraffic = %u", pce_rule.action.sPBB_Action.nTunnelIdKnownTraffic);
+ printf("\n\ta.sPBB_Action.nTunnelIdUnKnownTraffic = %u", pce_rule.action.sPBB_Action.nTunnelIdUnKnownTraffic);
+ printf("\n\ta.sPBB_Action.bReplace_B_SrcMacEnable = %u", pce_rule.action.sPBB_Action.bReplace_B_SrcMacEnable);
+ printf("\n\ta.sPBB_Action.bReplace_B_DstMacEnable = %u", pce_rule.action.sPBB_Action.bReplace_B_DstMacEnable);
+ printf("\n\ta.sPBB_Action.bReplace_I_TAG_ResEnable = %u", pce_rule.action.sPBB_Action.bReplace_I_TAG_ResEnable);
+ printf("\n\ta.sPBB_Action.bReplace_I_TAG_UacEnable = %u", pce_rule.action.sPBB_Action.bReplace_I_TAG_UacEnable);
+ printf("\n\ta.sPBB_Action.bReplace_I_TAG_DeiEnable = %u", pce_rule.action.sPBB_Action.bReplace_I_TAG_DeiEnable);
+ printf("\n\ta.sPBB_Action.bReplace_I_TAG_PcpEnable = %u", pce_rule.action.sPBB_Action.bReplace_I_TAG_PcpEnable);
+ printf("\n\ta.sPBB_Action.bReplace_I_TAG_SidEnable = %u", pce_rule.action.sPBB_Action.bReplace_I_TAG_SidEnable);
+ printf("\n\ta.sPBB_Action.bReplace_I_TAG_TpidEnable = %u", pce_rule.action.sPBB_Action.bReplace_I_TAG_TpidEnable);
+ break;
+
+ case GSW_PCE_I_HEADER_OPERATION_REMOVE :
+ printf("\n\ta.sPBB_Action.eIheaderOpMode = GSW_PCE_I_HEADER_OPERATION_REMOVE");
+ break;
+
+ case GSW_PCE_I_HEADER_OPERATION_NOCHANGE :
+ printf("\n\ta.sPBB_Action.eIheaderOpMode = GSW_PCE_I_HEADER_OPERATION_NOCHANGE");
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /*Applicable only for GSWIP 3.2*/
+ if (pce_rule.action.sPBB_Action.bBtagActionEnable) {
+ printf("\n\ta.sPBB_Action.bBtagActionEnable = %u", pce_rule.action.sPBB_Action.bBtagActionEnable);
+
+ switch (pce_rule.action.sPBB_Action.eBtagOpMode) {
+ case GSW_PCE_B_TAG_OPERATION_INSERT :
+ printf("\n\ta.sPBB_Action.eBtagOpMode = GSW_PCE_B_TAG_OPERATION_INSERT");
+ printf("\n\ta.sPBB_Action.nProcessIdKnownTraffic = %u", pce_rule.action.sPBB_Action.nProcessIdKnownTraffic);
+ printf("\n\ta.sPBB_Action.nProcessIdUnKnownTraffic = %u", pce_rule.action.sPBB_Action.nProcessIdUnKnownTraffic);
+ break;
+
+ case GSW_PCE_B_TAG_OPERATION_REPLACE :
+ printf("\n\ta.sPBB_Action.eBtagOpMode = GSW_PCE_B_TAG_OPERATION_REPLACE");
+ printf("\n\ta.sPBB_Action.nProcessIdKnownTraffic = %u", pce_rule.action.sPBB_Action.nProcessIdKnownTraffic);
+ printf("\n\ta.sPBB_Action.nProcessIdUnKnownTraffic = %u", pce_rule.action.sPBB_Action.nProcessIdUnKnownTraffic);
+ printf("\n\ta.sPBB_Action.bReplace_B_TAG_DeiEnable = %u", pce_rule.action.sPBB_Action.bReplace_B_TAG_DeiEnable);
+ printf("\n\ta.sPBB_Action.bReplace_B_TAG_PcpEnable = %u", pce_rule.action.sPBB_Action.bReplace_B_TAG_PcpEnable);
+ printf("\n\ta.sPBB_Action.bReplace_B_TAG_VidEnable = %u", pce_rule.action.sPBB_Action.bReplace_B_TAG_VidEnable);
+ printf("\n\ta.sPBB_Action.bReplace_B_TAG_TpidEnable = %u", pce_rule.action.sPBB_Action.bReplace_B_TAG_TpidEnable);
+ break;
+
+ case GSW_PCE_B_TAG_OPERATION_REMOVE :
+ printf("\n\ta.sPBB_Action.eBtagOpMode = GSW_PCE_B_TAG_OPERATION_REMOVE");
+ break;
+
+ case GSW_PCE_B_TAG_OPERATION_NOCHANGE :
+ printf("\n\ta.sPBB_Action.eBtagOpMode = GSW_PCE_B_TAG_OPERATION_NOCHANGE");
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /*Applicable only for GSWIP 3.2*/
+ if (pce_rule.action.sPBB_Action.bMacTableMacinMacActionEnable) {
+ printf("\n\ta.sPBB_Action.bMacTableMacinMacActionEnable = %u", pce_rule.action.sPBB_Action.bMacTableMacinMacActionEnable);
+
+ switch (pce_rule.action.sPBB_Action.eMacTableMacinMacSelect) {
+ case GSW_PCE_OUTER_MAC_SELECTED :
+ printf("\n\ta.sPBB_Action.eMacTableMacinMacSelect = GSW_PCE_OUTER_MAC_SELECTED");
+ break;
+
+ case GSW_PCE_INNER_MAC_SELECTED :
+ printf("\n\ta.sPBB_Action.eMacTableMacinMacSelect = GSW_PCE_INNER_MAC_SELECTED");
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (pce_rule.action.bDestSubIf_Action_Enable) {
+ printf("\n\ta.sDestSubIF_Action.bDestSubIFIDActionEnable = %u", pce_rule.action.sDestSubIF_Action.bDestSubIFIDActionEnable);
+ printf("\n\ta.sDestSubIF_Action.bDestSubIFIDAssignmentEnable = %u", pce_rule.action.sDestSubIF_Action.bDestSubIFIDAssignmentEnable);
+ printf("\n\ta.sDestSubIF_Action.nDestSubIFGrp_Field = %u", pce_rule.action.sDestSubIF_Action.nDestSubIFGrp_Field);
+ }
+ } else {
+ printf("\n\tp.nIndex rule not set at = %u", pce_rule.pattern.nIndex);
+ }
+ printf("\n");
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_PceRuleWrite(int prmc, char *prmv[])
+{
+ GSW_PCE_rule_t pce_rule = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ scanParamArg(prmc, prmv, "nLogicalPortId", sizeof(pce_rule.logicalportid), &pce_rule.logicalportid);
+ scanParamArg(prmc, prmv, "nSubIfIdGroup", sizeof(pce_rule.subifidgroup), &pce_rule.subifidgroup);
+ scanParamArg(prmc, prmv, "pattern.nIndex", sizeof(pce_rule.pattern.nIndex), &pce_rule.pattern.nIndex);
+ scanParamArg(prmc, prmv, "pattern.bEnable", sizeof(pce_rule.pattern.bEnable), &pce_rule.pattern.bEnable);
+ scanParamArg(prmc, prmv, "pattern.bPortIdEnable", sizeof(pce_rule.pattern.bPortIdEnable), &pce_rule.pattern.bPortIdEnable);
+ scanParamArg(prmc, prmv, "pattern.nPortId", sizeof(pce_rule.pattern.nPortId), &pce_rule.pattern.nPortId);
+ scanParamArg(prmc, prmv, "pattern.bPortId_Exclude", sizeof(pce_rule.pattern.bPortId_Exclude), &pce_rule.pattern.bPortId_Exclude);
+ scanParamArg(prmc, prmv, "pattern.bSubIfIdEnable", sizeof(pce_rule.pattern.bSubIfIdEnable), &pce_rule.pattern.bSubIfIdEnable);
+ scanParamArg(prmc, prmv, "pattern.nSubIfId", sizeof(pce_rule.pattern.nSubIfId), &pce_rule.pattern.nSubIfId);
+ scanParamArg(prmc, prmv, "pattern.eSubIfIdType", sizeof(pce_rule.pattern.eSubIfIdType), &pce_rule.pattern.eSubIfIdType);
+ scanParamArg(prmc, prmv, "pattern.bSubIfId_Exclude", sizeof(pce_rule.pattern.bSubIfId_Exclude), &pce_rule.pattern.bSubIfId_Exclude);
+ scanParamArg(prmc, prmv, "pattern.bInsertionFlag_Enable", sizeof(pce_rule.pattern.bInsertionFlag_Enable), &pce_rule.pattern.bInsertionFlag_Enable);
+ scanParamArg(prmc, prmv, "pattern.nInsertionFlag", sizeof(pce_rule.pattern.nInsertionFlag), &pce_rule.pattern.nInsertionFlag);
+ scanParamArg(prmc, prmv, "pattern.bDSCP_Enable", sizeof(pce_rule.pattern.bDSCP_Enable), &pce_rule.pattern.bDSCP_Enable);
+ scanParamArg(prmc, prmv, "pattern.nDSCP", sizeof(pce_rule.pattern.nDSCP), &pce_rule.pattern.nDSCP);
+ scanParamArg(prmc, prmv, "pattern.bDSCP_Exclude", sizeof(pce_rule.pattern.bDSCP_Exclude), &pce_rule.pattern.bDSCP_Exclude);
+ scanParamArg(prmc, prmv, "pattern.bInner_DSCP_Enable", sizeof(pce_rule.pattern.bInner_DSCP_Enable), &pce_rule.pattern.bInner_DSCP_Enable);
+ scanParamArg(prmc, prmv, "pattern.nInnerDSCP", sizeof(pce_rule.pattern.nInnerDSCP), &pce_rule.pattern.nInnerDSCP);
+ scanParamArg(prmc, prmv, "pattern.bInnerDSCP_Exclude", sizeof(pce_rule.pattern.bInnerDSCP_Exclude), &pce_rule.pattern.bInnerDSCP_Exclude);
+ scanParamArg(prmc, prmv, "pattern.bPCP_Enable", sizeof(pce_rule.pattern.bPCP_Enable), &pce_rule.pattern.bPCP_Enable);
+ scanParamArg(prmc, prmv, "pattern.nPCP", sizeof(pce_rule.pattern.nPCP), &pce_rule.pattern.nPCP);
+ scanParamArg(prmc, prmv, "pattern.bCTAG_PCP_DEI_Exclude", sizeof(pce_rule.pattern.bCTAG_PCP_DEI_Exclude), &pce_rule.pattern.bCTAG_PCP_DEI_Exclude);
+ scanParamArg(prmc, prmv, "pattern.bSTAG_PCP_DEI_Enable", sizeof(pce_rule.pattern.bSTAG_PCP_DEI_Enable), &pce_rule.pattern.bSTAG_PCP_DEI_Enable);
+ scanParamArg(prmc, prmv, "pattern.nSTAG_PCP_DEI", sizeof(pce_rule.pattern.nSTAG_PCP_DEI), &pce_rule.pattern.nSTAG_PCP_DEI);
+ scanParamArg(prmc, prmv, "pattern.bSTAG_PCP_DEI_Exclude", sizeof(pce_rule.pattern.bSTAG_PCP_DEI_Exclude), &pce_rule.pattern.bSTAG_PCP_DEI_Exclude);
+ scanParamArg(prmc, prmv, "pattern.bPktLngEnable", sizeof(pce_rule.pattern.bPktLngEnable), &pce_rule.pattern.bPktLngEnable);
+ scanParamArg(prmc, prmv, "pattern.nPktLng", sizeof(pce_rule.pattern.nPktLng), &pce_rule.pattern.nPktLng);
+ scanParamArg(prmc, prmv, "pattern.nPktLngRange", sizeof(pce_rule.pattern.nPktLngRange), &pce_rule.pattern.nPktLngRange);
+ scanParamArg(prmc, prmv, "pattern.bPktLng_Exclude", sizeof(pce_rule.pattern.bPktLng_Exclude), &pce_rule.pattern.bPktLng_Exclude);
+ scanParamArg(prmc, prmv, "pattern.bMAC_DstEnable", sizeof(pce_rule.pattern.bMAC_DstEnable), &pce_rule.pattern.bMAC_DstEnable);
+ scanMAC_Arg(prmc, prmv, "pattern.nMAC_Dst", pce_rule.pattern.nMAC_Dst);
+ scanParamArg(prmc, prmv, "pattern.nMAC_DstMask", sizeof(pce_rule.pattern.nMAC_DstMask), &pce_rule.pattern.nMAC_DstMask);
+ scanParamArg(prmc, prmv, "pattern.bDstMAC_Exclude", sizeof(pce_rule.pattern.bDstMAC_Exclude), &pce_rule.pattern.bDstMAC_Exclude);
+ scanParamArg(prmc, prmv, "pattern.bMAC_SrcEnable", sizeof(pce_rule.pattern.bMAC_SrcEnable), &pce_rule.pattern.bMAC_SrcEnable);
+ scanMAC_Arg(prmc, prmv, "pattern.nMAC_Src", pce_rule.pattern.nMAC_Src);
+ scanParamArg(prmc, prmv, "pattern.nMAC_SrcMask", sizeof(pce_rule.pattern.nMAC_SrcMask), &pce_rule.pattern.nMAC_SrcMask);
+ scanParamArg(prmc, prmv, "pattern.bSrcMAC_Exclude", sizeof(pce_rule.pattern.bSrcMAC_Exclude), &pce_rule.pattern.bSrcMAC_Exclude);
+ scanParamArg(prmc, prmv, "pattern.bAppDataMSB_Enable", sizeof(pce_rule.pattern.bAppDataMSB_Enable), &pce_rule.pattern.bAppDataMSB_Enable);
+ scanParamArg(prmc, prmv, "pattern.nAppDataMSB", sizeof(pce_rule.pattern.nAppDataMSB), &pce_rule.pattern.nAppDataMSB);
+ scanParamArg(prmc, prmv, "pattern.bAppMaskRangeMSB_Select", sizeof(pce_rule.pattern.bAppMaskRangeMSB_Select), &pce_rule.pattern.bAppMaskRangeMSB_Select);
+ scanParamArg(prmc, prmv, "pattern.nAppMaskRangeMSB", sizeof(pce_rule.pattern.nAppMaskRangeMSB), &pce_rule.pattern.nAppMaskRangeMSB);
+ scanParamArg(prmc, prmv, "pattern.bAppMSB_Exclude", sizeof(pce_rule.pattern.bAppMSB_Exclude), &pce_rule.pattern.bAppMSB_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bAppDataLSB_Enable", sizeof(pce_rule.pattern.bAppDataLSB_Enable), &pce_rule.pattern.bAppDataLSB_Enable);
+ scanParamArg(prmc, prmv, "pattern.nAppDataLSB", sizeof(pce_rule.pattern.nAppDataLSB), &pce_rule.pattern.nAppDataLSB);
+ scanParamArg(prmc, prmv, "pattern.bAppMaskRangeLSB_Select", sizeof(pce_rule.pattern.bAppMaskRangeLSB_Select), &pce_rule.pattern.bAppMaskRangeLSB_Select);
+ scanParamArg(prmc, prmv, "pattern.nAppMaskRangeLSB", sizeof(pce_rule.pattern.nAppMaskRangeLSB), &pce_rule.pattern.nAppMaskRangeLSB);
+ scanParamArg(prmc, prmv, "pattern.bAppLSB_Exclude", sizeof(pce_rule.pattern.bAppLSB_Exclude), &pce_rule.pattern.bAppLSB_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.eDstIP_Select", sizeof(pce_rule.pattern.eDstIP_Select), &pce_rule.pattern.eDstIP_Select);
+ if (pce_rule.pattern.eDstIP_Select == GSW_PCE_IP_V4)
+ scanIPv4_Arg(prmc, prmv, "pattern.nDstIP", &pce_rule.pattern.nDstIP.nIPv4);
+ else if (pce_rule.pattern.eDstIP_Select == GSW_PCE_IP_V6)
+ scanIPv6_Arg(prmc, prmv, "pattern.nDstIP", pce_rule.pattern.nDstIP.nIPv6);
+
+ scanParamArg(prmc, prmv, "pattern.nDstIP_Mask", sizeof(pce_rule.pattern.nDstIP_Mask), &pce_rule.pattern.nDstIP_Mask);
+ scanParamArg(prmc, prmv, "pattern.bDstIP_Exclude", sizeof(pce_rule.pattern.bDstIP_Exclude), &pce_rule.pattern.bDstIP_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.eInnerDstIP_Select", sizeof(pce_rule.pattern.eInnerDstIP_Select), &pce_rule.pattern.eInnerDstIP_Select);
+ if (pce_rule.pattern.eInnerDstIP_Select == GSW_PCE_IP_V4)
+ scanIPv4_Arg(prmc, prmv, "pattern.nInnerDstIP", &pce_rule.pattern.nInnerDstIP.nIPv4);
+ else if (pce_rule.pattern.eInnerDstIP_Select == GSW_PCE_IP_V6)
+ scanIPv6_Arg(prmc, prmv, "pattern.nInnerDstIP", pce_rule.pattern.nInnerDstIP.nIPv6);
+
+ scanParamArg(prmc, prmv, "pattern.nInnerDstIP_Mask", sizeof(pce_rule.pattern.nInnerDstIP_Mask), &pce_rule.pattern.nInnerDstIP_Mask);
+ scanParamArg(prmc, prmv, "pattern.bInnerDstIP_Exclude", sizeof(pce_rule.pattern.bInnerDstIP_Exclude), &pce_rule.pattern.bInnerDstIP_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.eSrcIP_Select", sizeof(pce_rule.pattern.eSrcIP_Select), &pce_rule.pattern.eSrcIP_Select);
+ if (pce_rule.pattern.eSrcIP_Select == GSW_PCE_IP_V4)
+ scanIPv4_Arg(prmc, prmv, "pattern.nSrcIP", &pce_rule.pattern.nSrcIP.nIPv4);
+ else if (pce_rule.pattern.eSrcIP_Select == GSW_PCE_IP_V6)
+ scanIPv6_Arg(prmc, prmv, "pattern.nSrcIP", pce_rule.pattern.nSrcIP.nIPv6);
+
+ scanParamArg(prmc, prmv, "pattern.nSrcIP_Mask", sizeof(pce_rule.pattern.nSrcIP_Mask), &pce_rule.pattern.nSrcIP_Mask);
+ scanParamArg(prmc, prmv, "pattern.bSrcIP_Exclude", sizeof(pce_rule.pattern.bSrcIP_Exclude), &pce_rule.pattern.bSrcIP_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.eInnerSrcIP_Select", sizeof(pce_rule.pattern.eInnerSrcIP_Select), &pce_rule.pattern.eInnerSrcIP_Select);
+ if (pce_rule.pattern.eInnerSrcIP_Select == GSW_PCE_IP_V4)
+ scanIPv4_Arg(prmc, prmv, "pattern.nInnerSrcIP", &pce_rule.pattern.nInnerSrcIP.nIPv4);
+ else if (pce_rule.pattern.eInnerSrcIP_Select == GSW_PCE_IP_V6)
+ scanIPv6_Arg(prmc, prmv, "pattern.nInnerSrcIP", pce_rule.pattern.nInnerSrcIP.nIPv6);
+
+ scanParamArg(prmc, prmv, "pattern.nInnerSrcIP_Mask", sizeof(pce_rule.pattern.nInnerSrcIP_Mask), &pce_rule.pattern.nInnerSrcIP_Mask);
+ scanParamArg(prmc, prmv, "pattern.bInnerSrcIP_Exclude", sizeof(pce_rule.pattern.bInnerSrcIP_Exclude), &pce_rule.pattern.bInnerSrcIP_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bEtherTypeEnable", sizeof(pce_rule.pattern.bEtherTypeEnable), &pce_rule.pattern.bEtherTypeEnable);
+ scanParamArg(prmc, prmv, "pattern.nEtherType", sizeof(pce_rule.pattern.nEtherType), &pce_rule.pattern.nEtherType);
+ scanParamArg(prmc, prmv, "pattern.nEtherTypeMask", sizeof(pce_rule.pattern.nEtherTypeMask), &pce_rule.pattern.nEtherTypeMask);
+ scanParamArg(prmc, prmv, "pattern.bEtherType_Exclude", sizeof(pce_rule.pattern.bEtherType_Exclude), &pce_rule.pattern.bEtherType_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bProtocolEnable", sizeof(pce_rule.pattern.bProtocolEnable), &pce_rule.pattern.bProtocolEnable);
+ scanParamArg(prmc, prmv, "pattern.nProtocol", sizeof(pce_rule.pattern.nProtocol), &pce_rule.pattern.nProtocol);
+ scanParamArg(prmc, prmv, "pattern.nProtocolMask", sizeof(pce_rule.pattern.nProtocolMask), &pce_rule.pattern.nProtocolMask);
+ scanParamArg(prmc, prmv, "pattern.bProtocol_Exclude", sizeof(pce_rule.pattern.bProtocol_Exclude), &pce_rule.pattern.bProtocol_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bInnerProtocolEnable", sizeof(pce_rule.pattern.bInnerProtocolEnable), &pce_rule.pattern.bInnerProtocolEnable);
+ scanParamArg(prmc, prmv, "pattern.nInnerProtocol", sizeof(pce_rule.pattern.nInnerProtocol), &pce_rule.pattern.nInnerProtocol);
+ scanParamArg(prmc, prmv, "pattern.nInnerProtocolMask", sizeof(pce_rule.pattern.nInnerProtocolMask), &pce_rule.pattern.nInnerProtocolMask);
+ scanParamArg(prmc, prmv, "pattern.bInnerProtocol_Exclude", sizeof(pce_rule.pattern.bInnerProtocol_Exclude), &pce_rule.pattern.bInnerProtocol_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bSessionIdEnable", sizeof(pce_rule.pattern.bSessionIdEnable), &pce_rule.pattern.bSessionIdEnable);
+ scanParamArg(prmc, prmv, "pattern.nSessionId", sizeof(pce_rule.pattern.nSessionId), &pce_rule.pattern.nSessionId);
+ scanParamArg(prmc, prmv, "pattern.bSessionId_Exclude", sizeof(pce_rule.pattern.bSessionId_Exclude), &pce_rule.pattern.bSessionId_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bPPP_ProtocolEnable", sizeof(pce_rule.pattern.bPPP_ProtocolEnable), &pce_rule.pattern.bPPP_ProtocolEnable);
+ scanParamArg(prmc, prmv, "pattern.nPPP_Protocol", sizeof(pce_rule.pattern.nPPP_Protocol), &pce_rule.pattern.nPPP_Protocol);
+ scanParamArg(prmc, prmv, "pattern.nPPP_ProtocolMask", sizeof(pce_rule.pattern.nPPP_ProtocolMask), &pce_rule.pattern.nPPP_ProtocolMask);
+ scanParamArg(prmc, prmv, "pattern.bPPP_Protocol_Exclude", sizeof(pce_rule.pattern.bPPP_Protocol_Exclude), &pce_rule.pattern.bPPP_Protocol_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bVid", sizeof(pce_rule.pattern.bVid), &pce_rule.pattern.bVid);
+ scanParamArg(prmc, prmv, "pattern.nVid", sizeof(pce_rule.pattern.nVid), &pce_rule.pattern.nVid);
+ scanParamArg(prmc, prmv, "pattern.bVidRange_Select", sizeof(pce_rule.pattern.bVidRange_Select), &pce_rule.pattern.bVidRange_Select);
+ scanParamArg(prmc, prmv, "pattern.nVidRange", sizeof(pce_rule.pattern.nVidRange), &pce_rule.pattern.nVidRange);
+ scanParamArg(prmc, prmv, "pattern.bVid_Exclude", sizeof(pce_rule.pattern.bVid_Exclude), &pce_rule.pattern.bVid_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bSLAN_Vid", sizeof(pce_rule.pattern.bSLAN_Vid), &pce_rule.pattern.bSLAN_Vid);
+ scanParamArg(prmc, prmv, "pattern.nSLAN_Vid", sizeof(pce_rule.pattern.nSLAN_Vid), &pce_rule.pattern.nSLAN_Vid);
+ scanParamArg(prmc, prmv, "pattern.bSLANVid_Exclude", sizeof(pce_rule.pattern.bSLANVid_Exclude), &pce_rule.pattern.bSLANVid_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bPayload1_SrcEnable", sizeof(pce_rule.pattern.bPayload1_SrcEnable), &pce_rule.pattern.bPayload1_SrcEnable);
+ scanParamArg(prmc, prmv, "pattern.nPayload1", sizeof(pce_rule.pattern.nPayload1), &pce_rule.pattern.nPayload1);
+ scanParamArg(prmc, prmv, "pattern.bPayload1MaskRange_Select", sizeof(pce_rule.pattern.bPayload1MaskRange_Select), &pce_rule.pattern.bPayload1MaskRange_Select);
+ scanParamArg(prmc, prmv, "pattern.nPayload1_Mask", sizeof(pce_rule.pattern.nPayload1_Mask), &pce_rule.pattern.nPayload1_Mask);
+ scanParamArg(prmc, prmv, "pattern.bPayload1_Exclude", sizeof(pce_rule.pattern.bPayload1_Exclude), &pce_rule.pattern.bPayload1_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bPayload2_SrcEnable", sizeof(pce_rule.pattern.bPayload2_SrcEnable), &pce_rule.pattern.bPayload2_SrcEnable);
+ scanParamArg(prmc, prmv, "pattern.nPayload2", sizeof(pce_rule.pattern.nPayload2), &pce_rule.pattern.nPayload2);
+ scanParamArg(prmc, prmv, "pattern.bPayload2MaskRange_Select", sizeof(pce_rule.pattern.bPayload2MaskRange_Select), &pce_rule.pattern.bPayload2MaskRange_Select);
+ scanParamArg(prmc, prmv, "pattern.nPayload2_Mask", sizeof(pce_rule.pattern.nPayload2_Mask), &pce_rule.pattern.nPayload2_Mask);
+ scanParamArg(prmc, prmv, "pattern.bPayload2_Exclude", sizeof(pce_rule.pattern.bPayload2_Exclude), &pce_rule.pattern.bPayload2_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bParserFlagLSB_Enable", sizeof(pce_rule.pattern.bParserFlagLSB_Enable), &pce_rule.pattern.bParserFlagLSB_Enable);
+ scanParamArg(prmc, prmv, "pattern.nParserFlagLSB", sizeof(pce_rule.pattern.nParserFlagLSB), &pce_rule.pattern.nParserFlagLSB);
+ scanParamArg(prmc, prmv, "pattern.nParserFlagLSB_Mask", sizeof(pce_rule.pattern.nParserFlagLSB_Mask), &pce_rule.pattern.nParserFlagLSB_Mask);
+ scanParamArg(prmc, prmv, "pattern.bParserFlagLSB_Exclude", sizeof(pce_rule.pattern.bParserFlagLSB_Exclude), &pce_rule.pattern.bParserFlagLSB_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bParserFlagMSB_Enable", sizeof(pce_rule.pattern.bParserFlagMSB_Enable), &pce_rule.pattern.bParserFlagMSB_Enable);
+ scanParamArg(prmc, prmv, "pattern.nParserFlagMSB", sizeof(pce_rule.pattern.nParserFlagMSB), &pce_rule.pattern.nParserFlagMSB);
+ scanParamArg(prmc, prmv, "pattern.nParserFlagMSB_Mask", sizeof(pce_rule.pattern.nParserFlagMSB_Mask), &pce_rule.pattern.nParserFlagMSB_Mask);
+ scanParamArg(prmc, prmv, "pattern.bParserFlagMSB_Exclude", sizeof(pce_rule.pattern.bParserFlagMSB_Exclude), &pce_rule.pattern.bParserFlagMSB_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bParserFlag1LSB_Enable", sizeof(pce_rule.pattern.bParserFlag1LSB_Enable), &pce_rule.pattern.bParserFlag1LSB_Enable);
+ scanParamArg(prmc, prmv, "pattern.nParserFlag1LSB", sizeof(pce_rule.pattern.nParserFlag1LSB), &pce_rule.pattern.nParserFlag1LSB);
+ scanParamArg(prmc, prmv, "pattern.nParserFlag1LSB_Mask", sizeof(pce_rule.pattern.nParserFlag1LSB_Mask), &pce_rule.pattern.nParserFlag1LSB_Mask);
+ scanParamArg(prmc, prmv, "pattern.bParserFlag1LSB_Exclude", sizeof(pce_rule.pattern.bParserFlag1LSB_Exclude), &pce_rule.pattern.bParserFlag1LSB_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bParserFlag1MSB_Enable", sizeof(pce_rule.pattern.bParserFlag1MSB_Enable), &pce_rule.pattern.bParserFlag1MSB_Enable);
+ scanParamArg(prmc, prmv, "pattern.nParserFlag1MSB", sizeof(pce_rule.pattern.nParserFlag1MSB), &pce_rule.pattern.nParserFlag1MSB);
+ scanParamArg(prmc, prmv, "pattern.nParserFlag1MSB_Mask", sizeof(pce_rule.pattern.nParserFlag1MSB_Mask), &pce_rule.pattern.nParserFlag1MSB_Mask);
+ scanParamArg(prmc, prmv, "pattern.bParserFlag1MSB_Exclude", sizeof(pce_rule.pattern.bParserFlag1MSB_Exclude), &pce_rule.pattern.bParserFlag1MSB_Exclude);
+
+ scanParamArg(prmc, prmv, "pattern.bVid_Original", sizeof(pce_rule.pattern.bVid_Original), &pce_rule.pattern.bVid_Original);
+ scanParamArg(prmc, prmv, "pattern.nOuterVidRange", sizeof(pce_rule.pattern.nOuterVidRange), &pce_rule.pattern.nOuterVidRange);
+ scanParamArg(prmc, prmv, "pattern.bSVidRange_Select", sizeof(pce_rule.pattern.bSVidRange_Select), &pce_rule.pattern.bSVidRange_Select);
+ scanParamArg(prmc, prmv, "pattern.bOuterVid_Original", sizeof(pce_rule.pattern.bOuterVid_Original), &pce_rule.pattern.bOuterVid_Original);
+
+ scanParamArg(prmc, prmv, "action.eTrafficClassAction", sizeof(pce_rule.action.eTrafficClassAction), &pce_rule.action.eTrafficClassAction);
+ scanParamArg(prmc, prmv, "action.nTrafficClassAlternate", sizeof(pce_rule.action.nTrafficClassAlternate), &pce_rule.action.nTrafficClassAlternate);
+ scanParamArg(prmc, prmv, "action.eSnoopingTypeAction", sizeof(pce_rule.action.eSnoopingTypeAction), &pce_rule.action.eSnoopingTypeAction);
+ scanParamArg(prmc, prmv, "action.eLearningAction", sizeof(pce_rule.action.eLearningAction), &pce_rule.action.eLearningAction);
+ scanParamArg(prmc, prmv, "action.eIrqAction", sizeof(pce_rule.action.eIrqAction), &pce_rule.action.eIrqAction);
+ scanParamArg(prmc, prmv, "action.eCrossStateAction", sizeof(pce_rule.action.eCrossStateAction), &pce_rule.action.eCrossStateAction);
+ scanParamArg(prmc, prmv, "action.eCritFrameAction", sizeof(pce_rule.action.eCritFrameAction), &pce_rule.action.eCritFrameAction);
+ scanParamArg(prmc, prmv, "action.eTimestampAction", sizeof(pce_rule.action.eTimestampAction), &pce_rule.action.eTimestampAction);
+ scanParamArg(prmc, prmv, "action.ePortMapAction", sizeof(pce_rule.action.ePortMapAction), &pce_rule.action.ePortMapAction);
+ scanParamArg(prmc, prmv, "action.nForwardPortMap", sizeof(pce_rule.action.nForwardPortMap[0]), &pce_rule.action.nForwardPortMap[0]);
+ scanParamArg(prmc, prmv, "action.nForwardPortMap[1]", sizeof(pce_rule.action.nForwardPortMap[1]), &pce_rule.action.nForwardPortMap[1]);
+ scanParamArg(prmc, prmv, "action.nForwardPortMap[2]", sizeof(pce_rule.action.nForwardPortMap[2]), &pce_rule.action.nForwardPortMap[2]);
+ scanParamArg(prmc, prmv, "action.nForwardPortMap[3]", sizeof(pce_rule.action.nForwardPortMap[3]), &pce_rule.action.nForwardPortMap[3]);
+ scanParamArg(prmc, prmv, "action.nForwardPortMap[4]", sizeof(pce_rule.action.nForwardPortMap[4]), &pce_rule.action.nForwardPortMap[4]);
+ scanParamArg(prmc, prmv, "action.nForwardPortMap[5]", sizeof(pce_rule.action.nForwardPortMap[5]), &pce_rule.action.nForwardPortMap[5]);
+ scanParamArg(prmc, prmv, "action.nForwardPortMap[6]", sizeof(pce_rule.action.nForwardPortMap[6]), &pce_rule.action.nForwardPortMap[6]);
+ scanParamArg(prmc, prmv, "action.nForwardPortMap[7]", sizeof(pce_rule.action.nForwardPortMap[7]), &pce_rule.action.nForwardPortMap[7]);
+ scanParamArg(prmc, prmv, "action.bRemarkAction", sizeof(pce_rule.action.bRemarkAction), &pce_rule.action.bRemarkAction);
+ scanParamArg(prmc, prmv, "action.bRemarkPCP", sizeof(pce_rule.action.bRemarkAction), &pce_rule.action.bRemarkPCP);
+ scanParamArg(prmc, prmv, "action.bRemarkSTAG_PCP", sizeof(pce_rule.action.bRemarkSTAG_PCP), &pce_rule.action.bRemarkSTAG_PCP);
+ scanParamArg(prmc, prmv, "action.bRemarkSTAG_DEI", sizeof(pce_rule.action.bRemarkSTAG_DEI), &pce_rule.action.bRemarkSTAG_DEI);
+ scanParamArg(prmc, prmv, "action.bRemarkDSCP", sizeof(pce_rule.action.bRemarkDSCP), &pce_rule.action.bRemarkDSCP);
+ scanParamArg(prmc, prmv, "action.bRemarkClass", sizeof(pce_rule.action.bRemarkClass), &pce_rule.action.bRemarkClass);
+ scanParamArg(prmc, prmv, "action.eMeterAction", sizeof(pce_rule.action.eMeterAction), &pce_rule.action.eMeterAction);
+ scanParamArg(prmc, prmv, "action.nMeterId", sizeof(pce_rule.action.nMeterId), &pce_rule.action.nMeterId);
+ scanParamArg(prmc, prmv, "action.bRMON_Action", sizeof(pce_rule.action.bRMON_Action), &pce_rule.action.bRMON_Action);
+ scanParamArg(prmc, prmv, "action.nRMON_Id", sizeof(pce_rule.action.nRMON_Id), &pce_rule.action.nRMON_Id);
+ scanParamArg(prmc, prmv, "action.eVLAN_Action", sizeof(pce_rule.action.eVLAN_Action), &pce_rule.action.eVLAN_Action);
+ scanParamArg(prmc, prmv, "action.nVLAN_Id", sizeof(pce_rule.action.nVLAN_Id), &pce_rule.action.nVLAN_Id);
+ scanParamArg(prmc, prmv, "action.nFId", sizeof(pce_rule.action.nFId), &pce_rule.action.nFId);
+ scanParamArg(prmc, prmv, "action.bFidEnable", sizeof(pce_rule.action.bFidEnable), &pce_rule.action.bFidEnable);
+
+ scanParamArg(prmc, prmv, "action.eSVLAN_Action", sizeof(pce_rule.action.eSVLAN_Action), &pce_rule.action.eSVLAN_Action);
+ scanParamArg(prmc, prmv, "action.nSVLAN_Id", sizeof(pce_rule.action.nSVLAN_Id), &pce_rule.action.nSVLAN_Id);
+ scanParamArg(prmc, prmv, "action.eVLAN_CrossAction", sizeof(pce_rule.action.eVLAN_CrossAction), &pce_rule.action.eVLAN_CrossAction);
+ scanParamArg(prmc, prmv, "action.bPortBitMapMuxControl", sizeof(pce_rule.action.bPortBitMapMuxControl), &pce_rule.action.bPortBitMapMuxControl);
+ scanParamArg(prmc, prmv, "action.bCVLAN_Ignore_Control", sizeof(pce_rule.action.bCVLAN_Ignore_Control), &pce_rule.action.bCVLAN_Ignore_Control);
+ scanParamArg(prmc, prmv, "action.bPortLinkSelection", sizeof(pce_rule.action.bPortLinkSelection), &pce_rule.action.bPortLinkSelection);
+ scanParamArg(prmc, prmv, "action.bPortTrunkAction", sizeof(pce_rule.action.bPortTrunkAction), &pce_rule.action.bPortTrunkAction);
+
+ scanParamArg(prmc, prmv, "action.bFlowID_Action", sizeof(pce_rule.action.bFlowID_Action), &pce_rule.action.bFlowID_Action);
+ scanParamArg(prmc, prmv, "action.nFlowID", sizeof(pce_rule.action.nFlowID), &pce_rule.action.nFlowID);
+
+ scanParamArg(prmc, prmv, "action.bRoutExtId_Action", sizeof(pce_rule.action.bRoutExtId_Action), &pce_rule.action.bRoutExtId_Action);
+ scanParamArg(prmc, prmv, "action.nRoutExtId", sizeof(pce_rule.action.nRoutExtId), &pce_rule.action.nRoutExtId);
+
+ scanParamArg(prmc, prmv, "action.bRtDstPortMaskCmp_Action", sizeof(pce_rule.action.bRtDstPortMaskCmp_Action), &pce_rule.action.bRtDstPortMaskCmp_Action);
+ scanParamArg(prmc, prmv, "action.bRtSrcPortMaskCmp_Action", sizeof(pce_rule.action.bRtSrcPortMaskCmp_Action), &pce_rule.action.bRtSrcPortMaskCmp_Action);
+ scanParamArg(prmc, prmv, "action.bRtDstIpMaskCmp_Action", sizeof(pce_rule.action.bRtDstIpMaskCmp_Action), &pce_rule.action.bRtDstIpMaskCmp_Action);
+ scanParamArg(prmc, prmv, "action.bRtSrcIpMaskCmp_Action", sizeof(pce_rule.action.bRtSrcIpMaskCmp_Action), &pce_rule.action.bRtSrcIpMaskCmp_Action);
+ scanParamArg(prmc, prmv, "action.bRtInnerIPasKey_Action", sizeof(pce_rule.action.bRtInnerIPasKey_Action), &pce_rule.action.bRtInnerIPasKey_Action);
+
+ scanParamArg(prmc, prmv, "action.bRtAccelEna_Action", sizeof(pce_rule.action.bRtAccelEna_Action), &pce_rule.action.bRtAccelEna_Action);
+ scanParamArg(prmc, prmv, "action.bRtCtrlEna_Action", sizeof(pce_rule.action.bRtCtrlEna_Action), &pce_rule.action.bRtCtrlEna_Action);
+ scanParamArg(prmc, prmv, "action.eProcessPath_Action", sizeof(pce_rule.action.eProcessPath_Action), &pce_rule.action.eProcessPath_Action);
+ scanParamArg(prmc, prmv, "action.ePortFilterType_Action", sizeof(pce_rule.action.ePortFilterType_Action), &pce_rule.action.ePortFilterType_Action);
+
+ scanParamArg(prmc, prmv, "action.bOamEnable", sizeof(pce_rule.action.bOamEnable), &pce_rule.action.bOamEnable);
+ scanParamArg(prmc, prmv, "action.nRecordId", sizeof(pce_rule.action.nRecordId), &pce_rule.action.nRecordId);
+ scanParamArg(prmc, prmv, "action.bExtractEnable", sizeof(pce_rule.action.bExtractEnable), &pce_rule.action.bExtractEnable);
+ scanParamArg(prmc, prmv, "action.eColorFrameAction", sizeof(pce_rule.action.eColorFrameAction), &pce_rule.action.eColorFrameAction);
+ scanParamArg(prmc, prmv, "action.bExtendedVlanEnable", sizeof(pce_rule.action.bExtendedVlanEnable), &pce_rule.action.bExtendedVlanEnable);
+ scanParamArg(prmc, prmv, "action.nExtendedVlanBlockId", sizeof(pce_rule.action.nExtendedVlanBlockId), &pce_rule.action.nExtendedVlanBlockId);
+
+ /*Aplicable for GSWIP 3.2*/
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField4Enable",
+ sizeof(pce_rule.pattern.bFlexibleField4Enable), &pce_rule.pattern.bFlexibleField4Enable);
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField4_ExcludeEnable",
+ sizeof(pce_rule.pattern.bFlexibleField4_ExcludeEnable), &pce_rule.pattern.bFlexibleField4_ExcludeEnable);
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField4_RangeEnable",
+ sizeof(pce_rule.pattern.bFlexibleField4_RangeEnable), &pce_rule.pattern.bFlexibleField4_RangeEnable);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField4_ParserIndex",
+ sizeof(pce_rule.pattern.nFlexibleField4_ParserIndex), &pce_rule.pattern.nFlexibleField4_ParserIndex);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField4_Value",
+ sizeof(pce_rule.pattern.nFlexibleField4_Value), &pce_rule.pattern.nFlexibleField4_Value);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField4_MaskOrRange",
+ sizeof(pce_rule.pattern.nFlexibleField4_MaskOrRange), &pce_rule.pattern.nFlexibleField4_MaskOrRange);
+
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField3Enable",
+ sizeof(pce_rule.pattern.bFlexibleField3Enable), &pce_rule.pattern.bFlexibleField3Enable);
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField3_ExcludeEnable",
+ sizeof(pce_rule.pattern.bFlexibleField3_ExcludeEnable), &pce_rule.pattern.bFlexibleField3_ExcludeEnable);
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField3_RangeEnable",
+ sizeof(pce_rule.pattern.bFlexibleField3_RangeEnable), &pce_rule.pattern.bFlexibleField3_RangeEnable);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField3_ParserIndex",
+ sizeof(pce_rule.pattern.nFlexibleField3_ParserIndex), &pce_rule.pattern.nFlexibleField3_ParserIndex);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField3_Value",
+ sizeof(pce_rule.pattern.nFlexibleField3_Value), &pce_rule.pattern.nFlexibleField3_Value);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField3_MaskOrRange",
+ sizeof(pce_rule.pattern.nFlexibleField3_MaskOrRange), &pce_rule.pattern.nFlexibleField3_MaskOrRange);
+
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField2Enable",
+ sizeof(pce_rule.pattern.bFlexibleField2Enable), &pce_rule.pattern.bFlexibleField2Enable);
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField2_ExcludeEnable",
+ sizeof(pce_rule.pattern.bFlexibleField2_ExcludeEnable), &pce_rule.pattern.bFlexibleField2_ExcludeEnable);
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField2_RangeEnable",
+ sizeof(pce_rule.pattern.bFlexibleField2_RangeEnable), &pce_rule.pattern.bFlexibleField2_RangeEnable);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField2_ParserIndex",
+ sizeof(pce_rule.pattern.nFlexibleField2_ParserIndex), &pce_rule.pattern.nFlexibleField2_ParserIndex);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField2_Value",
+ sizeof(pce_rule.pattern.nFlexibleField2_Value), &pce_rule.pattern.nFlexibleField2_Value);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField2_MaskOrRange",
+ sizeof(pce_rule.pattern.nFlexibleField2_MaskOrRange), &pce_rule.pattern.nFlexibleField2_MaskOrRange);
+
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField1Enable",
+ sizeof(pce_rule.pattern.bFlexibleField1Enable), &pce_rule.pattern.bFlexibleField1Enable);
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField1_ExcludeEnable",
+ sizeof(pce_rule.pattern.bFlexibleField1_ExcludeEnable), &pce_rule.pattern.bFlexibleField1_ExcludeEnable);
+ scanParamArg(prmc, prmv, "pattern.bFlexibleField1_RangeEnable",
+ sizeof(pce_rule.pattern.bFlexibleField1_RangeEnable), &pce_rule.pattern.bFlexibleField1_RangeEnable);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField1_ParserIndex",
+ sizeof(pce_rule.pattern.nFlexibleField1_ParserIndex), &pce_rule.pattern.nFlexibleField1_ParserIndex);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField1_Value",
+ sizeof(pce_rule.pattern.nFlexibleField1_Value), &pce_rule.pattern.nFlexibleField1_Value);
+ scanParamArg(prmc, prmv, "pattern.nFlexibleField1_MaskOrRange",
+ sizeof(pce_rule.pattern.nFlexibleField1_MaskOrRange), &pce_rule.pattern.nFlexibleField1_MaskOrRange);
+
+ scanParamArg(prmc, prmv, "action.bPBB_Action_Enable", sizeof(pce_rule.action.bPBB_Action_Enable), &pce_rule.action.bPBB_Action_Enable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bIheaderActionEnable",
+ sizeof(pce_rule.action.sPBB_Action.bIheaderActionEnable), &pce_rule.action.sPBB_Action.bIheaderActionEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.eIheaderOpMode",
+ sizeof(pce_rule.action.sPBB_Action.eIheaderOpMode), &pce_rule.action.sPBB_Action.eIheaderOpMode);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bTunnelIdKnownTrafficEnable",
+ sizeof(pce_rule.action.sPBB_Action.bTunnelIdKnownTrafficEnable), &pce_rule.action.sPBB_Action.bTunnelIdKnownTrafficEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.nTunnelIdKnownTraffic",
+ sizeof(pce_rule.action.sPBB_Action.nTunnelIdKnownTraffic), &pce_rule.action.sPBB_Action.nTunnelIdKnownTraffic);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bTunnelIdUnKnownTrafficEnable",
+ sizeof(pce_rule.action.sPBB_Action.bTunnelIdUnKnownTrafficEnable), &pce_rule.action.sPBB_Action.bTunnelIdUnKnownTrafficEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.nTunnelIdUnKnownTraffic",
+ sizeof(pce_rule.action.sPBB_Action.nTunnelIdUnKnownTraffic), &pce_rule.action.sPBB_Action.nTunnelIdUnKnownTraffic);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bB_DstMac_FromMacTableEnable",
+ sizeof(pce_rule.action.sPBB_Action.bB_DstMac_FromMacTableEnable), &pce_rule.action.sPBB_Action.bB_DstMac_FromMacTableEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_B_SrcMacEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_B_SrcMacEnable), &pce_rule.action.sPBB_Action.bReplace_B_SrcMacEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_B_DstMacEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_B_DstMacEnable), &pce_rule.action.sPBB_Action.bReplace_B_DstMacEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_I_TAG_ResEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_I_TAG_ResEnable), &pce_rule.action.sPBB_Action.bReplace_I_TAG_ResEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_I_TAG_UacEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_I_TAG_UacEnable), &pce_rule.action.sPBB_Action.bReplace_I_TAG_UacEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_I_TAG_DeiEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_I_TAG_DeiEnable), &pce_rule.action.sPBB_Action.bReplace_I_TAG_DeiEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_I_TAG_PcpEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_I_TAG_PcpEnable), &pce_rule.action.sPBB_Action.bReplace_I_TAG_PcpEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_I_TAG_SidEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_I_TAG_SidEnable), &pce_rule.action.sPBB_Action.bReplace_I_TAG_SidEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_I_TAG_TpidEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_I_TAG_TpidEnable), &pce_rule.action.sPBB_Action.bReplace_I_TAG_TpidEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bBtagActionEnable",
+ sizeof(pce_rule.action.sPBB_Action.bBtagActionEnable), &pce_rule.action.sPBB_Action.bBtagActionEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.eBtagOpMode",
+ sizeof(pce_rule.action.sPBB_Action.eBtagOpMode), &pce_rule.action.sPBB_Action.eBtagOpMode);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bProcessIdKnownTrafficEnable",
+ sizeof(pce_rule.action.sPBB_Action.bProcessIdKnownTrafficEnable), &pce_rule.action.sPBB_Action.bProcessIdKnownTrafficEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.nProcessIdKnownTraffic",
+ sizeof(pce_rule.action.sPBB_Action.nProcessIdKnownTraffic), &pce_rule.action.sPBB_Action.nProcessIdKnownTraffic);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bProcessIdUnKnownTrafficEnable",
+ sizeof(pce_rule.action.sPBB_Action.bProcessIdUnKnownTrafficEnable), &pce_rule.action.sPBB_Action.bProcessIdUnKnownTrafficEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.nProcessIdUnKnownTraffic",
+ sizeof(pce_rule.action.sPBB_Action.nProcessIdUnKnownTraffic), &pce_rule.action.sPBB_Action.nProcessIdUnKnownTraffic);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_B_TAG_DeiEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_B_TAG_DeiEnable), &pce_rule.action.sPBB_Action.bReplace_B_TAG_DeiEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_B_TAG_PcpEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_B_TAG_PcpEnable), &pce_rule.action.sPBB_Action.bReplace_B_TAG_PcpEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_B_TAG_VidEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_B_TAG_VidEnable), &pce_rule.action.sPBB_Action.bReplace_B_TAG_VidEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bReplace_B_TAG_TpidEnable",
+ sizeof(pce_rule.action.sPBB_Action.bReplace_B_TAG_TpidEnable), &pce_rule.action.sPBB_Action.bReplace_B_TAG_TpidEnable);
+
+ scanParamArg(prmc, prmv, "action.sPBB_Action.bMacTableMacinMacActionEnable",
+ sizeof(pce_rule.action.sPBB_Action.bMacTableMacinMacActionEnable), &pce_rule.action.sPBB_Action.bMacTableMacinMacActionEnable);
+ scanParamArg(prmc, prmv, "action.sPBB_Action.eMacTableMacinMacSelect",
+ sizeof(pce_rule.action.sPBB_Action.eMacTableMacinMacSelect), &pce_rule.action.sPBB_Action.eMacTableMacinMacSelect);
+
+ scanParamArg(prmc, prmv, "action.bDestSubIf_Action_Enable",
+ sizeof(pce_rule.action.bDestSubIf_Action_Enable), &pce_rule.action.bDestSubIf_Action_Enable);
+ scanParamArg(prmc, prmv, "action.sDestSubIF_Action.bDestSubIFIDActionEnable",
+ sizeof(pce_rule.action.sDestSubIF_Action.bDestSubIFIDActionEnable), &pce_rule.action.sDestSubIF_Action.bDestSubIFIDActionEnable);
+ scanParamArg(prmc, prmv, "action.sDestSubIF_Action.bDestSubIFIDAssignmentEnable",
+ sizeof(pce_rule.action.sDestSubIF_Action.bDestSubIFIDAssignmentEnable), &pce_rule.action.sDestSubIF_Action.bDestSubIFIDAssignmentEnable);
+ scanParamArg(prmc, prmv, "action.sDestSubIF_Action.nDestSubIFGrp_Field",
+ sizeof(pce_rule.action.sDestSubIF_Action.nDestSubIFGrp_Field), &pce_rule.action.sDestSubIF_Action.nDestSubIFGrp_Field);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PceRuleWrite(gsw_dev, &pce_rule);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PceRuleWrite failed with ret code", ret);
+ else{
+ printf("fapi_GSW_PceRuleWrite done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PceRuleDelete(int prmc, char *prmv[])
+{
+ GSW_PCE_ruleEntry_t pce_rule;
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ memset(&pce_rule, 0, sizeof(GSW_PCE_ruleEntry_t));
+
+ scanParamArg(prmc, prmv, "pattern.nIndex", sizeof(pce_rule.nIndex), &pce_rule.nIndex);
+ scanParamArg(prmc, prmv, "nLogicalPortId", sizeof(pce_rule.logicalportid), &pce_rule.logicalportid);
+ scanParamArg(prmc, prmv, "nSubIfIdGroup", sizeof(pce_rule.subifidgroup), &pce_rule.subifidgroup);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PceRuleDelete(gsw_dev, &pce_rule);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PceRuleDelete failed with ret code", ret);
+ else{
+ printf("fapi_GSW_PceRuleDelete done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PceRuleAlloc(int prmc, char *prmv[])
+{
+ GSW_PCE_rule_alloc_t alloc = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "num_of_rules", sizeof(alloc.num_of_rules), &alloc.num_of_rules);
+ if (rret < 1){
+ printf("Parameter not Found: num_of_rules\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PceRuleAlloc(gsw_dev, &alloc);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PceRuleAlloc failed with ret code", ret);
+ else{
+ printf("\n\tret = %d", ret);
+ printf("\n\tblockid = %u", alloc.blockid);
+ printf("\n\tnum_of_rules = %u", alloc.num_of_rules);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PceRuleFree(int prmc, char *prmv[])
+{
+ GSW_PCE_rule_alloc_t alloc = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "blockid", sizeof(alloc.num_of_rules), &alloc.blockid);
+ if (rret < 1){
+ printf("Parameter not Found: blockid\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PceRuleFree(gsw_dev, &alloc);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PceRuleFree failed with ret code", ret);
+ else{
+ printf("\n\tret = %d", ret);
+ printf("\n\tblockid = %u", alloc.blockid);
+ printf("\n\tnum_of_rules = %u", alloc.num_of_rules);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PceRuleEnable(int prmc, char *prmv[])
+{
+ GSW_PCE_ruleEntry_t pce_rule = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ scanParamArg(prmc, prmv, "nLogicalPortId", sizeof(pce_rule.logicalportid), &pce_rule.logicalportid);
+ scanParamArg(prmc, prmv, "nSubIfIdGroup", sizeof(pce_rule.subifidgroup), &pce_rule.subifidgroup);
+ scanParamArg(prmc, prmv, "region", sizeof(pce_rule.subifidgroup), &pce_rule.region);
+ scanParamArg(prmc, prmv, "pattern.nIndex", sizeof(pce_rule.nIndex), &pce_rule.nIndex);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PceRuleEnable(gsw_dev, &pce_rule);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PceRuleEnable failed with ret code", ret);
+ else{
+ printf("\n\tret = %d", ret);
+ printf("\n\tregion = %u", pce_rule.region);
+ printf("\n\tpattern.nIndex = %u", pce_rule.nIndex);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PceRuleDisable(int prmc, char *prmv[])
+{
+ GSW_PCE_ruleEntry_t pce_rule = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ scanParamArg(prmc, prmv, "nLogicalPortId", sizeof(pce_rule.logicalportid), &pce_rule.logicalportid);
+ scanParamArg(prmc, prmv, "nSubIfIdGroup", sizeof(pce_rule.subifidgroup), &pce_rule.subifidgroup);
+ scanParamArg(prmc, prmv, "region", sizeof(pce_rule.subifidgroup), &pce_rule.region);
+ scanParamArg(prmc, prmv, "pattern.nIndex", sizeof(pce_rule.nIndex), &pce_rule.nIndex);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PceRuleDisable(gsw_dev, &pce_rule);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PceRuleDisable failed with ret code", ret);
+ else{
+ printf("\n\tret = %d", ret);
+ printf("\n\tregion = %u", pce_rule.region);
+ printf("\n\tpattern.nIndex = %u", pce_rule.nIndex);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+// int gsw_dump_pce_mem(int prmc, char *prmv[])
+// {
+// GSW_table_t sVar = {0};
+// GSW_register_t reg = {0};
+// unsigned int i = 0, j = 0, k = 0, m = 0;
+// int num_of_elem;
+// GSW_Device_t *gsw_dev;
+// GSW_return_t ret;
+// int rret;
+// gsw_dev = gsw_get_struc(lif_id,0);
+
+// num_of_elem = (sizeof(tbl_dump_gsw33) / sizeof(struct _tbl_dump_));
+
+// for (i = 0; i < num_of_elem; i++) {
+// printf("===========================================\n");
+// printf("Table Name: %s\n", tbl_dump_gsw33[i].tbl_name);
+// printf("===========================================\n");
+
+// for (j = 0; j < tbl_dump_gsw33[i].entries; j++) {
+// memset(&sVar, 0, sizeof(sVar));
+
+// printf("Table Idx: %02d\n", j);
+// sVar.tbl_entry = j;
+// sVar.tbl_addr = tbl_dump_gsw33[i].tbl_addr;
+// sVar.tbl_id = 1;
+// gsw_cli_ops->gsw_debug_ops.DumpMem(gsw_dev, &sVar);
+
+
+// for (k = 0; k < gsw_pce_tbl_33[sVar.tbl_addr].num_key; k++)
+// printf("\tKey %d: %04x\n", k, sVar.ptdata.key[k]);
+
+// for (k = 0; k < gsw_pce_tbl_33[sVar.tbl_addr].num_mask; k++)
+// printf("\tMask %d: %04x\n", k, sVar.ptdata.mask[k]);
+
+// for (k = 0; k < gsw_pce_tbl_33[sVar.tbl_addr].num_val; k++)
+// printf("\tVal %d: %04x\n", k, sVar.ptdata.val[k]);
+
+// printf("\tValid: %x\n", sVar.ptdata.valid);
+// printf("\tType: %x\n", sVar.ptdata.type);
+// printf("\n");
+
+// for (m = 0; m < 500000; m++);
+// }
+// }
+// printf("===========================================\n");
+// for (i = 0; i < 0xEFF; i++) {
+
+// reg.nData = 0;
+// reg.nRegAddr = i;
+// GSW_RegisterGet(gsw_dev, ®);
+// printf("%08x: %08x\n", (0xC0D52000 + (i * 0x4)), reg.nData);
+// }
+
+// return ret;
+// }
+
+GSW_return_t fapi_GSW_MulticastRouterPortAdd(int prmc, char *prmv[])
+{
+ GSW_multicastRouter_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MulticastRouterPortAdd(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MulticastRouterPortAdd failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MulticastRouterPortAdd done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MulticastRouterPortRemove(int prmc, char *prmv[])
+{
+ GSW_multicastRouter_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MulticastRouterPortRemove(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MulticastRouterPortRemove failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MulticastRouterPortRemove done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MulticastSnoopCfgGet(int prmc, char *prmv[])
+{
+ GSW_multicastSnoopCfg_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MulticastSnoopCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MulticastSnoopCfgGet failed with ret code", ret);
+ else{
+ printf("Returned values:\n----------------\n");
+ printf("\t%40s:\t0x%x\n", "eIGMP_Mode", param.eIGMP_Mode);
+ printf("\t%40s:\t%s\n", "bCrossVLAN", (param.bCrossVLAN > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t0x%x\n", "eForwardPort", param.eForwardPort);
+ printf("\t%40s:\t0x%x\n", "nForwardPortId", param.nForwardPortId);
+ printf("\t%40s:\t0x%x\n", "nClassOfService", param.nClassOfService);
+
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MulticastSnoopCfgSet(int prmc, char *prmv[])
+{
+ GSW_multicastSnoopCfg_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MulticastSnoopCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_MulticastSnoopCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc,prmv, "eIGMP_Mode", sizeof(param.eIGMP_Mode), ¶m.eIGMP_Mode);
+ scanParamArg(prmc,prmv, "bCrossVLAN", sizeof(param.bCrossVLAN), ¶m.bCrossVLAN);
+ scanParamArg(prmc,prmv, "eForwardPort", sizeof(param.eForwardPort), ¶m.eForwardPort);
+ scanParamArg(prmc,prmv, "nForwardPortId", sizeof(param.nForwardPortId), ¶m.nForwardPortId);
+ scanParamArg(prmc,prmv, "nClassOfService", sizeof(param.nClassOfService), ¶m.nClassOfService);
+
+ ret = GSW_MulticastSnoopCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MulticastSnoopCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MulticastSnoopCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MulticastRouterPortRead(int prmc, char *prmv[])
+{
+ GSW_multicastRouterRead_t multicastRouterRead = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ multicastRouterRead.bInitial = 1;
+ gsw_dev = gsw_get_struc(lif_id,0);
+
+ for (;;) {
+ ret = GSW_MulticastRouterPortRead(gsw_dev, &multicastRouterRead);
+ if (ret < 0){
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MulticastRouterPortRead failed with ret code", ret);
+ return ret;
+ }
+
+ if (multicastRouterRead.bLast == 1)
+ break;
+
+ printf("\t%40s:\t%d\n", "Router Port", multicastRouterRead.nPortId);
+ memset(&multicastRouterRead, 0x00, sizeof(multicastRouterRead));
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MulticastTableEntryAdd(int prmc, char *prmv[])
+{
+ GSW_multicastTable_t param;
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int retval;
+
+ retval = multicastParamRead(prmc,prmv, ¶m);
+ if (retval != 0)
+ return retval;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MulticastTableEntryAdd(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MulticastTableEntryAdd failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MulticastTableEntryAdd done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MulticastTableEntryRead(int prmc, char *prmv[])
+{
+ GSW_multicastTableRead_t multicastTableRead;
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int k = 0, valid = 0;
+ u8 mcasthitsts_en = 0;
+ GSW_register_t param = {0};
+
+ memset(¶m, 0, sizeof(GSW_register_t));
+ param.nRegAddr = 0x456;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_RegisterGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_RegisterGet failed with ret code", ret);
+ return ret;
+ }
+
+ if (param.nData & 0x2000)
+ mcasthitsts_en = 1;
+ else
+ mcasthitsts_en = 0;
+
+ printf("-----------------------------------------------------------------------------------------------------------------------------------------------\n");
+ printf("| %4s | %6s | %3s | %39s | %39s | %11s | %9s | %9s\n", "Port", "Sub Id", "FID", "GDA", "GSA", "Member Mode", "HitStatus", "VLAN Info");
+ printf("-----------------------------------------------------------------------------------------------------------------------------------------------\n");
+
+ memset(&multicastTableRead, 0x00, sizeof(multicastTableRead));
+ multicastTableRead.bInitial = 1;
+
+ for (;;) {
+ ret = GSW_MulticastTableEntryRead(gsw_dev, &multicastTableRead);
+ if (ret < 0)
+ break;
+
+ if (multicastTableRead.bLast == 1)
+ break;
+
+ if ((multicastTableRead.nPortId == 0) && (multicastTableRead.nSubIfId == 0) && (multicastTableRead.nFID == 0)) {
+ valid = 0;
+
+ for (k = 0; k < 8; k++) {
+ if (multicastTableRead.uIP_Gsa.nIPv6[k] != 0)
+ valid = 1;
+ }
+
+ for (k = 0; k < 8; k++) {
+ if (multicastTableRead.uIP_Gda.nIPv6[k] != 0)
+ valid = 1;
+ }
+
+ for (k = 0; k < ARRAY_SIZE(multicastTableRead.nPortMap); k++) {
+ if (multicastTableRead.nPortMap[k] != 0)
+ valid = 1;
+ }
+
+ if (valid == 0)
+ continue;
+ }
+
+ if (multicastTableRead.nPortId & GSW_PORTMAP_FLAG_GET(GSW_multicastTableRead_t)) {
+
+ unsigned int i = 0, j = 0, mask = 1;
+
+ for (j = 0; j < ARRAY_SIZE(multicastTableRead.nPortMap); j++) {
+ i = 0;
+ mask = 1;
+
+ if (!multicastTableRead.nPortMap[j])
+ continue;
+
+ while (mask <= (1 << 16)) {
+ if (mask & multicastTableRead.nPortMap[j]) {
+ if (mcasthitsts_en && (j == 7) && (mask == (1 << 15))) {
+ break;
+ }
+
+ printf("| %4d |", (j * 16) + i);
+ printf(" %6d |", multicastTableRead.nSubIfId);
+ printf(" %3d |", multicastTableRead.nFID);
+ dump_multicast_table_entry(&multicastTableRead);
+ }
+
+ i++;
+ mask = 1 << i;
+ }
+ }
+ } else {
+ printf("| %4d |", multicastTableRead.nPortId);
+ printf(" %6d |", multicastTableRead.nSubIfId);
+ printf(" %3d |", multicastTableRead.nFID);
+ dump_multicast_table_entry(&multicastTableRead);
+ }
+
+ memset(&multicastTableRead, 0x00, sizeof(multicastTableRead));
+ }
+
+ printf("-----------------------------------------------------------------------------------------------------------------------------------------------\n");
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_MulticastTableEntryRemove(int prmc, char *prmv[])
+{
+ GSW_multicastTable_t param;
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int retval;
+
+ retval = multicastParamRead(prmc,prmv, ¶m);
+ if (retval != 0)
+ return retval;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_MulticastTableEntryRemove(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_MulticastTableEntryRemove failed with ret code", ret);
+ else{
+ printf("fapi_GSW_MulticastTableEntryRemove done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_FW_Update(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = sys_misc_fw_update(gsw_dev);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_FW_Update failed with ret code", ret);
+ else{
+ printf("fapi_GSW_FW_Update done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_FW_Version(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ struct sys_fw_image_version sys_img_ver = {0};
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = sys_misc_fw_version(gsw_dev,&sys_img_ver);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_FW_Version failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n", "Major", sys_img_ver.major);
+ printf("\t%40s:\t%x\n", "Minor", sys_img_ver.minor);
+ printf("\t%40s:\t%u\n", "Revision", sys_img_ver.revision);
+ printf("\t%40s:\t%u\n", "APP Revision", sys_img_ver.app_revision);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PVT_Meas(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ struct sys_sensor_value sensor_value_temp = {0};
+ struct sys_sensor_value sensor_value_volt = {0};
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = sys_misc_pvt_temp(gsw_dev,&sensor_value_temp);
+ ret = sys_misc_pvt_voltage(gsw_dev,&sensor_value_volt);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PVT_Temp failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%d.%d\n", "Temp", sensor_value_temp.val1,sensor_value_temp.val2);
+ printf("\t%40s:\t%d.%d\n", "Voltage", sensor_value_volt.val1,sensor_value_volt.val2);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_Delay(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+ struct sys_delay param = {0};
+
+ rret = scanParamArg(prmc, prmv, "nMsec", sizeof(param.m_sec), ¶m.m_sec);
+ if (rret < 1){
+ printf("Parameter not Found: nMsec\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = sys_misc_delay(gsw_dev,¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Delay failed with ret code", ret);
+ else{
+ printf("fapi_GSW_Delay done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_GPIO_Configure(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+ struct sys_gpio_config param = {0};
+
+ scanParamArg(prmc, prmv, "nEnableMaskIndex0", sizeof(param.enable_mask[0]), ¶m.enable_mask[0]);
+ scanParamArg(prmc, prmv, "nEnableMaskIndex1", sizeof(param.enable_mask[1]), ¶m.enable_mask[1]);
+ scanParamArg(prmc, prmv, "nEnableMaskIndex2", sizeof(param.enable_mask[2]), ¶m.enable_mask[2]);
+ scanParamArg(prmc, prmv, "nAltSel0Index0", sizeof(param.alt_sel_0[0]), ¶m.alt_sel_0[0]);
+ scanParamArg(prmc, prmv, "nAltSel0Index1", sizeof(param.alt_sel_0[1]), ¶m.alt_sel_0[1]);
+ scanParamArg(prmc, prmv, "nAltSel0Index2", sizeof(param.alt_sel_0[2]), ¶m.alt_sel_0[2]);
+ scanParamArg(prmc, prmv, "nAltSel1Index0", sizeof(param.alt_sel_1[0]), ¶m.alt_sel_1[0]);
+ scanParamArg(prmc, prmv, "nAltSel1Index1", sizeof(param.alt_sel_1[1]), ¶m.alt_sel_1[1]);
+ scanParamArg(prmc, prmv, "nAltSel1Index2", sizeof(param.alt_sel_1[2]), ¶m.alt_sel_1[2]);
+ scanParamArg(prmc, prmv, "nDirIndex0", sizeof(param.dir[0]), ¶m.dir[0]);
+ scanParamArg(prmc, prmv, "nDirIndex1", sizeof(param.dir[1]), ¶m.dir[1]);
+ scanParamArg(prmc, prmv, "nDirIndex2", sizeof(param.dir[2]), ¶m.dir[2]);
+ scanParamArg(prmc, prmv, "nOutValueIndex0", sizeof(param.out_val[0]), ¶m.out_val[0]);
+ scanParamArg(prmc, prmv, "nOutValueIndex1", sizeof(param.out_val[1]), ¶m.out_val[1]);
+ scanParamArg(prmc, prmv, "nOutValueIndex2", sizeof(param.out_val[2]), ¶m.out_val[2]);
+ scanParamArg(prmc, prmv, "nTimeoutValue", sizeof(param.timeout_val), ¶m.timeout_val);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = sys_misc_gpio_configure(gsw_dev,¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_GPIO_Configure failed with ret code", ret);
+ else{
+ printf("fapi_GSW_GPIO_Configure done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_Reboot(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = sys_misc_reboot(gsw_dev);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Reboot failed with ret code", ret);
+ else{
+ printf("fapi_GSW_Reboot done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_SysReg_Rd(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+ struct sys_reg_rd sys_reg = {0};
+
+ rret = scanParamArg(prmc, prmv, "addr", sizeof(sys_reg.addr), &sys_reg.addr);
+ if (rret < 1){
+ printf("Parameter not Found: addr\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = sys_misc_reg_rd(gsw_dev,&sys_reg);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_SysReg_Rd failed with ret code", ret);
+ else
+ printf("fapi_GSW_SysReg_Rd:\n\t addr=%x val=%x\n",sys_reg.addr ,sys_reg.val);
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_Debug_RMON_Port_Get(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_Debug_RMON_Port_cnt_t sVar;
+ memset(&sVar, 0, sizeof(GSW_Debug_RMON_Port_cnt_t));
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(sVar.nPortId), &sVar.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "ePortType", sizeof(sVar.ePortType), &sVar.ePortType);
+ if (rret < 1){
+ printf("Parameter not Found: ePortType\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "b64BitMode", sizeof(sVar.b64BitMode), &sVar.b64BitMode);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_Debug_RMON_Port_Get(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Debug_RMON_Port_Get failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n", "nPortId", sVar.nPortId);
+ printf("\t%40s:\t%x\n", "ePortType", sVar.ePortType);
+ printf("\t%40s:\t%s\n", "RMON Counter BitMode","64");
+ printf("\n\n");
+ printf("\t%40s:\t%u\n","nRxGoodPkts",sVar.nRxGoodPkts);
+ printf("\t%40s:\t%u\n","nRxUnicastPkts",sVar.nRxUnicastPkts);
+ printf("\t%40s:\t%u\n","nRxBroadcastPkts",sVar.nRxBroadcastPkts);
+ printf("\t%40s:\t%u\n","nRxMulticastPkts",sVar.nRxMulticastPkts);
+ printf("\t%40s:\t%u\n","nRxFCSErrorPkts",sVar.nRxFCSErrorPkts);
+ printf("\t%40s:\t%u\n","nRxUnderSizeGoodPkts",sVar.nRxUnderSizeGoodPkts);
+ printf("\t%40s:\t%u\n","nRxOversizeGoodPkts",sVar.nRxOversizeGoodPkts);
+ printf("\t%40s:\t%u\n","nRxUnderSizeErrorPkts",sVar.nRxUnderSizeErrorPkts);
+ printf("\t%40s:\t%u\n","nRxOversizeErrorPkts",sVar.nRxOversizeErrorPkts);
+ printf("\t%40s:\t%u\n","nRxFilteredPkts",sVar.nRxFilteredPkts);
+ printf("\t%40s:\t%u\n","nRx64BytePkts",sVar.nRx64BytePkts);
+ printf("\t%40s:\t%u\n","nRx127BytePkts",sVar.nRx127BytePkts);
+ printf("\t%40s:\t%u\n","nRx255BytePkts",sVar.nRx255BytePkts);
+ printf("\t%40s:\t%u\n","nRx511BytePkts",sVar.nRx511BytePkts);
+ printf("\t%40s:\t%u\n","nRx1023BytePkts",sVar.nRx1023BytePkts);
+ printf("\t%40s:\t%u\n","nRxMaxBytePkts",sVar.nRxMaxBytePkts);
+ printf("\t%40s:\t%u\n","nRxDroppedPkts",sVar.nRxDroppedPkts);
+ printf("\t%40s:\t%u\n","nRxExtendedVlanDiscardPkts",sVar.nRxExtendedVlanDiscardPkts);
+ printf("\t%40s:\t%u\n","nMtuExceedDiscardPkts",sVar.nMtuExceedDiscardPkts);
+ printf("\t%40s:\t%llu 0x%llx\n","nRxGoodBytes",(unsigned long long)sVar.nRxGoodBytes,(unsigned long long)sVar.nRxGoodBytes);
+ printf("\t%40s:\t%llu 0x%llx\n","nRxBadBytes",(unsigned long long)sVar.nRxBadBytes,(unsigned long long)sVar.nRxBadBytes);
+
+ /*Valid only for GSWIP3.2*/
+ printf("\t%40s:\t%u\n","nRxUnicastPktsYellowRed",sVar.nRxUnicastPktsYellowRed);
+ printf("\t%40s:\t%u\n","nRxBroadcastPktsYellowRed",sVar.nRxBroadcastPktsYellowRed);
+ printf("\t%40s:\t%u\n","nRxMulticastPktsYellowRed",sVar.nRxMulticastPktsYellowRed);
+ printf("\t%40s:\t%u\n","nRxGoodPktsYellowRed",sVar.nRxGoodPktsYellowRed);
+ printf("\t%40s:\t%llu 0x%llx\n","nRxGoodBytesYellowRed",(unsigned long long)sVar.nRxGoodBytesYellowRed,(unsigned long long)sVar.nRxGoodBytesYellowRed);
+
+ printf("\n\n");
+ printf("\t%40s:\t%u\n","nTxGoodPkts",sVar.nTxGoodPkts);
+ printf("\t%40s:\t%u\n","nTxUnicastPkts",sVar.nTxUnicastPkts);
+ printf("\t%40s:\t%u\n","nTxBroadcastPkts",sVar.nTxBroadcastPkts);
+ printf("\t%40s:\t%u\n","nTxMulticastPkts",sVar.nTxMulticastPkts);
+ printf("\t%40s:\t%u\n","nTx64BytePkts",sVar.nTx64BytePkts);
+ printf("\t%40s:\t%u\n","nTx127BytePkts",sVar.nTx127BytePkts);
+ printf("\t%40s:\t%u\n","nTx255BytePkts",sVar.nTx255BytePkts);
+ printf("\t%40s:\t%u\n","nTx511BytePkts",sVar.nTx511BytePkts);
+ printf("\t%40s:\t%u\n","nTx1023BytePkts",sVar.nTx1023BytePkts);
+ printf("\t%40s:\t%u\n","nTxMaxBytePkts",sVar.nTxMaxBytePkts);
+ printf("\t%40s:\t%u\n","nTxDroppedPkts",sVar.nTxDroppedPkts);
+ printf("\t%40s:\t%u\n","nTxOversizeGoodPkts",sVar.nTxOversizeGoodPkts);
+ printf("\t%40s:\t%u\n","nTxUnderSizeGoodPkts",sVar.nTxUnderSizeGoodPkts);
+ printf("\t%40s:\t%u\n","nTxAcmDroppedPkts",sVar.nTxAcmDroppedPkts);
+ printf("\t%40s:\t%llu 0x%llx\n","nTxGoodBytes",(unsigned long long)sVar.nTxGoodBytes,(unsigned long long)sVar.nTxGoodBytes);
+
+ printf("\t%40s:\t%u\n","nTxUnicastPktsYellowRed",sVar.nTxUnicastPktsYellowRed);
+ printf("\t%40s:\t%u\n","nTxBroadcastPktsYellowRed",sVar.nTxBroadcastPktsYellowRed);
+ printf("\t%40s:\t%u\n","nTxMulticastPktsYellowRed",sVar.nTxMulticastPktsYellowRed);
+ printf("\t%40s:\t%u\n","nTxGoodPktsYellowRed",sVar.nTxGoodPktsYellowRed);
+ printf("\t%40s:\t%llu 0x%llx\n","nTxGoodBytesYellowRed",(unsigned long long)sVar.nTxGoodBytesYellowRed,(unsigned long long)sVar.nTxGoodBytesYellowRed);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_CPU_PortCfgGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_CPU_PortCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_CPU_PortCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PortCfgGet failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%s\n", "bCPU_PortValid", (param.bCPU_PortValid > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%s\n", "bSpecialTagIngress", (param.bSpecialTagIngress > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%s\n", "bSpecialTagEgress", (param.bSpecialTagEgress > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%s\n", "bFcsCheck", (param.bFcsCheck > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%s\n", "bFcsGenerate", (param.bFcsGenerate > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%d\n", "bSpecialTagEthType", param.bSpecialTagEthType);
+ printf("\t%40s:\t%s\n", "bTsPtp", (param.bTsPtp > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%s\n", "bTsNonptp", (param.bTsNonptp > 0) ? "TRUE" : "FALSE");
+ printf("\t%40s:\t%d\n", "eNoMPEParserCfg", param.eNoMPEParserCfg);
+ printf("\t%40s:\t%d\n", "eMPE1ParserCfg", param.eMPE1ParserCfg);
+ printf("\t%40s:\t%d\n", "eMPE2ParserCfg", param.eMPE2ParserCfg);
+ printf("\t%40s:\t%d\n", "eMPE1MPE2ParserCfg", param.eMPE1MPE2ParserCfg);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_CPU_PortCfgSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_CPU_PortCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ if (rret < 1){
+ printf("Parameter not Found: nPortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_CPU_PortCfgGet(gsw_dev, ¶m);
+ if (ret < 0)
+ {
+ printf("\t%40s:\t0x%x\n", "GSW_CPU_PortCfgGet failed with ret code", ret);
+ return ret;
+ }
+
+ scanParamArg(prmc, prmv,"bCPU_PortValid", sizeof(param.bCPU_PortValid), ¶m.bCPU_PortValid);
+ scanParamArg(prmc, prmv,"bSpecialTagIngress", sizeof(param.bSpecialTagIngress), ¶m.bSpecialTagIngress);
+ scanParamArg(prmc, prmv,"bSpecialTagEgress", sizeof(param.bSpecialTagEgress), ¶m.bSpecialTagEgress);
+ scanParamArg(prmc, prmv,"bFcsCheck", sizeof(param.bFcsCheck), ¶m.bFcsCheck);
+ scanParamArg(prmc, prmv,"bFcsGenerate", sizeof(param.bFcsGenerate), ¶m.bFcsGenerate);
+ scanParamArg(prmc, prmv,"bSpecialTagEthType", sizeof(param.bSpecialTagEthType), ¶m.bSpecialTagEthType);
+ scanParamArg(prmc, prmv,"bTsPtp", sizeof(param.bTsPtp), ¶m.bTsPtp);
+ scanParamArg(prmc, prmv,"bTsNonptp", sizeof(param.bTsNonptp), ¶m.bTsNonptp);
+
+ scanParamArg(prmc, prmv,"eNoMPEParserCfg", sizeof(param.eNoMPEParserCfg), ¶m.eNoMPEParserCfg);
+ scanParamArg(prmc, prmv,"eMPE1ParserCfg", sizeof(param.eMPE1ParserCfg), ¶m.eMPE1ParserCfg);
+ scanParamArg(prmc, prmv,"eMPE2ParserCfg", sizeof(param.eMPE2ParserCfg), ¶m.eMPE2ParserCfg);
+ scanParamArg(prmc, prmv,"eMPE1MPE2ParserCfg", sizeof(param.eMPE1MPE2ParserCfg), ¶m.eMPE1MPE2ParserCfg);
+
+ ret = GSW_CPU_PortCfgSet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_CPU_PortCfgSet failed with ret code", ret);
+ else{
+ printf("fapi_GSW_CPU_PortCfgSet done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_VlanCounterMapSet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_VlanCounterMapping_config_t sVar = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nCounterIndex", sizeof(sVar.nCounterIndex), &sVar.nCounterIndex);
+ if (rret < 1){
+ printf("Parameter not Found: nCounterIndex\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "nCtpPortId", sizeof(sVar.nCtpPortId), &sVar.nCtpPortId);
+ scanParamArg(prmc, prmv, "bPriorityEnable", sizeof(sVar.bPriorityEnable), &sVar.bPriorityEnable);
+ scanParamArg(prmc, prmv, "nPriorityVal", sizeof(sVar.nPriorityVal), &sVar.nPriorityVal);
+ scanParamArg(prmc, prmv, "bVidEnable", sizeof(sVar.bVidEnable), &sVar.bVidEnable);
+ scanParamArg(prmc, prmv, "nVidVal", sizeof(sVar.nVidVal), &sVar.nVidVal);
+ scanParamArg(prmc, prmv, "bVlanTagSelectionEnable", sizeof(sVar.bVlanTagSelectionEnable), &sVar.bVlanTagSelectionEnable);
+ scanParamArg(prmc, prmv, "eVlanCounterMappingType", sizeof(sVar.eVlanCounterMappingType), &sVar.eVlanCounterMappingType);
+ scanParamArg(prmc, prmv, "eVlanCounterMappingFilterType", sizeof(sVar.eVlanCounterMappingFilterType), &sVar.eVlanCounterMappingFilterType);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_VlanCounterMapSet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_VlanCounterMapSet failed with ret code", ret);
+ else{
+
+ printf("fapi_GSW_VlanCounterMapSet done\n");
+ }
+ return ret;
+}
+
+GSW_return_t fapi_GSW_VlanCounterMapGet(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_VlanCounterMapping_config_t sVar = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nCounterIndex", sizeof(sVar.nCounterIndex), &sVar.nCounterIndex);
+ if (rret < 1){
+ printf("Parameter not Found: nCounterIndex\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "eVlanCounterMappingType", sizeof(sVar.eVlanCounterMappingType), &sVar.eVlanCounterMappingType);
+ if (rret < 1){
+ printf("Parameter not Found: nCounterIndex\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_VlanCounterMapGet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_VlanCounterMapGet failed with ret code", ret);
+ else{
+ printf("\n\t nCounterIndex = %u", sVar.nCounterIndex);
+ printf("\n\t nCtpPortId = %u", sVar.nCtpPortId);
+ printf("\n\t bPriorityEnable = %u", sVar.bPriorityEnable);
+ printf("\n\t nPriorityVal = %u", sVar.nPriorityVal);
+ printf("\n\t bVidEnable = %u", sVar.bVidEnable);
+ printf("\n\t nVidVal = %u", sVar.nVidVal);
+ printf("\n\t bVlanTagSelectionEnable = %u", sVar.bVlanTagSelectionEnable);
+ printf("\n\t eVlanCounterMappingType = %u", sVar.eVlanCounterMappingType);
+ printf("\n\t eVlanCounterMappingFilterType = %u", sVar.eVlanCounterMappingFilterType);
+ printf("\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_Vlan_RMON_Get(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_VLAN_RMON_cnt_t sVar = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nVlanCounterIndex", sizeof(sVar.nVlanCounterIndex), &sVar.nVlanCounterIndex);
+ if (rret < 1){
+ printf("Parameter not Found: nVlanCounterIndex\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "eVlanRmonType", sizeof(sVar.eVlanRmonType), &sVar.eVlanRmonType);
+ if (rret < 1){
+ printf("Parameter not Found: eVlanRmonType\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_Vlan_RMON_Get(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Vlan_RMON_Get failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%u\n", "nByteCountHigh", (sVar.nByteCountHigh ) );
+ printf("\t%40s:\t%u\n", "nByteCountLow", (sVar.nByteCountLow ) );
+ printf("\t%40s:\t%u\n", "nTotalPktCount", (sVar.nTotalPktCount ) );
+ printf("\t%40s:\t%u\n", "nMulticastPktCount", (sVar.nMulticastPktCount) );
+ printf("\t%40s:\t%u\n", "nDropPktCount", (sVar.nDropPktCount ) );
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_Vlan_RMON_Clear(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_VLAN_RMON_cnt_t sVar = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nVlanCounterIndex", sizeof(sVar.nVlanCounterIndex), &sVar.nVlanCounterIndex);
+ if (rret < 1){
+ printf("Parameter not Found: nVlanCounterIndex\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "eVlanRmonType", sizeof(sVar.eVlanRmonType), &sVar.eVlanRmonType);
+ if (rret < 1){
+ printf("Parameter not Found: eVlanRmonType\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "eClearAll", sizeof(sVar.eVlanRmonType), &sVar.clear_all);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_Vlan_RMON_Clear(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Vlan_RMON_Clear failed with ret code", ret);
+ else{
+ printf("fapi_GSW_Vlan_RMON_Clear done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_Vlan_RMONControl_Set(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_VLAN_RMON_control_t sVar = {0};
+
+ scanParamArg(prmc, prmv, "bVlanRmonEnable", sizeof(sVar.bVlanRmonEnable), &sVar.bVlanRmonEnable);
+ scanParamArg(prmc, prmv, "bIncludeBroadCastPktCounting", sizeof(sVar.bIncludeBroadCastPktCounting), &sVar.bIncludeBroadCastPktCounting);
+ scanParamArg(prmc, prmv, "nVlanLastEntry", sizeof(sVar.nVlanLastEntry), &sVar.nVlanLastEntry);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_Vlan_RMONControl_Set(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Vlan_RMONControl_Set failed with ret code", ret);
+ else{
+ printf("fapi_GSW_Vlan_RMONControl_Set done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_Vlan_RMONControl_Get(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_VLAN_RMON_control_t sVar = {0};
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_Vlan_RMONControl_Get(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Vlan_RMONControl_Get failed with ret code", ret);
+ else{
+ printf("\n\t bVlanRmonEnable = %u", sVar.bVlanRmonEnable);
+ printf("\n\t bIncludeBroadCastPktCounting = %u", sVar.bIncludeBroadCastPktCounting);
+ printf("\n\t nVlanLastEntry = %u\n", sVar.nVlanLastEntry);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PBB_TunnelTempate_Config_Set(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_PBB_Tunnel_Template_Config_t sVar = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nTunnelTemplateId", sizeof(sVar.nTunnelTemplateId), &sVar.nTunnelTemplateId);
+ if (rret < 1){
+ printf("Parameter not Found: nTunnelTemplateId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "bIheaderDstMACEnable", sizeof(sVar.bIheaderDstMACEnable), &sVar.bIheaderDstMACEnable);
+ scanMAC_Arg(prmc, prmv, "nIheaderDstMAC", sVar.nIheaderDstMAC);
+ scanParamArg(prmc, prmv, "bIheaderSrcMACEnable", sizeof(sVar.bIheaderSrcMACEnable), &sVar.bIheaderSrcMACEnable);
+ scanMAC_Arg(prmc, prmv, "nIheaderSrcMAC", sVar.nIheaderSrcMAC);
+
+ scanParamArg(prmc, prmv, "bItagEnable", sizeof(sVar.bItagEnable), &sVar.bItagEnable);
+ scanParamArg(prmc, prmv, "bItagTpidEnable", sizeof(sVar.sItag.bTpidEnable), &sVar.sItag.bTpidEnable);
+ scanParamArg(prmc, prmv, "nItagTpid", sizeof(sVar.sItag.nTpid), &sVar.sItag.nTpid);
+ scanParamArg(prmc, prmv, "bItagPcpEnable", sizeof(sVar.sItag.bPcpEnable), &sVar.sItag.bPcpEnable);
+ scanParamArg(prmc, prmv, "nItagPcp", sizeof(sVar.sItag.nPcp), &sVar.sItag.nPcp);
+ scanParamArg(prmc, prmv, "bItagDeiEnable", sizeof(sVar.sItag.bDeiEnable), &sVar.sItag.bDeiEnable);
+ scanParamArg(prmc, prmv, "nItagDei", sizeof(sVar.sItag.nDei), &sVar.sItag.nDei);
+ scanParamArg(prmc, prmv, "bItagUacEnable", sizeof(sVar.sItag.bUacEnable), &sVar.sItag.bUacEnable);
+ scanParamArg(prmc, prmv, "nItagUac", sizeof(sVar.sItag.nUac), &sVar.sItag.nUac);
+ scanParamArg(prmc, prmv, "bItagResEnable", sizeof(sVar.sItag.bResEnable), &sVar.sItag.bResEnable);
+ scanParamArg(prmc, prmv, "nItagRes", sizeof(sVar.sItag.nRes), &sVar.sItag.nRes);
+ scanParamArg(prmc, prmv, "bItagSidEnable", sizeof(sVar.sItag.bSidEnable), &sVar.sItag.bSidEnable);
+ scanParamArg(prmc, prmv, "nItagSid", sizeof(sVar.sItag.nSid), &sVar.sItag.nSid);
+
+ scanParamArg(prmc, prmv, "bBtagEnable", sizeof(sVar.bBtagEnable), &sVar.bBtagEnable);
+ scanParamArg(prmc, prmv, "bBtagTpidEnable", sizeof(sVar.sBtag.bTpidEnable), &sVar.sBtag.bTpidEnable);
+ scanParamArg(prmc, prmv, "nBtagTpid", sizeof(sVar.sBtag.nTpid), &sVar.sBtag.nTpid);
+ scanParamArg(prmc, prmv, "bBtagPcpEnable", sizeof(sVar.sBtag.bPcpEnable), &sVar.sBtag.bPcpEnable);
+ scanParamArg(prmc, prmv, "nBtagPcp", sizeof(sVar.sBtag.nPcp), &sVar.sBtag.nPcp);
+ scanParamArg(prmc, prmv, "bBtagDeiEnable", sizeof(sVar.sBtag.bDeiEnable), &sVar.sBtag.bDeiEnable);
+ scanParamArg(prmc, prmv, "nBtagDei", sizeof(sVar.sBtag.nDei), &sVar.sBtag.nDei);
+ scanParamArg(prmc, prmv, "bBtagVidEnable", sizeof(sVar.sBtag.bVidEnable), &sVar.sBtag.bVidEnable);
+ scanParamArg(prmc, prmv, "nBtagVid", sizeof(sVar.sBtag.nVid), &sVar.sBtag.nVid);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PBB_TunnelTempate_Config_Set(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PBB_TunnelTempate_Config_Set failed with ret code", ret);
+ else{
+ printf("fapi_GSW_PBB_TunnelTempate_Config_Set done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PBB_TunnelTempate_Config_Get(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_PBB_Tunnel_Template_Config_t sVar = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nTunnelTemplateId", sizeof(sVar.nTunnelTemplateId), &sVar.nTunnelTemplateId);
+ if (rret < 1){
+ printf("Parameter not Found: nTunnelTemplateId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PBB_TunnelTempate_Config_Get(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PBB_TunnelTempate_Config_Get failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%u\n", "nTunnelTemplateId", sVar.nTunnelTemplateId);
+ printf("\n\t nTunnelTemplateId = %u", sVar.nTunnelTemplateId);
+ printf("\n\t nIheaderDstMAC =");
+ printMAC_Address(sVar.nIheaderDstMAC);
+ printf("\n\t nIheaderSrcMAC =");
+ printMAC_Address(sVar.nIheaderSrcMAC);
+ printf("\n");
+ printf("\t%40s:\t%x\n", "nItagTpid", sVar.sItag.nTpid);
+ printf("\t%40s:\t%u\n", "nItagPcp", sVar.sItag.nPcp);
+ printf("\t%40s:\t%u\n", "nItagDei", sVar.sItag.nDei);
+ printf("\t%40s:\t%u\n", "nItagUac", sVar.sItag.nUac);
+ printf("\t%40s:\t%u\n", "nItagRes",sVar.sItag.nRes);
+ printf("\t%40s:\t%u\n", "nItagSid", sVar.sItag.nSid);
+ printf("\t%40s:\t%x\n", "nBtagTpid", sVar.sBtag.nTpid);
+ printf("\t%40s:\t%u\n", "nBtagPcp", sVar.sBtag.nPcp);
+ printf("\t%40s:\t%u\n", "nBtagDei", sVar.sBtag.nDei);
+ printf("\t%40s:\t%u\n", "nBtagVid", sVar.sBtag.nVid);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PBB_TunnelTempate_Free(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_PBB_Tunnel_Template_Config_t sVar = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nTunnelTemplateId", sizeof(sVar.nTunnelTemplateId), &sVar.nTunnelTemplateId);
+ if (rret < 1){
+ printf("Parameter not Found: nTunnelTemplateId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PBB_TunnelTempate_Free(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PBB_TunnelTempate_Free failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n", "Freed nTunnelTemplateId", sVar.nTunnelTemplateId);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PBB_TunnelTempate_Alloc(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_PBB_Tunnel_Template_Config_t sVar = {0};
+ int rret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PBB_TunnelTempate_Alloc(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PBB_TunnelTempate_Alloc failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n", "Allocated nTunnelTemplateId", sVar.nTunnelTemplateId);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_RMON_FlowGet(int prmc, char *prmv[])
+{
+ GSW_RMON_flowGet_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ scanParamArg(prmc, prmv,"bIndex", sizeof(param.bIndex), ¶m.bIndex);
+ scanParamArg(prmc, prmv,"nIndex", sizeof(param.nIndex), ¶m.nIndex);
+ scanParamArg(prmc, prmv,"nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ scanParamArg(prmc, prmv,"nFlowId", sizeof(param.nFlowId), ¶m.nFlowId);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_RMON_FlowGet(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_RMON_FlowGet failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n", "nIndex", param.nIndex);
+ printf("\t%40s:\t%x\n", "nRxPkts", param.nRxPkts);
+ printf("\t%40s:\t%x\n", "nTxPkts", param.nTxPkts);
+ printf("\t%40s:\t%x\n", "nTxPceBypassPkts", param.nTxPceBypassPkts);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_RMON_MeterGet(int prmc, char *prmv[])
+{
+ GSW_RMON_Meter_cnt_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ scanParamArg(prmc, prmv,"nMeterId", sizeof(param.nMeterId), ¶m.nMeterId);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_RMON_Meter_Get(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_RMON_Meter_Get failed with ret code", ret);
+ else{
+ printf("\t%40s:\t%x\n", "nMeterId", param.nMeterId);
+ printf("\t%40s:\t%x\n", "nGreenCount", param.nGreenCount);
+ printf("\t%40s:\t%x\n", "nYellowCount", param.nYellowCount);
+ printf("\t%40s:\t%x\n", "nRedCount", param.nRedCount);
+ printf("\t%40s:\t%x\n", "nResCount", param.nResCount);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_RMON_TFlowClear(int prmc, char *prmv[])
+{
+ GSW_RMON_flowGet_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ scanParamArg(prmc, prmv,"bIndex", sizeof(param.bIndex), ¶m.bIndex);
+ scanParamArg(prmc, prmv,"nIndex", sizeof(param.nIndex), ¶m.nIndex);
+ scanParamArg(prmc, prmv,"nPortId", sizeof(param.nPortId), ¶m.nPortId);
+ scanParamArg(prmc, prmv,"nFlowId", sizeof(param.nFlowId), ¶m.nFlowId);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_RmonTflowClear(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_RMON_TFlowClear failed with ret code", ret);
+ else{
+ printf("\t%40s\n","fapi_GSW_RMON_TFlowClear done");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_BridgePortFree(int prmc, char *prmv[])
+{
+ GSW_BRIDGE_portAlloc_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ int rret;
+
+ rret = scanParamArg(prmc, prmv,"nBridgePortId", sizeof(param.nBridgePortId), ¶m.nBridgePortId);
+ if (rret < 1){
+ printf("Parameter not Found: nBridgePortId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_BridgePortFree(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_BridgePortFree failed with ret code", ret);
+ else{
+ printf("\t%40s\n","fapi_GSW_BridgePortFree done");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_BridgePortAlloc(int prmc, char *prmv[])
+{
+ GSW_BRIDGE_portAlloc_t param = {0};
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_BridgePortAlloc(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_BridgePortAlloc failed with ret code", ret);
+ else{
+ printf("\n\tAllocated nBridgePortId = %u\n", param.nBridgePortId);
+ }
+
+ return ret;
+}
+
+
+GSW_return_t fapi_GSW_Freeze(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_Freeze(gsw_dev);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_Freeze failed with ret code", ret);
+ else{
+ printf("\t%40s\n","fapi_GSW_Freeze done");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_UnFreeze(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_UnFreeze(gsw_dev);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_UnFreeze failed with ret code", ret);
+ else{
+ printf("\t%40s\n","fapi_GSW_UnFreeze done");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_MeterAlloc(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_meterCfg_t param = {0};
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QOS_MeterAlloc(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_MeterAlloc failed with ret code", ret);
+ else{
+ printf("\n\tAllocated nMeterId = %u\n", param.nMeterId);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_QoS_MeterFree(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_QoS_meterCfg_t param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nMeterId", sizeof(param.nMeterId), ¶m.nMeterId);
+ if (rret < 1){
+ printf("Parameter not Found: nMeterId\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_QOS_MeterFree(gsw_dev, ¶m);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_QoS_MeterFree failed with ret code", ret);
+ else{
+ printf("fapi_GSW_QoS_MeterFree done\n");
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_PMAC_RMON_Get(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret;
+ GSW_PMAC_Cnt_t sVar = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "nPmacId", sizeof(sVar.nPmacId), &sVar.nPmacId);
+ if (rret < 1){
+ printf("Parameter not Found: nPmacId\n");
+ return OS_ERROR;
+ }
+
+ scanParamArg(prmc, prmv, "nPortId", sizeof(sVar.nTxDmaChanId), &sVar.nTxDmaChanId);
+ scanParamArg(prmc, prmv, "b64BitMode", sizeof(sVar.b64BitMode), &sVar.b64BitMode);
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = GSW_PMAC_CountGet(gsw_dev, &sVar);
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_GSW_PMAC_RMON_Get failed with ret code", ret);
+ else{
+ printf("\t nPmacId = %u\n\n", sVar.nPmacId);
+ printf("\t nPortId = %u\n", sVar.nTxDmaChanId);
+ printf("\t Egress Total Packet Count = %u\n", sVar.nEgressPktsCount);
+ printf("\t Egress Total Byte Count = %u\n", sVar.nEgressBytesCount);
+ printf("\t Egress Checksum Error Packet Count = %u\n", sVar.nChkSumErrPktsCount);
+ printf("\t Egress Checksum Error Byte Count = %u\n", sVar.nChkSumErrBytesCount);
+ printf("\t Egress Header Packet Count = %u\n", sVar.nEgressHdrPktsCount);
+ printf("\t Egress Header Byte Count = %u\n", sVar.nEgressHdrBytesCount);
+ printf("\t Egress Header Discard Packet Count = %u\n", sVar.nEgressHdrDiscPktsCount);
+ printf("\t Egress Header Discard Byte Count = %u\n\n", sVar.nEgressHdrDiscBytesCount);
+ printf("\t DMA TxCh = %u\n", sVar.nTxDmaChanId);
+ printf("\t Ingress Total Packet Count = %u\n", sVar.nIngressPktsCount);
+ printf("\t Ingress Total Byte Count = %u\n", sVar.nIngressBytesCount);
+ printf("\t Ingress Discard Packet Count = %u\n", sVar.nDiscPktsCount);
+ printf("\t Ingress Discard Byte Count = %u\n", sVar.nDiscBytesCount);
+ printf("\t Ingress Header Packet Count = %u\n", sVar.nIngressHdrPktsCount);
+ printf("\t Ingress Header Byte Count = %u\n", sVar.nIngressHdrBytesCount);
+ }
+
+ return ret;
+}
+
+GSW_return_t fapi_GSW_Debug_PMAC_RMON_Get_All(int prmc, char *prmv[])
+{
+ GSW_PMAC_Cnt_t *eg, *ig;
+ u32 i = 0;
+ u32 start = 0, end = 16;
+ u32 max_read = 0;
+ u8 pmacId = 0;
+ GSW_Device_t *gsw_dev;
+ GSW_return_t ret = 0;
+
+ scanParamArg(prmc, prmv, "nPmacId", sizeof(pmacId), &pmacId);
+ scanParamArg(prmc, prmv, "Start", sizeof(start), &start);
+ scanParamArg(prmc, prmv, "End", sizeof(end), &end);
+
+ max_read = end - start;
+ if (max_read > 16 || end > 16) {
+ printf("Display only 16 ports, please check start and end\n");
+ return -1;
+ }
+
+ eg = malloc(sizeof(*eg)*max_read);
+ if (!eg) {
+ printf("\n\tERROR: failed in buffer allocation\n");
+ return -ENOMEM;
+ }
+
+ ig = eg;
+
+ printf("\n");
+ printf("Reading PmacId %d: %s\n", pmacId, "Egress");
+ printf("Reading PmacId %d: %s\n", pmacId, "Ingress");
+ gsw_dev = gsw_get_struc(lif_id,0);
+
+ for (i = 0; i < max_read; i++) {
+ eg[i].nPmacId = pmacId;
+ eg[i].nTxDmaChanId = start + i;
+
+ ret = GSW_PMAC_CountGet(gsw_dev, &eg[i]);
+ if (ret < 0)
+ {
+ free (eg);
+ printf("\t%40s:\t0x%x\n", "GSW_PMAC_CountGet failed with ret code", ret);
+ return ret;
+ }
+ }
+
+ printf("\n");
+ printf("Rx Logical Port : ");
+ for (i = start; i < end; i++)
+ printf("%11u", i);
+
+ printf("\n");
+ printf("\n");
+ printf("Egress Checksum Error Packet Count : ");
+
+ for (i = 0; i < max_read; i++)
+ printf("%11u", eg[i].nChkSumErrPktsCount);
+
+ printf("\n");
+ printf("Egress Checksum Error Byte Count : ");
+
+ for (i = 0; i < max_read; i++)
+ printf("%11u", eg[i].nChkSumErrBytesCount);
+
+ printf("\n");
+ printf("Egress Total Packet Count : ");
+
+ for (i = 0; i < max_read; i++)
+ printf("%11u", eg[i].nEgressPktsCount);
+
+ printf("\n");
+ printf("Egress Total Byte Count : ");
+
+ for (i = 0; i < max_read; i++)
+ printf("%11u", eg[i].nEgressBytesCount);
+
+ printf("\n");
+ printf("\n");
+ printf("\n");
+
+ printf("DMA TxCh : ");
+ for (i = start; i < end; i++)
+ printf("%11u", i);
+
+ printf("\n");
+ printf("\n");
+
+ printf("Ingress Discard Packet Count : ");
+
+ for (i = 0; i < max_read; i++)
+ printf("%11u", ig[i].nDiscPktsCount);
+
+ printf("\n");
+ printf("Ingress Discard Byte Count : ");
+
+ for (i = 0; i < max_read; i++)
+ printf("%11u", ig[i].nDiscBytesCount);
+
+ printf("\n");
+ printf("Ingress Total Packet Count : ");
+
+ for (i = 0; i < max_read; i++)
+ printf("%11u", ig[i].nIngressPktsCount);
+
+ printf("\n");
+ printf("Ingress Total Byte Count : ");
+
+ for (i = 0; i < max_read; i++)
+ printf("%11u", ig[i].nIngressBytesCount);
+ printf("\n");
+ free(eg);
+
+ return ret;
+}
diff --git a/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi.h b/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi.h
new file mode 100644
index 0000000..f17c90b
--- /dev/null
+++ b/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi.h
@@ -0,0 +1,156 @@
+#ifndef _FAPI_GSW_HOST_H_
+
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+#include <mmd_apis.h>
+
+GSW_return_t fapi_GSW_RegisterGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_RegisterSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PortLinkCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PortLinkCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_RMON_Clear(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MonitorPortCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MonitorPortCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_PortCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_PortCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_DSCP_ClassGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_DSCP_ClassSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_PCP_ClassGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_PCP_ClassSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_SVLAN_PCP_ClassGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_SVLAN_PCP_ClassSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_ShaperCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_ShaperCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_ShaperQueueDeassign(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_ShaperQueueAssign(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_ShaperQueueGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_SchedulerCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_SchedulerCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_WredCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_WredCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_WredQueueCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_WredQueueCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_WredPortCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_WredPortCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_TrunkingCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_TrunkingCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MAC_TableClear(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_CfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_CfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MAC_TableEntryRemove(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MAC_TableEntryQuery(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_FlowctrlCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_FlowctrlCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_FlowctrlPortCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_FlowctrlPortCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MAC_TableEntryAdd(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MAC_TableEntryRead(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_QueuePortSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_QueuePortGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_CPU_PortCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_CPU_PortCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_BridgePortConfigGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_BridgePortConfigSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_CtpPortConfigGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_CtpPortConfigSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_BridgeAlloc(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_BridgeFree(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_BridgeConfigSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_BridgeConfigGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_ExtendedVlanAlloc(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_ExtendedVlanFree(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_ExtendedVlanSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_ExtendedVlanGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_VlanFilterFree(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_VlanFilterAlloc(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_VlanFilterSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_VlanFilterGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_STP_PortCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_STP_PortCfgGet(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_STP_BPDU_RuleSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_STP_BPDU_RuleGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_RegisterMod(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_Debug_RMON_Port_Get(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_QoS_MeterCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_MeterCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MAC_DefaultFilterGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MAC_DefaultFilterSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_CTP_PortAssignmentGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_CTP_PortAssignmentSet(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_PMAC_GLBL_CfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PMAC_GLBL_CfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PMAC_BM_CfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PMAC_BM_CfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PMAC_EG_CfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PMAC_EG_CfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PMAC_IG_CfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PMAC_IG_CfgSet(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_PceRuleRead(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PceRuleWrite(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PceRuleDelete(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PceRuleAlloc(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PceRuleFree(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PceRuleEnable(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PceRuleDisable(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_MulticastRouterPortAdd(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MulticastRouterPortRemove(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MulticastSnoopCfgGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MulticastSnoopCfgSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MulticastRouterPortRead(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MulticastTableEntryAdd(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MulticastTableEntryRead(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_MulticastTableEntryRemove(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_FW_Update(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_FW_Version(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PVT_Meas(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_Delay(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_GPIO_Configure(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_Reboot(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_SysReg_Rd(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_MAC_TableCondClear(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_VlanCounterMapSet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_VlanCounterMapGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_Vlan_RMON_Get(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_Vlan_RMON_Clear(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_Vlan_RMONControl_Set(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_Vlan_RMONControl_Get(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_PBB_TunnelTempate_Config_Set(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PBB_TunnelTempate_Config_Get(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PBB_TunnelTempate_Alloc(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_PBB_TunnelTempate_Free(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_RMON_MeterGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_RMON_FlowGet(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_RMON_TFlowClear(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_BridgePortAlloc(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_BridgePortFree(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_Freeze(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_UnFreeze(int prmc, char *prmv[]);
+
+// GSW_return_t fapi_GSW_DEBUG_RMON_Port_Get_All(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_MeterFree(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_QoS_MeterAlloc(int prmc, char *prmv[]);
+
+GSW_return_t fapi_GSW_PMAC_RMON_Get(int prmc, char *prmv[]);
+GSW_return_t fapi_GSW_Debug_PMAC_RMON_Get_All(int prmc, char *prmv[]);
+
+#endif /* _FAPI_GSW_HOST_H_ */
diff --git a/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi_mdio_relay.c b/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi_mdio_relay.c
new file mode 100644
index 0000000..f05727f
--- /dev/null
+++ b/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi_mdio_relay.c
@@ -0,0 +1,280 @@
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+#include <os_types.h>
+#include <gsw_device.h>
+#include <host_adapt.h>
+#include <mdio_relay.h>
+#include <gsw_cli_common.h>
+
+#define lif_id 0
+#define NUM_TC 16
+#define MAX_NUM_OF_DISPLAY_PORTS 2
+
+
+/* read internal GPHY MDIO/MMD registers */
+int fapi_int_gphy_read(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ int ret;
+ struct mdio_relay_data param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "phy", sizeof(param.phy), ¶m.phy);
+ if (rret < 1){
+ printf("parameter not Found: phy\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "mmd", sizeof(param.mmd), ¶m.mmd);
+ if (rret < 1){
+ printf("parameter not Found: mmd\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "reg", sizeof(param.reg), ¶m.reg);
+ if (rret < 1){
+ printf("parameter not Found: reg\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = int_gphy_read(gsw_dev, ¶m);
+
+
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_int_gphy_read failed with ret code", ret);
+ else
+ printf("fapi_int_gphy_read:\tphy=0x%x mmd=0x%x reg=0x%x ret=0x%x\n",param.reg,param.mmd,param.reg,param.data);
+ return 0;
+
+}
+
+/* write internal GPHY MDIO/MMD registers */
+int fapi_int_gphy_write(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ int ret;
+ struct mdio_relay_data param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "phy", sizeof(param.phy), ¶m.phy);
+ if (rret < 1){
+ printf("parameter not Found: phy\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "mmd", sizeof(param.mmd), ¶m.mmd);
+ if (rret < 1){
+ printf("parameter not Found: mmd\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "reg", sizeof(param.reg), ¶m.reg);
+ if (rret < 1){
+ printf("parameter not Found: reg\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "data", sizeof(param.data), ¶m.data);
+ if (rret < 1){
+ printf("parameter not Found: data\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = int_gphy_write(gsw_dev, ¶m);
+
+
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_int_gphy_write failed with ret code", ret);
+ else
+ printf("fapi_int_gphy_write:\tphy=0x%x mmd=0x%x reg=0x%x data=0x%x\n",param.reg,param.mmd,param.reg,param.data);
+ return 0;
+
+}
+
+// /* modify internal GPHY MDIO/MMD registers */
+int fapi_int_gphy_mod(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ int ret;
+ struct mdio_relay_mod_data param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "phy", sizeof(param.phy), ¶m.phy);
+ if (rret < 1){
+ printf("parameter not Found: phy\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "mmd", sizeof(param.mmd), ¶m.mmd);
+ if (rret < 1){
+ printf("parameter not Found: mmd\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "reg", sizeof(param.reg), ¶m.reg);
+ if (rret < 1){
+ printf("parameter not Found: reg\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "data", sizeof(param.data), ¶m.data);
+ if (rret < 1){
+ printf("parameter not Found: data\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "mask", sizeof(param.mask), ¶m.mask);
+ if (rret < 1){
+ printf("parameter not Found: mask\n");
+ return OS_ERROR;
+ }
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = int_gphy_mod(gsw_dev, ¶m);
+
+
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_int_gphy_mod failed with ret code", ret);
+ else
+ printf("fapi_int_gphy_mod:\tphy=0x%x mmd=0x%x reg=0x%x data=0x%x mask=0x%x\n",param.reg,param.mmd,param.reg,param.data, param.mask);
+ return 0;
+
+}
+
+/* read external GPHY MDIO/MMD registers via MDIO bus */
+int fapi_ext_mdio_read(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ int ret;
+ struct mdio_relay_data param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "phy", sizeof(param.phy), ¶m.phy);
+ if (rret < 1){
+ printf("parameter not Found: phy\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "mmd", sizeof(param.mmd), ¶m.mmd);
+ if (rret < 1){
+ printf("parameter not Found: mmd\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "reg", sizeof(param.reg), ¶m.reg);
+ if (rret < 1){
+ printf("parameter not Found: reg\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = ext_mdio_read(gsw_dev, ¶m);
+
+
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_ext_mdio_read failed with ret code", ret);
+ else
+ printf("fapi_ext_mdio_read:\tphy=0x%x mmd=0x%x reg=0x%x ret=0x%x\n",param.reg,param.mmd,param.reg,param.data);
+ return 0;
+
+}
+/* write external GPHY MDIO/MMD registers via MDIO bus */
+int fapi_ext_mdio_write(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ int ret;
+ struct mdio_relay_data param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "phy", sizeof(param.phy), ¶m.phy);
+ if (rret < 1){
+ printf("parameter not Found: phy\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "mmd", sizeof(param.mmd), ¶m.mmd);
+ if (rret < 1){
+ printf("parameter not Found: mmd\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "reg", sizeof(param.reg), ¶m.reg);
+ if (rret < 1){
+ printf("parameter not Found: reg\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "data", sizeof(param.data), ¶m.data);
+ if (rret < 1){
+ printf("parameter not Found: data\n");
+ return OS_ERROR;
+ }
+
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = ext_mdio_write(gsw_dev, ¶m);
+
+
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_ext_mdio_write failed with ret code", ret);
+ else
+ printf("fapi_ext_mdio_write:\tphy=0x%x mmd=0x%x reg=0x%x data=0x%x\n",param.reg,param.mmd,param.reg,param.data);
+ return 0;
+
+}
+/* modify external GPHY MDIO/MMD registers via MDIO bus */
+int fapi_ext_mdio_mod(int prmc, char *prmv[])
+{
+ GSW_Device_t *gsw_dev;
+ int ret;
+ struct mdio_relay_mod_data param = {0};
+ int rret;
+
+ rret = scanParamArg(prmc, prmv, "phy", sizeof(param.phy), ¶m.phy);
+ if (rret < 1){
+ printf("parameter not Found: phy\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "mmd", sizeof(param.mmd), ¶m.mmd);
+ if (rret < 1){
+ printf("parameter not Found: mmd\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "reg", sizeof(param.reg), ¶m.reg);
+ if (rret < 1){
+ printf("parameter not Found: reg\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "data", sizeof(param.data), ¶m.data);
+ if (rret < 1){
+ printf("parameter not Found: data\n");
+ return OS_ERROR;
+ }
+
+ rret = scanParamArg(prmc, prmv, "mask", sizeof(param.mask), ¶m.mask);
+ if (rret < 1){
+ printf("parameter not Found: mask\n");
+ return OS_ERROR;
+ }
+ gsw_dev = gsw_get_struc(lif_id,0);
+ ret = ext_mdio_mod(gsw_dev, ¶m);
+
+
+ if (ret < 0)
+ printf("\t%40s:\t0x%x\n", "fapi_ext_mdio_mod failed with ret code", ret);
+ else
+ printf("fapi_ext_mdio_mod:\tphy=0x%x mmd=0x%x reg=0x%x data=0x%x mask=0x%x\n",param.reg,param.mmd,param.reg,param.data, param.mask);
+ return 0;
+
+}
\ No newline at end of file
diff --git a/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi_mdio_relay.h b/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi_mdio_relay.h
new file mode 100644
index 0000000..fe72970
--- /dev/null
+++ b/feed/app/ethswbox/src/example/fapi/fapi_gsw_hostapi_mdio_relay.h
@@ -0,0 +1,28 @@
+#ifndef _FAPI_GPY_HOST_H_
+
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+#include <mmd_apis.h>
+
+int fapi_int_gphy_read(int prmc, char *prmv[]);
+/* write internal GPHY MDIO/MMD registers */
+int fapi_int_gphy_write(int prmc, char *prmv[]);
+/* modify internal GPHY MDIO/MMD registers */
+int fapi_int_gphy_mod(int prmc, char *prmv[]);
+
+/* read external GPHY MDIO/MMD registers via MDIO bus */
+int fapi_ext_mdio_read(int prmc, char *prmv[]);
+/* write external GPHY MDIO/MMD registers via MDIO bus */
+int fapi_ext_mdio_write(int prmc, char *prmv[]);
+/* modify external GPHY MDIO/MMD registers via MDIO bus */
+int fapi_ext_mdio_mod(int prmc, char *prmv[]);
+
+#endif /* _FAPI_GPY_HOST_H_ */
diff --git a/feed/app/ethswbox/src/example/os/os_types.h b/feed/app/ethswbox/src/example/os/os_types.h
new file mode 100644
index 0000000..72b9e9e
--- /dev/null
+++ b/feed/app/ethswbox/src/example/os/os_types.h
@@ -0,0 +1,60 @@
+#ifndef _OS_TYPES_H
+#define _OS_TYPES_H
+/******************************************************************************
+
+ Copyright 2022 Maxlinear
+
+ SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+******************************************************************************/
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* ============================= */
+/* Includes */
+/* ============================= */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+
+/** A type for handling boolean issues. */
+typedef enum {
+ /** false */
+ OS_FALSE = 0,
+ /** true */
+ OS_TRUE = 1
+} OS_boolean_t;
+
+
+/**
+ This type is used for parameters that should enable
+ and disable a dedicated feature. */
+typedef enum {
+ /** disable */
+ OS_DISABLE = 0,
+ /** enable */
+ OS_ENABLE = 1
+} OS_enDis_t;
+
+/**
+ This type has two states, success and error
+*/
+typedef enum {
+ /** operation failed */
+ OS_ERROR = (-1),
+ /** operation succeeded */
+ OS_SUCCESS = 0
+} OS_return_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OS_TYPES_H */
diff --git a/feed/app/ethswbox/src/switch_hostapi/CHANGELOG b/feed/app/ethswbox/src/switch_hostapi/CHANGELOG
new file mode 100644
index 0000000..1e03a87
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/CHANGELOG
@@ -0,0 +1,54 @@
+--------------------------------------------------------------------------------
+version 1.2.0.0 | 2024-03-01 | General Availability (GA) release
+--------------------------------------------------------------------------------
+Tested with firmware:
+ Mcuboot Version: 1.1.21
+ WSP Kernel Version: 1.1.36
+ WSP App Version: 1.1.35
+ Gphy Version: 0032
+
+Known Issues
+------------
+- F48X_SW-1267: GSW_QoS_PortCfgGet didn't get the correct eClassMode state.
+- F48X_SW-1265: GSW_MulticastRouterPortAdd didn't work.
+- F48X_SW-1260: Unable to swap MAC DA/SA in ingress or egress packets.
+- F48X_SW-1259: Extended VLAN eRemoveTagAction failed to remove the VLAN tag of packet.
+- F48X_SW-1209: Cannot enable reference clock by API.
+- F48X_SW-1109: Rate metering doesn't work against unknown unicast packets if flow control is enabled on the receiving port.
+- F48X_SW-958: Cannot enable special tag function by API.
+- F48X_SW-897: Cannot change Ethernet SerDes interfaces by API.
+- F48X_SW-614: SFP1 Bridge RMON TX counter is incorrect if sending increment/random frame size packets.
+
+--------------------------------------------------------------------------------
+version 1.1.0.0 | 2024-01-18 | Engineering release
+--------------------------------------------------------------------------------
+Mcuboot Version: 1.0.20
+WSP Kernel Version: 1.0.34
+WSP App Version: 1.0.34
+Gphy Version: 0032
+
+Known Issues
+------------
+- F48X_SW-1170: User cannot control GPIO40 and GPIO43 by API.
+- F48X_SW-1128: Binding a rate shaper to one queue will also limit the speed of other queues.
+- F48X_SW-1127: 10BT/100BT half-duplex: short packets exceeding 98% utilization will be dropped.
+- F48X_SW-1111: PCP functions only take effect on QinQ packets.
+- F48X_SW-1110: The first added static MAC entry cannot be queried.
+- F48X_SW-1109: Rate metering doesn't work against unknown unicast packets if flow control is enabled on the receiving port.
+- F48X_SW-1106: The I2C SCL frequency is 107kHz instead of the 100kHz specified in the datasheet.
+- F48X_SW-614: SFP1 Bridge RMON TX counter is incorrect if sending increment/random frame size packets.
+
+--------------------------------------------------------------------------------
+version 1.0.0.0 | 2023-09-28 | Engineering release
+--------------------------------------------------------------------------------
+CHG Requires MxL862xx firmware image: unsigned-unmanaged-V1.0.0.2
+CHG Removed development variant of typedef struct GSW_Device_t.
+FIX Fixed issues reported by static code analysis tool.
+
+--------------------------------------------------------------------------------
+version 0.0.0.1 | 2023-09-20 | Initial release - Engineering drop quality
+--------------------------------------------------------------------------------
+
+NEW Requires MxL862xx firmware image: unsigned-unmanaged-V1.0.0.1
+ Firmware image in .hex and .bin format is located in folder "firmware".
+
diff --git a/feed/app/ethswbox/src/switch_hostapi/LICENSE b/feed/app/ethswbox/src/switch_hostapi/LICENSE
new file mode 100644
index 0000000..b43bfaa
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/LICENSE
@@ -0,0 +1,367 @@
+This source code is distributed under a dual license of GPL and BSD (2-clause).
+Please choose the appropriate license for your intended usage.
+
+1. BSD license (2-clause BSD license)
+
+Copyright (c) 2020, MaxLinear, Inc.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+2. GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/feed/app/ethswbox/src/switch_hostapi/doc/GPY_GSW_APIs.pdf b/feed/app/ethswbox/src/switch_hostapi/doc/GPY_GSW_APIs.pdf
new file mode 100644
index 0000000..3fb9bcf
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/doc/GPY_GSW_APIs.pdf
Binary files differ
diff --git a/feed/app/ethswbox/src/switch_hostapi/doc/MaxLinear-logo.png b/feed/app/ethswbox/src/switch_hostapi/doc/MaxLinear-logo.png
new file mode 100644
index 0000000..3f543a4
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/doc/MaxLinear-logo.png
Binary files differ
diff --git a/feed/app/ethswbox/src/switch_hostapi/doc/doxygen.cfg b/feed/app/ethswbox/src/switch_hostapi/doc/doxygen.cfg
new file mode 100644
index 0000000..c6119d7
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/doc/doxygen.cfg
@@ -0,0 +1,353 @@
+# Doxyfile 1.8.13
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = "MxL862xx Switch Host API"
+PROJECT_NUMBER =
+PROJECT_BRIEF =
+PROJECT_LOGO = MaxLinear-logo.png
+OUTPUT_DIRECTORY =
+CREATE_SUBDIRS = NO
+ALLOW_UNICODE_NAMES = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = YES
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 4
+ALIASES =
+TCL_SUBST =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+OPTIMIZE_FOR_FORTRAN = NO
+OPTIMIZE_OUTPUT_VHDL = NO
+EXTENSION_MAPPING =
+MARKDOWN_SUPPORT = YES
+TOC_INCLUDE_HEADINGS = 0
+AUTOLINK_SUPPORT = YES
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+SIP_SUPPORT = NO
+IDL_PROPERTY_SUPPORT = YES
+DISTRIBUTE_GROUP_DOC = NO
+GROUP_NESTED_COMPOUNDS = NO
+SUBGROUPING = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS = NO
+TYPEDEF_HIDES_STRUCT = NO
+LOOKUP_CACHE_SIZE = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_PACKAGE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+HIDE_COMPOUND_REFERENCE= NO
+SHOW_INCLUDE_FILES = YES
+SHOW_GROUPED_MEMB_INC = NO
+FORCE_LOCAL_INCLUDES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES = NO
+SORT_BY_SCOPE_NAME = NO
+STRICT_PROTO_MATCHING = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_FILES = YES
+SHOW_NAMESPACES = YES
+FILE_VERSION_FILTER =
+LAYOUT_FILE =
+CITE_BIB_FILES =
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_AS_ERROR = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = ../include/gswip/gsw.h \
+ ../include/gswip/gsw_api.h \
+ ../include/gswip/gsw_ctp.h \
+ ../include/gswip/gsw_flow.h \
+ ../include/gswip/gsw_pmac.h \
+ ../include/gswip/gsw_rmon.h \
+ ../include/gswip/gsw_types.h \
+ ../include/gswip/mdio_relay.h
+
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++
+RECURSIVE = NO
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE =
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = YES
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = NO
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+CLANG_ASSISTED_PARSING = NO
+CLANG_OPTIONS =
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_FILES =
+HTML_COLORSTYLE_HUE = 220
+HTML_COLORSTYLE_SAT = 100
+HTML_COLORSTYLE_GAMMA = 80
+HTML_TIMESTAMP = NO
+HTML_DYNAMIC_SECTIONS = NO
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET = NO
+DOCSET_FEEDNAME = "Doxygen generated docs"
+DOCSET_BUNDLE_ID = com.maxlinear.mxl862xx.switch_host_api
+DOCSET_PUBLISHER_ID = com.maxlinear
+DOCSET_PUBLISHER_NAME = MaxLinear
+GENERATE_HTMLHELP = YES
+CHM_FILE = switch_api.chm
+HHC_LOCATION =
+GENERATE_CHI = NO
+CHM_INDEX_ENCODING =
+BINARY_TOC = NO
+TOC_EXPAND = NO
+GENERATE_QHP = NO
+QCH_FILE =
+QHP_NAMESPACE = org.doxygen.Project
+QHP_VIRTUAL_FOLDER = doc
+QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
+QHG_LOCATION =
+GENERATE_ECLIPSEHELP = NO
+ECLIPSE_DOC_ID = org.doxygen.Project
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = NO
+ENUM_VALUES_PER_LINE = 4
+TREEVIEW_WIDTH = 250
+EXT_LINKS_IN_WINDOW = NO
+FORMULA_FONTSIZE = 10
+FORMULA_TRANSPARENT = YES
+USE_MATHJAX = NO
+MATHJAX_FORMAT = HTML-CSS
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS =
+MATHJAX_CODEFILE =
+SEARCHENGINE = YES
+SERVER_BASED_SEARCH = NO
+EXTERNAL_SEARCH = NO
+SEARCHENGINE_URL =
+SEARCHDATA_FILE = searchdata.xml
+EXTERNAL_SEARCH_ID =
+EXTRA_SEARCH_MAPPINGS =
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4
+EXTRA_PACKAGES =
+LATEX_HEADER =
+LATEX_FOOTER =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+LATEX_SOURCE_CODE = NO
+LATEX_BIB_STYLE = plain
+LATEX_TIMESTAMP = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+RTF_SOURCE_CODE = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_SUBDIR =
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK = NO
+DOCBOOK_OUTPUT = docbook
+DOCBOOK_PROGRAMLISTING = NO
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+EXTERNAL_PAGES = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+MSCGEN_PATH =
+DIA_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+DOT_NUM_THREADS = 0
+DOT_FONTNAME = Helvetica
+DOT_FONTSIZE = 10
+DOT_FONTPATH =
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+UML_LIMIT_NUM_FIELDS = 10
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+INTERACTIVE_SVG = NO
+DOT_PATH =
+DOTFILE_DIRS =
+MSCFILE_DIRS =
+DIAFILE_DIRS =
+PLANTUML_JAR_PATH =
+PLANTUML_CFG_FILE =
+PLANTUML_INCLUDE_PATH =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
diff --git a/feed/app/ethswbox/src/switch_hostapi/doc/footer.html b/feed/app/ethswbox/src/switch_hostapi/doc/footer.html
new file mode 100644
index 0000000..a24bf2b
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/doc/footer.html
@@ -0,0 +1,21 @@
+<!-- HTML footer for doxygen 1.8.13-->
+<!-- start footer part -->
+<!--BEGIN GENERATE_TREEVIEW-->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ $navpath
+ <li class="footer">$generatedby
+ <a href="http://www.doxygen.org/index.html">
+ <img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
+ </ul>
+</div>
+<!--END GENERATE_TREEVIEW-->
+<!--BEGIN !GENERATE_TREEVIEW-->
+<hr class="footer"/><address class="footer"><small>
+$generatedby  <a href="http://www.doxygen.org/index.html">
+<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
+</a> $doxygenversion
+</small></address>
+<!--END !GENERATE_TREEVIEW-->
+</body>
+</html>
diff --git a/feed/app/ethswbox/src/switch_hostapi/doc/header.html b/feed/app/ethswbox/src/switch_hostapi/doc/header.html
new file mode 100644
index 0000000..13af98a
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/doc/header.html
@@ -0,0 +1,56 @@
+<!-- HTML header for doxygen 1.8.13-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen $doxygenversion"/>
+<meta name="viewport" content="width=device-width, initial-scale=1"/>
+<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
+<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
+<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="$relpath^jquery.js"></script>
+<script type="text/javascript" src="$relpath^dynsections.js"></script>
+$treeview
+$search
+$mathjax
+<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
+$extrastylesheet
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+
+<!--BEGIN TITLEAREA-->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <!--BEGIN PROJECT_LOGO-->
+ <td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
+ <!--END PROJECT_LOGO-->
+ <!--BEGIN PROJECT_NAME-->
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname">$projectname
+ <!--BEGIN PROJECT_NUMBER--> <span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
+ </div>
+ <!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
+ </td>
+ <!--END PROJECT_NAME-->
+ <!--BEGIN !PROJECT_NAME-->
+ <!--BEGIN PROJECT_BRIEF-->
+ <td style="padding-left: 0.5em;">
+ <div id="projectbrief">$projectbrief</div>
+ </td>
+ <!--END PROJECT_BRIEF-->
+ <!--END !PROJECT_NAME-->
+ <!--BEGIN DISABLE_INDEX-->
+ <!--BEGIN SEARCHENGINE-->
+ <td>$searchbox</td>
+ <!--END SEARCHENGINE-->
+ <!--END DISABLE_INDEX-->
+ </tr>
+ </tbody>
+</table>
+</div>
+<!--END TITLEAREA-->
+<!-- end header part -->
diff --git a/feed/app/ethswbox/src/switch_hostapi/doc/stylesheet.css b/feed/app/ethswbox/src/switch_hostapi/doc/stylesheet.css
new file mode 100644
index 0000000..4f1ab91
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/doc/stylesheet.css
@@ -0,0 +1,1596 @@
+/* The standard CSS for doxygen 1.8.13 */
+
+body, table, div, p, dl {
+ font: 400 14px/22px Roboto,sans-serif;
+}
+
+p.reference, p.definition {
+ font: 400 14px/22px Roboto,sans-serif;
+}
+
+/* @group Heading Levels */
+
+h1.groupheader {
+ font-size: 150%;
+}
+
+.title {
+ font: 400 14px/28px Roboto,sans-serif;
+ font-size: 150%;
+ font-weight: bold;
+ margin: 10px 2px;
+}
+
+h2.groupheader {
+ border-bottom: 1px solid #879ECB;
+ color: #354C7B;
+ font-size: 150%;
+ font-weight: normal;
+ margin-top: 1.75em;
+ padding-top: 8px;
+ padding-bottom: 4px;
+ width: 100%;
+}
+
+h3.groupheader {
+ font-size: 100%;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ -webkit-transition: text-shadow 0.5s linear;
+ -moz-transition: text-shadow 0.5s linear;
+ -ms-transition: text-shadow 0.5s linear;
+ -o-transition: text-shadow 0.5s linear;
+ transition: text-shadow 0.5s linear;
+ margin-right: 15px;
+}
+
+h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow {
+ text-shadow: 0 0 15px cyan;
+}
+
+dt {
+ font-weight: bold;
+}
+
+div.multicol {
+ -moz-column-gap: 1em;
+ -webkit-column-gap: 1em;
+ -moz-column-count: 3;
+ -webkit-column-count: 3;
+}
+
+p.startli, p.startdd {
+ margin-top: 2px;
+}
+
+p.starttd {
+ margin-top: 0px;
+}
+
+p.endli {
+ margin-bottom: 0px;
+}
+
+p.enddd {
+ margin-bottom: 4px;
+}
+
+p.endtd {
+ margin-bottom: 2px;
+}
+
+/* @end */
+
+caption {
+ font-weight: bold;
+}
+
+span.legend {
+ font-size: 70%;
+ text-align: center;
+}
+
+h3.version {
+ font-size: 90%;
+ text-align: center;
+}
+
+div.qindex, div.navtab{
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+}
+
+div.qindex, div.navpath {
+ width: 100%;
+ line-height: 140%;
+}
+
+div.navtab {
+ margin-right: 15px;
+}
+
+/* @group Link Styling */
+
+a {
+ color: #3D578C;
+ font-weight: normal;
+ text-decoration: none;
+}
+
+.contents a:visited {
+ color: #4665A2;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+a.qindex {
+ font-weight: bold;
+}
+
+a.qindexHL {
+ font-weight: bold;
+ background-color: #9CAFD4;
+ color: #ffffff;
+ border: 1px double #869DCA;
+}
+
+.contents a.qindexHL:visited {
+ color: #ffffff;
+}
+
+a.el {
+ font-weight: bold;
+}
+
+a.elRef {
+}
+
+a.code, a.code:visited, a.line, a.line:visited {
+ color: #4665A2;
+}
+
+a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
+ color: #4665A2;
+}
+
+/* @end */
+
+dl.el {
+ margin-left: -1cm;
+}
+
+pre.fragment {
+ border: 1px solid #C4CFE5;
+ background-color: #FBFCFD;
+ padding: 4px 6px;
+ margin: 4px 8px 4px 2px;
+ overflow: auto;
+ word-wrap: break-word;
+ font-size: 9pt;
+ line-height: 125%;
+ font-family: monospace, fixed;
+ font-size: 105%;
+}
+
+div.fragment {
+ padding: 0px;
+ margin: 4px 8px 4px 2px;
+ background-color: #FBFCFD;
+ border: 1px solid #C4CFE5;
+}
+
+div.line {
+ font-family: monospace, fixed;
+ font-size: 13px;
+ min-height: 13px;
+ line-height: 1.0;
+ text-wrap: unrestricted;
+ white-space: -moz-pre-wrap; /* Moz */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ white-space: pre-wrap; /* CSS3 */
+ word-wrap: break-word; /* IE 5.5+ */
+ text-indent: -53px;
+ padding-left: 53px;
+ padding-bottom: 0px;
+ margin: 0px;
+ -webkit-transition-property: background-color, box-shadow;
+ -webkit-transition-duration: 0.5s;
+ -moz-transition-property: background-color, box-shadow;
+ -moz-transition-duration: 0.5s;
+ -ms-transition-property: background-color, box-shadow;
+ -ms-transition-duration: 0.5s;
+ -o-transition-property: background-color, box-shadow;
+ -o-transition-duration: 0.5s;
+ transition-property: background-color, box-shadow;
+ transition-duration: 0.5s;
+}
+
+div.line:after {
+ content:"\000A";
+ white-space: pre;
+}
+
+div.line.glow {
+ background-color: cyan;
+ box-shadow: 0 0 10px cyan;
+}
+
+
+span.lineno {
+ padding-right: 4px;
+ text-align: right;
+ border-right: 2px solid #0F0;
+ background-color: #E8E8E8;
+ white-space: pre;
+}
+span.lineno a {
+ background-color: #D8D8D8;
+}
+
+span.lineno a:hover {
+ background-color: #C8C8C8;
+}
+
+.lineno {
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+div.ah, span.ah {
+ background-color: black;
+ font-weight: bold;
+ color: #ffffff;
+ margin-bottom: 3px;
+ margin-top: 3px;
+ padding: 0.2em;
+ border: solid thin #333;
+ border-radius: 0.5em;
+ -webkit-border-radius: .5em;
+ -moz-border-radius: .5em;
+ box-shadow: 2px 2px 3px #999;
+ -webkit-box-shadow: 2px 2px 3px #999;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
+ background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%);
+}
+
+div.classindex ul {
+ list-style: none;
+ padding-left: 0;
+}
+
+div.classindex span.ai {
+ display: inline-block;
+}
+
+div.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ font-weight: bold;
+}
+
+div.groupText {
+ margin-left: 16px;
+ font-style: italic;
+}
+
+body {
+ background-color: white;
+ color: black;
+ margin: 0;
+}
+
+div.contents {
+ margin-top: 10px;
+ margin-left: 12px;
+ margin-right: 8px;
+}
+
+td.indexkey {
+ background-color: #EBEFF6;
+ font-weight: bold;
+ border: 1px solid #C4CFE5;
+ margin: 2px 0px 2px 0;
+ padding: 2px 10px;
+ white-space: nowrap;
+ vertical-align: top;
+}
+
+td.indexvalue {
+ background-color: #EBEFF6;
+ border: 1px solid #C4CFE5;
+ padding: 2px 10px;
+ margin: 2px 0px;
+}
+
+tr.memlist {
+ background-color: #EEF1F7;
+}
+
+p.formulaDsp {
+ text-align: center;
+}
+
+img.formulaDsp {
+
+}
+
+img.formulaInl {
+ vertical-align: middle;
+}
+
+div.center {
+ text-align: center;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px;
+}
+
+div.center img {
+ border: 0px;
+}
+
+address.footer {
+ text-align: right;
+ padding-right: 12px;
+}
+
+img.footer {
+ border: 0px;
+ vertical-align: middle;
+}
+
+/* @group Code Colorization */
+
+span.keyword {
+ color: #008000
+}
+
+span.keywordtype {
+ color: #604020
+}
+
+span.keywordflow {
+ color: #e08000
+}
+
+span.comment {
+ color: #800000
+}
+
+span.preprocessor {
+ color: #806020
+}
+
+span.stringliteral {
+ color: #002080
+}
+
+span.charliteral {
+ color: #008080
+}
+
+span.vhdldigit {
+ color: #ff00ff
+}
+
+span.vhdlchar {
+ color: #000000
+}
+
+span.vhdlkeyword {
+ color: #700070
+}
+
+span.vhdllogic {
+ color: #ff0000
+}
+
+blockquote {
+ background-color: #F7F8FB;
+ border-left: 2px solid #9CAFD4;
+ margin: 0 24px 0 4px;
+ padding: 0 12px 0 16px;
+}
+
+/* @end */
+
+/*
+.search {
+ color: #003399;
+ font-weight: bold;
+}
+
+form.search {
+ margin-bottom: 0px;
+ margin-top: 0px;
+}
+
+input.search {
+ font-size: 75%;
+ color: #000080;
+ font-weight: normal;
+ background-color: #e8eef2;
+}
+*/
+
+td.tiny {
+ font-size: 75%;
+}
+
+.dirtab {
+ padding: 4px;
+ border-collapse: collapse;
+ border: 1px solid #A3B4D7;
+}
+
+th.dirtab {
+ background: #EBEFF6;
+ font-weight: bold;
+}
+
+hr {
+ height: 0px;
+ border: none;
+ border-top: 1px solid #4A6AAA;
+}
+
+hr.footer {
+ height: 1px;
+}
+
+/* @group Member Descriptions */
+
+table.memberdecls {
+ border-spacing: 0px;
+ padding: 0px;
+}
+
+.memberdecls td, .fieldtable tr {
+ -webkit-transition-property: background-color, box-shadow;
+ -webkit-transition-duration: 0.5s;
+ -moz-transition-property: background-color, box-shadow;
+ -moz-transition-duration: 0.5s;
+ -ms-transition-property: background-color, box-shadow;
+ -ms-transition-duration: 0.5s;
+ -o-transition-property: background-color, box-shadow;
+ -o-transition-duration: 0.5s;
+ transition-property: background-color, box-shadow;
+ transition-duration: 0.5s;
+}
+
+.memberdecls td.glow, .fieldtable tr.glow {
+ background-color: cyan;
+ box-shadow: 0 0 15px cyan;
+}
+
+.mdescLeft, .mdescRight,
+.memItemLeft, .memItemRight,
+.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
+ background-color: #F9FAFC;
+ border: none;
+ margin: 4px;
+ padding: 1px 0 0 8px;
+}
+
+.mdescLeft, .mdescRight {
+ padding: 0px 8px 4px 8px;
+ color: #555;
+}
+
+.memSeparator {
+ border-bottom: 1px solid #DEE4F0;
+ line-height: 1px;
+ margin: 0px;
+ padding: 0px;
+}
+
+.memItemLeft, .memTemplItemLeft {
+ white-space: nowrap;
+}
+
+.memItemRight {
+ width: 100%;
+}
+
+.memTemplParams {
+ color: #4665A2;
+ white-space: nowrap;
+ font-size: 80%;
+}
+
+/* @end */
+
+/* @group Member Details */
+
+/* Styles for detailed member documentation */
+
+.memtitle {
+ padding: 8px;
+ border-top: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ border-top-right-radius: 4px;
+ border-top-left-radius: 4px;
+ margin-bottom: -1px;
+ background-image: url('nav_f.png');
+ background-repeat: repeat-x;
+ background-color: #E2E8F2;
+ line-height: 1.25;
+ font-weight: 300;
+ float:left;
+}
+
+.permalink
+{
+ font-size: 65%;
+ display: inline-block;
+ vertical-align: middle;
+}
+
+.memtemplate {
+ font-size: 80%;
+ color: #4665A2;
+ font-weight: normal;
+ margin-left: 9px;
+}
+
+.memnav {
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+
+.mempage {
+ width: 100%;
+}
+
+.memitem {
+ padding: 0;
+ margin-bottom: 10px;
+ margin-right: 5px;
+ -webkit-transition: box-shadow 0.5s linear;
+ -moz-transition: box-shadow 0.5s linear;
+ -ms-transition: box-shadow 0.5s linear;
+ -o-transition: box-shadow 0.5s linear;
+ transition: box-shadow 0.5s linear;
+ display: table !important;
+ width: 100%;
+}
+
+.memitem.glow {
+ box-shadow: 0 0 15px cyan;
+}
+
+.memname {
+ font-weight: 400;
+ margin-left: 6px;
+}
+
+.memname td {
+ vertical-align: bottom;
+}
+
+.memproto, dl.reflist dt {
+ border-top: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 6px 0px 6px 0px;
+ color: #253555;
+ font-weight: bold;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ background-color: #DFE5F1;
+ /* opera specific markup */
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ border-top-right-radius: 4px;
+ /* firefox specific markup */
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ -moz-border-radius-topright: 4px;
+ /* webkit specific markup */
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -webkit-border-top-right-radius: 4px;
+
+}
+
+.overload {
+ font-family: "courier new",courier,monospace;
+ font-size: 65%;
+}
+
+.memdoc, dl.reflist dd {
+ border-bottom: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 6px 10px 2px 10px;
+ background-color: #FBFCFD;
+ border-top-width: 0;
+ background-image:url('nav_g.png');
+ background-repeat:repeat-x;
+ background-color: #FFFFFF;
+ /* opera specific markup */
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ /* firefox specific markup */
+ -moz-border-radius-bottomleft: 4px;
+ -moz-border-radius-bottomright: 4px;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ /* webkit specific markup */
+ -webkit-border-bottom-left-radius: 4px;
+ -webkit-border-bottom-right-radius: 4px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+}
+
+dl.reflist dt {
+ padding: 5px;
+}
+
+dl.reflist dd {
+ margin: 0px 0px 10px 0px;
+ padding: 5px;
+}
+
+.paramkey {
+ text-align: right;
+}
+
+.paramtype {
+ white-space: nowrap;
+}
+
+.paramname {
+ color: #602020;
+ white-space: nowrap;
+}
+.paramname em {
+ font-style: normal;
+}
+.paramname code {
+ line-height: 14px;
+}
+
+.params, .retval, .exception, .tparams {
+ margin-left: 0px;
+ padding-left: 0px;
+}
+
+.params .paramname, .retval .paramname {
+ font-weight: bold;
+ vertical-align: top;
+}
+
+.params .paramtype {
+ font-style: italic;
+ vertical-align: top;
+}
+
+.params .paramdir {
+ font-family: "courier new",courier,monospace;
+ vertical-align: top;
+}
+
+table.mlabels {
+ border-spacing: 0px;
+}
+
+td.mlabels-left {
+ width: 100%;
+ padding: 0px;
+}
+
+td.mlabels-right {
+ vertical-align: bottom;
+ padding: 0px;
+ white-space: nowrap;
+}
+
+span.mlabels {
+ margin-left: 8px;
+}
+
+span.mlabel {
+ background-color: #728DC1;
+ border-top:1px solid #5373B4;
+ border-left:1px solid #5373B4;
+ border-right:1px solid #C4CFE5;
+ border-bottom:1px solid #C4CFE5;
+ text-shadow: none;
+ color: white;
+ margin-right: 4px;
+ padding: 2px 3px;
+ border-radius: 3px;
+ font-size: 7pt;
+ white-space: nowrap;
+ vertical-align: middle;
+}
+
+
+
+/* @end */
+
+/* these are for tree view inside a (index) page */
+
+div.directory {
+ margin: 10px 0px;
+ border-top: 1px solid #9CAFD4;
+ border-bottom: 1px solid #9CAFD4;
+ width: 100%;
+}
+
+.directory table {
+ border-collapse:collapse;
+}
+
+.directory td {
+ margin: 0px;
+ padding: 0px;
+ vertical-align: top;
+}
+
+.directory td.entry {
+ white-space: nowrap;
+ padding-right: 6px;
+ padding-top: 3px;
+}
+
+.directory td.entry a {
+ outline:none;
+}
+
+.directory td.entry a img {
+ border: none;
+}
+
+.directory td.desc {
+ width: 100%;
+ padding-left: 6px;
+ padding-right: 6px;
+ padding-top: 3px;
+ border-left: 1px solid rgba(0,0,0,0.05);
+}
+
+.directory tr.even {
+ padding-left: 6px;
+ background-color: #F7F8FB;
+}
+
+.directory img {
+ vertical-align: -30%;
+}
+
+.directory .levels {
+ white-space: nowrap;
+ width: 100%;
+ text-align: right;
+ font-size: 9pt;
+}
+
+.directory .levels span {
+ cursor: pointer;
+ padding-left: 2px;
+ padding-right: 2px;
+ color: #3D578C;
+}
+
+.arrow {
+ color: #9CAFD4;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ cursor: pointer;
+ font-size: 80%;
+ display: inline-block;
+ width: 16px;
+ height: 22px;
+}
+
+.icon {
+ font-family: Arial, Helvetica;
+ font-weight: bold;
+ font-size: 12px;
+ height: 14px;
+ width: 16px;
+ display: inline-block;
+ background-color: #728DC1;
+ color: white;
+ text-align: center;
+ border-radius: 4px;
+ margin-left: 2px;
+ margin-right: 2px;
+}
+
+.icona {
+ width: 24px;
+ height: 22px;
+ display: inline-block;
+}
+
+.iconfopen {
+ width: 24px;
+ height: 18px;
+ margin-bottom: 4px;
+ background-image:url('folderopen.png');
+ background-position: 0px -4px;
+ background-repeat: repeat-y;
+ vertical-align:top;
+ display: inline-block;
+}
+
+.iconfclosed {
+ width: 24px;
+ height: 18px;
+ margin-bottom: 4px;
+ background-image:url('folderclosed.png');
+ background-position: 0px -4px;
+ background-repeat: repeat-y;
+ vertical-align:top;
+ display: inline-block;
+}
+
+.icondoc {
+ width: 24px;
+ height: 18px;
+ margin-bottom: 4px;
+ background-image:url('doc.png');
+ background-position: 0px -4px;
+ background-repeat: repeat-y;
+ vertical-align:top;
+ display: inline-block;
+}
+
+table.directory {
+ font: 400 14px Roboto,sans-serif;
+}
+
+/* @end */
+
+div.dynheader {
+ margin-top: 8px;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+address {
+ font-style: normal;
+ color: #2A3D61;
+}
+
+table.doxtable caption {
+ caption-side: top;
+}
+
+table.doxtable {
+ border-collapse:collapse;
+ margin-top: 4px;
+ margin-bottom: 4px;
+}
+
+table.doxtable td, table.doxtable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+table.doxtable th {
+ background-color: #374F7F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+}
+
+table.fieldtable {
+ /*width: 100%;*/
+ margin-bottom: 10px;
+ border: 1px solid #A8B8D9;
+ border-spacing: 0px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
+ box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
+}
+
+.fieldtable td, .fieldtable th {
+ padding: 3px 7px 2px;
+}
+
+.fieldtable td.fieldtype, .fieldtable td.fieldname {
+ white-space: nowrap;
+ border-right: 1px solid #A8B8D9;
+ border-bottom: 1px solid #A8B8D9;
+ vertical-align: top;
+}
+
+.fieldtable td.fieldname {
+ padding-top: 3px;
+}
+
+.fieldtable td.fielddoc {
+ border-bottom: 1px solid #A8B8D9;
+ /*width: 100%;*/
+}
+
+.fieldtable td.fielddoc p:first-child {
+ margin-top: 0px;
+}
+
+.fieldtable td.fielddoc p:last-child {
+ margin-bottom: 2px;
+}
+
+.fieldtable tr:last-child td {
+ border-bottom: none;
+}
+
+.fieldtable th {
+ background-image:url('nav_f.png');
+ background-repeat:repeat-x;
+ background-color: #E2E8F2;
+ font-size: 90%;
+ color: #253555;
+ padding-bottom: 4px;
+ padding-top: 5px;
+ text-align:left;
+ font-weight: 400;
+ -moz-border-radius-topleft: 4px;
+ -moz-border-radius-topright: 4px;
+ -webkit-border-top-left-radius: 4px;
+ -webkit-border-top-right-radius: 4px;
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ border-bottom: 1px solid #A8B8D9;
+}
+
+
+.tabsearch {
+ top: 0px;
+ left: 10px;
+ height: 36px;
+ background-image: url('tab_b.png');
+ z-index: 101;
+ overflow: hidden;
+ font-size: 13px;
+}
+
+.navpath ul
+{
+ font-size: 11px;
+ background-image:url('tab_b.png');
+ background-repeat:repeat-x;
+ background-position: 0 -5px;
+ height:30px;
+ line-height:30px;
+ color:#8AA0CC;
+ border:solid 1px #C2CDE4;
+ overflow:hidden;
+ margin:0px;
+ padding:0px;
+}
+
+.navpath li
+{
+ list-style-type:none;
+ float:left;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:url('bc_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+}
+
+.navpath li.navelem a
+{
+ height:32px;
+ display:block;
+ text-decoration: none;
+ outline: none;
+ color: #283A5D;
+ font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ text-decoration: none;
+}
+
+.navpath li.navelem a:hover
+{
+ color:#6884BD;
+}
+
+.navpath li.footer
+{
+ list-style-type:none;
+ float:right;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:none;
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+ font-size: 8pt;
+}
+
+
+div.summary
+{
+ float: right;
+ font-size: 8pt;
+ padding-right: 5px;
+ width: 50%;
+ text-align: right;
+}
+
+div.summary a
+{
+ white-space: nowrap;
+}
+
+table.classindex
+{
+ margin: 10px;
+ white-space: nowrap;
+ margin-left: 3%;
+ margin-right: 3%;
+ width: 94%;
+ border: 0;
+ border-spacing: 0;
+ padding: 0;
+}
+
+div.ingroups
+{
+ font-size: 8pt;
+ width: 50%;
+ text-align: left;
+}
+
+div.ingroups a
+{
+ white-space: nowrap;
+}
+
+div.header
+{
+ background-image:url('nav_h.png');
+ background-repeat:repeat-x;
+ background-color: #F9FAFC;
+ margin: 0px;
+ border-bottom: 1px solid #C4CFE5;
+}
+
+div.headertitle
+{
+ padding: 5px 5px 5px 10px;
+}
+
+dl
+{
+ padding: 0 0 0 10px;
+}
+
+/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */
+dl.section
+{
+ margin-left: 0px;
+ padding-left: 0px;
+}
+
+dl.note
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #D0C000;
+}
+
+dl.warning, dl.attention
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #FF0000;
+}
+
+dl.pre, dl.post, dl.invariant
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #00D000;
+}
+
+dl.deprecated
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #505050;
+}
+
+dl.todo
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #00C0E0;
+}
+
+dl.test
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #3030E0;
+}
+
+dl.bug
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #C08050;
+}
+
+dl.section dd {
+ margin-bottom: 6px;
+}
+
+
+#projectlogo
+{
+ text-align: center;
+ vertical-align: bottom;
+ border-collapse: separate;
+}
+
+#projectlogo img
+{
+ border: 0px none;
+}
+
+#projectalign
+{
+ vertical-align: middle;
+}
+
+#projectname
+{
+ font: 300% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 2px 0px;
+}
+
+#projectbrief
+{
+ font: 120% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#projectnumber
+{
+ font: 50% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#titlearea
+{
+ padding: 0px;
+ margin: 0px;
+ width: 100%;
+ border-bottom: 1px solid #5373B4;
+}
+
+.image
+{
+ text-align: center;
+}
+
+.dotgraph
+{
+ text-align: center;
+}
+
+.mscgraph
+{
+ text-align: center;
+}
+
+.plantumlgraph
+{
+ text-align: center;
+}
+
+.diagraph
+{
+ text-align: center;
+}
+
+.caption
+{
+ font-weight: bold;
+}
+
+div.zoom
+{
+ border: 1px solid #90A5CE;
+}
+
+dl.citelist {
+ margin-bottom:50px;
+}
+
+dl.citelist dt {
+ color:#334975;
+ float:left;
+ font-weight:bold;
+ margin-right:10px;
+ padding:5px;
+}
+
+dl.citelist dd {
+ margin:2px 0;
+ padding:5px 0;
+}
+
+div.toc {
+ padding: 14px 25px;
+ background-color: #F4F6FA;
+ border: 1px solid #D8DFEE;
+ border-radius: 7px 7px 7px 7px;
+ float: right;
+ height: auto;
+ margin: 0 8px 10px 10px;
+ width: 200px;
+}
+
+div.toc li {
+ background: url("bdwn.png") no-repeat scroll 0 5px transparent;
+ font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif;
+ margin-top: 5px;
+ padding-left: 10px;
+ padding-top: 2px;
+}
+
+div.toc h3 {
+ font: bold 12px/1.2 Arial,FreeSans,sans-serif;
+ color: #4665A2;
+ border-bottom: 0 none;
+ margin: 0;
+}
+
+div.toc ul {
+ list-style: none outside none;
+ border: medium none;
+ padding: 0px;
+}
+
+div.toc li.level1 {
+ margin-left: 0px;
+}
+
+div.toc li.level2 {
+ margin-left: 15px;
+}
+
+div.toc li.level3 {
+ margin-left: 30px;
+}
+
+div.toc li.level4 {
+ margin-left: 45px;
+}
+
+.inherit_header {
+ font-weight: bold;
+ color: gray;
+ cursor: pointer;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.inherit_header td {
+ padding: 6px 0px 2px 5px;
+}
+
+.inherit {
+ display: none;
+}
+
+tr.heading h2 {
+ margin-top: 12px;
+ margin-bottom: 4px;
+}
+
+/* tooltip related style info */
+
+.ttc {
+ position: absolute;
+ display: none;
+}
+
+#powerTip {
+ cursor: default;
+ white-space: nowrap;
+ background-color: white;
+ border: 1px solid gray;
+ border-radius: 4px 4px 4px 4px;
+ box-shadow: 1px 1px 7px gray;
+ display: none;
+ font-size: smaller;
+ max-width: 80%;
+ opacity: 0.9;
+ padding: 1ex 1em 1em;
+ position: absolute;
+ z-index: 2147483647;
+}
+
+#powerTip div.ttdoc {
+ color: grey;
+ font-style: italic;
+}
+
+#powerTip div.ttname a {
+ font-weight: bold;
+}
+
+#powerTip div.ttname {
+ font-weight: bold;
+}
+
+#powerTip div.ttdeci {
+ color: #006318;
+}
+
+#powerTip div {
+ margin: 0px;
+ padding: 0px;
+ font: 12px/16px Roboto,sans-serif;
+}
+
+#powerTip:before, #powerTip:after {
+ content: "";
+ position: absolute;
+ margin: 0px;
+}
+
+#powerTip.n:after, #powerTip.n:before,
+#powerTip.s:after, #powerTip.s:before,
+#powerTip.w:after, #powerTip.w:before,
+#powerTip.e:after, #powerTip.e:before,
+#powerTip.ne:after, #powerTip.ne:before,
+#powerTip.se:after, #powerTip.se:before,
+#powerTip.nw:after, #powerTip.nw:before,
+#powerTip.sw:after, #powerTip.sw:before {
+ border: solid transparent;
+ content: " ";
+ height: 0;
+ width: 0;
+ position: absolute;
+}
+
+#powerTip.n:after, #powerTip.s:after,
+#powerTip.w:after, #powerTip.e:after,
+#powerTip.nw:after, #powerTip.ne:after,
+#powerTip.sw:after, #powerTip.se:after {
+ border-color: rgba(255, 255, 255, 0);
+}
+
+#powerTip.n:before, #powerTip.s:before,
+#powerTip.w:before, #powerTip.e:before,
+#powerTip.nw:before, #powerTip.ne:before,
+#powerTip.sw:before, #powerTip.se:before {
+ border-color: rgba(128, 128, 128, 0);
+}
+
+#powerTip.n:after, #powerTip.n:before,
+#powerTip.ne:after, #powerTip.ne:before,
+#powerTip.nw:after, #powerTip.nw:before {
+ top: 100%;
+}
+
+#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after {
+ border-top-color: #ffffff;
+ border-width: 10px;
+ margin: 0px -10px;
+}
+#powerTip.n:before {
+ border-top-color: #808080;
+ border-width: 11px;
+ margin: 0px -11px;
+}
+#powerTip.n:after, #powerTip.n:before {
+ left: 50%;
+}
+
+#powerTip.nw:after, #powerTip.nw:before {
+ right: 14px;
+}
+
+#powerTip.ne:after, #powerTip.ne:before {
+ left: 14px;
+}
+
+#powerTip.s:after, #powerTip.s:before,
+#powerTip.se:after, #powerTip.se:before,
+#powerTip.sw:after, #powerTip.sw:before {
+ bottom: 100%;
+}
+
+#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after {
+ border-bottom-color: #ffffff;
+ border-width: 10px;
+ margin: 0px -10px;
+}
+
+#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before {
+ border-bottom-color: #808080;
+ border-width: 11px;
+ margin: 0px -11px;
+}
+
+#powerTip.s:after, #powerTip.s:before {
+ left: 50%;
+}
+
+#powerTip.sw:after, #powerTip.sw:before {
+ right: 14px;
+}
+
+#powerTip.se:after, #powerTip.se:before {
+ left: 14px;
+}
+
+#powerTip.e:after, #powerTip.e:before {
+ left: 100%;
+}
+#powerTip.e:after {
+ border-left-color: #ffffff;
+ border-width: 10px;
+ top: 50%;
+ margin-top: -10px;
+}
+#powerTip.e:before {
+ border-left-color: #808080;
+ border-width: 11px;
+ top: 50%;
+ margin-top: -11px;
+}
+
+#powerTip.w:after, #powerTip.w:before {
+ right: 100%;
+}
+#powerTip.w:after {
+ border-right-color: #ffffff;
+ border-width: 10px;
+ top: 50%;
+ margin-top: -10px;
+}
+#powerTip.w:before {
+ border-right-color: #808080;
+ border-width: 11px;
+ top: 50%;
+ margin-top: -11px;
+}
+
+@media print
+{
+ #top { display: none; }
+ #side-nav { display: none; }
+ #nav-path { display: none; }
+ body { overflow:visible; }
+ h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
+ .summary { display: none; }
+ .memitem { page-break-inside: avoid; }
+ #doc-content
+ {
+ margin-left:0 !important;
+ height:auto !important;
+ width:auto !important;
+ overflow:inherit;
+ display:inline;
+ }
+}
+
+/* @group Markdown */
+
+/*
+table.markdownTable {
+ border-collapse:collapse;
+ margin-top: 4px;
+ margin-bottom: 4px;
+}
+
+table.markdownTable td, table.markdownTable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+table.markdownTableHead tr {
+}
+
+table.markdownTableBodyLeft td, table.markdownTable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th.markdownTableHeadNone {
+ background-color: #374F7F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+}
+
+th.markdownTableHeadLeft {
+ text-align: left
+}
+
+th.markdownTableHeadRight {
+ text-align: right
+}
+
+th.markdownTableHeadCenter {
+ text-align: center
+}
+*/
+
+table.markdownTable {
+ border-collapse:collapse;
+ margin-top: 4px;
+ margin-bottom: 4px;
+}
+
+table.markdownTable td, table.markdownTable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+table.markdownTable tr {
+}
+
+th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone {
+ background-color: #374F7F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+}
+
+th.markdownTableHeadLeft, td.markdownTableBodyLeft {
+ text-align: left
+}
+
+th.markdownTableHeadRight, td.markdownTableBodyRight {
+ text-align: right
+}
+
+th.markdownTableHeadCenter, td.markdownTableBodyCenter {
+ text-align: center
+}
+
+
+/* @end */
diff --git a/feed/app/ethswbox/src/switch_hostapi/doc/switch_api.chm b/feed/app/ethswbox/src/switch_hostapi/doc/switch_api.chm
new file mode 100644
index 0000000..9c82c12
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/doc/switch_api.chm
Binary files differ
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gpy/gpy2xx.h b/feed/app/ethswbox/src/switch_hostapi/include/gpy/gpy2xx.h
new file mode 100644
index 0000000..11132ca
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gpy/gpy2xx.h
@@ -0,0 +1,2603 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _GPY2XX_H_
+#define _GPY2XX_H_
+
+#include <errno.h>
+
+#ifndef IS_ENABLED
+#define IS_ENABLED(x) 0
+#endif
+
+#pragma pack(push, 1)
+#pragma scalar_storage_order little-endian
+
+/** \mainpage GPY APIs
+ \section intro_sec Introduction
+
+ The Intel Ethernet Network Connection GPY API device is a
+ multi-mode Gigabit Ethernet (GbE) transceiver integrated circuit,
+ supporting speeds of 10, 100, 1000 and 2500 Mbps. It supports 10BASE-Te,
+ 100BASE-TX, 1000BASE-T and 2.5GBASE-T standards and is characterized by
+ low power consumption. Power savings at the system level are introduced using
+ the Wake-on-LAN feature.
+
+ Ethernet PHYs are controlled over the MDIO interface and the base functionality is
+ usually provided by the network stack and the MDIO driver of the operating system.
+
+ The GPY API allows to make use of additional functionality, which is not provided
+ by the operating system, to speed up integration of the GPY device and to to ensure
+ correct configuration of features. The GPY API is intended to be used in user space,
+ but can be used also in kernel space with minor adaptations and based on customer requirements.
+*/
+
+/** \defgroup GPY2XX_API GPY2xx APIs
+ \brief This chapter describes the interface for accessing the GPY2xx.
+*/
+
+/** @{*/
+
+/** \defgroup GPY2XX_INIT Init APIs
+ \brief Group of functional APIs for initialization and cleanup.
+*/
+
+/** \defgroup GPY2XX_MDIO MDIO Bus APIs
+ \brief Group of functional APIs for MDIO Bus access.
+*/
+
+/** \defgroup GPY2XX_LINK_API Link APIs
+ \brief Group of functional APIs for auto-negotiation, link status, etc.
+*/
+
+/** \defgroup GPY2XX_LINK_SUPPORTED Supported Link Mode
+ \brief Group of macros for supported link mode configuration via \ref gpy2xx_link in \ref GPY2XX_LINK_API.
+ @cond SUBGROUPING
+ @ingroup GPY2XX_LINK_API
+ @endcond*/
+
+/** \defgroup GPY2XX_LINK_ADVERTISED Advertised Link Mode
+ \brief Group of macros for advertised link mode configuration via \ref gpy2xx_link in \ref GPY2XX_LINK_API.
+ @cond SUBGROUPING
+ @ingroup GPY2XX_LINK_API
+ @endcond
+*/
+
+/** \defgroup GPY2XX_LINK_SPEED Link Speed
+ \brief Group of macros for link speed configuration via \ref gpy2xx_link in APIs \ref gpy2xx_setup_forced,
+ \ref gpy2xx_config_aneg and \ref gpy2xx_sgmii_config_aneg.
+ @cond SUBGROUPING
+ @ingroup GPY2XX_LINK_API
+ @endcond
+*/
+
+/** \defgroup GPY2XX_LINK_DUPLEX Duplex
+ \brief Group of macros for duplex mode configuration via \ref gpy2xx_link in APIs \ref gpy2xx_setup_forced,
+ \ref gpy2xx_config_aneg and \ref gpy2xx_sgmii_config_aneg.
+ @cond SUBGROUPING
+ @ingroup GPY2XX_LINK_API
+ @endcond
+*/
+
+/** \defgroup GPY2XX_LED LED Function Config APIs
+ \brief Group of functional APIs for LED configuration.
+*/
+
+/** \defgroup GPY2XX_INT External Interrupt APIs
+ \brief Group of functional APIs for external interrupt configuration.
+*/
+
+/** \defgroup GPY2XX_DIAG Diagnosis and Test APIs
+ \brief Group of functional APIs for diagnosis and test.
+*/
+
+/** \defgroup GPY2XX_SYNCE Synchronous Ethernet (SyncE) Config APIs.
+ \brief Group of functional APIs for Synchronous Ethernet (SyncE) configuration.
+ Note: Not supported on GPHY flavours (i.e part numbers): GPY212, GPY2XX.
+*/
+
+/** \defgroup GPY2XX_SGMII SGMII Interface Config APIs
+ \brief Group of functional APIs for SGMII interface configuration.
+*/
+
+/** \defgroup GPY2XX_WOL_FLAG Wake-on-LAN Flags
+ \brief Group of Wake-on-LAN flags.
+*/
+
+/** \defgroup GPY2XX_MISC Miscellaneous Config APIs
+ \brief Group of functional APIs for miscellaneous features.
+*/
+
+/** \defgroup GPY2XX_FW Firmware Download APIs
+ \brief Group of functional APIs to download firmware into flash memory.
+*/
+
+/** \defgroup GPY2XX_GPY2XX_USXGMII USXGMII_REACH APIs
+ \brief Group of functional APIs for USXGMII Reach configuration.
+ Note: USXGMII is not supported for models without USXGMII capability.
+*/
+
+/**@}*/ /* GPY2XX_API */
+
+/** \addtogroup GPY211_MDIO */
+/**@{*/
+/** \brief Flag to enable 21-bit IEEE 802.3ae Clause 45 addressing mode */
+#define MII_ADDR_C45 (1<<30)
+/**@}*/ /* GPY211_MDIO */
+
+/** @cond INTERNAL */
+/** \brief Slave MDIO's Target Base Address Register's Address */
+#define SMDIO_BADR 0x1F
+/** \brief Slave MDIO's Target Offset Address */
+#define SMDIO_TOFF 0x00
+/** @endcond */
+
+/** \addtogroup GPY2XX_LINK_API */
+/**@{*/
+/** \brief Link mode bit indices */
+enum link_mode_bit_indices {
+ /** \brief 10M half-duplex twisted-pair */
+ LINK_MODE_10baseT_Half_BIT = 0,
+ /** \brief 10M full-duplex twisted-pair */
+ LINK_MODE_10baseT_Full_BIT = 1,
+ /** \brief 100M half-duplex twisted-pair */
+ LINK_MODE_100baseT_Half_BIT = 2,
+ /** \brief 100M full-duplex twisted-pair */
+ LINK_MODE_100baseT_Full_BIT = 3,
+ /** \brief 1G half-duplex twisted-pair */
+ LINK_MODE_1000baseT_Half_BIT = 4,
+ /** \brief 1G full-duplex twisted-pair */
+ LINK_MODE_1000baseT_Full_BIT = 5,
+ /** \brief Auto-negotiation */
+ LINK_MODE_Autoneg_BIT = 6,
+ /** \brief Twisted-pair */
+ LINK_MODE_TP_BIT = 7,
+ /** \brief Attachment unit interface */
+ LINK_MODE_AUI_BIT = 8,
+ /** \brief Media-independent interface */
+ LINK_MODE_MII_BIT = 9,
+ /** \brief Fiber */
+ LINK_MODE_FIBRE_BIT = 10,
+ /** \brief BNC (Bayonet Neill-Concelman) Connector */
+ LINK_MODE_BNC_BIT = 11,
+ /** \brief 10G full-duplex twisted-pair */
+ LINK_MODE_10000baseT_Full_BIT = 12,
+ /** \brief Pause supported */
+ LINK_MODE_Pause_BIT = 13,
+ /** \brief Asymmetric-pause supported */
+ LINK_MODE_Asym_Pause_BIT = 14,
+ /** \brief 2.5G full-duplex */
+ LINK_MODE_2500baseX_Full_BIT = 15,
+ /** \brief Backplane */
+ LINK_MODE_Backplane_BIT = 16,
+ /** \brief 1G full-duplex backplane C48 coding */
+ LINK_MODE_1000baseKX_Full_BIT = 17,
+ /** \brief 10G full-duplex 4-lane backplane C48 coding */
+ LINK_MODE_10000baseKX4_Full_BIT = 18,
+ /** \brief 10G full-duplex 1-lane backplane C49 coding */
+ LINK_MODE_10000baseKR_Full_BIT = 19,
+ /** \brief 10G full-duplex C49 coding */
+ LINK_MODE_10000baseR_FEC_BIT = 20,
+ /** \brief 20G full-duplex */
+ LINK_MODE_20000baseMLD2_Full_BIT = 21,
+ /** \brief 20G full-duplex 2-lane backplane C49 coding */
+ LINK_MODE_20000baseKR2_Full_BIT = 22,
+ /** \brief 40G full-duplex 4-lane backplane C49 coding */
+ LINK_MODE_40000baseKR4_Full_BIT = 23,
+ /** \brief 40G full-duplex fiber */
+ LINK_MODE_40000baseCR4_Full_BIT = 24,
+ /** \brief 40G full-duplex fiber */
+ LINK_MODE_40000baseSR4_Full_BIT = 25,
+ /** \brief 40G full-duplex fiber */
+ LINK_MODE_40000baseLR4_Full_BIT = 26,
+ /** \brief 56G full-duplex 4-lane backplane C49 coding */
+ LINK_MODE_56000baseKR4_Full_BIT = 27,
+ /** \brief 56G full-duplex fiber */
+ LINK_MODE_56000baseCR4_Full_BIT = 28,
+ /** \brief 56G full-duplex fiber */
+ LINK_MODE_56000baseSR4_Full_BIT = 29,
+ /** \brief 56G full-duplex fiber */
+ LINK_MODE_56000baseLR4_Full_BIT = 30,
+ /** \brief 25G full-duplex fiber */
+ LINK_MODE_25000baseCR_Full_BIT = 31,
+ /** \brief 25G full-duplex backplane C49 coding */
+ LINK_MODE_25000baseKR_Full_BIT = 32,
+ /** \brief 25G full-duplex fiber */
+ LINK_MODE_25000baseSR_Full_BIT = 33,
+ /** \brief 50G full-duplex fiber */
+ LINK_MODE_50000baseCR2_Full_BIT = 34,
+ /** \brief 50G full-duplex 2-lane backplane C49 coding */
+ LINK_MODE_50000baseKR2_Full_BIT = 35,
+ /** \brief 100G full-duplex 4-lane backplane C49 coding */
+ LINK_MODE_100000baseKR4_Full_BIT = 36,
+ /** \brief 100G full-duplex fiber */
+ LINK_MODE_100000baseSR4_Full_BIT = 37,
+ /** \brief 100G full-duplex fiber */
+ LINK_MODE_100000baseCR4_Full_BIT = 38,
+ /** \brief 100G full-duplex fiber */
+ LINK_MODE_100000baseLR4_ER4_Full_BIT = 39,
+ /** \brief 50G full-duplex fiber */
+ LINK_MODE_50000baseSR2_Full_BIT = 40,
+ /** \brief 1G full-duplex */
+ LINK_MODE_1000baseX_Full_BIT = 41,
+ /** \brief 10G full-duplex fiber */
+ LINK_MODE_10000baseCR_Full_BIT = 42,
+ /** \brief 10G full-duplex fiber */
+ LINK_MODE_10000baseSR_Full_BIT = 43,
+ /** \brief 10G full-duplex fiber */
+ LINK_MODE_10000baseLR_Full_BIT = 44,
+ /** \brief 10G full-duplex fiber */
+ LINK_MODE_10000baseLRM_Full_BIT = 45,
+ /** \brief 10G full-duplex fiber */
+ LINK_MODE_10000baseER_Full_BIT = 46,
+ /** \brief 2.5G full-duplex twisted-pair */
+ LINK_MODE_2500baseT_Full_BIT = 47,
+ /** \brief 5G full-duplex twisted-pair */
+ LINK_MODE_5000baseT_Full_BIT = 48,
+ /** \brief 2.5G Base-T fast retrain */
+ LINK_MODE_2500baseT_FR_BIT = 49,
+ /** \brief 5G Base-T fast retrain */
+ LINK_MODE_5000baseT_FR_BIT = 50,
+
+ /** \brief Last Mode */
+ LINK_MODE_LAST = LINK_MODE_5000baseT_FR_BIT,
+};
+
+/** \brief Wrapper for link mode used by \ref GPY2XX_LINK_SUPPORTED
+ and \ref GPY2XX_LINK_ADVERTISED macros*/
+#define LINK_MODE_MASK(base_name) \
+ (1ULL << (LINK_MODE_ ## base_name ## _BIT))
+/**@}*/ /* GPY2XX_LINK_API */
+
+/** \addtogroup GPY2XX_LINK_SUPPORTED */
+/**@{*/
+/** \brief Macros used by \b supported in \ref gpy2xx_link */
+/** \brief 10M half-duplex twisted-pair */
+#define GPY2XX_SUPPORTED_10baseT_Half LINK_MODE_MASK(10baseT_Half)
+/** \brief 10M full-duplex twisted-pair */
+#define GPY2XX_SUPPORTED_10baseT_Full LINK_MODE_MASK(10baseT_Full)
+/** \brief 100M half-duplex twisted-pair */
+#define GPY2XX_SUPPORTED_100baseT_Half LINK_MODE_MASK(100baseT_Half)
+/** \brief 100M full-duplex twisted-pair */
+#define GPY2XX_SUPPORTED_100baseT_Full LINK_MODE_MASK(100baseT_Full)
+/** \brief 1G half-duplex twisted-pair */
+#define GPY2XX_SUPPORTED_1000baseT_Half LINK_MODE_MASK(1000baseT_Half)
+/** \brief 1G full-duplex twisted-pair */
+#define GPY2XX_SUPPORTED_1000baseT_Full LINK_MODE_MASK(1000baseT_Full)
+/** \brief Auto-negotiation */
+#define GPY2XX_SUPPORTED_Autoneg LINK_MODE_MASK(Autoneg)
+/** \brief Twisted-pair */
+#define GPY2XX_SUPPORTED_TP LINK_MODE_MASK(TP)
+/** \brief Media-independent interface */
+#define GPY2XX_SUPPORTED_MII LINK_MODE_MASK(MII)
+/** \brief Pause supported */
+#define GPY2XX_SUPPORTED_Pause LINK_MODE_MASK(Pause)
+/** \brief Asymmetric-pause supported */
+#define GPY2XX_SUPPORTED_Asym_Pause LINK_MODE_MASK(Asym_Pause)
+/** \brief 2.5G full-duplex twisted-pair */
+#define GPY2XX_SUPPORTED_2500baseT_Full LINK_MODE_MASK(2500baseT_Full)
+/** \brief 5G full-duplex twisted-pair */
+#define GPY2XX_SUPPORTED_5000baseT_Full LINK_MODE_MASK(5000baseT_Full)
+/** \brief 2.5G Base-T fast retrain */
+#define GPY2XX_SUPPORTED_2500baseT_FR LINK_MODE_MASK(2500baseT_FR)
+/** \brief 5G Base-T fast retrain */
+#define GPY2XX_SUPPORTED_5000baseT_FR LINK_MODE_MASK(5000baseT_FR)
+/**@}*/ /* GPY2XX_LINK_SUPPORTED */
+
+/** \addtogroup GPY2XX_LINK_ADVERTISED */
+/**@{*/
+/** \brief Macros used by \b advertising in \ref gpy2xx_link */
+/** \brief 10M half-duplex twisted-pair */
+#define GPY2XX_ADVERTISED_10baseT_Half LINK_MODE_MASK(10baseT_Half)
+/** \brief 10M full-duplex twisted-pair */
+#define GPY2XX_ADVERTISED_10baseT_Full LINK_MODE_MASK(10baseT_Full)
+/** \brief 100M half-duplex twisted-pair */
+#define GPY2XX_ADVERTISED_100baseT_Half LINK_MODE_MASK(100baseT_Half)
+/** \brief 100M full-duplex twisted-pair */
+#define GPY2XX_ADVERTISED_100baseT_Full LINK_MODE_MASK(100baseT_Full)
+/** \brief 1G half-duplex twisted-pair */
+#define GPY2XX_ADVERTISED_1000baseT_Half LINK_MODE_MASK(1000baseT_Half)
+/** \brief 1G full-duplex twisted-pair */
+#define GPY2XX_ADVERTISED_1000baseT_Full LINK_MODE_MASK(1000baseT_Full)
+/** \brief Auto-negotiation */
+#define GPY2XX_ADVERTISED_Autoneg LINK_MODE_MASK(Autoneg)
+/** \brief Twisted-pair */
+#define GPY2XX_ADVERTISED_TP LINK_MODE_MASK(TP)
+/** \brief Media-independent interface */
+#define GPY2XX_ADVERTISED_MII LINK_MODE_MASK(MII)
+/** \brief Pause supported */
+#define GPY2XX_ADVERTISED_Pause LINK_MODE_MASK(Pause)
+/** \brief Asymmetric-pause supported */
+#define GPY2XX_ADVERTISED_Asym_Pause LINK_MODE_MASK(Asym_Pause)
+/** \brief 2.5G full-duplex twisted-pair */
+#define GPY2XX_ADVERTISED_2500baseT_Full LINK_MODE_MASK(2500baseT_Full)
+/** \brief 5G full-duplex twisted-pair */
+#define GPY2XX_ADVERTISED_5000baseT_Full LINK_MODE_MASK(5000baseT_Full)
+/** \brief 2.5G Base-T fast retrain */
+#define GPY2XX_ADVERTISED_2500baseT_FR LINK_MODE_MASK(2500baseT_FR)
+/** \brief 5G Base-T fast retrain */
+#define GPY2XX_ADVERTISED_5000baseT_FR LINK_MODE_MASK(5000baseT_FR)
+/**@}*/ /* GPY2XX_LINK_ADVERTISED */
+
+/** \addtogroup GPY2XX_LINK_SPEED */
+/**@{*/
+/** \brief Macros used by \b speed in \ref gpy2xx_link */
+/** \brief 10 Mbps */
+#define SPEED_10 10
+/** \brief 100 Mbps */
+#define SPEED_100 100
+/** \brief 1 Gbps */
+#define SPEED_1000 1000
+/** \brief 2.5 Gbps */
+#define SPEED_2500 2500
+/** \brief 5 Gbps */
+#define SPEED_5000 5000
+/** \brief 10 Gbps */
+#define SPEED_10000 10000
+/** @cond INTERNAL */
+/** \brief Unknown speed */
+#define SPEED_UNKNOWN -1
+/** @endcond */
+/**@}*/ /* GPY2XX_LINK_SPEED */
+
+/** \addtogroup GPY2XX_LINK_DUPLEX */
+/**@{*/
+/** \brief Macros used by \b duplex in \ref gpy2xx_link */
+/** \brief Half duplex */
+#define DUPLEX_HALF 0x00
+/** \brief Full duplex */
+#define DUPLEX_FULL 0x01
+/** @cond INTERNAL */
+/** \brief Unknown duplex */
+#define DUPLEX_INVALID (~0)
+/** @endcond */
+/**@}*/ /* GPY2XX_LINK_DUPLEX */
+
+/** \cond INTERNAL */
+#ifndef MDIO_MMD_PMAPMD
+#define MDIO_MMD_PMAPMD 0x01
+#endif
+#ifndef MDIO_MMD_PCS
+#define MDIO_MMD_PCS 0x03
+#endif
+#ifndef MDIO_MMD_AN
+#define MDIO_MMD_AN 0x07
+#endif
+#ifndef MDIO_MMD_VEND1
+#define MDIO_MMD_VEND1 0x1E
+#endif
+#ifndef MDIO_MMD_VEND2
+#define MDIO_MMD_VEND2 0x1F
+#endif
+/** \endcond */
+
+/** @cond INTERNAL */
+/** \brief Max GPIO pins supported */
+#define GPIO_PINS_MAX 18
+/** @endcond */
+
+/** \addtogroup GPY2XX_GPIO_FLAG */
+/**@{*/
+/** \brief Macros used by \b flags in \ref gpy2xx_gpio */
+/** \brief Output pin */
+#define GPIOF_DIR_OUT (0 << 0)
+/** \brief Input pin */
+#define GPIOF_DIR_IN (1 << 0)
+/** \brief Output pin low */
+#define GPIOF_OUTPUT_LOW (0 << 1)
+/** \brief Output pin high */
+#define GPIOF_OUTPUT_HIGH (1 << 1)
+/** \brief Input pin low */
+#define GPIOF_INPUT_LOW (0 << 2)
+/** \brief Input pin high */
+#define GPIOF_INPUT_HIGH (1 << 2)
+
+/** \brief GPIO pin is open-drain */
+#define GPIOF_OPEN_DRAIN (1 << 3)
+
+/** \brief GPIO pin is pull up */
+#define GPIOF_PULL_UP (2 << 8)
+/** \brief GPIO pin pull down */
+#define GPIOF_PULL_DOWN (3 << 8)
+
+/** \brief GPIO pin select alternative function "x" (0~3) */
+#define GPIOF_FUNC(x) (((x)&0x03)<<10)
+
+/** \brief GPIO pin pad strength "x": 0 - 2 mA, 1 - 4 mA,
+ 2 - 8 mA, 3 - 12 mA */
+#define GPIOF_PAD_STR(x) (((x)&0x03)<<12)
+
+/** \brief GPIO pin slow slew */
+#define GPIOF_SLOW_SLEW (0 << 15)
+/** \brief GPIO pin fast slew */
+#define GPIOF_FAST_SLEW (1 << 15)
+/**@}*/ /* GPY2XX_GPIO_FLAG */
+
+/** \addtogroup GPY2XX_INT */
+/**@{*/
+/** \brief Macros used by \b std_imask or \b std_istat in \ref gpy2xx_phy_extin */
+/** \brief External interrupt event */
+enum gpy2xx_extin_phy_event {
+ /** \brief Link state change */
+ EXTIN_PHY_LSTC = (1 << 0),
+ /** \brief Link speed change */
+ EXTIN_PHY_LSPC = (1 << 1),
+ /** \brief Duplex mode change */
+ EXTIN_PHY_DXMC = (1 << 2),
+ /** \brief MDI/MDIX crossover change */
+ EXTIN_PHY_MDIXC = (1 << 3),
+ /** \brief MDI polarity change */
+ EXTIN_PHY_MDIPC = (1 << 4),
+ /** \brief Link's auto-downspeed change */
+ EXTIN_PHY_ADSC = (1 << 5),
+ /** \brief Link's auto-downspeed change */
+ EXTIN_PHY_TEMP = (1 << 6),
+ /** \brief Link's auto-downspeed change */
+ EXTIN_PHY_ULP = (1 << 7),
+ /** \brief SyncE loss of reference clock */
+ EXTIN_PHY_LOR = (1 << 8),
+ /** \cond INTERNAL */
+ /** \brief Mailbox transaction complete - (for internal use only)*/
+ EXTIN_PHY_MBOX = (1 << 9),
+ /** \endcond */
+ /** \brief Auto-negotiation complete */
+ EXTIN_PHY_ANC = (1 << 10),
+ /** \brief Auto-negotiation error */
+ EXTIN_PHY_ANE = (1 << 11),
+ /** \brief Next page transmitted */
+ EXTIN_PHY_NPTX = (1 << 12),
+ /** \brief Next page received */
+ EXTIN_PHY_NPRX = (1 << 13),
+ /** \brief Master/slave resolution error */
+ EXTIN_PHY_MSRE = (1 << 14),
+ /** \brief Wake-on-LAN event */
+ EXTIN_PHY_WOL = (1 << 15),
+};
+/** \cond INTERNAL */
+#define EXTIN_PHY_EVENT_MIN ((EXTIN_PHY_LSTC << 1) - 1)
+#define EXTIN_PHY_EVENT_MAX ((EXTIN_PHY_WOL << 1) - 1)
+/** \endcond */
+
+/** \brief Macros used by \b ext_imask or \b ext_istat in \ref gpy2xx_phy_extin */
+/** \brief IM2 interrupt enable */
+enum gpy2xx_extin_im2_mask {
+ /** \brief Enable interrupt on LPI event hit */
+ EXTIN_IM2_IE_LPI = (1 << 1),
+ /** \brief Enable interrupt on any of Rx/Tx Timestamp FIFO is non-zero */
+ EXTIN_IM2_IE_TS_FIFO = (1 << 3),
+ /** \brief Enable interrupt on MACsec event hit */
+ EXTIN_IM2_IE_MACSEC = (1 << 4),
+};
+/** \cond INTERNAL */
+#define EXTIN_IM2_EVENT_MIN EXTIN_IM2_IE_LPI
+#define EXTIN_IM2_EVENT_MAX ((EXTIN_IM2_IE_MACSEC << 1) - 1)
+/** \endcond */
+/**@}*/ /* GPY2XX_INT */
+
+/** \addtogroup GPY2XX_DIAG */
+/**@{*/
+/** \brief Test modes */
+enum gpy2xx_test_mode {
+ /** \brief Normal operation without test */
+ TEST_NOP = 0,
+ /** \brief Test mode 1 (transmit waveform test)
+ Refer to IEEE 802.3-2015 Table 40-7 */
+ TEST_MODE1 = 1,
+ /** \brief Test mode 1 (transmit waveform test)
+ Refer to IEEE 802.3-2015 Table 40-7 */
+ TEST_WAV = TEST_MODE1,
+ /** \brief Test mode 2 (transmit jitter test in MASTER mode)
+ Refer to IEEE 802.3-2015 Table 40-7 */
+ TEST_MODE2 = 2,
+ /** \brief Test mode 2 (transmit jitter test in MASTER mode)
+ Refer to IEEE 802.3-2015 Table 40-7 */
+ TEST_JITM = TEST_MODE2,
+ /** \brief Test mode 3 (transmit jitter test in SLAVE mode)
+ Refer to IEEE 802.3-2015 Table 40-7 */
+ TEST_MODE3 = 3,
+ /** \brief Test mode 3 (transmit jitter test in SLAVE mode)
+ Refer to IEEE 802.3-2015 Table 40-7 */
+ TEST_JITS = TEST_MODE3,
+ /** \brief Test mode 4 (transmitter distortion test)
+ Refer to IEEE 802.3-2015 Table 40-7 */
+ TEST_MODE4 = 4,
+ /** \brief Test mode 4 (transmitter distortion test)
+ Refer to IEEE 802.3-2015 Table 40-7 */
+ TEST_DIST = TEST_MODE4,
+ /** \brief AFE Test */
+ TEST_AFE = 5,
+ /** \brief Cable diagnostics */
+ TEST_CDIAG = 6,
+ /** \brief Analog built-in self-test */
+ TEST_ABIST = 7,
+
+ /** \cond INTERNAL */
+ TEST_LAST_MODE = TEST_ABIST,
+ /** \endcond */
+};
+
+/** \brief Macros used by \b state in \ref gpy2xx_cdiag_sum */
+/** \brief Pair state in cable diagnostics */
+enum gpy2xx_cdiag_state {
+ /** \brief Indicates non-trivial echo due to mismatch at the reported
+ distance (essentially the level is not ignorable, but not as
+ strong as expected from a full reflection) */
+ CDIAG_REFLECTION = 1,
+ /** \brief Indicates a clear level of echo due to an open termination */
+ CDIAG_OPEN = 2,
+ /** \brief Indicates a clear level of echo due to a short termination */
+ CDIAG_SHORT = 4,
+ /** \brief Indicates no detectable echo impulse (essentially the cable
+ is properly matched) */
+ CDIAG_MATCHED = 8,
+};
+
+/** \brief Macros used by \b test in \ref gpy2xx_abist_param */
+/** \brief Flags in analog built-in self-test (ABIST) */
+enum gpy2xx_abist_test {
+ /** \brief Analog test for IP version < 1.5 */
+ ABIST_ANALOG_IPV_0 = 0,
+ /** \brief Analog test for IP version >= 1.5 */
+ //ABIST_ANALOG_IPV_15 = 1, //Commented as not supported in latest spec.
+
+ /** \brief DC test for 10BT mode LD, max +ve differential level */
+ ABIST_DC_10BT_MAX_PVE = (1 << 4) | 0,
+ /** \brief DC test for 10BT mode LD, 0 differential level */
+ ABIST_DC_10BT_0 = (1 << 4) | 1,
+ /** \brief DC test for 10BT mode LD, max -ve differential level */
+ ABIST_DC_10BT_MAX_NVE = (1 << 4) | 2,
+
+ /** \brief DC test for 100BT mode LD, max +ve differential level */
+ ABIST_DC_100BT_MAX_PVE = (1 << 4) | 3,
+ /** \brief DC test for 100BT mode LD, 0 differential level */
+ ABIST_DC_100BT_0 = (1 << 4) | 4,
+ /** \brief DC test for 100BT mode LD, max -ve differential level */
+ ABIST_DC_100BT_MAX_NVE = (1 << 4) | 5,
+
+ /** \brief DC test for 1000BT mode LD, max +ve differential level */
+ ABIST_DC_1000BT_MAX_PVE = (1 << 4) | 6,
+ /** \brief DC test for 1000BT mode LD, 0 differential level */
+ ABIST_DC_1000BT_0 = (1 << 4) | 7,
+ /** \brief DC test for 10000BT mode LD, max -ve differential level */
+ ABIST_DC_1000BT_MAX_NVE = (1 << 4) | 8,
+
+ /** \brief DC test for 2500BT mode LD, max +ve differential level */
+ ABIST_DC_2500BT_MAX_PVE = (1 << 4) | 9,
+ /** \brief DC test for 2500BT mode LD, 0 differential level */
+ ABIST_DC_2500BT_0 = (1 << 4) | 10,
+ /** \brief DC test for 2500BT mode LD, max -ve differential level */
+ ABIST_DC_2500BT_MAX_NVE = (1 << 4) | 11,
+
+ /** \brief Bit Error Rate (BER) test */
+ //ABIST_BER = (2 << 4), //Commented as not supported in latest spec.
+};
+
+/** \brief Test loop modes */
+enum gpy2xx_test_loop {
+ /** \brief Disable test loop */
+ TLOOP_OFF = 0,
+ /** \brief GMII (Near End) Test Loop:
+ This test loop allows raw (G)MII transmit data to be looped back
+ to the (G)MII) receive port. The setting will only take effect
+ after a link down/up event takes place. */
+ TLOOP_NETl = 1,
+ /** \brief Far End Test Loop:
+ This PCS far end test loop allows for the receive data at the
+ output of the receive PCS to be fed back into the transmit path,
+ that is, the input of the transmit PCS. The received data is
+ also available at the xMII interface output, however all xMII
+ transmit data is ignored in this test mode. The setting will
+ only take effect after a link down/up event takes place. */
+ TLOOP_FETl = 2,
+ /** \brief DEC (Digital Echo Canceler) Test Loop:
+ This test loop allows the transmit signal to be looped back via
+ the Digital Echo Canceler (DEC). This loopback is similar to
+ the functionality of the MDI test loop (\ref TLOOP_RJTl), except
+ that it does not require special termination circuitry at the
+ MDI connector. The user of this test loop has the option to
+ terminate each twisted pair with a 100 Ohm resistor. This test
+ loop is only applicable for 1000Base-T/2.5GBase-T. The setting
+ will only take effect after a link down/up event takes place. */
+ TLOOP_ECHO = 3,
+ /** \brief MDI (RJ45 Near End) Test Loop:
+ This test loop allows for loopback of the signal at the MDI
+ connector, for example RJ45 or SMB. Referring to the four
+ available twisted pairs in a CAT5 or equivalent cable type,
+ pair A is connected to pair B, and pair C to pair D. This
+ shorting of near-end twisted pairs must be enabled using
+ specialized termination circuitry. No additional resistors are
+ required. The setting will only take effect after a link down/up
+ event takes place. */
+ TLOOP_RJTl = 4,
+ /** \brief Far End Test Loop:
+ This is the same as \ref TLOOP_FETl, except that \ref TLOOP_FETl
+ is dependent on the availability of TX_CLK and RX_CLK from
+ the MII interface, but the IP takes care of generating the necessary
+ clocks for the loopback to work in this mode. The setting will
+ only take effect after a link down/up event takes place. */
+ TLOOP_FELTS = 5,
+ /** \brief GMII (Near End) Test Loop:
+ This test loop allows raw (G)MII transmit data to be looped back
+ to the (G)MII) receive port. The difference compared to
+ \ref TLOOP_NETl is that this setting takes effect immediately.
+ The Ethernet port indicates a link down and enters test mode,
+ in addition to closing the (G)MII-to-PCS buffer loop. */
+ TLOOP_NETLI = 8,
+};
+
+/** \brief Error events to be counted */
+enum gpy2xx_errcnt_event {
+ /** \brief Receive errors are counted */
+ ERRCNT_RXERR = 0,
+ /** \brief Receive frames are counted */
+ ERRCNT_RXACT = 1,
+ /** \brief ESD errors are counted */
+ ERRCNT_ESDERR = 2,
+ /** \brief SSD errors are counted */
+ ERRCNT_SSDERR = 3,
+ /** \brief Transmit errors are counted */
+ ERRCNT_TXERR = 4,
+ /** \brief Transmit frames are counted */
+ ERRCNT_TXACT = 5,
+ /** \brief Collision events are counted */
+ ERRCNT_COL = 6,
+ /** \brief Link down events are counted */
+ ERRCNT_NLD = 8,
+ /** \brief Auto-downspeed events are counted */
+ ERRCNT_ADS = 9,
+ /** \brief CRC error events are counted */
+ ERRCNT_CRC = 10,
+ /** \brief Time to link events are counted */
+ ERRCNT_TTL = 11,
+};
+/**@}*/ /* GPY2XX_DIAG */
+
+/** \addtogroup GPY2XX_SYNCE */
+/**@{*/
+/** \brief Macros used by \b synce_refclk in \ref gpy2xx_synce */
+/** \brief SyncE reference clock input frequency */
+enum gpy2xx_synce_clk {
+ /** \brief SyncE clock frequency is PSTN class: 8KHz */
+ SYNCE_CLK_PSTN = 0,
+ /** \brief SyncE clock frequency is EEC-1 class: 2.048MHz */
+ SYNCE_CLK_EEC1 = 1,
+ /** \brief SyncE clock frequency is EEC-2 class: 1.544MHz */
+ SYNCE_CLK_EEC2 = 2,
+ /** \brief Reserved */
+ SYNCE_CLK_RES = 3,
+};
+/** \cond INTERNAL */
+/** \brief Lowest ref clock's i/p frequency value */
+#define SYNCE_REFCLK_MIN SYNCE_CLK_PSTN
+/** \brief Highest ref clock's i/p frequency value */
+#define SYNCE_REFCLK_MAX SYNCE_CLK_EEC2
+/** \endcond */
+
+/** \brief GPC-0 mux selected on GPIO pin 10 on GPY2XX */
+#define GPIO_PIN10_GPC0_FUN 10
+/** \brief GPC-0 mux selected on GPIO pin 10 on GPY2XX */
+#define GPIO_PIN07_GPC0_FUN 07
+
+/** \brief Macros used by \b master_sel in \ref gpy2xx_synce */
+/** \brief Select synce master, slave mode */
+enum gpy2xx_synce_master_mode {
+ /** \brief SLAVE mode */
+ SYNCE_SLAVE = 0,
+ /** \brief Master mode */
+ SYNCE_MASTER = 1,
+};
+
+/** \brief Macros used by \b data_rate in \ref gpy2xx_synce */
+/** \brief Data rate */
+enum gpy2xx_data_rate {
+ /** \brief SYNCE_1G */
+ SYNCE_1G = 0,
+ /** \brief SYNCE_2G5 */
+ SYNCE_2G5 = 1,
+};
+
+/** \brief Macros used by \b gpc_sel in \ref gpy2xx_synce and \ref gpy2xx_pps_ctrl */
+/** \brief Time Stamp Capture Input Signal Selection.
+ This is to specify the input signal selected for time stamp capture. */
+enum gpy2xx_gpc_sel {
+ /** \brief OUT_TIMER signal from PM is selected as input signal to trigger time stamp capture.*/
+ OUTTIMER = 0,
+ /** \brief GPC0 is selected as input signal to trigger time stamp capture. */
+ SYNCE_GPC0 = 1,
+ /** \brief GPC1 is selected as input signal to trigger time stamp capture. */
+ SYNCE_GPC1 = 2,
+ /** \brief GPC2 is selected as input signal to trigger time stamp capture. */
+ SYNCE_GPC2 = 3,
+};
+/**@}*/ /* GPY2XX_SYNCE */
+
+/** \addtogroup GPY2XX_SGMII */
+/**@{*/
+/** \brief Macros used by \b linkcfg_dir in \ref gpy2xx_sgmii */
+/** \brief SGMII link configuration direction */
+enum gpy2xx_sgmii_linkcfg_dir {
+ /** \brief SGMII configuration is taken from twisted pair link status */
+ SGMII_LINKCFG_TPI = 0,
+ /** \brief SGMII configuration is taken from SGMII registers */
+ SGMII_LINKCFG_SGMII = 1,
+};
+
+/** \brief Macros used by \b aneg_mode in \ref gpy2xx_sgmii */
+/** \brief SGMII auto-negotiation mode */
+enum gpy2xx_sgmii_aneg_mode {
+ /** \brief 1000-Bx ANEG mode */
+ SGMII_ANEG_1000BX = 1,
+ /** \brief SGMII ANEG mode with GPY2xx acting as a PHY */
+ SGMII_ANEG_CISCO_PHY = 2,
+ /** \brief SGMII ANEG mode with GPY2xx acting as a MAC */
+ SGMII_ANEG_CISCO_MAC = 3,
+};
+
+/** \brief SGMII operation mode */
+enum gpy2xx_sgmii_operation {
+ /** \brief Normal operation */
+ SGMII_OP_NORMAL = 0,
+ /** \brief Power down */
+ SGMII_OP_DOWN = 1,
+ /** \brief Loopback data coming in from analog interface back to itself */
+ SGMII_OP_LOOPBACK = 2,
+ /** \brief Reset SGMII block */
+ SGMII_OP_RESET = 3
+};
+/**@}*/ /* GPY2XX_SGMII */
+
+/** \addtogroup GPY2XX_WOL_FLAG */
+/**@{*/
+/** \brief Macros used by \b wolopts in \ref gpy2xx_wol_cfg */
+/** \brief Wake up when PHY link is up */
+#define WAKE_PHY (1 << 0)
+/** \brief Wake up when received Unicast frame */
+#define WAKE_UCAST (1 << 1)
+/** \brief Wake up when received Multicast fram */
+#define WAKE_MCAST (1 << 2)
+/** \brief Wake up when received Broadcast frame */
+#define WAKE_BCAST (1 << 3)
+/** \brief Wake up when received ARP frame */
+#define WAKE_ARP (1 << 4)
+/** \brief Wake up when received Magic frame */
+#define WAKE_MAGIC (1 << 5)
+/** \brief Secured wake upOnly meaningful if WAKE_MAGIC is use */
+#define WAKE_MAGICSECURE (1 << 6)
+
+/** \cond INTERNAL */
+#define GPY2XX_WOL_FLAG_MIN ((WAKE_PHY << 1) - 1)
+#define GPY2XX_WOL_FLAG_MAX ((WAKE_MAGICSECURE << 1) - 1)
+/** \endcond */
+/**@}*/ /* GPY2XX_WOL_FLAG */
+
+/** \addtogroup GPY2XX_FW */
+/**@{*/
+/** \brief Default timeout (in milliseconds) for field firmware upgrade APIs */
+#define FW_FWR_DEF_TIMEOUT 5000
+/**@}*/ /* GPY2XX_FW */
+
+/** \addtogroup GPY2XX_GPY2XX_USXGMII */
+/**@{*/
+/** \brief Max number of slices */
+#define SLICE_NUM 8
+/**@}*/ /* GPY2XX_GPY2XX_USXGMII */
+
+/** @cond INTERNAL */
+#define PHYADDR2INDEX(phyaddr) (phyaddr & (SLICE_NUM - 1))
+/** @endcond */
+
+/** \addtogroup GPY2XX_LINK_API */
+/**@{*/
+/** \brief Member used by \b link in \ref gpy2xx_device and \ref gpy2xx_sgmii */
+/** \brief Data structure representing GPHY link configuration and status */
+struct gpy2xx_link {
+ /** \brief Link speed (forced) or partner link speed (auto-negotiation)
+ defined by \ref GPY2XX_LINK_SPEED macros */
+ int16_t speed;
+ /** \brief Duplex (forced) or partner duplex (auto-negotiation)
+ defined by \ref GPY2XX_LINK_DUPLEX macros */
+ unsigned int duplex : 2;
+ /** \brief Partner pause (auto-negotiation) */
+ unsigned int pause : 1;
+ /** \brief Partner asym-pause (auto-negotiation) */
+ unsigned int asym_pause : 1;
+ /** \brief The most recently read link state */
+ unsigned int link : 1;
+
+ /** \brief TPI speed or forced 2.5G */
+ unsigned int fixed2g5 : 1;
+
+ /** \brief Enable auto-negotiation.
+ Value 1 to enable auto-negotiation, value 0 to force link */
+ unsigned int autoneg : 1;
+
+ /** \brief Union of GPHY supported modes listed in
+ \ref GPY2XX_LINK_SUPPORTED macros. This is updated when \ref gpy2xx_init
+ is called and should not be changed by the user application. */
+ uint64_t supported;
+ /** \brief Union of GPHY advertising modes listed in
+ \ref GPY2XX_LINK_ADVERTISED macros */
+ uint64_t advertising;
+ /** \brief Union of partner advertising modes listed in
+ \ref GPY2XX_LINK_ADVERTISED macros */
+ uint64_t lp_advertising;
+};
+/**@}*/ /* GPY2XX_LINK_API */
+
+/** \addtogroup GPY2XX_LED */
+/**@{*/
+/** \brief (Macros used by \b id in \ref gpy2xx_led_cfg) */
+/** \brief LED ID 0 */
+#define LED_ID_0 0
+/** \brief LED ID 1 */
+#define LED_ID_1 1
+/** \brief LED ID 2 */
+#define LED_ID_2 2
+/** \brief LED ID 3 (Not applicable to gpy24X) */
+#define LED_ID_3 3
+/** \cond INTERNAL */
+/** \brief Lowest LED value */
+#define LED_ID_MIN LED_ID_0
+/** \brief Highest LED value */
+#define LED_ID_MAX LED_ID_3
+/** \endcond */
+
+/** \brief Macros used by \b color_mode in \ref gpy2xx_led_cfg */
+/** \brief LED color mode */
+enum gpy2xx_led_colormode {
+ /** \brief Ground mode */
+ LED_SINGLE = 0,
+ /** \brief Power mode */
+ LED_DUAL = 1,
+};
+
+/** \cond INTERNAL */
+/** \brief Lowest CM value */
+#define LED_CM_MIN LED_SINGLE
+/** \brief Highest CM value */
+#define LED_CM_MAX LED_DUAL
+/** \endcond */
+
+/** \brief Macros used by \b slow_blink_src or \b fast_blink_src or \b const_on in \ref gpy2xx_led_cfg */
+/** \brief Stats trigger PHY blinking */
+enum gpy2xx_led_bsrc {
+ /** \brief No blinking */
+ LED_BSRC_NONE = 0,
+ /** \brief Blink on 10 Mbps link */
+ LED_BSRC_LINK10 = 1,
+ /** \brief Blink on 100 Mbps link */
+ LED_BSRC_LINK100 = 2,
+ /** \brief Blink on 1000 Mbps link */
+ LED_BSRC_LINK1000 = 4,
+ /** \brief Blink on 2500 Mbps link */
+ LED_BSRC_LINK2500 = 8,
+};
+/** \cond INTERNAL */
+/** \brief Lowest PHY blinking trigger value */
+#define LED_BSRC_MIN LED_BSRC_NONE
+/** \brief Highest PHY blinking trigger value */
+#define LED_BSRC_MAX ((LED_BSRC_LINK2500 << 1) - 1)
+/** \endcond */
+
+/** \brief Macros used by \b pulse in \ref gpy2xx_led_cfg */
+/** \brief LED pulse flags */
+enum gpy2xx_led_pulse {
+ /** \brief No pulsing */
+ LED_PULSE_NONE = 0,
+ /** \brief Generate pulse on LED when TX activity is detected */
+ LED_PULSE_TX = 1,
+ /** \brief Generate pulse on LED when RX activity is detected */
+ LED_PULSE_RX = 2,
+ /** \brief Generate pulse on LED when Collision is detected */
+ LED_PULSE_COL = 4,
+ /** \brief Constant ON behavior is switched off */
+ LED_PULSE_NO_CON = 8,
+};
+/** \cond INTERNAL */
+/** \brief Lowest pulse value */
+#define LED_PULSE_MIN LED_PULSE_NONE
+/** \brief Highest pulse value */
+#define LED_PULSE_MAX ((LED_PULSE_NO_CON << 1) - 1)
+/** \endcond */
+
+/** \cond INTERNAL */
+/** \brief Min discharge slots */
+#define LED_DIS_SLOTS_MIN 0
+/** \brief Max discharge slots */
+#define LED_DIS_SLOTS_MAX 63
+/** \endcond */
+
+/** \cond INTERNAL */
+/** \brief Min brightness level */
+#define LED_BRIGHT_LVL_MIN 0
+/** \brief Max brightness level */
+#define LED_BRIGHT_LVL_MAX 15
+/** \endcond */
+
+/** \brief Data structure for LED configuration */
+struct gpy2xx_led_cfg {
+ /** \brief LED ID (0~3) (\ref GPY2XX_LED)*/
+ int id;
+ /** \brief LED color mode.
+ Valid values are \ref gpy2xx_led_colormode.
+ NOTE: This is for internal use only */
+ enum gpy2xx_led_colormode color_mode;
+ /** \brief Select in which PHY state the LED blinks with slow frequency.
+ Valid values are defined in \ref gpy2xx_led_bsrc enum. */
+ enum gpy2xx_led_bsrc slow_blink_src;
+ /** \brief Select in which PHY state the LED blinks with fast frequency.
+ Valid values are defined in \ref gpy2xx_led_bsrc enum. */
+ enum gpy2xx_led_bsrc fast_blink_src;
+ /** \brief Select in which PHY status the LED is constantly on.
+ Valid values are defined in \ref gpy2xx_led_bsrc enum. */
+ enum gpy2xx_led_bsrc const_on;
+ /** \brief Pulsing configuration.
+ Values (\ref gpy2xx_led_pulse) can be combined with "or". */
+ uint32_t pulse;
+};
+/**@}*/ /* GPY2XX_LED */
+
+/** \addtogroup GPY2XX_INT */
+/**@{*/
+/** \brief Data structure for external interrupt configuration */
+struct gpy2xx_phy_extin {
+ /** \brief Standard interrupt mask. Valid values are defined in
+ \ref gpy2xx_extin_phy_event enum */
+ enum gpy2xx_extin_phy_event std_imask;
+ /** \brief Standard interrupt status. Valid values are defined in
+ \ref gpy2xx_extin_phy_event enum */
+ enum gpy2xx_extin_phy_event std_istat;
+ /** \brief Extended interrupt mask. Valid values are defined in
+ \ref gpy2xx_extin_im2_mask enum */
+ enum gpy2xx_extin_im2_mask ext_imask;
+ /** \brief Extended interrupt status. Valid values are defined in
+ \ref gpy2xx_extin_im2_mask enum */
+ enum gpy2xx_extin_im2_mask ext_istat;
+};
+/**@}*/ /* GPY2XX_INT */
+
+/** \addtogroup GPY2XX_DIAG */
+/**@{*/
+/** \brief Member used by \b results in \ref gpy2xx_cdiag_pair */
+/** \brief Cable diagnostic report of non-trivial echo */
+struct gpy2xx_cdiag_sum {
+ /** \brief Distance in meters */
+ uint8_t distance;
+ /** \brief Pair state (\ref gpy2xx_cdiag_state) */
+ uint8_t state;
+ /** \brief 16-bit signed short integer of the echo coefficient of the first
+ detected peak */
+ int16_t peak;
+};
+
+/** \brief Member used by \b pair in \ref gpy2xx_cdiag_report */
+/** \brief Cable diagnostic report of one pair */
+struct gpy2xx_cdiag_pair {
+ /** \brief Number of valid results in results of \ref gpy2xx_cdiag_pair*/
+ uint16_t num_valid_result;
+ /** \brief Up to 5 non-trivial echos are reported */
+ struct gpy2xx_cdiag_sum results[5];
+ /** \brief 16-bit signed short integer representing the sum-of-square
+ of all XC(0~2) coefficients. This can be used to detect whether
+ the cross-talk level is non-trivial. */
+ int16_t xc_pwr[3];
+};
+
+/** \brief Cable diagnostic report */
+struct gpy2xx_cdiag_report {
+ /** \brief Report of each pair:
+ 0 - DSPA, 1 - DSPB, 2 - DSPC, 3 - DSPD */
+ struct gpy2xx_cdiag_pair pair[4];
+};
+
+/** \brief Member used by \b pair in \ref gpy2xx_abist_report */
+/** \brief Analog built-in self-test report of one pair */
+struct gpy2xx_abist_pair {
+ struct {
+ /** \brief Max ADC noise injection magnitude */
+ uint8_t mag_max;
+ /** \brief Min ADC noise injection magnitude */
+ uint8_t mag_min;
+ /** \brief Average ADC noise injection magnitude */
+ uint8_t mag_avg;
+ /** \brief DC ADC noise injection magnitude */
+ uint8_t mag_dc;
+ }
+ /** \brief ADC noise (ICN_GMAX) */
+ icn_gmax,
+ /** \brief DAC + LD noise (ICN_GMIN) */
+ icn_gmin;
+ struct {
+ /** \brief Measured power at +9/+6/+2/-1/-5/-8 dB gain respectively */
+ uint8_t agc_pwr[6];
+ /** \brief Mean of measured power at +9/+6/+2/-1/-5/-8 dB gain */
+ uint8_t agc_mean;
+ /** \brief Std measured power at +9/+6/+2/-1/-5/-8 dB gain */
+ uint8_t agc_std;
+ }
+ /** \brief Measured power when hybrid ON */
+ agc_hyb,
+ /** \brief Measured power when hybrid OFF */
+ agc_nohyb;
+ struct {
+ /** \brief FFT magnitude at DC */
+ uint8_t dc_mag;
+ /** \brief FFT magnitude at nyquist frequency 100 MHz */
+ uint8_t nyq_mag;
+ /** \brief FFT magnitude at fundamental frequency */
+ uint8_t k1_mag;
+ /** \brief Harmonics K2 */
+ uint8_t k2_mag;
+ /** \brief Harmonics K3 */
+ uint8_t k3_mag;
+ /** \brief Harmonics K4 */
+ uint8_t k4_mag;
+ }
+ /** \brief Measured for 10bt mode with hybrid OFF */
+ nohyb_10bt,
+ /** \brief Measured for 100bt mode with hybrid OFF */
+ nohyb_100bt,
+ /** \brief Measured for 1000bt mode with hybrid ON */
+ hyb_1000bt,
+ /** \brief Measured for 1000bt mode with hybrid OFF */
+ nohyb_1000bt,
+ /** \brief Measured for 2500bt mode with hybrid ON */
+ hyb_2500bt,
+ /** \brief Measured for 2500bt mode with hybrid OFF */
+ nohyb_2500bt;
+};
+
+/** \brief Analog built-in self-test report */
+struct gpy2xx_abist_report {
+ /** \brief Report of each pair:
+ 0 - DSPA, 1 - DSPB, 2 - DSPC, 3 - DSPD */
+ struct gpy2xx_abist_pair pair[4];
+};
+
+/** \brief PCS status */
+struct gpy2xx_pcs_status {
+ /** \brief Bit error rate (BER) */
+ uint32_t ber;
+ /** \brief Number of errored blocks */
+ uint32_t errored_block;
+
+ /** \brief 1 indicates high bit error rate (BER) */
+ uint8_t high_ber;
+ /** \brief 0 indicates loss of block lock */
+ uint8_t block_lock;
+ /** \brief 1 indicates PCS receive link up */
+ uint8_t rcv_link_up;
+};
+/**@}*/ /* GPY2XX_DIAG */
+
+/** \addtogroup GPY2XX_SYNCE */
+/**@{*/
+/** \brief SyncE configuration */
+struct gpy2xx_synce {
+ /** \brief Enable SyncE.
+ Value 1 to enable, value 0 to disable */
+ char synce_enable; // VSPEC1_PM_CTRL.SYNCE_EN, TGU_PDI_PD_CTL.EN
+ /** \brief Select input frequency of reference clock.
+ Valid values are defined in \ref gpy2xx_synce_clk enum */
+ enum gpy2xx_synce_clk synce_refclk;
+ /** \brief Master/slave select.
+ Value 0 to select slave mode, else to select master mode*/
+ enum gpy2xx_synce_master_mode master_sel;
+ /** \brief Data rate (1G or 2.5G) */
+ enum gpy2xx_data_rate data_rate;
+ /** \brief GPC select.
+ Configure GPC and GPIOs */
+ enum gpy2xx_gpc_sel gpc_sel;
+};
+/**@}*/ /* GPY2XX_SYNCE */
+
+/** \addtogroup GPY2XX_MISC */
+/**@{*/
+/** \brief Wake-on-LAN configuration */
+struct gpy2xx_wolinfo {
+ /** \brief Flags for enabled Wake-on-LAN modes.
+ Values (\ref GPY2XX_WOL_FLAG) can be combined with "or".
+ If this is 0, Wake-on-LAN is disabled */
+ uint32_t wolopts;
+ /** \brief Wake-on-LAN designated MAC */
+ uint8_t mac[6];
+ /** \brief Wake-on-LAN SecureON password.
+ This is only meaningful if \ref WAKE_MAGICSECURE is set
+ in wolopts of \ref gpy2xx_wolinfo */
+ uint8_t sopass[6];
+};
+
+/** \brief Macros used by \b no_nrg_rst in \ref gpy2xx_ads_ctrl */
+/** \brief Auto-downspeed configuration */
+enum ads_adv_status {
+ /** \brief Disable advertising all speeds when no energy is detected. */
+ ADS_NO_ENERGY_ADV_DIS = 0,
+ /** \brief Enable advertising all speeds when no energy is detected. */
+ ADS_NO_ENERGY_ADV_EN = 1,
+};
+
+/** \brief Macros used by \b downshift_en in \ref gpy2xx_ads_ctrl */
+/** \brief Auto-downspeed status */
+enum ads_nbt_ds_status {
+ /** \brief downshift, disable */
+ ADS_NBT_DOWNSHIFT_DIS = 0,
+ /** \brief downshift, enable */
+ ADS_NBT_DOWNSHIFT_EN = 1,
+};
+
+/** \brief Macros used by \b downshift_thr in \ref gpy2xx_ads_ctrl */
+/** \brief ADS_DOWNSHIFT THRESHOLD MIN */
+#define ADS_DOWNSHIFT_THR_MIN 0
+/** \brief ADS_DOWNSHIFT THRESHOLD MAX */
+#define ADS_DOWNSHIFT_THR_MAX 15
+
+/** \brief Macros used by \b nrg_rst_cnt in \ref gpy2xx_ads_ctrl */
+/** \brief ADS_DOWNSHIFT COUNTER MIN */
+#define ADS_NRG_RST_CNT_MIN 0
+/** \brief ADS_DOWNSHIFT COUNTER MAX */
+#define ADS_NRG_RST_CNT_MAX 255
+
+/** \brief Macros used by \b force_rst in \ref gpy2xx_ads_ctrl */
+/** \brief Force reset setting */
+enum ads_force_rst_status {
+ /** \brief Wait for timeout before reset capability advertisement. */
+ ADS_FORCE_RST_DIS = 0,
+ /** \brief Reset capability advertisement */
+ ADS_FORCE_RST_EN = 1,
+};
+
+/** \brief Link Speed Auto-downspeed Control. */
+struct gpy2xx_ads_ctrl {
+ /** \brief Auto-downspeed configuration */
+ enum ads_adv_status no_nrg_rst;
+ /** \brief Auto-downspeed status */
+ enum ads_nbt_ds_status downshift_en;
+ /** \brief NBASE-T Downshift Training Counter Threshold, 0 - 15 */
+ uint16_t downshift_thr;
+ /** \brief Force Reset of Downshift Process, 0-disable /1-enable */
+ enum ads_force_rst_status force_rst;
+ /** \brief Timer to Reset the Downshift process, 0 - 255 */
+ uint8_t nrg_rst_cnt;
+};
+
+/** \brief Auto-downspeed status & config */
+struct gpy2xx_ads_sta {
+ /** \brief Training attempt counter, the number of attempt, when hit downshift_thr, downshift speed */
+ uint8_t downshift_cnt;
+ /** \brief Downshift from 2.5 G to lower speed, 0-no downshift / 1-downshift */
+ uint8_t downshift_2G5;
+ /** \brief Downshift from 1 G to lower speed, 0-no downshift / 1-downshift */
+ uint8_t downshift_1G;
+ /** \brief ads control config */
+ struct gpy2xx_ads_ctrl ads_ctrl;
+};
+/**@}*/ /* GPY2XX_MISC */
+
+/** \addtogroup GPY2XX_INIT */
+/**@{*/
+/** \brief Macros used by \b fw_memory in \ref gpy2xx_id */
+/** \brief Indicates the memory target used for firmware execution */
+enum gpy2xx_fwboot_mode {
+ /** \brief Firmware is executed from ROM */
+ FW_EXECUTED_FROM_ROM = 0,
+ /** \brief Firmware is executed from OTP (OneTimeProgram memory) */
+ FW_EXECUTED_FROM_OTP = 1,
+ /** \brief Firmware is executed from FLASH */
+ FW_EXECUTED_FROM_FLASH = 2,
+ /** \brief Firmware is executed from SRAM (GPY24x only) */
+ FW_EXECUTED_FROM_SRAM = 3,
+};
+
+/** \brief Member used by \b id in \ref gpy2xx_device */
+/** \brief GPHY ID information such as manufacturer data, firmware or API version */
+struct gpy2xx_id {
+ /** \brief PHY organizationally unique identifier */
+ uint32_t OUI;
+ /** \brief PHY manufacturer's model number */
+ uint8_t model_no;
+ /** \brief PHY manufacturer's model family */
+ uint8_t family;
+ /** \brief PHY revision number */
+ uint8_t revision;
+
+ /** \brief The most recently read firmware release indication:
+ 0 - test version, 1 - released version */
+ unsigned int fw_release : 1;
+ /** \brief The most recently read firmware major version number */
+ unsigned int fw_major : 7;
+ /** \brief The most recently read firmware minor version number */
+ uint8_t fw_minor;
+ /** \brief The memory target used for firmware execution, valid from FW 8747 onwards only.
+ Valid values are defined in \ref gpy2xx_fwboot_mode enum */
+ enum gpy2xx_fwboot_mode fw_memory;
+
+ /** \brief API major version number */
+ uint16_t drv_major;
+ /** \brief API minor version number */
+ uint16_t drv_minor;
+ /** \brief API release indication:
+ 0 - test version, 1 - general available (GA) release,
+ >= 2 - maintenance release (MR) */
+ uint16_t drv_release;
+ /** \brief The most recently read firmware patch indication:
+ 1 - GA/MR release, >= 2 - patch release */
+ uint16_t drv_patch;
+};
+/**@}*/ /* GPY2XX_INIT */
+
+/** \addtogroup GPY2XX_MISC */
+/**@{*/
+/** \brief GPHY temperature information */
+struct gpy2xx_pvt {
+ /** \brief GPHY temperature in degree Celsius scale */
+ int temperature;
+};
+/**@}*/ /* GPY2XX_MISC */
+
+/** \addtogroup GPY2XX_GPY2XX_USXGMII */
+/**@{*/
+enum gpy2xx_eye_scope_sel {
+ SCOPE_SEL_ATT = 0,
+ SCOPE_SEL_DFE = 1,
+ SCOPE_SEL_MAX
+};
+
+enum gpy2xx_eye_dbg_opt {
+ SCOPE_EYE_DBG_DISABLED = 0,
+ SCOPE_EYE_DBG_ALL_MSG_OUT = 1,
+ SCOPE_EYE_DBG_CORR_DATA_ONLY = 2,
+ SCOPE_EYE_DBG_MAX
+};
+
+/** \brief USXGMII 4-point eye test parameter.
+ * Used by \ref gpy2xx_usxgmii_4peye_start and
+ * \ref gpy2xx_usxgmii_4peye_cfg_get.and
+ * \ref gpy2xx_usxgmii_fsweep_start and
+ * \ref gpy2xx_usxgmii_fsweep_cfg_get
+ */
+struct gpy2xx_4peye_cfg {
+ /** \brief Bit Error Rate (BER) target in exp.
+ * For example BERT target 1E-9 if ber = 9.
+ * 4~12 is supported in current implementation.
+ */
+ uint16_t ber;
+ /** \brief number of error bits index,
+ * the indexed max error counter value will be different for the different BER target
+ * only 1, 2, 3 are supported
+ */
+ uint16_t errbit;
+ /** \brief Optimization mode.
+ * Value 'true' to do 1E-9 with same number of error bits
+ * to get result range, then sweep the smaller range
+ * with give BER target.
+ */
+ bool is_opt;
+ /** \brief Measurement time (optional).
+ * Measurement time for each data point.
+ * If this is 0, a default time calculated based BER target
+ * and number of error bits is used.
+ */
+ uint32_t mtime;
+};
+
+/** \brief USXGMII scope eye test parameter.
+ * Used by \ref gpy2xx_usxgmii_scope_start
+ */
+struct gpy2xx_scope_cfg {
+ /** \brief debug option, for the WSP UART printing control
+ * \ref gpy2xx_eye_dbg_opt defination
+ * 0: disable debug message printing to WSP terminal UART
+ * 1: print all debug message and also scope sweep correlation data to terminal,
+ * the scope sweep correlation data can be used for the python plot code to plot the eye diagram
+ * 2: only print scope sweep correlation data to terminal, NO debug message printing.
+ */
+ uint8_t dbg_opt;
+ /** \brief scope select
+ * \ref gpy2xx_eye_scope_sel defination
+ * 0: ATT scope eye
+ * 1: DFE scope eye
+ */
+ uint8_t scope_sel;
+ uint8_t rsv1;
+ uint8_t rsv2;
+};
+
+/** \brief USXGMII 4-point eye test result return data structure.
+ * Used by \ref gpy2xx_usxgmii_4peye_result.
+ */
+struct gpy2xx_4peye_result {
+ /** \brief Running state.
+ * < 0 - error code
+ * = 0 - not started
+ * = 1 - running
+ * = 2 - completed with valid result
+ */
+ int ret;
+ /** \brief Running state.
+ * left of 4-point eye in UI.
+ */
+ int left;
+ /** \brief Running state.
+ * right of 4-point eye in UI.
+ */
+ int right;
+ /** \brief Running state.
+ * top of 4-point eye in 3.125mV.
+ */
+ int top;
+ /** \brief Running state.
+ * bottom of 4-point eye in 3.125mV.
+ */
+ int bottom;
+ /** \brief Measurement time in milliseconds (ms).
+ */
+ uint32_t time;
+};
+
+/** \brief USXGMII full sweep or scope sweep test state and data buffer info structure.
+ * Used by \ref gpy2xx_usxgmii_fsweep_result.
+ * and \ref gpy2xx_usxgmii_scope_result.
+ * for full sweep and scope eye sweep, the result only for the running state and buffer info, the sweep data is NOT included
+ */
+struct gpy2xx_sweep_sts_buff_info {
+ /** \brief Running state.
+ * < 0 - error code
+ * = 0 - not started
+ * = 1 - running
+ * = 2 - completed with valid result
+ */
+ int ret;
+ /** \brief buffer address
+ * include the extra 16 bytes gphy_wsp data exchange..
+ */
+ uint32_t buff_addr;
+ /** \brief buffer size
+ * include the extra 16 bytes gphy_wsp data exchange, uint is byte
+ * for the detail, refer to the SRAM_SERDES_DATA_BUFF_SIZE or SRAM_SERDES_SCOPE_EYE_BUFF_SIZE comment in the gphy_wsp_com.h
+ */
+ uint32_t buff_size;
+
+ /** \brief Measurement time in milliseconds (ms).
+ */
+ uint32_t time;
+};
+
+/** \brief USXGMII eye test result common structure.
+ * Used by \ref gpy2xx_usxgmii_4peye_result
+ * and \ref gpy2xx_usxgmii_fsweep_result.
+ * and \ref gpy2xx_usxgmii_scope_result.
+ */
+
+union gpy2xx_eye_result {
+ struct gpy2xx_4peye_result fpeye_result;
+ struct gpy2xx_sweep_sts_buff_info fsweep_result;
+ struct gpy2xx_sweep_sts_buff_info scope_result;
+};
+
+/**@}*/ /* GPY2XX_GPY2XX_USXGMII */
+
+/** \addtogroup GPY2XX_INIT */
+/**@{*/
+
+/** \brief Data structure representing the GPHY entity. The user application uses this
+ struct to communicate with GPHY APIs.*/
+struct gpy2xx_device {
+ /**
+ \brief Function called by API when entering an API function.
+ The user application should implement this function for resource protection
+ in a multi-threaded application, or NULL for a single-threaded application.
+
+ \param lock_data Pointer to user data provided by the user application in
+ lock_data of \ref gpy2xx_device.
+
+ \return No return value.
+ */
+ void (*lock)(void *lock_data);
+
+ /**
+ \brief Function called by API when leaving an API function.
+ The user application should implement this function for resource protection
+ in a multi-threaded application, or NULL for a single-threaded application.
+
+ \param lock_data Pointer to user data provided by the user application in
+ lock_data of \ref gpy2xx_device.
+
+ \return No return value.
+ */
+ void (*unlock)(void *lock_data);
+
+ /** \brief User data for lock, unlock of \ref gpy2xx_device. The user application
+ should provide proper value before calling any GPHY APIs. */
+ void *lock_data;
+
+ /**
+ \brief Function for MDIO read operation on MDIO bus. The user application
+ must implement this function for a GPHY API accessing the MDIO device.
+ Both Clause 22 and Clause 45 addressing should be supported. If the MDIO
+ master does not support Clause 45 addressing, the user application should
+ use MMD indirect access registers at 0x13 and 0x14 for the implementation.
+
+ \param mdiobus_data Pointer to user data provided by the user application
+ in mdiobus_data of \ref gpy2xx_device.
+
+ \param addr This is the PHY address.
+
+ \param regnum In Clause 22, this is 5-bit register number to be written.
+ In Clause 45, bits 0~15 are the register number, bits 16~20 are the device address
+ (MMD) to be written to, and bit 30 is a flag \ref MII_ADDR_C45 to indicate Clause 45 type.
+
+ \return
+ - >=0: register value
+ - <0: error code
+ */
+ int (*mdiobus_read)(void *mdiobus_data, uint16_t addr, uint32_t regnum);
+
+ /**
+ \brief Function for MDIO write operation on MDIO bus. The user application
+ must implement this function for a GPHY API accessing the MDIO device.
+ Both Clause 22 and Clause 45 addressing should be supported. If the MDIO
+ master does not support Clause 45 addressing, the user application should
+ use MMD indirect access registers at 0x13 and 0x14 for the implementation.
+
+ \param mdiobus_data Pointer to user data provided by user application
+ in mdiobus_data of \ref gpy2xx_device.
+
+ \param addr This is the PHY address.
+
+ \param regnum In Clause 22, this is 5-bit register number to be written.
+ In Clause 45, bits 0~15 are the register number, bits 16~20 are the device address
+ (MMD) to be written to, and bit 30 is a flag \ref MII_ADDR_C45 to indicate Clause 45 type.
+
+ \param val This is 16-bit value to be written to register.
+
+ \return
+ - 0: successful
+ - <0: error code
+ */
+ int (*mdiobus_write)(void *mdiobus_data, uint16_t addr, uint32_t regnum, uint16_t val);
+
+ /** \brief User data for mdiobus_read and mdiobus_write of
+ \ref gpy2xx_device. The user application must provide proper
+ value before calling any GPHY APIs. */
+ void *mdiobus_data;
+
+ /** \brief Slave MDIO address for internal register access.
+ Default value is 0x1F. The user application must provide proper value
+ before calling any GPHY APIs. The value must be the same as
+ SMDIO_PDI_SMDIO_REGISTERS_SMDIO_CFG.ADDR. */
+ uint8_t smdio_addr;
+
+ /** \brief This is the GPHY address for Standard MDIO and MMD register access.
+ This address is from PMU_PDI_REGISTERS_GPHY_GPS1.MDIO_PHY_ADDR
+ which is pin-strapped. The user application must call \ref gpy2xx_init
+ before any other APIs for initialization. */
+ uint8_t phy_addr;
+
+ /** \brief This is private data for GPHY APIs. The user application must call
+ \ref gpy2xx_init before any other APIs for initialization. And call
+ \ref gpy2xx_uninit to free the device when cleaning up. */
+ void *priv_data;
+
+#if IS_ENABLED(CONFIG_GPY_SHARED_DATA)
+ /**
+ \brief Pointer to data structure.
+ For most users, this is NULL. This is a workaround for
+ applications that have multiple processes, a separate address for
+ each process and share the data section. In this case, the user
+ needs to provide the data pointer referring to the shared data. Only fields
+ id, link, and wol_supported of \ref gpy2xx_device in the shared data are used.
+ */
+ struct gpy2xx_device *shared_data;
+#endif
+
+ /** \brief PHY ID */
+ struct gpy2xx_id id;
+
+ /** \brief Link configuration and status. The user application uses
+ APIs defined in \ref GPY2XX_LINK_API, such as \ref gpy2xx_config_advert,
+ \ref gpy2xx_setup_forced, \ref gpy2xx_restart_aneg,
+ \ref gpy2xx_config_aneg, \ref gpy2xx_aneg_done, \ref gpy2xx_update_link,
+ and \ref gpy2xx_read_status for configuration purposes or to read out information. */
+ struct gpy2xx_link link;
+
+ /** \brief Flags for supported Wake-on-LAN modes.
+ Values (\ref GPY2XX_WOL_FLAG) can be combined with "or" */
+ uint32_t wol_supported;
+ /** \brief SyncE capable (value 1) or not capable (value 0) */
+ unsigned int synce_supported : 1;
+ /** \brief MACsec capable (value 1) or not capable (value 0) */
+ unsigned int macsec_supported : 1;
+ /** \brief Allows forcing of master or slave mode manually. Applicaple when
+ choosing forced link speed of 2.5G or 1G only */
+ unsigned int mstr_slave : 1;
+};
+/**@}*/ /* GPY2XX_INIT */
+
+/** @cond INTERNAL */
+/** \brief CHIP ID supported */
+#define ID_P31G 0x00
+#define ID_P34X 0x08
+#define ID_P34X_LGS 0x0E
+/** @endcond */
+
+
+/**********************
+ APIs
+ **********************/
+/** \addtogroup GPY2XX_MDIO */
+/**@{*/
+/** @cond INTERNAL */
+/**
+ \brief API for Slave MDIO read operation.
+ \details The user application uses this API to read the internal registers
+ of the GPHY.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param regaddr 16-bit register number.
+
+ \return
+ - >=0: register value
+ - <0: error code
+*/
+static inline int gpy2xx_smdio_read(struct gpy2xx_device *phy, uint32_t regaddr)
+{
+ int ret;
+
+ if (phy == NULL)
+ return -EINVAL;
+
+ ret = phy->mdiobus_write(phy->mdiobus_data, phy->smdio_addr,
+ SMDIO_BADR, regaddr);
+
+ if (ret < 0)
+ return ret;
+
+ return phy->mdiobus_read(phy->mdiobus_data, phy->smdio_addr, SMDIO_TOFF);
+}
+
+/**
+ \brief API for Slave MDIO write operation.
+ \details The user application uses this API to write to the internal
+ registers of the GPHY.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param regaddr 16-bit register number.
+
+ \param data 16-bit value to be written.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+static inline int gpy2xx_smdio_write(struct gpy2xx_device *phy, uint32_t regaddr,
+ uint16_t data)
+{
+ int ret;
+
+ if (phy == NULL)
+ return -EINVAL;
+
+ ret = phy->mdiobus_write(phy->mdiobus_data, phy->smdio_addr,
+ SMDIO_BADR, regaddr);
+
+ if (ret < 0)
+ return ret;
+
+ return phy->mdiobus_write(phy->mdiobus_data, phy->smdio_addr,
+ SMDIO_TOFF, data);
+}
+
+/**
+ \brief Debug API for reading individual MDIO register of PHY/STD device.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param regaddr 16-bit register number.
+
+ \return
+ - >=0: register value
+ - <0: error code
+*/
+static inline int gpy2xx_read(struct gpy2xx_device *phy, uint32_t regaddr)
+{
+ if (phy == NULL)
+ return -EINVAL;
+
+ return phy->mdiobus_read(phy->mdiobus_data, phy->phy_addr, regaddr);
+}
+
+/**
+ \brief Debug API for writing individual MDIO register of PHY/STD device.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param regaddr 16-bit register number.
+
+ \param data 16-bit value to be written to given 'regaddr' address.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+static inline int gpy2xx_write(struct gpy2xx_device *phy, uint32_t regaddr,
+ uint16_t data)
+{
+ if (phy == NULL)
+ return -EINVAL;
+
+ return phy->mdiobus_write(phy->mdiobus_data, phy->phy_addr,
+ regaddr, data);
+}
+
+/**
+ \brief Debug API for reading individual register of an MMD device.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param devtype The MMD (MDIO Manageable Device) to read from.
+
+ \param regaddr 16-bit register number on the MMD.
+
+ \return
+ - >=0: register value
+ - <0: error code
+*/
+static inline int gpy2xx_read_mmd(struct gpy2xx_device *phy, uint8_t devtype,
+ uint16_t regaddr)
+{
+ uint32_t regnum;
+
+ if (phy == NULL || devtype > 31)
+ return -EINVAL;
+
+ regnum = MII_ADDR_C45 | (devtype << 16) | (regaddr & 0xffff);
+ return phy->mdiobus_read(phy->mdiobus_data, phy->phy_addr, regnum);
+}
+
+/**
+ \brief Debug API for writing individual register of an MMD device.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param devtype The MMD (MDIO Manageable Device) to write to.
+
+ \param regaddr 16-bit register number on the MMD.
+
+ \param data 16-bit value to be written to given 'regaddr' address.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+static inline int gpy2xx_write_mmd(struct gpy2xx_device *phy, uint8_t devtype,
+ uint16_t regaddr, uint16_t data)
+{
+ uint32_t regnum;
+
+ if (phy == NULL || devtype > 31)
+ return -EINVAL;
+
+ regnum = MII_ADDR_C45 | (devtype << 16) | (regaddr & 0xffff);
+ return phy->mdiobus_write(phy->mdiobus_data, phy->phy_addr,
+ regnum, data);
+}
+
+/**
+ \brief Debug API to read 16-bit wide data from Smart-AZ subsystem registers
+ such as Buffer Manager, LED Control and Temperature Sensor.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+ \param regaddr Register (AHB bus) address.
+ \param data Pointer to store read data.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_mbox_read16(struct gpy2xx_device *phy, uint32_t regaddr,
+ uint16_t *data);
+
+/**
+ \brief Debug API to write 16-bit wide data into Smart-AZ subsystem registers
+ such as Buffer Manager, LED Control and Temperature Sensor.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+ \param regaddr Register (AHB bus) address.
+ \param data Data to be written to given 'regaddr' address.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_mbox_write16(struct gpy2xx_device *phy, uint32_t regaddr,
+ uint16_t data);
+
+/**
+ \brief Debug API to read 32-bit wide data from Smart-AZ subsystem registers
+ of MACSec module.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+ \param regaddr Register (AHB bus) address.
+ \param data Pointer to store read data.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_mbox_read32(struct gpy2xx_device *phy, uint32_t regaddr,
+ uint32_t *data);
+
+/**
+ \brief Debug API to write 32-bit wide data into Smart-AZ subsystem registers
+ of MACSec module.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+ \param regaddr Register (AHB bus) address.
+ \param data Data to be written to given 'regaddr' address.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_mbox_write32(struct gpy2xx_device *phy, uint32_t regaddr,
+ uint32_t data);
+/** @endcond */
+
+/**
+ \brief Debug API to read XPCS register.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+ \param regaddr XPCS register address (byte address).
+ \param data Pointer to store read data.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_xpcs_read(struct gpy2xx_device *phy, uint32_t regaddr,
+ uint16_t *data);
+
+/**
+ \brief Debug API to write XPCS register.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+ \param regaddr XPCS register address (byte address).
+ \param data Data to be written to given 'regaddr' address.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_xpcs_write(struct gpy2xx_device *phy, uint32_t regaddr,
+ uint16_t data);
+
+/**
+ \brief Debug API to read SERDES register via XPCS CR access.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+ \param regaddr SERDES register address (byte address).
+ \param data Pointer to store read data.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_serdes_read(struct gpy2xx_device *phy, uint32_t addr,
+ uint16_t *data);
+
+/**
+ \brief Debug API to write SERDES register via XPCS CR access.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+ \param regaddr SERDES register address (byte address).
+ \param data Data to be written to given 'regaddr' address.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_serdes_write(struct gpy2xx_device *phy, uint32_t addr,
+ uint16_t data);
+/**@}*/ /* GPY2XX_MDIO */
+
+/** \addtogroup GPY2XX_INIT */
+/**@{*/
+
+/**
+ \brief Initialization.
+ \details This is the first API called by the user application before any other API.
+ This API checks for MDIO access to the given PHY address and verifies the OUI
+ (Operationally Unique ID). It reads and stores other information, such as manufacturer data,
+ firmware/API version, default supported & advertised link configuration & status. This is
+ filled into the \ref gpy2xx_device structure. The user application must provide
+ proper values/function-pointers for mdiobus_read, mdiobus_write, mdiobus_data,
+ and smdio_addr in the \ref gpy2xx_device structure.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_init(struct gpy2xx_device *phy);
+
+/**
+ \brief Cleanup.
+ \details This is last API called by the user application for un-initialization purposes.
+ The application has to implement/modify this API to unconfigure/release resources,
+ disable interrupts etc.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+*/
+int gpy2xx_uninit(struct gpy2xx_device *phy);
+
+/**
+ \brief Resets the PHY to its default state.
+ \details Triggers a soft reset. Active links are terminated.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_soft_reset(struct gpy2xx_device *phy);
+
+/**
+ \brief Poll PHY reset status
+ \details The user application uses \ref gpy2xx_soft_reset to trigger a soft reset.
+ Afterwards it uses this API to poll every few milliseconds (e.g. every 50 ms) to determine when the reset has completed,
+ i.e. until a positive value is returned.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - >0: reset complete
+ - =0: reset incomplete
+ - <0: error code
+*/
+int gpy2xx_poll_reset(struct gpy2xx_device *phy);
+/**@}*/ /* GPY2XX_INIT */
+
+/** \addtogroup GPY2XX_LINK_API */
+/**@{*/
+/**
+ \brief Configures the link advertisement parameters.
+ \details It writes MII_ADVERTISE with the appropriate values, after masking the advertising parameter values
+ to make sure that only the parameters supported by the firmware are advertised. The user must call \ref gpy2xx_restart_aneg
+ to make sure the effective paramaters will be advertised to the link partner.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - >0: advertisement is changed successfully
+ - =0: advertisement is not changed
+ - <0: error code
+*/
+int gpy2xx_config_advert(struct gpy2xx_device *phy);
+
+/**
+ \brief Forcefully sets the link speed and duplex mode.
+ \details It configures the PHY to forcefully set the link speed and duplex.
+ This disables the auto-negotiation at this node and the user application must set
+ the link partner's speed and duplex mode forcefully at the other end of the link node.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_setup_forced(struct gpy2xx_device *phy);
+
+/**
+ \brief Enable and restart standard auto-negotiation.
+ \details The user application must call this API to restart standard auto-negotiation,
+ and also to make sure the effective parameters are set in
+ \ref gpy2xx_config_advert. These will be advertised to the link partner when auto-negotiation is restarted.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_restart_aneg(struct gpy2xx_device *phy);
+
+/**
+ \brief Enable & restart auto-negotiation or set link speed & duplex
+ forcefully dependending on given autoneg of \ref gpy2xx_link.
+ \details If autoneg is 1, this API calls \ref gpy2xx_config_advert and
+ \ref gpy2xx_restart_aneg to advertise and restart auto-negotiation.
+ If autoneg is 0, \ref gpy2xx_setup_forced is used to set link speed and duplex
+ forcefully. In this case, the auto-negotiation is disabled and it is the responsibility of the user
+ application to take care of setting the same speed and duplex for the link partner so that the
+ link is UP and running, otherwise the link will be DOWN.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_config_aneg(struct gpy2xx_device *phy);
+
+/**
+ \brief Gets the restarted auto-negotiation status.
+ \details The user application must call and check to see if auto-negotiation has completed
+ before reading the link status \ref gpy2xx_read_status after auto-negotiation was restarted
+ using \ref gpy2xx_restart_aneg.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =1: auto-negotiation is done
+ - =0: auto-negotiation is incomplete or there was an error during negotiation
+ - <0: error code
+*/
+int gpy2xx_aneg_done(struct gpy2xx_device *phy);
+
+/**
+ \brief Updates the current link state of UP or DOWN link of \ref gpy2xx_link
+ link state.
+ \details The user application can call this API to only update the link state (UP or DOWN)
+ in the variable 'link' of \ref gpy2xx_link.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_update_link(struct gpy2xx_device *phy);
+
+/**
+ \brief Reads and updates the link parameters and status.
+ \details The user application can call this API to read and update the link parameters
+ of this and the partner node. It also updates the link state of this node.
+ If autoneg is 0, speed and duplex of \ref gpy2xx_link are retrieved from PHY.
+ If autoneg is 1, link partner information is updated in lp_advertising,
+ speed, duplex, pause, and asym_pause of \ref gpy2xx_link.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_read_status(struct gpy2xx_device *phy);
+
+/**
+ \brief Reads and updates the PHY FW parameters and boot status.
+ \details The user application can call this API to read and update the most recently
+ updated FW parameters, like Firmware major & minor version, Firmware release indication
+ of test vs engineered and the memory target used for firmware execution.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: Firmware is executed from ROM
+ - =1: Firmware is executed from OTP (OneTimeProgram memory)
+ - =2: Firmware is executed from FLASH
+ - =3: Firmware is executed from SRAM (GPY24x only)
+ - <0: error code
+*/
+int gpy2xx_read_fw_info(struct gpy2xx_device *phy);
+/**@}*/ /* GPY2XX_LINK */
+
+/** \addtogroup GPY2XX_LED */
+/**
+ \brief Configures the given LED specific function.
+ \details Use this API to assign an LED configuration to specific PHY
+ activities of given link rates as details below.
+
+ This API configures the behavior of the LED0 depending on pre-defined states
+ or events the PHY has entered into or raised. Since more than one event or
+ state can be active at the same time, more than one function might apply
+ simultaneously. The priority from highest to lowest is given by the order
+ pulseFlags, slowBlinkSrc, fastBlinkSrc, constantlyOn. LED pulseFlags for the
+ selected activity is displayed only for the link speed selected in
+ constantlyOn. If constantlyOn is selected as NONE then pulseFlags is not
+ displayed on LED for any activity. To avoid constant ON when LED is
+ configured for pulsing alone then set NO_CON bit in pulseFlags field.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param cfg Pointer to given LED config \ref gpy2xx_led_cfg.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_led_if_cfg(struct gpy2xx_device *phy,
+ struct gpy2xx_led_cfg *cfg);
+/**@}*/ /* GPY2XX_LED */
+
+/** \addtogroup GPY2XX_INT */
+/**@{*/
+/**
+ \brief Enable/disable SoC external interrupt event source.
+ \details Use this API to config various events to generate MDINT external
+ interrupt to SoC, including PHY specific, PTP and MACSec events.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param extin Pointer to EXT interrupt event source (\ref gpy2xx_phy_extin).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_extin_mask(struct gpy2xx_device *phy,
+ struct gpy2xx_phy_extin *extin);
+
+/**
+ \brief Gets configured SoC external interrupt source.
+ \details Use this API to get various events set by \ref gpy2xx_extin_mask to
+ generate MDINT external interrupt to SoC, including PHY specific, PTP and MACSec events.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param extin Pointer to EXT interrupt event source \ref gpy2xx_phy_extin.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_extin_get(struct gpy2xx_device *phy,
+ struct gpy2xx_phy_extin *extin);
+/**@}*/ /* GPY2XX_INT */
+
+/** \addtogroup GPY2XX_DIAG */
+/**@{*/
+/**
+ \brief Sets PHY test mode.
+ \details Use this API to test modes of PHY, such as transmit waveform,
+ transmit jitter in master or slave mode, transmitter distortion and AFE test.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+ \param mode PHY test mode (\ref gpy2xx_test_mode)
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_test_mode_cfg(struct gpy2xx_device *phy,
+ enum gpy2xx_test_mode mode);
+
+/**
+ \brief Starts cable diagnostics test.
+ \details Use this API to test cable diagnostics, such as cable open/short detection
+ and cable length estimation.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_cdiag_start(struct gpy2xx_device *phy);
+
+/**
+ \brief Gets cable diagnostics test report.
+ \details The user application needs to call this API once after it starts CDIAG using
+ \ref gpy2xx_cdiag_start, to get cable diagnostics such as cable open/short detection
+ and cable length estimation.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param report Pointer to cabe diagnostics report (\ref gpy2xx_cdiag_report).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_cdiag_read(struct gpy2xx_device *phy,
+ struct gpy2xx_cdiag_report *report);
+
+/**
+ \brief Stops cable diagnostics or abist test.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_cdiag_abist_stop(struct gpy2xx_device *phy);
+
+/**
+ \brief Starts analog built-in self-test (ABIST)
+ \details The analog BIST is a feature that enables internal testing & qualification of
+ the analog parts of the device, especially the line drivers (LD), analog gain controls (AGC)
+ and ADC/DAC, without the need for expensive analog production testing equipment.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param param Pointer to ABIST paramters (\ref gpy2xx_abist_param).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_abist_start(struct gpy2xx_device *phy,
+ enum gpy2xx_abist_test test);
+
+/**
+ \brief Gets analog built-in self-test (ABIST) report.
+ \details The user application needs to call this API once after it starts ABIST using
+ \ref gpy2xx_abist_start, in order to get the ABIST report on, for example, the line drivers(LD),
+ analog gain controls (AGC) and ADC/DAC.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param report Pointer to ABIST report (\ref gpy2xx_abist_report).
+ (\ref gpy2xx_abist_report).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_abist_read(struct gpy2xx_device *phy,
+ struct gpy2xx_abist_report *report);
+
+/**
+ \brief Configures various loopback test modes.
+ \details Most loopback mode settings only take effect after a
+ link down/up event has taken place.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param tloop PHY Loopback test mode (\ref gpy2xx_test_loop)
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_loopback_cfg(struct gpy2xx_device *phy,
+ enum gpy2xx_test_loop tloop);
+
+/**
+ \brief Configure errors/events to be counted.
+ \details The error/event is counted using an 8-bit counter. The counter
+ is cleared every time \ref gpy2xx_errcnt_read is called. This counter
+ saturates at the value 255 (0xFF).
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param event Error/event to be counted (\ref gpy2xx_errcnt_event).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_errcnt_cfg(struct gpy2xx_device *phy,
+ enum gpy2xx_errcnt_event event);
+
+/**
+ \brief Reads error/event counters.
+ \details The source is configured with \ref gpy2xx_errcnt_cfg.
+ The error/event is counted using a 8-bit counter. The counter
+ is cleared every time this API is called. This counter
+ saturates at the value 255 (0xFF).
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - 255: saturated
+ - >=0: successful and value is counter
+ - <0: error code
+*/
+int gpy2xx_errcnt_read(struct gpy2xx_device *phy);
+
+/**
+ \brief Gets PCS status.
+ \details Read MMD registers 3.32, 3.33, 3.44, 3.45.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param status Point to get status (\ref gpy2xx_pcs_status).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_pcs_status_read(struct gpy2xx_device *phy,
+ struct gpy2xx_pcs_status *status);
+/**@}*/ /* GPY2XX_DIAG */
+
+/** \addtogroup GPY2XX_SYNCE */
+/**@{*/
+/**
+ \brief Configures SyncE function.
+ \details Synchronous Ethernet interface to support transportation of a source-referable
+ clock from the server to the end-points. Essentially, it consist of a reference clock input
+ and a reference clock output. The GPY2xx works as a reference clock master by accepting an input
+ reference clock and transporting this clock frequency via the signalling on the twisted pair interface.
+ As a reference clock slave, the GPY2xx will recover the clock and derive an output reference clock.
+ The GPY2xx provides a means of detecting the loss of reference clock input.
+ For the SoC integrators: there are two possible connections for this interface:
+ - If the SoC is capable of generating the reference clocks to be transported, then an internal connection
+ is all that is required.
+ - If the SoC is intended to also accept or provide reference clocks, then pad connectivity to
+ REFCLKO/REFCLKI should be provided.
+
+ Note:The GPY2xx provides both REFCLKO and REFCLKI to meet both reference clock master and reference clock slave requirements.
+ SoC integrators may choose, depending on their system needs, to provide either one or both at the chip-level pinning.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param cfg SyncE configuration (\ref gpy2xx_synce).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_synce_cfg(struct gpy2xx_device *phy, struct gpy2xx_synce *cfg);
+/**@}*/ /* GPY2XX_SYNCE */
+
+/** \addtogroup GPY2XX_MISC */
+/**@{*/
+/**
+ \brief Configures Wake-on-LAN function.
+ \details Wake-on-LAN (WoL) is a feature that is capable of monitoring and
+ detecting WoL packets. The PHY issues a wake-up indication, via the external interrupt
+ sourced by the GPY2xx to the SoC, by activating the MDINT signal to wake a larger SoC from
+ its power-down state. The most commonly used WoL packet is a magic packet that contains
+ the MAC address of the device that is to be woken up. The wolopts of \ref gpy2xx_wolinfo
+ will be updated to the options that have been successfully configured into the hardware
+ after API called.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param wol Pointer to Wake-On-Lan configuration (\ref gpy2xx_wolinfo).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_wol_cfg(struct gpy2xx_device *phy, struct gpy2xx_wolinfo *wol);
+
+/**
+ \brief Configures auto-downspeed (ADS) function.
+ \details The ADS feature ensures maximum interoperability in specific situations, such as, information
+ available about the cabling during ANEG is insufficient, the integrity of received signals
+ is not suitable for link-up due to increased alien noise, or over-length cables.
+ The ADS feature avoids continuous link-up failures in such situations, and the next link-up will be
+ done at the next advertised speed below 1000 Mbit/s.
+
+ If the link only supports speeds of 1000 Mbit/s or 2500 Mbit/s, the ADS feature is automatically disabled.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param ads Holds auto-downspeed configuration (\ref gpy2xx_ads_sta).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_ads_cfg(struct gpy2xx_device *phy, struct gpy2xx_ads_ctrl *ads);
+
+/**
+ \brief Gets auto-downspeed (ADS) detected status.
+ \details Gets whether the ADS has happened at all due to harsh or inadequate cable
+ infrastructure environments. The number of times the GPY2xx decided to downspeed the link
+ is counted and available as statistics via the \ref gpy2xx_errcnt_cfg for event = 9.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - >0: successful and auto-downspeed is detected
+ - =0: successful but no auto-downspeed is detected
+ - <0: error code
+*/
+int gpy2xx_ads_detected(struct gpy2xx_device *phy);
+
+/**
+ \brief Gets the GPY2xx's sensor temperature in degrees Celsius.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param pvt Pointer to on-chip sensor temperature (\ref gpy2xx_pvt).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_pvt_get(struct gpy2xx_device *phy, struct gpy2xx_pvt *pvt);
+/**@}*/ /* GPY2XX_MISC */
+
+/** \addtogroup GPY2XX_GPY2XX_USXGMII */
+/**@{*/
+/**
+ \brief Enter or exit USXGMII debug mode.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. When entering debug mode, GPY2xx device prepares environment
+ for EQ tuning. This must be first step before running any
+ USXGMII (XPCS/SERDES) register access and related test functions/APIs.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param is_exit Value 'false' to 'enter' and 'true' to leave.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_dbg_enter(struct gpy2xx_device *phy, bool is_exit);
+
+/**
+ \brief Start 4-point eye test on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. Start to run 4-point eye test on USXGMII with given
+ parameters. \ref gpy2xx_usxgmii_dbg_enter must be called to
+ enter debug mode before this API. 4-point eye test takes
+ long time for higher BER target.
+ Use \ref gpy2xx_usxgmii_4peye_poll to check whether the test
+ is completed.
+ Use \ref gpy2xx_usxgmii_4peye_cancel to cancel the test
+ if it's too long to wait for.
+ Use \ref gpy2xx_usxgmii_4peye_result to retrieve the test result.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param pcfg Refer to \ref gpy2xx_4peye_cfg for parameter details.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_4peye_start(struct gpy2xx_device *phy, const struct gpy2xx_4peye_cfg *pcfg);
+
+/**
+ \brief Poll running state of 4-point eye test on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. \ref gpy2xx_usxgmii_dbg_enter must be called to
+ enter debug mode before this API. \ref gpy2xx_usxgmii_4peye_start
+ is used to start 4-point eye test and this API is used to check
+ whether the test is completed.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =1: running
+ - =0: free (test completed or test not started)
+ - <0: error code
+*/
+int gpy2xx_usxgmii_4peye_poll(struct gpy2xx_device *phy);
+
+/**
+ \brief Poll running state of 4-point eye test on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. \ref gpy2xx_usxgmii_dbg_enter must be called to
+ enter debug mode before this API. This API is used to stop running
+ test started with \ref gpy2xx_usxgmii_4peye_start.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_4peye_cancel(struct gpy2xx_device *phy);
+
+/**
+ \brief Get 4-point eye test result on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. Start to run 4-point eye test on USXGMII with given
+ parameters. This API is used to retrieve 4-point eye test result.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param presult Refer to \ref gpy2xx_4peye_result for test result.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_4peye_result(struct gpy2xx_device *phy, union gpy2xx_eye_result *presult);
+
+/**
+ \brief Get 4-point eye test config on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. This API is used to retrieve parameters used to
+ start 4-point eye test with \ref gpy2xx_usxgmii_4peye_start.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param pcfg Refer to \ref gpy2xx_4peye_cfg for parameter details.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_4peye_cfg_get(struct gpy2xx_device *phy, struct gpy2xx_4peye_cfg *pcfg);
+
+/**
+ \brief Start full sweep of 4-point eye test on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. Start to run full sweep test on USXGMII with given
+ parameters. \ref gpy2xx_usxgmii_dbg_enter must be called to
+ enter debug mode before this API. full sweep test takes
+ long time for higher BER target.
+ Use \ref gpy2xx_usxgmii_fsweep_poll to check whether the test
+ is completed.
+ Use \ref gpy2xx_usxgmii_fsweep_cancel to cancel the test
+ if it's too long to wait for.
+ Use \ref gpy2xx_usxgmii_fsweep_result to retrieve the test result.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param pcfg Refer to \ref gpy2xx_fsweep_cfg for parameter details.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_fsweep_start(struct gpy2xx_device *phy, const struct gpy2xx_4peye_cfg *pcfg);
+
+/**
+ \brief Poll running state of full sweep of 4-point eye test on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. \ref gpy2xx_usxgmii_dbg_enter must be called to
+ enter debug mode before this API. \ref gpy2xx_usxgmii_fsweep_start
+ is used to start full sweep test and this API is used to check
+ whether the test is completed.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =1: running
+ - =0: free (test completed or test not started)
+ - <0: error code
+*/
+int gpy2xx_usxgmii_fsweep_poll(struct gpy2xx_device *phy);
+
+/**
+ \brief Poll running state of full sweep of 4-point eye test on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. \ref gpy2xx_usxgmii_dbg_enter must be called to
+ enter debug mode before this API. This API is used to stop running
+ test started with \ref gpy2xx_usxgmii_fsweep_start.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_fsweep_cancel(struct gpy2xx_device *phy);
+
+/**
+ \brief Get full sweep of 4-point eye test result on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. Start to run full sweep test on USXGMII with given
+ parameters.
+ This API is used to retrieve full sweep test state and data buffer infomation.
+ for the data in the buffer, need the gpy2xx_usxgmii_fetch_fsweep_data api to fetch it.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param presult Refer to \ref gpy2xx_weep_result for test result.
+
+ _______________________________________<---- Buffer Addr, Buffer Size include this 16 bytes
+ | 16 bytes buff info |
+ |_____________________________________|<---- fetch data from the data buffer, exclude first 16 bytes
+ | |
+ | |
+ | FullSweep Eye Data Buffer |
+ | 32K Byte |
+ | |
+ |_____________________________________|
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_fsweep_result(struct gpy2xx_device *phy, union gpy2xx_eye_result *presult);
+
+/**
+ \brief fetch full sweep of 4-point eye test data on USXGMII interface.
+ \details Before call this function, need to call gpy2xx_usxgmii_fsweep_result function
+ to get the buffer infomation.
+ This API is used to retrieve full sweep test data in the buffer.
+ One call just fetch one DWORD data. To fetch all the data in the buffer,
+ need to continusly call this function to fetch all the data.
+ The buffer size is get by the gpy2xx_usxgmii_fsweep_result function.
+ The buffer size value in the result is byte unit, this fetch funciton will return one DWORD (four bytes),
+ the fetch time need to be calculated according this formula: fetch time = (buff_size - 16)/4
+ The scope eye buffer size is fixed 0x8000+16, so the fetch time is 8192
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - >=: data fetched (DWORD, 4 bytes)
+ for the diagram plot preparing, attach the higher 2 bytes data to the host buffer before lower 2 bytes
+ - <0: error code
+*/
+int gpy2xx_usxgmii_fetch_fsweep_data(struct gpy2xx_device *phy);
+
+/**
+ \brief Get full sweep of 4-point eye test config on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. This API is used to retrieve parameters used to
+ start full sweep test with \ref gpy2xx_usxgmii_fsweep_start.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param pcfg Refer to \ref gpy2xx_fsweep_cfg for parameter details.
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_fsweep_cfg_get(struct gpy2xx_device *phy, struct gpy2xx_4peye_cfg *pcfg);
+
+/**
+ \brief Get scope eye test result on USXGMII interface.
+ \details This is only applied to models supporting USXGMII EQ tuning
+ function. Start to run scope eye test on USXGMII port.
+ This API is used to retrieve scope eye test state and data buffer infomation.
+ for the data in the buffer, need the gpy2xx_usxgmii_fetch_scope_eye_data api to fetch it.
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \param presult Refer to \ref gpy2xx_weep_result for test result.
+
+ _______________________________________<---- Buffer Addr, Buffer Size include this 16 bytes
+ | 16 bytes buff info |
+ |_____________________________________|<---- fetch data from the data buffer, exclude first 16 bytes
+ | |
+ | |
+ | Scope Eye Data Buffer |
+ | 42K Byte |
+ | |
+ |_____________________________________|
+
+ \return
+ - =0: successful
+ - <0: error code
+*/
+int gpy2xx_usxgmii_scope_eye_result(struct gpy2xx_device *phy, union gpy2xx_eye_result *presult);
+
+/**
+ \brief fetch scope eye test data on USXGMII interface.
+ \details Before call this function, need to call gpy2xx_usxgmii_scope_result function
+ to get the buffer infomation.
+
+ This API is used to retrieve scope eye test data in the buffer.
+ One call just fetch one DWORD data.
+
+ To fetch all the data in the buffer, need to continusly call this function to fetch all the data.
+ How many time need to fetch the data depends on buffer size
+ which is get by the gpy2xx_usxgmii_scope_result function.
+ The buffer size value in the result is byte unit, this fetch funciton will return one DWORD (four bytes),
+ the fetch time need to be calculated according this formula: fetch time = (buff_size - 16)/4
+ The scope eye buffer size is fixed 0xA800+16, so the fetch time is 10752
+
+ \param phy Pointer to GPHY data (\ref gpy2xx_device).
+
+ \return
+ - >=: data fetched (DWORD, 4 bytes)
+ for the diagram plot preparing, attach the higher 2 bytes data to the host buffer before lower 2 bytes
+ - <0: error code
+*/
+int gpy2xx_usxgmii_fetch_scope_eye_data(struct gpy2xx_device *phy);
+
+/**@}*/ /* GPY2XX_GPY2XX_USXGMII */
+
+#pragma scalar_storage_order default
+#pragma pack(pop)
+
+#endif
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw.h
new file mode 100644
index 0000000..29aca91
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw.h
@@ -0,0 +1,2888 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _MXL_GSW_H_
+#define _MXL_GSW_H_
+
+#include "gsw_types.h"
+#include "gsw_rmon.h"
+
+#pragma pack(push, 1)
+#pragma scalar_storage_order little-endian
+
+/** \brief Spanning Tree Protocol port states.
+ Used by \ref GSW_STP_portCfg_t. */
+typedef enum {
+ /** Forwarding state. The port is allowed to transmit and receive
+ all packets. Address Learning is allowed. */
+ GSW_STP_PORT_STATE_FORWARD = 0,
+ /** Disabled/Discarding state. The port entity will not transmit
+ and receive any packets. Learning is disabled in this state. */
+ GSW_STP_PORT_STATE_DISABLE = 1,
+ /** Learning state. The port entity will only transmit and receive
+ Spanning Tree Protocol packets (BPDU). All other packets are discarded.
+ MAC table address learning is enabled for all good frames. */
+ GSW_STP_PORT_STATE_LEARNING = 2,
+ /** Blocking/Listening. Only the Spanning Tree Protocol packets will
+ be received and transmitted. All other packets are discarded by
+ the port entity. MAC table address learning is disabled in this
+ state. */
+ GSW_STP_PORT_STATE_BLOCKING = 3
+} GSW_STP_PortState_t;
+
+/** \brief Describes the 802.1x port state.
+ Used by \ref GSW_8021X_portCfg_t. */
+typedef enum {
+ /** Receive and transmit direction are authorized. The port is allowed to
+ transmit and receive all packets and the address learning process is
+ also allowed. */
+ GSW_8021X_PORT_STATE_AUTHORIZED = 0,
+ /** Receive and transmit direction are unauthorized. All the packets
+ except EAPOL are not allowed to transmit and receive. The address learning
+ process is disabled. */
+ GSW_8021X_PORT_STATE_UNAUTHORIZED = 1,
+ /** Receive direction is authorized, transmit direction is unauthorized.
+ The port is allowed to receive all packets. Packet transmission to this
+ port is not allowed. The address learning process is also allowed. */
+ GSW_8021X_PORT_STATE_RX_AUTHORIZED = 2,
+ /** Transmit direction is authorized, receive direction is unauthorized.
+ The port is allowed to transmit all packets. Packet reception on this
+ port is not allowed. The address learning process is disabled. */
+ GSW_8021X_PORT_STATE_TX_AUTHORIZED = 3
+} GSW_8021X_portState_t;
+
+/* SSB Arbitration memory mode */
+typedef enum {
+ /* GSWIP will be 10 ports mode */
+ GSW_10_PORT_MODE = 0,
+ /* GSWIP will be 16 ports mode */
+ GSW_16_PORT_MODE = 1,
+} GSW_SSB_Arb_Mode_t;
+
+/** \brief Bridge Port Allocation.
+ Used by \ref GSW_BRIDGE_PORT_ALLOC and \ref GSW_BRIDGE_PORT_FREE. */
+typedef struct {
+ /** If \ref GSW_BRIDGE_PORT_ALLOC is successful, a valid ID will be returned
+ in this field. Otherwise, \ref INVALID_HANDLE is returned in this field.
+ For \ref GSW_BRIDGE_PORT_FREE, this field should be valid ID returned by
+ \ref GSW_BRIDGE_PORT_ALLOC. ID 0 is special for CPU port in PRX300
+ by mapping to CTP 0 (Logical Port 0 with Sub-interface ID 0), and
+ pre-alloced during initialization. */
+ u16 nBridgePortId;
+} GSW_BRIDGE_portAlloc_t;
+
+typedef struct {
+ u16 IngressExVlanBlkId;
+ u16 EgressExVlanBlkId;
+ u16 IngressTrafficMeterId;
+ u16 EgressTrafficMeterId;
+ u16 BroadcastMeteringId;
+ u16 MulticastMeteringId;
+ u16 UnknownUniCastMeteringId;
+ u16 UnknownMultiIpMeteringId;
+ u16 UnknownMultiNonIpMeteringId;
+ u16 PmappperIdx;
+ u16 IngressVlanFilterBlkId;
+ u16 EgressVlanFilter1BlkId;
+ u16 EgressVlanFilter2BlkId;
+ u16 LearningLimit;
+ u16 IndexInUsageCnt;
+ u16 IndexInUse : 1;
+ u16 BrdgIdAssigned : 1;
+ u16 IngressExVlanBlkAssigned : 1;
+ u16 EgressExVlanBlkAssigned : 1;
+ u16 IngressMeteringAssigned : 1;
+ u16 EgressMeteringAssigned : 1;
+ u16 BroadcastMeteringAssigned : 1;
+ u16 MulticastMeteringAssigned : 1;
+ u16 UnknownUniCastMeteringAssigned : 1;
+ u16 UnknownMultiIpMeteringAssigned : 1;
+ u16 UnknownMultiNonIpMeteringAssigned : 1;
+ u16 PmapperAssigned : 1;
+ u16 IngressVlanFilterAssigned : 1;
+ u16 EgressVlanFilter1Assigned : 1;
+ u16 EgressVlanFilter2Assigned : 1;
+ u8 BrdgId;
+ GSW_STP_PortState_t StpState;
+ GSW_8021X_portState_t P8021xState;
+} gsw_brdgportconfig_t;
+
+
+/** \brief Color Remarking Mode
+ Used by \ref GSW_CTP_portConfig_t. */
+typedef enum {
+ /** values from last process stage */
+ GSW_REMARKING_NONE = 0,
+ /** DEI mark mode */
+ GSW_REMARKING_DEI = 2,
+ /** PCP 8P0D mark mode */
+ GSW_REMARKING_PCP_8P0D = 3,
+ /** PCP 7P1D mark mode */
+ GSW_REMARKING_PCP_7P1D = 4,
+ /** PCP 6P2D mark mode */
+ GSW_REMARKING_PCP_6P2D = 5,
+ /** PCP 5P3D mark mode */
+ GSW_REMARKING_PCP_5P3D = 6,
+ /** DSCP AF class */
+ GSW_REMARKING_DSCP_AF = 7
+} GSW_ColorRemarkingMode_t;
+
+/** \brief Meters for various egress traffic type.
+ Used by \ref GSW_BRIDGE_portConfig_t. */
+typedef enum {
+ /** Index of broadcast traffic meter */
+ GSW_BRIDGE_PORT_EGRESS_METER_BROADCAST = 0,
+ /** Index of known multicast traffic meter */
+ GSW_BRIDGE_PORT_EGRESS_METER_MULTICAST = 1,
+ /** Index of unknown multicast IP traffic meter */
+ GSW_BRIDGE_PORT_EGRESS_METER_UNKNOWN_MC_IP = 2,
+ /** Index of unknown multicast non-IP traffic meter */
+ GSW_BRIDGE_PORT_EGRESS_METER_UNKNOWN_MC_NON_IP = 3,
+ /** Index of unknown unicast traffic meter */
+ GSW_BRIDGE_PORT_EGRESS_METER_UNKNOWN_UC = 4,
+ /** Index of traffic meter for other types */
+ GSW_BRIDGE_PORT_EGRESS_METER_OTHERS = 5,
+ /** Number of index */
+ GSW_BRIDGE_PORT_EGRESS_METER_MAX = 6
+} GSW_BridgePortEgressMeter_t;
+
+/** \brief P-mapper Mapping Mode
+ Used by \ref GSW_CTP_portConfig_t. */
+typedef enum {
+ /** Use PCP for VLAN tagged packets to derive sub interface ID group.
+
+ \remarks
+ P-mapper table entry 1-8. */
+ GSW_PMAPPER_MAPPING_PCP = 0,
+ /** Use LAG Index for Pmapper access (regardless of IP and VLAN packet)to
+ derive sub interface ID group.
+
+ \remarks
+ P-mapper table entry 9-72. */
+ GSW_PMAPPER_MAPPING_LAG = 1,
+ /** Use DSCP for VLAN tagged IP packets to derive sub interface ID group.
+
+ \remarks
+ P-mapper table entry 9-72. */
+ GSW_PMAPPER_MAPPING_DSCP = 2,
+} GSW_PmapperMappingMode_t;
+
+/** \brief P-mapper Configuration
+ Used by \ref GSW_CTP_portConfig_t, GSW_BRIDGE_portConfig_t.
+ In case of LAG, it is user's responsibility to provide the mapped entries
+ in given P-mapper table. In other modes the entries are auto mapped from
+ input packet. */
+typedef struct {
+ /** Index of P-mapper <0-31>. */
+ u16 nPmapperId;
+
+ /** Sub interface ID group.
+
+ \remarks
+ Entry 0 is for non-IP and non-VLAN tagged packets. Entries 1-8 are PCP
+ mapping entries for VLAN tagged packets with \ref GSW_PMAPPER_MAPPING_PCP
+ selected. Entries 9-72 are DSCP or LAG mapping entries for IP packets without
+ VLAN tag or VLAN tagged packets with \ref GSW_PMAPPER_MAPPING_DSCP or
+ GSW_PMAPPER_MAPPING_LAG selected. When LAG is selected this 8bit field is
+ decoded as Destination sub-interface ID group field bits 3:0, Destination
+ logical port ID field bits 7:4 */
+ u8 nDestSubIfIdGroup[73];
+} GSW_PMAPPER_t;
+
+/** \brief Bridge Port configuration mask.
+ Used by \ref GSW_BRIDGE_portConfig_t. */
+typedef enum {
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::nBridgeId */
+ GSW_BRIDGE_PORT_CONFIG_MASK_BRIDGE_ID = 0x00000001,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bIngressExtendedVlanEnable and
+ \ref GSW_BRIDGE_portConfig_t::nIngressExtendedVlanBlockId */
+ GSW_BRIDGE_PORT_CONFIG_MASK_INGRESS_VLAN = 0x00000002,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bEgressExtendedVlanEnable and
+ \ref GSW_BRIDGE_portConfig_t::nEgressExtendedVlanBlockId */
+ GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_VLAN = 0x00000004,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::eIngressMarkingMode */
+ GSW_BRIDGE_PORT_CONFIG_MASK_INGRESS_MARKING = 0x00000008,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::eEgressRemarkingMode */
+ GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_REMARKING = 0x00000010,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bIngressMeteringEnable and
+ \ref GSW_BRIDGE_portConfig_t::nIngressTrafficMeterId */
+ GSW_BRIDGE_PORT_CONFIG_MASK_INGRESS_METER = 0x00000020,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bEgressSubMeteringEnable and
+ \ref GSW_BRIDGE_portConfig_t::nEgressTrafficSubMeterId */
+ GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_SUB_METER = 0x00000040,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::nDestLogicalPortId,
+ \ref GSW_BRIDGE_portConfig_t::bPmapperEnable,
+ \ref GSW_BRIDGE_portConfig_t::nDestSubIfIdGroup,
+ \ref GSW_BRIDGE_portConfig_t::ePmapperMappingMode,
+ \ref GSW_BRIDGE_portConfig_t::bPmapperIdValid and
+ \ref GSW_BRIDGE_portConfig_t::sPmapper. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_CTP_MAPPING = 0x00000080,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::nBridgePortMap */
+ GSW_BRIDGE_PORT_CONFIG_MASK_BRIDGE_PORT_MAP = 0x00000100,
+
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bMcDestIpLookupEnable. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_MC_DEST_IP_LOOKUP = 0x00000200,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bMcSrcIpLookupEnable. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_MC_SRC_IP_LOOKUP = 0x00000400,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bDestMacLookupEnable. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_MC_DEST_MAC_LOOKUP = 0x00000800,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bSrcMacLearningEnable. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_MC_SRC_MAC_LEARNING = 0x00001000,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bMacSpoofingDetectEnable. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_MAC_SPOOFING = 0x00002000,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bPortLockEnable. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_PORT_LOCK = 0x00004000,
+
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bMacLearningLimitEnable and
+ \ref GSW_BRIDGE_portConfig_t::nMacLearningLimit. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_MAC_LEARNING_LIMIT = 0x00008000,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::nMacLearningCount */
+ GSW_BRIDGE_PORT_CONFIG_MASK_MAC_LEARNED_COUNT = 0x00010000,
+
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bIngressVlanFilterEnable and
+ \ref GSW_BRIDGE_portConfig_t::nIngressVlanFilterBlockId. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_INGRESS_VLAN_FILTER = 0x00020000,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bBypassEgressVlanFilter1,
+ \ref GSW_BRIDGE_portConfig_t::bEgressVlanFilter1Enable
+ and \ref GSW_BRIDGE_portConfig_t::nEgressVlanFilter1BlockId. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_VLAN_FILTER1 = 0x00040000,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bEgressVlanFilter2Enable and
+ \ref GSW_BRIDGE_portConfig_t::nEgressVlanFilter2BlockId. */
+ GSW_BRIDGE_PORT_CONFIG_MASK_EGRESS_VLAN_FILTER2 = 0x00080000,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bVlanTagSelection,
+ \ref GSW_BRIDGE_portConfig_t::bVlanSrcMacPriorityEnable,
+ \ref GSW_BRIDGE_portConfig_t::bVlanSrcMacDEIEnable,
+ \ref GSW_BRIDGE_portConfig_t::bVlanSrcMacVidEnable,
+ \ref GSW_BRIDGE_portConfig_t::bVlanDstMacPriorityEnable,
+ \ref GSW_BRIDGE_portConfig_t::bVlanDstMacDEIEnable,
+ \ref GSW_BRIDGE_portConfig_t::bVlanDstMacVidEnable */
+ GSW_BRIDGE_PORT_CONFIG_MASK_VLAN_BASED_MAC_LEARNING = 0x00100000,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::bVlanMulticastPriorityEnable,
+ \ref GSW_BRIDGE_portConfig_t::bVlanMulticastDEIEnable,
+ \ref GSW_BRIDGE_portConfig_t::bVlanMulticastVidEnable */
+ GSW_BRIDGE_PORT_CONFIG_MASK_VLAN_BASED_MULTICAST_LOOKUP = 0x00200000,
+ /** Mask for \ref GSW_BRIDGE_portConfig_t::nLoopViolationCount */
+ GSW_BRIDGE_PORT_CONFIG_MASK_LOOP_VIOLATION_COUNTER = 0x00400000,
+ /** Enable all */
+ GSW_BRIDGE_PORT_CONFIG_MASK_ALL = 0x7FFFFFFF,
+ /** Bypass any check for debug purpose */
+ GSW_BRIDGE_PORT_CONFIG_MASK_FORCE = 0x80000000
+} GSW_BridgePortConfigMask_t;
+
+/** \brief Color Marking Mode
+ Used by \ref GSW_CTP_portConfig_t. */
+typedef enum {
+ /** mark packets (except critical) to green */
+ GSW_MARKING_ALL_GREEN = 0,
+ /** do not change color and priority */
+ GSW_MARKING_INTERNAL_MARKING = 1,
+ /** DEI mark mode */
+ GSW_MARKING_DEI = 2,
+ /** PCP 8P0D mark mode */
+ GSW_MARKING_PCP_8P0D = 3,
+ /** PCP 7P1D mark mode */
+ GSW_MARKING_PCP_7P1D = 4,
+ /** PCP 6P2D mark mode */
+ GSW_MARKING_PCP_6P2D = 5,
+ /** PCP 5P3D mark mode */
+ GSW_MARKING_PCP_5P3D = 6,
+ /** DSCP AF class */
+ GSW_MARKING_DSCP_AF = 7
+} GSW_ColorMarkingMode_t;
+
+
+/** \brief Bridge configuration mask.
+ Used by \ref GSW_BRIDGE_config_t. */
+typedef enum {
+ /** Mask for \ref GSW_BRIDGE_config_t::bMacLearningLimitEnable
+ and \ref GSW_BRIDGE_config_t::nMacLearningLimit. */
+ GSW_BRIDGE_CONFIG_MASK_MAC_LEARNING_LIMIT = 0x00000001,
+ /** Mask for \ref GSW_BRIDGE_config_t::nMacLearningCount */
+ GSW_BRIDGE_CONFIG_MASK_MAC_LEARNED_COUNT = 0x00000002,
+ /** Mask for \ref GSW_BRIDGE_config_t::nLearningDiscardEvent */
+ GSW_BRIDGE_CONFIG_MASK_MAC_DISCARD_COUNT = 0x00000004,
+ /** Mask for \ref GSW_BRIDGE_config_t::bSubMeteringEnable and
+ \ref GSW_BRIDGE_config_t::nTrafficSubMeterId */
+ GSW_BRIDGE_CONFIG_MASK_SUB_METER = 0x00000008,
+ /** Mask for \ref GSW_BRIDGE_config_t::eForwardBroadcast,
+ \ref GSW_BRIDGE_config_t::eForwardUnknownMulticastIp,
+ \ref GSW_BRIDGE_config_t::eForwardUnknownMulticastNonIp,
+ and \ref GSW_BRIDGE_config_t::eForwardUnknownUnicast. */
+ GSW_BRIDGE_CONFIG_MASK_FORWARDING_MODE = 0x00000010,
+
+ /** Enable all */
+ GSW_BRIDGE_CONFIG_MASK_ALL = 0x7FFFFFFF,
+ /** Bypass any check for debug purpose */
+ GSW_BRIDGE_CONFIG_MASK_FORCE = 0x80000000
+} GSW_BridgeConfigMask_t;
+
+/** \brief Bridge forwarding type of packet.
+ Used by \ref GSW_BRIDGE_portConfig_t. */
+typedef enum {
+ /** Packet is flooded to port members of ingress bridge port */
+ GSW_BRIDGE_FORWARD_FLOOD = 0,
+ /** Packet is dscarded */
+ GSW_BRIDGE_FORWARD_DISCARD = 1,
+ /** Packet is forwarded to logical port 0 CTP port 0 bridge port 0 */
+ GSW_BRIDGE_FORWARD_CPU = 2
+} GSW_BridgeForwardMode_t;
+
+
+/** \brief Bridge Port Configuration.
+ Used by \ref GSW_BRIDGE_PORT_CONFIG_SET and \ref GSW_BRIDGE_PORT_CONFIG_GET. */
+typedef struct {
+ /** Bridge Port ID allocated by \ref GSW_BRIDGE_PORT_ALLOC.
+
+ \remarks
+ If \ref GSW_BRIDGE_portConfig_t::eMask has
+ \ref GSW_BridgePortConfigMask_t::GSW_BRIDGE_PORT_CONFIG_MASK_FORCE, this
+ field is absolute index of Bridge Port in hardware for debug purpose,
+ bypassing any check. */
+ u16 nBridgePortId;
+
+ /** Mask for updating/retrieving fields. */
+ GSW_BridgePortConfigMask_t eMask;
+
+ /** Bridge ID (FID) to which this bridge port is associated. A default
+ bridge (ID 0) should be always available. */
+ u16 nBridgeId;
+
+ /** Enable extended VLAN processing for ingress non-IGMP traffic. */
+ gsw_bool_t bIngressExtendedVlanEnable;
+ /** Extended VLAN block allocated for ingress non-IGMP traffic. It defines
+ extended VLAN process for ingress non-IGMP traffic. Valid when
+ bIngressExtendedVlanEnable is TRUE. */
+ u16 nIngressExtendedVlanBlockId;
+ /** Extended VLAN block size for ingress non-IGMP traffic. This is optional.
+ If it is 0, the block size of nIngressExtendedVlanBlockId will be used.
+ Otherwise, this field will be used. */
+ u16 nIngressExtendedVlanBlockSize;
+
+ /** Enable extended VLAN processing enabled for egress non-IGMP traffic. */
+ gsw_bool_t bEgressExtendedVlanEnable;
+ /** Extended VLAN block allocated for egress non-IGMP traffic. It defines
+ extended VLAN process for egress non-IGMP traffic. Valid when
+ bEgressExtendedVlanEnable is TRUE. */
+ u16 nEgressExtendedVlanBlockId;
+ /** Extended VLAN block size for egress non-IGMP traffic. This is optional.
+ If it is 0, the block size of nEgressExtendedVlanBlockId will be used.
+ Otherwise, this field will be used. */
+ u16 nEgressExtendedVlanBlockSize;
+
+ /** Ingress color marking mode for ingress traffic. */
+ GSW_ColorMarkingMode_t eIngressMarkingMode;
+
+ /** Color remarking for egress traffic. */
+ GSW_ColorRemarkingMode_t eEgressRemarkingMode;
+
+ /** Traffic metering on ingress traffic applies. */
+ gsw_bool_t bIngressMeteringEnable;
+ /** Meter for ingress Bridge Port process.
+
+ \remarks
+ Meter should be allocated with \ref GSW_QOS_METER_ALLOC before Bridge
+ port configuration. If this Bridge port is re-set, the last used meter
+ should be released. */
+ u16 nIngressTrafficMeterId;
+
+ /** Traffic metering on various types of egress traffic (such as broadcast,
+ multicast, unknown unicast, etc) applies. */
+ gsw_bool_t bEgressSubMeteringEnable[GSW_BRIDGE_PORT_EGRESS_METER_MAX];
+ /** Meter for egress Bridge Port process with specific type (such as
+ broadcast, multicast, unknown unicast, etc). Need pre-allocated for each
+ type. */
+ u16 nEgressTrafficSubMeterId[GSW_BRIDGE_PORT_EGRESS_METER_MAX];
+
+ /** This field defines destination logical port. */
+ u8 nDestLogicalPortId;
+ /** This field indicates whether to enable P-mapper. */
+ gsw_bool_t bPmapperEnable;
+ /** When bPmapperEnable is FALSE, this field defines destination sub
+ interface ID group. */
+ u16 nDestSubIfIdGroup;
+ /** When bPmapperEnable is TRUE, this field selects either DSCP or PCP to
+ derive sub interface ID. */
+ GSW_PmapperMappingMode_t ePmapperMappingMode;
+ /** When bPmapperEnable is TRUE, P-mapper is used. This field determines
+ whether sPmapper.nPmapperId is valid. If this field is TRUE, the
+ P-mapper is re-used and no allocation of new P-mapper or value
+ change in the P-mapper. If this field is FALSE, allocation is
+ taken care in the API implementation. */
+ gsw_bool_t bPmapperIdValid;
+ /** When bPmapperEnable is TRUE, P-mapper is used. if bPmapperIdValid is
+ FALSE, API implementation need take care of P-mapper allocation,
+ and maintain the reference counter of P-mapper used multiple times.
+ If bPmapperIdValid is TRUE, only sPmapper.nPmapperId is used to
+ associate the P-mapper, and there is no allocation of new P-mapper
+ or value change in the P-mapper. */
+ GSW_PMAPPER_t sPmapper;
+
+ /** Port map define broadcast domain.
+
+ \remarks
+ Each bit is one bridge port. Bridge port ID is index * 16 + bit offset.
+ For example, bit 1 of nBridgePortMap[1] is bridge port ID 17. */
+ u16 nBridgePortMap[8]; /* max can be 16 */
+
+ /** Multicast IP table is searched if this field is FALSE and traffic is IP
+ multicast. */
+ gsw_bool_t bMcDestIpLookupDisable;
+ /** Multicast IP table is searched if this field is TRUE and traffic is IP
+ multicast. */
+ gsw_bool_t bMcSrcIpLookupEnable;
+
+ /** Default is FALSE. Packet is treated as "unknown" if it's not
+ broadcast/multicast packet. */
+ gsw_bool_t bDestMacLookupDisable;
+
+ /** Default is FALSE. Source MAC address is learned. */
+ gsw_bool_t bSrcMacLearningDisable;
+
+ /** If this field is TRUE and MAC address which is already learned in another
+ bridge port appears on this bridge port, port locking violation is
+ detected. */
+ gsw_bool_t bMacSpoofingDetectEnable;
+
+ /** If this field is TRUE and MAC address which is already learned in this
+ bridge port appears on another bridge port, port locking violation is
+ detected. */
+ gsw_bool_t bPortLockEnable;
+
+ /** Enable MAC learning limitation. */
+ gsw_bool_t bMacLearningLimitEnable;
+ /** Max number of MAC can be learned from this bridge port. */
+ u16 nMacLearningLimit;
+
+ /** Get number of Loop violation counter from this bridge port. */
+ u16 nLoopViolationCount;
+
+ /** Get number of MAC address learned from this bridge port. */
+ u16 nMacLearningCount;
+
+ /** Enable ingress VLAN filter */
+ gsw_bool_t bIngressVlanFilterEnable;
+ /** VLAN filter block of ingress traffic if
+ \ref GSW_BRIDGE_portConfig_t::bIngressVlanFilterEnable is TRUE. */
+ u16 nIngressVlanFilterBlockId;
+ /** VLAN filter block size. This is optional.
+ If it is 0, the block size of nIngressVlanFilterBlockId will be used.
+ Otherwise, this field will be used. */
+ u16 nIngressVlanFilterBlockSize;
+ /** For ingress traffic, bypass VLAN filter 1 at egress bridge port
+ processing. */
+ gsw_bool_t bBypassEgressVlanFilter1;
+ /** Enable egress VLAN filter 1 */
+ gsw_bool_t bEgressVlanFilter1Enable;
+ /** VLAN filter block 1 of egress traffic if
+ \ref GSW_BRIDGE_portConfig_t::bEgressVlanFilter1Enable is TRUE. */
+ u16 nEgressVlanFilter1BlockId;
+ /** VLAN filter block 1 size. This is optional.
+ If it is 0, the block size of nEgressVlanFilter1BlockId will be used.
+ Otherwise, this field will be used. */
+ u16 nEgressVlanFilter1BlockSize;
+ /** Enable egress VLAN filter 2 */
+ gsw_bool_t bEgressVlanFilter2Enable;
+ /** VLAN filter block 2 of egress traffic if
+ \ref GSW_BRIDGE_portConfig_t::bEgressVlanFilter2Enable is TRUE. */
+ u16 nEgressVlanFilter2BlockId;
+ /** VLAN filter block 2 size. This is optional.
+ If it is 0, the block size of nEgressVlanFilter2BlockId will be used.
+ Otherwise, this field will be used. */
+ u16 nEgressVlanFilter2BlockSize;
+ /** Enable Ingress VLAN Based Mac Learning */
+ gsw_bool_t bIngressVlanBasedMacLearningEnable;
+ /** 0 - Intermediate outer VLAN
+ tag is used for MAC address/multicast
+ learning, lookup and filtering.
+ 1 - Original outer VLAN tag is used
+ for MAC address/multicast learning, lookup
+ and filtering. */
+ gsw_bool_t bVlanTagSelection;
+ /** 0 - Disable, VLAN Priority field is not used
+ and value 0 is used for source MAC address
+ learning and filtering.
+ 1 - Enable, VLAN Priority field is used for
+ source MAC address learning and filtering. */
+ gsw_bool_t bVlanSrcMacPriorityEnable;
+ /** 0 - Disable, VLAN DEI/CFI field is not used
+ and value 0 is used for source MAC address
+ learning and filtering.
+ 1 - Enable, VLAN DEI/CFI field is used for
+ source MAC address learning and filtering */
+ gsw_bool_t bVlanSrcMacDEIEnable;
+ /** 0 - Disable, VLAN ID field is not used and
+ value 0 is used for source MAC address
+ learning and filtering
+ 1 - Enable, VLAN ID field is used for source
+ MAC address learning and filtering. */
+ gsw_bool_t bVlanSrcMacVidEnable;
+ /** 0 - Disable, VLAN Priority field is not used
+ and value 0 is used for destination MAC
+ address look up and filtering.
+ 1 - Enable, VLAN Priority field is used for
+ destination MAC address look up and
+ filtering */
+ gsw_bool_t bVlanDstMacPriorityEnable;
+ /** 0 - Disable, VLAN CFI/DEI field is not used
+ and value 0 is used for destination MAC
+ address lookup and filtering.
+ 1 - Enable, VLAN CFI/DEI field is used for
+ destination MAC address look up and
+ filtering. */
+ gsw_bool_t bVlanDstMacDEIEnable;
+ /** 0 - Disable, VLAN ID field is not used and
+ value 0 is used for destination MAC address
+ look up and filtering.
+ 1 - Enable, VLAN ID field is destination for
+ destination MAC address look up and
+ filtering. */
+ gsw_bool_t bVlanDstMacVidEnable;
+
+ /** Enable, VLAN Based Multicast Lookup */
+ gsw_bool_t bVlanBasedMultiCastLookup;
+ /** 0 - Disable, VLAN Priority field is not used
+ and value 0 is used for IP multicast lookup.
+ 1 - Enable, VLAN Priority field is used for IP
+ multicast lookup. */
+ gsw_bool_t bVlanMulticastPriorityEnable;
+ /** 0 - Disable, VLAN CFI/DEI field is not used
+ and value 0 is used for IP multicast lookup.
+ 1 - Enable, VLAN CFI/DEI field is used for IP
+ multicast lookup. */
+ gsw_bool_t bVlanMulticastDEIEnable;
+ /** 0 - Disable, VLAN ID field is not used and
+ value 0 is used for IP multicast lookup.
+ 1 - Enable, VLAN ID field is destination for IP
+ multicast lookup. */
+ gsw_bool_t bVlanMulticastVidEnable;
+} GSW_BRIDGE_portConfig_t;
+
+
+/** \brief VLAN Filter TCI Mask.
+ Used by \ref GSW_VLANFILTER_config_t */
+typedef enum {
+ GSW_VLAN_FILTER_TCI_MASK_VID = 0,
+ GSW_VLAN_FILTER_TCI_MASK_PCP = 1,
+ GSW_VLAN_FILTER_TCI_MASK_TCI = 2
+} GSW_VlanFilterTciMask_t;
+
+typedef struct {
+ u16 IndexInUsageCnt : 15;
+ u8 IndexInUse : 1;
+} gsw_pmapper_t;
+
+
+/** \brief Bridge Allocation.
+ Used by \ref GSW_BRIDGE_ALLOC and \ref GSW_BRIDGE_FREE. */
+typedef struct {
+ /** If \ref GSW_BRIDGE_ALLOC is successful, a valid ID will be returned
+ in this field. Otherwise, \ref INVALID_HANDLE is returned in this field.
+ For \ref GSW_BRIDGE_FREE, this field should be valid ID returned by
+ \ref GSW_BRIDGE_ALLOC. ID 0 is special Bridge created during
+ initialization. */
+ u16 nBridgeId;
+} GSW_BRIDGE_alloc_t;
+
+/** \brief Bridge Configuration.
+ Used by \ref GSW_BRIDGE_CONFIG_SET and \ref GSW_BRIDGE_CONFIG_GET. */
+typedef struct {
+ /** Bridge ID (FID) allocated by \ref GSW_BRIDGE_ALLOC.
+
+ \remarks
+ If \ref GSW_BRIDGE_config_t::eMask has
+ \ref GSW_BridgeConfigMask_t::GSW_BRIDGE_CONFIG_MASK_FORCE, this field is
+ absolute index of Bridge (FID) in hardware for debug purpose, bypassing
+ any check. */
+ u16 nBridgeId;
+
+ /** Mask for updating/retrieving fields. */
+ GSW_BridgeConfigMask_t eMask;
+
+ /** Enable MAC learning limitation. */
+ gsw_bool_t bMacLearningLimitEnable;
+ /** Max number of MAC can be learned in this bridge (all bridge ports). */
+ u16 nMacLearningLimit;
+
+ /** Get number of MAC address learned from this bridge port. */
+ u16 nMacLearningCount;
+
+ /** Number of learning discard event due to hardware resource not available.
+
+ \remarks
+ This is discard event due to either MAC table full or Hash collision.
+ Discard due to nMacLearningCount reached is not counted in this field. */
+ u32 nLearningDiscardEvent;
+
+ /** Traffic metering on type of traffic (such as broadcast, multicast,
+ unknown unicast, etc) applies. */
+ gsw_bool_t bSubMeteringEnable[GSW_BRIDGE_PORT_EGRESS_METER_MAX];
+ /** Meter for bridge process with specific type (such as broadcast,
+ multicast, unknown unicast, etc). Need pre-allocated for each type. */
+ u16 nTrafficSubMeterId[GSW_BRIDGE_PORT_EGRESS_METER_MAX];
+
+ /** Forwarding mode of broadcast traffic. */
+ GSW_BridgeForwardMode_t eForwardBroadcast;
+ /** Forwarding mode of unknown multicast IP traffic. */
+ GSW_BridgeForwardMode_t eForwardUnknownMulticastIp;
+ /** Forwarding mode of unknown multicast non-IP traffic. */
+ GSW_BridgeForwardMode_t eForwardUnknownMulticastNonIp;
+ /** Forwarding mode of unknown unicast traffic. */
+ GSW_BridgeForwardMode_t eForwardUnknownUnicast;
+} GSW_BRIDGE_config_t;
+
+/** \brief Ethernet port speed mode.
+ For certain generations of GSWIP, a port might support only a subset of the possible settings.
+ Used by \ref GSW_portLinkCfg_t. */
+typedef enum {
+ /** 10 Mbit/s */
+ GSW_PORT_SPEED_10,
+ /** 100 Mbit/s */
+ GSW_PORT_SPEED_100,
+ /** 200 Mbit/s */
+ GSW_PORT_SPEED_200,
+ /** 1000 Mbit/s */
+ GSW_PORT_SPEED_1000,
+ /** 2.5 Gbit/s */
+ GSW_PORT_SPEED_2500,
+ /** 5 Gbit/s */
+ GSW_PORT_SPEED_5000,
+ /** 10 Gbit/s */
+ GSW_PORT_SPEED_10000,
+ /** Auto speed for XGMAC */
+ GSW_PORT_SPEED_AUTO,
+} GSW_portSpeed_t;
+
+/** \brief Ethernet port duplex status.
+ Used by \ref GSW_portLinkCfg_t. */
+typedef enum {
+ /** Port operates in full-duplex mode */
+ GSW_DUPLEX_FULL = 0,
+ /** Port operates in half-duplex mode */
+ GSW_DUPLEX_HALF = 1,
+ /** Port operates in Auto mode */
+ GSW_DUPLEX_AUTO = 2,
+} GSW_portDuplex_t;
+
+/** \brief Force the MAC and PHY link modus.
+ Used by \ref GSW_portLinkCfg_t. */
+typedef enum {
+ /** Link up. Any connected LED
+ still behaves based on the real PHY status. */
+ GSW_PORT_LINK_UP = 0,
+ /** Link down. */
+ GSW_PORT_LINK_DOWN = 1,
+ /** Link Auto. */
+ GSW_PORT_LINK_AUTO = 2,
+} GSW_portLink_t;
+
+/** \brief Ethernet port interface mode.
+ A port might support only a subset of the possible settings.
+ Used by \ref GSW_portLinkCfg_t. */
+typedef enum {
+ /** Normal PHY interface (twisted pair), use the internal MII Interface. */
+ GSW_PORT_HW_MII = 0,
+ /** Reduced MII interface in normal mode. */
+ GSW_PORT_HW_RMII = 1,
+ /** GMII or MII, depending upon the speed. */
+ GSW_PORT_HW_GMII = 2,
+ /** RGMII mode. */
+ GSW_PORT_HW_RGMII = 3,
+ /** XGMII mode. */
+ GSW_PORT_HW_XGMII = 4,
+} GSW_MII_Mode_t;
+
+/** \brief Ethernet port configuration for PHY or MAC mode.
+ Used by \ref GSW_portLinkCfg_t. */
+typedef enum {
+ /** MAC Mode. The Ethernet port is configured to work in MAC mode. */
+ GSW_PORT_MAC = 0,
+ /** PHY Mode. The Ethernet port is configured to work in PHY mode. */
+ GSW_PORT_PHY = 1
+} GSW_MII_Type_t;
+
+/** \brief Ethernet port clock source configuration.
+ Used by \ref GSW_portLinkCfg_t. */
+typedef enum {
+ /** Clock Mode not applicable. */
+ GSW_PORT_CLK_NA = 0,
+ /** Clock Master Mode. The port is configured to provide the clock as output signal. */
+ GSW_PORT_CLK_MASTER = 1,
+ /** Clock Slave Mode. The port is configured to use the input clock signal. */
+ GSW_PORT_CLK_SLAVE = 2
+} GSW_clkMode_t;
+
+
+/** \brief Ethernet port link, speed status and flow control status.
+ Used by \ref GSW_PORT_LINK_CFG_GET and \ref GSW_PORT_LINK_CFG_SET. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. */
+ u16 nPortId;
+ /** Force Port Duplex Mode.
+
+ - 0: Negotiate Duplex Mode. Auto-negotiation mode. Negotiated
+ duplex mode given in 'eDuplex'
+ during GSW_PORT_LINK_CFG_GET calls.
+ - 1: Force Duplex Mode. Force duplex mode in 'eDuplex'.
+ */
+ gsw_bool_t bDuplexForce;
+ /** Port Duplex Status. */
+ GSW_portDuplex_t eDuplex;
+ /** Force Link Speed.
+
+ - 0: Negotiate Link Speed. Negotiated speed given in
+ 'eSpeed' during GSW_PORT_LINK_CFG_GET calls.
+ - 1: Force Link Speed. Forced speed mode in 'eSpeed'.
+ */
+ gsw_bool_t bSpeedForce;
+ /** Ethernet port link up/down and speed status. */
+ GSW_portSpeed_t eSpeed;
+ /** Force Link.
+
+ - 0: Auto-negotiate Link. Current link status is given in
+ 'eLink' during GSW_PORT_LINK_CFG_GET calls.
+ - 1: Force Duplex Mode. Force duplex mode in 'eLink'.
+ */
+ gsw_bool_t bLinkForce;
+ /** Link Status. Read out the current link status.
+ Note that the link could be forced by setting 'bLinkForce'. */
+ GSW_portLink_t eLink;
+ /** Selected interface mode (MII/RMII/RGMII/GMII/XGMII). */
+ GSW_MII_Mode_t eMII_Mode;
+ /** Select MAC or PHY mode (PHY = Reverse xMII). */
+ GSW_MII_Type_t eMII_Type;
+ /** Interface Clock mode (used for RMII mode). */
+ GSW_clkMode_t eClkMode;
+ /** 'Low Power Idle' Support for 'Energy Efficient Ethernet'.
+ Only enable this feature in case the attached PHY also supports it. */
+ gsw_bool_t bLPI;
+} GSW_portLinkCfg_t;
+
+/** \brief Port Enable Type Selection.
+ Used by \ref GSW_portCfg_t. */
+typedef enum {
+ /** The port is disabled in both directions. */
+ GSW_PORT_DISABLE = 0,
+ /** The port is enabled in both directions (ingress and egress). */
+ GSW_PORT_ENABLE_RXTX = 1,
+ /** The port is enabled in the receive (ingress) direction only. */
+ GSW_PORT_ENABLE_RX = 2,
+ /** The port is enabled in the transmit (egress) direction only. */
+ GSW_PORT_ENABLE_TX = 3
+} GSW_portEnable_t;
+
+/** \brief Ethernet flow control status.
+ Used by \ref GSW_portCfg_t. */
+typedef enum {
+ /** Automatic flow control mode selection through auto-negotiation. */
+ GSW_FLOW_AUTO = 0,
+ /** Receive flow control only */
+ GSW_FLOW_RX = 1,
+ /** Transmit flow control only */
+ GSW_FLOW_TX = 2,
+ /** Receive and Transmit flow control */
+ GSW_FLOW_RXTX = 3,
+ /** No flow control */
+ GSW_FLOW_OFF = 4
+} GSW_portFlow_t;
+
+
+/** \brief Port Mirror Options.
+ Used by \ref GSW_portCfg_t. */
+typedef enum {
+ /** Mirror Feature is disabled. Normal port usage. */
+ GSW_PORT_MONITOR_NONE = 0,
+ /** Port Ingress packets are mirrored to the monitor port. */
+ GSW_PORT_MONITOR_RX = 1,
+ /** Port Egress packets are mirrored to the monitor port. */
+ GSW_PORT_MONITOR_TX = 2,
+ /** Port Ingress and Egress packets are mirrored to the monitor port. */
+ GSW_PORT_MONITOR_RXTX = 3,
+ /** Packet mirroring of 'unknown VLAN violation' frames. */
+ GSW_PORT_MONITOR_VLAN_UNKNOWN = 4,
+ /** Packet mirroring of 'VLAN ingress or egress membership violation' frames. */
+ GSW_PORT_MONITOR_VLAN_MEMBERSHIP = 16,
+ /** Packet mirroring of 'port state violation' frames. */
+ GSW_PORT_MONITOR_PORT_STATE = 32,
+ /** Packet mirroring of 'MAC learning limit violation' frames. */
+ GSW_PORT_MONITOR_LEARNING_LIMIT = 64,
+ /** Packet mirroring of 'port lock violation' frames. */
+ GSW_PORT_MONITOR_PORT_LOCK = 128
+} GSW_portMonitor_t;
+
+/** \brief Interface RMON Counter Mode - (FID, SUBID or FLOWID) Config - GSWIP-3.0 only.
+ Used by \ref GSW_portCfg_t. */
+typedef enum {
+ /** FID based Interface RMON counters Usage */
+ GSW_IF_RMON_FID = 0,
+ /** Sub-Interface Id based Interface RMON counters Usage */
+ GSW_IF_RMON_SUBID = 1,
+ /** Flow Id (LSB bits 3 to 0) based Interface RMON counters Usage */
+ GSW_IF_RMON_FLOWID_LSB = 2,
+ /** Flow Id (MSB bits 7 to 4) based Interface RMON counters Usage */
+ GSW_IF_RMON_FLOWID_MSB = 3
+} GSW_If_RMON_Mode_t;
+
+/** \brief Port Configuration Parameters.
+ Used by \ref GSW_PORT_CFG_GET and \ref GSW_PORT_CFG_SET. */
+typedef struct {
+ /** Port Type. This gives information which type of port is configured.
+ nPortId should be based on this field. */
+ GSW_portType_t ePortType;
+
+ /** Ethernet Port number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. */
+ u16 nPortId;
+ /** Enable Port (ingress only, egress only, both directions, or disabled).
+ This parameter is used for Spanning Tree Protocol and 802.1X applications. */
+ GSW_portEnable_t eEnable;
+ /** Drop unknown unicast packets.
+ Do not send out unknown unicast packets on this port,
+ if the boolean parameter is enabled. By default packets of this type
+ are forwarded to this port. */
+ gsw_bool_t bUnicastUnknownDrop;
+ /** Drop unknown multicast packets.
+ Do not send out unknown multicast packets on this port,
+ if boolean parameter is enabled. By default packets of this type
+ are forwarded to this port.
+ Some platforms also drop broadcast packets. */
+ gsw_bool_t bMulticastUnknownDrop;
+ /** Drop reserved packet types
+ (destination address from '01 80 C2 00 00 00' to
+ '01 80 C2 00 00 2F') received on this port. */
+ gsw_bool_t bReservedPacketDrop;
+ /** Drop Broadcast packets received on this port. By default packets of this
+ type are forwarded to this port. */
+ gsw_bool_t bBroadcastDrop;
+ /** Enables MAC address table aging.
+ The MAC table entries learned on this port are removed after the
+ aging time has expired.
+ The aging time is a global parameter, common to all ports. */
+ gsw_bool_t bAging;
+ /** MAC address table learning on the port specified by 'nPortId'.
+ By default this parameter is always enabled. */
+ gsw_bool_t bLearning;
+ /** Automatic MAC address table learning locking on the port specified
+ by 'nPortId'.
+ This parameter is only taken into account when 'bLearning' is enabled. */
+ gsw_bool_t bLearningMAC_PortLock;
+ /** Automatic MAC address table learning limitation on this port.
+ The learning functionality is disabled when the limit value is zero.
+ The value 0xFFFF to allow unlimited learned address.
+ This parameter is only taken into account when 'bLearning' is enabled. */
+ u16 nLearningLimit;
+ /** MAC spoofing detection. Identifies ingress packets that carry
+ a MAC source address which was previously learned on a different ingress
+ port (learned by MAC bridging table). This also applies to static added
+ entries. Those violated packets could be accepted or discarded,
+ depending on the global switch configuration 'bMAC_SpoofingAction'.
+ This parameter is only taken into account when 'bLearning' is enabled. */
+ gsw_bool_t bMAC_SpoofingDetection;
+ /** Port Flow Control Status. Enables the flow control function. */
+ GSW_portFlow_t eFlowCtrl;
+ /** Port monitor feature. Allows forwarding of egress and/or ingress
+ packets to the monitor port. If enabled, the monitor port gets
+ a copy of the selected packet type. */
+ GSW_portMonitor_t ePortMonitor;
+ /** Assign Interface RMON Counters for this Port - GSWIP-3.0 */
+ gsw_bool_t bIfCounters;
+ /** Interface RMON Counters Start Index - GSWIP-3.0.
+ Value of (-1) denotes unassigned Interface Counters.
+ Valid range : 0-255 available to be shared amongst ports in desired way*/
+ int nIfCountStartIdx;
+ /** Interface RMON Counters Mode - GSWIP-3.0 */
+ GSW_If_RMON_Mode_t eIfRMONmode;
+} GSW_portCfg_t;
+
+#define GSW_ERROR_BASE 1024
+/** \brief Enumeration for function status return. The upper four bits are reserved for error classification */
+typedef enum {
+ /** Correct or Expected Status */
+ GSW_statusOk = 0,
+ /** Generic or unknown error occurred */
+ GSW_statusErr = -1,
+ /** Invalid function parameter */
+ GSW_statusParam = -(GSW_ERROR_BASE + 2),
+ /** No space left in VLAN table */
+ GSW_statusVLAN_Space = -(GSW_ERROR_BASE + 3),
+ /** Requested VLAN ID not found in table */
+ GSW_statusVLAN_ID = -(GSW_ERROR_BASE + 4),
+ /** Invalid ioctl */
+ GSW_statusInvalIoctl = -(GSW_ERROR_BASE + 5),
+ /** Operation not supported by hardware */
+ GSW_statusNoSupport = -(GSW_ERROR_BASE + 6),
+ /** Timeout */
+ GSW_statusTimeout = -(GSW_ERROR_BASE + 7),
+ /** At least one value is out of range */
+ GSW_statusValueRange = -(GSW_ERROR_BASE + 8),
+ /** The PortId/QueueId/MeterId/etc. is not available in this hardware or the
+ selected feature is not available on this port */
+ GSW_statusPortInvalid = -(GSW_ERROR_BASE + 9),
+ /** The interrupt is not available in this hardware */
+ GSW_statusIRQ_Invalid = -(GSW_ERROR_BASE + 10),
+ /** The MAC table is full, an entry could not be added */
+ GSW_statusMAC_TableFull = -(GSW_ERROR_BASE + 11),
+ /** Locking failed - SWAPI is busy */
+ GSW_statusLock_Failed = -(GSW_ERROR_BASE + 12),
+ /** Multicast Forwarding table entry not found */
+ GSW_statusEntryNotFound = -(GSW_ERROR_BASE + 13),
+} GSW_return_t;
+
+/** \brief Meter Type - srTCM or trTCM. Defines the Metering algorithm Type.
+ Used by \ref GSW_QoS_meterCfg_t. */
+typedef enum {
+ /** srTCM Meter Type */
+ GSW_QOS_Meter_srTCM = 0,
+ /** trTCM Meter Type - GSWIP-3.0 only */
+ GSW_QOS_Meter_trTCM = 1,
+} GSW_QoS_Meter_Type;
+
+/** \brief Specifies the direction for ingress and egress.
+ Used by \ref GSW_QoS_meterPort_t and \ref GSW_QoS_meterPortGet_t. */
+typedef enum {
+ /** No direction. */
+ GSW_DIRECTION_NONE = 0,
+ /** Ingress direction. */
+ GSW_DIRECTION_INGRESS = 1,
+ /** Egress direction. */
+ GSW_DIRECTION_EGRESS = 2,
+ /** Ingress and egress direction. */
+ GSW_DIRECTION_BOTH = 3
+} GSW_direction_t;
+
+/** \brief DSCP Drop Precedence to color code assignment.
+ Used by \ref GSW_QoS_DSCP_DropPrecedenceCfg_t. */
+typedef enum {
+ /** Critical Packet. Metering never changes the drop precedence of these packets. */
+ GSW_DROP_PRECEDENCE_CRITICAL = 0,
+ /** Green Drop Precedence Packet. Packet is marked with a 'low' drop precedence. */
+ GSW_DROP_PRECEDENCE_GREEN = 1,
+ /** Yellow Drop Precedence Packet. Packet is marked with a 'middle' drop precedence. */
+ GSW_DROP_PRECEDENCE_YELLOW = 2,
+ /** Red Drop Precedence Packet. Packet is marked with a 'high' drop precedence. */
+ GSW_DROP_PRECEDENCE_RED = 3
+} GSW_QoS_DropPrecedence_t;
+
+
+/** \brief Selection of the traffic class field.
+ Used by \ref GSW_QoS_portCfg_t.
+ The port default traffic class is assigned in case non of the
+ configured protocol code points given by the packet. */
+typedef enum {
+ /** No traffic class assignment based on DSCP or PCP */
+ GSW_QOS_CLASS_SELECT_NO = 0,
+ /** Traffic class assignment based on DSCP. PCP information is ignored.
+ The Port Class is used in case DSCP is not available in the packet. */
+ GSW_QOS_CLASS_SELECT_DSCP = 1,
+ /** Traffic class assignment based on PCP. DSCP information is ignored.
+ The Port Class is used in case PCP is not available in the packet. */
+ GSW_QOS_CLASS_SELECT_PCP = 2,
+ /** Traffic class assignment based on DSCP. Make the assignment based on
+ PCP in case the DSCP information is not available in the packet header.
+ The Port Class is used in case both are not available in the packet. */
+ GSW_QOS_CLASS_SELECT_DSCP_PCP = 3,
+ /** CTAG VLAN PCP, IP DSCP. Traffic class assignment based
+ on CTAG VLAN PCP, alternative use DSCP based assignment. */
+ GSW_QOS_CLASS_SELECT_PCP_DSCP = 4,
+ /** STAG VLAN PCP. Traffic class assignment based
+ on STAG VLAN PCP. */
+ GSW_QOS_CLASS_SELECT_SPCP = 5,
+ /** STAG VLAN PCP, IP DSCP. Traffic class assignment based
+ on STAG VLAN PCP, alternative use DSCP based assignment. */
+ GSW_QOS_CLASS_SELECT_SPCP_DSCP = 6,
+ /** IP DSCP, STAG VLAN PCP. Traffic class assignment based
+ on DSCP, alternative use STAG VLAN PCP based assignment. */
+ GSW_QOS_CLASS_SELECT_DSCP_SPCP = 7,
+ /** STAG VLAN PCP, CTAG VLAN PCP. Traffic class assignment based
+ on STAG VLAN PCP, alternative use CTAG VLAN PCP based assignment. */
+ GSW_QOS_CLASS_SELECT_SPCP_PCP = 8,
+ /** STAG VLAN PCP, CTAG VLAN PCP, IP DSCP. Traffic class assignment
+ based on STAG VLAN PCP, alternative use CTAG VLAN PCP based
+ assignment, alternative use DSCP based assignment. */
+ GSW_QOS_CLASS_SELECT_SPCP_PCP_DSCP = 9,
+ /** IP DSCP, STAG VLAN PCP, CTAG VLAN PCP. Traffic class assignment
+ based on DSCP, alternative use STAG VLAN PCP based
+ assignment, alternative use CTAG VLAN PCP based assignment. */
+ GSW_QOS_CLASS_SELECT_DSCP_SPCP_PCP = 10
+} GSW_QoS_ClassSelect_t;
+
+
+/** \brief Configures the parameters of a rate meter instance.
+ Used by \ref GSW_QOS_METER_ALLOC, \ref GSW_QOS_METER_FREE,
+ \ref GSW_QOS_METER_CFG_SET and \ref GSW_QOS_METER_CFG_GET. */
+typedef struct {
+ /** Enable/Disable the meter shaper. */
+ gsw_bool_t bEnable;
+ /** Meter index (zero-based counting).
+
+ \remarks
+ For \ref GSW_QOS_METER_FREE, this is the only input and other fields are
+ ignored. For \ref GSW_QOS_METER_ALLOC, this is output when allocation
+ is successful. For \ref GSW_QOS_METER_CFG_SET and
+ \ref GSW_QOS_METER_CFG_GET, this is input to indicate meter to
+ configure/get-configuration. */
+ u16 nMeterId;
+ /** Meter Name string for easy reference (Id to Name Mapping) - TBD*/
+ char cMeterName[32];
+ /** Meter Algorithm Type */
+ GSW_QoS_Meter_Type eMtrType;
+ /** Committed Burst Size (CBS [Bytes]). */
+ u32 nCbs;
+ /** Committed Burst Size Exponent (CBS [Bytes]). */
+ u32 nCbs_ls;
+ /** Excess Burst Size (EBS [Bytes]). */
+ u32 nEbs;
+ /** Excess Burst Size Exponent (EBS [Bytes]). */
+ u32 nEbs_ls;
+ /** Committed Information Rate (CIR)
+
+ \remarks
+ CIR in [kbit/s] if \ref GSW_QoS_meterCfg_t::bPktMode is FALSE,
+ or in [packet/s] if \ref GSW_QoS_meterCfg_t::bPktMode is TRUE. */
+ u32 nRate;
+ /** Peak Information Rate (PIR) - applicable for trTCM only
+
+ \remarks
+ PIR in [kbit/s] if \ref GSW_QoS_meterCfg_t::bPktMode is FALSE,
+ or in [packet/s] if \ref GSW_QoS_meterCfg_t::bPktMode is TRUE. */
+ u32 nPiRate;
+ /** Peak Burst Size (PBS [Bytes]) - applicable for trTCM only */
+// u32 nPbs;
+ /** Meter colour mode **/
+ u8 nColourBlindMode;
+ /** Enable/Disable Packet Mode. 0- Byte, 1 - Pkt */
+ u8 bPktMode;
+ /** Enable/Disable local overhead for metering rate calculation. */
+ gsw_bool_t bLocalOverhd;
+ /** Local overhead for metering rate calculation when
+ \ref GSW_QoS_meterCfg_t::bLocalOverhd is TRUE. */
+ u16 nLocaloverhd;
+} GSW_QoS_meterCfg_t;
+
+
+/** \brief DSCP mapping table.
+ Used by \ref GSW_QOS_DSCP_CLASS_SET
+ and \ref GSW_QOS_DSCP_CLASS_GET. */
+typedef struct {
+ /** Traffic class associated with a particular DSCP value.
+ DSCP is the index to an array of resulting traffic class values.
+ The index starts counting from zero. */
+ u8 nTrafficClass[64];
+} GSW_QoS_DSCP_ClassCfg_t;
+
+
+/** \brief DSCP to Drop Precedence assignment table configuration.
+ Used by \ref GSW_QOS_DSCP_DROP_PRECEDENCE_CFG_SET
+ and \ref GSW_QOS_DSCP_DROP_PRECEDENCE_CFG_GET. */
+typedef struct {
+ /** DSCP to drop precedence assignment. Every array entry represents the
+ drop precedence for one of the 64 existing DSCP values.
+ DSCP is the index to an array of resulting drop precedence values.
+ The index starts counting from zero.
+ Value refers to \ref GSW_QoS_DropPrecedence_t. */
+ u8 nDSCP_DropPrecedence[64];
+} GSW_QoS_DSCP_DropPrecedenceCfg_t;
+
+/** \brief Ingress DSCP remarking attribute. This attribute defines on the
+ ingress port packets how these will be remarked on the egress port.
+ A packet is only remarked in case its ingress and its egress port
+ have remarking enabled.
+ Used by \ref GSW_QoS_portRemarkingCfg_t. */
+typedef enum {
+ /** No DSCP Remarking. No remarking is done on the egress port. */
+ GSW_DSCP_REMARK_DISABLE = 0,
+ /** TC DSCP 6-Bit Remarking. The complete DSCP remarking is done based
+ on the traffic class. The traffic class to DSCP value mapping is
+ given in a device global table. */
+ GSW_DSCP_REMARK_TC6 = 1,
+ /** TC DSCP 3-Bit Remarking. The upper 3-Bits of the DSCP field are
+ remarked based on the traffic class. The traffic class to DSCP value
+ mapping is given in a device global table. */
+ GSW_DSCP_REMARK_TC3 = 2,
+ /** Drop Precedence Remarking. The Drop Precedence is remarked on the
+ egress side. */
+ GSW_DSCP_REMARK_DP3 = 3,
+ /** TC Drop Precedence Remarking. The Drop Precedence is remarked on the
+ egress side and the upper 3-Bits of the DSCP field are
+ remarked based on the traffic class. The traffic class to DSCP value
+ mapping is given in a device global table. */
+ GSW_DSCP_REMARK_DP3_TC3 = 4
+} GSW_Qos_ingressRemarking_t;
+
+/** \brief Port Remarking Configuration. Ingress and Egress remarking options for
+ dedicated packet fields DSCP, CTAG VLAN PCP, STAG VLAN PCP
+ and STAG VLAN DEI.
+ Remarking is done either on the used traffic class or the
+ drop precedence.
+ Packet field specific remarking only applies on a packet if
+ enabled on ingress and egress port.
+ Used by \ref GSW_QOS_PORT_REMARKING_CFG_SET
+ and \ref GSW_QOS_PORT_REMARKING_CFG_GET. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. */
+ u16 nPortId;
+ /** Ingress DSCP Remarking. Specifies on ingress side how a packet should
+ be remarked. This DSCP remarking only works in case remarking is
+ enabled on the egress port.
+ This configuration requires that remarking is also enabled on the
+ egress port. DSCP remarking enable on either ingress or egress port
+ side does not perform any remark operation. */
+ GSW_Qos_ingressRemarking_t eDSCP_IngressRemarkingEnable;
+ /** Egress DSCP Remarking. Applies remarking on egress packets in a
+ fashion as specified on the ingress port. This ingress port remarking
+ is configured by the parameter 'eDSCP_IngressRemarking'.
+ This configuration requires that remarking is also enabled on the
+ ingress port. DSCP remarking enable on either ingress or egress port
+ side does not perform any remark operation. */
+ gsw_bool_t bDSCP_EgressRemarkingEnable;
+ /** Ingress PCP Remarking. Applies remarking to all port ingress packets.
+ This configuration requires that remarking is also enabled on the
+ egress port. PCP remarking enable on either ingress or egress port
+ side does not perform any remark operation. */
+ gsw_bool_t bPCP_IngressRemarkingEnable;
+ /** Egress PCP Remarking. Applies remarking for all port egress packets.
+ This configuration requires that remarking is also enabled on the
+ ingress port. PCP remarking enable on either ingress or egress port
+ side does not perform any remark operation. */
+ gsw_bool_t bPCP_EgressRemarkingEnable;
+ /** Ingress STAG VLAN PCP Remarking */
+ gsw_bool_t bSTAG_PCP_IngressRemarkingEnable;
+ /** Ingress STAG VLAN DEI Remarking */
+ gsw_bool_t bSTAG_DEI_IngressRemarkingEnable;
+ /** Egress STAG VLAN PCP & DEI Remarking */
+ gsw_bool_t bSTAG_PCP_DEI_EgressRemarkingEnable;
+} GSW_QoS_portRemarkingCfg_t;
+
+/** \brief Describes which priority information of ingress packets is used
+ (taken into account) to identify the packet priority and the related egress
+ priority queue. For DSCP, the priority to queue assignment is done
+ using \ref GSW_QOS_DSCP_CLASS_SET. For VLAN, the priority to queue
+ assignment is done using \ref GSW_QOS_PCP_CLASS_SET.
+ Used by \ref GSW_QOS_PORT_CFG_SET and \ref GSW_QOS_PORT_CFG_GET. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. */
+ u16 nPortId;
+ /** Select the packet header field on which to base the traffic class assignment. */
+ GSW_QoS_ClassSelect_t eClassMode;
+ /** Default port priority in case no other priority
+ (such as VLAN-based PCP or IP-based DSCP) is used. */
+ u8 nTrafficClass;
+} GSW_QoS_portCfg_t;
+
+/** \brief Traffic class associated with a particular 802.1P (PCP) priority mapping value.
+ This table is global for the entire switch device. Priority map entry structure.
+ Used by \ref GSW_QOS_CLASS_PCP_SET
+ and \ref GSW_QOS_CLASS_PCP_GET. */
+typedef struct {
+ /** Configures the traffic class to PCP (3-bit) mapping.
+ The queue index starts counting from zero. */
+ u8 nPCP[16];
+} GSW_QoS_ClassPCP_Cfg_t;
+
+
+/** \brief Traffic class associated with a particular 802.1P (PCP) priority mapping value.
+ This table is global for the entire switch device. Priority map entry structure.
+ Used by \ref GSW_QOS_PCP_CLASS_SET
+ and \ref GSW_QOS_PCP_CLASS_GET. */
+typedef struct {
+ /** Configures the PCP to traffic class mapping.
+ The queue index starts counting from zero. */
+ u8 nTrafficClass[16];
+} GSW_QoS_PCP_ClassCfg_t;
+
+/** \brief Describes the QoS Queue Mapping Mode. GSWIP-3.1 only.
+ Used by \ref GSW_QoS_queuePort_t. */
+typedef enum {
+ /** This is default mode where the QID is fixed at
+ \ref GSW_QOS_QUEUE_PORT_SET. */
+ GSW_QOS_QMAP_SINGLE_MODE = 0,
+ /** This is new mode in GSWIP-3.1. The QID given in
+ \ref GSW_QOS_QUEUE_PORT_SET is base, and bit 0~3 of sub-interface ID
+ is offset. The final QID is base + SubIfId[0:3]. */
+ GSW_QOS_QMAP_SUBIFID_MODE = 1
+} GSW_QoS_qMapMode_t;
+
+
+/** \brief Sets the Queue ID for one traffic class of one port.
+ Used by \ref GSW_QOS_QUEUE_PORT_SET and \ref GSW_QOS_QUEUE_PORT_GET. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available.
+ This is an input parameter for \ref GSW_QOS_QUEUE_PORT_GET. */
+ u16 nPortId;
+ /** Forward CPU (extraction) before external QoS queueing (DownMEP).
+ GSWIP-3.1 only. */
+ gsw_bool_t bExtrationEnable;
+ /** When \ref GSW_QoS_queuePort_t::bExtrationEnable is FALSE, this field
+ defines Queue Mapping Mode. GSWIP-3.1 only. */
+ GSW_QoS_qMapMode_t eQMapMode;
+ /** Traffic Class index (zero-based counting).
+ This is an input parameter for \ref GSW_QOS_QUEUE_PORT_GET. */
+ u8 nTrafficClassId;
+ /** QoS queue index (zero-based counting).
+ This is an output parameter for \ref GSW_QOS_QUEUE_PORT_GET. */
+ u8 nQueueId;
+ /** Queue Redirection bypass Option.
+ If enabled, all packets destined to 'nQueueId' are redirected from the
+ 'nPortId' to 'nRedirectPortId'. This is used for 2nd stage of FULL QoS
+ Path, where the packet has completed QoS process at CBM/CQEM and been
+ injected into GSWIP again. */
+ gsw_bool_t bRedirectionBypass;
+ /** Redirected traffic forward port.
+ All egress packets to 'nPortId' are redirected to "nRedirectPortId".
+ If there is no redirection required, it should be same as "nPortId".
+ GSWIP-3.0/3.1 only. */
+ u8 nRedirectPortId;
+
+ /** To enable Ingress PCE Bypass. Applicable for GSWIP 3.2 and above.
+ For \ref GSW_QoS_QueuePortGet, set TRUE as input to check whether
+ Ingress PCE Bypass is enabled, and this field is updated as output.
+ For \ref GSW_QoS_QueuePortSet, set FALSE to configure normal
+ path first, then set TRUE to configure Ingress PCE Bypass path
+ (only if application requires). */
+ gsw_bool_t bEnableIngressPceBypass;
+ /** Internal purpose only - user not allowed to use it.
+ Applicable for GSWIP 3.2 and above. */
+ gsw_bool_t bReservedPortMode;
+} GSW_QoS_queuePort_t;
+
+
+/** \brief Select the type of the Egress Queue Scheduler.
+ Used by \ref GSW_QoS_schedulerCfg_t. */
+typedef enum {
+ /** Strict Priority Scheduler. */
+ GSW_QOS_SCHEDULER_STRICT = 0,
+ /** Weighted Fair Queuing Shceduler. */
+ GSW_QOS_SCHEDULER_WFQ = 1
+} GSW_QoS_Scheduler_t;
+
+/** \brief Configures the egress queues attached to a single port, and that
+ are scheduled to transmit the queued Ethernet packets.
+ Used by \ref GSW_QOS_SCHEDULER_CFG_SET and \ref GSW_QOS_SCHEDULER_CFG_GET. */
+typedef struct {
+ /** QoS queue index (zero-based counting). */
+ u8 nQueueId;
+ /** Scheduler Type (Strict Priority/Weighted Fair Queuing).
+ Refers to \ref GSW_QoS_Scheduler_t for detail values. */
+ u8 eType;
+ /** Weight in Token. Parameter used for WFQ configuration.
+ Sets the weight in token in relation to all remaining
+ queues on this egress port having WFQ configuration.
+ This parameter is only used when 'eType=GSW_QOS_SCHEDULER_WFQ'. */
+ u16 nWeight;
+} GSW_QoS_schedulerCfg_t;
+
+/** \brief Configures a rate shaper instance with the rate and the burst size.
+ Used by \ref GSW_QOS_SHAPER_CFG_SET and \ref GSW_QOS_SHAPER_CFG_GET. */
+typedef struct {
+ /** Rate shaper index (zero-based counting). */
+ u8 nRateShaperId;
+ /** Enable/Disable the rate shaper. */
+ gsw_bool_t bEnable;
+ /** 802.1Qav credit based shaper mode. This specific shaper
+ algorithm mode is used by the audio/video bridging (AVB)
+ network (according to 802.1Qav). By default, an token
+ based shaper algorithm is used. */
+ gsw_bool_t bAVB;
+ /** Committed Burst Size (CBS [bytes]) */
+ u32 nCbs;
+ /** Rate [kbit/s] */
+ u32 nRate;
+} GSW_QoS_ShaperCfg_t;
+
+/** \brief Assign one rate shaper instance to a QoS queue.
+ Used by \ref GSW_QOS_SHAPER_QUEUE_ASSIGN and \ref GSW_QOS_SHAPER_QUEUE_DEASSIGN. */
+typedef struct {
+ /** Rate shaper index (zero-based counting). */
+ u8 nRateShaperId;
+ /** QoS queue index (zero-based counting). */
+ u8 nQueueId;
+} GSW_QoS_ShaperQueue_t;
+
+/** \brief Retrieve if a rate shaper instance is assigned to a QoS egress queue.
+ Used by \ref GSW_QOS_SHAPER_QUEUE_GET. */
+typedef struct {
+ /** QoS queue index (zero-based counting).
+ This parameter is the input parameter for the GET function. */
+ u8 nQueueId;
+ /** Rate shaper instance assigned.
+ If 1, a rate shaper instance is assigned to the queue. Otherwise no shaper instance is assigned. */
+ gsw_bool_t bAssigned;
+ /** Rate shaper index (zero-based counting). Only a valid instance is returned in case 'bAssigned == 1'. */
+ u8 nRateShaperId;
+} GSW_QoS_ShaperQueueGet_t;
+
+/** \brief Assigns one meter instances for storm control.
+ Used by \ref GSW_QOS_STORM_CFG_SET and \ref GSW_QOS_STORM_CFG_GET.
+ Not applicable to GSWIP-3.1. */
+typedef struct {
+ /** Meter index 0 (zero-based counting). */
+ u16 nMeterId;
+ /** Meter instances used for broadcast traffic. */
+ gsw_bool_t bBroadcast;
+ /** Meter instances used for multicast traffic. */
+ gsw_bool_t bMulticast;
+ /** Meter instances used for unknown unicast traffic. */
+ gsw_bool_t bUnknownUnicast;
+} GSW_QoS_stormCfg_t;
+
+/** \brief Egress Queue Congestion Notification Watermark.
+ Used by \ref GSW_QoS_WRED_Cfg_t. */
+typedef enum {
+ /**
+ >= 1/4 of green max water mark assert
+ <= 1/4 of green max water mark de assert*/
+ GSW_QOS_WRED_WATERMARK_1_4 = 0,
+ /**
+ >= 1/8 of green max water mark assert
+ <= 1/8 of green max water mark de assert*/
+ GSW_QOS_WRED_WATERMARK_1_8 = 1,
+ /**
+ >= 1/12 of green max water mark assert
+ <= 1/12 of green max water mark de assert*/
+ GSW_QOS_WRED_WATERMARK_1_12 = 2,
+ /**
+ >= 1/16 of green max water mark assert
+ <= 1/16 of green max water mark de assert*/
+ GSW_QOS_WRED_WATERMARK_1_16 = 3
+} GSW_QoS_WRED_WATERMARK_t;
+
+/** \brief Drop Probability Profile. Defines the drop probability profile.
+ Used by \ref GSW_QoS_WRED_Cfg_t. */
+typedef enum {
+ /** Pmin = 25%, Pmax = 75% (default) */
+ GSW_QOS_WRED_PROFILE_P0 = 0,
+ /** Pmin = 25%, Pmax = 50% */
+ GSW_QOS_WRED_PROFILE_P1 = 1,
+ /** Pmin = 50%, Pmax = 50% */
+ GSW_QOS_WRED_PROFILE_P2 = 2,
+ /** Pmin = 50%, Pmax = 75% */
+ GSW_QOS_WRED_PROFILE_P3 = 3
+} GSW_QoS_WRED_Profile_t;
+
+/** \brief WRED Cfg Type - Automatic (Adaptive) or Manual.
+ Used by \ref GSW_QoS_WRED_Cfg_t. */
+typedef enum {
+ /** Automatic - Adaptive Watermark Type - GSWIP-3.0/3.1 only*/
+ GSW_QOS_WRED_Adaptive = 0,
+ /** Manual Threshold Levels Type */
+ GSW_QOS_WRED_Manual = 1
+} GSW_QoS_WRED_Mode_t;
+
+/** \brief WRED Thresholds Mode Type. - GSWIP-3.0/3.1 only
+ Used by \ref GSW_QoS_WRED_Cfg_t. */
+typedef enum {
+ /** Local Thresholds Mode */
+ GSW_QOS_WRED_Local_Thresh = 0,
+ /** Global Thresholds Mode */
+ GSW_QOS_WRED_Global_Thresh = 1,
+ /** Port queue and Port WRED Thresholds */
+ GSW_QOS_WRED_Port_Thresh = 2,
+
+} GSW_QoS_WRED_ThreshMode_t;
+
+/** \brief Configures the global probability profile of the device.
+ The min. and max. threshold values are given in number of packet
+ buffer segments and required only in case of Manual Mode. The GSWIP-3.0/3.1 supports Auto mode and the threshold values are dynamically computed internally by GSWIP. The size of a segment can be retrieved using \ref GSW_CAP_GET.
+ Used by \ref GSW_QOS_WRED_CFG_SET and \ref GSW_QOS_WRED_CFG_GET. */
+typedef struct {
+ /** Egress Queue Congestion Notification Watermark
+ only applicable for GSWIP 3.1*/
+ GSW_QoS_WRED_WATERMARK_t eCongestionWatermark;
+ /** Drop Probability Profile. */
+ GSW_QoS_WRED_Profile_t eProfile;
+ /** Automatic or Manual Mode of Thresholds Config */
+ GSW_QoS_WRED_Mode_t eMode;
+ /** WRED Threshold Mode Config */
+ GSW_QoS_WRED_ThreshMode_t eThreshMode;
+ /** WRED Red Threshold Min [number of segments] - Valid for Manual Mode only. */
+ u16 nRed_Min;
+ /** WRED Red Threshold Max [number of segments] - Valid for Manual Mode only */
+ u16 nRed_Max;
+ /** WRED Yellow Threshold Min [number of segments] - Valid for Manual Mode only */
+ u16 nYellow_Min;
+ /** WRED Yellow Threshold Max [number of segments] - Valid for Manual Mode only */
+ u16 nYellow_Max;
+ /** WRED Green Threshold Min [number of segments] - Valid for Manual Mode only */
+ u16 nGreen_Min;
+ /** WRED Green Threshold Max [number of segments] - Valid for Manual Mode only */
+ u16 nGreen_Max;
+} GSW_QoS_WRED_Cfg_t;
+
+/** \brief Configures the WRED threshold level values.
+ The min. and max. values are given in number of packet
+ buffer segments. The size of a segment can be
+ retrieved using \ref GSW_CAP_GET.
+ Used by \ref GSW_QOS_WRED_QUEUE_CFG_SET and \ref GSW_QOS_WRED_QUEUE_CFG_GET. */
+typedef struct {
+ /** QoS queue index (zero-based counting). */
+ u16 nQueueId;
+ /** WRED Red Threshold Min [number of segments]. */
+ u16 nRed_Min;
+ /** WRED Red Threshold Max [number of segments]. */
+ u16 nRed_Max;
+ /** WRED Yellow Threshold Min [number of segments]. */
+ u16 nYellow_Min;
+ /** WRED Yellow Threshold Max [number of segments]. */
+ u16 nYellow_Max;
+ /** WRED Green Threshold Min [number of segments]. */
+ u16 nGreen_Min;
+ /** WRED Green Threshold Max [number of segments]. */
+ u16 nGreen_Max;
+ /** Reserved Buffer Threshold */
+ u16 nReserveThreshold;
+} GSW_QoS_WRED_QueueCfg_t;
+
+/** \brief Configures the WRED threshold parameter per port.
+ The configured thresholds apply to fill level sum
+ of all egress queues which are assigned to the egress port.
+ The min. and max. values are given in number of packet
+ buffer segments. The size of a segment can be
+ retrieved using \ref GSW_CAP_GET.
+ Used by \ref GSW_QOS_WRED_PORT_CFG_SET and \ref GSW_QOS_WRED_PORT_CFG_GET. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting).
+ The valid range is hardware dependent. */
+ u16 nPortId;
+ /** WRED Red Threshold Min [number of segments]. */
+ u16 nRed_Min;
+ /** WRED Red Threshold Max [number of segments]. */
+ u16 nRed_Max;
+ /** WRED Yellow Threshold Min [number of segments]. */
+ u16 nYellow_Min;
+ /** WRED Yellow Threshold Max [number of segments]. */
+ u16 nYellow_Max;
+ /** WRED Green Threshold Min [number of segments]. */
+ u16 nGreen_Min;
+ /** WRED Green Threshold Max [number of segments]. */
+ u16 nGreen_Max;
+} GSW_QoS_WRED_PortCfg_t;
+
+/** \brief Configures the global buffer flow control threshold for
+ conforming and non-conforming packets.
+ The min. and max. values are given in number of packet
+ buffer segments. The size of a segment can be
+ retrieved using \ref GSW_CAP_GET.
+ Used by \ref GSW_QOS_FLOWCTRL_CFG_SET and \ref GSW_QOS_FLOWCTRL_CFG_GET. */
+typedef struct {
+ /** Global Buffer Non Conforming Flow Control Threshold Minimum [number of segments]. */
+ u16 nFlowCtrlNonConform_Min;
+ /** Global Buffer Non Conforming Flow Control Threshold Maximum [number of segments]. */
+ u16 nFlowCtrlNonConform_Max;
+ /** Global Buffer Conforming Flow Control Threshold Minimum [number of segments]. */
+ u16 nFlowCtrlConform_Min;
+ /** Global Buffer Conforming Flow Control Threshold Maximum [number of segments]. */
+ u16 nFlowCtrlConform_Max;
+} GSW_QoS_FlowCtrlCfg_t;
+
+/** \brief Configures the ingress port flow control threshold for
+ used packet segments.
+ The min. and max. values are given in number of packet
+ buffer segments. The size of a segment can be
+ retrieved using \ref GSW_CAP_GET.
+ Used by \ref GSW_QOS_FLOWCTRL_PORT_CFG_SET and \ref GSW_QOS_FLOWCTRL_PORT_CFG_GET. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting).
+ The valid range is hardware dependent. */
+ u16 nPortId;
+ /** Ingress Port occupied Buffer Flow Control Threshold Minimum [number of segments]. */
+ u16 nFlowCtrl_Min;
+ /** Ingress Port occupied Buffer Flow Control Threshold Maximum [number of segments]. */
+ u16 nFlowCtrl_Max;
+} GSW_QoS_FlowCtrlPortCfg_t;
+
+/** \brief Reserved egress queue buffer segments.
+ Used by \ref GSW_QOS_QUEUE_BUFFER_RESERVE_CFG_SET and \ref GSW_QOS_QUEUE_BUFFER_RESERVE_CFG_GET. */
+typedef struct {
+ /** QoS queue index (zero-based counting).
+ This is an input parameter for \ref GSW_QOS_QUEUE_BUFFER_RESERVE_CFG_GET. */
+ u16 nQueueId;
+ /** Reserved Buffer Segment Threshold [number of segments].
+ This is an output parameter for \ref GSW_QOS_QUEUE_BUFFER_RESERVE_CFG_GET. */
+ u16 nBufferReserved;
+} GSW_QoS_QueueBufferReserveCfg_t;
+
+/** \brief Color Marking Table.
+ There are standards to define the marking table. User should use
+ \ref GSW_QOS_COLOR_MARKING_TABLE_SET to initialize the table before color
+ marking happens. \ref GSW_QOS_COLOR_MARKING_TABLE_GET is used to get
+ the marking table, mainly for debug purpose. */
+typedef struct {
+ /** Mode of color marking. */
+ GSW_ColorMarkingMode_t eMode;
+
+ /** If eMode is GSW_REMARKING_DSCP_AF, index stands for 6-bit DSCP value.
+ If eMode is one of GSW_REMARKING_PCP_8P0D, GSW_REMARKING_PCP_7P1D,
+ GSW_REMARKING_PCP_6P2D and GSW_REMARKING_PCP_5P3D, index 0-7 is
+ 3-bit PCP value with DEI is 0, and index 8-15 is 3-bit PCP value with
+ DEI is 1. Ignored in other modes. */
+ u8 nPriority[64];
+ /** If eMode is GSW_REMARKING_DSCP_AF, index stands for 6-bit DSCP value.
+ If eMode is one of GSW_REMARKING_PCP_8P0D, GSW_REMARKING_PCP_7P1D,
+ GSW_REMARKING_PCP_6P2D and GSW_REMARKING_PCP_5P3D, index 0-7 is 3-bit
+ PCP value with DEI is 0, and index 8-15 is 3-bit PCP value with DEI is 1.
+ Ignored in other modes.
+ Value refers to \ref GSW_QoS_DropPrecedence_t. */
+ u8 nColor[64];
+} GSW_QoS_colorMarkingEntry_t;
+
+/** \brief Color Remarking Table.
+ There are standards to define the remarking table. User should use
+ \ref GSW_QOS_COLOR_REMARKING_TABLE_SET to initialize the table before color
+ remarking happens. \ref GSW_QOS_COLOR_REMARKING_TABLE_GET is used to get
+ the remarking table, mainly for debug purpose. */
+typedef struct {
+ /** Mode of color remarking. */
+ GSW_ColorRemarkingMode_t eMode;
+
+ /** Index stands for color and priority. Index 0-7 is green color with
+ priority (traffic class) 0-7. Index 8-15 is yellow color with priority
+ (traffic class) 0-7. Value is DSCP if eMode is GSW_REMARKING_DSCP_AF.
+ Value bit 0 is DEI and bit 1-3 is PCP if eMode is one of
+ GSW_REMARKING_PCP_8P0D, GSW_REMARKING_PCP_7P1D, GSW_REMARKING_PCP_6P2D
+ and GSW_REMARKING_PCP_5P3D. Value is ignored for other mode. */
+ u8 nVal[16];
+} GSW_QoS_colorRemarkingEntry_t;
+
+
+/** \brief DSCP to PCP Mapping.
+ Used by \ref GSW_DSCP2PCP_MAP_GET. */
+typedef struct {
+ /** Index of entry in mapping table. */
+ u16 nIndex;
+
+ /** The index of array stands for DSCP value. Each byte of the array is 3-bit
+ PCP value. */
+ u8 nMap[64];
+} GSW_DSCP2PCP_map_t;
+
+/** \brief Traffic class associated with a particular STAG VLAN 802.1P (PCP) priority and Drop Eligible Indicator (DEI) mapping value.
+ This table is global for the entire switch device. Priority map entry structure.
+ The table index value is calculated by 'index=PCP + 8*DEI'
+ Used by \ref GSW_QOS_SVLAN_PCP_CLASS_SET and \ref GSW_QOS_SVLAN_PCP_CLASS_GET. */
+typedef struct {
+ /** Configures the PCP and DEI to traffic class mapping.
+ The queue index starts counting from zero. */
+ u8 nTrafficClass[16];
+ /** Configures the PCP traffic color.
+ Not applicable to GSWIP-3.1. */
+ u8 nTrafficColor[16];
+ /** PCP Remark disable control.
+ Not applicable to GSWIP-3.1. */
+ u8 nPCP_Remark_Enable[16];
+ /** DEI Remark disable control.
+ Not applicable to GSWIP-3.1. */
+ u8 nDEI_Remark_Enable[16];
+
+} GSW_QoS_SVLAN_PCP_ClassCfg_t;
+
+/** \brief MAC Table Clear Type
+ Used by \ref GSW_MAC_tableClearCond_t */
+typedef enum {
+ /** Clear dynamic entries based on Physical Port */
+ GSW_MAC_CLEAR_PHY_PORT = 0,
+ /** Clear all dynamic entries */
+ GSW_MAC_CLEAR_DYNAMIC = 1,
+} GSW_MacClearType_t;
+
+/** \brief MAC Table Clear based on given condition.
+ Used by \ref GSW_MAC_TABLE_CLEAR_COND. */
+typedef struct {
+ /** MAC table clear type \ref GSW_MacClearType_t */
+ u8 eType;
+ union {
+ /** Physical port id (0~16) if \ref eType is
+ ref GSW_MAC_CLEAR_PHY_PORT. */
+ u8 nPortId;
+ };
+} GSW_MAC_tableClearCond_t;
+
+/** \brief MAC Table Entry to be added.
+ Used by \ref GSW_MAC_TABLE_ENTRY_ADD. */
+typedef struct {
+ /** Filtering Identifier (FID) (not supported by all switches) */
+ u16 nFId;
+ /** Ethernet Port number (zero-based counting) in GSWIP-2.1/2.2/3.0. From
+ GSWIP-3.1, this field is Bridge Port ID. The valid range is hardware
+ dependent.
+
+ \remarks
+ In GSWIP-2.1/2.2/3.0, this field is used as portmap field, when the MSB
+ bit is set. In portmap mode, every value bit represents an Ethernet port.
+ LSB represents Port 0 with incrementing counting.
+ The (MSB - 1) bit represent the last port.
+ The macro \ref GSW_PORTMAP_FLAG_SET allows to set the MSB bit,
+ marking it as portmap variable.
+ Checking the portmap flag can be done by
+ using the \ref GSW_PORTMAP_FLAG_GET macro.
+ From GSWIP3.1, if MSB is set, other bits in this field are ignored.
+ array \ref GSW_MAC_tableRead_t::nPortMap is used for bit map. */
+ u32 nPortId;
+ /** Bridge Port Map - to support GSWIP-3.1, following field is added
+ for port map in static entry. It's valid only when MSB of
+ \ref GSW_MAC_tableRead_t::nPortId is set. Each bit stands for 1 bridge
+ port. */
+ u16 nPortMap[8]; /* max can be 16 */
+ /** Sub-Interface Identifier Destination (supported in GSWIP-3.0/3.1 only).
+
+ \remarks
+ In GSWIP-3.1, this field is sub interface ID for WLAN logical port. For
+ Other types, either outer VLAN ID if Nto1Vlan enabled or 0. */
+ u16 nSubIfId;
+ /** Aging Time, given in multiples of 1 second in a range
+ from 1 s to 1,000,000 s.
+ The configured value might be rounded that it fits to the given hardware platform. */
+ int nAgeTimer;
+ /** STAG VLAN Id. Only applicable in case SVLAN support is enabled on the device. */
+ u16 nSVLAN_Id;
+ /** Static Entry (value will be aged out if the entry is not set to static). The
+ switch API implementation uses the maximum age timer in case the entry
+ is not static. */
+ gsw_bool_t bStaticEntry;
+ /** Egress queue traffic class.
+ The queue index starts counting from zero. */
+ u8 nTrafficClass;
+ /** MAC Address to add to the table. */
+ u8 nMAC[GSW_MAC_ADDR_LEN];
+ /** Source/Destination MAC address filtering flag (GSWIP-3.1 only)
+ Value 0 - not filter, 1 - source address filter,
+ 2 - destination address filter, 3 - both source and destination filter.
+
+ \remarks
+ Please refer to "GSWIP Hardware Architecture Spec" chapter 3.4.4.6
+ "Source MAC Address Filtering and Destination MAC Address Filtering"
+ for more detail. */
+ u8 nFilterFlag;
+ /** Packet is marked as IGMP controlled if destination MAC address matches
+ MAC in this entry. (GSWIP-3.1 only) */
+ gsw_bool_t bIgmpControlled;
+
+ /** Associated Mac address -(GSWIP-3.2)*/
+ u8 nAssociatedMAC[GSW_MAC_ADDR_LEN];
+
+ /** TCI for (GSWIP-3.2) B-Step
+ Bit [0:11] - VLAN ID
+ Bit [12] - VLAN CFI/DEI
+ Bit [13:15] - VLAN PRI */
+ u16 nTci;
+} GSW_MAC_tableAdd_t;
+
+/** \brief MAC Table Entry to be read.
+ Used by \ref GSW_MAC_TABLE_ENTRY_READ. */
+typedef struct {
+ /** Restart the get operation from the beginning of the table. Otherwise
+ return the next table entry (next to the entry that was returned
+ during the previous get operation). This boolean parameter is set by the
+ calling application. */
+ gsw_bool_t bInitial;
+ /** Indicates that the read operation got all last valid entries of the
+ table. This boolean parameter is set by the switch API
+ when the Switch API is called after the last valid one was returned already. */
+ gsw_bool_t bLast;
+ /** Get the MAC table entry belonging to the given Filtering Identifier
+ (not supported by all switches). */
+ u16 nFId;
+ /** Ethernet Port number (zero-based counting) in GSWIP-2.1/2.2/3.0. From
+ GSWIP-3.1, this field is Bridge Port ID. The valid range is hardware
+ dependent.
+
+ \remarks
+ In GSWIP-2.1/2.2/3.0, this field is used as portmap field, when the MSB
+ bit is set. In portmap mode, every value bit represents an Ethernet port.
+ LSB represents Port 0 with incrementing counting.
+ The (MSB - 1) bit represent the last port.
+ The macro \ref GSW_PORTMAP_FLAG_SET allows to set the MSB bit,
+ marking it as portmap variable.
+ Checking the portmap flag can be done by
+ using the \ref GSW_PORTMAP_FLAG_GET macro.
+ From GSWIP3.1, if MSB is set, other bits in this field are ignored.
+ array \ref GSW_MAC_tableRead_t::nPortMap is used for bit map. */
+ u32 nPortId;
+ /** Bridge Port Map - to support GSWIP-3.1, following field is added
+ for port map in static entry. It's valid only when MSB of
+ \ref GSW_MAC_tableRead_t::nPortId is set. Each bit stands for 1 bridge
+ port. */
+ u16 nPortMap[8]; /* max can be 16 */
+ /** Aging Time, given in multiples of 1 second in a range from 1 s to 1,000,000 s.
+ The value read back in a GET command might differ slightly from the value
+ given in the SET command due to limited hardware timing resolution.
+ Filled out by the switch API implementation. */
+ int nAgeTimer;
+ /** STAG VLAN Id. Only applicable in case SVLAN support is enabled on the device. */
+ u16 nSVLAN_Id;
+ /** Static Entry (value will be aged out after 'nAgeTimer' if the entry
+ is not set to static). */
+ gsw_bool_t bStaticEntry;
+ /** Sub-Interface Identifier Destination (supported in GSWIP-3.0/3.1 only). */
+ u16 nSubIfId;
+ /** MAC Address. Filled out by the switch API implementation. */
+ u8 nMAC[GSW_MAC_ADDR_LEN];
+ /** Source/Destination MAC address filtering flag (GSWIP-3.1 only)
+ Value 0 - not filter, 1 - source address filter,
+ 2 - destination address filter, 3 - both source and destination filter.
+
+ \remarks
+ Please refer to "GSWIP Hardware Architecture Spec" chapter 3.4.4.6
+ "Source MAC Address Filtering and Destination MAC Address Filtering"
+ for more detail. */
+ u8 nFilterFlag;
+ /** Packet is marked as IGMP controlled if destination MAC address matches
+ MAC in this entry. (GSWIP-3.1 only) */
+ gsw_bool_t bIgmpControlled;
+
+ /** Changed
+ 0: the entry is not changed
+ 1: the entry is changed and not accessed yet */
+
+ gsw_bool_t bEntryChanged;
+
+ /** Associated Mac address -(GSWIP-3.2)*/
+ u8 nAssociatedMAC[GSW_MAC_ADDR_LEN];
+ /* MAC Table Hit Status Update (Supported in GSWip-3.1/3.2) */
+ gsw_bool_t hitstatus;
+ /** TCI for (GSWIP-3.2) B-Step
+ Bit [0:11] - VLAN ID
+ Bit [12] - VLAN CFI/DEI
+ Bit [13:15] - VLAN PRI */
+ u16 nTci;
+ u16 nFirstBridgePortId;
+} GSW_MAC_tableRead_t;
+
+/** \brief Search for a MAC address entry in the address table.
+ Used by \ref GSW_MAC_TABLE_ENTRY_QUERY. */
+typedef struct {
+ /** MAC Address. This parameter needs to be provided for the search operation.
+ This is an input parameter. */
+ u8 nMAC[GSW_MAC_ADDR_LEN];
+ /** Get the MAC table entry belonging to the given Filtering Identifier
+ (not supported by all switches).
+ This is an input parameter. */
+ u16 nFId;
+ /** MAC Address Found. Switch API sets this boolean variable in case
+ the requested MAC address 'nMAC' is found inside the address table,
+ otherwise it is set to FALSE.
+ This is an output parameter. */
+ gsw_bool_t bFound;
+ /** Ethernet Port number (zero-based counting) in GSWIP-2.1/2.2/3.0. From
+ GSWIP-3.1, this field is Bridge port ID. The valid range is hardware
+ dependent.
+
+ \remarks
+ In GSWIP-2.1/2.2/3.0, this field is used as portmap field, when the MSB
+ bit is set. In portmap mode, every value bit represents an Ethernet port.
+ LSB represents Port 0 with incrementing counting.
+ The (MSB - 1) bit represent the last port.
+ The macro \ref GSW_PORTMAP_FLAG_SET allows to set the MSB bit,
+ marking it as portmap variable.
+ Checking the portmap flag can be done by
+ using the \ref GSW_PORTMAP_FLAG_GET macro.
+ From GSWIP3.1, if MSB is set, other bits in this field are ignored.
+ array \ref GSW_MAC_tableRead_t::nPortMap is used for bit map. */
+ u32 nPortId;
+ /** Bridge Port Map - to support GSWIP-3.1, following field is added
+ for port map in static entry. It's valid only when MSB of
+ \ref GSW_MAC_tableRead_t::nPortId is set. Each bit stands for 1 bridge
+ port. */
+ u16 nPortMap[8]; /* max can be 16 */
+ /** Sub-Interface Identifier Destination (supported in GSWIP-3.0/3.1 only). */
+ u16 nSubIfId;
+ /** Aging Time, given in multiples of 1 second in a range from 1 s to 1,000,000 s.
+ The value read back in a GET command might differ slightly from the value
+ given in the SET command due to limited hardware timing resolution.
+ Filled out by the switch API implementation.
+ This is an output parameter. */
+ int nAgeTimer;
+ /** STAG VLAN Id. Only applicable in case SVLAN support is enabled on the device. */
+ u16 nSVLAN_Id;
+ /** Static Entry (value will be aged out after 'nAgeTimer' if the entry
+ is not set to static).
+ This is an output parameter. */
+ gsw_bool_t bStaticEntry;
+ /** Source/Destination MAC address filtering flag (GSWIP-3.1 only)
+ Value 0 - not filter, 1 - source address filter,
+ 2 - destination address filter, 3 - both source and destination filter.
+
+ \remarks
+ Please refer to "GSWIP Hardware Architecture Spec" chapter 3.4.4.6
+ "Source MAC Address Filtering and Destination MAC Address Filtering"
+ for more detail. */
+ u8 nFilterFlag;
+ /** Packet is marked as IGMP controlled if destination MAC address matches
+ MAC in this entry. (GSWIP-3.1 only) */
+ gsw_bool_t bIgmpControlled;
+ /** Changed
+ 0: the entry is not changed
+ 1: the entry is changed and not accessed yet */
+ gsw_bool_t bEntryChanged;
+ /** Associated Mac address -(GSWIP-3.2)*/
+ u8 nAssociatedMAC[GSW_MAC_ADDR_LEN];
+
+ /* MAC Table Hit Status Update (Supported in GSWip-3.1/3.2) */
+ gsw_bool_t hitstatus;
+ /** TCI for (GSWIP-3.2) B-Step
+ Bit [0:11] - VLAN ID
+ Bit [12] - VLAN CFI/DEI
+ Bit [13:15] - VLAN PRI */
+ u16 nTci;
+ /** first bridge port ID (supported in GSWIP-3.3only) */
+ u16 nFirstBridgePortId;
+} GSW_MAC_tableQuery_t;
+
+/** \brief MAC Table Entry to be removed.
+ Used by \ref GSW_MAC_TABLE_ENTRY_REMOVE. */
+typedef struct {
+ /** Filtering Identifier (FID) (not supported by all switches) */
+ u16 nFId;
+ /** MAC Address to be removed from the table. */
+ u8 nMAC[GSW_MAC_ADDR_LEN];
+ /** Source/Destination MAC address filtering flag (GSWIP-3.1 only)
+ Value 0 - not filter, 1 - source address filter,
+ 2 - destination address filter, 3 - both source and destination filter.
+
+ \remarks
+ Please refer to "GSWIP Hardware Architecture Spec" chapter 3.4.4.6
+ "Source MAC Address Filtering and Destination MAC Address Filtering"
+ for more detail. */
+ u8 nFilterFlag;
+ /** TCI for (GSWIP-3.2) B-Step
+ Bit [0:11] - VLAN ID
+ Bit [12] - VLAN CFI/DEI
+ Bit [13:15] - VLAN PRI */
+ u16 nTci;
+} GSW_MAC_tableRemove_t;
+
+/** \brief MAC Address Filter Type.
+ Used by \ref GSW_MACFILTER_default_t */
+typedef enum {
+ /** Source MAC Address Filter */
+ GSW_MACFILTERTYPE_SRC = 0,
+ /** Destination MAC Address Filter */
+ GSW_MACFILTERTYPE_DEST = 1
+} GSW_MacFilterType_t;
+
+/** \brief Default MAC Address Filter.
+ Used by \ref GSW_DEFAUL_MAC_FILTER_SET and \ref GSW_DEFAUL_MAC_FILTER_GET */
+typedef struct {
+ /** MAC Filter Type */
+ GSW_MacFilterType_t eType;
+
+ /** Destination bridge port map. For GSWIP-3.1 only.
+
+ \remarks
+ Each bit stands for 1 bridge port. For PRX300 (GSWIP-3.1 integrated),
+ only index 0-7 is valid. */
+ u16 nPortmap[8]; /* max can be 16 */
+} GSW_MACFILTER_default_t;
+
+/** \brief Aging Timer Value.
+ Used by \ref GSW_cfg_t. */
+typedef enum {
+ /** 1 second aging time */
+ GSW_AGETIMER_1_SEC = 1,
+ /** 10 seconds aging time */
+ GSW_AGETIMER_10_SEC = 2,
+ /** 300 seconds aging time */
+ GSW_AGETIMER_300_SEC = 3,
+ /** 1 hour aging time */
+ GSW_AGETIMER_1_HOUR = 4,
+ /** 24 hours aging time */
+ GSW_AGETIMER_1_DAY = 5,
+ /** Custom aging time in seconds */
+ GSW_AGETIMER_CUSTOM = 6
+} GSW_ageTimer_t;
+
+// #ifdef CONFIG_GSWIP_EVLAN
+typedef enum {
+ GSW_EXTENDEDVLAN_TPID_VTETYPE_1 = 0,
+ GSW_EXTENDEDVLAN_TPID_VTETYPE_2 = 1,
+ GSW_EXTENDEDVLAN_TPID_VTETYPE_3 = 2,
+ GSW_EXTENDEDVLAN_TPID_VTETYPE_4 = 3
+} GSW_ExtendedVlan_4_Tpid_Mode_t;
+
+/** \brief Extended VLAN Filter TPID Field.
+ Used by \ref GSW_EXTENDEDVLAN_filterVLAN_t. */
+typedef enum {
+ /** Do not filter. */
+ GSW_EXTENDEDVLAN_FILTER_TPID_NO_FILTER = 0,
+ /** TPID is 0x8100. */
+ GSW_EXTENDEDVLAN_FILTER_TPID_8021Q = 1,
+ /** TPID is global configured value. */
+ GSW_EXTENDEDVLAN_FILTER_TPID_VTETYPE = 2
+} GSW_ExtendedVlanFilterTpid_t;
+
+/** \brief Extended VLAN Treatment Set TPID.
+ Used by \ref GSW_EXTENDEDVLAN_treatmentVlan_t. */
+typedef enum {
+ /** TPID is copied from inner VLAN tag of received packet. */
+ GSW_EXTENDEDVLAN_TREATMENT_INNER_TPID = 0,
+ /** TPID is copied from outer VLAN tag of received packet. */
+ GSW_EXTENDEDVLAN_TREATMENT_OUTER_TPID = 1,
+ /** TPID is global configured value. */
+ GSW_EXTENDEDVLAN_TREATMENT_VTETYPE = 2,
+ /** TPID is 0x8100. */
+ GSW_EXTENDEDVLAN_TREATMENT_8021Q = 3
+} GSW_ExtendedVlanTreatmentTpid_t;
+
+/** \brief Extended VLAN Filter DEI Field.
+ Used by \ref GSW_EXTENDEDVLAN_filterVLAN_t. */
+typedef enum {
+ /** Do not filter. */
+ GSW_EXTENDEDVLAN_FILTER_DEI_NO_FILTER = 0,
+ /** DEI is 0. */
+ GSW_EXTENDEDVLAN_FILTER_DEI_0 = 1,
+ /** DEI is 1. */
+ GSW_EXTENDEDVLAN_FILTER_DEI_1 = 2
+} GSW_ExtendedVlanFilterDei_t;
+
+/** \brief Extended VLAN Treatment Set DEI.
+ Used by \ref GSW_EXTENDEDVLAN_treatmentVlan_t. */
+typedef enum {
+ /** DEI (if applicable) is copied from inner VLAN tag of received packet. */
+ GSW_EXTENDEDVLAN_TREATMENT_INNER_DEI = 0,
+ /** DEI (if applicable) is copied from outer VLAN tag of received packet. */
+ GSW_EXTENDEDVLAN_TREATMENT_OUTER_DEI = 1,
+ /** DEI is 0. */
+ GSW_EXTENDEDVLAN_TREATMENT_DEI_0 = 2,
+ /** DEI is 1. */
+ GSW_EXTENDEDVLAN_TREATMENT_DEI_1 = 3
+} GSW_ExtendedVlanTreatmentDei_t;
+
+/** \brief Extended VLAN Filter Type.
+ Used by \ref GSW_EXTENDEDVLAN_filterVLAN_t. */
+typedef enum {
+ /** There is tag and criteria applies. */
+ GSW_EXTENDEDVLAN_FILTER_TYPE_NORMAL = 0,
+ /** There is tag but no criteria. */
+ GSW_EXTENDEDVLAN_FILTER_TYPE_NO_FILTER = 1,
+ /** Default entry if no other rule applies. */
+ GSW_EXTENDEDVLAN_FILTER_TYPE_DEFAULT = 2,
+ /** There is no tag. */
+ GSW_EXTENDEDVLAN_FILTER_TYPE_NO_TAG = 3,
+ /** Block invalid*/
+ GSW_EXTENDEDVLAN_BLOCK_INVALID = 4
+} GSW_ExtendedVlanFilterType_t;
+
+/** \brief Extended VLAN Filter EtherType.
+ Used by \ref GSW_EXTENDEDVLAN_filterVLAN_t. */
+typedef enum {
+ /** Do not filter. */
+ GSW_EXTENDEDVLAN_FILTER_ETHERTYPE_NO_FILTER = 0,
+ /** IPoE frame (Ethertyp is 0x0800). */
+ GSW_EXTENDEDVLAN_FILTER_ETHERTYPE_IPOE = 1,
+ /** PPPoE frame (Ethertyp is 0x8863 or 0x8864). */
+ GSW_EXTENDEDVLAN_FILTER_ETHERTYPE_PPPOE = 2,
+ /** ARP frame (Ethertyp is 0x0806). */
+ GSW_EXTENDEDVLAN_FILTER_ETHERTYPE_ARP = 3,
+ /** IPv6 IPoE frame (Ethertyp is 0x86DD). */
+ GSW_EXTENDEDVLAN_FILTER_ETHERTYPE_IPV6IPOE = 4,
+ /** EAPOL (Ethertyp is 0x888E). */
+ GSW_EXTENDEDVLAN_FILTER_ETHERTYPE_EAPOL = 5,
+ /** DHCPV4 (UDP DESTINATION PORT 67&68). */
+ GSW_EXTENDEDVLAN_FILTER_ETHERTYPE_DHCPV4 = 6,
+ /** DHCPV6 (UDP DESTINATION PORT 546&547). */
+ GSW_EXTENDEDVLAN_FILTER_ETHERTYPE_DHCPV6 = 7
+} GSW_ExtendedVlanFilterEthertype_t;
+
+/** \brief Extended VLAN Treatment Set Priority.
+ Used by \ref GSW_EXTENDEDVLAN_treatmentVlan_t. */
+typedef enum {
+ /** Set priority with given value. */
+ GSW_EXTENDEDVLAN_TREATMENT_PRIORITY_VAL = 0,
+ /** Prority value is copied from inner VLAN tag of received packet. */
+ GSW_EXTENDEDVLAN_TREATMENT_INNER_PRORITY = 1,
+ /** Prority value is copied from outer VLAN tag of received packet. */
+ GSW_EXTENDEDVLAN_TREATMENT_OUTER_PRORITY = 2,
+ /** Prority value is derived from DSCP field of received packet. */
+ GSW_EXTENDEDVLAN_TREATMENT_DSCP = 3
+} GSW_ExtendedVlanTreatmentPriority_t;
+
+/** \brief Extended VLAN Treatment Set VID.
+ Used by \ref GSW_EXTENDEDVLAN_treatmentVlan_t. */
+typedef enum {
+ /** Set VID with given value. */
+ GSW_EXTENDEDVLAN_TREATMENT_VID_VAL = 0,
+ /** VID is copied from inner VLAN tag of received packet. */
+ GSW_EXTENDEDVLAN_TREATMENT_INNER_VID = 1,
+ /** VID is copied from outer VLAN tag of received packet. */
+ GSW_EXTENDEDVLAN_TREATMENT_OUTER_VID = 2,
+} GSW_ExtendedVlanTreatmentVid_t;
+
+/** \brief Extended VLAN Treatment Remove Tag.
+ Used by \ref GSW_EXTENDEDVLAN_treatmentVlan_t. */
+typedef enum {
+ /** Do not remove VLAN tag. */
+ GSW_EXTENDEDVLAN_TREATMENT_NOT_REMOVE_TAG = 0,
+ /** Remove 1 VLAN tag following DA/SA. */
+ GSW_EXTENDEDVLAN_TREATMENT_REMOVE_1_TAG = 1,
+ /** Remove 2 VLAN tag following DA/SA. */
+ GSW_EXTENDEDVLAN_TREATMENT_REMOVE_2_TAG = 2,
+ /** Discard upstream traffic. */
+ GSW_EXTENDEDVLAN_TREATMENT_DISCARD_UPSTREAM = 3,
+} GSW_ExtendedVlanTreatmentRemoveTag_t;
+
+/** \brief Extended VLAN Filter VLAN Tag.
+ Used by \ref GSW_EXTENDEDVLAN_filter_t. */
+typedef struct {
+ /** Filter Type: normal filter, default rule, or no tag */
+ GSW_ExtendedVlanFilterType_t eType;
+ /** Enable priority field filtering. */
+ gsw_bool_t bPriorityEnable;
+ /** Filter priority value if bPriorityEnable is TRUE. */
+ u32 nPriorityVal;
+ /** Enable VID filtering. */
+ gsw_bool_t bVidEnable;
+ /** Filter VID if bVidEnable is TRUE. */
+ u32 nVidVal;
+ /** Mode to filter TPID of VLAN tag. */
+ GSW_ExtendedVlanFilterTpid_t eTpid;
+ /** Mode to filter DEI of VLAN tag. */
+ GSW_ExtendedVlanFilterDei_t eDei;
+} GSW_EXTENDEDVLAN_filterVLAN_t;
+
+/** \brief Extended VLAN Treatment VLAN Tag.
+ Used by \ref GSW_EXTENDEDVLAN_treatment_t. */
+typedef struct {
+ /** Select source of priority field of VLAN tag. */
+ GSW_ExtendedVlanTreatmentPriority_t ePriorityMode;
+ /** If \ref GSW_EXTENDEDVLAN_treatmentVlan_t::ePriorityMode is
+ \ref GSW_EXTENDEDVLAN_TREATMENT_PRIORITY_VAL, use this value for
+ priority field of VLAN tag. */
+ u32 ePriorityVal;
+ /** Select source of VID field of VLAN tag. */
+ GSW_ExtendedVlanTreatmentVid_t eVidMode;
+ /** If \ref GSW_EXTENDEDVLAN_treatmentVlan_t::eVidMode is
+ \ref GSW_EXTENDEDVLAN_TREATMENT_VID_VAL, use this value for VID field
+ of VLAN tag. */
+ u32 eVidVal;
+ /** Select source of TPID field of VLAN tag. */
+ GSW_ExtendedVlanTreatmentTpid_t eTpid;
+ /** Select source of DEI field of VLAN tag. */
+ GSW_ExtendedVlanTreatmentDei_t eDei;
+} GSW_EXTENDEDVLAN_treatmentVlan_t;
+
+
+/** \brief Extended VLAN Filter.
+ Used by \ref GSW_EXTENDEDVLAN_config_t. */
+typedef struct {
+ /** Filter on Original Packet. */
+ gsw_bool_t bOriginalPacketFilterMode;
+ GSW_ExtendedVlan_4_Tpid_Mode_t eFilter_4_Tpid_Mode;
+ /** Filter for outer VLAN tag. */
+ GSW_EXTENDEDVLAN_filterVLAN_t sOuterVlan;
+ /** Filter for inner VLAN tag. */
+ GSW_EXTENDEDVLAN_filterVLAN_t sInnerVlan;
+ /** Filter EtherType. */
+ GSW_ExtendedVlanFilterEthertype_t eEtherType;
+} GSW_EXTENDEDVLAN_filter_t;
+
+
+/** \brief Extended VLAN Allocation.
+ Used by \ref GSW_EXTENDEDVLAN_ALLOC and \ref GSW_EXTENDEDVLAN_FREE. */
+typedef struct {
+ /** Total number of extended VLAN entries are requested. Proper value should
+ be given for \ref GSW_EXTENDEDVLAN_ALLOC. This field is ignored for
+ \ref GSW_EXTENDEDVLAN_FREE. */
+ u16 nNumberOfEntries;
+
+ /** If \ref GSW_EXTENDEDVLAN_ALLOC is successful, a valid ID will be returned
+ in this field. Otherwise, \ref INVALID_HANDLE is returned in this field.
+ For \ref GSW_EXTENDEDVLAN_FREE, this field should be valid ID returned by
+ \ref GSW_EXTENDEDVLAN_ALLOC. */
+ u16 nExtendedVlanBlockId;
+} GSW_EXTENDEDVLAN_alloc_t;
+
+/** \brief Extended VLAN Treatment.
+ Used by \ref GSW_EXTENDEDVLAN_config_t. */
+typedef struct {
+ /** Number of VLAN tag(s) to remove. */
+ GSW_ExtendedVlanTreatmentRemoveTag_t eRemoveTag;
+
+ GSW_ExtendedVlan_4_Tpid_Mode_t eTreatment_4_Tpid_Mode;
+
+ /** Enable outer VLAN tag add/modification. */
+ gsw_bool_t bAddOuterVlan;
+ /** If bAddOuterVlan is TRUE, add or modify outer VLAN tag. */
+ GSW_EXTENDEDVLAN_treatmentVlan_t sOuterVlan;
+
+ /** Enable inner VLAN tag add/modification. */
+ gsw_bool_t bAddInnerVlan;
+ /** If bAddInnerVlan is TRUE, add or modify inner VLAN tag. */
+ GSW_EXTENDEDVLAN_treatmentVlan_t sInnerVlan;
+
+ /** Enable re-assignment of bridge port. */
+ gsw_bool_t bReassignBridgePort;
+ /** If bReassignBridgePort is TRUE, use this value for bridge port. */
+ u16 nNewBridgePortId;
+
+ /** Enable new DSCP. */
+ gsw_bool_t bNewDscpEnable;
+ /** If bNewDscpEnable is TRUE, use this value for DSCP. */
+ u16 nNewDscp;
+
+ /** Enable new traffic class. */
+ gsw_bool_t bNewTrafficClassEnable;
+ /** If bNewTrafficClassEnable is TRUE, use this value for traffic class. */
+ u8 nNewTrafficClass;
+
+ /** Enable new meter. */
+ gsw_bool_t bNewMeterEnable;
+ /** New meter ID.
+
+ \remarks
+ Meter should be allocated with \ref GSW_QOS_METER_ALLOC before extended
+ VLAN treatment is added. If this extended VLAN treatment is deleted,
+ this meter should be released with \ref GSW_QOS_METER_FREE. */
+ u16 sNewTrafficMeterId;
+
+ /** DSCP to PCP mapping, if
+ \ref GSW_EXTENDEDVLAN_treatmentVlan_t::ePriorityMode in
+ \ref GSW_EXTENDEDVLAN_treatment_t::sOuterVlan.ePriorityMode or
+ \ref GSW_EXTENDEDVLAN_treatment_t::sInnerVlan.ePriorityMode is
+ \ref GSW_EXTENDEDVLAN_TREATMENT_DSCP.
+
+ \remarks
+ The index of array stands for DSCP value. Each byte of the array is 3-bit
+ PCP value. For implementation, if DSCP2PCP is separate hardware table,
+ a resource management mechanism should be implemented. Allocation happens
+ when extended VLAN treatment added, and release happens when the
+ treatment is deleted. For debug, the DSCP2PCP table can be dumped with
+ \ref GSW_DSCP2PCP_MAP_GET. */
+ u8 nDscp2PcpMap[64];
+
+ /** Enable loopback. */
+ gsw_bool_t bLoopbackEnable;
+ /** Enable destination/source MAC address swap. */
+ gsw_bool_t bDaSaSwapEnable;
+ /** Enable traffic mirrored to the monitoring port. */
+ gsw_bool_t bMirrorEnable;
+} GSW_EXTENDEDVLAN_treatment_t;
+
+/** \brief Extended VLAN Configuration.
+ Used by \ref GSW_EXTENDEDVLAN_SET and \ref GSW_EXTENDEDVLAN_GET. */
+typedef struct {
+ /** This should be valid ID returned by \ref GSW_EXTENDEDVLAN_ALLOC.
+ If it is \ref INVALID_HANDLE, \ref GSW_EXTENDEDVLAN_config_t::nEntryIndex
+ is absolute index of Extended VLAN entry in hardware for debug purpose,
+ bypassing any check. */
+ u16 nExtendedVlanBlockId;
+
+ /** Index of entry, ranges between 0 and
+ \ref GSW_EXTENDEDVLAN_alloc_t::nNumberOfEntries - 1, to
+ set (\ref GSW_EXTENDEDVLAN_SET) or get (\ref GSW_EXTENDEDVLAN_GET)
+ Extended VLAN Configuration entry. For debug purpose, this field could be
+ absolute index of Entended VLAN entry in hardware, when
+ \ref GSW_EXTENDEDVLAN_config_t::nExtendedVlanBlockId is
+ \ref INVALID_HANDLE. */
+ u16 nEntryIndex;
+
+ /** Extended VLAN Filter */
+ GSW_EXTENDEDVLAN_filter_t sFilter;
+ /** Extended VLAN Treatment */
+ GSW_EXTENDEDVLAN_treatment_t sTreatment;
+} GSW_EXTENDEDVLAN_config_t;
+
+/** \brief VLAN Filter Allocation.
+ Used by \ref GSW_VLANFILTER_ALLOC and \ref GSW_VLANFILTER_FREE. */
+typedef struct {
+ /** Total number of VLAN Filter entries are requested. Proper value should
+ be given for \ref GSW_VLANFILTER_ALLOC. This field is ignored for
+ \ref GSW_VLANFILTER_FREE. */
+ u16 nNumberOfEntries;
+
+ /** If \ref GSW_VLANFILTER_ALLOC is successful, a valid ID will be returned
+ in this field. Otherwise, \ref INVALID_HANDLE is returned in this field.
+ For \ref GSW_EXTENDEDVLAN_FREE, this field should be valid ID returned by
+ \ref GSW_VLANFILTER_ALLOC. */
+ u16 nVlanFilterBlockId;
+
+ /** Discard packet without VLAN tag. */
+ gsw_bool_t bDiscardUntagged;
+ /** Discard VLAN tagged packet not matching any filter entry. */
+ gsw_bool_t bDiscardUnmatchedTagged;
+ /** Use default port VLAN ID for VLAN filtering
+
+ \remarks
+ This field is not available in PRX300. */
+ gsw_bool_t bUseDefaultPortVID;
+} GSW_VLANFILTER_alloc_t;
+
+/** \brief VLAN Filter.
+ Used by \ref GSW_VLANFILTER_SET and \ref GSW_VLANFILTER_GET */
+typedef struct {
+ /** This should be valid ID return by \ref GSW_VLANFILTER_ALLOC.
+ If it is \ref INVALID_HANDLE, \ref GSW_VLANFILTER_config_t::nEntryIndex
+ is absolute index of VLAN Filter entry in hardware for debug purpose,
+ bypassing any check. */
+ u16 nVlanFilterBlockId;
+
+ /** Index of entry. ranges between 0 and
+ \ref GSW_VLANFILTER_alloc_t::nNumberOfEntries - 1, to
+ set (\ref GSW_VLANFILTER_SET) or get (\ref GSW_VLANFILTER_GET)
+ VLAN FIlter entry. For debug purpose, this field could be absolute index
+ of VLAN Filter entry in hardware, when
+ \ref GSW_VLANFILTER_config_t::nVlanFilterBlockId is
+ \ref INVALID_HANDLE. */
+ u16 nEntryIndex;
+
+ /** VLAN TCI filter mask mode.
+
+ \remarks
+ In GSWIP-3.1, this field of first entry in the block will applies to rest
+ of entries in the same block. */
+ GSW_VlanFilterTciMask_t eVlanFilterMask;
+
+ /** This is value for VLAN filtering. It depends on
+ \ref GSW_VLANFILTER_config_t::eVlanFilterMask.
+ For GSW_VLAN_FILTER_TCI_MASK_VID, this is 12-bit VLAN ID.
+ For GSW_VLAN_FILTER_TCI_MASK_PCP, this is 3-bit PCP field of VLAN tag.
+ For GSW_VLAN_FILTER_TCI_MASK_TCI, this is 16-bit TCI of VLAN tag. */
+ u32 nVal;
+ /** Discard packet if match. */
+ gsw_bool_t bDiscardMatched;
+} GSW_VLANFILTER_config_t;
+
+/* VLAN Rmon Counters */
+typedef enum {
+ GSW_VLAN_RMON_RX = 0,
+ GSW_VLAN_RMON_TX = 1,
+ GSW_VLAN_RMON__PCE_BYPASS = 2,
+} GSW_VlanRMON_Type_t;
+
+/**
+ \brief RMON Counters structure for VLAN. */
+typedef struct {
+ u16 nVlanCounterIndex;
+ GSW_VlanRMON_Type_t eVlanRmonType;
+ u32 nByteCountHigh;
+ u32 nByteCountLow;
+ u32 nTotalPktCount;
+ u32 nMulticastPktCount;
+ u32 nDropPktCount;
+ u32 clear_all;
+} GSW_VLAN_RMON_cnt_t;
+
+/**
+ \brief RMON Counters control structure for VLAN. */
+typedef struct {
+ gsw_bool_t bVlanRmonEnable;
+ gsw_bool_t bIncludeBroadCastPktCounting;
+ u32 nVlanLastEntry;
+} GSW_VLAN_RMON_control_t;
+
+/** \brief VLAN Counter Mapping. */
+typedef enum {
+ /** VLAN Mapping for Ingress */
+ GSW_VLAN_MAPPING_INGRESS = 0,
+ /** VLAN Mapping for Egress */
+ GSW_VLAN_MAPPING_EGRESS = 1,
+ /** VLAN Mapping for Ingress and Egress */
+ GSW_VLAN_MAPPING_INGRESS_AND_EGRESS = 2
+} GSW_VlanCounterMappingType_t;
+
+/** \brief VLAN Counter Mapping Filter. */
+typedef enum {
+ /** There is tag and criteria applies. */
+ GSW_VLANCOUNTERMAP_FILTER_TYPE_NORMAL = 0,
+ /** There is tag but no criteria. */
+ GSW_VLANCOUNTERMAP_FILTER_TYPE_NO_FILTER = 1,
+ /** Default entry if no other rule applies. */
+ GSW_VLANCOUNTERMAP_FILTER_TYPE_DEFAULT = 2,
+ /** There is no tag. */
+ GSW_VLANCOUNTERMAP_FILTER_TYPE_NO_TAG = 3,
+ /** Filter invalid*/
+ GSW_VLANCOUNTERMAP_FILTER_INVALID = 4,
+} GSW_VlanCounterMapFilterType_t;
+
+/** \brief VLAN Counter Mapping Configuration. */
+typedef struct {
+ /** Counter Index */
+ u8 nCounterIndex;
+ /** Ctp Port Id */
+ u16 nCtpPortId;
+ /** Priority Enable */
+ gsw_bool_t bPriorityEnable;
+ /** Priority Val */
+ u32 nPriorityVal;
+ /** VLAN Id Enable */
+ gsw_bool_t bVidEnable;
+ /** VLAN Id Value */
+ u32 nVidVal;
+ /** VLAN Tag Selection Value */
+ gsw_bool_t bVlanTagSelectionEnable;
+ /** VLAN Counter Mapping Type */
+ GSW_VlanCounterMappingType_t eVlanCounterMappingType;
+ /** VLAN Counter Mapping Filter Type */
+ GSW_VlanCounterMapFilterType_t eVlanCounterMappingFilterType;
+} GSW_VlanCounterMapping_config_t;
+// #endif
+
+/** \brief Add an Ethernet port as router port to the switch hardware multicast table.
+ Used by \ref GSW_MULTICAST_ROUTER_PORT_ADD and \ref GSW_MULTICAST_ROUTER_PORT_REMOVE. */
+typedef struct {
+ /** Bridge Port ID. The valid range is hardware dependent.
+ An error code is delivered if the selected port is not available.
+
+ \remarks
+ This field is used as portmap field, when the MSB bit is set.
+ In portmap mode, every value bit represents an Ethernet port.
+ LSB represents Port 0 with incrementing counting.
+ The (MSB - 1) bit represent the last port.
+ The macro \ref GSW_PORTMAP_FLAG_SET allows to set the MSB bit,
+ marking it as portmap variable.
+ Checking the portmap flag can be done by
+ using the \ref GSW_PORTMAP_FLAG_GET macro. */
+ u16 nPortId;
+} GSW_multicastRouter_t;
+
+/** \brief Check if a port has been selected as a router port.
+ Used by \ref GSW_MULTICAST_ROUTER_PORT_READ. Not applicable to GSWIP-3.1. */
+typedef struct {
+ /** Restart the get operation from the start of the table. Otherwise
+ return the next table entry (next to the entry that was returned
+ during the previous get operation). This parameter is always reset
+ during the read operation. This boolean parameter is set by the
+ calling application. */
+ gsw_bool_t bInitial;
+ /** Indicates that the read operation got all last valid entries of the
+ table. This boolean parameter is set by the switch API
+ when the Switch API is called after the last valid one was returned already. */
+ gsw_bool_t bLast;
+ /** Ethernet Port number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. */
+ u16 nPortId;
+} GSW_multicastRouterRead_t;
+
+
+/** \brief Configure the IGMP snooping mode.
+ Used by \ref GSW_multicastSnoopCfg_t. */
+typedef enum {
+ /** IGMP management packet snooping and multicast level 3 table learning
+ is disabled. */
+ GSW_MULTICAST_SNOOP_MODE_DISABLED = 0,
+ /** IGMP management packet snooping is enabled and used for the hardware
+ auto-learning to fill the multicast level 3 table.
+ This is not supported and reserved. */
+ GSW_MULTICAST_SNOOP_MODE_AUTOLEARNING = 1,
+ /** IGMP management packet snooping is enabled and forwarded to the
+ configured port. No autolearning of the multicast level 3 table. This
+ table has to be maintained by the management software. */
+ GSW_MULTICAST_SNOOP_MODE_FORWARD = 2
+} GSW_multicastSnoopMode_t;
+
+/** \brief Packet forwarding.
+ Used by \ref GSW_STP_BPDU_Rule_t and \ref GSW_multicastSnoopCfg_t
+ and \ref GSW_8021X_EAPOL_Rule_t. */
+typedef enum {
+ /** Default; portmap is determined by the forwarding classification. */
+ GSW_PORT_FORWARD_DEFAULT = 0,
+ /** Discard; discard packets. */
+ GSW_PORT_FORWARD_DISCARD = 1,
+ /** Forward to the CPU port. This requires that the CPU port is previously
+ set by calling \ref GSW_CPU_PORT_CFG_SET. */
+ GSW_PORT_FORWARD_CPU = 2,
+ /** Forward to a port, selected by the parameter 'nForwardPortId'.
+ Please note that this feature is not supported by all
+ hardware platforms. */
+ GSW_PORT_FORWARD_PORT = 3
+} GSW_portForward_t;
+
+/** \brief Configures the Spanning Tree Protocol state of an Ethernet port.
+ Used by \ref GSW_STP_PORT_CFG_SET
+ and \ref GSW_STP_PORT_CFG_GET. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting) in GSWIP-2.1/2.2/3.0. From
+ GSWIP-3.1, this field is Bridge Port ID. The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. */
+ u16 nPortId;
+ /** Filtering Identifier (FID) (not supported by all switches).
+ The FID allows to keep multiple STP states per physical Ethernet port.
+ Multiple CTAG VLAN groups could be a assigned to one FID and therefore
+ share the same STP port state. Switch API ignores the FID value
+ in case the switch device does not support it or switch CTAG VLAN
+ awareness is disabled. */
+ u16 nFId;
+ /** Spanning Tree Protocol state of the port. */
+ GSW_STP_PortState_t ePortState;
+} GSW_STP_portCfg_t;
+
+/** \brief Spanning tree packet detection and forwarding.
+ Used by \ref GSW_STP_BPDU_RULE_SET
+ and \ref GSW_STP_BPDU_RULE_GET. */
+typedef struct {
+ /** Filter spanning tree packets and forward them, discard them or
+ disable the filter. */
+ GSW_portForward_t eForwardPort;
+ /** Target (bridge) port for forwarded packets; only used if selected by
+ 'eForwardPort'. Forwarding is done
+ if 'eForwardPort = GSW_PORT_FORWARD_PORT'. */
+ u8 nForwardPortId;
+} GSW_STP_BPDU_Rule_t;
+
+/** \brief Configure the IGMP report suppression mode.
+ Used by \ref GSW_multicastSnoopCfg_t. */
+typedef enum {
+ /** Report Suppression and Join Aggregation. */
+ GSW_MULTICAST_REPORT_JOIN = 0,
+ /** Report Suppression. No Join Aggregation. */
+ GSW_MULTICAST_REPORT = 1,
+ /** Transparent Mode. No Report Suppression and no Join Aggregation. */
+ GSW_MULTICAST_TRANSPARENT = 2
+} GSW_multicastReportSuppression_t;
+
+/** \brief Configure the switch multicast configuration.
+ Used by \ref GSW_MULTICAST_SNOOP_CFG_SET and \ref GSW_MULTICAST_SNOOP_CFG_GET. */
+typedef struct {
+ /** Enables and configures the IGMP/MLD snooping feature.
+ Select autolearning or management packet forwarding mode.
+ Packet forwarding is done to the port selected in 'eForwardPort'. */
+ GSW_multicastSnoopMode_t eIGMP_Mode;
+ /** Enables snooped IGMP control packets treated as cross-CTAG VLAN packets. This
+ parameter is used for hardware auto-learning and snooping packets
+ forwarded to a dedicated port. This dedicated port can be selected
+ over 'eForwardPort'. */
+ gsw_bool_t bCrossVLAN;
+ /** Forward snooped packet, only used if forwarded mode
+ is selected by
+ 'eIGMP_Mode = GSW_MULTICAST_SNOOP_MODE_SNOOPFORWARD'. */
+ GSW_portForward_t eForwardPort;
+ /** Target Bridge Port ID for forwarded packets, only used if selected
+ by 'eForwardPort = GSW_PORT_FORWARD_PORT'. */
+ u8 nForwardPortId;
+ /** Snooping control class of service.
+ Snooping control packet can be forwarded to the 'nForwardPortId' when
+ selected in 'eIGMP_Mode'. The class of service of this port can be
+ selected for the snooped control packets, starting from zero.
+ The maximum possible service class depends
+ on the hardware platform used. The value
+ GSW_TRAFFIC_CLASS_DISABLE disables overwriting the given
+ class assignment. */
+ u8 nClassOfService;
+} GSW_multicastSnoopCfg_t;
+
+
+/** \brief For debugging Purpose only.
+ Used for GSWIP 3.3. */
+typedef struct {
+ /** Table Index to get status of the Table Index only for GSWIP 3.1 */
+ u16 nTableIndex;
+ /** Force table Index In USEonly for GSWIP 3.1 */
+ u8 nForceSet;
+ /** To check dispaly index which are In USE for GSWIP 3.1 */
+ gsw_bool_t nCheckIndexInUse;
+ /** Vlan Filter or Exvlan BlockID*/
+ u16 nblockid;
+ /** Vlan Filter debugging usage*/
+ u8 nDiscardUntagged;
+ /** Vlan Filter debugging usage*/
+ u8 nDiscardUnMatchedTagged;
+ /** Pmac debugging purpose*/
+ u8 nPmacId;
+ /** Pmac debugging purpose*/
+ u8 nDestPort;
+} GSW_debug_t;
+
+/** \brief Global Switch configuration Attributes.
+ Used by \ref GSW_CFG_SET and \ref GSW_CFG_GET. */
+typedef struct {
+ /** MAC table aging timer. After this timer expires the MAC table
+ entry is aged out. */
+ GSW_ageTimer_t eMAC_TableAgeTimer;
+ /** If eMAC_TableAgeTimer = GSW_AGETIMER_CUSTOM, this variable defines
+ MAC table aging timer in seconds. */
+ u32 nAgeTimer;
+ /** Maximum Ethernet packet length. */
+ u16 nMaxPacketLen;
+ /** Automatic MAC address table learning limitation consecutive action.
+ These frame addresses are not learned, but there exists control as to whether
+ the frame is still forwarded or dropped.
+
+ - False: Drop
+ - True: Forward
+ */
+ gsw_bool_t bLearningLimitAction;
+ /** Accept or discard MAC port locking violation packets.
+ MAC spoofing detection features identifies ingress packets that carry
+ a MAC source address which was previously learned on a different
+ ingress port (learned by MAC bridging table). This also applies to
+ static added entries. MAC address port locking is configured on
+ port level by 'bLearningMAC_PortLock'.
+
+ - False: Drop
+ - True: Forward
+ */
+ gsw_bool_t bMAC_LockingAction;
+ /** Accept or discard MAC spoofing and port MAC locking violation packets.
+ MAC spoofing detection features identifies ingress packets that carry
+ a MAC source address which was previously learned on a different
+ ingress port (learned by MAC bridging table). This also applies to
+ static added entries. MAC spoofing detection is enabled on port
+ level by 'bMAC_SpoofingDetection'.
+
+ - False: Drop
+ - True: Forward
+ */
+ gsw_bool_t bMAC_SpoofingAction;
+ /** Pause frame MAC source address mode. If enabled, use the alternative
+ address specified with 'nMAC'. */
+ gsw_bool_t bPauseMAC_ModeSrc;
+ /** Pause frame MAC source address. */
+ u8 nPauseMAC_Src[GSW_MAC_ADDR_LEN];
+} GSW_cfg_t;
+
+
+/** \brief Special tag Ethertype mode */
+typedef enum {
+ /** The EtherType field of the Special Tag of egress packets is always set
+ to a prefined value. This same defined value applies for all
+ switch ports. */
+ GSW_CPU_ETHTYPE_PREDEFINED = 0,
+ /** The Ethertype field of the Special Tag of egress packets is set to
+ the FlowID parameter, which is a results of the switch flow
+ classification result. The switch flow table rule provides this
+ FlowID as action parameter. */
+ GSW_CPU_ETHTYPE_FLOWID = 1
+} GSW_CPU_SpecialTagEthType_t;
+
+
+/** \brief Parser Flags and Offsets Header settings on CPU Port for GSWIP-3.0.
+ Used by \ref GSW_CPU_PortCfg_t. */
+typedef enum {
+ /** No Parsing Flags or Offsets accompanying to CPU Port for this combination */
+ GSW_CPU_PARSER_NIL = 0,
+ /** 8-Bytes Parsing Flags (Bit 63:0) accompanying to CPU Port for this combination */
+ GSW_CPU_PARSER_FLAGS = 1,
+ /** 40-Bytes Offsets (Offset-0 to -39) + 8-Bytes Parsing Flags (Bit 63:0) accompanying to CPU Port for this combination */
+ GSW_CPU_PARSER_OFFSETS_FLAGS = 2,
+ /** Reserved - for future use */
+ GSW_CPU_PARSER_RESERVED = 3
+} GSW_CPU_ParserHeaderCfg_t;
+
+/** \brief FCS and Pad Insertion operations for GSWIP 3.1
+ Used by \ref GSW_CPU_PortCfgSet/Get. */
+typedef enum {
+ /** CRC Pad Insertion Enable */
+ GSW_CRC_PAD_INS_EN = 0,
+ /** CRC Insertion Enable Pad Insertion Disable */
+ GSW_CRC_EN_PAD_DIS = 1,
+ /** CRC Pad Insertion Disable */
+ GSW_CRC_PAD_INS_DIS = 2
+} GSW_FCS_TxOps_t;
+
+/** \brief Defines one port that is directly connected to the CPU and its applicable settings.
+ Used by \ref GSW_CPU_PORT_CFG_SET and \ref GSW_CPU_PORT_CFG_GET. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting) set to CPU Port. The valid number is hardware
+ dependent. (E.g. Port number 0 for GSWIP-3.0 or 6 for GSWIP-2.x). An error code is delivered if the selected port is not
+ available. */
+ u16 nPortId;
+ /** CPU port validity.
+ Set command: set true to define a CPU port, set false to undo the setting.
+ Get command: true if defined as CPU, false if not defined as CPU port. */
+ gsw_bool_t bCPU_PortValid;
+ /** Special tag enable in ingress direction. */
+ gsw_bool_t bSpecialTagIngress;
+ /** Special tag enable in egress direction. */
+ gsw_bool_t bSpecialTagEgress;
+ /** Enable FCS check
+
+ - false: No check, forward all frames
+ - 1: Check FCS, drop frames with errors
+ */
+ gsw_bool_t bFcsCheck;
+ /** Enable FCS generation
+
+ - false: Forward packets without FCS
+ - 1: Generate FCS for all frames
+ */
+ gsw_bool_t bFcsGenerate;
+ /** Special tag Ethertype mode. Not applicable to GSWIP-3.1. */
+ GSW_CPU_SpecialTagEthType_t bSpecialTagEthType;
+ /** GSWIP-3.0 specific Parser Header Config for no MPE flags (i.e. MPE1=0, MPE2=0). */
+ GSW_CPU_ParserHeaderCfg_t eNoMPEParserCfg;
+ /** GSWIP-3.0 specific Parser Header Config for MPE-1 set flag (i.e. MPE1=1, MPE2=0). */
+ GSW_CPU_ParserHeaderCfg_t eMPE1ParserCfg;
+ /** GSWIP-3.0 specific Parser Header Config for MPE-2 set flag (i.e. MPE1=0, MPE2=1). */
+ GSW_CPU_ParserHeaderCfg_t eMPE2ParserCfg;
+ /** GSWIP-3.0 specific Parser Header Config for both MPE-1 and MPE-2 set flag (i.e. MPE1=1, MPE2=1). */
+ GSW_CPU_ParserHeaderCfg_t eMPE1MPE2ParserCfg;
+ /** GSWIP-3.1 FCS tx Operations. */
+ GSW_FCS_TxOps_t bFcsTxOps;
+ /** GSWIP-3.2 Time Stamp Field Removal for PTP Packet
+ 0 - DIS Removal is disabled
+ 1 - EN Removal is enabled
+ */
+ gsw_bool_t bTsPtp;
+ /** GSWIP-3.2 Time Stamp Field Removal for Non-PTP Packet
+ 0 - DIS Removal is disabled
+ 1 - EN Removal is enabled
+ */
+ gsw_bool_t bTsNonptp;
+} GSW_CPU_PortCfg_t;
+
+/** \brief Defines the multicast group member mode.
+ Used by \ref GSW_multicastTable_t and \ref GSW_multicastTableRead_t. */
+typedef enum {
+ /** Include source IP address membership mode.
+ Only supported for IGMPv3. */
+ GSW_IGMP_MEMBER_INCLUDE = 0,
+ /** Exclude source IP address membership mode.
+ Only supported for IGMPv2. */
+ GSW_IGMP_MEMBER_EXCLUDE = 1,
+ /** Group source IP address is 'don't care'. This means all source IP
+ addresses (*) are included for the multicast group membership.
+ This is the default mode for IGMPv1 and IGMPv2. */
+ GSW_IGMP_MEMBER_DONT_CARE = 2,
+
+ GSW_IGMP_MEMBER_INVALID,
+} GSW_IGMP_MemberMode_t;
+
+/** \brief Add a host as a member to a multicast group.
+ Used by \ref GSW_MULTICAST_TABLE_ENTRY_ADD and \ref GSW_MULTICAST_TABLE_ENTRY_REMOVE. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting) in GSWIP-2.1/2.2/3.0. From
+ GSWIP-3.1, this field is Bridge Port ID. The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. */
+ u32 nPortId;
+ /** Sub-Interface Id - valid for GSWIP 3.0/3.1 only */
+ u16 nSubIfId;
+ /** Select the IP version of the 'uIP_Gda' and 'uIP_Gsa' fields.
+ Both fields support either IPv4 or IPv6. */
+ GSW_IP_Select_t eIPVersion;
+ /** Group Destination IP address (GDA). */
+ GSW_IP_t uIP_Gda;
+ /** Group Source IP address. Only used in case IGMPv3 support is enabled
+ and 'eModeMember != GSW_IGMP_MEMBER_DONT_CARE'. */
+ GSW_IP_t uIP_Gsa;
+ /** FID - valid for GSWIP 3.0 only subject to Global FID for MC is enabled.
+ always valid in GSWIP-3.1. */
+ u8 nFID;
+ /** Exclude Mode - valid for GSWIP 3.0 only - Includes or Excludes Source IP - uIP_Gsa */
+ gsw_bool_t bExclSrcIP;
+ /** Group member filter mode.
+ This is valid for GSWIP-3.0/3.1 to replaces bExclSrcIP.
+ This parameter is ignored when deleting a multicast membership table entry.
+ The configurations 'GSW_IGMP_MEMBER_EXCLUDE'
+ and 'GSW_IGMP_MEMBER_INCLUDE' are only supported
+ if IGMPv3 is used. */
+ GSW_IGMP_MemberMode_t eModeMember;
+ /** TCI for (GSWIP-3.2) B-Step
+ Bit [0:11] - VLAN ID
+ Bit [12] - VLAN CFI/DEI
+ Bit [13:15] - VLAN PRI */
+ u16 nTci;
+} GSW_multicastTable_t;
+
+
+/** \brief Read out the multicast membership table.
+ Used by \ref GSW_MULTICAST_TABLE_ENTRY_READ. */
+typedef struct {
+ /** Restart the get operation from the beginning of the table. Otherwise
+ return the next table entry (next to the entry that was returned
+ during the previous get operation). This parameter is always reset
+ during the read operation. This boolean parameter is set by the
+ calling application. */
+ gsw_bool_t bInitial;
+ /** Indicates that the read operation got all last valid entries of the
+ table. This boolean parameter is set by the switch API
+ when the Switch API is called after the last valid one was returned already. */
+ gsw_bool_t bLast;
+ /** Ethernet Port number (zero-based counting) in GSWIP-2.1/2.2/3.0. From
+ GSWIP-3.1, this field is Bridge Port ID. The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available.
+
+ \remarks
+ This field is used as portmap field, when the MSB bit is set.
+ In portmap mode, every value bit represents an Ethernet port.
+ LSB represents Port 0 with incrementing counting.
+ The (MSB - 1) bit represent the last port.
+ The macro \ref GSW_PORTMAP_FLAG_SET allows to set the MSB bit,
+ marking it as portmap variable.
+ Checking the portmap flag can be done by
+ using the \ref GSW_PORTMAP_FLAG_GET macro. */
+ u32 nPortId;
+ /** Ethernet Port Map - to support GSWIP-3.1, following field is added
+ for port map in static entry. It's valid only when MSB of nPortId is set.
+ Each bit stands for 1 bridge port. */
+ u16 nPortMap[8]; /* max can be 16 */
+ /** Sub-Interface Id - valid for GSWIP 3.0 only */
+ u16 nSubIfId;
+ /** Select the IP version of the 'uIP_Gda' and 'uIP_Gsa' fields.
+ Both fields support either IPv4 or IPv6. */
+ GSW_IP_Select_t eIPVersion;
+ /** Group Destination IP address (GDA). */
+ GSW_IP_t uIP_Gda;
+ /** Group Source IP address. Only used in case IGMPv3 support is enabled. */
+ GSW_IP_t uIP_Gsa;
+ /** FID - valid for GSWIP 3.0 only subject to Global FID for MC is enabled */
+ u8 nFID;
+ /** Exclude Mode - valid for GSWIP 3.0 only - Includes or Excludes Source IP - uIP_Gsa */
+ gsw_bool_t bExclSrcIP;
+ /** Group member filter mode.
+ This parameter is ignored when deleting a multicast membership table entry.
+ The configurations 'GSW_IGMP_MEMBER_EXCLUDE'
+ and 'GSW_IGMP_MEMBER_INCLUDE' are only supported
+ if IGMPv3 is used. */
+ GSW_IGMP_MemberMode_t eModeMember;
+ /* MULTICAST Table Hit Status Update (Supported in GSWip-3.1/3.2) */
+ gsw_bool_t hitstatus;
+ /** TCI for (GSWIP-3.2) B-Step
+ Bit [0:11] - VLAN ID
+ Bit [12] - VLAN CFI/DEI
+ Bit [13:15] - VLAN PRI */
+ u16 nTci;
+} GSW_multicastTableRead_t;
+
+
+/** \brief Global Ethernet trunking configuration.
+ Used by \ref GSW_TRUNKING_CFG_GET
+ and \ref GSW_TRUNKING_CFG_SET. */
+typedef struct {
+ /** IP source address is used by the
+ hash algorithm to calculate the egress trunking port index. */
+ gsw_bool_t bIP_Src;
+ /** IP destination address is used by the
+ hash algorithm to calculate the egress trunking port index. */
+ gsw_bool_t bIP_Dst;
+ /** MAC source address is used by the
+ hash algorithm to calculate the egress trunking port index. */
+ gsw_bool_t bMAC_Src;
+ /** MAC destination address is used by the
+ hash algorithm to calculate the egress trunking port index. */
+ gsw_bool_t bMAC_Dst;
+ /** TCP/UDP Source Port is used by the
+ hash algorithm to calculate the egress trunking port index. */
+ gsw_bool_t bSrc_Port;
+ /** TCP/UDP Destination Port is used by the
+ hash algorithm to calculate the egress trunking port index. */
+ gsw_bool_t bDst_Port;
+} GSW_trunkingCfg_t;
+
+/** \brief I-TAG header defintion .GSWIP-3.2 only
+ Used by \ref GSW_PBB_Tunnel_Template_Config_t*/
+typedef struct {
+ /**I-TAG TPID -2 bytes field*/
+ gsw_bool_t bTpidEnable;
+ u16 nTpid;
+
+ /**I-TAG PCP -3 Bit field*/
+ gsw_bool_t bPcpEnable;
+ u8 nPcp;
+
+ /**I-TAG DEI -1 Bit field*/
+ gsw_bool_t bDeiEnable;
+ u8 nDei;
+
+ /**I-TAG UAC -1 Bit field*/
+ gsw_bool_t bUacEnable;
+ u8 nUac;
+
+ /**I-TAG RES -3 Bit field*/
+ gsw_bool_t bResEnable;
+ u8 nRes;
+
+ /**I-TAG SID -24 Bit field*/
+ gsw_bool_t bSidEnable;
+ u32 nSid;
+} GSW_I_TAG_Config_t;
+
+/** \brief B-TAG header defintion .GSWIP-3.2 only
+ Used by \ref GSW_PBB_Tunnel_Template_Config_t*/
+typedef struct {
+ /**B-TAG TPID -2 bytes field*/
+ gsw_bool_t bTpidEnable;
+ u16 nTpid;
+
+ /**B-TAG PCP -3 Bit field*/
+ gsw_bool_t bPcpEnable;
+ u8 nPcp;
+
+ /**B-TAG DEI -1 Bit field*/
+ gsw_bool_t bDeiEnable;
+ u8 nDei;
+
+ /**B-TAG VID -12 Bit field*/
+ gsw_bool_t bVidEnable;
+ u16 nVid;
+} GSW_B_TAG_Config_t;
+
+/** \brief Tunnel Template Configuration.GSWIP-3.2 only
+ Used by \ref GSW_PBB_TunnelTempate_Config_Set and \ref GSW_PBB_TunnelTempate_Config_Get
+ For \ref GSW_PBB_TunnelTempate_Free, this field should be valid ID returned by
+ \ref GSW_PBB_TunnelTempate_Alloc.*/
+typedef struct {
+ u16 nTunnelTemplateId;
+
+ /** I-Header Destination Address*/
+ gsw_bool_t bIheaderDstMACEnable;
+ u8 nIheaderDstMAC[GSW_MAC_ADDR_LEN];
+
+ /** I-Header source Address*/
+ gsw_bool_t bIheaderSrcMACEnable;
+ u8 nIheaderSrcMAC[GSW_MAC_ADDR_LEN];
+
+ /** I-Tag*/
+ gsw_bool_t bItagEnable;
+ GSW_I_TAG_Config_t sItag;
+
+ /** B-Tag*/
+ gsw_bool_t bBtagEnable;
+ GSW_B_TAG_Config_t sBtag;
+} GSW_PBB_Tunnel_Template_Config_t;
+
+/** \brief Port monitor configuration.
+ Used by \ref GSW_MONITOR_PORT_CFG_GET and \ref GSW_MONITOR_PORT_CFG_SET. */
+typedef struct {
+ /** Ethernet Port number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. */
+ u8 nPortId;
+ /* Monitoring Sub-IF id */
+ u16 nSubIfId;
+ /* Out of use. */
+ gsw_bool_t bMonitorPort;
+} GSW_monitorPortCfg_t;
+
+/** \brief Sets the portmap flag of a PortID variable.
+ Some Switch API commands allow to use a port index as portmap variable.
+ This requires that the MSB bit is set to indicate that this variable
+ contains a portmap, instead of a port index.
+ In portmap mode, every value bit represents an Ethernet port.
+ LSB represents Port 0 with incrementing counting.
+ The (MSB - 1) bit represent the last port. */
+#define GSW_PORTMAP_FLAG_SET(varType) (1 << ( sizeof(((varType *)0)->nPortId) * 8 - 1))
+
+/** \brief Checks the portmap flag of a PortID variable.
+ Some Switch API commands allow to use a port index as portmap variable.
+ This requires that the MSB bit is set to indicate that this variable
+ contains a portmap, instead of a port index.
+ In portmap mode, every value bit represents an Ethernet port.
+ LSB represents Port 0 with incrementing counting.
+ The (MSB - 1) bit represent the last port. */
+#define GSW_PORTMAP_FLAG_GET(varType) (1 << ( sizeof(((varType *)0)->nPortId) * 8 - 1))
+
+#pragma scalar_storage_order default
+#pragma pack(pop)
+
+#include "gsw_ctp.h"
+#include "gsw_flow.h"
+#include "gsw_pmac.h"
+#include "gsw_tbl_rw.h"
+
+#endif /* _MXL_GSW_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_api.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_api.h
new file mode 100644
index 0000000..e0bf30a
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_api.h
@@ -0,0 +1,238 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef MXL_GSW_API_H_
+#define MXL_GSW_API_H_
+
+#include "gsw.h"
+
+GSW_return_t GSW_RegisterGet(const GSW_Device_t *dev, GSW_register_t *);
+GSW_return_t GSW_RegisterSet(const GSW_Device_t *dev, GSW_register_t *);
+GSW_return_t GSW_RegisterMod(const GSW_Device_t *dev, GSW_register_mod_t *);
+GSW_return_t GSW_CPU_PortCfgSet(const GSW_Device_t *dev, GSW_CPU_PortCfg_t *);
+GSW_return_t GSW_CPU_PortCfgGet(const GSW_Device_t *dev, GSW_CPU_PortCfg_t *);
+GSW_return_t GSW_PortLinkCfgSet(const GSW_Device_t *dev, GSW_portLinkCfg_t *);
+GSW_return_t GSW_PortLinkCfgGet(const GSW_Device_t *dev, GSW_portLinkCfg_t *);
+GSW_return_t GSW_PortCfgSet(const GSW_Device_t *dev, GSW_portCfg_t *);
+GSW_return_t GSW_PortCfgGet(const GSW_Device_t *dev, GSW_portCfg_t *);
+GSW_return_t GSW_CfgSet(const GSW_Device_t *dev, GSW_cfg_t *);
+GSW_return_t GSW_CfgGet(const GSW_Device_t *dev, GSW_cfg_t *);
+GSW_return_t GSW_MonitorPortCfgGet(const GSW_Device_t *dev, GSW_monitorPortCfg_t *);
+GSW_return_t GSW_MonitorPortCfgSet(const GSW_Device_t *dev, GSW_monitorPortCfg_t *);
+GSW_return_t GSW_Freeze(const GSW_Device_t *dev);
+GSW_return_t GSW_UnFreeze(const GSW_Device_t *dev);
+
+/* TFLOW */
+GSW_return_t GSW_PceRuleAlloc(const GSW_Device_t *dev, GSW_PCE_rule_alloc_t *parm);
+GSW_return_t GSW_PceRuleFree(const GSW_Device_t *dev, GSW_PCE_rule_alloc_t *parm);
+GSW_return_t GSW_PceRuleEnable(const GSW_Device_t *dev, GSW_PCE_ruleEntry_t *parm);
+GSW_return_t GSW_PceRuleDisable(const GSW_Device_t *dev, GSW_PCE_ruleEntry_t *parm);
+GSW_return_t GSW_PceRuleRead(const GSW_Device_t *dev, GSW_PCE_rule_t *);
+GSW_return_t GSW_PceRuleWrite(const GSW_Device_t *dev, GSW_PCE_rule_t *);
+GSW_return_t GSW_PceRuleDelete(const GSW_Device_t *dev, GSW_PCE_ruleEntry_t *);
+GSW_return_t GSW_PceRuleAlloc(const GSW_Device_t *dev, GSW_PCE_rule_alloc_t *);
+GSW_return_t GSW_PceRuleFree(const GSW_Device_t *dev, GSW_PCE_rule_alloc_t *);
+GSW_return_t GSW_PceRuleEnable(const GSW_Device_t *dev, GSW_PCE_ruleEntry_t *);
+GSW_return_t GSW_PceRuleDisable(const GSW_Device_t *dev, GSW_PCE_ruleEntry_t *);
+GSW_return_t GSW_DumpTable(const GSW_Device_t *dev, GSW_table_t *);
+
+/* BM Table */
+
+/* Bridge */
+GSW_return_t GSW_BridgeAlloc(const GSW_Device_t *dev, GSW_BRIDGE_alloc_t *);
+GSW_return_t GSW_BridgeFree(const GSW_Device_t *dev, GSW_BRIDGE_alloc_t *);
+GSW_return_t GSW_BridgeConfigSet(const GSW_Device_t *dev, GSW_BRIDGE_config_t *);
+GSW_return_t GSW_BridgeConfigGet(const GSW_Device_t *dev, GSW_BRIDGE_config_t *);
+
+/*Bridge Port*/
+GSW_return_t GSW_BridgePortAlloc(const GSW_Device_t *dev, GSW_BRIDGE_portAlloc_t *);
+GSW_return_t GSW_BridgePortConfigSet(const GSW_Device_t *dev, GSW_BRIDGE_portConfig_t *);
+GSW_return_t GSW_BridgePortConfigGet(const GSW_Device_t *dev, GSW_BRIDGE_portConfig_t *);
+GSW_return_t GSW_BridgePortFree(const GSW_Device_t *dev, GSW_BRIDGE_portAlloc_t *);
+
+/* CTP Port */
+GSW_return_t GSW_CTP_PortAssignmentAlloc(const GSW_Device_t *, GSW_CTP_portAssignment_t *);
+GSW_return_t GSW_CTP_PortAssignmentFree(const GSW_Device_t *, GSW_CTP_portAssignment_t *);
+GSW_return_t GSW_CTP_PortAssignmentSet(const GSW_Device_t *, GSW_CTP_portAssignment_t *);
+GSW_return_t GSW_CTP_PortAssignmentGet(const GSW_Device_t *, GSW_CTP_portAssignment_t *);
+GSW_return_t GSW_CtpPortConfigSet(const GSW_Device_t *, GSW_CTP_portConfig_t *);
+GSW_return_t GSW_CtpPortConfigGet(const GSW_Device_t *, GSW_CTP_portConfig_t *);
+GSW_return_t GSW_CtpPortConfigReset(const GSW_Device_t *, GSW_CTP_portConfig_t *);
+
+/* QoS */
+GSW_return_t GSW_QoS_MeterCfgSet(const GSW_Device_t *, GSW_QoS_meterCfg_t *);
+GSW_return_t GSW_QoS_MeterCfgGet(const GSW_Device_t *, GSW_QoS_meterCfg_t *);
+GSW_return_t GSW_QoS_DSCP_ClassGet(const GSW_Device_t *, GSW_QoS_DSCP_ClassCfg_t *);
+GSW_return_t GSW_QoS_DSCP_ClassSet(const GSW_Device_t *, GSW_QoS_DSCP_ClassCfg_t *);
+GSW_return_t GSW_QoS_DSCP_DropPrecedenceCfgSet(const GSW_Device_t *,
+ GSW_QoS_DSCP_DropPrecedenceCfg_t *);
+GSW_return_t GSW_QoS_DSCP_DropPrecedenceCfgGet(const GSW_Device_t *,
+ GSW_QoS_DSCP_DropPrecedenceCfg_t *);
+GSW_return_t GSW_QoS_PortRemarkingCfgSet(const GSW_Device_t *,
+ GSW_QoS_portRemarkingCfg_t *);
+GSW_return_t GSW_QoS_PortRemarkingCfgGet(const GSW_Device_t *,
+ GSW_QoS_portRemarkingCfg_t *);
+
+GSW_return_t GSW_QoS_PCP_ClassGet(const GSW_Device_t *,
+ GSW_QoS_PCP_ClassCfg_t *);
+GSW_return_t GSW_QoS_PCP_ClassSet(const GSW_Device_t *,
+ GSW_QoS_PCP_ClassCfg_t *);
+GSW_return_t GSW_QoS_PortCfgGet(const GSW_Device_t *, GSW_QoS_portCfg_t *);
+GSW_return_t GSW_QoS_PortCfgSet(const GSW_Device_t *, GSW_QoS_portCfg_t *);
+GSW_return_t GSW_QoS_SchedulerCfgSet(const GSW_Device_t *,
+ GSW_QoS_schedulerCfg_t *);
+GSW_return_t GSW_QoS_SchedulerCfgGet(const GSW_Device_t *,
+ GSW_QoS_schedulerCfg_t *);
+GSW_return_t GSW_QoS_ShaperCfgSet(const GSW_Device_t *,
+ GSW_QoS_ShaperCfg_t *);
+GSW_return_t GSW_QoS_ShaperCfgGet(const GSW_Device_t *,
+ GSW_QoS_ShaperCfg_t *);
+GSW_return_t GSW_QoS_ShaperQueueAssign(const GSW_Device_t *,
+ GSW_QoS_ShaperQueue_t *);
+GSW_return_t GSW_QoS_ShaperQueueDeassign(const GSW_Device_t *,
+ GSW_QoS_ShaperQueue_t *);
+GSW_return_t GSW_QoS_ShaperQueueGet(const GSW_Device_t *,
+ GSW_QoS_ShaperQueueGet_t *);
+GSW_return_t GSW_QoS_StormCfgSet(const GSW_Device_t *,
+ GSW_QoS_stormCfg_t *);
+GSW_return_t GSW_QoS_StormCfgGet(const GSW_Device_t *,
+ GSW_QoS_stormCfg_t *);
+GSW_return_t GSW_QoS_WredCfgSet(const GSW_Device_t *,
+ GSW_QoS_WRED_Cfg_t *);
+GSW_return_t GSW_QoS_WredCfgGet(const GSW_Device_t *,
+ GSW_QoS_WRED_Cfg_t *);
+GSW_return_t GSW_QoS_WredQueueCfgSet(const GSW_Device_t *,
+ GSW_QoS_WRED_QueueCfg_t *);
+GSW_return_t GSW_QoS_WredQueueCfgGet(const GSW_Device_t *,
+ GSW_QoS_WRED_QueueCfg_t *);
+GSW_return_t GSW_QoS_WredPortCfgSet(const GSW_Device_t *,
+ GSW_QoS_WRED_PortCfg_t *);
+GSW_return_t GSW_QoS_WredPortCfgGet(const GSW_Device_t *,
+ GSW_QoS_WRED_PortCfg_t *);
+GSW_return_t GSW_QoS_FlowctrlCfgSet(const GSW_Device_t *,
+ GSW_QoS_FlowCtrlCfg_t *);
+GSW_return_t GSW_QoS_FlowctrlCfgGet(const GSW_Device_t *,
+ GSW_QoS_FlowCtrlCfg_t *);
+
+GSW_return_t GSW_QoS_FlowctrlPortCfgSet(const GSW_Device_t *,
+ GSW_QoS_FlowCtrlPortCfg_t *);
+GSW_return_t GSW_QoS_FlowctrlPortCfgGet(const GSW_Device_t *,
+ GSW_QoS_FlowCtrlPortCfg_t *);
+GSW_return_t GSW_QoS_QueueBufferReserveCfgSet(const GSW_Device_t *,
+ GSW_QoS_QueueBufferReserveCfg_t *);
+GSW_return_t GSW_QoS_QueueBufferReserveCfgGet(const GSW_Device_t *,
+ GSW_QoS_QueueBufferReserveCfg_t *);
+GSW_return_t GSW_QOS_ColorMarkingTableSet(const GSW_Device_t *, GSW_QoS_colorMarkingEntry_t *);
+GSW_return_t GSW_QOS_ColorMarkingTableGet(const GSW_Device_t *, GSW_QoS_colorMarkingEntry_t *);
+GSW_return_t GSW_QOS_ColorReMarkingTableSet(const GSW_Device_t *, GSW_QoS_colorRemarkingEntry_t *);
+GSW_return_t GSW_QOS_ColorReMarkingTableGet(const GSW_Device_t *, GSW_QoS_colorRemarkingEntry_t *);
+GSW_return_t GSW_QOS_MeterAlloc(const GSW_Device_t *, GSW_QoS_meterCfg_t *);
+GSW_return_t GSW_QOS_MeterFree(const GSW_Device_t *, GSW_QoS_meterCfg_t *);
+GSW_return_t GSW_QOS_Dscp2PcpTableSet(const GSW_Device_t *, GSW_DSCP2PCP_map_t *);
+GSW_return_t GSW_QOS_Dscp2PcpTableGet(const GSW_Device_t *, GSW_DSCP2PCP_map_t *);
+GSW_return_t GSW_QOS_PmapperTableSet(const GSW_Device_t *, GSW_PMAPPER_t *);
+GSW_return_t GSW_QOS_PmapperTableGet(const GSW_Device_t *, GSW_PMAPPER_t *);
+GSW_return_t GSW_QoS_SVLAN_PCP_ClassGet(const GSW_Device_t *,
+ GSW_QoS_SVLAN_PCP_ClassCfg_t *);
+GSW_return_t GSW_QoS_SVLAN_PCP_ClassSet(const GSW_Device_t *,
+ GSW_QoS_SVLAN_PCP_ClassCfg_t *);
+GSW_return_t GSW_QOS_PmapperTableSet(const GSW_Device_t *, GSW_PMAPPER_t *);
+GSW_return_t GSW_QOS_PmapperTableGet(const GSW_Device_t *, GSW_PMAPPER_t *);
+GSW_return_t GSW_QoS_QueuePortSet(const GSW_Device_t *, GSW_QoS_queuePort_t *);
+GSW_return_t GSW_QoS_QueuePortGet(const GSW_Device_t *, GSW_QoS_queuePort_t *);
+
+/* RMON */
+GSW_return_t GSW_RMON_Port_Get(const GSW_Device_t *, GSW_RMON_Port_cnt_t *);
+GSW_return_t GSW_RMON_Mode_Set(const GSW_Device_t *, GSW_RMON_mode_t *);
+GSW_return_t GSW_RMON_Meter_Get(const GSW_Device_t *, GSW_RMON_Meter_cnt_t *);
+GSW_return_t GSW_RMON_Clear(const GSW_Device_t *, GSW_RMON_clear_t *);
+GSW_return_t GSW_RmonTflowClear(const GSW_Device_t *, GSW_RMON_flowGet_t *);
+GSW_return_t GSW_RMON_FlowGet(const GSW_Device_t *, GSW_RMON_flowGet_t *);
+GSW_return_t GSW_RmonTflowClear(const GSW_Device_t *, GSW_RMON_flowGet_t *);
+GSW_return_t GSW_TflowCountModeSet(const GSW_Device_t *, GSW_TflowCmodeConf_t *);
+GSW_return_t GSW_TflowCountModeGet(const GSW_Device_t *, GSW_TflowCmodeConf_t *);
+
+/*Debug */
+GSW_return_t GSW_Debug_RMON_Port_Get(const GSW_Device_t *, GSW_Debug_RMON_Port_cnt_t *);
+GSW_return_t GSW_Debug_MeterTableStatus(const GSW_Device_t *, GSW_debug_t *);
+
+/*PMAC */
+GSW_return_t GSW_PMAC_CountGet(const GSW_Device_t *, GSW_PMAC_Cnt_t *);
+GSW_return_t GSW_PMAC_GLBL_CfgSet(const GSW_Device_t *, GSW_PMAC_Glbl_Cfg_t *);
+GSW_return_t GSW_PMAC_GLBL_CfgGet(const GSW_Device_t *, GSW_PMAC_Glbl_Cfg_t *);
+GSW_return_t GSW_PMAC_BM_CfgSet(const GSW_Device_t *, GSW_PMAC_BM_Cfg_t *);
+GSW_return_t GSW_PMAC_BM_CfgGet(const GSW_Device_t *, GSW_PMAC_BM_Cfg_t *);
+GSW_return_t GSW_PMAC_IG_CfgSet(const GSW_Device_t *, GSW_PMAC_Ig_Cfg_t *);
+GSW_return_t GSW_PMAC_IG_CfgGet(const GSW_Device_t *, GSW_PMAC_Ig_Cfg_t *);
+GSW_return_t GSW_PMAC_EG_CfgSet(const GSW_Device_t *, GSW_PMAC_Eg_Cfg_t *);
+GSW_return_t GSW_PMAC_EG_CfgGet(const GSW_Device_t *, GSW_PMAC_Eg_Cfg_t *);
+
+// #ifdef CONFIG_GSWIP_MAC
+GSW_return_t GSW_MAC_TableClear(const GSW_Device_t *);
+GSW_return_t GSW_MAC_TableClearCond(const GSW_Device_t *dev,
+ GSW_MAC_tableClearCond_t *parm);
+GSW_return_t GSW_MAC_TableEntryAdd(const GSW_Device_t *,
+ GSW_MAC_tableAdd_t *);
+GSW_return_t GSW_MAC_TableEntryQuery(const GSW_Device_t *,
+ GSW_MAC_tableQuery_t *);
+GSW_return_t GSW_MAC_TableEntryRead(const GSW_Device_t *,
+ GSW_MAC_tableRead_t *);
+GSW_return_t GSW_MAC_TableEntryRemove(const GSW_Device_t *,
+ GSW_MAC_tableRemove_t *);
+GSW_return_t GSW_DefaultMacFilterSet(const GSW_Device_t *, GSW_MACFILTER_default_t *);
+GSW_return_t GSW_DefaultMacFilterGet(const GSW_Device_t *, GSW_MACFILTER_default_t *);
+// #endif
+
+// #ifdef CONFIG_GSWIP_EVLAN
+GSW_return_t GSW_ExtendedVlanAlloc(const GSW_Device_t *, GSW_EXTENDEDVLAN_alloc_t *);
+GSW_return_t GSW_ExtendedVlanSet(const GSW_Device_t *, GSW_EXTENDEDVLAN_config_t *);
+GSW_return_t GSW_ExtendedVlanGet(const GSW_Device_t *, GSW_EXTENDEDVLAN_config_t *);
+GSW_return_t GSW_ExtendedVlanFree(const GSW_Device_t *, GSW_EXTENDEDVLAN_alloc_t *);
+GSW_return_t GSW_Debug_ExvlanTableStatus(const GSW_Device_t *, GSW_debug_t *);
+GSW_return_t GSW_Debug_VlanFilterTableStatus(const GSW_Device_t *, GSW_debug_t *);
+GSW_return_t GSW_VlanFilterAlloc(const GSW_Device_t *, GSW_VLANFILTER_alloc_t *);
+GSW_return_t GSW_VlanFilterSet(const GSW_Device_t *, GSW_VLANFILTER_config_t *);
+GSW_return_t GSW_VlanFilterGet(const GSW_Device_t *, GSW_VLANFILTER_config_t *);
+GSW_return_t GSW_VlanFilterFree(const GSW_Device_t *, GSW_VLANFILTER_alloc_t *);
+GSW_return_t GSW_Vlan_RMONControl_Set(const GSW_Device_t *, GSW_VLAN_RMON_control_t *);
+GSW_return_t GSW_Vlan_RMONControl_Get(const GSW_Device_t *, GSW_VLAN_RMON_control_t *);
+GSW_return_t GSW_Vlan_RMON_Get(const GSW_Device_t *, GSW_VLAN_RMON_cnt_t *);
+GSW_return_t GSW_Vlan_RMON_Clear(const GSW_Device_t *, GSW_VLAN_RMON_cnt_t *);
+GSW_return_t GSW_VlanCounterMapSet(const GSW_Device_t *, GSW_VlanCounterMapping_config_t *);
+GSW_return_t GSW_VlanCounterMapGet(const GSW_Device_t *, GSW_VlanCounterMapping_config_t *);
+// #endif
+
+// #ifdef CONFIG_GSWIP_MCAST
+GSW_return_t GSW_MulticastRouterPortAdd(const GSW_Device_t *, GSW_multicastRouter_t *);
+GSW_return_t GSW_MulticastRouterPortRead(const GSW_Device_t *, GSW_multicastRouterRead_t *);
+GSW_return_t GSW_MulticastRouterPortRemove(const GSW_Device_t *, GSW_multicastRouter_t *);
+GSW_return_t GSW_MulticastSnoopCfgGet(const GSW_Device_t *, GSW_multicastSnoopCfg_t *);
+GSW_return_t GSW_MulticastSnoopCfgSet(const GSW_Device_t *, GSW_multicastSnoopCfg_t *);
+GSW_return_t GSW_MulticastTableEntryAdd(const GSW_Device_t *, GSW_multicastTable_t *);
+GSW_return_t GSW_MulticastTableEntryRead(const GSW_Device_t *, GSW_multicastTableRead_t *);
+GSW_return_t GSW_MulticastTableEntryRemove(const GSW_Device_t *, GSW_multicastTable_t *);
+// #endif
+
+// #ifdef CONFIG_GSWIP_STP
+GSW_return_t GSW_STP_PortCfgGet(const GSW_Device_t *cdev, GSW_STP_portCfg_t *parm);
+GSW_return_t GSW_STP_PortCfgSet(const GSW_Device_t *cdev, GSW_STP_portCfg_t *parm);
+GSW_return_t GSW_STP_BPDU_RuleGet(const GSW_Device_t *cdev, GSW_STP_BPDU_Rule_t *parm);
+GSW_return_t GSW_STP_BPDU_RuleSet(const GSW_Device_t *cdev, GSW_STP_BPDU_Rule_t *parm);
+// #endif
+
+GSW_return_t GSW_TrunkingCfgSet(const GSW_Device_t *, GSW_trunkingCfg_t *);
+GSW_return_t GSW_TrunkingCfgGet(const GSW_Device_t *, GSW_trunkingCfg_t *);
+
+GSW_return_t GSW_PBB_TunnelTempate_Alloc(const GSW_Device_t *, GSW_PBB_Tunnel_Template_Config_t *);
+GSW_return_t GSW_PBB_TunnelTempate_Free(const GSW_Device_t *, GSW_PBB_Tunnel_Template_Config_t *);
+GSW_return_t GSW_PBB_TunnelTempate_Config_Set(const GSW_Device_t *, GSW_PBB_Tunnel_Template_Config_t *);
+GSW_return_t GSW_PBB_TunnelTempate_Config_Get(const GSW_Device_t *, GSW_PBB_Tunnel_Template_Config_t *);
+
+#endif /* MXL_GSW_API_H_ */
+
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_cli_common.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_cli_common.h
new file mode 100644
index 0000000..19d3981
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_cli_common.h
@@ -0,0 +1,27 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _MXL_MAC_CLI_LIB_H_
+#define _MXL_MAC_CLI_LIB_H_
+
+int scanParamArg(int argc, char *argv[], char *name, size_t size, void *param);
+void printHex32Value(char *name, unsigned int value, unsigned int bitmapIndicator);
+int scanMAC_Arg(int argc, char *argv[], char *name, unsigned char *param);
+int scanPMAP_Arg(int argc, char *argv[], char *name, unsigned char *param);
+int findStringParam(int argc, char *argv[], char *name);
+int scanKey_Arg(int argc, char *argv[], char *name, unsigned char size, char *param);
+int scanPMAC_Arg(int argc, char *argv[], char *name, unsigned char *param);
+int scanIPv4_Arg(int argc, char *argv[], char *name, unsigned int *param);
+int scanIPv6_Arg(int argc, char *argv[], char *name, unsigned short *param);
+void printMAC_Address(unsigned char *pMAC);
+int checkValidMAC_Address(unsigned char *pMAC);
+int scan_advert(int argc, char *argv[], char *name, uint64_t *param);
+int print_advert(char *buf, uint32_t size, uint64_t param);
+
+#endif /* _MXL_MAC_CLI_LIB_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_ctp.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_ctp.h
new file mode 100644
index 0000000..f2ef9e3
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_ctp.h
@@ -0,0 +1,326 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _GSW_CTP_H_
+#define _GSW_CTP_H_
+
+#include "gsw_types.h"
+
+#pragma pack(push, 1)
+#pragma scalar_storage_order little-endian
+
+/** \brief Logical port mode.
+ Used by \ref GSW_CTP_portAssignment_t. */
+typedef enum {
+ /** WLAN with 8-bit station ID */
+ GSW_LOGICAL_PORT_8BIT_WLAN = 0,
+ /** WLAN with 9-bit station ID */
+ GSW_LOGICAL_PORT_9BIT_WLAN = 1,
+ /** GPON OMCI context */
+ GSW_LOGICAL_PORT_GPON = 2,
+ /** EPON context */
+ GSW_LOGICAL_PORT_EPON = 3,
+ /** G.INT context */
+ GSW_LOGICAL_PORT_GINT = 4,
+ /** Others (sub interface ID is 0 by default) */
+ GSW_LOGICAL_PORT_OTHER = 0xFF,
+} GSW_LogicalPortMode_t;
+
+/** \brief CTP Port configuration mask.
+ Used by \ref GSW_CTP_portConfig_t. */
+typedef enum {
+ /** Mask for \ref GSW_CTP_portConfig_t::nBridgePortId */
+ GSW_CTP_PORT_CONFIG_MASK_BRIDGE_PORT_ID = 0x00000001,
+ /** Mask for \ref GSW_CTP_portConfig_t::bForcedTrafficClass and
+ \ref GSW_CTP_portConfig_t::nDefaultTrafficClass */
+ GSW_CTP_PORT_CONFIG_MASK_FORCE_TRAFFIC_CLASS = 0x00000002,
+ /** Mask for \ref GSW_CTP_portConfig_t::bIngressExtendedVlanEnable and
+ \ref GSW_CTP_portConfig_t::nIngressExtendedVlanBlockId */
+ GSW_CTP_PORT_CONFIG_MASK_INGRESS_VLAN = 0x00000004,
+ /** Mask for \ref GSW_CTP_portConfig_t::bIngressExtendedVlanIgmpEnable and
+ \ref GSW_CTP_portConfig_t::nIngressExtendedVlanBlockIdIgmp */
+ GSW_CTP_PORT_CONFIG_MASK_INGRESS_VLAN_IGMP = 0x00000008,
+ /** Mask for \ref GSW_CTP_portConfig_t::bEgressExtendedVlanEnable and
+ \ref GSW_CTP_portConfig_t::nEgressExtendedVlanBlockId */
+ GSW_CTP_PORT_CONFIG_MASK_EGRESS_VLAN = 0x00000010,
+ /** Mask for \ref GSW_CTP_portConfig_t::bEgressExtendedVlanIgmpEnable and
+ \ref GSW_CTP_portConfig_t::nEgressExtendedVlanBlockIdIgmp */
+ GSW_CTP_PORT_CONFIG_MASK_EGRESS_VLAN_IGMP = 0x00000020,
+ /** Mask for \ref GSW_CTP_portConfig_t::bIngressNto1VlanEnable */
+ GSW_CTP_PORT_CONFIG_MASK_INRESS_NTO1_VLAN = 0x00000040,
+ /** Mask for \ref GSW_CTP_portConfig_t::bEgressNto1VlanEnable */
+ GSW_CTP_PORT_CONFIG_MASK_EGRESS_NTO1_VLAN = 0x00000080,
+ /** Mask for \ref GSW_CTP_portConfig_t::eIngressMarkingMode */
+ GSW_CTP_PORT_CONFIG_INGRESS_MARKING = 0x00000100,
+ /** Mask for \ref GSW_CTP_portConfig_t::eEgressMarkingMode */
+ GSW_CTP_PORT_CONFIG_EGRESS_MARKING = 0x00000200,
+ /** Mask for \ref GSW_CTP_portConfig_t::bEgressMarkingOverrideEnable and
+ \ref GSW_CTP_portConfig_t::eEgressMarkingModeOverride */
+ GSW_CTP_PORT_CONFIG_EGRESS_MARKING_OVERRIDE = 0x00000400,
+ /** Mask for \ref GSW_CTP_portConfig_t::eEgressRemarkingMode */
+ GSW_CTP_PORT_CONFIG_EGRESS_REMARKING = 0x00000800,
+ /** Mask for \ref GSW_CTP_portConfig_t::bIngressMeteringEnable and
+ \ref GSW_CTP_portConfig_t::nIngressTrafficMeterId */
+ GSW_CTP_PORT_CONFIG_INGRESS_METER = 0x00001000,
+ /** Mask for \ref GSW_CTP_portConfig_t::bEgressMeteringEnable and
+ \ref GSW_CTP_portConfig_t::nEgressTrafficMeterId */
+ GSW_CTP_PORT_CONFIG_EGRESS_METER = 0x00002000,
+ /** Mask for \ref GSW_CTP_portConfig_t::bBridgingBypass,
+ \ref GSW_CTP_portConfig_t::nDestLogicalPortId,
+ \ref GSW_CTP_portConfig_t::bPmapperEnable,
+ \ref GSW_CTP_portConfig_t::nDestSubIfIdGroup,
+ \ref GSW_CTP_portConfig_t::ePmapperMappingMode
+ \ref GSW_CTP_portConfig_t::bPmapperIdValid and
+ \ref GSW_CTP_portConfig_t::sPmapper */
+ GSW_CTP_PORT_CONFIG_BRIDGING_BYPASS = 0x00004000,
+ /** Mask for \ref GSW_CTP_portConfig_t::nFirstFlowEntryIndex and
+ \ref GSW_CTP_portConfig_t::nNumberOfFlowEntries */
+ GSW_CTP_PORT_CONFIG_FLOW_ENTRY = 0x00008000,
+ /** Mask for \ref GSW_CTP_portConfig_t::bIngressLoopbackEnable,
+ \ref GSW_CTP_portConfig_t::bIngressDaSaSwapEnable,
+ \ref GSW_CTP_portConfig_t::bEgressLoopbackEnable,
+ \ref GSW_CTP_portConfig_t::bEgressDaSaSwapEnable,
+ \ref GSW_CTP_portConfig_t::bIngressMirrorEnable and
+ \ref GSW_CTP_portConfig_t::bEgressMirrorEnable */
+ GSW_CTP_PORT_CONFIG_LOOPBACK_AND_MIRROR = 0x00010000,
+
+ /** Enable all fields */
+ GSW_CTP_PORT_CONFIG_MASK_ALL = 0x7FFFFFFF,
+ /** Bypass any check for debug purpose */
+ GSW_CTP_PORT_CONFIG_MASK_FORCE = 0x80000000
+} GSW_CtpPortConfigMask_t;
+
+/** \brief CTP Port Assignment/association with logical port.
+ Used by \ref GSW_CTP_PORT_ASSIGNMENT_ALLOC, \ref GSW_CTP_PORT_ASSIGNMENT_SET
+ and \ref GSW_CTP_PORT_ASSIGNMENT_GET. */
+typedef struct {
+ /** Logical Port Id. The valid range is hardware dependent. */
+ u8 nLogicalPortId;
+
+ /** First CTP Port ID mapped to above logical port ID.
+
+ \remarks
+ For \ref GSW_CTP_PORT_ASSIGNMENT_ALLOC, this is output when CTP
+ allocation is successful. For other APIs, this is input. */
+ u16 nFirstCtpPortId;
+ /** Total number of CTP Ports mapped above logical port ID. */
+ u16 nNumberOfCtpPort;
+
+ /** Logical port mode to define sub interface ID format. */
+ GSW_LogicalPortMode_t eMode;
+
+ /** Bridge ID (FID)
+
+ \remarks
+ For \ref GSW_CTP_PORT_ASSIGNMENT_ALLOC, this is input. Each CTP allocated
+ is mapped to Bridge Port given by this field. The Bridge Port will be
+ configured to use first CTP
+ (\ref GSW_CTP_portAssignment_t::nFirstCtpPortId) as egress CTP.
+ For other APIs, this is ignored. */
+ u16 nBridgePortId;
+} GSW_CTP_portAssignment_t;
+
+/** \brief CTP Port Configuration.
+ Used by \ref GSW_CTP_PORT_CONFIG_SET and \ref GSW_CTP_PORT_CONFIG_GET. */
+typedef struct {
+ /** Logical Port Id. The valid range is hardware dependent.
+ If \ref GSW_CTP_portConfig_t::eMask has
+ \ref GSW_CtpPortConfigMask_t::GSW_CTP_PORT_CONFIG_MASK_FORCE, this field
+ is ignored. */
+ u8 nLogicalPortId;
+
+ /** Sub interface ID group. The valid range is hardware/protocol dependent.
+
+ \remarks
+ Sub interface ID group is defined for each of \ref GSW_LogicalPortMode_t.
+ For both \ref GSW_LOGICAL_PORT_8BIT_WLAN and
+ \ref GSW_LOGICAL_PORT_9BIT_WLAN, this field is VAP.
+ For \ref GSW_LOGICAL_PORT_GPON, this field is GEM index.
+ For \ref GSW_LOGICAL_PORT_EPON, this field is stream index.
+ For \ref GSW_LOGICAL_PORT_GINT, this field is LLID.
+ For others, this field is 0.
+ If \ref GSW_CTP_portConfig_t::eMask has
+ \ref GSW_CtpPortConfigMask_t::GSW_CTP_PORT_CONFIG_MASK_FORCE, this field
+ is absolute index of CTP in hardware for debug purpose, bypassing
+ any check. */
+ u16 nSubIfIdGroup;
+
+ /** Mask for updating/retrieving fields. */
+ GSW_CtpPortConfigMask_t eMask;
+
+ /** Ingress Bridge Port ID to which this CTP port is associated for ingress
+ traffic. */
+ u16 nBridgePortId;
+
+ /** Default traffic class can not be overridden by other rules (except
+ traffic flow table and special tag) in processing stages. */
+ gsw_bool_t bForcedTrafficClass;
+ /** Default traffic class associated with all ingress traffic from this CTP
+ Port. */
+ u8 nDefaultTrafficClass;
+
+ /** Enable Extended VLAN processing for ingress non-IGMP traffic. */
+ gsw_bool_t bIngressExtendedVlanEnable;
+ /** Extended VLAN block allocated for ingress non-IGMP traffic. It defines
+ extended VLAN process for ingress non-IGMP traffic. Valid when
+ bIngressExtendedVlanEnable is TRUE. */
+ u16 nIngressExtendedVlanBlockId;
+ /** Extended VLAN block size for ingress non-IGMP traffic. This is optional.
+ If it is 0, the block size of nIngressExtendedVlanBlockId will be used.
+ Otherwise, this field will be used. */
+ u16 nIngressExtendedVlanBlockSize;
+ /** Enable extended VLAN processing for ingress IGMP traffic. */
+ gsw_bool_t bIngressExtendedVlanIgmpEnable;
+ /** Extended VLAN block allocated for ingress IGMP traffic. It defines
+ extended VLAN process for ingress IGMP traffic. Valid when
+ bIngressExtendedVlanIgmpEnable is TRUE. */
+ u16 nIngressExtendedVlanBlockIdIgmp;
+ /** Extended VLAN block size for ingress IGMP traffic. This is optional.
+ If it is 0, the block size of nIngressExtendedVlanBlockIdIgmp will be
+ used. Otherwise, this field will be used. */
+ u16 nIngressExtendedVlanBlockSizeIgmp;
+
+ /** Enable extended VLAN processing for egress non-IGMP traffic. */
+ gsw_bool_t bEgressExtendedVlanEnable;
+ /** Extended VLAN block allocated for egress non-IGMP traffic. It defines
+ extended VLAN process for egress non-IGMP traffic. Valid when
+ bEgressExtendedVlanEnable is TRUE. */
+ u16 nEgressExtendedVlanBlockId;
+ /** Extended VLAN block size for egress non-IGMP traffic. This is optional.
+ If it is 0, the block size of nEgressExtendedVlanBlockId will be used.
+ Otherwise, this field will be used. */
+ u16 nEgressExtendedVlanBlockSize;
+ /** Enable extended VLAN processing for egress IGMP traffic. */
+ gsw_bool_t bEgressExtendedVlanIgmpEnable;
+ /** Extended VLAN block allocated for egress IGMP traffic. It defines
+ extended VLAN process for egress IGMP traffic. Valid when
+ bEgressExtendedVlanIgmpEnable is TRUE. */
+ u16 nEgressExtendedVlanBlockIdIgmp;
+ /** Extended VLAN block size for egress IGMP traffic. This is optional.
+ If it is 0, the block size of nEgressExtendedVlanBlockIdIgmp will be
+ used. Otherwise, this field will be used. */
+ u16 nEgressExtendedVlanBlockSizeIgmp;
+
+ /** For WLAN type logical port, this should be FALSE. For other types, if
+ enabled and ingress packet is VLAN tagged, outer VLAN ID is used for
+ "nSubIfId" field in MAC table, otherwise, 0 is used for "nSubIfId". */
+ gsw_bool_t bIngressNto1VlanEnable;
+ /** For WLAN type logical port, this should be FALSE. For other types, if
+ enabled and egress packet is known unicast, outer VLAN ID is from
+ "nSubIfId" field in MAC table. */
+ gsw_bool_t bEgressNto1VlanEnable;
+
+ /** Ingress color marking mode for ingress traffic. */
+ GSW_ColorMarkingMode_t eIngressMarkingMode;
+ /** Egress color marking mode for ingress traffic at egress priority queue
+ color marking stage */
+ GSW_ColorMarkingMode_t eEgressMarkingMode;
+ /** Egress color marking mode override color marking mode from last stage. */
+ gsw_bool_t bEgressMarkingOverrideEnable;
+ /** Egress color marking mode for egress traffic. Valid only when
+ bEgressMarkingOverride is TRUE. */
+ GSW_ColorMarkingMode_t eEgressMarkingModeOverride;
+
+ /** Color remarking for egress traffic. */
+ GSW_ColorRemarkingMode_t eEgressRemarkingMode;
+
+ /** Traffic metering on ingress traffic applies. */
+ gsw_bool_t bIngressMeteringEnable;
+ /** Meter for ingress CTP process.
+
+ \remarks
+ Meter should be allocated with \ref GSW_QOS_METER_ALLOC before CTP
+ port configuration. If this CTP port is re-set, the last used meter
+ should be released. */
+ u16 nIngressTrafficMeterId;
+ /** Traffic metering on egress traffic applies. */
+ gsw_bool_t bEgressMeteringEnable;
+ /** Meter for egress CTP process.
+
+ \remarks
+ Meter should be allocated with \ref GSW_QOS_METER_ALLOC before CTP
+ port configuration. If this CTP port is re-set, the last used meter
+ should be released. */
+ u16 nEgressTrafficMeterId;
+
+ /** Ingress traffic bypass bridging/multicast processing. Following
+ parameters are used to determine destination. Traffic flow table is not
+ bypassed. */
+ gsw_bool_t bBridgingBypass;
+ /** When bBridgingBypass is TRUE, this field defines destination logical
+ port. */
+ u8 nDestLogicalPortId;
+ /** When bBridgingBypass is TRUE, this field indicates whether to use
+ \ref GSW_CTP_portConfig_t::nDestSubIfIdGroup or
+ \ref GSW_CTP_portConfig_t::ePmapperMappingMode/
+ \ref GSW_CTP_portConfig_t::sPmapper. */
+ gsw_bool_t bPmapperEnable;
+ /** When bBridgingBypass is TRUE and bPmapperEnable is FALSE, this field
+ defines destination sub interface ID group. */
+ u16 nDestSubIfIdGroup;
+ /** When bBridgingBypass is TRUE and bPmapperEnable is TRUE, this field
+ selects either DSCP or PCP to derive sub interface ID. */
+ GSW_PmapperMappingMode_t ePmapperMappingMode;
+ /** When bPmapperEnable is TRUE, P-mapper is used. This field determines
+ whether sPmapper.nPmapperId is valid. If this field is TRUE, the
+ P-mapper is re-used and no allocation of new P-mapper or value
+ change in the P-mapper. If this field is FALSE, allocation is
+ taken care in the API implementation. */
+ gsw_bool_t bPmapperIdValid;
+ /** When bBridgingBypass is TRUE and bPmapperEnable is TRUE, P-mapper is
+ used. If bPmapperIdValid is FALSE, API implementation need take care
+ of P-mapper allocation, and maintain the reference counter of
+ P-mapper used multiple times. If bPmapperIdValid is TRUE, only
+ sPmapper.nPmapperId is used to associate the P-mapper, and there is
+ no allocation of new P-mapper or value change in the P-mapper. */
+ GSW_PMAPPER_t sPmapper;
+
+ /** First traffic flow table entry is associated to this CTP port. Ingress
+ traffic from this CTP port will go through traffic flow table search
+ starting from nFirstFlowEntryIndex. Should be times of 4. */
+ u16 nFirstFlowEntryIndex;
+ /** Number of traffic flow table entries are associated to this CTP port.
+ Ingress traffic from this CTP port will go through PCE rules search
+ ending at (nFirstFlowEntryIndex+nNumberOfFlowEntries)-1. Should
+ be times of 4. */
+ u16 nNumberOfFlowEntries;
+
+ /** Ingress traffic from this CTP port will be redirected to ingress
+ logical port of this CTP port with source sub interface ID used as
+ destination sub interface ID. Following processing except traffic
+ flow table search is bypassed if loopback enabled. */
+ gsw_bool_t bIngressLoopbackEnable;
+ /** Destination/Source MAC address of ingress traffic is swapped before
+ transmitted (not swapped during PCE processing stages). If destination
+ is multicast, there is no swap, but source MAC address is replaced
+ with global configurable value. */
+ gsw_bool_t bIngressDaSaSwapEnable;
+ /** Egress traffic to this CTP port will be redirected to ingress logical
+ port with same sub interface ID as ingress. */
+ gsw_bool_t bEgressLoopbackEnable;
+ /** Destination/Source MAC address of egress traffic is swapped before
+ transmitted. */
+ gsw_bool_t bEgressDaSaSwapEnable;
+
+ /** If enabled, ingress traffic is mirrored to the monitoring port.
+
+ \remarks
+ This should be used exclusive with bIngressLoopbackEnable. */
+ gsw_bool_t bIngressMirrorEnable;
+ /** If enabled, egress traffic is mirrored to the monitoring port.
+
+ \remarks
+ This should be used exclusive with bEgressLoopbackEnable. */
+ gsw_bool_t bEgressMirrorEnable;
+} GSW_CTP_portConfig_t;
+
+#pragma scalar_storage_order default
+#pragma pack(pop)
+
+#endif /*_GSW_CTP_H */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_device.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_device.h
new file mode 100644
index 0000000..59a2681
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_device.h
@@ -0,0 +1,29 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _GSW_DEVICE_H_
+#define _GSW_DEVICE_H_
+
+typedef struct {
+ void (*usleep)(unsigned long usec);
+
+ void (*lock)(void *lock_data);
+ void (*unlock)(void *lock_data);
+ void *lock_data;
+
+ int (*mdiobus_read)(void *mdiobus_data, uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg);
+ int (*mdiobus_write)(void *mdiobus_data, uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg, uint16_t val);
+ void *mdiobus_data;
+
+ uint8_t phy_addr;
+} GSW_Device_t;
+
+#endif /* _GSW_DEVICE_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_flow.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_flow.h
new file mode 100644
index 0000000..8a4b603
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_flow.h
@@ -0,0 +1,1062 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef MXL_GSW_FLOW_H_
+#define MXL_GSW_FLOW_H_
+
+#include "gsw_types.h"
+#include "gsw_flow_index.h"
+
+#pragma pack(push, 1)
+#pragma scalar_storage_order little-endian
+
+/** \brief Register access parameter to directly read or write switch
+ internal registers.
+ Used by \ref GSW_REGISTER_SET and \ref GSW_REGISTER_GET. */
+typedef struct {
+ /** Register Address Offset for read or write access. */
+ u16 nRegAddr;
+ /** Value to write to or read from 'nRegAddr'. */
+ u16 nData;
+} GSW_register_t;
+
+/** \brief Register access parameter to directly modify internal registers.
+ Used by \ref GSW_REGISTER_MOD. */
+typedef struct {
+ /** Register Address Offset for modifiation. */
+ u16 nRegAddr;
+ /** Value to write to 'nRegAddr'. */
+ u16 nData;
+ /** Mask of bits to be modified. 1 to modify, 0 to ignore. */
+ u16 nMask;
+} GSW_register_mod_t;
+
+/** \brief Traffic Class Action Selector.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disabled. Traffic class action is disabled. */
+ GSW_PCE_ACTION_TRAFFIC_CLASS_DISABLE = 0,
+ /** Regular Class. Traffic class action is enabled and the CoS
+ classification traffic class is used. */
+ GSW_PCE_ACTION_TRAFFIC_CLASS_REGULAR = 1,
+ /** Alternative Class. Traffic class action is enabled and the
+ class of the 'nTrafficClassAlter' field is used. */
+ GSW_PCE_ACTION_TRAFFIC_CLASS_ALTERNATIVE = 2,
+} GSW_PCE_ActionTrafficClass_t;
+
+/** \brief IGMP Snooping Control.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disabled. IGMP Snooping is disabled. */
+ GSW_PCE_ACTION_IGMP_SNOOP_DISABLE = 0,
+ /** Default. Regular Packet. No IGMP Snooping action required. */
+ GSW_PCE_ACTION_IGMP_SNOOP_REGULAR = 1,
+ /** IGMP Report/Join Message. */
+ GSW_PCE_ACTION_IGMP_SNOOP_REPORT = 2,
+ /** IGMP Leave Message. */
+ GSW_PCE_ACTION_IGMP_SNOOP_LEAVE = 3,
+ /** Router Solicitation/Advertisement message. */
+ GSW_PCE_ACTION_IGMP_SNOOP_AD = 4,
+ /** IGMP Query Message. */
+ GSW_PCE_ACTION_IGMP_SNOOP_QUERY = 5,
+ /** IGMP Group Specific Query Message. */
+ GSW_PCE_ACTION_IGMP_SNOOP_QUERY_GROUP = 6,
+ /** IGMP General Query message without Router Solicitation. */
+ GSW_PCE_ACTION_IGMP_SNOOP_QUERY_NO_ROUTER = 7
+} GSW_PCE_ActionIGMP_Snoop_t;
+
+/** \brief MAC Address Learning control.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Learning is based on the forwarding decision. If the packet is discarded,
+ the address is not learned. If the packet is forwarded to any egress port,
+ the address is learned. */
+ GSW_PCE_ACTION_LEARNING_DISABLE = 0,
+ /** Reserved */
+ GSW_PCE_ACTION_LEARNING_REGULAR = 1,
+ /** Force No Learning. The address is not learned; forwarding decision
+ ignored. */
+ GSW_PCE_ACTION_LEARNING_FORCE_NOT = 2,
+ /** Force Learning. The address is learned, the forwarding decision ignored.
+ Note: The MAC Learning Control signals delivered to Port-Map filtering
+ and combined with Final Forwarding Decision. The result is used as a
+ feedback for MAC Address learning in the Bridging Table. */
+ GSW_PCE_ACTION_LEARNING_FORCE = 3
+} GSW_PCE_ActionLearning_t;
+
+/** \brief Interrupt Control Action Selector.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disabled. Interrupt Control Action is disabled for this rule. */
+ GSW_PCE_ACTION_IRQ_DISABLE = 0,
+ /** Regular Packet. The Interrupt Control Action is enabled, the packet is
+ treated as a regular packet and no interrupt event is generated. */
+ GSW_PCE_ACTION_IRQ_REGULAR = 1,
+ /** Interrupt Event. The Interrupt Control Action is enabled and an
+ interrupt event is generated. */
+ GSW_PCE_ACTION_IRQ_EVENT = 2
+} GSW_PCE_ActionIrq_t;
+
+
+/** \brief Cross State Action Selector.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disable. The Cross State Action is disabled. */
+ GSW_PCE_ACTION_CROSS_STATE_DISABLE = 0,
+ /** Regular Packet. The Cross State Action is enabled and the packet is
+ treated as a non-Cross-State packet (regular packet). Therefore it does
+ not ignore Port-State filtering rules. */
+ GSW_PCE_ACTION_CROSS_STATE_REGULAR = 1,
+ /** Cross-State packet. The Cross State Action is enabled and the packet is
+ treated as a Cross-State packet. It ignores the Port-State
+ filtering rules. */
+ GSW_PCE_ACTION_CROSS_STATE_CROSS = 2
+} GSW_PCE_ActionCrossState_t;
+
+/** \brief Critical Frame Action Selector.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disable. The Critical Frame Action is disabled. */
+ GSW_PCE_ACTION_CRITICAL_FRAME_DISABLE = 0,
+ /** Regular Packet. The Critical Frame Action is enabled and the packet is
+ treated as a non-Critical Frame. */
+ GSW_PCE_ACTION_CRITICAL_FRAME_REGULAR = 1,
+ /** Critical Packet. The Critical Frame Action is enabled and the packet is
+ treated as a Critical Frame. */
+ GSW_PCE_ACTION_CRITICAL_FRAME_CRITICAL = 2
+} GSW_PCE_ActionCriticalFrame_t;
+
+/** \brief Color Frame Action Selector.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disable. No color frame action. */
+ GSW_PCE_ACTION_COLOR_FRAME_DISABLE = 0,
+ /** Do not change color. */
+ GSW_PCE_ACTION_COLOR_FRAME_NO_CHANGE = 1,
+ /** Idendity packet as critical which bypass active congestion
+ management (ACM). */
+ GSW_PCE_ACTION_COLOR_FRAME_CRITICAL = 2,
+ /** Change to green color. */
+ GSW_PCE_ACTION_COLOR_FRAME_GREEN = 3,
+ /** Change to yellow color. */
+ GSW_PCE_ACTION_COLOR_FRAME_YELLOW = 4,
+ /** Change to red color. */
+ GSW_PCE_ACTION_COLOR_FRAME_RED = 5
+} GSW_PCE_ActionColorFrame_t;
+
+
+/** \brief Timestamp Action Selector.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disable. Timestamp Action is disabled for this rule. */
+ GSW_PCE_ACTION_TIMESTAMP_DISABLE = 0,
+ /** Regular Packet. The Timestamp Action is enabled for this rule.
+ The packet is treated as a regular packet and no timing information
+ is stored. */
+ GSW_PCE_ACTION_TIMESTAMP_REGULAR = 1,
+ /** Receive/Transmit Timing packet. Ingress and Egress Timestamps for
+ this packet should be stored. */
+ GSW_PCE_ACTION_TIMESTAMP_STORED = 2
+} GSW_PCE_ActionTimestamp_t;
+
+/** \brief Forwarding Group Action Selector.
+ This flow table action and the 'bFlowID_Action' action
+ can be used exclusively.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disable. Forwarding Group Action is disabled. */
+ GSW_PCE_ACTION_PORTMAP_DISABLE = 0,
+ /** Regular Packet. Forwarding Action enabled. Select Default
+ Port-Map (result of Default Forwarding Classification). */
+ GSW_PCE_ACTION_PORTMAP_REGULAR = 1,
+ /** Discard. Discard the packets. */
+ GSW_PCE_ACTION_PORTMAP_DISCARD = 2,
+ /** Forward to the CPU port. This requires that the CPU port is previously
+ set by calling \ref GSW_CPU_PORT_CFG_SET. */
+ GSW_PCE_ACTION_PORTMAP_CPU = 3,
+ /** Forward to a portmap, selected by the parameter 'nForwardPortMap'.
+ Please note that this feature is not supported by all
+ hardware platforms. */
+ GSW_PCE_ACTION_PORTMAP_ALTERNATIVE = 4,
+ /** The packet is treated as Multicast Router
+ Solicitation/Advertisement or Query packet. */
+ GSW_PCE_ACTION_PORTMAP_MULTICAST_ROUTER = 5,
+ /** The packet is interpreted as Multicast packet and learned in the
+ multicast group table. */
+ GSW_PCE_ACTION_PORTMAP_MULTICAST_HW_TABLE = 6,
+ /** The CTAG VLAN portmap classification result is replaced by the
+ portmap parameter 'nForwardPortMap'. All other classification
+ results stay unchanged and will be combined together with
+ the overwritten portmap. */
+ GSW_PCE_ACTION_PORTMAP_ALTERNATIVE_VLAN = 7,
+ /** Add STAG VLAN portmap 'nForwardPortMap' to the overall portmap
+ classification result (AND'ed with the portmap). */
+ GSW_PCE_ACTION_PORTMAP_ALTERNATIVE_STAG_VLAN = 8
+} GSW_PCE_ActionPortmap_t;
+
+/** \brief Flow Meter Assignment control.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Action Disable. */
+ GSW_PCE_ACTION_METER_DISABLE = 0,
+ /** Action Enable.
+ The action is enabled but no dedicated metering instance is assigned by the rule. */
+ GSW_PCE_ACTION_METER_REGULAR = 1,
+ /** Action Enable. Assign one meter instance as given in parameter "nMeterId". */
+ GSW_PCE_ACTION_METER_1 = 2,
+ /** Action Enable. Assign pair of meter instances.
+ These instances are "nMeterId" and the next following meter instance index. */
+ GSW_PCE_ACTION_METER_1_2 = 3
+} GSW_PCE_ActionMeter_t;
+
+/** \brief VLAN Group Action Selector.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disabled. The VLAN Action is disabled. */
+ GSW_PCE_ACTION_VLAN_DISABLE = 0,
+ /** Regular VLAN. VLAN Action enabled. Select Default VLAN ID. */
+ GSW_PCE_ACTION_VLAN_REGULAR = 1,
+ /** Alternative VLAN. VLAN Action enabled.
+ Select Alternative VLAN as configured in 'nVLAN_Id'
+ or 'nSVLAN_Id'. For CTAG VLAN it requires that this VLAN ID
+ is configured by calling
+ \ref GSW_VLAN_ID_CREATE in advance.
+ This additional call is not required for STAG VLAN. */
+ GSW_PCE_ACTION_VLAN_ALTERNATIVE = 2
+} GSW_PCE_ActionVLAN_t;
+
+
+/** \brief Cross VLAN Action Selector.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Disabled. The Cross VLAN Action is disabled. */
+ GSW_PCE_ACTION_CROSS_VLAN_DISABLE = 0,
+ /** Regular VLAN Packet. Do not ignore VLAN filtering rules. */
+ GSW_PCE_ACTION_CROSS_VLAN_REGULAR = 1,
+ /** Cross-VLAN packet. Ignore VLAN filtering rules.*/
+ GSW_PCE_ACTION_CROSS_VLAN_CROSS = 2
+} GSW_PCE_ActionCrossVLAN_t;
+
+/** \brief MPE Processing Path Assignment Selector - used for GSWIP-3.0 only.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Processing Path is not enabled. */
+ GSW_PCE_PROCESSING_PATH_UNUSED = 0,
+ /** Processing Path-1 is used for MPE-1. */
+ GSW_PCE_PROCESSING_PATH_1 = 1,
+ /** Processing Path-2 is used for MPE-2. */
+ GSW_PCE_PROCESSING_PATH_2 = 2,
+ /** Processing Path-1 and -2 are used for MPE-1 & MPE-2. */
+ GSW_PCE_PROCESSING_PATH_BOTH = 3,
+} GSW_PCE_ProcessingPathAction_t;
+
+/** \brief Port Filter Action-1/2/3/4/5/6 Selector - used for GSWIP-3.0 only.
+ This can be used only along with PortMember config.
+ Used by \ref GSW_PCE_action_t. */
+typedef enum {
+ /** Port Filter Action is Unused. */
+ GSW_PCE_PORT_FILTER_ACTION_UNUSED = 0,
+ /** Port Filter Action Type-1 is used. */
+ GSW_PCE_PORT_FILTER_ACTION_1 = 1,
+ /** Port Filter Action Type-2 is used. */
+ GSW_PCE_PORT_FILTER_ACTION_2 = 2,
+ /** Port Filter Action Type-3 is used. */
+ GSW_PCE_PORT_FILTER_ACTION_3 = 3,
+ /** Port Filter Action Type-4 is used. */
+ GSW_PCE_PORT_FILTER_ACTION_4 = 4,
+ /** Port Filter Action Type-5 (Unknown Unicast) is used. */
+ GSW_PCE_PORT_FILTER_ACTION_5 = 5,
+ /** Port Filter Action Type-6 (Unknown Multicast) is used. */
+ GSW_PCE_PORT_FILTER_ACTION_6 = 6
+} GSW_PCE_PortFilterAction_t;
+
+
+
+typedef struct {
+ /** Destination Sub IF ID Group Field Action Enable*/
+ gsw_bool_t bDestSubIFIDActionEnable;
+ /** Destination Sub IF ID Group Field Assignment Enable*/
+ gsw_bool_t bDestSubIFIDAssignmentEnable;
+ /** Destination Sub IF ID Group Field or LAG Index for truncking action*/
+ u16 nDestSubIFGrp_Field;
+
+} GSW_PCE_ActionDestSubIF_t;
+
+/** \brief Select Mode of Sub-Interface ID Field.
+ Used by \ref GSW_PCE_pattern_t. */
+typedef enum {
+ /** Sub Interface ID group as defined by GSWIP-3.1. */
+ GSW_PCE_SUBIFID_TYPE_GROUP = 0,
+ /** Bridge Port ID as defined by GSWIP-3.1. */
+ GSW_PCE_SUBIFID_TYPE_BRIDGEPORT = 1
+} GSW_PCE_SUBIFID_TYPE_t;
+
+/** \brief Rule selection for IPv4/IPv6.
+ Used by \ref GSW_PCE_pattern_t. */
+typedef enum {
+ /** Rule Pattern for IP selection disabled. */
+ GSW_PCE_IP_DISABLED = 0,
+ /** Rule Pattern for IPv4. */
+ GSW_PCE_IP_V4 = 1,
+ /** Rule Pattern for IPv6. */
+ GSW_PCE_IP_V6 = 2
+} GSW_PCE_IP_t;
+
+typedef enum {
+ /** No change in packet. */
+ GSW_PCE_I_HEADER_OPERATION_NOCHANGE = 0,
+ /** Insert I-Header for Non-PBB packet */
+ GSW_PCE_I_HEADER_OPERATION_INSERT = 1,
+ /** Remove I-Header for PBB packet
+ (Removes both I-Header and B-Tag)*/
+ GSW_PCE_I_HEADER_OPERATION_REMOVE = 2,
+ /** Replace the I-Header Fields for PBB packet */
+ GSW_PCE_I_HEADER_OPERATION_REPLACE = 3,
+} GSW_PCE_IheaderOperationMode;
+
+typedef enum {
+ /** No change in B-TAG for PBB packet. */
+ GSW_PCE_B_TAG_OPERATION_NOCHANGE = 0,
+ /** Insert B-TAG for PBB packet */
+ GSW_PCE_B_TAG_OPERATION_INSERT = 1,
+ /** Remove B-TAG for PBB packet */
+ GSW_PCE_B_TAG_OPERATION_REMOVE = 2,
+ /** Replace B-TAG fields for PBB packet */
+ GSW_PCE_B_TAG_OPERATION_REPLACE = 3,
+} GSW_PCE_BtagOperationMode;
+
+typedef enum {
+ /** Outer Mac address is selected for learning
+ non-PBB packet or PBB encapsulation*/
+ GSW_PCE_OUTER_MAC_SELECTED = 0,
+ /** inner Mac address is selected for learning
+ PBB decapsulation*/
+ GSW_PCE_INNER_MAC_SELECTED = 1,
+} GSW_PCE_MacTableMacinMacSelect;
+
+typedef struct {
+ /** Tunnel Template Index for I-Header Known traffic
+ this field should be valid ID returned by
+ \ref GSW_PBB_TunnelTempate_Alloc and
+ Configured Using GSW_PBB_TunnelTempate_Config_Set*/
+ u8 nTunnelIdKnownTraffic;
+ /** Tunnel Template Index for I-Header UnKnown traffic
+ this field should be valid ID returned by
+ \ref GSW_PBB_TunnelTempate_Alloc and
+ Configured Using GSW_PBB_TunnelTempate_Config_Set*/
+ u8 nTunnelIdUnKnownTraffic;
+ /** Tunnel Template Index for B-TAG Known traffic
+ this field should be valid ID returned by
+ \ref GSW_PBB_TunnelTempate_Alloc and
+ Configured Using GSW_PBB_TunnelTempate_Config_Set*/
+ u8 nProcessIdKnownTraffic;
+ /** Tunnel Template Index for B-TAG UnKnown traffic
+ this field should be valid ID returned by
+ \ref GSW_PBB_TunnelTempate_Alloc and
+ Configured Using GSW_PBB_TunnelTempate_Config_Set*/
+ u8 nProcessIdUnKnownTraffic;
+ /** I-Header Operation Mode*/
+ GSW_PCE_IheaderOperationMode eIheaderOpMode;
+ /** B-Tag Operation Mode*/
+ GSW_PCE_BtagOperationMode eBtagOpMode;
+ /** Action enable I-Header*/
+ /**Select Mac Table MacinMac Action */
+ GSW_PCE_MacTableMacinMacSelect eMacTableMacinMacSelect;
+ gsw_bool_t bIheaderActionEnable;
+ /** Enable Tunnel Id for I-Header Known traffic*/
+ gsw_bool_t bTunnelIdKnownTrafficEnable;
+ /** Enable Tunnel Id for I-Header UnKnown traffic*/
+ gsw_bool_t bTunnelIdUnKnownTrafficEnable;
+ /** Incase of I-Header operation mode is Insertion
+ and bB_DstMac_FromMacTableEnable is enabled,
+ the B-DA is from Mac table instead of tunnel template*/
+ gsw_bool_t bB_DstMac_FromMacTableEnable;
+ /** Replace B-SA from tunnel template*/
+ gsw_bool_t bReplace_B_SrcMacEnable;
+ /** Replace B-DA from tunnel template*/
+ gsw_bool_t bReplace_B_DstMacEnable;
+ /** Replace I-Tag Res from tunnel template*/
+ gsw_bool_t bReplace_I_TAG_ResEnable;
+ /** Replace I-Tag UAC from tunnel template*/
+ gsw_bool_t bReplace_I_TAG_UacEnable;
+ /** Replace I-Tag DEI from tunnel template*/
+ gsw_bool_t bReplace_I_TAG_DeiEnable;
+ /** Replace I-Tag PCP from tunnel template*/
+ gsw_bool_t bReplace_I_TAG_PcpEnable;
+ /** Replace I-Tag SID from tunnel template*/
+ gsw_bool_t bReplace_I_TAG_SidEnable;
+ /** Replace I-Tag TPID from tunnel template*/
+ gsw_bool_t bReplace_I_TAG_TpidEnable;
+ /** Action enable B-TAG*/
+ gsw_bool_t bBtagActionEnable;
+ /** Enable Process Id for B-TAG Known traffic*/
+ gsw_bool_t bProcessIdKnownTrafficEnable;
+ /** Enable Process Id for B-TAG UnKnown traffic*/
+ gsw_bool_t bProcessIdUnKnownTrafficEnable;
+ /** Replace B-Tag DEI from tunnel template*/
+ gsw_bool_t bReplace_B_TAG_DeiEnable;
+ /** Replace B-Tag PCP from tunnel template*/
+ gsw_bool_t bReplace_B_TAG_PcpEnable;
+ /** Replace B-Tag SID from tunnel template*/
+ gsw_bool_t bReplace_B_TAG_VidEnable;
+ /** Replace B-Tag TPID from tunnel template*/
+ gsw_bool_t bReplace_B_TAG_TpidEnable;
+ /**Action enable Mac Table MacinMac*/
+ gsw_bool_t bMacTableMacinMacActionEnable;
+} GSW_PCE_ActionPBB_t;
+
+typedef struct {
+ /** Signed time compensation value for OAM delay measurement.
+ * The valid values are -4,294,967,295 ~ 4,294,967,295.
+ */
+ long long nTimeComp;
+ /** Extended VLAN block allocated for traffic match this flow entry. Valid
+ when bExtendedVlanEnable is TRUE. Only FIRST VLAN operation in this block
+ is used for flow process. */
+ u16 nExtendedVlanBlockId;
+ /** Insertion/Extraction Point */
+ u8 nInsExtPoint;
+ /** PTP Sequence ID for PTP application */
+ u8 nPtpSeqId;
+ /** Target portmap for forwarded packets, only used if selected by
+ 'ePortMapAction'. Forwarding is done
+ if 'ePortMapAction = GSW_PCE_ACTION_PORTMAP_ALTERNATIVE'.
+ Every bit in the portmap represents one port (port 0 = LSB bit). */
+ /** If both bNoPktUpdate and bAppendToPkt are false, this is byte offset (2~255) to insert counter or timestamp. */
+ u16 nPktUpdateOffset;
+ /** Traffic flow counter ID used for counter insertion in OAM loss measurement.
+ * This is least significant bits of traffic flow counter ID.
+ * The most significant bits depends on traffic flow counter mode.
+ * For example, if it's global mode, this is full traffic flow counter ID.
+ * If it's logical port mode, MSB is ingress logical port ID and LSB is 5 bits of this parameter.
+ * If it's CTP or BP (bridge port) mode, it depends on configuration.
+ */
+ u16 nOamFlowId;
+ /** Record ID is information used by extraction (bExtractEnable is set)
+ * and/or OAM process (bOamEnable is set). For GSWIP-3.1 and above.
+ * Refer to GSWIP-3.1 Hardware Architecture Spec (HAS) for more detail.
+ * This is deperated and should be set to ZERO.
+ **/
+ u16 nRecordId;
+
+ u16 nForwardPortMap[8]; /* max can be 16 */
+ /** Counter ID (The index starts counting from zero). */
+ u16 nRMON_Id;
+ /** Alternative STAG VLAN Id */
+ u16 nSVLAN_Id;
+ /** Flow ID */
+ u16 nFlowID;
+ /** Routing Extension Id Value - for GSWIP-3.0 only. (8-bits range) */
+ u16 nRoutExtId;
+ /** Alternative Traffic class - used when eTrafficClassAction is set to 2. */
+ u8 nTrafficClassAlternate;
+ /** Meter ID */
+ u8 nMeterId;
+ /** Alternative CTAG VLAN Id */
+ u8 nVLAN_Id;
+ /** Alternative FID. Valid when bFidEnable is TRUE. */
+ u8 nFId;
+ /** Action "Traffic Class" Group.
+ Traffic class action enable */
+ GSW_PCE_ActionTrafficClass_t eTrafficClassAction;
+
+ /** Action "IGMP Snooping" Group.
+ IGMP Snooping control and enable. Please note that the 'nPortMapAction'
+ configuration is ignored in case the IGMP snooping is enabled.
+ Here, on read operations,
+ 'nPortMapAction = GSW_PCE_ACTION_PORTMAP_DISABLE' is returned. */
+ GSW_PCE_ActionIGMP_Snoop_t eSnoopingTypeAction;
+
+ /** Action "Learning" Group.
+ Learning action control and enable */
+ GSW_PCE_ActionLearning_t eLearningAction;
+
+ /** Action "Interrupt" Group.
+ Interrupt action generate and enable */
+ GSW_PCE_ActionIrq_t eIrqAction;
+
+ /** Action "Cross State" Group.
+ Cross state action control and enable */
+ GSW_PCE_ActionCrossState_t eCrossStateAction;
+
+ /** Action "Critical Frames" Group.
+ Critical Frame action control and enable */
+ GSW_PCE_ActionCriticalFrame_t eCritFrameAction;
+
+ /** Action "Color Frames" Group.
+ This is replacement of eCritFrameAction in GSWIP-3.1. */
+ GSW_PCE_ActionColorFrame_t eColorFrameAction;
+
+ /** Action "Timestamp" Group. Time stamp action control and enable */
+ GSW_PCE_ActionTimestamp_t eTimestampAction;
+
+ /** Action "Forwarding" Group.
+ Port map action enable. This port forwarding configuration is ignored
+ in case the action "IGMP Snooping" is enabled via the
+ parameter 'nSnoopingTypeAction'. */
+ GSW_PCE_ActionPortmap_t ePortMapAction;
+ /** Action "Meter" Group. Meter action control and enable.
+ If metering action enabled, specified metering instance number
+ overrules any other metering assignment.
+ Up to two metering instances can be applied to a single packet. */
+ GSW_PCE_ActionMeter_t eMeterAction;
+ /** Action "CTAG VLAN" Group. VLAN action enable */
+ GSW_PCE_ActionVLAN_t eVLAN_Action;
+ /** Action "STAG VLAN" Group. VLAN action enable */
+ GSW_PCE_ActionVLAN_t eSVLAN_Action;
+ /** Action "Cross VLAN" Group. Cross VLAN action enable */
+ GSW_PCE_ActionCrossVLAN_t eVLAN_CrossAction;
+ /** Assignment of flow to MPE Processing Path-1 or -2 or both - for GSWIP-3.0 only. */
+ GSW_PCE_ProcessingPathAction_t eProcessPath_Action;
+ /** Port Filter Action Config for this flow - for GSWIP-3.0 only. */
+ GSW_PCE_PortFilterAction_t ePortFilterType_Action;
+ GSW_PCE_ActionPBB_t sPBB_Action;
+ GSW_PCE_ActionDestSubIF_t sDestSubIF_Action;
+ /** Action "Remarking" Group. Remarking action enable. Reserved in
+ GSWIP-3.1. */
+ gsw_bool_t bRemarkAction;
+ /** CTAG VLAN PCP remarking enable. Reserved in GSWIP-3.1.
+ Remarking enabling means that remarking is possible in case
+ the port configuration or metering enables remarking on that
+ packet. Disabling remarking means that it is forced to
+ not remarking this packet, independent of any port remarking of
+ metering configuration. */
+ gsw_bool_t bRemarkPCP;
+ /** STAG VLAN PCP remarking enable. Reserved in GSWIP-3.1.
+ Remarking enabling means that remarking is possible in case
+ the port configuration or metering enables remarking on that
+ packet. Disabling remarking means that it is forced to
+ not remarking this packet, independent of any port remarking of
+ metering configuration. */
+ gsw_bool_t bRemarkSTAG_PCP;
+ /** STAG VLAN DEI remarking enable. Reserved in GSWIP-3.1.
+ Remarking enabling means that remarking is possible in case
+ the port configuration or metering enables remarking on that
+ packet. Disabling remarking means that it is forced to
+ not remarking this packet, independent of any port remarking of
+ metering configuration. */
+ gsw_bool_t bRemarkSTAG_DEI;
+ /** DSCP remarking enable. Reserved in GSWIP-3.1.
+ Remarking enabling means that remarking is possible in case
+ the port configuration or metering enables remarking on that
+ packet. Disabling remarking means that it is forced to
+ not remarking this packet, independent of any port remarking of
+ metering configuration. */
+ gsw_bool_t bRemarkDSCP;
+ /** Class remarking enable. Reserved in GSWIP-3.1.
+ Remarking enabling means that remarking is possible in case
+ the port configuration or metering enables remarking on that
+ packet. Disabling remarking means that it is forced to
+ not remarking this packet, independent of any port remarking of
+ metering configuration. */
+ gsw_bool_t bRemarkClass;
+
+ /** Action "RMON" Group. RMON action enable. Reserved in GSWIP-3.1. */
+ gsw_bool_t bRMON_Action;
+ /** Enable alternative FID */
+ gsw_bool_t bFidEnable;
+ /** Enable extended VLAN operation for traffic match this flow entry. */
+ gsw_bool_t bExtendedVlanEnable;
+ /** CVLAN Ignore control */
+ gsw_bool_t bCVLAN_Ignore_Control;
+ /** Port BitMap Mux control */
+ gsw_bool_t bPortBitMapMuxControl;
+ /** Trunking action enable */
+ gsw_bool_t bPortTrunkAction;
+ /** Port Link Selection control */
+ gsw_bool_t bPortLinkSelection; //NA for F48X. Can remove?
+ /** Action "Flow ID".
+ The Switch supports enhancing the egress packets by a device specific
+ special tag header. This header contains detailed switch classification
+ results. One header file is a 'Flow ID', which can be explicitly set as
+ flow table action when hitting a table rule.
+ If selected, the Flow ID is given by the parameter 'nFlowID'. */
+ gsw_bool_t bFlowID_Action;
+ /** Routing Extension Id Action Selector - for GSWIP-3.0 only.
+ When enabled, it expects a valid nRoutExtId value to be supplied. */
+ gsw_bool_t bRoutExtId_Action;
+ /** Routing Destination Port Mask Comparison - for GSWIP-3.0 only. If not enabled this field is not considered for routing session pattern lookup.*/
+ gsw_bool_t bRtDstPortMaskCmp_Action;
+ /** Routing Source Port Mask Comparison - for GSWIP-3.0 only. If not enabled, this field is not considered for routing session pattern lookup.*/
+ gsw_bool_t bRtSrcPortMaskCmp_Action;
+ /** Routing Destination IP Address Mask Comparison - for GSWIP-3.0 only. If not enabled, this field is not considered for routing session pattern lookup.*/
+ gsw_bool_t bRtDstIpMaskCmp_Action;
+ /** Routing Source IP Address Mask Comparison - for GSWIP-3.0 only. If not enabled, this field is not considered for routing session pattern lookup.*/
+ gsw_bool_t bRtSrcIpMaskCmp_Action;
+ /** Selector of IP in Tunneled IP header (Outer or Inner) - for GSWIP-3.0 only. */
+ gsw_bool_t bRtInnerIPasKey_Action;
+ /** Routing Acceleration Enable Action - for GSWIP-3.0 only. This variable decides whether to accelerate the Routing session or not */
+ gsw_bool_t bRtAccelEna_Action;
+ /** Routing Control Enable Action - for GSWIP-3.0 only. This variable is selector of Routing Accelerate action*/
+ gsw_bool_t bRtCtrlEna_Action;
+ /** Enable Extraction. For GSWIP-3.1 only.
+ Packet is identified to be extracted at extraction point defined by
+ nRecordId. */
+ gsw_bool_t bExtractEnable;
+ /** Enable OAM. For GSWIP-3.1 only.
+ Packet is identified for OAM process. */
+ gsw_bool_t bOamEnable;
+ /** Update packet after QoS queue (in PCE Bypass path). */
+ gsw_bool_t bPceBypassPath;
+ /** This is Tx flow counter, otherwise Rx flow counter is used in OAM loss measurement. */
+ gsw_bool_t bTxFlowCnt;
+ /** Timestamp format. */
+ enum {
+ GSW_PCE_DIGITAL_10B = 0,
+ GSW_PCE_BINARY_10B = 1,
+ GSW_PCE_DIGITAL_8B = 2,
+ GSW_PCE_BINARY_8B = 3
+ } eTimeFormat;
+ /** Do not update packet */
+ gsw_bool_t bNoPktUpdate;
+ /** If bNoPktUpdate is false, this flag indicates to append counter or timestamp to end of packet. */
+ gsw_bool_t bAppendToPkt;
+ /** Configure PBB action. For GSWIP-3.2 only*/
+ gsw_bool_t bPBB_Action_Enable;
+ /** For Enabling Dest SubIF ID Group field in TFLOW.Valid only For GSWIP-3.2 only*/
+ gsw_bool_t bDestSubIf_Action_Enable;
+} GSW_PCE_action_t;
+
+/** \brief Packet Classification Engine Pattern Configuration.
+ GSWIP-3.0 has additional patterns such as Inner IP, Inner DSCP, Inner Protocol, Exclude Mode etc.
+ Used by \ref GSW_PCE_rule_t. */
+typedef struct {
+ /** PCE Rule Index (Upto 512 rules supported in GSWIP-3.0, whereas 64 rules supported in GSWIP-2.x) */
+ u16 nIndex;
+ /** Destination IP Nibble Mask.
+ 1 bit represents 1 nibble mask of the 'nDstIP' field.
+ Please clear the bits of the nibbles that are not marked out and set all other bits.
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u32 nDstIP_Mask;
+ /** Inner Destination IP Nibble Mask - for GSWIP-3.0 only.
+ 1 bit represents 1 nibble mask of the 'nInnerDstIP' field.
+ Please clear the bits of the nibbles that are not marked out and set all other bits.
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u32 nInnerDstIP_Mask;
+ /** Source IP Nibble Mask (Outer for GSWIP-3.0).
+ 1 bit represents 1 nibble mask of the 'nSrcIP' field.
+ Please clear the bits of the nibbles that are not marked out and set all other bits.
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u32 nSrcIP_Mask;
+ /** Inner Src IP Nibble Mask - for GSWIP-3.0 only.
+ 1 bit represents 1 nibble mask of the 'nInnerSrcIP' field.
+ Please clear the bits of the nibbles that are not marked out and set all other bits.
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u32 nInnerSrcIP_Mask;
+ /** Incoming Sub-Interface ID value - used for GSWIP-3.0 only */
+ u16 nSubIfId;
+ /** Packet length in bytes */
+ u16 nPktLng;
+ /** Packet length Range (from nPktLng to nPktLngRange) */
+ u16 nPktLngRange;
+ /** Destination MAC address nibble mask.
+ Please clear the bits of the nibbles that are not marked out and set all other bits.
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u16 nMAC_DstMask;
+ /** Source MAC address nibble mask.
+ Please clear the bits of the nibbles that are not marked out and set all other bits.
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u16 nMAC_SrcMask;
+ /** MSB Application field.
+ The first 2 bytes of the packet content following the IP header
+ for TCP/UDP packets (source port field), or the first 2 bytes of packet content
+ following the Ethertype for non-IP packets. Any part of this
+ content can be masked-out by a programmable bit
+ mask 'nAppMaskRangeMSB'. */
+ u16 nAppDataMSB;
+ /** MSB Application mask/range. When used as a range parameter,
+ 1 bit represents 1 nibble mask of the 'nAppDataMSB' field.
+ Please clear the bits of the nibbles that are not marked out and set all other bits.
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u16 nAppMaskRangeMSB;
+ /** Ethertype */
+ u16 nEtherType;
+ /** Ethertype Mask.
+ 1 bit represents 1 nibble mask of the 'nEtherType' field.
+ Please clear the bits of the nibbles that are not marked out and set all other bits.
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u16 nEtherTypeMask;
+ /** PPPoE Session Id */
+ u16 nSessionId;
+ /** PPP Protocol Value - used for GSWIP-3.0 only*/
+ u16 nPPP_Protocol;
+ /** PPP protocol Bit Mask (Positional bit 1 signifies masking of corresponding bit value in nPPP_Protocol) - for GSWIP-3.0 only. */
+ u16 nPPP_ProtocolMask;
+ /** VLAN ID (CVID) */
+ u16 nVid;
+ /** STAG VLAN ID */
+ u16 nSLAN_Vid;
+ /** Flexible Field 4 value. 16 bit value for pattern match**/
+ u16 nFlexibleField4_Value;
+ /** Flexible Field 4 mask or range value.If bFlexibleField4_MaskEnable is 1 then
+ this 16 bit feid will be Mask or it will be Range**/
+ u16 nFlexibleField4_MaskOrRange;
+ /** Flexible Field 3 value. 16 bit value for pattern match**/
+ u16 nFlexibleField3_Value;
+ /** Flexible Field 3 mask or range value.If bFlexibleField4_MaskEnable is 1 then
+ this 16 bit feid will be Mask or it will be Range**/
+ u16 nFlexibleField3_MaskOrRange;
+ /** Flexible Field 1 value. 16 bit value for pattern match**/
+ u16 nFlexibleField1_Value;
+ /** Flexible Field 1 mask or range value.If bFlexibleField4_MaskEnable is 1 then
+ this 16 bit feid will be Mask or it will be Range**/
+ u16 nFlexibleField1_MaskOrRange;
+ /** MSB Application Data Exclude - for GSWIP-3.0 only */
+ /** VLAN ID Range for outer VLAN tag. Used for GSWIP-3.1 only. */
+ u16 nOuterVidRange;
+ /** Payload-1 Value (16-bits) - for GSWIP-3.0 PAE only */
+ u16 nPayload1;
+ /** Payload-1 Bit mask - for GSWIP-3.0 PAE only */
+ u16 nPayload1_Mask;
+ /** Payload-2 Value (16-bits) - for GSWIP-3.0 PAE only */
+ u16 nPayload2;
+ /** Payload-2 Bit mask - for GSWIP-3.0 PAE only */
+ u16 nPayload2_Mask;
+ /** Parser Flag LSW Value - each bit indicates specific parsed result */
+ u16 nParserFlagLSB;
+ /** Corresponding LSW Parser Flag Mask - when the bit is set to 1 corresponding flag gets masked out (ignored). */
+ u16 nParserFlagLSB_Mask;
+ /** Parser Flag MSW Value - each bit indicates specific parsed result */
+ u16 nParserFlagMSB;
+ /** Corresponding Parser Flag MSW Mask - when the bit is set to 1 corresponding flag gets masked out (ignored). */
+ u16 nParserFlagMSB_Mask;
+ /** Parser Flag LSW Value - each bit indicates specific parsed result */
+ u16 nParserFlag1LSB;
+ /** Corresponding LSW Parser Flag Mask - when the bit is set to 1 corresponding flag gets masked out (ignored). */
+ u16 nParserFlag1LSB_Mask;
+ /** Parser Flag MSW Value - each bit indicates specific parsed result */
+ u16 nParserFlag1MSB;
+ /** Corresponding Parser Flag MSW Mask - when the bit is set to 1 corresponding flag gets masked out (ignored). */
+ u16 nParserFlag1MSB_Mask;
+ /** LSB Application field.
+ The following 2 bytes of the packet behind the 'nAppDataMSB' field.
+ This is the destination port field for TCP/UDP packets,
+ or byte 3 and byte 4 of the packet content following the Ethertype
+ for non-IP packets. Any part of this content can be masked-out
+ by a programmable bit mask 'nAppMaskRangeLSB'. */
+ u16 nAppDataLSB;
+ /** LSB Application mask/range. When used as a range parameter,
+ 1 bit represents 1 nibble mask of the 'nAppDataLSB' field.
+ Please clear the bits of the nibbles that are not marked out and set all other bits.
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u16 nAppMaskRangeLSB;
+ /** Inserted packet by CPU to data path. For GSWIP-3.1 only */
+ u16 nInsertionFlag;
+ /** VLAN ID Range (CVID). Gets used as mask to nVid in case bVidRange_Select is set to 0 */
+ u16 nVidRange;
+ /** Flexible Field 2 mask or range value.If bFlexibleField4_MaskEnable is 1 then
+ * this 16 bit feid will be Mask or it will be Range**/
+ u16 nFlexibleField2_MaskOrRange;
+ /** Flexible Field 2 value. 16 bit value for pattern match**/
+ u16 nFlexibleField2_Value;
+ /** Port ID value of incoming packets used for classification */
+ u8 nPortId;
+ /** DSCP value (Outer for GSWIP-3.0) */
+ u8 nDSCP;
+ /** Inner DSCP value for GSWIP-3.0 only */
+ u8 nInnerDSCP;
+ /** CTAG (i.e Inner Tag) VLAN DEI (bit 3) and PCP (bit 2-0) value */
+ u8 nPCP;
+ /** STAG (i.e Outer Tag) VLAN DEI (bit 3) and PCP (bit 2-0) value */
+ u8 nSTAG_PCP_DEI;
+ /** Destination MAC address */
+ u8 nMAC_Dst[6];
+ /** Source MAC address */
+ u8 nMAC_Src[6];
+ /** IP protocol Value */
+ u8 nProtocol;
+ /** IP protocol Mask.
+ 1 bit represents 1 nibble mask of the 'nProtocol' field.
+ Please clear the bits of the nibbles that are not marked out and set all other bits i.e. a set bit 1 indicates that bit is masked out (not compared).
+ The LSB bit represents the lowest data nibble, the next bit the next nibble,
+ and so on. */
+ u8 nProtocolMask;
+ /** Inner IP protocol Value - for GSWIP-3.0 only. */
+ u8 nInnerProtocol;
+ /** Inner IP protocol Bit Mask - for GSWIP-3.0 only. */
+ u8 nInnerProtocolMask;
+ /** Flexible Field 4 parser out put index 0-127**/
+ u8 nFlexibleField4_ParserIndex;
+ /** Flexible Field 3 parser out put index 0-127**/
+ u8 nFlexibleField3_ParserIndex;
+ /** Flexible Field 1 parser out put index 0-127**/
+ u8 nFlexibleField1_ParserIndex;
+ /** Flexible Field 2 parser out put index 0-127**/
+ u8 nFlexibleField2_ParserIndex;
+ /** Index is used (enabled) or set to unused (disabled) */
+ gsw_bool_t bEnable;
+ /** Port ID used for ingress packet classification */
+ gsw_bool_t bPortIdEnable;
+ /** Exclude Port Id Value - When set exclusion of specified nPortId takes effect. Available for GSWIP-3.0 only */
+ gsw_bool_t bPortId_Exclude;
+ /** Select mode of sub-interface ID field */
+ GSW_PCE_SUBIFID_TYPE_t eSubIfIdType;
+ /** Incoming Sub-Interface ID Enable - used for GSWIP-3.0 only */
+ gsw_bool_t bSubIfIdEnable;
+ /** Exclude of specified Sub-Interface Id value in nSubIfId - used for GSWIP-3.0 only */
+ gsw_bool_t bSubIfId_Exclude;
+ /** DSCP value used (Outer for GSWIP-3.0) */
+ gsw_bool_t bDSCP_Enable;
+ /** Exclude (Outer) DSCP value used for GSWIP-3.0 only */
+ gsw_bool_t bDSCP_Exclude;
+ /** Inner DSCP value used for GSWIP-3.0 only */
+ gsw_bool_t bInner_DSCP_Enable;
+ /** Exclude of Inner DSCP (nInnerDSCP) value used for GSWIP-3.0 only */
+ gsw_bool_t bInnerDSCP_Exclude;
+ /** CTAG VLAN PCP n DEI value used */
+ gsw_bool_t bPCP_Enable;
+ /* Exclude CTAG value used for GSWIP-3.0 only */
+// gsw_bool_t bCTAG_Exclude;
+ /** Exclude CTAG PCP & DEI value used for GSWIP-3.0 only */
+ gsw_bool_t bCTAG_PCP_DEI_Exclude;
+ /** STAG VLAN PCP/DEI value used */
+ gsw_bool_t bSTAG_PCP_DEI_Enable;
+ /* Exclude STAG value used for GSWIP-3.0 only */
+// gsw_bool_t bSTAG_Exclude;
+ /** Exclude STAG PCP & DEI value used for GSWIP-3.0 only */
+ gsw_bool_t bSTAG_PCP_DEI_Exclude;
+ /** Packet length used for classification */
+ gsw_bool_t bPktLngEnable;
+ /** Exclude of Packet Length or range value used for GSWIP-3.0 only */
+ gsw_bool_t bPktLng_Exclude;
+ /** Destination MAC address used */
+ gsw_bool_t bMAC_DstEnable;
+ /** Exclude Destination MAC Address used for GSWIP-3.0 only */
+ gsw_bool_t bDstMAC_Exclude;
+ /** Source MAC address used */
+ gsw_bool_t bMAC_SrcEnable;
+ /** Exclude Source MAC Address used for GSWIP-3.0 only */
+ gsw_bool_t bSrcMAC_Exclude;
+ /** MSB Application field used */
+ gsw_bool_t bAppDataMSB_Enable;
+ /** MSB Application mask/range selection.
+ If set to LTQ_TRUE, the field 'nAppMaskRangeMSB' is used as a
+ range parameter, otherwise it is used as a nibble mask field. */
+ gsw_bool_t bAppMaskRangeMSB_Select;
+ gsw_bool_t bAppMSB_Exclude;
+ /** LSB Application used */
+ gsw_bool_t bAppDataLSB_Enable;
+ /** LSB Application mask/range selection.
+ If set to LTQ_TRUE, the field 'nAppMaskRangeLSB' is used as
+ a range parameter, otherwise it is used as a nibble mask field. */
+ gsw_bool_t bAppMaskRangeLSB_Select;
+ /** LSB Application Data Exclude - for GSWIP-3.0 only */
+ gsw_bool_t bAppLSB_Exclude;
+ /** Destination IP Selection (Outer for GSWIP-3.0). */
+ GSW_PCE_IP_t eDstIP_Select;
+ /** Destination IP (Outer for GSWIP-3.0) */
+ GSW_IP_t nDstIP;
+ /** Exclude Destination IP Value - used for GSWIP-3.0 only */
+ gsw_bool_t bDstIP_Exclude;
+ /** Inner Destination IP Selection - for GSWIP-3.0 only. */
+ GSW_PCE_IP_t eInnerDstIP_Select;
+ /** Inner Destination IP - for GSWIP-3.0 only.*/
+ GSW_IP_t nInnerDstIP;
+ /** Exclude Inner Destination IP Value - used for GSWIP-3.0 only */
+ gsw_bool_t bInnerDstIP_Exclude;
+ /** Source IP Selection (Outer for GSWIP-3.0). */
+ GSW_PCE_IP_t eSrcIP_Select;
+ /** Source IP (Outer for GSWIP-3.0) */
+ GSW_IP_t nSrcIP;
+ /** Exclude Source IP Value - used for GSWIP-3.0 only */
+ gsw_bool_t bSrcIP_Exclude;
+ /** Inner Source IP Selection - for GSWIP-3.0 only. */
+ GSW_PCE_IP_t eInnerSrcIP_Select;
+ /** Inner Source IP - for GSWIP-3.0 only*/
+ GSW_IP_t nInnerSrcIP;
+ /** Exclude Inner Source IP Value - used for GSWIP-3.0 only */
+ gsw_bool_t bInnerSrcIP_Exclude;
+ /** Ethertype used. */
+ gsw_bool_t bEtherTypeEnable;
+ /** Exclude for Ether Type Value - used for GSWIP-3.0 only. */
+ gsw_bool_t bEtherType_Exclude;
+ /** IP protocol used */
+ gsw_bool_t bProtocolEnable;
+ /** Exclude for IP Protocol Value - used for GSWIP-3.0 only. */
+ gsw_bool_t bProtocol_Exclude;
+ /** Inner IP protocol used - for GSWIP-3.0 only. */
+ gsw_bool_t bInnerProtocolEnable;
+ /** Exclude for Inner IP Protocol Value - used for GSWIP-3.0 only. */
+ gsw_bool_t bInnerProtocol_Exclude;
+ /** PPPoE used. */
+ gsw_bool_t bSessionIdEnable;
+ /** Exclude for PPPoE Session Value - used for GSWIP-3.0 only. */
+ gsw_bool_t bSessionId_Exclude;
+ /** PPP Protocol used - used for GSWIP-3.0 only */
+ gsw_bool_t bPPP_ProtocolEnable;
+ /** Exclude for PPP Protocol Value - used for GSWIP-3.0 only. */
+ gsw_bool_t bPPP_Protocol_Exclude;
+ /** VLAN ID (CVID) used.
+ \remarks
+ CVID is inner VLAN as defined in GSWIP-3.1 */
+ gsw_bool_t bVid;
+ /** VID mask/range selection.
+ If set to 1, the field 'nVidRange' is used as
+ a range parameter, otherwise it is used as a mask field.
+ \remarks
+ This must be range in GSWIP-3.1 */
+ gsw_bool_t bVidRange_Select;
+ /** Exclude for VLAN Id (CVLAN) - used for GSWIP-3.0 only. */
+ gsw_bool_t bVid_Exclude;
+ /** If this field is TRUE, use original VLAN ID as key even it's modified in
+ any stage before flow table process. Used for GSWIP-3.1 only. */
+ gsw_bool_t bVid_Original;
+ /** STAG VLAN ID used.
+ \remarks
+ SLAN is outer VLAN as defined GSWIP-3.1 */
+ gsw_bool_t bSLAN_Vid;
+ /** Exclude for SVLAN Id (SVLAN) - used for GSWIP-3.0 only. */
+ gsw_bool_t bSLANVid_Exclude;
+ /** VID mask/range selection.
+ If set to 1, the field 'nVidRange' is used as
+ a range parameter, otherwise it is used as a mask field.
+ \remarks
+ This must be range in GSWIP-3.1 */
+ gsw_bool_t bSVidRange_Select;
+ /** If this field is TRUE, use original VLAN ID as key even it's modified in
+ any stage before flow table process. Used for GSWIP-3.1 only. */
+ gsw_bool_t bOuterVid_Original;
+ /** Payload-1 used - for GSWIP-3.0 PAE only */
+ gsw_bool_t bPayload1_SrcEnable;
+ /** Payload1 mask/range selection.
+ If set to LTQ_TRUE, the field 'nPayload1' is used as
+ a range parameter, otherwise it is used as a bit mask field. */
+ gsw_bool_t bPayload1MaskRange_Select;
+ /** Exclude Payload-1 used for GSWIP-3.0 PAE only */
+ gsw_bool_t bPayload1_Exclude;
+ /** Payload-2 used - for GSWIP-3.0 PAE only */
+ gsw_bool_t bPayload2_SrcEnable;
+ /** Payload2 mask/range selection.
+ If set to LTQ_TRUE, the field 'nPayload2' is used as
+ a range parameter, otherwise it is used as a bit mask field. */
+ gsw_bool_t bPayload2MaskRange_Select;
+ /** Exclude Payload-2 used for GSWIP-3.0 PAE only */
+ gsw_bool_t bPayload2_Exclude;
+ /** Parser Flag LSW (Bit position 15 to 0) is used - for GSWIP 3.0 only */
+ gsw_bool_t bParserFlagLSB_Enable;
+ /** Exclude for Parser Flag LSW specified in nParserFlagLSB */
+ gsw_bool_t bParserFlagLSB_Exclude;
+ /** Parser Flag MSW (Bit 31 to 16) is used - for GSWIP 3.0 only */
+ gsw_bool_t bParserFlagMSB_Enable;
+ /** Exclude for Parser Flag MSW specified in nParserFlagMSB */
+ gsw_bool_t bParserFlagMSB_Exclude;
+ /** Parser Flag LSW (Bit position 47 to 32) is used - for GSWIP 3.1 only */
+ gsw_bool_t bParserFlag1LSB_Enable;
+ /** Exclude for Parser Flag LSW specified in nParserFlagLSB */
+ gsw_bool_t bParserFlag1LSB_Exclude;
+ /** Parser Flag MSW (Bit 63 to 48) is used - for GSWIP 3.1 only */
+ gsw_bool_t bParserFlag1MSB_Enable;
+ /** Exclude for Parser Flag MSW specified in nParserFlagMSB */
+ gsw_bool_t bParserFlag1MSB_Exclude;
+ /** nInsertionFlag is used. For GSWIP-3.1 only */
+ gsw_bool_t bInsertionFlag_Enable;
+ /*The below flexible field are Applicable for GSWIP 3.2 only*/
+ gsw_bool_t bFlexibleField4Enable;
+ /** Flexible Field 4 exclude mode 1 enable and 0 disable**/
+ gsw_bool_t bFlexibleField4_ExcludeEnable;
+ /** Flexible Field 4 parser mask or range selction - 0 mask/1 range**/
+ gsw_bool_t bFlexibleField4_RangeEnable;
+ gsw_bool_t bFlexibleField3Enable;
+ /** Flexible Field 3 exclude mode 1 enable and 0 disable**/
+ gsw_bool_t bFlexibleField3_ExcludeEnable;
+ /** Flexible Field 3 parser mask or range selction - 0 mask/1 range**/
+ gsw_bool_t bFlexibleField3_RangeEnable;
+ gsw_bool_t bFlexibleField2Enable;
+ /** Flexible Field 2 exclude mode 1 enable and 0 disable**/
+ gsw_bool_t bFlexibleField2_ExcludeEnable;
+ /** Flexible Field 2 parser mask or range selction - 0 mask/1 range**/
+ gsw_bool_t bFlexibleField2_RangeEnable;
+ gsw_bool_t bFlexibleField1Enable;
+ /** Flexible Field 1 exclude mode 1 enable and 0 disable**/
+ gsw_bool_t bFlexibleField1_ExcludeEnable;
+ /** Flexible Field 1 parser mask or range selction - 0 mask/1 range**/
+ gsw_bool_t bFlexibleField1_RangeEnable;
+} GSW_PCE_pattern_t;
+
+/** \brief Traffic Flow Table Mangaement.
+ * Used by \ref GSW_PCE_rule_t.
+ */
+typedef enum {
+ /** PCE Rule Region common for all CTP */
+ GSW_PCE_RULE_COMMMON = 0,
+ /** PCE Rule Region for specific CTP */
+ GSW_PCE_RULE_CTP = 1,
+ /** PCE Rule Debug (HW direct mapping) */
+ GSW_PCE_RULE_DEBUG = 2
+} GSW_PCE_RuleRegion_t;
+
+/** \brief Parameter to delete a rule from the packet classification engine.
+ Used by \ref GSW_PCE_RULE_DELETE. */
+typedef struct {
+ /** Logical Port Id. The valid range is hardware dependent. */
+ u8 logicalportid;
+ /** Sub interface ID group,
+ *The valid range is hardware/protocol dependent.
+ */
+ u16 subifidgroup;
+ /** PCE TABLE Region */
+ GSW_PCE_RuleRegion_t region;
+
+ /** Rule Index in the PCE Table. */
+ u16 nIndex;
+} GSW_PCE_ruleEntry_t;
+
+/** \brief Parameter to add/read a rule to/from the packet classification engine.
+ Used by \ref GSW_PCE_RULE_WRITE and \ref GSW_PCE_RULE_READ. */
+typedef struct {
+ /** Logical Port Id. The valid range is hardware dependent. */
+ u8 logicalportid;
+ /** Sub interface ID group,
+ *The valid range is hardware/protocol dependent.
+ */
+ u16 subifidgroup;
+ /** PCE TABLE Region */
+ GSW_PCE_RuleRegion_t region;
+
+ /** PCE Rule Pattern Part. */
+ GSW_PCE_pattern_t pattern;
+ /** PCE Rule Action Part. */
+ GSW_PCE_action_t action;
+} GSW_PCE_rule_t;
+
+/** \brief TRAFFIC FLOW TABLE Allocation.
+ * Used by \ref GSW_PCE_RULE_ALLOC and \ref GSW_PCE_RULE_FREE.
+ */
+typedef struct {
+ /** Number of traffic flow table entries are
+ * associated to CTP port.Ingress traffic from this CTP
+ * port will go through PCE rules search ending at
+ * (nFirstFlowEntryIndex+nNumberOfFlowEntries)-1. Should
+ * be times of 4. Proper value should be given
+ * for \ref GSW_PCE_RULE_ALLOC.
+ * This field is ignored for \ref GSW_PCE_RULE_FREE.
+ */
+ u16 num_of_rules;
+ /** If \ref GSW_PCE_RULE_ALLOC is successful, a valid ID will be returned
+ * in this field. Otherwise, \ref INVALID_HANDLE is
+ * returned in this field.
+ * For \ref GSW_PCE_RULE_FREE, this field should be valid ID returned by
+ * \ref GSW_PCE_RULE_ALLOC.
+ */
+ u16 blockid;
+} GSW_PCE_rule_alloc_t;
+
+#pragma scalar_storage_order default
+#pragma pack(pop)
+
+#endif /* MXL_GSW_FLOW_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_flow_index.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_flow_index.h
new file mode 100644
index 0000000..ad17c7c
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_flow_index.h
@@ -0,0 +1,24 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef MXL_GSW_FLOW_INDEX_H_
+#define MXL_GSW_FLOW_INDEX_H_
+
+/* Global Rules */
+#define MPCE_RULES_INDEX 0
+#define MPCE_RULES_INDEX_LAST (MPCE_RULES_INDEX + 7)
+#define EAPOL_PCE_RULE_INDEX 8
+#define BPDU_PCE_RULE_INDEX 9
+#define PFC_PCE_RULE_INDEX 10
+#define DSA_EXT_PCE_RULE_INDEX 11
+
+/* Per CTP Rules */
+#define FC_PCE_RULE_INDEX 0
+
+#endif /* #ifndef MXL_GSW_FLOW_INDEX_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_pmac.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_pmac.h
new file mode 100644
index 0000000..6c9c58a
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_pmac.h
@@ -0,0 +1,259 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _GSW_PMAC_H_
+#define _GSW_PMAC_H_
+
+#include "gsw_types.h"
+
+#pragma pack(push, 1)
+#pragma scalar_storage_order little-endian
+
+/** \brief Short Length Received Frame Check Type for PMAC.
+ Used by PMAC structure \ref GSW_PMAC_Glbl_Cfg_t. */
+typedef enum {
+ /** Short frame length check is disabled. */
+ GSW_PMAC_SHORT_LEN_DIS = 0,
+ /** Short frame length check is enabled without considering VLAN Tags. */
+ GSW_PMAC_SHORT_LEN_ENA_UNTAG = 1,
+ /** Short frame length check is enabled including VLAN Tags. */
+ GSW_PMAC_SHORT_LEN_ENA_TAG = 2,
+ /** Reserved - Currently unused */
+ GSW_PMAC_SHORT_LEN_RESERVED = 3
+} GSW_PMAC_Short_Frame_Chk_t;
+
+
+/** \brief Egress PMAC Config Table Selector */
+typedef enum {
+ /** Use value of \ref GSW_PMAC_Glbl_Cfg_t::bProcFlagsEgCfgEna */
+ GSW_PMAC_PROC_FLAGS_NONE = 0,
+ /** Use traffic class for egress config table addressing */
+ GSW_PMAC_PROC_FLAGS_TC = 1,
+ /** Use flags (MPE1, MPE2, DEC, ENC) for egress config table addressing */
+ GSW_PMAC_PROC_FLAGS_FLAG = 2,
+ /** Use reduced traffic class (saturated to 3) and flags (MPE1, MPE2) for
+ egress config table addressing */
+ GSW_PMAC_PROC_FLAGS_MIX = 3
+} GSW_PMAC_Proc_Flags_Eg_Cfg_t;
+
+
+/** \brief PMAC Ingress Configuration Source
+ Source of the corresponding field. */
+typedef enum {
+ /** Field is from DMA descriptor */
+ GSW_PMAC_IG_CFG_SRC_DMA_DESC = 0,
+ /** Field is from default PMAC header */
+ GSW_PMAC_IG_CFG_SRC_DEF_PMAC = 1,
+ /** Field is from PMAC header of packet */
+ GSW_PMAC_IG_CFG_SRC_PMAC = 2,
+} GSW_PMAC_Ig_Cfg_Src_t;
+
+
+/** \brief PMAC Counters available for specified DMA Channel.
+ Used by \ref GSW_PMAC_COUNT_GET. */
+typedef struct {
+ /** PMAC Interface ID Applicable only for GSWIP 3.1 */
+ u8 nPmacId;
+ /*Applicable only for GSWIP 3.1*/
+ gsw_bool_t b64BitMode;
+ /** Transmit DMA Channel Identifier (0..15) for GSWIP3.0 (0..16) for GSWIP3.1 Source PortId for Egress Counters (0..15) for GSWIP3.1 - Index */
+ u8 nTxDmaChanId;
+ /** Ingress Total discarded packets counter (32-bits) */
+ u32 nDiscPktsCount;
+ /** Ingress Total discarded bytes counter (32-bits) */
+ u32 nDiscBytesCount;
+ /** Egress Total TCP/UDP/IP checksum error-ed packets counter (32-bits) */
+ u32 nChkSumErrPktsCount;
+ /** Egress Total TCP/UDP/IP checksum error-ed bytes counter (32-bits) */
+ u32 nChkSumErrBytesCount;
+ /** Total Ingress Packet Count in Applicable only for GSWIP 3.1 (32-bits) */
+ u32 nIngressPktsCount;
+ /** Total Ingress Bytes Count in Applicable only for GSWIP 3.1 (32-bits) */
+ u32 nIngressBytesCount;
+ /** Total Engress Packet Count in Applicable only for GSWIP 3.1 (32-bits) */
+ u32 nEgressPktsCount;
+ /** Total Engress Bytes Count in Applicable only for GSWIP 3.1 (32-bits) */
+ u32 nEgressBytesCount;
+ /** Ingress header Packet Count Applicable only for GSWIP 3.2 (32-bits) */
+ u32 nIngressHdrPktsCount;
+ /** Ingress header Byte Count Applicable only for GSWIP 3.2 (32-bits) */
+ u32 nIngressHdrBytesCount;
+ /** Egress header Packet Count Applicable only for GSWIP 3.2 (32-bits) */
+ u32 nEgressHdrPktsCount;
+ /** Egress header Byte Count Applicable only for GSWIP 3.2 (32-bits) */
+ u32 nEgressHdrBytesCount;
+ /** Egress header Discard Packet Count Applicable only for GSWIP 3.2 (32-bits) */
+ u32 nEgressHdrDiscPktsCount;
+ /** Egress header Discard Byte Count Applicable only for GSWIP 3.2 (32-bits) */
+ u32 nEgressHdrDiscBytesCount;
+} GSW_PMAC_Cnt_t;
+
+/** \brief Configure the global settings of PMAC for GSWIP-3.x. This includes settings such as Jumbo frame, Checksum handling,
+ Padding and Engress PMAC Selector Config.
+ Used by \ref GSW_PMAC_GLBL_CFG_SET and \ref GSW_PMAC_GLBL_CFG_GET. */
+typedef struct {
+ /** PMAC Interface Id */
+ u8 nPmacId;
+ /** Automatic Padding Settings - Disabled (Default), to enable set it true. */
+ gsw_bool_t bAPadEna;
+ /** Global Padding Settings - Disabled (Default), to enable set it true. */
+ gsw_bool_t bPadEna;
+ /** VLAN Padding Setting - Disabled (Default), to enable set it true - applicable when bPadEna is set. */
+ gsw_bool_t bVPadEna;
+ /** Stacked VLAN Padding Setting - Disabled (Default), to enable set it true - applicable when bPadEna is set. */
+ gsw_bool_t bSVPadEna;
+ /** Packet carry FCS after PMAC process - Disabled (Default), to enable set it true. */
+ gsw_bool_t bRxFCSDis;
+ /** Transmit FCS Regeneration Setting - Disabled (Default), to enable set it true. */
+ gsw_bool_t bTxFCSDis;
+ /** IP and Transport (TCP/UDP) Headers Checksum Generation Control - Enabled (Default), to disable set it true. */
+ gsw_bool_t bIPTransChkRegDis;
+ /** IP and Transport (TCP/UDP) Headers Checksum Verification Control - Enabled (Default), to disable set it true. */
+ gsw_bool_t bIPTransChkVerDis;
+ /** To enable receipt of Jumbo frames - Disabled (Default - 1518 bytes normal frames without VLAN tags), to enable Jumbo set it true. */
+ gsw_bool_t bJumboEna;
+ /** Maximum length of Jumbo frames in terms of bytes (Bits 13:0). The maximum handled in Switch is 9990 bytes. */
+ u16 nMaxJumboLen;
+ /** Threshold length for Jumbo frames qualification in terms of bytes (Bits 13:0). */
+ u16 nJumboThreshLen;
+ /** Long frame length check - Enabled (Default), to disable set it true. */
+ gsw_bool_t bLongFrmChkDis;
+ /** Short frame length check Type - default (Enabled for 64 bytes without considering VLAN). */
+ GSW_PMAC_Short_Frame_Chk_t eShortFrmChkType;
+ /** GSWIP3.0 specific - Egress PMAC Config Table Selector - TrafficClass or Processing Flags (MPE1, MPE22, DEC, ENC based).
+ The default setting is Traffic Class based selector for Egress PMAC. */
+ gsw_bool_t bProcFlagsEgCfgEna;
+ /** GSWIP3.1 specific - Egress PMAC Config Table Selector
+ If this field is not \ref GSW_PMAC_PROC_FLAGS_NONE, it will override
+ bProcFlagsEgCfgEna. */
+ GSW_PMAC_Proc_Flags_Eg_Cfg_t eProcFlagsEgCfg;
+ /** GSWIP3.1 specific - frame size threshold for buffer selection.
+ Value in this array should be in ascending order. */
+ u32 nBslThreshold[3];
+} GSW_PMAC_Glbl_Cfg_t;
+
+/** \brief Configure the Backpressure mapping for egress Queues Congestion or ingress (receiving) ports to DMA channel.
+ Used by \ref GSW_PMAC_BM_CFG_SET and \ref GSW_PMAC_BM_CFG_GET. */
+typedef struct {
+ /** PMAC Interface ID */
+ u8 nPmacId;
+ /** Tx DMA Channel Identifier which receives sideband backpressure signal (0..15) */
+ u8 nTxDmaChanId;
+ /** Transmit Queues Selection Mask which will generate backpressure - (Configurable upto 32 Egress Queues) */
+ u32 txQMask;
+ /** Receive (Ingress) ports selection congestion Mask which will generate backpressure - (Configurable upto 16 ports) */
+ u32 rxPortMask;
+} GSW_PMAC_BM_Cfg_t;
+
+
+
+/** \brief Configure the PMAC Ingress Configuration on a given Tx DMA channel to PMAC. (Upto 16 entries).
+ This Ingress PMAC table is addressed through Trasnmit DMA Channel Identifier.
+ Used by \ref GSW_PMAC_IG_CFG_SET and \ref GSW_PMAC_IG_CFG_GET. */
+typedef struct {
+ /** PMAC Interface Id */
+ u8 nPmacId;
+ /** Tx DMA Channel Identifier (0..16) - Index of Ingress PMAC Config Table */
+ u8 nTxDmaChanId;
+ /** Error set packets to be discarded (True) or not (False) */
+ gsw_bool_t bErrPktsDisc;
+ /** Port Map info from default PMAC header (True) or incoming PMAC header (False) */
+ gsw_bool_t bPmapDefault;
+ /** Port Map Enable info from default PMAC header (True) or incoming PMAC header (False) */
+ gsw_bool_t bPmapEna;
+ /** Class Info from default PMAC header (True) or incoming PMAC header (False) */
+ gsw_bool_t bClassDefault;
+ /** Class Enable info from default PMAC header (True) or incoming PMAC header (False) */
+ gsw_bool_t bClassEna;
+ /** Sub_Interface Id Info from ingress PMAC header (GSW_PMAC_IG_CFG_SRC_PMAC),
+ default PMAC header (GSW_PMAC_IG_CFG_SRC_DEF_PMAC), or source sub-If in
+ packet descriptor (GSW_PMAC_IG_CFG_SRC_DMA_DESC) */
+ GSW_PMAC_Ig_Cfg_Src_t eSubId;
+ /** Source Port Id from default PMAC header (True) or incoming PMAC header (False) */
+ gsw_bool_t bSpIdDefault;
+ /** Packet PMAC header is present (True) or not (False) */
+ gsw_bool_t bPmacPresent;
+ /** Default PMAC header - 8 Bytes Configuration - Ingress PMAC Header Format */
+ u8 defPmacHdr[8];
+} GSW_PMAC_Ig_Cfg_t;
+
+/** \brief Configure the PMAC Egress Configuration. (Upto 1024 entries)
+ This Egress PMAC table is addressed through combination of following fields (Bit0 - Bit 9).
+ nDestPortId (Bits 0-3) + Combination of [bMpe1Flag (Bit 4) + bMpe2Flag (Bit 5) + bEncFlag (Bit 6) + bDecFlag (Bit 7) ] or TrafficClass Value (Bits 4-7) + nFlowIdMSB (Bits 8-9).
+ The bits 4-7 of index option is either based upon TC (default) or combination of Processing flags is decided through bProcFlagsEgPMACEna.
+ It is expected to pass the correct value in bProcFlagsSelect same as global bProcFlagsEgPMACEna;
+ Used by \ref GSW_PMAC_EG_CFG_SET and \ref GSW_PMAC_EG_CFG_GET. */
+typedef struct {
+ /** PMAC Interface ID */
+ u8 nPmacId;
+ /** Destination Port Identifier (0..15) - Part of Table Index (Bits 0-3)*/
+ u8 nDestPortId;
+ /** Traffic Class value [Lower 4 -bits (LSB-0, 1, 2, 3)]. - Part of Table Index Bits 4-7.
+ This value is considered, only when bProcFlagsSelect is not set */
+ u8 nTrafficClass;
+ /** MPE-1 Flag value - Part of Table Index Bit 4. Valid only when bProcFlagsSelect is set. */
+ gsw_bool_t bMpe1Flag;
+ /** MPE-2 Flag value - Part of Table Index Bit 5. Valid only when bProcFlagsSelect is set. */
+ gsw_bool_t bMpe2Flag;
+ /** Cryptography Decryption Action Flag value - Part of Table Index Bit 6. Valid only, when bProcFlagsSelect is set. */
+ gsw_bool_t bDecFlag;
+ /** Cryptography Encryption Action Flag value - Part of Table Index Bit 7. Valid only, when bProcFlagsSelect is set. */
+ gsw_bool_t bEncFlag;
+ /** Flow-ID MSB (2-bits) value - valid range (0..2). - Part of Table Index Bits 8-9. */
+ u8 nFlowIDMsb;
+ /** Selector for Processing Flags (MPE1, MPE2, DEC & ENC bits). If enabled, then the combination of flags bDecFlag, bEncFlag, bMpe1Flag and bMpe2Flag are considered as index instead of nTrafficClass. For using these combination flags, turn ON this boolean selector.
+ TC or combination processing flag is decided at global level through bProcFlagsEgPMACEna.
+ It is expected that user always passes correct value based upon bProcFlagsEgMPACEna. If mismatch found with global PMAC mode, SWAPI will return error code.
+
+ \remarks
+ In GSWIP-3.1, this is ignored and driver will determine automatically by
+ reading register.
+ */
+ gsw_bool_t bProcFlagsSelect;
+ /** Receive DMA Channel Identifier (0..15) */
+ u8 nRxDmaChanId;
+ /** To remove L2 header & additional bytes (True) or Not (False) */
+ gsw_bool_t bRemL2Hdr;
+ /** No. of bytes to be removed after Layer-2 Header, valid when bRemL2Hdr is set */
+ u8 numBytesRem;
+ /** Packet egressing will have FCS (True) or Not (False) */
+ gsw_bool_t bFcsEna;
+ /** Packet egressing will have PMAC (True) or Not (False) */
+ gsw_bool_t bPmacEna;
+ /** Enable redirection flag. GSWIP-3.1 only.
+ Overwritten by bRes1DW0Enable and nRes1DW0. */
+ gsw_bool_t bRedirEnable;
+ /** Allow (False) or not allow (True) segmentation during buffer selection.
+ GSWIP-3.1 only. Overwritten by bResDW1Enable and nResDW1. */
+ gsw_bool_t bBslSegmentDisable;
+ /** Traffic class used for buffer selection. GSWIP-3.1 only.
+ Overwritten by bResDW1Enable and nResDW1. */
+ u8 nBslTrafficClass;
+ /** If false, nResDW1 is ignored. */
+ gsw_bool_t bResDW1Enable;
+ /** 4-bits Reserved Field in DMA Descriptor - DW1 (bit 7 to 4) - for any future/custom usage. (Valid range : 0-15) */
+ u8 nResDW1;
+ /** If false, nRes1DW0 is ignored. */
+ gsw_bool_t bRes1DW0Enable;
+ /** 3-bits Reserved Field in DMA Descriptor - DW0 (bit 31 to 29) - for any future/custom usage. (Valid range : 0-7) */
+ u8 nRes1DW0;
+ /** If false, nRes2DW0 is ignored. */
+ gsw_bool_t bRes2DW0Enable;
+ /** 2-bits Reserved Field in DMA Descriptor - DW0 (bit 14 to 13) - for any future/custom usage. (Valid range : 0-2) */
+ u8 nRes2DW0;
+ /** Selector for TrafficClass bits. If enabled, then the flags
+ bDecFlag, bEncFlag, bMpe1Flag and bMpe2Flag are not used instead nTrafficClass parameter is used. For using these flags turn off this boolean */
+ gsw_bool_t bTCEnable;
+} GSW_PMAC_Eg_Cfg_t;
+
+#pragma scalar_storage_order default
+#pragma pack(pop)
+
+#endif /*_GSW_PMAC_H_ */
+
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_rmon.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_rmon.h
new file mode 100644
index 0000000..326cb12
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_rmon.h
@@ -0,0 +1,502 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _GSW_RMON_H_
+#define _GSW_RMON_H_
+
+#include "gsw_types.h"
+
+#pragma pack(push, 1)
+#pragma scalar_storage_order little-endian
+
+/** \brief Port Type - GSWIP-3.1 only.
+ Used by \ref GSW_portCfg_t. */
+typedef enum {
+ /** Logical Port */
+ GSW_LOGICAL_PORT = 0,
+ /** Physical Port
+ Applicable only for GSWIP-3.1/3.2 */
+ GSW_PHYSICAL_PORT = 1,
+ /** Connectivity Termination Port (CTP)
+ Applicable only for GSWIP-3.1/3.2 */
+ GSW_CTP_PORT = 2,
+ /** Bridge Port
+ Applicable only for GSWIP-3.1/3.2 */
+ GSW_BRIDGE_PORT = 3
+} GSW_portType_t;
+
+/**Defined as per RMON counter table structure
+ Applicable only for GSWIP 3.1*/
+typedef enum {
+ GSW_RMON_CTP_PORT_RX = 0,
+ GSW_RMON_CTP_PORT_TX = 1,
+ GSW_RMON_BRIDGE_PORT_RX = 2,
+ GSW_RMON_BRIDGE_PORT_TX = 3,
+ GSW_RMON_CTP_PORT_PCE_BYPASS = 4,
+ GSW_RMON_TFLOW_RX = 5,
+ GSW_RMON_TFLOW_TX = 6,
+ GSW_RMON_QMAP = 0x0E,
+ GSW_RMON_METER = 0x19,
+ GSW_RMON_PMAC = 0x1C,
+} GSW_RMON_portType_t;
+
+/** Defined as per RMON counter table structure
+ * Applicable only for GSWIP 3.0
+ */
+typedef enum {
+ GSW_RMON_REDIRECTION = 0X18,
+ GSW_RMON_IF = 0x1A,
+ GSW_RMON_ROUTE = 0x1B,
+ GSW_RMON_PMACIG = 0x1C,
+} GSW_RMON_Port_t;
+
+typedef enum {
+ /** Parser microcode table */
+ PMAC_BPMAP_INDEX = 0x00,
+ PMAC_IGCFG_INDEX = 0x01,
+ PMAC_EGCFG_INDEX = 0x02,
+} pm_tbl_cmds_t;
+/** \brief RMON Counters Type enumeration.
+ Used by \ref GSW_RMON_clear_t and \ref GSW_RMON_mode_t. */
+typedef enum {
+ /** All RMON Types Counters */
+ GSW_RMON_ALL_TYPE = 0,
+ /** All PMAC RMON Counters */
+ GSW_RMON_PMAC_TYPE = 1,
+ /** Port based RMON Counters */
+ GSW_RMON_PORT_TYPE = 2,
+ /** Meter based RMON Counters */
+ GSW_RMON_METER_TYPE = 3,
+ /** Interface based RMON Counters */
+ GSW_RMON_IF_TYPE = 4,
+ /** Route based RMON Counters */
+ GSW_RMON_ROUTE_TYPE = 5,
+ /** Redirected Traffic based RMON Counters */
+ GSW_RMON_REDIRECT_TYPE = 6,
+ /** Bridge Port based RMON Counters */
+ GSW_RMON_BRIDGE_TYPE = 7,
+ /** CTP Port based RMON Counters */
+ GSW_RMON_CTP_TYPE = 8,
+} GSW_RMON_type_t;
+
+
+/** \brief RMON Counters Mode Enumeration.
+ This enumeration defines Counters mode - Packets based or Bytes based counting.
+ Metering and Routing Sessions RMON counting support either Byte based or packets based only. */
+typedef enum {
+ /** Packet based RMON Counters */
+ GSW_RMON_COUNT_PKTS = 0,
+ /** Bytes based RMON Counters */
+ GSW_RMON_COUNT_BYTES = 1,
+ /** number of dropped frames, supported only for interface cunters */
+ GSW_RMON_DROP_COUNT = 2,
+} GSW_RMON_CountMode_t;
+
+/** \brief Used for getting metering RMON counters.
+ Used by \ref GSW_RMON_METER_GET */
+typedef enum {
+ /* Resereved */
+ GSW_RMON_METER_COLOR_RES = 0,
+ /* Green color */
+ GSW_RMON_METER_COLOR_GREEN = 1,
+ /* Yellow color */
+ GSW_RMON_METER_COLOR_YELLOW = 2,
+ /* Red color */
+ GSW_RMON_METER_COLOR_RED = 3,
+} GSW_RmonMeterColor_t;
+
+/* TFLOW counter type */
+typedef enum {
+ /* Set all Rx/Tx/PCE-Bp-Tx registers to same value */
+ GSW_TFLOW_COUNTER_ALL = 0, //Default for 'set' function.
+ /* SEt PCE Rx register config only */
+ GSW_TFLOW_COUNTER_PCE_Rx = 1, //Default for 'get' function.
+ /* SEt PCE Tx register config only */
+ GSW_TFLOW_COUNTER_PCE_Tx = 2,
+ /* SEt PCE-Bypass Tx register config only */
+ GSW_TFLOW_COUNTER_PCE_BP_Tx = 3,
+} GSW_TflowCountConfType_t;
+
+
+/* TFLOW counter mode type */
+typedef enum {
+ /* Global mode */
+ GSW_TFLOW_CMODE_GLOBAL = 0,
+ /* Logical mode */
+ GSW_TFLOW_CMODE_LOGICAL = 1,
+ /* CTP port mode */
+ GSW_TFLOW_CMODE_CTP = 2,
+ /* Bridge port mode */
+ GSW_TFLOW_CMODE_BRIDGE = 3,
+} GSW_TflowCmodeType_t;
+
+/* TFLOW CTP counter LSB bits */
+typedef enum {
+ /* Num of valid bits */
+ GSW_TCM_CTP_VAL_BITS_0 = 0,
+ GSW_TCM_CTP_VAL_BITS_1 = 1,
+ GSW_TCM_CTP_VAL_BITS_2 = 2,
+ GSW_TCM_CTP_VAL_BITS_3 = 3,
+ GSW_TCM_CTP_VAL_BITS_4 = 4,
+ GSW_TCM_CTP_VAL_BITS_5 = 5,
+ GSW_TCM_CTP_VAL_BITS_6 = 6,
+} GSW_TflowCtpValBits_t;
+
+
+/* TFLOW bridge port counter LSB bits */
+typedef enum {
+ /* Num of valid bits */
+ GSW_TCM_BRP_VAL_BITS_2 = 2,
+ GSW_TCM_BRP_VAL_BITS_3 = 3,
+ GSW_TCM_BRP_VAL_BITS_4 = 4,
+ GSW_TCM_BRP_VAL_BITS_5 = 5,
+ GSW_TCM_BRP_VAL_BITS_6 = 6,
+} GSW_TflowBrpValBits_t;
+
+/**
+ \brief RMON Counters for individual Port.
+ This structure contains the RMON counters of an Ethernet Switch Port.
+ Used by \ref GSW_RMON_PORT_GET. */
+typedef struct {
+ /** Port Type. This gives information which type of port to get RMON.
+ nPortId should be based on this field.
+ This is new in GSWIP-3.1. For GSWIP-2.1/2.2/3.0, this field is always
+ ZERO (GSW_LOGICAL_PORT). */
+ GSW_portType_t ePortType;
+ /** Ethernet Port number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. This parameter specifies for which MAC port the RMON
+ counter is read. It has to be set by the application before
+ calling \ref GSW_RMON_PORT_GET. */
+ u16 nPortId;
+ /** Sub interface ID group. The valid range is hardware/protocol dependent.
+
+ \remarks
+ This field is valid when \ref GSW_RMON_Port_cnt_t::ePortType is
+ \ref GSW_portType_t::GSW_CTP_PORT.
+ Sub interface ID group is defined for each of \ref GSW_LogicalPortMode_t.
+ For both \ref GSW_LOGICAL_PORT_8BIT_WLAN and
+ \ref GSW_LOGICAL_PORT_9BIT_WLAN, this field is VAP.
+ For \ref GSW_LOGICAL_PORT_GPON, this field is GEM index.
+ For \ref GSW_LOGICAL_PORT_EPON, this field is stream index.
+ For \ref GSW_LOGICAL_PORT_GINT, this field is LLID.
+ For others, this field is 0. */
+ u16 nSubIfIdGroup;
+ /** Separate set of CTP Tx counters when PCE is bypassed. GSWIP-3.1 only.*/
+ gsw_bool_t bPceBypass;
+ /*Applicable only for GSWIP 3.1*/
+ /** Discarded at Extended VLAN Operation Packet Count. GSWIP-3.1 only. */
+ u32 nRxExtendedVlanDiscardPkts;
+ /** Discarded MTU Exceeded Packet Count. GSWIP-3.1 only. */
+ u32 nMtuExceedDiscardPkts;
+ /** Tx Undersize (<64) Packet Count. GSWIP-3.1 only. */
+ u32 nTxUnderSizeGoodPkts;
+ /** Tx Oversize (>1518) Packet Count. GSWIP-3.1 only. */
+ u32 nTxOversizeGoodPkts;
+ /** Receive Packet Count (only packets that are accepted and not discarded). */
+ u32 nRxGoodPkts;
+ /** Receive Unicast Packet Count. */
+ u32 nRxUnicastPkts;
+ /** Receive Broadcast Packet Count. */
+ u32 nRxBroadcastPkts;
+ /** Receive Multicast Packet Count. */
+ u32 nRxMulticastPkts;
+ /** Receive FCS Error Packet Count. */
+ u32 nRxFCSErrorPkts;
+ /** Receive Undersize Good Packet Count. */
+ u32 nRxUnderSizeGoodPkts;
+ /** Receive Oversize Good Packet Count. */
+ u32 nRxOversizeGoodPkts;
+ /** Receive Undersize Error Packet Count. */
+ u32 nRxUnderSizeErrorPkts;
+ /** Receive Good Pause Packet Count. */
+ u32 nRxGoodPausePkts;
+ /** Receive Oversize Error Packet Count. */
+ u32 nRxOversizeErrorPkts;
+ /** Receive Align Error Packet Count. */
+ u32 nRxAlignErrorPkts;
+ /** Filtered Packet Count. */
+ u32 nRxFilteredPkts;
+ /** Receive Size 64 Bytes Packet Count. */
+ u32 nRx64BytePkts;
+ /** Receive Size 65-127 Bytes Packet Count. */
+ u32 nRx127BytePkts;
+ /** Receive Size 128-255 Bytes Packet Count. */
+ u32 nRx255BytePkts;
+ /** Receive Size 256-511 Bytes Packet Count. */
+ u32 nRx511BytePkts;
+ /** Receive Size 512-1023 Bytes Packet Count. */
+ u32 nRx1023BytePkts;
+ /** Receive Size 1024-1522 Bytes (or more, if configured) Packet Count. */
+ u32 nRxMaxBytePkts;
+ /** Overall Transmit Good Packets Count. */
+ u32 nTxGoodPkts;
+ /** Transmit Unicast Packet Count. */
+ u32 nTxUnicastPkts;
+ /** Transmit Broadcast Packet Count. */
+ u32 nTxBroadcastPkts;
+ /** Transmit Multicast Packet Count. */
+ u32 nTxMulticastPkts;
+ /** Transmit Single Collision Count. */
+ u32 nTxSingleCollCount;
+ /** Transmit Multiple Collision Count. */
+ u32 nTxMultCollCount;
+ /** Transmit Late Collision Count. */
+ u32 nTxLateCollCount;
+ /** Transmit Excessive Collision Count. */
+ u32 nTxExcessCollCount;
+ /** Transmit Collision Count. */
+ u32 nTxCollCount;
+ /** Transmit Pause Packet Count. */
+ u32 nTxPauseCount;
+ /** Transmit Size 64 Bytes Packet Count. */
+ u32 nTx64BytePkts;
+ /** Transmit Size 65-127 Bytes Packet Count. */
+ u32 nTx127BytePkts;
+ /** Transmit Size 128-255 Bytes Packet Count. */
+ u32 nTx255BytePkts;
+ /** Transmit Size 256-511 Bytes Packet Count. */
+ u32 nTx511BytePkts;
+ /** Transmit Size 512-1023 Bytes Packet Count. */
+ u32 nTx1023BytePkts;
+ /** Transmit Size 1024-1522 Bytes (or more, if configured) Packet Count. */
+ u32 nTxMaxBytePkts;
+ /** Transmit Drop Packet Count. */
+ u32 nTxDroppedPkts;
+ /** Transmit Dropped Packet Count, based on Congestion Management. */
+ u32 nTxAcmDroppedPkts;
+ /** Receive Dropped Packet Count. */
+ u32 nRxDroppedPkts;
+ /** Receive Good Byte Count (64 bit). */
+ u64 nRxGoodBytes;
+ /** Receive Bad Byte Count (64 bit). */
+ u64 nRxBadBytes;
+ /** Transmit Good Byte Count (64 bit). */
+ u64 nTxGoodBytes;
+} GSW_RMON_Port_cnt_t;
+
+/** \brief RMON Counters Mode for different Elements.
+ This structure takes RMON Counter Element Name and mode config */
+typedef struct {
+ /** RMON Counters Type */
+ GSW_RMON_type_t eRmonType;
+ /** RMON Counters Mode */
+ GSW_RMON_CountMode_t eCountMode;
+} GSW_RMON_mode_t;
+
+/**
+ \brief RMON Counters for Meter - Type (GSWIP-3.0 only).
+ This structure contains the RMON counters of one Meter Instance.
+ Used by \ref GSW_RMON_METER_GET. */
+typedef struct {
+ /** Meter Instance number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected meter is not
+ available. This parameter specifies for which Meter Id the RMON-1
+ counter is read. It has to be set by the application before
+ calling \ref GSW_RMON_METER_GET. */
+ u8 nMeterId;
+ /** Metered Green colored packets or bytes (depending upon mode) count. */
+ u32 nGreenCount;
+ /** Metered Yellow colored packets or bytes (depending upon mode) count. */
+ u32 nYellowCount;
+ /** Metered Red colored packets or bytes (depending upon mode) count. */
+ u32 nRedCount;
+ /** Metered Reserved (Future Use) packets or bytes (depending upon mode) count. */
+ u32 nResCount;
+} GSW_RMON_Meter_cnt_t;
+
+/** \brief RMON Counters Data Structure for clearance of values.
+ Used by \ref GSW_RMON_CLEAR. */
+typedef struct {
+ /** RMON Counters Type */
+ GSW_RMON_type_t eRmonType;
+ /** RMON Counters Identifier - Meter, Port, If, Route, etc. */
+ u8 nRmonId;
+} GSW_RMON_clear_t;
+
+/**
+ \brief Hardware platform TFLOW counter mode.
+ Supported modes include, Global (default), Logical, CTP, Bridge port mode.
+ The number of counters that can be assigned varies based these mode type.
+ Used by \ref GSW_TFLOW_COUNT_MODE_SET and GSW_TFLOW_COUNT_MODE_GET. */
+typedef struct {
+ //Counter type. PCE Rx/Tx/Bp-Tx.
+ GSW_TflowCountConfType_t eCountType;
+ //Counter mode. Global/Logical/CTP/BrP.
+ GSW_TflowCmodeType_t eCountMode;
+ //The below params are valid only for CTP/BrP types.
+ //A group of ports matching MS (9-n) bits. n is nCtpLsb or nBrpLsb.
+ u16 nPortMsb;
+ //Number of valid bits in CTP port counter mode.
+ GSW_TflowCtpValBits_t nCtpLsb;
+ //Number of valid bits in bridge port counter mode.
+ GSW_TflowBrpValBits_t nBrpLsb;
+} GSW_TflowCmodeConf_t;
+
+
+/**
+ \brief Hardware platform extended RMON Counters. GSWIP-3.1 only.
+ This structure contains additional RMON counters. These counters can be
+ used by the packet classification engine and can be freely assigned to
+ dedicated packet rules and flows.
+ Used by \ref GSW_RMON_FLOW_GET. */
+typedef struct {
+ /** If TRUE, use \ref GSW_RMON_flowGet_t::nIndex to access the Flow Counter,
+ otherwise, use \ref GSW_TFLOW_COUNT_MODE_GET to determine mode and use
+ \ref GSW_RMON_flowGet_t::nPortId and \ref GSW_RMON_flowGet_t::nFlowId
+ to calculate index of the Flow Counter. */
+ gsw_bool_t bIndex;
+ /** Absolute index of Flow Counter. */
+ u16 nIndex;
+ /** Port ID. This could be Logical Port, CTP or Bridge Port. It depends
+ on the mode set by \ref GSW_TFLOW_COUNT_MODE_SET. */
+ u16 nPortId;
+ /** \ref GSW_PCE_action_t::nFlowID. The range depends on the mode set
+ by \ref GSW_TFLOW_COUNT_MODE_SET. */
+ u16 nFlowId;
+
+ /** Rx Packet Counter */
+ u32 nRxPkts;
+ /** Tx Packet Counter (non-PCE-Bypass) */
+ u32 nTxPkts;
+ /** Tx Packet Counter (PCE-Bypass) */
+ u32 nTxPceBypassPkts;
+} GSW_RMON_flowGet_t;
+
+/** \brief For debugging Purpose only.
+ Used for GSWIP 3.1. */
+
+typedef struct {
+ /** Ethernet Port number (zero-based counting). The valid range is hardware
+ dependent. An error code is delivered if the selected port is not
+ available. This parameter specifies for which MAC port the RMON
+ counter is read. It has to be set by the application before
+ calling \ref GSW_RMON_PORT_GET. */
+ u16 nPortId;
+ /**Table address selection based on port type
+ Applicable only for GSWIP 3.1
+ \ref GSW_RMON_portType_t**/
+ GSW_RMON_portType_t ePortType;
+ /*Applicable only for GSWIP 3.1*/
+ gsw_bool_t b64BitMode;
+ /*Applicable only for GSWIP 3.1*/
+ u32 nRxExtendedVlanDiscardPkts;
+ /*Applicable only for GSWIP 3.1*/
+ u32 nMtuExceedDiscardPkts;
+ /*Applicable only for GSWIP 3.1*/
+ u32 nTxUnderSizeGoodPkts;
+ /*Applicable only for GSWIP 3.1*/
+ u32 nTxOversizeGoodPkts;
+ /** Receive Packet Count (only packets that are accepted and not discarded). */
+ u32 nRxGoodPkts;
+ /** Receive Unicast Packet Count. */
+ u32 nRxUnicastPkts;
+ /** Receive Broadcast Packet Count. */
+ u32 nRxBroadcastPkts;
+ /** Receive Multicast Packet Count. */
+ u32 nRxMulticastPkts;
+ /** Receive FCS Error Packet Count. */
+ u32 nRxFCSErrorPkts;
+ /** Receive Undersize Good Packet Count. */
+ u32 nRxUnderSizeGoodPkts;
+ /** Receive Oversize Good Packet Count. */
+ u32 nRxOversizeGoodPkts;
+ /** Receive Undersize Error Packet Count. */
+ u32 nRxUnderSizeErrorPkts;
+ /** Receive Good Pause Packet Count. */
+ u32 nRxGoodPausePkts;
+ /** Receive Oversize Error Packet Count. */
+ u32 nRxOversizeErrorPkts;
+ /** Receive Align Error Packet Count. */
+ u32 nRxAlignErrorPkts;
+ /** Filtered Packet Count. */
+ u32 nRxFilteredPkts;
+ /** Receive Size 64 Bytes Packet Count. */
+ u32 nRx64BytePkts;
+ /** Receive Size 65-127 Bytes Packet Count. */
+ u32 nRx127BytePkts;
+ /** Receive Size 128-255 Bytes Packet Count. */
+ u32 nRx255BytePkts;
+ /** Receive Size 256-511 Bytes Packet Count. */
+ u32 nRx511BytePkts;
+ /** Receive Size 512-1023 Bytes Packet Count. */
+ u32 nRx1023BytePkts;
+ /** Receive Size 1024-1522 Bytes (or more, if configured) Packet Count. */
+ u32 nRxMaxBytePkts;
+ /** Overall Transmit Good Packets Count. */
+ u32 nTxGoodPkts;
+ /** Transmit Unicast Packet Count. */
+ u32 nTxUnicastPkts;
+ /** Transmit Broadcast Packet Count. */
+ u32 nTxBroadcastPkts;
+ /** Transmit Multicast Packet Count. */
+ u32 nTxMulticastPkts;
+ /** Transmit Single Collision Count. */
+ u32 nTxSingleCollCount;
+ /** Transmit Multiple Collision Count. */
+ u32 nTxMultCollCount;
+ /** Transmit Late Collision Count. */
+ u32 nTxLateCollCount;
+ /** Transmit Excessive Collision Count. */
+ u32 nTxExcessCollCount;
+ /** Transmit Collision Count. */
+ u32 nTxCollCount;
+ /** Transmit Pause Packet Count. */
+ u32 nTxPauseCount;
+ /** Transmit Size 64 Bytes Packet Count. */
+ u32 nTx64BytePkts;
+ /** Transmit Size 65-127 Bytes Packet Count. */
+ u32 nTx127BytePkts;
+ /** Transmit Size 128-255 Bytes Packet Count. */
+ u32 nTx255BytePkts;
+ /** Transmit Size 256-511 Bytes Packet Count. */
+ u32 nTx511BytePkts;
+ /** Transmit Size 512-1023 Bytes Packet Count. */
+ u32 nTx1023BytePkts;
+ /** Transmit Size 1024-1522 Bytes (or more, if configured) Packet Count. */
+ u32 nTxMaxBytePkts;
+ /** Transmit Drop Packet Count. */
+ u32 nTxDroppedPkts;
+ /** Transmit Dropped Packet Count, based on Congestion Management. */
+ u32 nTxAcmDroppedPkts;
+ /** Receive Dropped Packet Count. */
+ u32 nRxDroppedPkts;
+ /** Receive Good Byte Count (64 bit). */
+ u64 nRxGoodBytes;
+ /** Receive Bad Byte Count (64 bit). */
+ u64 nRxBadBytes;
+ /** Transmit Good Byte Count (64 bit). */
+ u64 nTxGoodBytes;
+ /**For GSWIP V32 only **/
+ /** Receive Unicast Packet Count for Yellow & Red packet. */
+ u32 nRxUnicastPktsYellowRed;
+ /** Receive Broadcast Packet Count for Yellow & Red packet. */
+ u32 nRxBroadcastPktsYellowRed;
+ /** Receive Multicast Packet Count for Yellow & Red packet. */
+ u32 nRxMulticastPktsYellowRed;
+ /** Receive Good Byte Count (64 bit) for Yellow & Red packet. */
+ u64 nRxGoodBytesYellowRed;
+ /** Receive Packet Count for Yellow & Red packet. */
+ u32 nRxGoodPktsYellowRed;
+ /** Transmit Unicast Packet Count for Yellow & Red packet. */
+ u32 nTxUnicastPktsYellowRed;
+ /** Transmit Broadcast Packet Count for Yellow & Red packet. */
+ u32 nTxBroadcastPktsYellowRed;
+ /** Transmit Multicast Packet Count for Yellow & Red packet. */
+ u32 nTxMulticastPktsYellowRed;
+ /** Transmit Good Byte Count (64 bit) for Yellow & Red packet. */
+ u64 nTxGoodBytesYellowRed;
+ /** Transmit Packet Count for Yellow & Red packet. */
+ u32 nTxGoodPktsYellowRed;
+} GSW_Debug_RMON_Port_cnt_t;
+
+#pragma scalar_storage_order default
+#pragma pack(pop)
+
+#endif /* _GSW_RMON_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_tbl_rw.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_tbl_rw.h
new file mode 100644
index 0000000..eea10a6
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_tbl_rw.h
@@ -0,0 +1,137 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _GSW_TBL_RW_H_
+#define _GSW_TBL_RW_H_
+
+#include "gsw_types.h"
+
+#pragma pack(push, 1)
+#pragma scalar_storage_order little-endian
+
+/* GSWIP PCE Table Programming structure */
+typedef struct {
+ u16 key[34];
+ u16 mask[4];
+ u16 val[31];
+ u16 table;
+ u16 pcindex;
+ u16 op_mode: 2;
+ u16 extop: 1;
+ u16 kformat: 1;
+ u16 type: 1;
+ u16 valid: 1;
+ u16 group: 4;
+} pctbl_prog_t;
+
+/* GSWIP Table structure to access all tables */
+typedef struct {
+ u32 tbl_entry;
+ /** Start offset mem dump purpose */
+ u32 tbl_addr;
+ u32 tbl_id;
+ u32 bm_numValues;
+ pctbl_prog_t ptdata;
+ //bmtbl_prog_t bmtable;
+ //pmtbl_prog_t pmactable;
+} GSW_table_t;
+
+/* GSWIP BM Table ID to access different tables */
+typedef enum {
+ CTP_PORT_RX_RMON = 0x00,
+ CTP_PORT_TX_RMON = 0x01,
+ BRIDGE_PORT_RX_RMON = 0x02,
+ BRIDGE_PORT_TX_RMON = 0x03,
+ CTP_PORT_PCE_BYPASS_TX_RMON = 0x04,
+ FLOW_RX_RMON = 0x05,
+ FLOW_TX_RMON = 0x06,
+ WFQ_PARAM = 0x08,
+ PQM_THRESHOLD = 0x09,
+ PQM_PACKET_PTR = 0x0A,
+ SSL_NEXT_PTR_MEM = 0x0B,
+ SSL_HEADER_DES_MEM1 = 0x0C,
+ SSL_HEADER_DES_MEM2 = 0x0D,
+ BUF_MGR_Q_MAP_TABLE = 0x0E,
+ METER_RMON_COUNTER = 0x19,
+ ROUTING_RMON_COUNTER = 0x1B,
+ PMAC_RMON_COUNTER = 0x1C,
+} BM_Table_ID;
+
+/* GSWIP BM Table Address */
+typedef union {
+ u16 raw;
+ struct {
+ u16 b0: 1, b1: 1, b2: 1, b3: 1, b4: 1, b5: 1, b6: 1, b7: 1,
+ b8: 1, b9: 1, b10: 1, b11: 1, b12: 1, b13: 1, b14: 1, b15: 1;
+ } bits;
+ struct {
+ u16 counterOffset: 6, portOffset: 10;
+ } rmon;
+ struct {
+ u16 counterOffset: 4, counterpoint: 2, portOffset: 10;
+ } vlanrmon;
+ struct {
+ u16 nQueueId: 7, reserved0: 9;
+ } wfq;
+ struct {
+ u16 color_or_submode: 2, mode: 1, nQueueId: 7, reserved1: 6;
+ } pqmThr;
+ struct {
+ u16 ptr: 11, reserved2: 5;
+ } pqmPtr;
+ struct {
+ u16 ptr: 10, reserved3: 6;
+ } ssl;
+ struct {
+ u16 nQueueId: 7, reserved4: 9;
+ } qMapTbl;
+ struct {
+ u16 meterNo: 7, reserved5: 1, color: 2, reserved6: 6;
+ } meterRmon;
+ struct {
+ u16 portNo: 4, counterType: 4, reserved7: 8;
+ } routingRmon;
+ struct {
+ u16 channel_or_port: 5, count: 3, pmacNo: 3, reserved8: 5;
+ } pmacRmon;
+} BM_Table_Address;
+
+/* GSWIP BM Table programming structure */
+typedef struct {
+ BM_Table_ID tableID;
+ BM_Table_Address adr;
+ u16 value[10];
+ gsw_bool_t b64bitMode;
+ u8 numValues;
+} bmtbl_prog_t;
+
+/* GSWIP PMAC Table programming structure */
+typedef struct {
+ u16 val[8];
+ u16 ptaddr;
+ u16 ptcaddr;
+ u16 op_mode;
+ u16 pmacId;
+} pmtbl_prog_t;
+
+int gsw_pce_table_write(const GSW_Device_t *dev, pctbl_prog_t *ptdata);
+int gsw_pce_table_read(const GSW_Device_t *dev, pctbl_prog_t *ptdata);
+int gsw_pce_table_read_next_valid(const GSW_Device_t *dev, pctbl_prog_t *ptdata);
+int gsw_pce_table_read_next_change(const GSW_Device_t *dev, pctbl_prog_t *ptdata);
+int gsw_pce_table_key_write(const GSW_Device_t *dev, pctbl_prog_t *ptdata);
+int gsw_pce_table_key_read(const GSW_Device_t *dev, pctbl_prog_t *ptdata);
+int gsw_pmac_table_read(const GSW_Device_t *dev, pmtbl_prog_t *ptdata);
+int gsw_pmac_table_write(const GSW_Device_t *dev, pmtbl_prog_t *ptdata);
+GSW_return_t gsw_bm_table_read(const GSW_Device_t *dev, bmtbl_prog_t *ptdata);
+GSW_return_t gsw_bm_table_write(const GSW_Device_t *dev, bmtbl_prog_t *ptdata);
+
+#pragma scalar_storage_order default
+#pragma pack(pop)
+
+#endif /* _GSW_TBL_RW_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_types.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_types.h
new file mode 100644
index 0000000..a8b4de1
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/gsw_types.h
@@ -0,0 +1,73 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _GSW_TYPES_H_
+#define _GSW_TYPES_H_
+
+#include <stdint.h>
+
+/** \brief This is the unsigned 64-bit datatype. */
+typedef uint64_t u64;
+/** \brief This is the unsigned 32-bit datatype. */
+typedef uint32_t u32;
+/** \brief This is the unsigned 16-bit datatype. */
+typedef uint16_t u16;
+/** \brief This is the unsigned 8-bit datatype. */
+typedef uint8_t u8;
+/** \brief This is the signed 64-bit datatype. */
+typedef int64_t i64;
+/** \brief This is the signed 32-bit datatype. */
+typedef int32_t i32;
+/** \brief This is the signed 16-bit datatype. */
+typedef int16_t i16;
+/** \brief This is the signed 8-bit datatype. */
+typedef int8_t i8;
+/** \brief This is the signed 8-bit datatype. */
+typedef int32_t s32;
+/** \brief This is the signed 8-bit datatype. */
+typedef int8_t s8;
+
+/** \brief MAC Address Field Size.
+ Number of bytes used to store MAC address information. */
+#define GSW_MAC_ADDR_LEN 6
+
+/** \brief This enumeration type defines two boolean states: False and True. */
+enum {
+ /** Boolean False. */
+ GSW_FALSE = 0,
+ /** Boolean True. */
+ GSW_TRUE = 1
+};
+
+/** \brief This is the boolean datatype. */
+typedef uint8_t gsw_bool_t;
+
+/** \brief This is a union to describe the IPv4 and IPv6 Address in numeric representation. Used by multiple Structures and APIs. The member selection would be based upon \ref GSW_IP_Select_t */
+typedef union {
+ /** Describe the IPv4 address.
+ Only used if the IPv4 address should be read or configured.
+ Cannot be used together with the IPv6 address fields. */
+ u32 nIPv4;
+ /** Describe the IPv6 address.
+ Only used if the IPv6 address should be read or configured.
+ Cannot be used together with the IPv4 address fields. */
+ u16 nIPv6[8];
+} GSW_IP_t;
+
+/** \brief Selection to use IPv4 or IPv6.
+ Used along with \ref GSW_IP_t to denote which union member to be accessed.
+*/
+typedef enum {
+ /** IPv4 Type */
+ GSW_IP_SELECT_IPV4 = 0,
+ /** IPv6 Type */
+ GSW_IP_SELECT_IPV6 = 1
+} GSW_IP_Select_t;
+
+#endif /* _GSW_TYPES_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/mdio_relay.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/mdio_relay.h
new file mode 100644
index 0000000..ff69dd7
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/mdio_relay.h
@@ -0,0 +1,70 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _MDIO_RELAY_H_
+#define _MDIO_RELAY_H_
+
+#pragma pack(push, 1)
+#pragma scalar_storage_order little-endian
+
+struct mdio_relay_data {
+ /* data to be read or written */
+ uint16_t data;
+ /* PHY index (0~7) for internal PHY
+ * PHY address (0~31) for external PHY access via MDIO bus
+ */
+ uint8_t phy;
+ /* MMD device (0~31) */
+ uint8_t mmd;
+ /* Register Index
+ * 0~31 if mmd is 0 (CL22)
+ * 0~65535 otherwise (CL45)
+ */
+ uint16_t reg;
+};
+
+struct mdio_relay_mod_data {
+ /* data to be written with mask */
+ uint16_t data;
+ /* PHY index (0~7) for internal PHY
+ * PHY address (0~31) for external PHY access via MDIO bus
+ */
+ uint8_t phy;
+ /* MMD device (0~31) */
+ uint8_t mmd;
+ /* Register Index
+ * 0~31 if mmd is 0 (CL22)
+ * 0~65535 otherwise (CL45)
+ */
+ uint16_t reg;
+ /* mask of bit fields to be updated
+ * 1 to write the bit
+ * 0 to ignore
+ */
+ uint16_t mask;
+};
+
+#pragma scalar_storage_order default
+#pragma pack(pop)
+
+/* read internal GPHY MDIO/MMD registers */
+int int_gphy_read(const GSW_Device_t *dev, struct mdio_relay_data *pdata);
+/* write internal GPHY MDIO/MMD registers */
+int int_gphy_write(const GSW_Device_t *dev, struct mdio_relay_data *pdata);
+/* modify internal GPHY MDIO/MMD registers */
+int int_gphy_mod(const GSW_Device_t *dev, struct mdio_relay_mod_data *pdata);
+
+/* read external GPHY MDIO/MMD registers via MDIO bus */
+int ext_mdio_read(const GSW_Device_t *dev, struct mdio_relay_data *pdata);
+/* write external GPHY MDIO/MMD registers via MDIO bus */
+int ext_mdio_write(const GSW_Device_t *dev, struct mdio_relay_data *pdata);
+/* modify external GPHY MDIO/MMD registers via MDIO bus */
+int ext_mdio_mod(const GSW_Device_t *dev, struct mdio_relay_mod_data *pdata);
+
+#endif /* _MDIO_RELAY_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/mmd_apis.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/mmd_apis.h
new file mode 100644
index 0000000..592938c
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/mmd_apis.h
@@ -0,0 +1,325 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _MXL_MMD_APIS_H_
+#define _MXL_MMD_APIS_H_
+
+#include "gsw_api.h"
+#include "mdio_relay.h"
+#include "sys_misc.h"
+
+#define GSW_MMD_SMDIO_DEV 0
+#define GSW_MMD_DEV 30
+#define GSW_MMD_REG_CTRL 0
+#define GSW_MMD_REG_LEN_RET 1
+#define GSW_MMD_REG_DATA_FIRST 2
+#define GSW_MMD_REG_DATA_LAST 95
+#define GSW_MMD_REG_DATA_MAX_SIZE \
+ (GSW_MMD_REG_DATA_LAST - GSW_MMD_REG_DATA_FIRST + 1)
+
+typedef union mmd_api_data {
+ uint16_t data[GSW_MMD_REG_DATA_MAX_SIZE * 3]; //Maximum data size is GSW_PCE_rule_t (508)
+ GSW_register_t GSW_register_t_data;
+ GSW_register_mod_t GSW_register_mod_t_data;
+ GSW_CPU_PortCfg_t GSW_CPU_PortCfg_t_data;
+ GSW_portLinkCfg_t GSW_portLinkCfg_t_data;
+ GSW_portCfg_t GSW_portCfg_t_data;
+ GSW_cfg_t GSW_cfg_t_data;
+ GSW_monitorPortCfg_t GSW_monitorPortCfg_t_data;
+ GSW_PCE_rule_t GSW_PCE_rule_t_data;
+ GSW_PCE_ruleEntry_t GSW_PCE_ruleEntry_t_data;
+ GSW_BRIDGE_config_t GSW_BRIDGE_config_t_data;
+ GSW_BRIDGE_alloc_t GSW_BRIDGE_alloc_t_data;
+ GSW_BRIDGE_portAlloc_t GSW_BRIDGE_portAlloc_t_data;
+ GSW_BRIDGE_portConfig_t GSW_BRIDGE_portConfig_t_data;
+ GSW_CTP_portAssignment_t GSW_CTP_portAssignment_t_data;
+ GSW_CTP_portConfig_t GSW_CTP_portConfig_t_data;
+ GSW_QoS_DSCP_ClassCfg_t GSW_QoS_DSCP_ClassCfg_t_data;
+ GSW_QoS_DSCP_DropPrecedenceCfg_t GSW_QoS_DSCP_DropPrecedenceCfg_t_data;
+ GSW_QoS_portRemarkingCfg_t GSW_QoS_portRemarkingCfg_t_data;
+ GSW_QoS_PCP_ClassCfg_t GSW_QoS_PCP_ClassCfg_t_data;
+ GSW_QoS_portCfg_t GSW_QoS_portCfg_t_data;
+ GSW_QoS_queuePort_t GSW_QoS_queuePort_t_data;
+ GSW_QoS_schedulerCfg_t GSW_QoS_schedulerCfg_t_data;
+ GSW_QoS_ShaperCfg_t GSW_QoS_ShaperCfg_t_data;
+ GSW_QoS_ShaperQueue_t GSW_QoS_ShaperQueue_t_data;
+ GSW_QoS_ShaperQueueGet_t GSW_QoS_ShaperQueueGet_t_data;
+ GSW_QoS_stormCfg_t GSW_QoS_stormCfg_t_data;
+ GSW_QoS_WRED_Cfg_t GSW_QoS_WRED_Cfg_t_data;
+ GSW_QoS_WRED_QueueCfg_t GSW_QoS_WRED_QueueCfg_t_data;
+ GSW_QoS_WRED_PortCfg_t GSW_QoS_WRED_PortCfg_t_data;
+ GSW_QoS_FlowCtrlCfg_t GSW_QoS_FlowCtrlCfg_t_data;
+ GSW_QoS_FlowCtrlPortCfg_t GSW_QoS_FlowCtrlPortCfg_t_data;
+ GSW_QoS_QueueBufferReserveCfg_t GSW_QoS_QueueBufferReserveCfg_t_data;
+ GSW_QoS_colorMarkingEntry_t GSW_QoS_colorMarkingEntry_t_data;
+ GSW_QoS_colorRemarkingEntry_t GSW_QoS_colorRemarkingEntry_t_data;
+ GSW_QoS_meterCfg_t GSW_QoS_meterCfg_t_data;
+ GSW_DSCP2PCP_map_t GSW_DSCP2PCP_map_t_data;
+ GSW_PMAPPER_t GSW_PMAPPER_t_data;
+ GSW_QoS_SVLAN_PCP_ClassCfg_t GSW_QoS_SVLAN_PCP_ClassCfg_t_data;
+ GSW_RMON_Port_cnt_t GSW_RMON_Port_cnt_t_data;
+ GSW_RMON_mode_t GSW_RMON_mode_t_data;
+ GSW_RMON_Meter_cnt_t GSW_RMON_Meter_cnt_t_data;
+ GSW_RMON_clear_t GSW_RMON_clear_t_data;
+ GSW_RMON_flowGet_t GSW_RMON_flowGet_t_data;
+ GSW_TflowCmodeConf_t GSW_TflowCmodeConf_t_data;
+ GSW_Debug_RMON_Port_cnt_t GSW_Debug_RMON_Port_cnt_t_data;
+ GSW_table_t GSW_table_t_data;
+ GSW_debug_t GSW_debug_t_data;
+ GSW_PMAC_Cnt_t GSW_PMAC_Cnt_t_data;
+ GSW_PMAC_Glbl_Cfg_t GSW_PMAC_Glbl_Cfg_t_data;
+ GSW_PMAC_BM_Cfg_t GSW_PMAC_BM_Cfg_t_data;
+ GSW_PMAC_Ig_Cfg_t GSW_PMAC_Ig_Cfg_t_data;
+ GSW_PMAC_Eg_Cfg_t GSW_PMAC_Eg_Cfg_t_data;
+ GSW_MAC_tableClearCond_t GSW_MAC_tableClearCond_t_data;
+ GSW_MAC_tableAdd_t GSW_MAC_tableAdd_t_data;
+ GSW_MAC_tableRead_t GSW_MAC_tableRead_t_data;
+ GSW_MAC_tableQuery_t GSW_MAC_tableQuery_t_data;
+ GSW_MAC_tableRemove_t GSW_MAC_tableRemove_t_data;
+ GSW_MACFILTER_default_t GSW_MACFILTER_default_t_data;
+// #ifdef CONFIG_GSWIP_EVLAN
+ GSW_EXTENDEDVLAN_config_t GSW_EXTENDEDVLAN_config_t_data;
+ GSW_EXTENDEDVLAN_alloc_t GSW_EXTENDEDVLAN_alloc_t_data;
+ GSW_VLANFILTER_config_t GSW_VLANFILTER_config_t_data;
+ GSW_VLANFILTER_alloc_t GSW_VLANFILTER_alloc_t_data;
+ GSW_VLAN_RMON_control_t GSW_VLAN_RMON_control_t_data;
+ GSW_VLAN_RMON_cnt_t GSW_VLAN_RMON_cnt_t_data;
+ GSW_VlanCounterMapping_config_t GSW_VlanCounterMapping_config_t_data;
+// #endif
+ GSW_multicastRouterRead_t GSW_multicastRouterRead_t_data;
+ GSW_multicastRouter_t GSW_multicastRouter_t_data;
+ GSW_multicastSnoopCfg_t GSW_multicastSnoopCfg_t_data;
+ GSW_multicastTableRead_t GSW_multicastTableRead_t_data;
+ GSW_multicastTable_t GSW_multicastTable_t_data;
+ GSW_trunkingCfg_t GSW_trunkingCfg_t_data;
+ GSW_STP_portCfg_t GSW_STP_portCfg_t_data;
+ GSW_STP_BPDU_Rule_t GSW_STP_BPDU_Rule_t_data;
+ GSW_PBB_Tunnel_Template_Config_t GSW_PBB_Tunnel_Template_Config_t_data;
+
+ struct mdio_relay_data mdio_relay_data;
+ struct mdio_relay_mod_data mdio_relay_mod_data;
+ struct sys_fw_image_version img_ver_data;
+// #ifdef CONFIG_SENSOR_MXL
+ struct sys_sensor_value pvt_sensor_data;
+// #endif
+} mmd_api_data_t;
+
+#define GSW_COMMON_MAGIC 0x100
+#define GSW_TFLOW_MAGIC 0x200
+#define GSW_BRDG_MAGIC 0x300
+#define GSW_BRDGPORT_MAGIC 0x400
+#define GSW_CTP_MAGIC 0x500
+#define GSW_QOS_MAGIC 0x600
+#define GSW_RMON_MAGIC 0x700
+#define GSW_DEBUG_MAGIC 0x800
+#define GSW_PMAC_MAGIC 0x900
+#define GSW_SWMAC_MAGIC 0xA00
+#define GSW_EXTVLAN_MAGIC 0xB00
+#define GSW_VLANFILTER_MAGIC 0xC00
+#define GSW_MULTICAST_MAGIC 0xD00
+#define GSW_TRUNKING_MAGIC 0xE00
+#define GSW_STP_MAGIC 0xF00
+#define GSW_PBB_MAGIC 0x1000
+#define GSW_VLAN_RMON_MAGIC 0x1100
+
+#define GPY_GPY2XX_MAGIC 0x1800
+
+#define SYS_MISC_MAGIC 0x1900
+
+#ifdef MMD_API_TEST
+#define MMD_API_SIMPLE_TEST (0x0 + 0x1)
+#endif
+#define MMD_API_SET_DATA_0 (0x0 + 0x2)
+#define MMD_API_SET_DATA_1 (0x0 + 0x3)
+#define MMD_API_SET_DATA_2 (0x0 + 0x4)
+#define MMD_API_GET_DATA_0 (0x0 + 0x5)
+#define MMD_API_GET_DATA_1 (0x0 + 0x6)
+#define MMD_API_GET_DATA_2 (0x0 + 0x7)
+#define MMD_API_RST_DATA (0x0 + 0x8)
+
+#define GSW_COMMON_REGISTERGET (GSW_COMMON_MAGIC + 0x1)
+#define GSW_COMMON_REGISTERSET (GSW_COMMON_MAGIC + 0x2)
+#define GSW_COMMON_CPU_PORTCFGGET (GSW_COMMON_MAGIC + 0x3)
+#define GSW_COMMON_CPU_PORTCFGSET (GSW_COMMON_MAGIC + 0x4)
+#define GSW_COMMON_PORTLINKCFGGET (GSW_COMMON_MAGIC + 0x5)
+#define GSW_COMMON_PORTLINKCFGSET (GSW_COMMON_MAGIC + 0x6)
+#define GSW_COMMON_PORTCFGGET (GSW_COMMON_MAGIC + 0x7)
+#define GSW_COMMON_PORTCFGSET (GSW_COMMON_MAGIC + 0x8)
+#define GSW_COMMON_CFGGET (GSW_COMMON_MAGIC + 0x9)
+#define GSW_COMMON_CFGSET (GSW_COMMON_MAGIC + 0xA)
+#define GSW_COMMON_MONITORPORTCFGGET (GSW_COMMON_MAGIC + 0xD)
+#define GSW_COMMON_MONITORPORTCFGSET (GSW_COMMON_MAGIC + 0xE)
+#define GSW_COMMON_FREEZE (GSW_COMMON_MAGIC + 0xF)
+#define GSW_COMMON_UNFREEZE (GSW_COMMON_MAGIC + 0x10)
+#define GSW_COMMON_REGISTERMOD (GSW_COMMON_MAGIC + 0x11)
+
+#define GSW_TFLOW_PCERULEREAD (GSW_TFLOW_MAGIC + 0x1)
+#define GSW_TFLOW_PCERULEWRITE (GSW_TFLOW_MAGIC + 0x2)
+#define GSW_TFLOW_PCERULEDELETE (GSW_TFLOW_MAGIC + 0x3)
+#define GSW_TFLOW_PCERULEALLOC (GSW_TFLOW_MAGIC + 0x4)
+#define GSW_TFLOW_PCERULEFREE (GSW_TFLOW_MAGIC + 0x5)
+#define GSW_TFLOW_PCERULEENABLE (GSW_TFLOW_MAGIC + 0x6)
+#define GSW_TFLOW_PCERULEDISABLE (GSW_TFLOW_MAGIC + 0x7)
+
+#define GSW_BRIDGE_ALLOC (GSW_BRDG_MAGIC + 0x1)
+#define GSW_BRIDGE_CONFIGSET (GSW_BRDG_MAGIC + 0x2)
+#define GSW_BRIDGE_CONFIGGET (GSW_BRDG_MAGIC + 0x3)
+#define GSW_BRIDGE_FREE (GSW_BRDG_MAGIC + 0x4)
+
+#define GSW_BRIDGEPORT_ALLOC (GSW_BRDGPORT_MAGIC + 0x1)
+#define GSW_BRIDGEPORT_CONFIGSET (GSW_BRDGPORT_MAGIC + 0x2)
+#define GSW_BRIDGEPORT_CONFIGGET (GSW_BRDGPORT_MAGIC + 0x3)
+#define GSW_BRIDGEPORT_FREE (GSW_BRDGPORT_MAGIC + 0x4)
+
+#define GSW_CTP_PORTASSIGNMENTALLOC (GSW_CTP_MAGIC + 0x1)
+#define GSW_CTP_PORTASSIGNMENTFREE (GSW_CTP_MAGIC + 0x2)
+#define GSW_CTP_PORTASSIGNMENTSET (GSW_CTP_MAGIC + 0x3)
+#define GSW_CTP_PORTASSIGNMENTGET (GSW_CTP_MAGIC + 0x4)
+#define GSW_CTP_PORTCONFIGSET (GSW_CTP_MAGIC + 0x5)
+#define GSW_CTP_PORTCONFIGGET (GSW_CTP_MAGIC + 0x6)
+#define GSW_CTP_PORTCONFIGRESET (GSW_CTP_MAGIC + 0x7)
+
+#define GSW_QOS_METERCFGGET (GSW_QOS_MAGIC + 0x1)
+#define GSW_QOS_METERCFGSET (GSW_QOS_MAGIC + 0x2)
+#define GSW_QOS_DSCP_CLASSGET (GSW_QOS_MAGIC + 0x4)
+#define GSW_QOS_DSCP_CLASSSET (GSW_QOS_MAGIC + 0x5)
+#define GSW_QOS_DSCP_DROPPRECEDENCECFGGET (GSW_QOS_MAGIC + 0x6)
+#define GSW_QOS_DSCP_DROPPRECEDENCECFGSET (GSW_QOS_MAGIC + 0x7)
+#define GSW_QOS_PORTREMARKINGCFGGET (GSW_QOS_MAGIC + 0x8)
+#define GSW_QOS_PORTREMARKINGCFGSET (GSW_QOS_MAGIC + 0x9)
+#define GSW_QOS_PCP_CLASSGET (GSW_QOS_MAGIC + 0xA)
+#define GSW_QOS_PCP_CLASSSET (GSW_QOS_MAGIC + 0xB)
+#define GSW_QOS_PORTCFGGET (GSW_QOS_MAGIC + 0xC)
+#define GSW_QOS_PORTCFGSET (GSW_QOS_MAGIC + 0xD)
+#define GSW_QOS_QUEUEPORTGET (GSW_QOS_MAGIC + 0xE)
+#define GSW_QOS_QUEUEPORTSET (GSW_QOS_MAGIC + 0xF)
+#define GSW_QOS_SCHEDULERCFGGET (GSW_QOS_MAGIC + 0x10)
+#define GSW_QOS_SCHEDULERCFGSET (GSW_QOS_MAGIC + 0x11)
+#define GSW_QOS_SHAPERCFGGET (GSW_QOS_MAGIC + 0x12)
+#define GSW_QOS_SHAPERCFGSET (GSW_QOS_MAGIC + 0x13)
+#define GSW_QOS_SHAPERQUEUEASSIGN (GSW_QOS_MAGIC + 0x14)
+#define GSW_QOS_SHAPERQUEUEDEASSIGN (GSW_QOS_MAGIC + 0x15)
+#define GSW_QOS_SHAPERQUEUEGET (GSW_QOS_MAGIC + 0x16)
+#define GSW_QOS_STORMCFGSET (GSW_QOS_MAGIC + 0x17)
+#define GSW_QOS_STORMCFGGET (GSW_QOS_MAGIC + 0x18)
+#define GSW_QOS_WREDCFGGET (GSW_QOS_MAGIC + 0x19)
+#define GSW_QOS_WREDCFGSET (GSW_QOS_MAGIC + 0x1A)
+#define GSW_QOS_WREDQUEUECFGGET (GSW_QOS_MAGIC + 0x1B)
+#define GSW_QOS_WREDQUEUECFGSET (GSW_QOS_MAGIC + 0x1C)
+#define GSW_QOS_WREDPORTCFGGET (GSW_QOS_MAGIC + 0x1D)
+#define GSW_QOS_WREDPORTCFGSET (GSW_QOS_MAGIC + 0x1E)
+#define GSW_QOS_FLOWCTRLCFGGET (GSW_QOS_MAGIC + 0x1F)
+#define GSW_QOS_FLOWCTRLCFGSET (GSW_QOS_MAGIC + 0x20)
+#define GSW_QOS_FLOWCTRLPORTCFGGET (GSW_QOS_MAGIC + 0x21)
+#define GSW_QOS_FLOWCTRLPORTCFGSET (GSW_QOS_MAGIC + 0x22)
+#define GSW_QOS_QUEUEBUFFERRESERVECFGGET (GSW_QOS_MAGIC + 0x23)
+#define GSW_QOS_QUEUEBUFFERRESERVECFGSET (GSW_QOS_MAGIC + 0x24)
+#define GSW_QOS_COLORMARKINGTABLEGET (GSW_QOS_MAGIC + 0x26)
+#define GSW_QOS_COLORMARKINGTABLESET (GSW_QOS_MAGIC + 0x27)
+#define GSW_QOS_COLORREMARKINGTABLESET (GSW_QOS_MAGIC + 0x28)
+#define GSW_QOS_COLORREMARKINGTABLEGET (GSW_QOS_MAGIC + 0x29)
+#define GSW_QOS_METERALLOC (GSW_QOS_MAGIC + 0x2A)
+#define GSW_QOS_METERFREE (GSW_QOS_MAGIC + 0x2B)
+#define GSW_QOS_DSCP2PCPTABLESET (GSW_QOS_MAGIC + 0x2C)
+#define GSW_QOS_DSCP2PCPTABLEGET (GSW_QOS_MAGIC + 0x2D)
+#define GSW_QOS_PMAPPERTABLESET (GSW_QOS_MAGIC + 0x2E)
+#define GSW_QOS_PMAPPERTABLEGET (GSW_QOS_MAGIC + 0x2F)
+#define GSW_QOS_SVLAN_PCP_CLASSGET (GSW_QOS_MAGIC + 0x30)
+#define GSW_QOS_SVLAN_PCP_CLASSSET (GSW_QOS_MAGIC + 0x31)
+
+#define GSW_RMON_PORT_GET (GSW_RMON_MAGIC + 0x1)
+#define GSW_RMON_MODE_SET (GSW_RMON_MAGIC + 0x2)
+#define GSW_RMON_METER_GET (GSW_RMON_MAGIC + 0x3)
+#define GSW_RMON_CLEAR (GSW_RMON_MAGIC + 0x4)
+#define GSW_RMON_TFLOWGET (GSW_RMON_MAGIC + 0x5)
+#define GSW_RMON_TFLOWCLEAR (GSW_RMON_MAGIC + 0x6)
+#define GSW_RMON_TFLOWCOUNTMODESET (GSW_RMON_MAGIC + 0x7)
+#define GSW_RMON_TFLOWCOUNTMODEGET (GSW_RMON_MAGIC + 0x8)
+
+#define GSW_DEBUG_RMON_PORT_GET (GSW_DEBUG_MAGIC + 0x1)
+
+#define GSW_PMAC_COUNTGET (GSW_PMAC_MAGIC + 0x1)
+#define GSW_PMAC_GBL_CFGSET (GSW_PMAC_MAGIC + 0x2)
+#define GSW_PMAC_GBL_CFGGET (GSW_PMAC_MAGIC + 0x3)
+#define GSW_PMAC_BM_CFGSET (GSW_PMAC_MAGIC + 0x4)
+#define GSW_PMAC_BM_CFGGET (GSW_PMAC_MAGIC + 0x5)
+#define GSW_PMAC_IG_CFGSET (GSW_PMAC_MAGIC + 0x6)
+#define GSW_PMAC_IG_CFGGET (GSW_PMAC_MAGIC + 0x7)
+#define GSW_PMAC_EG_CFGSET (GSW_PMAC_MAGIC + 0x8)
+#define GSW_PMAC_EG_CFGGET (GSW_PMAC_MAGIC + 0x9)
+
+#define GSW_MAC_TABLECLEAR (GSW_SWMAC_MAGIC + 0x1)
+#define GSW_MAC_TABLEENTRYADD (GSW_SWMAC_MAGIC + 0x2)
+#define GSW_MAC_TABLEENTRYREAD (GSW_SWMAC_MAGIC + 0x3)
+#define GSW_MAC_TABLEENTRYQUERY (GSW_SWMAC_MAGIC + 0x4)
+#define GSW_MAC_TABLEENTRYREMOVE (GSW_SWMAC_MAGIC + 0x5)
+#define GSW_MAC_DEFAULTFILTERSET (GSW_SWMAC_MAGIC + 0x6)
+#define GSW_MAC_DEFAULTFILTERGET (GSW_SWMAC_MAGIC + 0x7)
+#define GSW_MAC_TABLECLEARCOND (GSW_SWMAC_MAGIC + 0x8)
+
+#define GSW_EXTENDEDVLAN_ALLOC (GSW_EXTVLAN_MAGIC + 0x1)
+#define GSW_EXTENDEDVLAN_SET (GSW_EXTVLAN_MAGIC + 0x2)
+#define GSW_EXTENDEDVLAN_GET (GSW_EXTVLAN_MAGIC + 0x3)
+#define GSW_EXTENDEDVLAN_FREE (GSW_EXTVLAN_MAGIC + 0x4)
+
+#define GSW_VLANFILTER_ALLOC (GSW_VLANFILTER_MAGIC + 0x1)
+#define GSW_VLANFILTER_SET (GSW_VLANFILTER_MAGIC + 0x2)
+#define GSW_VLANFILTER_GET (GSW_VLANFILTER_MAGIC + 0x3)
+#define GSW_VLANFILTER_FREE (GSW_VLANFILTER_MAGIC + 0x4)
+
+#define GSW_VLAN_COUNTER_MAPPING_SET (GSW_VLAN_RMON_MAGIC + 0x1)
+#define GSW_VLAN_COUNTER_MAPPING_GET (GSW_VLAN_RMON_MAGIC + 0x2)
+#define GSW_VLAN_RMON_GET (GSW_VLAN_RMON_MAGIC + 0x3)
+#define GSW_VLAN_RMON_CLEAR (GSW_VLAN_RMON_MAGIC + 0x4)
+#define GSW_VLAN_RMON_CONTROL_SET (GSW_VLAN_RMON_MAGIC + 0x5)
+#define GSW_VLAN_RMON_CONTROL_GET (GSW_VLAN_RMON_MAGIC + 0x6)
+
+#define GSW_MULTICAST_ROUTERPORTADD (GSW_MULTICAST_MAGIC + 0x1)
+#define GSW_MULTICAST_ROUTERPORTREAD (GSW_MULTICAST_MAGIC + 0x2)
+#define GSW_MULTICAST_ROUTERPORTREMOVE (GSW_MULTICAST_MAGIC + 0x3)
+#define GSW_MULTICAST_SNOOPCFGGET (GSW_MULTICAST_MAGIC + 0x4)
+#define GSW_MULTICAST_SNOOPCFGSET (GSW_MULTICAST_MAGIC + 0x5)
+#define GSW_MULTICAST_TABLEENTRYADD (GSW_MULTICAST_MAGIC + 0x6)
+#define GSW_MULTICAST_TABLEENTRYREAD (GSW_MULTICAST_MAGIC + 0x7)
+#define GSW_MULTICAST_TABLEENTRYREMOVE (GSW_MULTICAST_MAGIC + 0x8)
+
+#define GSW_TRUNKING_CFGGET (GSW_TRUNKING_MAGIC + 0x1)
+#define GSW_TRUNKING_CFGSET (GSW_TRUNKING_MAGIC + 0x2)
+#define GSW_TRUNKING_PORTCFGGET (GSW_TRUNKING_MAGIC + 0x3)
+#define GSW_TRUNKING_PORTCFGSET (GSW_TRUNKING_MAGIC + 0x4)
+
+#define GSW_STP_PORTCFGGET (GSW_STP_MAGIC + 0x1)
+#define GSW_STP_PORTCFGSET (GSW_STP_MAGIC + 0x2)
+#define GSW_STP_BPDU_RULEGET (GSW_STP_MAGIC + 0x3)
+#define GSW_STP_BPDU_RULESET (GSW_STP_MAGIC + 0x4)
+
+#define GSW_PBB_TEMPLATEALLOC (GSW_PBB_MAGIC + 0x1)
+#define GSW_PBB_TEMPLATEFREE (GSW_PBB_MAGIC + 0x2)
+#define GSW_PBB_TEMPLATESET (GSW_PBB_MAGIC + 0x3)
+#define GSW_PBB_TEMPLATEGET (GSW_PBB_MAGIC + 0x4)
+
+#define INT_GPHY_READ (GPY_GPY2XX_MAGIC + 0x01)
+#define INT_GPHY_WRITE (GPY_GPY2XX_MAGIC + 0x02)
+#define INT_GPHY_MOD (GPY_GPY2XX_MAGIC + 0x03)
+#define EXT_MDIO_READ (GPY_GPY2XX_MAGIC + 0x11)
+#define EXT_MDIO_WRITE (GPY_GPY2XX_MAGIC + 0x12)
+#define EXT_MDIO_MOD (GPY_GPY2XX_MAGIC + 0x13)
+
+#define SYS_MISC_FW_UPDATE (SYS_MISC_MAGIC + 0x01)
+#define SYS_MISC_FW_VERSION (SYS_MISC_MAGIC + 0x02)
+#define SYS_MISC_PVT_TEMP (SYS_MISC_MAGIC + 0x03)
+#define SYS_MISC_PVT_VOLTAGE (SYS_MISC_MAGIC + 0x04)
+#define SYS_MISC_DELAY (SYS_MISC_MAGIC + 0x05)
+#define SYS_MISC_GPIO_CONFIGURE (SYS_MISC_MAGIC + 0x06)
+#define SYS_MISC_REBOOT (SYS_MISC_MAGIC + 0x07)
+#define SYS_MISC_REG_RD (SYS_MISC_MAGIC + 0x08)
+
+#define MMD_API_MAXIMUM_ID 0x7FFF
+
+#endif /* _MXL_MMD_APIS_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/include/gswip/sys_misc.h b/feed/app/ethswbox/src/switch_hostapi/include/gswip/sys_misc.h
new file mode 100644
index 0000000..178bafc
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/include/gswip/sys_misc.h
@@ -0,0 +1,89 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _SYS_MISC_H_
+#define _SYS_MISC_H_
+
+#pragma pack(push, 1)
+#pragma scalar_storage_order little-endian
+
+struct sys_fw_image_version {
+ uint8_t major;
+ uint8_t minor;
+ uint16_t revision;
+ uint32_t app_revision;
+};
+
+struct sys_delay {
+ /* m_sec unit is 1ms, the accuracy is 10ms. */
+ uint32_t m_sec;
+};
+
+struct sys_gpio_config {
+ uint16_t enable_mask[3];
+ uint16_t alt_sel_0[3];
+ uint16_t alt_sel_1[3];
+ uint16_t dir[3];
+ uint16_t out_val[3];
+ /**
+ * reserve 1 - reserved for open drain in future
+ * reserve 2 - reserved for pull up enable in future
+ * reserve 3 - reserved for pull up/down in future
+ **/
+ uint16_t reserve_1[3];
+ uint16_t reserve_2[3];
+ uint16_t reserve_3[3];
+ /**
+ * unit is 1ms, the accuracy is 10ms.
+ **/
+ uint32_t timeout_val;
+};
+
+/**
+ * @brief Representation of a sensor readout value.
+ *
+ * The value is represented as having an integer and a fractional part,
+ * and can be obtained using the formula val1 + val2 * 10^(-6). Negative
+ * values also adhere to the above formula, but may need special attention.
+ * Here are some examples of the value representation:
+ *
+ * 0.5: val1 = 0, val2 = 500000
+ * -0.5: val1 = 0, val2 = -500000
+ * -1.0: val1 = -1, val2 = 0
+ * -1.5: val1 = -1, val2 = -500000
+ */
+struct sys_sensor_value {
+ /** Integer part of the value. */
+ int32_t val1;
+ /** Fractional part of the value (in one-millionth parts). */
+ int32_t val2;
+};
+
+/**
+ * @brief Register read data structure
+ */
+struct sys_reg_rd {
+ /** 32-bit register address */
+ uint32_t addr;
+ /** register value */
+ uint32_t val;
+};
+
+#pragma scalar_storage_order default
+#pragma pack(pop)
+
+int sys_misc_fw_update(const GSW_Device_t *dummy);
+int sys_misc_fw_version(const GSW_Device_t *dummy, struct sys_fw_image_version *sys_img_ver);
+int sys_misc_pvt_temp(const GSW_Device_t *dev, struct sys_sensor_value *sys_temp_val);
+int sys_misc_pvt_voltage(const GSW_Device_t *dev, struct sys_sensor_value *sys_voltage);
+int sys_misc_delay(const GSW_Device_t *dummy, struct sys_delay *pdelay);
+int sys_misc_gpio_configure(const GSW_Device_t *dummy, struct sys_gpio_config *sys_gpio_conf);
+int sys_misc_reboot(const GSW_Device_t *dummy);
+int sys_misc_reg_rd(const GSW_Device_t *dummy, struct sys_reg_rd *sys_reg);
+#endif
\ No newline at end of file
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/gsw_api.c b/feed/app/ethswbox/src/switch_hostapi/src/gsw_api.c
new file mode 100644
index 0000000..4b29d28
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/gsw_api.c
@@ -0,0 +1,1434 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#include "host_adapt.h"
+#include "host_api_impl.h"
+#include <gsw_api.h>
+
+GSW_return_t GSW_RegisterGet(const GSW_Device_t *dev, GSW_register_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_REGISTERGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_RegisterSet(const GSW_Device_t *dev, GSW_register_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_REGISTERSET,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_RegisterMod(const GSW_Device_t *dev, GSW_register_mod_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_REGISTERMOD,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_CPU_PortCfgGet(const GSW_Device_t *dev, GSW_CPU_PortCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_CPU_PORTCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_CPU_PortCfgSet(const GSW_Device_t *dev, GSW_CPU_PortCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_CPU_PORTCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_COMMON_CPU_PORTCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_PortLinkCfgGet(const GSW_Device_t *dev, GSW_portLinkCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_PORTLINKCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PortLinkCfgSet(const GSW_Device_t *dev, GSW_portLinkCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_PORTLINKCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_COMMON_PORTLINKCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_PortCfgGet(const GSW_Device_t *dev, GSW_portCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_PORTCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PortCfgSet(const GSW_Device_t *dev, GSW_portCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_PORTCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_COMMON_PORTCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_CfgGet(const GSW_Device_t *dev, GSW_cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_CFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_CfgSet(const GSW_Device_t *dev, GSW_cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_CFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_COMMON_CFGGET,
+ 0);
+}
+
+GSW_return_t GSW_MonitorPortCfgGet(const GSW_Device_t *dev, GSW_monitorPortCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_MONITORPORTCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_MonitorPortCfgSet(const GSW_Device_t *dev, GSW_monitorPortCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_MONITORPORTCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_COMMON_MONITORPORTCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_Freeze(const GSW_Device_t *dev)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_FREEZE,
+ NULL,
+ 0,
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_UnFreeze(const GSW_Device_t *dev)
+{
+ return gsw_api_wrap(dev,
+ GSW_COMMON_UNFREEZE,
+ NULL,
+ 0,
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_PceRuleRead(const GSW_Device_t *dev, GSW_PCE_rule_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_TFLOW_PCERULEREAD,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PceRuleWrite(const GSW_Device_t *dev, GSW_PCE_rule_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_TFLOW_PCERULEWRITE,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PceRuleDelete(const GSW_Device_t *dev, GSW_PCE_ruleEntry_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_TFLOW_PCERULEDELETE,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PceRuleAlloc(const GSW_Device_t *dev, GSW_PCE_rule_alloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_TFLOW_PCERULEALLOC,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PceRuleFree(const GSW_Device_t *dev, GSW_PCE_rule_alloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_TFLOW_PCERULEFREE,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PceRuleEnable(const GSW_Device_t *dev, GSW_PCE_ruleEntry_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_TFLOW_PCERULEENABLE,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PceRuleDisable(const GSW_Device_t *dev, GSW_PCE_ruleEntry_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_TFLOW_PCERULEDISABLE,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_BridgeAlloc(const GSW_Device_t *dev, GSW_BRIDGE_alloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_BRIDGE_ALLOC,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_BridgeConfigSet(const GSW_Device_t *dev, GSW_BRIDGE_config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_BRIDGE_CONFIGSET,
+ parm,
+ sizeof(*parm),
+ GSW_BRIDGE_CONFIGGET,
+ 0);
+}
+
+GSW_return_t GSW_BridgeConfigGet(const GSW_Device_t *dev, GSW_BRIDGE_config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_BRIDGE_CONFIGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_BridgeFree(const GSW_Device_t *dev, GSW_BRIDGE_alloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_BRIDGE_FREE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_BridgePortAlloc(const GSW_Device_t *dev, GSW_BRIDGE_portAlloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_BRIDGEPORT_ALLOC,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_BridgePortConfigSet(const GSW_Device_t *dev, GSW_BRIDGE_portConfig_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_BRIDGEPORT_CONFIGSET,
+ parm,
+ sizeof(*parm),
+ GSW_BRIDGEPORT_CONFIGGET,
+ 0);
+}
+
+GSW_return_t GSW_BridgePortConfigGet(const GSW_Device_t *dev, GSW_BRIDGE_portConfig_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_BRIDGEPORT_CONFIGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_BridgePortFree(const GSW_Device_t *dev, GSW_BRIDGE_portAlloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_BRIDGEPORT_FREE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_CTP_PortAssignmentAlloc(const GSW_Device_t *dev, GSW_CTP_portAssignment_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_CTP_PORTASSIGNMENTALLOC,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_CTP_PortAssignmentFree(const GSW_Device_t *dev, GSW_CTP_portAssignment_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_CTP_PORTASSIGNMENTFREE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_CTP_PortAssignmentSet(const GSW_Device_t *dev, GSW_CTP_portAssignment_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_CTP_PORTASSIGNMENTSET,
+ parm,
+ sizeof(*parm),
+ GSW_CTP_PORTASSIGNMENTGET,
+ 0);
+}
+
+GSW_return_t GSW_CTP_PortAssignmentGet(const GSW_Device_t *dev, GSW_CTP_portAssignment_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_CTP_PORTASSIGNMENTGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_CtpPortConfigSet(const GSW_Device_t *dev, GSW_CTP_portConfig_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_CTP_PORTCONFIGSET,
+ parm,
+ sizeof(*parm),
+ GSW_CTP_PORTCONFIGGET,
+ 0);
+}
+
+GSW_return_t GSW_CtpPortConfigGet(const GSW_Device_t *dev, GSW_CTP_portConfig_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_CTP_PORTCONFIGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_CtpPortConfigReset(const GSW_Device_t *dev, GSW_CTP_portConfig_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_CTP_PORTCONFIGRESET,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_QoS_MeterCfgGet(const GSW_Device_t *dev, GSW_QoS_meterCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_METERCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_MeterCfgSet(const GSW_Device_t *dev, GSW_QoS_meterCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_METERCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_METERCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_DSCP_ClassGet(const GSW_Device_t *dev, GSW_QoS_DSCP_ClassCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_DSCP_CLASSGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_DSCP_ClassSet(const GSW_Device_t *dev, GSW_QoS_DSCP_ClassCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_DSCP_CLASSSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_DSCP_CLASSGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_DSCP_DropPrecedenceCfgGet(const GSW_Device_t *dev, GSW_QoS_DSCP_DropPrecedenceCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_DSCP_DROPPRECEDENCECFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_DSCP_DropPrecedenceCfgSet(const GSW_Device_t *dev, GSW_QoS_DSCP_DropPrecedenceCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_DSCP_DROPPRECEDENCECFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_DSCP_DROPPRECEDENCECFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_PortRemarkingCfgGet(const GSW_Device_t *dev, GSW_QoS_portRemarkingCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_PORTREMARKINGCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_PortRemarkingCfgSet(const GSW_Device_t *dev, GSW_QoS_portRemarkingCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_PORTREMARKINGCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_PORTREMARKINGCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_PCP_ClassGet(const GSW_Device_t *dev, GSW_QoS_PCP_ClassCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_PCP_CLASSGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_PCP_ClassSet(const GSW_Device_t *dev, GSW_QoS_PCP_ClassCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_PCP_CLASSSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_PCP_CLASSGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_PortCfgGet(const GSW_Device_t *dev, GSW_QoS_portCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_PORTCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_PortCfgSet(const GSW_Device_t *dev, GSW_QoS_portCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_PORTCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_PORTCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_QueuePortGet(const GSW_Device_t *dev, GSW_QoS_queuePort_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_QUEUEPORTGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_QueuePortSet(const GSW_Device_t *dev, GSW_QoS_queuePort_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_QUEUEPORTSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_QUEUEPORTGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_SchedulerCfgGet(const GSW_Device_t *dev, GSW_QoS_schedulerCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_SCHEDULERCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_SchedulerCfgSet(const GSW_Device_t *dev, GSW_QoS_schedulerCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_SCHEDULERCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_SCHEDULERCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_ShaperCfgGet(const GSW_Device_t *dev, GSW_QoS_ShaperCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_SHAPERCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_ShaperCfgSet(const GSW_Device_t *dev, GSW_QoS_ShaperCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_SHAPERCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_SHAPERCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_ShaperQueueAssign(const GSW_Device_t *dev, GSW_QoS_ShaperQueue_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_SHAPERQUEUEASSIGN,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_QoS_ShaperQueueDeassign(const GSW_Device_t *dev, GSW_QoS_ShaperQueue_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_SHAPERQUEUEDEASSIGN,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_QoS_ShaperQueueGet(const GSW_Device_t *dev, GSW_QoS_ShaperQueueGet_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_SHAPERQUEUEGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_StormCfgSet(const GSW_Device_t *dev, GSW_QoS_stormCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_STORMCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_STORMCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_StormCfgGet(const GSW_Device_t *dev, GSW_QoS_stormCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_STORMCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_WredCfgGet(const GSW_Device_t *dev, GSW_QoS_WRED_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_WREDCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_WredCfgSet(const GSW_Device_t *dev, GSW_QoS_WRED_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_WREDCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_WREDCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_WredQueueCfgGet(const GSW_Device_t *dev, GSW_QoS_WRED_QueueCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_WREDQUEUECFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_WredQueueCfgSet(const GSW_Device_t *dev, GSW_QoS_WRED_QueueCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_WREDQUEUECFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_WREDQUEUECFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_WredPortCfgGet(const GSW_Device_t *dev, GSW_QoS_WRED_PortCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_WREDPORTCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_WredPortCfgSet(const GSW_Device_t *dev, GSW_QoS_WRED_PortCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_WREDPORTCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_WREDPORTCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_FlowctrlCfgGet(const GSW_Device_t *dev, GSW_QoS_FlowCtrlCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_FLOWCTRLCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_FlowctrlCfgSet(const GSW_Device_t *dev, GSW_QoS_FlowCtrlCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_FLOWCTRLCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_FLOWCTRLCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_FlowctrlPortCfgGet(const GSW_Device_t *dev, GSW_QoS_FlowCtrlPortCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_FLOWCTRLPORTCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_FlowctrlPortCfgSet(const GSW_Device_t *dev, GSW_QoS_FlowCtrlPortCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_FLOWCTRLPORTCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_FLOWCTRLPORTCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QoS_QueueBufferReserveCfgGet(const GSW_Device_t *dev, GSW_QoS_QueueBufferReserveCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_QUEUEBUFFERRESERVECFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_QueueBufferReserveCfgSet(const GSW_Device_t *dev, GSW_QoS_QueueBufferReserveCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_QUEUEBUFFERRESERVECFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_QUEUEBUFFERRESERVECFGGET,
+ 0);
+}
+
+GSW_return_t GSW_QOS_ColorMarkingTableGet(const GSW_Device_t *dev, GSW_QoS_colorMarkingEntry_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_COLORMARKINGTABLEGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QOS_ColorMarkingTableSet(const GSW_Device_t *dev, GSW_QoS_colorMarkingEntry_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_COLORMARKINGTABLESET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_COLORMARKINGTABLEGET,
+ 0);
+}
+
+GSW_return_t GSW_QOS_ColorReMarkingTableSet(const GSW_Device_t *dev, GSW_QoS_colorRemarkingEntry_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_COLORREMARKINGTABLESET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_COLORREMARKINGTABLEGET,
+ 0);
+}
+
+GSW_return_t GSW_QOS_ColorReMarkingTableGet(const GSW_Device_t *dev, GSW_QoS_colorRemarkingEntry_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_COLORREMARKINGTABLEGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QOS_MeterAlloc(const GSW_Device_t *dev, GSW_QoS_meterCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_METERALLOC,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QOS_MeterFree(const GSW_Device_t *dev, GSW_QoS_meterCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_METERFREE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_QOS_Dscp2PcpTableSet(const GSW_Device_t *dev, GSW_DSCP2PCP_map_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_DSCP2PCPTABLESET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_DSCP2PCPTABLEGET,
+ 0);
+}
+
+GSW_return_t GSW_QOS_Dscp2PcpTableGet(const GSW_Device_t *dev, GSW_DSCP2PCP_map_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_DSCP2PCPTABLEGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QOS_PmapperTableSet(const GSW_Device_t *dev, GSW_PMAPPER_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_PMAPPERTABLESET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_PMAPPERTABLEGET,
+ 0);
+}
+
+GSW_return_t GSW_QOS_PmapperTableGet(const GSW_Device_t *dev, GSW_PMAPPER_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_PMAPPERTABLEGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_SVLAN_PCP_ClassGet(const GSW_Device_t *dev, GSW_QoS_SVLAN_PCP_ClassCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_SVLAN_PCP_CLASSGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_QoS_SVLAN_PCP_ClassSet(const GSW_Device_t *dev, GSW_QoS_SVLAN_PCP_ClassCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_QOS_SVLAN_PCP_CLASSSET,
+ parm,
+ sizeof(*parm),
+ GSW_QOS_SVLAN_PCP_CLASSGET,
+ 0);
+}
+
+GSW_return_t GSW_RMON_Port_Get(const GSW_Device_t *dev, GSW_RMON_Port_cnt_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_RMON_PORT_GET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_RMON_Mode_Set(const GSW_Device_t *dev, GSW_RMON_mode_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_RMON_MODE_SET,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_RMON_Meter_Get(const GSW_Device_t *dev, GSW_RMON_Meter_cnt_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_RMON_METER_GET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_RMON_Clear(const GSW_Device_t *dev, GSW_RMON_clear_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_RMON_CLEAR,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_RMON_FlowGet(const GSW_Device_t *dev, GSW_RMON_flowGet_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_RMON_TFLOWGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_RmonTflowClear(const GSW_Device_t *dev, GSW_RMON_flowGet_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_RMON_TFLOWCLEAR,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_TflowCountModeSet(const GSW_Device_t *dev, GSW_TflowCmodeConf_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_RMON_TFLOWCOUNTMODESET,
+ parm,
+ sizeof(*parm),
+ GSW_RMON_TFLOWCOUNTMODEGET,
+ 0);
+}
+
+GSW_return_t GSW_TflowCountModeGet(const GSW_Device_t *dev, GSW_TflowCmodeConf_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_RMON_TFLOWCOUNTMODEGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_Debug_RMON_Port_Get(const GSW_Device_t *dev, GSW_Debug_RMON_Port_cnt_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_DEBUG_RMON_PORT_GET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PMAC_CountGet(const GSW_Device_t *dev, GSW_PMAC_Cnt_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PMAC_COUNTGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PMAC_GLBL_CfgSet(const GSW_Device_t *dev, GSW_PMAC_Glbl_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PMAC_GBL_CFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_PMAC_GBL_CFGGET,
+ 0);
+}
+
+GSW_return_t GSW_PMAC_GLBL_CfgGet(const GSW_Device_t *dev, GSW_PMAC_Glbl_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PMAC_GBL_CFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PMAC_BM_CfgSet(const GSW_Device_t *dev, GSW_PMAC_BM_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PMAC_BM_CFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_PMAC_BM_CFGGET,
+ 0);
+}
+
+GSW_return_t GSW_PMAC_BM_CfgGet(const GSW_Device_t *dev, GSW_PMAC_BM_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PMAC_BM_CFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PMAC_IG_CfgSet(const GSW_Device_t *dev, GSW_PMAC_Ig_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PMAC_IG_CFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_PMAC_IG_CFGGET,
+ 0);
+}
+
+GSW_return_t GSW_PMAC_IG_CfgGet(const GSW_Device_t *dev, GSW_PMAC_Ig_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PMAC_IG_CFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PMAC_EG_CfgSet(const GSW_Device_t *dev, GSW_PMAC_Eg_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PMAC_EG_CFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_PMAC_EG_CFGGET,
+ 0);
+}
+
+GSW_return_t GSW_PMAC_EG_CfgGet(const GSW_Device_t *dev, GSW_PMAC_Eg_Cfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PMAC_EG_CFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_MAC_TableClear(const GSW_Device_t *dev)
+{
+ return gsw_api_wrap(dev,
+ GSW_MAC_TABLECLEAR,
+ NULL,
+ 0,
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_MAC_TableClearCond(const GSW_Device_t *dev, GSW_MAC_tableClearCond_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MAC_TABLECLEARCOND,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_MAC_TableEntryAdd(const GSW_Device_t *dev, GSW_MAC_tableAdd_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MAC_TABLEENTRYADD,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_MAC_TableEntryRead(const GSW_Device_t *dev, GSW_MAC_tableRead_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MAC_TABLEENTRYREAD,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_MAC_TableEntryQuery(const GSW_Device_t *dev, GSW_MAC_tableQuery_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MAC_TABLEENTRYQUERY,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_MAC_TableEntryRemove(const GSW_Device_t *dev, GSW_MAC_tableRemove_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MAC_TABLEENTRYREMOVE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_DefaultMacFilterSet(const GSW_Device_t *dev, GSW_MACFILTER_default_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MAC_DEFAULTFILTERSET,
+ parm,
+ sizeof(*parm),
+ GSW_MAC_DEFAULTFILTERGET,
+ 0);
+}
+
+GSW_return_t GSW_DefaultMacFilterGet(const GSW_Device_t *dev, GSW_MACFILTER_default_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MAC_DEFAULTFILTERGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+// #ifdef CONFIG_GSWIP_EVLAN
+GSW_return_t GSW_ExtendedVlanAlloc(const GSW_Device_t *dev, GSW_EXTENDEDVLAN_alloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_EXTENDEDVLAN_ALLOC,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_ExtendedVlanSet(const GSW_Device_t *dev, GSW_EXTENDEDVLAN_config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_EXTENDEDVLAN_SET,
+ parm,
+ sizeof(*parm),
+ GSW_EXTENDEDVLAN_GET,
+ 0);
+}
+
+GSW_return_t GSW_ExtendedVlanGet(const GSW_Device_t *dev, GSW_EXTENDEDVLAN_config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_EXTENDEDVLAN_GET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_ExtendedVlanFree(const GSW_Device_t *dev, GSW_EXTENDEDVLAN_alloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_EXTENDEDVLAN_FREE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_VlanFilterAlloc(const GSW_Device_t *dev, GSW_VLANFILTER_alloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLANFILTER_ALLOC,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_VlanFilterSet(const GSW_Device_t *dev, GSW_VLANFILTER_config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLANFILTER_SET,
+ parm,
+ sizeof(*parm),
+ GSW_VLANFILTER_GET,
+ 0);
+}
+
+GSW_return_t GSW_VlanFilterGet(const GSW_Device_t *dev, GSW_VLANFILTER_config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLANFILTER_GET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_VlanFilterFree(const GSW_Device_t *dev, GSW_VLANFILTER_alloc_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLANFILTER_FREE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_Vlan_RMONControl_Set(const GSW_Device_t *dev, GSW_VLAN_RMON_control_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLAN_RMON_CONTROL_SET,
+ parm,
+ sizeof(*parm),
+ GSW_VLAN_RMON_CONTROL_GET,
+ 0);
+}
+
+GSW_return_t GSW_Vlan_RMONControl_Get(const GSW_Device_t *dev, GSW_VLAN_RMON_control_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLAN_RMON_CONTROL_GET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_Vlan_RMON_Get(const GSW_Device_t *dev, GSW_VLAN_RMON_cnt_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLAN_RMON_GET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_Vlan_RMON_Clear(const GSW_Device_t *dev, GSW_VLAN_RMON_cnt_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLAN_RMON_CLEAR,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_VlanCounterMapSet(const GSW_Device_t *dev, GSW_VlanCounterMapping_config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLAN_COUNTER_MAPPING_SET,
+ parm,
+ sizeof(*parm),
+ GSW_VLAN_COUNTER_MAPPING_GET,
+ 0);
+}
+
+GSW_return_t GSW_VlanCounterMapGet(const GSW_Device_t *dev, GSW_VlanCounterMapping_config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_VLAN_COUNTER_MAPPING_GET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+// #endif /* CONFIG_GSWIP_EVLAN */
+
+GSW_return_t GSW_MulticastRouterPortAdd(const GSW_Device_t *dev, GSW_multicastRouter_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MULTICAST_ROUTERPORTADD,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_MulticastRouterPortRead(const GSW_Device_t *dev, GSW_multicastRouterRead_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MULTICAST_ROUTERPORTREAD,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_MulticastRouterPortRemove(const GSW_Device_t *dev, GSW_multicastRouter_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MULTICAST_ROUTERPORTREMOVE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_MulticastSnoopCfgGet(const GSW_Device_t *dev, GSW_multicastSnoopCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MULTICAST_SNOOPCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_MulticastSnoopCfgSet(const GSW_Device_t *dev, GSW_multicastSnoopCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MULTICAST_SNOOPCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_MULTICAST_SNOOPCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_MulticastTableEntryAdd(const GSW_Device_t *dev, GSW_multicastTable_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MULTICAST_TABLEENTRYADD,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_MulticastTableEntryRead(const GSW_Device_t *dev, GSW_multicastTableRead_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MULTICAST_TABLEENTRYREAD,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_MulticastTableEntryRemove(const GSW_Device_t *dev, GSW_multicastTable_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_MULTICAST_TABLEENTRYREMOVE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_TrunkingCfgGet(const GSW_Device_t *dev, GSW_trunkingCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_TRUNKING_CFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_TrunkingCfgSet(const GSW_Device_t *dev, GSW_trunkingCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_TRUNKING_CFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_TRUNKING_CFGGET,
+ 0);
+}
+
+GSW_return_t GSW_STP_PortCfgGet(const GSW_Device_t *dev, GSW_STP_portCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_STP_PORTCFGGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_STP_PortCfgSet(const GSW_Device_t *dev, GSW_STP_portCfg_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_STP_PORTCFGSET,
+ parm,
+ sizeof(*parm),
+ GSW_STP_PORTCFGGET,
+ 0);
+}
+
+GSW_return_t GSW_STP_BPDU_RuleGet(const GSW_Device_t *dev, GSW_STP_BPDU_Rule_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_STP_BPDU_RULEGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_STP_BPDU_RuleSet(const GSW_Device_t *dev, GSW_STP_BPDU_Rule_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_STP_BPDU_RULESET,
+ parm,
+ sizeof(*parm),
+ GSW_STP_BPDU_RULEGET,
+ 0);
+}
+
+GSW_return_t GSW_PBB_TunnelTempate_Alloc(const GSW_Device_t *dev, GSW_PBB_Tunnel_Template_Config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PBB_TEMPLATEALLOC,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
+
+GSW_return_t GSW_PBB_TunnelTempate_Free(const GSW_Device_t *dev, GSW_PBB_Tunnel_Template_Config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PBB_TEMPLATEFREE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+GSW_return_t GSW_PBB_TunnelTempate_Config_Set(const GSW_Device_t *dev, GSW_PBB_Tunnel_Template_Config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PBB_TEMPLATESET,
+ parm,
+ sizeof(*parm),
+ GSW_PBB_TEMPLATEGET,
+ 0);
+}
+
+GSW_return_t GSW_PBB_TunnelTempate_Config_Get(const GSW_Device_t *dev, GSW_PBB_Tunnel_Template_Config_t *parm)
+{
+ return gsw_api_wrap(dev,
+ GSW_PBB_TEMPLATEGET,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(*parm));
+}
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/gsw_cli_common.c b/feed/app/ethswbox/src/switch_hostapi/src/gsw_cli_common.c
new file mode 100644
index 0000000..f7aef23
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/gsw_cli_common.c
@@ -0,0 +1,436 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <host_adapt.h>
+#include <gsw_types.h>
+#include <gpy2xx.h>
+
+#include <gsw_cli_common.h>
+
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+#define ULONG_MAX_X 4294967295UL
+
+uint32_t convert_pmac_adr_str( char *pmac_adr_str, unsigned char *pmac_adr_ptr )
+{
+ char *str_ptr=pmac_adr_str;
+ char *endptr;
+ int i;
+ unsigned long int val;
+
+ if (strlen(pmac_adr_str) != (16+7))
+ {
+ printf("ERROR: Invalid length of pmac (xx:xx:xx:xx:xx:xx:xx:xx)!\n");
+ return 0;
+ }
+
+ for (i=0; i<8; i++)
+ {
+ val = strtoul(str_ptr, &endptr, 16);
+ if ((*endptr != 0) && (*endptr != ':') && (*endptr != '-'))
+ return 0;
+ *(pmac_adr_ptr+i)= (unsigned char) (val & 0xFF);
+ str_ptr = endptr+1;
+ }
+ return 1;
+}
+
+static int convert_ipv4_str(const char *ip_adr_str, uint32_t *ip_adr_ptr)
+{
+ struct in_addr dst;
+
+ if (!ip_adr_str || !ip_adr_ptr)
+ return 0;
+
+ if (inet_pton(AF_INET, ip_adr_str, &dst) <= 0)
+ return 0;
+
+ *ip_adr_ptr = ntohl(dst.s_addr);
+
+ return 1;
+}
+
+static int convert_ipv6_str(const char *ip_adr_str, unsigned short ip_adr_ptr[8])
+{
+ struct in6_addr dst;
+ size_t i;
+
+ if (!ip_adr_str || !ip_adr_ptr)
+ return 0;
+
+ if (inet_pton(AF_INET6, ip_adr_str, &dst) <= 0)
+ return 0;
+
+ for (i = 0; i < 8; i++)
+ ip_adr_ptr[i] = ntohs(dst.s6_addr16[i]);
+
+ return 1;
+}
+
+static int convert_pmapper_adr_str(char *pmap_adr_str, unsigned char *pmap_adr_ptr)
+{
+ char *str_ptr = pmap_adr_str;
+ char *endptr;
+ int i;
+ unsigned long int val;
+
+ for (i = 0; i < 73; i++) {
+ val = strtoul(str_ptr, &endptr, 10);
+
+ if ((*endptr != 0) && (*endptr != ',') && (*endptr != '-'))
+ return 0;
+
+ *(pmap_adr_ptr + i) = (unsigned char)(val & 0xFF);
+ str_ptr = endptr + 1;
+ }
+
+ return 1;
+}
+
+static char *findArgParam(int argc, char *argv[], char *name)
+{
+ int i;
+ size_t len;
+
+ len = strlen(name);
+
+ for (i = 0; i < argc; i++) {
+ if (strncasecmp(name, argv[i], len) == 0) {
+ if (strlen(argv[i]) > (len + 1)) {
+ if ('=' == argv[i][len]) {
+ return argv[i] + len + 1;
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
+int scanParamArg(int argc, char *argv[], char *name, size_t size, void *param)
+{
+ uint64_t tmp = 0;
+ char *endptr;
+ char *ptr = findArgParam(argc, argv, name);
+
+ if (ptr == NULL)
+ return 0;
+
+ /* check if the given parameter value are the boolean "TRUE" / "FALSE" */
+ if (0 == strncasecmp(ptr, "TRUE", strnlen(ptr, 6))) {
+ tmp = 1;
+ } else if (0 == strncasecmp(ptr, "FALSE", strnlen(ptr, 6))) {
+ tmp = 0;
+ } else {
+ /* scan for a number */
+ tmp = strtoull(ptr, &endptr, 0);
+
+ /* parameter detection does not work in case there are more character after the provided number */
+ if (*endptr != '\0')
+ return 0;
+ }
+
+ if (size == sizeof(uint16_t) || size == sizeof(uint16_t) * 8)
+ *((uint16_t *)param) = (uint16_t)tmp;
+ else if (size == sizeof(uint32_t) || size == sizeof(uint32_t) * 8)
+ *((uint32_t *)param) = (uint32_t)tmp;
+ else if (size == sizeof(uint64_t) || size == sizeof(uint64_t) * 8)
+ *((uint64_t *)param) = (uint64_t)tmp;
+ else
+ *((uint8_t *)param) = (uint8_t)tmp;
+
+ return 1;
+}
+
+static int convert_mac_adr_str(char *mac_adr_str, u8 *mac_adr_ptr)
+{
+ char *str_ptr = mac_adr_str;
+ char *endptr;
+ int i;
+ unsigned long int val;
+
+ if (strlen(mac_adr_str) != (12 + 5)) {
+ printf("ERROR: Invalid length of address string!\n");
+ return 0;
+ }
+
+ for (i = 0; i < 6; i++) {
+ val = strtoul(str_ptr, &endptr, 16);
+
+ if ((*endptr != 0) && (*endptr != ':') && (*endptr != '-'))
+ return 0;
+
+ *(mac_adr_ptr + i) = (u8)(val & 0xFF);
+ str_ptr = endptr + 1;
+ }
+
+ return 1;
+}
+
+static int copy_key_to_dst(char *key_adr_str, u8 size, char *key_adr_ptr)
+{
+ int i;
+ char buf[20];
+ char *pEnd = NULL;
+ char *in_key = (char *)key_adr_str;
+ uint32_t *out_key = (uint32_t *)key_adr_ptr;
+
+ if (strlen(key_adr_str) != (size_t)(size * 2)) {
+ printf("WARN: Len mismatch %ld != %ld!\n", strlen(in_key), (size_t)(size * 2));
+ }
+
+ for (i = 0; i < (size / 4); i++) {
+ pEnd = NULL;
+ snprintf(buf, sizeof(buf) / sizeof(buf[0]), "%c%c%c%c%c%c%c%c",
+ in_key[6], in_key[7], in_key[4], in_key[5],
+ in_key[2], in_key[3], in_key[0], in_key[1]);
+
+ out_key[i] = (strtoul(buf, &pEnd, 16) & 0xFFFFFFFFu);
+ in_key = in_key + 8;
+ //printf("\nConverted int %s, %x", buf, out_key[i]);
+ }
+
+ return 0;
+}
+
+void printHex32Value(char *name, uint32_t value, uint32_t bitmapIndicator)
+{
+ if (bitmapIndicator == 0) {
+ printf("\t%40s:\t%u", name, (uint32_t)value);
+
+ if (value > 9) {
+ /* Make an additional hex printout for larger values */
+ printf(" (0x%0x)", (uint32_t)value);
+ }
+ } else {
+ int i;
+ int bitset = 0;
+
+ if ((1 << (bitmapIndicator - 1)) & value) {
+
+ /* Make an additional hex printout for larger values */
+ uint32_t tmp = (1 << bitmapIndicator) - 1;
+
+ if (tmp == 0) tmp -= 1;
+
+ value = value & tmp;
+ printf("\t%40s:\t0x%0x (Bits: ", name, (uint32_t)value);
+
+ /* The highest data bit is set and is used as bitmap indicator, therefore
+ represent the data as bitmap as well. */
+ for (i = bitmapIndicator - 2; i >= 0; i--) {
+ if ((1 << i) & value) {
+ if (bitset) printf(",");
+
+ printf("%d", i);
+ bitset = 1;
+ }
+ }
+ }
+
+ printf(")");
+ }
+
+ printf("\n");
+}
+
+int findStringParam(int argc, char *argv[], char *name)
+{
+ int i;
+
+ /* search for all programm parameter for a command name */
+ for (i = 1; i < argc; i++) {
+ if (strncasecmp(argv[i], name, strlen(name)) == 0) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int scanMAC_Arg(int argc, char *argv[], char *name, unsigned char *param)
+{
+ char *ptr = findArgParam(argc, argv, name);
+
+ if (ptr == NULL) return 0;
+
+ return convert_mac_adr_str(ptr, param);
+}
+
+int scanIPv4_Arg(int argc, char *argv[], char *name, uint32_t *param)
+{
+ char *ptr = findArgParam(argc, argv, name);
+
+ if (ptr == NULL) return 0;
+
+ return convert_ipv4_str(ptr, param);
+}
+
+int scanIPv6_Arg(int argc, char *argv[], char *name, unsigned short *param)
+{
+ char *ptr = findArgParam(argc, argv, name);
+
+ if (ptr == NULL) return 0;
+
+ return convert_ipv6_str(ptr, param);
+}
+
+int scanPMAP_Arg(int argc, char *argv[], char *name, unsigned char *param)
+{
+ char *ptr = findArgParam(argc, argv, name);
+
+ if (ptr == NULL) return 0;
+
+ return convert_pmapper_adr_str(ptr, param);
+}
+
+int scanKey_Arg(int argc, char *argv[], char *name, unsigned char size, char *param)
+{
+ char *ptr = findArgParam(argc, argv, name);
+
+ if (ptr == NULL) return 0;
+
+ return copy_key_to_dst(ptr, size, param);
+}
+
+int scanPMAC_Arg(int argc, char *argv[], char *name, unsigned char *param)
+{
+ char *ptr = findArgParam(argc, argv, name);
+
+ if (ptr == NULL) return 0;
+
+ return convert_pmac_adr_str(ptr, param);
+}
+
+void printMAC_Address(unsigned char *pMAC)
+{
+ printf("%02x:%02x:%02x:%02x:%02x:%02x",
+ pMAC[0],
+ pMAC[1],
+ pMAC[2],
+ pMAC[3],
+ pMAC[4],
+ pMAC[5]);
+}
+
+int checkValidMAC_Address(unsigned char *pMAC)
+{
+ if ((pMAC[0] == 0) &&
+ (pMAC[1] == 0) &&
+ (pMAC[2] == 0) &&
+ (pMAC[3] == 0) &&
+ (pMAC[4] == 0) &&
+ (pMAC[5] == 0))
+ return (-1);
+
+ return 0;
+}
+
+static struct {
+ const char *name;
+ enum link_mode_bit_indices bit;
+} phy_advert[] = {
+ {"10baseT_Half", LINK_MODE_10baseT_Half_BIT},
+ {"10baseT_Full", LINK_MODE_10baseT_Full_BIT},
+ {"100baseT_Half", LINK_MODE_100baseT_Half_BIT},
+ {"100baseT_Full", LINK_MODE_100baseT_Full_BIT},
+ {"1000baseT_Half", LINK_MODE_1000baseT_Half_BIT},
+ {"1000baseT_Full", LINK_MODE_1000baseT_Full_BIT},
+ {"2500baseT_Full", LINK_MODE_2500baseT_Full_BIT},
+ {"2500baseT_FR", LINK_MODE_2500baseT_FR_BIT},
+ {"5000baseT_Full", LINK_MODE_5000baseT_Full_BIT},
+ {"5000baseT_FR", LINK_MODE_5000baseT_FR_BIT},
+ {"Autoneg", LINK_MODE_Autoneg_BIT},
+ {"Pause", LINK_MODE_Pause_BIT},
+ {"Asym_Pause", LINK_MODE_Asym_Pause_BIT},
+};
+
+int scan_advert(int argc, char *argv[], char *name, uint64_t *param)
+{
+ char *p, *p1, *p2;
+ uint8_t i;
+
+ p = findArgParam(argc, argv, name);
+
+ if (p == NULL)
+ return 0;
+
+ *param = 0;
+
+ for (p1 = p; *p1 != 0; p1 = p2) {
+ for (p2 = p1; *p2 != 0 && *p2 != ',' && *p2 != '|' && *p2 != ';'; p2++);
+
+ if (*p2 != 0) {
+ *p2 = 0;
+ p2++;
+ }
+
+ if (*p1 == 0)
+ continue;
+
+ for (i = 0; i < ARRAY_SIZE(phy_advert); i++) {
+ if (strncasecmp(p1, phy_advert[i].name, strlen(p)) == 0) {
+ *param |= (uint64_t)1 << phy_advert[i].bit;
+ break;
+ }
+ }
+ }
+
+ if (*param == 0)
+ *param = strtoull(p, NULL, 0);
+
+ return *param == 0 ? 0 : 1;
+}
+
+int print_advert(char *buf, uint32_t size, uint64_t param)
+{
+ char *p = buf;
+ uint32_t flag = 0;
+ uint32_t total_len = 0;
+ uint32_t len;
+ uint32_t i;
+
+ strncpy(buf, "none", size);
+ buf[size - 1] = 0;
+
+ for (i = 0; i < ARRAY_SIZE(phy_advert); i++) {
+ if ((param & ((uint64_t)1 << phy_advert[i].bit))) {
+ len = (uint32_t)strlen(phy_advert[i].name);
+
+ if (flag == 0) {
+ if (total_len + len + 1 >= size)
+ break;
+
+ flag++;
+ } else {
+ if (total_len + len + 4 >= size)
+ break;
+
+ p[0] = ' ';
+ p[1] = '|';
+ p[2] = ' ';
+ p += 3;
+ total_len += 3;
+ }
+
+ strcpy(p, phy_advert[i].name);
+ p += len;
+ total_len += len;
+ }
+ }
+
+ return (int)total_len;
+}
+
+
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_adapt.c b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt.c
new file mode 120000
index 0000000..3f49361
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt.c
@@ -0,0 +1 @@
+host_adapt_user.c
\ No newline at end of file
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_adapt.h b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt.h
new file mode 120000
index 0000000..67afb30
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt.h
@@ -0,0 +1 @@
+host_adapt_user.h
\ No newline at end of file
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_rpi4evk.c b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_rpi4evk.c
new file mode 100644
index 0000000..77faa20
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_rpi4evk.c
@@ -0,0 +1,253 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#include "host_adapt.h"
+
+#include <lif_api.h>
+#include <unistd.h>
+
+
+static void __usleep(unsigned long usec)
+{
+ /* TO be replaced with OS dependent implementation */
+ usleep(usec);
+}
+
+
+static pthread_mutex_t lock;
+
+static void __lock(void *lock_data)
+{
+ pthread_mutex_lock(lock_data);
+}
+
+static void __unlock(void *lock_data)
+{
+ pthread_mutex_unlock(lock_data);
+}
+
+
+typedef struct
+{
+ /** mdio clock pin with the following values
+ - (0) pin not valid
+ - (1) valid pin close
+ - (pin) valid open pin as clock pin */
+ uint8_t cpin;
+
+ /** mdio data pin with the following values
+ - (0) pin not valid
+ - (1) valid pin closed
+ - (pin) valid open pin as data pin */
+ uint8_t dpin;
+
+ /** Number of Phys Found */
+ uint8_t nr_phys;
+
+ /** Phy information in structure [Address, PHYID] */
+ uint32_t phy_info[PHY_MAX_VAL][2];
+
+
+ /** Phy information in structure [Address, PHYID] */
+ // void* gsw_struct;
+
+ GSW_Device_t gsw_struct[PHY_MAX_VAL];
+
+} link_struc;
+link_struc scanned_links[MAX_LINKS];
+
+struct phy_if {
+ uint8_t lif_id;
+
+};
+static struct phy_if phyif;
+
+static int mdiobus_read(void *mdiobus_data, uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg)
+{
+ const struct device *dev = mdiobus_data;
+ int ret;
+
+ if (phyaddr > 31 ||
+ mmd != GSW_MMD_DEV || reg > GSW_MMD_REG_DATA_LAST)
+ return -EINVAL;
+ ret = lif_mdio_c45_read(phyif.lif_id, phyaddr, mmd, reg);
+ return ret;
+}
+
+static int mdiobus_write(void *mdiobus_data, uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg, uint16_t val)
+{
+ const struct device *dev = mdiobus_data;
+
+ if ( phyaddr > 31 ||
+ mmd != GSW_MMD_DEV || reg > GSW_MMD_REG_DATA_LAST)
+ return -EINVAL;
+ return lif_mdio_c45_write(phyif.lif_id, phyaddr, mmd, reg, val);
+}
+
+
+static GSW_Device_t gsw_dev;
+
+
+/* TO be adapted with target dependent implementation */
+GSW_Device_t* gsw_adapt_init(uint8_t lif_id, uint8_t phy_id)
+{
+ memset(&gsw_dev, 0, sizeof(gsw_dev));
+
+ gsw_dev.usleep = __usleep;
+ gsw_dev.lock = __lock;
+ gsw_dev.unlock = __unlock;
+ gsw_dev.lock_data = &lock;
+ gsw_dev.mdiobus_read = mdiobus_read;
+ gsw_dev.mdiobus_write = mdiobus_write;
+ gsw_dev.mdiobus_data = NULL;
+ gsw_dev.phy_addr = (uint8_t)gsw_get_phy_addr(lif_id, phy_id);
+ return &gsw_dev;
+}
+
+
+/**
+ Implements the MDIO library (PyRPIO only) Scan procedure.
+
+
+ \param
+ char* lib, GPIO Interface library name
+
+ \return
+ nr_lif number of links found.
+*/
+int32_t api_gsw_get_links(char* lib)
+{
+ int32_t nr_lif = 0;
+ uint8_t lif_id,phy,max_phy;
+ lif_mdio_init(lib);
+ nr_lif = lif_scan(lib);
+
+
+ for (lif_id = 0; lif_id < nr_lif; lif_id++){
+ max_phy = (uint8_t)lif_get_nr_phys(lif_id);
+ scanned_links[lif_id].cpin = (uint8_t)lif_get_cpin(lif_id);
+ scanned_links[lif_id].dpin = (uint8_t)lif_get_dpin(lif_id);
+ scanned_links[lif_id].nr_phys = max_phy;
+
+
+ for (phy = 0; phy < max_phy; phy++){
+ scanned_links[lif_id].phy_info[phy][0]=lif_get_phy_addr(lif_id,phy);
+ scanned_links[lif_id].phy_info[phy][1]=lif_get_phy_id(lif_id,phy);
+ scanned_links[lif_id].gsw_struct[phy] = *(GSW_Device_t *)gsw_adapt_init(lif_id,phy);
+ }
+ }
+ return nr_lif;
+}
+
+
+int32_t gsw_get_cpin (uint8_t lif_id) {
+
+ return scanned_links[lif_id].cpin;
+}
+
+/**
+ Return Lif Data pin.
+
+ \param
+
+ uint8_t lif_id, Lif_Id index
+
+
+ \return
+ int32_t data pin
+*/
+int32_t gsw_get_dpin(uint8_t lif_id){
+
+ return scanned_links[lif_id].dpin;
+}
+int32_t gsw_update_lif_id(uint8_t lif_id){
+
+
+ phyif.lif_id = lif_id;
+
+}
+
+/**
+ Return Number of Phys per Lif.
+
+ \param
+
+ uint8_t lif_id, Lif_Id index
+
+
+ \return
+ int32_t Number of Phys
+*/
+int32_t gsw_get_nr_phys (uint8_t lif_id){
+
+ return scanned_links[lif_id].nr_phys;
+}
+
+/**
+ Return PHY ADDR based on LIF and Phy Index.
+ \param
+
+ uint8_t lif_id, Lif_Id index
+ uint8_t phy, Phy Index
+
+ \return
+ int32_t PHY ADDR
+*/
+
+int32_t gsw_get_phy_addr(uint8_t lif_id, uint8_t phy) {
+
+ return scanned_links[lif_id].phy_info[phy][0];
+}
+
+/**
+ Return PHY ID based on LIF and Phy Index.
+ \param
+
+ uint8_t lif_id, Lif_Id index
+ uint8_t phy, Phy Index
+
+ \return
+ int32_t PHY ID
+*/
+int32_t gsw_get_phy_id(uint8_t lif_id, uint8_t phy) {
+
+ return scanned_links[lif_id].phy_info[phy][1];
+}
+
+/**
+ Return gsw structure pointer based on LIf.
+ \param
+
+ uint8_t lif_id, Lif_Id index
+ uint8_t phy_id, phy_id index
+
+
+ \return
+ void* gsw_211 struc
+*/
+
+GSW_Device_t* gsw_get_struc(uint8_t lif_id,uint8_t phy_id){
+
+ gsw_update_lif_id(lif_id);
+ return &scanned_links[lif_id].gsw_struct[phy_id];
+}
+
+int gsw_read(const GSW_Device_t *dev, uint32_t regaddr)
+{
+ return dev->mdiobus_read(dev->mdiobus_data, dev->phy_addr, GSW_MMD_DEV,
+ regaddr);
+}
+
+int gsw_write(const GSW_Device_t *dev, uint32_t regaddr, uint16_t data)
+{
+ return dev->mdiobus_write(dev->mdiobus_data, dev->phy_addr, GSW_MMD_DEV,
+ regaddr, data);
+}
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_rpi4evk.h b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_rpi4evk.h
new file mode 100644
index 0000000..0339617
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_rpi4evk.h
@@ -0,0 +1,128 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _HOST_ADAPT_H_
+#define _HOST_ADAPT_H_
+
+
+/* endianess*/
+#undef CONFIG_LITTLE_ENDIAN /* big-endian */
+#define CONFIG_LITTLE_ENDIAN 1 /* little-endian */
+
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <pthread.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <string.h>
+
+#include "gsw_device.h"
+#include "mmd_apis.h"
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
+#define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
+
+#define GENMASK(h, l) \
+ (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+
+#undef BIT
+#define BIT(x) (1UL << (x))
+
+
+/* This is to enable optimization of host <-> F48X communication.
+ * It's based on a frequent use case that host get the configuration,
+ * modify a field, then set it back to F48X (get-modify-set).
+ * A set of shadow value has been saved for each GET API so that
+ * only changed values are sent to F48X from host in following SET API.
+ *
+ * Note:
+ * GET and following SET should be atomic. So, a mutex should be used
+ * in Multithread environment/application to ensure no other GSW API
+ * called between GET and SET.
+ * Otherwise, please change this option to 0 to avoid malfunction.
+ */
+#define ENABLE_GETSET_OPT 1
+
+
+
+#ifdef CONFIG_LITTLE_ENDIAN
+#define sys_le16_to_cpu(val) (val)
+#define sys_cpu_to_le16(val) (val)
+#define sys_le24_to_cpu(val) (val)
+#define sys_cpu_to_le24(val) (val)
+#define sys_le32_to_cpu(val) (val)
+#define sys_cpu_to_le32(val) (val)
+#define sys_le48_to_cpu(val) (val)
+#define sys_cpu_to_le48(val) (val)
+#define sys_le64_to_cpu(val) (val)
+#define sys_cpu_to_le64(val) (val)
+#define sys_be16_to_cpu(val) __bswap_16(val)
+#define sys_cpu_to_be16(val) __bswap_16(val)
+#define sys_be24_to_cpu(val) __bswap_24(val)
+#define sys_cpu_to_be24(val) __bswap_24(val)
+#define sys_be32_to_cpu(val) __bswap_32(val)
+#define sys_cpu_to_be32(val) __bswap_32(val)
+#define sys_be48_to_cpu(val) __bswap_48(val)
+#define sys_cpu_to_be48(val) __bswap_48(val)
+#define sys_be64_to_cpu(val) __bswap_64(val)
+#define sys_cpu_to_be64(val) __bswap_64(val)
+#else
+#define sys_le16_to_cpu(val) __bswap_16(val)
+#define sys_cpu_to_le16(val) __bswap_16(val)
+#define sys_le24_to_cpu(val) __bswap_24(val)
+#define sys_cpu_to_le24(val) __bswap_24(val)
+#define sys_le32_to_cpu(val) __bswap_32(val)
+#define sys_cpu_to_le32(val) __bswap_32(val)
+#define sys_le48_to_cpu(val) __bswap_48(val)
+#define sys_cpu_to_le48(val) __bswap_48(val)
+#define sys_le64_to_cpu(val) __bswap_64(val)
+#define sys_cpu_to_le64(val) __bswap_64(val)
+#define sys_be16_to_cpu(val) (val)
+#define sys_cpu_to_be16(val) (val)
+#define sys_be24_to_cpu(val) (val)
+#define sys_cpu_to_be24(val) (val)
+#define sys_be32_to_cpu(val) (val)
+#define sys_cpu_to_be32(val) (val)
+#define sys_be48_to_cpu(val) (val)
+#define sys_cpu_to_be48(val) (val)
+#define sys_be64_to_cpu(val) (val)
+#define sys_cpu_to_be64(val) (val)
+#endif
+
+/* Clause 45 MDIO read and write functions to customize */
+#ifndef CL45_MDIO_READ
+#define CL45_MDIO_READ(...) 0
+#endif
+
+#ifndef CL45_MDIO_WRITE
+#define CL45_MDIO_WRITE(...) 0
+#endif
+
+
+/*prototype global functions */
+int gsw_read(const GSW_Device_t *dev, uint32_t regaddr);
+int gsw_write(const GSW_Device_t *dev, uint32_t regaddr, uint16_t data);
+
+int32_t api_gsw_get_links(char* lib);
+int32_t gsw_get_cpin(uint8_t lif_id);
+int32_t gsw_get_dpin(uint8_t lif_id);
+int32_t gsw_update_lif_id(uint8_t lif_id);
+int32_t gsw_get_nr_phys(uint8_t lif_id);
+
+GSW_Device_t* gsw_get_struc(uint8_t lif_id,uint8_t phy_id);
+int32_t gsw_get_phy_addr(uint8_t lif_id, uint8_t phy);
+int32_t gsw_get_phy_id(uint8_t lif_id, uint8_t phy);
+
+
+#endif /* _HOST_ADAPT_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_user.c b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_user.c
new file mode 100644
index 0000000..ceb90a0
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_user.c
@@ -0,0 +1,100 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#include "host_adapt.h"
+#include "sys_switch_ioctl.h"
+
+#define SMDIO_ADDR 0x10
+
+static void __usleep(unsigned long usec)
+{
+ /* TO be replaced with OS dependent implementation */
+ usleep(usec);
+}
+
+static pthread_mutex_t lock;
+
+static void __lock(void *lock_data)
+{
+ pthread_mutex_lock(lock_data);
+}
+
+static void __unlock(void *lock_data)
+{
+ pthread_mutex_unlock(lock_data);
+}
+
+static int mdiobus_read(void *mdiobus_data, uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg)
+{
+ uint16_t val=0;
+ int ret;
+
+ if (phyaddr > 31 ||
+ mmd != GSW_MMD_DEV || reg > GSW_MMD_REG_DATA_LAST)
+ return -EINVAL;
+
+ ret = sys_cl45_mdio_read(phyaddr, mmd, reg, &val);
+ return ret < 0 ? ret : (int)val;
+}
+
+static int mdiobus_write(void *mdiobus_data, uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg, uint16_t val)
+{
+ if ( phyaddr > 31 ||
+ mmd != GSW_MMD_DEV || reg > GSW_MMD_REG_DATA_LAST)
+ return -EINVAL;
+
+ return sys_cl45_mdio_write(phyaddr, mmd, reg, val);
+}
+
+static GSW_Device_t gsw_dev = {0};
+
+
+/* TO be adapted with target dependent implementation */
+int gsw_adapt_init(void)
+{
+ gsw_dev.usleep = __usleep;
+
+ gsw_dev.lock = __lock;
+ gsw_dev.unlock = __unlock;
+ gsw_dev.lock_data = &lock;
+
+ gsw_dev.mdiobus_read = mdiobus_read;
+ gsw_dev.mdiobus_write = mdiobus_write;
+
+ gsw_dev.mdiobus_data = NULL;
+ gsw_dev.phy_addr = SMDIO_ADDR;
+
+ return 0;
+}
+
+int32_t api_gsw_get_links(char* lib)
+{
+ gsw_adapt_init();
+ switch_ioctl_init();
+ return 0;
+}
+
+GSW_Device_t* gsw_get_struc(uint8_t lif_id,uint8_t phy_id)
+{
+ return &gsw_dev;
+}
+
+int gsw_read(const GSW_Device_t *dev, uint32_t regaddr)
+{
+ return dev->mdiobus_read(dev->mdiobus_data, dev->phy_addr, GSW_MMD_DEV,
+ regaddr);
+}
+
+int gsw_write(const GSW_Device_t *dev, uint32_t regaddr, uint16_t data)
+{
+ return dev->mdiobus_write(dev->mdiobus_data, dev->phy_addr, GSW_MMD_DEV,
+ regaddr, data);
+}
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_user.h b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_user.h
new file mode 100644
index 0000000..fa1cb65
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_adapt_user.h
@@ -0,0 +1,120 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _HOST_ADAPT_H_
+#define _HOST_ADAPT_H_
+
+
+/* endianess*/
+#undef CONFIG_LITTLE_ENDIAN /* big-endian */
+#define CONFIG_LITTLE_ENDIAN 1 /* little-endian */
+
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <pthread.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <string.h>
+
+#include "gsw_device.h"
+#include "mmd_apis.h"
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
+#define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
+
+#define GENMASK(h, l) \
+ (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+
+#undef BIT
+#define BIT(x) (1UL << (x))
+
+
+/* This is to enable optimization of host <-> F48X communication.
+ * It's based on a frequent use case that host get the configuration,
+ * modify a field, then set it back to F48X (get-modify-set).
+ * A set of shadow value has been saved for each GET API so that
+ * only changed values are sent to F48X from host in following SET API.
+ *
+ * Note:
+ * GET and following SET should be atomic. So, a mutex should be used
+ * in Multithread environment/application to ensure no other GSW API
+ * called between GET and SET.
+ * Otherwise, please change this option to 0 to avoid malfunction.
+ */
+#define ENABLE_GETSET_OPT 1
+
+
+
+#ifdef CONFIG_LITTLE_ENDIAN
+#define sys_le16_to_cpu(val) (val)
+#define sys_cpu_to_le16(val) (val)
+#define sys_le24_to_cpu(val) (val)
+#define sys_cpu_to_le24(val) (val)
+#define sys_le32_to_cpu(val) (val)
+#define sys_cpu_to_le32(val) (val)
+#define sys_le48_to_cpu(val) (val)
+#define sys_cpu_to_le48(val) (val)
+#define sys_le64_to_cpu(val) (val)
+#define sys_cpu_to_le64(val) (val)
+#define sys_be16_to_cpu(val) __bswap_16(val)
+#define sys_cpu_to_be16(val) __bswap_16(val)
+#define sys_be24_to_cpu(val) __bswap_24(val)
+#define sys_cpu_to_be24(val) __bswap_24(val)
+#define sys_be32_to_cpu(val) __bswap_32(val)
+#define sys_cpu_to_be32(val) __bswap_32(val)
+#define sys_be48_to_cpu(val) __bswap_48(val)
+#define sys_cpu_to_be48(val) __bswap_48(val)
+#define sys_be64_to_cpu(val) __bswap_64(val)
+#define sys_cpu_to_be64(val) __bswap_64(val)
+#else
+#define sys_le16_to_cpu(val) __bswap_16(val)
+#define sys_cpu_to_le16(val) __bswap_16(val)
+#define sys_le24_to_cpu(val) __bswap_24(val)
+#define sys_cpu_to_le24(val) __bswap_24(val)
+#define sys_le32_to_cpu(val) __bswap_32(val)
+#define sys_cpu_to_le32(val) __bswap_32(val)
+#define sys_le48_to_cpu(val) __bswap_48(val)
+#define sys_cpu_to_le48(val) __bswap_48(val)
+#define sys_le64_to_cpu(val) __bswap_64(val)
+#define sys_cpu_to_le64(val) __bswap_64(val)
+#define sys_be16_to_cpu(val) (val)
+#define sys_cpu_to_be16(val) (val)
+#define sys_be24_to_cpu(val) (val)
+#define sys_cpu_to_be24(val) (val)
+#define sys_be32_to_cpu(val) (val)
+#define sys_cpu_to_be32(val) (val)
+#define sys_be48_to_cpu(val) (val)
+#define sys_cpu_to_be48(val) (val)
+#define sys_be64_to_cpu(val) (val)
+#define sys_cpu_to_be64(val) (val)
+#endif
+
+/* Clause 45 MDIO read and write functions to customize */
+#ifndef CL45_MDIO_READ
+#define CL45_MDIO_READ(...) 0
+#endif
+
+#ifndef CL45_MDIO_WRITE
+#define CL45_MDIO_WRITE(...) 0
+#endif
+
+
+/*prototype global functions */
+int32_t api_gsw_get_links(char* lib);
+int gsw_read(const GSW_Device_t *dev, uint32_t regaddr);
+int gsw_write(const GSW_Device_t *dev, uint32_t regaddr, uint16_t data);
+GSW_Device_t* gsw_get_struc(uint8_t lif_id,uint8_t phy_id);
+
+
+#endif /* _HOST_ADAPT_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_api_impl.c b/feed/app/ethswbox/src/switch_hostapi/src/host_api_impl.c
new file mode 100644
index 0000000..84a9bf5
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_api_impl.c
@@ -0,0 +1,377 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <assert.h>
+#include "host_adapt.h"
+
+#include "host_api_impl.h"
+
+
+#define CTRL_BUSY_MASK BIT(15)
+#define CTRL_CMD_MASK (BIT(15) - 1)
+
+#define MAX_BUSY_LOOP 1000 /* roughly 10ms */
+
+#define THR_RST_DATA 5
+
+#if defined(ENABLE_GETSET_OPT) && ENABLE_GETSET_OPT
+static struct {
+ uint16_t ctrl;
+ int16_t ret;
+ mmd_api_data_t data;
+} shadow = {
+ .ctrl = ~0,
+ .ret = -1,
+ .data = {{0}}
+};
+#endif
+
+static int __wait_ctrl_busy(const GSW_Device_t *dev)
+{
+ int ret, i;
+
+ for (i = 0; i < MAX_BUSY_LOOP; i++) {
+ ret = gsw_read(dev, GSW_MMD_REG_CTRL);
+ if (ret < 0)
+ return ret;
+
+ if (!(ret & CTRL_BUSY_MASK))
+ return 0;
+
+ dev->usleep(10);
+ }
+
+ return -ETIMEDOUT;
+}
+
+static int __gsw_rst_data(const GSW_Device_t *dev)
+{
+ int ret;
+
+ ret = gsw_write(dev, GSW_MMD_REG_LEN_RET, 0);
+ if (ret < 0)
+ return ret;
+
+ ret = gsw_write(dev, GSW_MMD_REG_CTRL,
+ MMD_API_RST_DATA | CTRL_BUSY_MASK);
+ if (ret < 0)
+ return ret;
+
+ return __wait_ctrl_busy(dev);
+}
+
+static int __gsw_set_data(const GSW_Device_t *dev, uint16_t words)
+{
+ int ret;
+ uint16_t cmd;
+
+ ret = gsw_write(dev, GSW_MMD_REG_LEN_RET,
+ GSW_MMD_REG_DATA_MAX_SIZE * sizeof(uint16_t));
+ if (ret < 0)
+ return ret;
+
+ cmd = words / GSW_MMD_REG_DATA_MAX_SIZE - 1;
+ assert(cmd < 2);
+ cmd += MMD_API_SET_DATA_0;
+ ret = gsw_write(dev, GSW_MMD_REG_CTRL,
+ cmd | CTRL_BUSY_MASK);
+ if (ret < 0)
+ return ret;
+
+ return __wait_ctrl_busy(dev);
+}
+
+static int __gsw_get_data(const GSW_Device_t *dev, uint16_t words)
+{
+ int ret;
+ uint16_t cmd;
+
+ ret = gsw_write(dev, GSW_MMD_REG_LEN_RET,
+ GSW_MMD_REG_DATA_MAX_SIZE * sizeof(uint16_t));
+ if (ret < 0)
+ return ret;
+
+ cmd = words / GSW_MMD_REG_DATA_MAX_SIZE;
+ assert(cmd > 0 && cmd < 3);
+ cmd += MMD_API_SET_DATA_0;
+ ret = gsw_write(dev, GSW_MMD_REG_CTRL,
+ cmd | CTRL_BUSY_MASK);
+ if (ret < 0)
+ return ret;
+
+ return __wait_ctrl_busy(dev);
+}
+
+static int __gsw_send_cmd(const GSW_Device_t *dev, uint16_t cmd, uint16_t size,
+ int16_t *presult)
+{
+ int ret;
+
+ ret = gsw_write(dev, GSW_MMD_REG_LEN_RET, size);
+ if (ret < 0)
+ return ret;
+
+ ret = gsw_write(dev, GSW_MMD_REG_CTRL,
+ cmd | CTRL_BUSY_MASK);
+ if (ret < 0)
+ return ret;
+
+ ret = __wait_ctrl_busy(dev);
+ if (ret < 0)
+ return ret;
+
+ ret = gsw_read(dev, GSW_MMD_REG_LEN_RET);
+ if (ret < 0)
+ return ret;
+
+ *presult = (int16_t)ret;
+ return 0;
+}
+
+static bool __gsw_cmd_r_valid(uint16_t cmd_r)
+{
+#if defined(ENABLE_GETSET_OPT) && ENABLE_GETSET_OPT
+ return (shadow.ctrl == cmd_r && shadow.ret >= 0) ? true : false;
+#else
+ return false;
+#endif
+}
+
+/* This is usually used to implement CFG_SET command.
+ * With previous CFG_GET command executed properly, the retrieved data
+ * are shadowed in local structure. WSP FW has a set of shadow too,
+ * so that only the difference to be sent over SMDIO.
+ */
+static int __gsw_api_wrap_cmd_r(const GSW_Device_t *dev, uint16_t cmd, void *pdata,
+ uint16_t size, uint16_t r_size)
+{
+#if defined(ENABLE_GETSET_OPT) && ENABLE_GETSET_OPT
+ int ret;
+
+ uint16_t max, i;
+ uint16_t *data;
+ int16_t result = 0;
+
+ max = (size + 1) / 2;
+ data = pdata;
+
+ ret = __wait_ctrl_busy(dev);
+ if (ret < 0)
+ return ret;
+
+ for (uint16_t i = 0; i < max; i++) {
+ uint16_t off = i % GSW_MMD_REG_DATA_MAX_SIZE;
+
+ if (i && off == 0) {
+ /* Send command to set data when every
+ * GSW_MMD_REG_DATA_MAX_SIZE of WORDs are written
+ * and reload next batch of data from last CFG_GET.
+ */
+ ret = __gsw_set_data(dev, i);
+ if (ret < 0)
+ return ret;
+ }
+
+ if (data[i] == shadow.data.data[i])
+ continue;
+
+ gsw_write(dev, GSW_MMD_REG_DATA_FIRST + off,
+ sys_le16_to_cpu(data[i]));
+ }
+
+ ret = __gsw_send_cmd(dev, cmd, size, &result);
+ if (ret < 0)
+ return ret;
+
+ if (result < 0)
+ return result;
+
+ max = (r_size + 1) / 2;
+ for (i = 0; i < max; i++) {
+ uint16_t off = i % GSW_MMD_REG_DATA_MAX_SIZE;
+
+ if (i && off == 0) {
+ /* Send command to fetch next batch of data
+ * when every GSW_MMD_REG_DATA_MAX_SIZE of WORDs
+ * are read.
+ */
+ ret = __gsw_get_data(dev, i);
+ if (ret < 0)
+ return ret;
+ }
+
+ ret = gsw_read(dev, GSW_MMD_REG_DATA_FIRST + off);
+ if (ret < 0)
+ return ret;
+
+ if ((i * 2 + 1) == r_size) {
+ /* Special handling for last BYTE
+ * if it's not WORD aligned.
+ */
+ *(uint8_t *)&data[i] = ret & 0xFF;
+ } else {
+ data[i] = sys_cpu_to_le16((uint16_t)ret);
+ }
+ }
+
+ shadow.data.data[max] = 0;
+ memcpy(shadow.data.data, data, r_size);
+
+ return result;
+#else /* defined(ENABLE_GETSET_OPT) && ENABLE_GETSET_OPT */
+ ARG_UNUSED(dev);
+ ARG_UNUSED(cmd);
+ ARG_UNUSED(pdata);
+ ARG_UNUSED(size);
+ return -ENOTSUP;
+#endif /* defined(ENABLE_GETSET_OPT) && ENABLE_GETSET_OPT */
+}
+
+int gsw_api_wrap(const GSW_Device_t *dev, uint16_t cmd, void *pdata,
+ uint16_t size, uint16_t cmd_r, uint16_t r_size)
+{
+ int ret;
+ uint16_t max, i, cnt;
+ uint16_t *data;
+ int16_t result = 0;
+
+ if (!dev || (!pdata && size))
+ return -EINVAL;
+
+ assert(size <= sizeof(mmd_api_data_t));
+ assert(r_size <= size);
+
+ dev->lock(dev->lock_data);
+
+ if (__gsw_cmd_r_valid(cmd_r)) {
+ /* Special handling for GET and SET command pair. */
+ ret = __gsw_api_wrap_cmd_r(dev, cmd, pdata, size, r_size);
+ goto EXIT;
+ }
+
+ max = (size + 1) / 2;
+ data = pdata;
+
+ /* Check whether it's worth to issue RST_DATA command. */
+ for (i = cnt = 0; i < max && cnt < THR_RST_DATA; i++) {
+ if (!data[i])
+ cnt++;
+ }
+
+ ret = __wait_ctrl_busy(dev);
+ if (ret < 0)
+ goto EXIT;
+
+ if (cnt >= THR_RST_DATA) {
+ /* Issue RST_DATA commdand. */
+ ret = __gsw_rst_data(dev);
+ if (ret < 0)
+ goto EXIT;
+
+ for (uint16_t i = 0, cnt = 0; i < max; i++) {
+ uint16_t off = i % GSW_MMD_REG_DATA_MAX_SIZE;
+
+ if (i && off == 0) {
+ uint16_t cnt_old = cnt;
+
+ cnt = 0;
+
+ /* No actual data was written. */
+ if (!cnt_old)
+ continue;
+
+ /* Send command to set data when every
+ * GSW_MMD_REG_DATA_MAX_SIZE of WORDs are written
+ * and clear the MMD registe space.
+ */
+ ret = __gsw_set_data(dev, i);
+ if (ret < 0)
+ goto EXIT;
+ }
+
+ /* Skip '0' data. */
+ if (!data[i])
+ continue;
+
+ gsw_write(dev, GSW_MMD_REG_DATA_FIRST + off,
+ sys_le16_to_cpu(data[i]));
+ cnt++;
+ }
+ } else {
+ for (i = 0; i < max; i++) {
+ uint16_t off = i % GSW_MMD_REG_DATA_MAX_SIZE;
+
+ if (i && off == 0) {
+ /* Send command to set data when every
+ * GSW_MMD_REG_DATA_MAX_SIZE of WORDs are written.
+ */
+ ret = __gsw_set_data(dev, i);
+ if (ret < 0)
+ goto EXIT;
+ }
+
+ gsw_write(dev, GSW_MMD_REG_DATA_FIRST + off,
+ sys_le16_to_cpu(data[i]));
+ }
+ }
+
+ ret = __gsw_send_cmd(dev, cmd, size, &result);
+ if (ret < 0)
+ goto EXIT;
+
+ if (result < 0) {
+ ret = result;
+ goto EXIT;
+ }
+
+ max = (r_size + 1) / 2;
+ for (i = 0; i < max; i++) {
+ uint16_t off = i % GSW_MMD_REG_DATA_MAX_SIZE;
+
+ if (i && off == 0) {
+ /* Send command to fetch next batch of data
+ * when every GSW_MMD_REG_DATA_MAX_SIZE of WORDs
+ * are read.
+ */
+ ret = __gsw_get_data(dev, i);
+ if (ret < 0)
+ goto EXIT;
+ }
+
+ ret = gsw_read(dev, GSW_MMD_REG_DATA_FIRST + off);
+ if (ret < 0)
+ goto EXIT;
+
+ if ((i * 2 + 1) == r_size) {
+ /* Special handling for last BYTE
+ * if it's not WORD aligned.
+ */
+ *(uint8_t *)&data[i] = ret & 0xFF;
+ } else {
+ data[i] = sys_cpu_to_le16((uint16_t)ret);
+ }
+ }
+
+#if defined(ENABLE_GETSET_OPT) && ENABLE_GETSET_OPT
+ shadow.data.data[max] = 0;
+ memcpy(shadow.data.data, data, r_size);
+#endif
+
+ ret = result;
+
+EXIT:
+#if defined(ENABLE_GETSET_OPT) && ENABLE_GETSET_OPT
+ shadow.ctrl = cmd;
+ shadow.ret = (int16_t)ret;
+#endif
+ dev->unlock(dev->lock_data);
+ return ret;
+}
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_api_impl.h b/feed/app/ethswbox/src/switch_hostapi/src/host_api_impl.h
new file mode 100644
index 0000000..495c2bb
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_api_impl.h
@@ -0,0 +1,16 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef _HOST_API_IMPL_H_
+#define _HOST_API_IMPL_H_
+
+extern int gsw_api_wrap(const GSW_Device_t *dev, uint16_t cmd, void *pdata,
+ uint16_t size, uint16_t cmd_r, uint16_t r_size);
+
+#endif /* _HOST_API_IMPL_H_ */
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb.c b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb.c
new file mode 120000
index 0000000..bc9b131
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb.c
@@ -0,0 +1 @@
+host_smdio_ssb_user.c
\ No newline at end of file
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb.h b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb.h
new file mode 120000
index 0000000..f278af1
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb.h
@@ -0,0 +1 @@
+host_smdio_ssb_user.h
\ No newline at end of file
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_rpi4evk.c b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_rpi4evk.c
new file mode 100644
index 0000000..cb937af
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_rpi4evk.c
@@ -0,0 +1,360 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#include "host_smdio_ssb.h"
+#include "host_adapt.h"
+
+#include "smdio_access.h"
+
+#include <unistd.h>
+#include <stdlib.h>
+
+#define SB_PDI_CTRL 0xE100
+#define SB_PDI_ADDR 0xE101
+#define SB_PDI_DATA 0xE102
+#define SB_PDI_STAT 0xE103
+
+#define SB1_ADDR 0x7800
+#define SB_PDI_CTRL_RD 0x01
+#define SB_PDI_CTRL_WR 0x02
+#define SB_PDI_RST 0x0
+
+#define FW_DL_MDIO_START_MAGIC 0xF48F
+#define FW_DL_MDIO_RDY_MAGIC 0xC55C
+#define RESCUE_IMAGE_HEADER_SIZE 20
+
+#define lif_id 0
+#define SMDIO_PHY_NR 8
+#define M_SLEEP(x) usleep((x)*1000)
+
+
+struct host_smdio_ssb_ops {
+ const GSW_Device_t *pdev;
+
+ int (*smdio_write)(const GSW_Device_t *pdev, uint16_t phy_reg, uint16_t phy_reg_data);
+ int (*smdio_cont_write)(const GSW_Device_t *pdev, uint16_t phy_reg, uint16_t phy_reg_data[8], uint8_t num);
+ int (*smdio_read)(const GSW_Device_t *pdev, uint16_t phy_reg);
+};
+
+static struct host_smdio_ssb_ops host_smdio_ops;
+static GSW_Device_t gsw_dev = {0};
+
+
+static int gsw_smdio_read(const GSW_Device_t *pdev, uint16_t phy_reg)
+{
+ return smdio_read(lif_id, ((GSW_Device_t *)(pdev))->phy_addr, phy_reg);
+}
+
+static int gsw_smdio_write(const GSW_Device_t *pdev, uint16_t phy_reg, uint16_t phy_reg_data)
+{
+ return smdio_write(lif_id, ((GSW_Device_t *)(pdev))->phy_addr, phy_reg, phy_reg_data);
+}
+
+static int gsw_smdio_cont_write(const GSW_Device_t *pdev, uint16_t phy_reg, uint16_t phy_reg_data[8], uint8_t num)
+{
+ return smdio_cont_write(lif_id, ((GSW_Device_t *)(pdev))->phy_addr, phy_reg, phy_reg_data, num);
+}
+
+
+/**
+ * Initialize smdio_ssb_ops operation
+ */
+#define slif_lib "bcm2835"
+void host_smdio_ssb_ops_init(const void *pdev)
+{
+ api_gsw_get_links(slif_lib);
+ pdev = gsw_get_struc(lif_id,0);
+
+ host_smdio_ops.pdev = pdev;
+ host_smdio_ops.smdio_read = gsw_smdio_read;
+ host_smdio_ops.smdio_write = gsw_smdio_write;
+ host_smdio_ops.smdio_cont_write = gsw_smdio_cont_write;
+}
+
+/**
+ * Uninitialize host_smdio_ssb_ops operation
+ */
+void host_smdio_ssb_ops_uninit()
+{
+ smdio_deinit();
+
+ host_smdio_ops.pdev = NULL;
+ host_smdio_ops.smdio_read = NULL;
+ host_smdio_ops.smdio_write = NULL;
+ host_smdio_ops.smdio_cont_write = NULL;
+
+}
+
+/**
+ * Reset SB PDI registers
+ */
+static void smdio_ssb_pdi_reset()
+{
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_RST);
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_ADDR, SB_PDI_RST);
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_DATA, SB_PDI_RST);
+}
+
+static bool smdio_ssb_wait_pdi_stat_is_expected(uint16_t exp_val, uint32_t timeout_ms)
+{
+ int loop = timeout_ms / 10;
+ uint16_t sb_pdi_stat;
+
+ while (loop > 0) {
+ sb_pdi_stat = host_smdio_ops.smdio_read(host_smdio_ops.pdev, SB_PDI_STAT);
+ if (sb_pdi_stat == exp_val)
+ return true;
+ M_SLEEP(10);
+ loop -= 1;
+ }
+ return false;
+}
+
+static int smdio_ssb_wait_pdi_stat_not_expected(uint16_t exp_val, uint16_t *ret_val, uint32_t timeout_ms)
+{
+ int loop = timeout_ms / 10;
+ uint16_t sb_pdi_stat ;
+
+ while (loop > 0) {
+ sb_pdi_stat = host_smdio_ops.smdio_read(host_smdio_ops.pdev, SB_PDI_STAT);
+ if (sb_pdi_stat != exp_val) {
+ *ret_val = sb_pdi_stat;
+ return 0;
+ }
+ M_SLEEP(10);
+ loop -= 1;
+ }
+ return -1;
+}
+
+/**
+ * Write image data to target which in rescue mode
+ * Image start with 4 bytes of image type
+ * followed by 4 bytes of image size and 4 bytes
+ * of checksum
+ *
+ * pdata - data pointer to be writen to SB
+ *
+ * return size of data writen to target if successful
+ */
+int host_smdio_ssb_rescue_download(uint8_t *pdata, uint32_t timeout_ms)
+{
+ uint32_t word_idx = 0;
+ uint32_t idx = 0;
+ uint16_t data_arr[8] = {0};
+ uint8_t num = 0;
+ uint16_t sb_pdi_stat = FW_DL_MDIO_START_MAGIC;
+ uint32_t image_type, image_size_1, image_checksum_1, image_size_2, image_checksum_2, data_size, full_image_size;
+ uint16_t *pimage_header;
+ int rc = 0;
+
+ if (!pdata) {
+ printf("Data can not be NULL\n");
+ return -EINVAL;
+ }
+
+ //Initialize SMDIO and SSB PDI
+ smdio_ssb_pdi_reset();
+
+ //Wait for target to be ready for download
+ if (smdio_ssb_wait_pdi_stat_is_expected(FW_DL_MDIO_RDY_MAGIC, timeout_ms)) {
+ printf("Target is ready for downloading.\n");
+ } else {
+ //if timeout, here we can not return timeout code, for compatibility, we still continue
+ ((GSW_Device_t *)(host_smdio_ops.pdev))->phy_addr = 0x1F;
+ }
+
+ //Send START signal to target which is rescue mode
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, sb_pdi_stat);
+
+ sb_pdi_stat += 1;
+ if (smdio_ssb_wait_pdi_stat_is_expected(sb_pdi_stat, timeout_ms)) {
+ printf("Received START ACK from target, starting...\n");
+ } else
+ return -ETIMEDOUT;
+
+ sb_pdi_stat = host_smdio_ops.smdio_read(host_smdio_ops.pdev, SB_PDI_STAT);
+
+ image_type = *(uint32_t *)pdata;
+ image_size_1 = *((uint32_t *)pdata + 1);
+ image_checksum_1 = *((uint32_t *)pdata + 2);
+ image_size_2 = *((uint32_t *)pdata + 3);
+ image_checksum_2 = *((uint32_t *)pdata + 4);
+ printf("image type: %x, size 1: %x, checksum 1: %x, size 2: %x, checksum 2: %x\n", image_type, image_size_1, image_checksum_1, image_size_2, image_checksum_2);
+
+ // send image header (20 bytes)
+ pimage_header = (uint16_t *)pdata;
+ //Trigger write
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_CTRL_WR);
+ host_smdio_ops.smdio_cont_write(host_smdio_ops.pdev, SB_PDI_DATA, pimage_header, 8);
+ host_smdio_ops.smdio_cont_write(host_smdio_ops.pdev, SB_PDI_DATA, pimage_header + 8, 2);
+ smdio_ssb_pdi_reset();
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, RESCUE_IMAGE_HEADER_SIZE);
+
+ sb_pdi_stat = RESCUE_IMAGE_HEADER_SIZE + 1;
+ if (smdio_ssb_wait_pdi_stat_is_expected(sb_pdi_stat, timeout_ms)) {
+ printf("Received ACK of image header from target\n");
+ } else
+ return -ETIMEDOUT;
+
+ pdata += RESCUE_IMAGE_HEADER_SIZE; // skip image headers
+ data_size = 0;
+ full_image_size = image_size_1 + image_size_2;
+
+ printf("Erase flash\n");
+ fflush(stdout);
+
+ if (smdio_ssb_wait_pdi_stat_is_expected(0, timeout_ms)) {
+
+ printf("Program flash\n");
+ fflush(stdout);
+
+ //Trigger write
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_CTRL_WR);
+ while (idx < full_image_size) {
+ num = 0;
+ do {
+ //16 bits data
+ uint16_t fdata = 0x0;
+ if (idx + 1 < full_image_size) {
+ fdata = ((pdata[idx + 1]) << 8) | pdata[idx];
+ idx += 2;
+ data_size += 2;
+ } else if (idx < full_image_size) { // last byte of data, padding high 8bits with 0s
+ fdata |= pdata[idx];
+ idx++;
+ data_size++;
+ } else { // no more data
+ break;
+ }
+ data_arr[num] = fdata;
+ num++;
+ } while (num < 8);
+ host_smdio_ops.smdio_cont_write(host_smdio_ops.pdev, SB_PDI_DATA, data_arr, num);
+
+ word_idx += num;
+ // check download is completed?
+ if (idx >= full_image_size) {
+ // Send data size to target MCUBoot
+ smdio_ssb_pdi_reset();
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, data_size); // last batch data
+ break;
+ }
+
+ if (word_idx == 16384) { // 32KB is done, need to set SB PDI addr to 0x7800
+ printf(".");
+ fflush(stdout);
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_RST);
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_ADDR, SB1_ADDR);
+ // Continue to write SB1 32KB
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_CTRL_WR);
+ } else if (word_idx == 32760) { // One slice is done: 32768 - 8 Word
+ smdio_ssb_pdi_reset();
+ printf(".");
+ fflush(stdout);
+
+ // Send data size to target MCUBoot
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, data_size); //64KB - 16B
+ word_idx = 0;
+ data_size = 0;
+ // Paused here to wait for target MCUBoot to program flash, and then continue
+ if (smdio_ssb_wait_pdi_stat_is_expected(0, timeout_ms)) {
+ //Trigger write
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_CTRL_WR);
+ } else
+ return -ETIMEDOUT;
+ }
+ }
+ } else
+ return -ETIMEDOUT;
+
+ rc = smdio_ssb_wait_pdi_stat_not_expected(data_size, &sb_pdi_stat, timeout_ms);
+ /* write to avoid slave hang */
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, 0x3CC3);
+ if (rc == 0 && sb_pdi_stat == 0) {
+ printf("\nsuccessfully download firmware to target\n");
+ return idx;
+ } else {
+ printf("\nfailed download firmware to target\n");
+ return rc;
+ }
+}
+
+int ssb_load(char *fw_path)
+{
+ int ret,i;
+ FILE *fwin;
+ int filesize;
+ uint8_t *pDataBuf;
+
+ host_smdio_ssb_ops_init(&gsw_dev);
+
+ fwin = fopen(fw_path, "rb");
+ if (fwin == NULL) {
+ printf("Failed to open FW file \"%s\".\n", fw_path);
+ return -errno;
+ }
+ fseek(fwin, 0L, SEEK_END);
+ filesize = ftell(fwin);
+ printf("FW size: %d bytes\n", filesize);
+ rewind(fwin);
+
+ pDataBuf = (uint8_t*)malloc(filesize);
+ ret = fread(pDataBuf, 1, filesize, fwin);
+ if (ret != filesize)
+ {
+ free(pDataBuf);
+ ret = fclose(fwin);
+ return -errno;
+ }
+ fclose(fwin);
+
+ ret = host_smdio_ssb_rescue_download((uint8_t *) pDataBuf, 70 * 1000);
+ free(pDataBuf);
+ if ((ret + RESCUE_IMAGE_HEADER_SIZE) != filesize)
+ {
+ printf("FW Upload Failed - FW Write Failed\n");
+ return -errno;
+ }
+
+ //Wait for PHY to start
+ sleep(5);
+ ret = check_registers();
+ if (ret != 0)
+ {
+ printf("FW Upload Failed - Register Read Failed\n");
+ return -errno;
+ }
+
+ printf("FW Upload Sucessful\n");
+ return 0;
+}
+
+/**
+ * Check ID and FW registers after FW Download
+ */
+int check_registers()
+{
+ int ret,i;
+ struct mdio_relay_data param = {0};
+
+ for ( i = 0; i < SMDIO_PHY_NR; i++ )
+ {
+ param.phy = (uint8_t)i;
+ param.mmd = (uint8_t)0x0;
+ param.reg = (uint16_t)0x3;
+ if ( (ret=int_gphy_read(host_smdio_ops.pdev, ¶m) != 0) || (param.data == 0xffff) )
+ return -1;
+
+ param.reg = (uint16_t)0x1e;
+ if ( (ret=int_gphy_read(host_smdio_ops.pdev, ¶m) != 0) || (param.data == 0xffff) )
+ return -1;
+ }
+ return 0;
+}
\ No newline at end of file
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_rpi4evk.h b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_rpi4evk.h
new file mode 100644
index 0000000..5022ba4
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_rpi4evk.h
@@ -0,0 +1,57 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef __HOST_SMDIO_SSB_H__
+#define __HOST_SMDIO_SSB_H__
+#include <stdint.h>
+
+/**
+ * Initialize host_smdio_ssb_ops operation
+ */
+void host_smdio_ssb_ops_init(const void *pdev);
+
+/**
+ * Uninitialize host_smdio_ssb_ops operation
+ */
+void host_smdio_ssb_ops_uninit();
+
+/**
+ * Write image data to target which in rescue mode
+ * Image start with 4 bytes of image type
+ * followed by 4 bytes of image size and 4 bytes
+ * of checksum
+ *
+ * pdata - data pointer to be writen to SB
+ *
+ * return size of data writen to target if successful
+ */
+int host_smdio_ssb_rescue_download(uint8_t *pdata, uint32_t timeout_ms);
+
+/**
+ * Read FW file
+ */
+int ssb_load(char* fw_path);
+
+
+/**
+ * Check Register Status
+ */
+int check_registers();
+
+
+/* Clause 22 MDIO read and write functions to customize */
+#ifndef CL22_MDIO_READ
+#define CL22_MDIO_READ(...) 0
+#endif
+
+#ifndef CL22_MDIO_WRITE
+#define CL22_MDIO_WRITE(...) 0
+#endif
+
+#endif
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_user.c b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_user.c
new file mode 100644
index 0000000..6650fc3
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_user.c
@@ -0,0 +1,388 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#include "host_smdio_ssb.h"
+#include "host_adapt.h"
+
+#include <unistd.h>
+#include <stdlib.h>
+
+#define SB_PDI_CTRL 0xE100
+#define SB_PDI_ADDR 0xE101
+#define SB_PDI_DATA 0xE102
+#define SB_PDI_STAT 0xE103
+
+#define SB1_ADDR 0x7800
+#define SB_PDI_CTRL_RD 0x01
+#define SB_PDI_CTRL_WR 0x02
+#define SB_PDI_RST 0x0
+
+#define FW_DL_MDIO_START_MAGIC 0xF48F
+#define FW_DL_MDIO_RDY_MAGIC 0xC55C
+#define RESCUE_IMAGE_HEADER_SIZE 20
+
+#define SMIDO_SB_PHY_ADDR_REG 0x1F
+#define SMIDO_SB_PHY_DATA_REG 0x0
+
+#define lif_id 0
+#define SMDIO_PHY_NR 8
+#define M_SLEEP(x) usleep((x)*1000)
+
+struct host_smdio_ssb_ops {
+ const GSW_Device_t *pdev;
+
+ int (*smdio_write)(const GSW_Device_t *pdev, uint16_t phy_reg, uint16_t phy_reg_data);
+ int (*smdio_cont_write)(const GSW_Device_t *pdev, uint16_t phy_reg, uint16_t phy_reg_data[8], uint8_t num);
+ int (*smdio_read)(const GSW_Device_t *pdev, uint16_t phy_reg);
+};
+
+static struct host_smdio_ssb_ops host_smdio_ops;
+static GSW_Device_t gsw_dev = {0};
+
+static int gsw_smdio_read(const GSW_Device_t *pdev, uint16_t phy_reg)
+{
+ uint16_t val=0;
+ int ret;
+
+ ret = sys_cl22_mdio_write(((GSW_Device_t *)pdev)->phy_addr, SMIDO_SB_PHY_ADDR_REG, phy_reg);
+
+ if (ret == 0) {
+ ret = sys_cl22_mdio_read(((GSW_Device_t *)pdev)->phy_addr, SMIDO_SB_PHY_DATA_REG, &val);
+ }
+
+ return ret < 0 ? ret : (int)val;
+}
+
+static int gsw_smdio_write(const GSW_Device_t *pdev, uint16_t phy_reg, uint16_t phy_reg_data)
+{
+ int ret = 0;
+
+ ret = sys_cl22_mdio_write(((GSW_Device_t *)pdev)->phy_addr, SMIDO_SB_PHY_ADDR_REG, phy_reg);
+ if (ret == 0) {
+ ret = sys_cl22_mdio_write(((GSW_Device_t *)pdev)->phy_addr, SMIDO_SB_PHY_DATA_REG, phy_reg_data);
+ }
+
+ return ret;
+}
+
+static int gsw_smdio_cont_write(const GSW_Device_t *pdev, uint16_t phy_reg, uint16_t phy_reg_data[8], uint8_t num)
+{
+ int ret = 0;
+
+ ret = sys_cl22_mdio_write(((GSW_Device_t *)pdev)->phy_addr, SMIDO_SB_PHY_ADDR_REG, phy_reg);
+ if (ret == 0) {
+ for (uint8_t i = 0; i < (num & 0xF); i++) {
+ ret |= sys_cl22_mdio_write(((GSW_Device_t *)pdev)->phy_addr, SMIDO_SB_PHY_DATA_REG, phy_reg_data[i]);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * Initialize smdio_ssb_ops operation
+ */
+void host_smdio_ssb_ops_init(const void *pdev)
+{
+ char* slib ="";
+
+ api_gsw_get_links(slib);
+ pdev = gsw_get_struc(lif_id,0);
+
+ host_smdio_ops.pdev = pdev;
+ host_smdio_ops.smdio_read = gsw_smdio_read;
+ host_smdio_ops.smdio_write = gsw_smdio_write;
+ host_smdio_ops.smdio_cont_write = gsw_smdio_cont_write;
+}
+
+/**
+ * Uninitialize host_smdio_ssb_ops operation
+ */
+void host_smdio_ssb_ops_uninit()
+{
+ host_smdio_ops.pdev = NULL;
+ host_smdio_ops.smdio_read = NULL;
+ host_smdio_ops.smdio_write = NULL;
+ host_smdio_ops.smdio_cont_write = NULL;
+
+}
+
+/**
+ * Reset SB PDI registers
+ */
+static void smdio_ssb_pdi_reset()
+{
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_RST);
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_ADDR, SB_PDI_RST);
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_DATA, SB_PDI_RST);
+}
+
+static bool smdio_ssb_wait_pdi_stat_is_expected(uint16_t exp_val, uint32_t timeout_ms)
+{
+ int loop = timeout_ms / 10;
+ uint16_t sb_pdi_stat;
+
+ while (loop > 0) {
+ sb_pdi_stat = host_smdio_ops.smdio_read(host_smdio_ops.pdev, SB_PDI_STAT);
+ if (sb_pdi_stat == exp_val)
+ return true;
+ M_SLEEP(10);
+ loop -= 1;
+ }
+ return false;
+}
+
+static int smdio_ssb_wait_pdi_stat_not_expected(uint16_t exp_val, uint16_t *ret_val, uint32_t timeout_ms)
+{
+ int loop = timeout_ms / 10;
+ uint16_t sb_pdi_stat ;
+
+ while (loop > 0) {
+ sb_pdi_stat = host_smdio_ops.smdio_read(host_smdio_ops.pdev, SB_PDI_STAT);
+ if (sb_pdi_stat != exp_val) {
+ *ret_val = sb_pdi_stat;
+ return 0;
+ }
+ M_SLEEP(10);
+ loop -= 1;
+ }
+ return -1;
+}
+
+/**
+ * Write image data to target which in rescue mode
+ * Image start with 4 bytes of image type
+ * followed by 4 bytes of image size and 4 bytes
+ * of checksum
+ *
+ * pdata - data pointer to be writen to SB
+ *
+ * return size of data writen to target if successful
+ */
+int host_smdio_ssb_rescue_download(uint8_t *pdata, uint32_t timeout_ms)
+{
+ uint32_t word_idx = 0;
+ uint32_t idx = 0;
+ uint16_t data_arr[8] = {0};
+ uint8_t num = 0;
+ uint16_t sb_pdi_stat = FW_DL_MDIO_START_MAGIC;
+ uint32_t image_type, image_size_1, image_checksum_1, image_size_2, image_checksum_2, data_size, full_image_size;
+ uint16_t *pimage_header;
+ int rc = 0;
+
+ if (!pdata) {
+ printf("Data can not be NULL\n");
+ return -EINVAL;
+ }
+
+ //Initialize SMDIO and SSB PDI
+ smdio_ssb_pdi_reset();
+
+ //Wait for target to be ready for download
+ if (smdio_ssb_wait_pdi_stat_is_expected(FW_DL_MDIO_RDY_MAGIC, timeout_ms)) {
+ printf("Target is ready for downloading.\n");
+ } else {
+ //if timeout, here we can not return timeout code, for compatibility, we still continue
+ ((GSW_Device_t *)(host_smdio_ops.pdev))->phy_addr = 0x1F;
+ }
+
+ //Send START signal to target which is rescue mode
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, sb_pdi_stat);
+
+ sb_pdi_stat += 1;
+ if (smdio_ssb_wait_pdi_stat_is_expected(sb_pdi_stat, timeout_ms)) {
+ printf("Received START ACK from target, starting...\n");
+ } else
+ return -ETIMEDOUT;
+
+ sb_pdi_stat = host_smdio_ops.smdio_read(host_smdio_ops.pdev, SB_PDI_STAT);
+
+ image_type = *(uint32_t *)pdata;
+ image_size_1 = *((uint32_t *)pdata + 1);
+ image_checksum_1 = *((uint32_t *)pdata + 2);
+ image_size_2 = *((uint32_t *)pdata + 3);
+ image_checksum_2 = *((uint32_t *)pdata + 4);
+ printf("image type: %x, size 1: %x, checksum 1: %x, size 2: %x, checksum 2: %x\n", image_type, image_size_1, image_checksum_1, image_size_2, image_checksum_2);
+
+ // send image header (20 bytes)
+ pimage_header = (uint16_t *)pdata;
+ //Trigger write
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_CTRL_WR);
+ host_smdio_ops.smdio_cont_write(host_smdio_ops.pdev, SB_PDI_DATA, pimage_header, 8);
+ host_smdio_ops.smdio_cont_write(host_smdio_ops.pdev, SB_PDI_DATA, pimage_header + 8, 2);
+ smdio_ssb_pdi_reset();
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, RESCUE_IMAGE_HEADER_SIZE);
+
+ sb_pdi_stat = RESCUE_IMAGE_HEADER_SIZE + 1;
+ if (smdio_ssb_wait_pdi_stat_is_expected(sb_pdi_stat, timeout_ms)) {
+ printf("Received ACK of image header from target\n");
+ } else
+ return -ETIMEDOUT;
+
+ pdata += RESCUE_IMAGE_HEADER_SIZE; // skip image headers
+ data_size = 0;
+ full_image_size = image_size_1 + image_size_2;
+
+ printf("Erase flash\n");
+ fflush(stdout);
+
+ if (smdio_ssb_wait_pdi_stat_is_expected(0, timeout_ms)) {
+
+ printf("Program flash\n");
+ fflush(stdout);
+
+ //Trigger write
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_CTRL_WR);
+ while (idx < full_image_size) {
+ num = 0;
+ do {
+ //16 bits data
+ uint16_t fdata = 0x0;
+ if (idx + 1 < full_image_size) {
+ fdata = ((pdata[idx + 1]) << 8) | pdata[idx];
+ idx += 2;
+ data_size += 2;
+ } else if (idx < full_image_size) { // last byte of data, padding high 8bits with 0s
+ fdata |= (uint16_t)pdata[idx];
+ idx++;
+ data_size++;
+ } else { // no more data
+ break;
+ }
+ data_arr[num] = fdata;
+ num++;
+ } while (num < 8);
+ host_smdio_ops.smdio_cont_write(host_smdio_ops.pdev, SB_PDI_DATA, data_arr, num);
+
+ word_idx += num;
+ // check download is completed?
+ if (idx >= full_image_size) {
+ // Send data size to target MCUBoot
+ smdio_ssb_pdi_reset();
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, data_size); // last batch data
+ break;
+ }
+
+ if (word_idx == 16384) { // 32KB is done, need to set SB PDI addr to 0x7800
+ printf(".");
+ fflush(stdout);
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_RST);
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_ADDR, SB1_ADDR);
+ // Continue to write SB1 32KB
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_CTRL_WR);
+ } else if (word_idx == 32760) { // One slice is done: 32768 - 8 Word
+ smdio_ssb_pdi_reset();
+ printf(".");
+ fflush(stdout);
+
+ // Send data size to target MCUBoot
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, data_size); //64KB - 16B
+ word_idx = 0;
+ data_size = 0;
+ // Paused here to wait for target MCUBoot to program flash, and then continue
+ if (smdio_ssb_wait_pdi_stat_is_expected(0, timeout_ms)) {
+ //Trigger write
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_CTRL, SB_PDI_CTRL_WR);
+ } else
+ return -ETIMEDOUT;
+ }
+ }
+ } else
+ return -ETIMEDOUT;
+
+ rc = smdio_ssb_wait_pdi_stat_not_expected(data_size, &sb_pdi_stat, timeout_ms);
+ /* write to avoid slave hang */
+ host_smdio_ops.smdio_write(host_smdio_ops.pdev, SB_PDI_STAT, 0x3CC3);
+ if (rc == 0 && sb_pdi_stat == 0) {
+ printf("\nsuccessfully download firmware to target\n");
+ return idx;
+ } else {
+ printf("\nfailed download firmware to target\n");
+ return rc;
+ }
+}
+
+int ssb_load(char *fw_path)
+{
+ int ret,i;
+ FILE *fwin;
+ int filesize;
+ uint8_t *pDataBuf;
+
+ host_smdio_ssb_ops_init(&gsw_dev);
+
+ fwin = fopen(fw_path, "rb");
+ if (fwin == NULL) {
+ printf("Failed to open FW file \"%s\".\n", fw_path);
+ return -errno;
+ }
+ fseek(fwin, 0L, SEEK_END);
+ filesize = ftell(fwin);
+ printf("FW size: %d bytes\n", filesize);
+ rewind(fwin);
+
+ pDataBuf = (uint8_t*)malloc(filesize);
+ if (pDataBuf == NULL) {
+ printf("malloc: Unable to allocate memory.\n");
+ ret = fclose(fwin);
+ return -errno;
+ }
+
+ ret = fread(pDataBuf, 1, filesize, fwin);
+ if (ret != filesize)
+ {
+ free(pDataBuf);
+ ret = fclose(fwin);
+ return -errno;
+ }
+ fclose(fwin);
+
+ ret = host_smdio_ssb_rescue_download((uint8_t *) pDataBuf, 70 * 1000);
+ free(pDataBuf);
+ if ((ret + RESCUE_IMAGE_HEADER_SIZE) != filesize)
+ {
+ printf("FW Upload Failed - FW Write Failed\n");
+ return -errno;
+ }
+
+ //Wait for PHY to start
+ sleep(5);
+ ret = check_registers();
+ if (ret != 0)
+ {
+ printf("FW Upload Failed - Register Read Failed\n");
+ return -errno;
+ }
+
+ printf("FW Upload Sucessful\n");
+ return 0;
+}
+
+/**
+ * Check ID and FW registers after FW Download
+ */
+int check_registers()
+{
+ int ret,i;
+ struct mdio_relay_data param = {0};
+
+ for ( i = 0; i < SMDIO_PHY_NR; i++ )
+ {
+ param.phy = (uint8_t)i;
+ param.mmd = (uint8_t)0x0;
+ param.reg = (uint16_t)0x3;
+ if ( (ret=int_gphy_read(host_smdio_ops.pdev, ¶m) != 0) || (param.data == 0xffff) )
+ return -1;
+
+ param.reg = (uint16_t)0x1e;
+ if ( (ret=int_gphy_read(host_smdio_ops.pdev, ¶m) != 0) || (param.data == 0xffff) )
+ return -1;
+ }
+ return 0;
+}
\ No newline at end of file
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_user.h b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_user.h
new file mode 100644
index 0000000..5022ba4
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/host_smdio_ssb_user.h
@@ -0,0 +1,57 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#ifndef __HOST_SMDIO_SSB_H__
+#define __HOST_SMDIO_SSB_H__
+#include <stdint.h>
+
+/**
+ * Initialize host_smdio_ssb_ops operation
+ */
+void host_smdio_ssb_ops_init(const void *pdev);
+
+/**
+ * Uninitialize host_smdio_ssb_ops operation
+ */
+void host_smdio_ssb_ops_uninit();
+
+/**
+ * Write image data to target which in rescue mode
+ * Image start with 4 bytes of image type
+ * followed by 4 bytes of image size and 4 bytes
+ * of checksum
+ *
+ * pdata - data pointer to be writen to SB
+ *
+ * return size of data writen to target if successful
+ */
+int host_smdio_ssb_rescue_download(uint8_t *pdata, uint32_t timeout_ms);
+
+/**
+ * Read FW file
+ */
+int ssb_load(char* fw_path);
+
+
+/**
+ * Check Register Status
+ */
+int check_registers();
+
+
+/* Clause 22 MDIO read and write functions to customize */
+#ifndef CL22_MDIO_READ
+#define CL22_MDIO_READ(...) 0
+#endif
+
+#ifndef CL22_MDIO_WRITE
+#define CL22_MDIO_WRITE(...) 0
+#endif
+
+#endif
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/mdio_relay.c b/feed/app/ethswbox/src/switch_hostapi/src/mdio_relay.c
new file mode 100644
index 0000000..65c71b6
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/mdio_relay.c
@@ -0,0 +1,72 @@
+/******************************************************************************
+
+ Copyright 2023 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#include "host_adapt.h"
+#include "host_api_impl.h"
+#include "mdio_relay.h"
+
+int int_gphy_read(const GSW_Device_t *dev, struct mdio_relay_data *parm)
+{
+ return gsw_api_wrap(dev,
+ INT_GPHY_READ,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(parm->data));
+}
+
+int int_gphy_write(const GSW_Device_t *dev, struct mdio_relay_data *parm)
+{
+ return gsw_api_wrap(dev,
+ INT_GPHY_WRITE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+int int_gphy_mod(const GSW_Device_t *dev, struct mdio_relay_mod_data *parm)
+{
+ return gsw_api_wrap(dev,
+ INT_GPHY_MOD,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+int ext_mdio_read(const GSW_Device_t *dev, struct mdio_relay_data *parm)
+{
+ return gsw_api_wrap(dev,
+ EXT_MDIO_READ,
+ parm,
+ sizeof(*parm),
+ 0,
+ sizeof(parm->data));
+}
+
+int ext_mdio_write(const GSW_Device_t *dev, struct mdio_relay_data *parm)
+{
+ return gsw_api_wrap(dev,
+ EXT_MDIO_WRITE,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
+
+int ext_mdio_mod(const GSW_Device_t *dev, struct mdio_relay_mod_data *parm)
+{
+ return gsw_api_wrap(dev,
+ EXT_MDIO_MOD,
+ parm,
+ sizeof(*parm),
+ 0,
+ 0);
+}
diff --git a/feed/app/ethswbox/src/switch_hostapi/src/sys_misc.c b/feed/app/ethswbox/src/switch_hostapi/src/sys_misc.c
new file mode 100644
index 0000000..3c62022
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_hostapi/src/sys_misc.c
@@ -0,0 +1,91 @@
+/******************************************************************************
+
+ Copyright 2023-2024 MaxLinear, Inc.
+
+ For licensing information, see the file 'LICENSE' in the root folder of
+ this software module.
+
+******************************************************************************/
+
+#include "host_adapt.h"
+#include "host_api_impl.h"
+
+int sys_misc_fw_update(const GSW_Device_t *dev)
+{
+ return gsw_api_wrap(dev,
+ SYS_MISC_FW_UPDATE,
+ NULL,
+ 0,
+ 0,
+ 0);
+}
+
+int sys_misc_fw_version(const GSW_Device_t *dev, struct sys_fw_image_version *sys_img_ver)
+{
+ return gsw_api_wrap(dev,
+ SYS_MISC_FW_VERSION,
+ sys_img_ver,
+ sizeof(*sys_img_ver),
+ 0,
+ sizeof(*sys_img_ver));
+}
+
+int sys_misc_pvt_temp(const GSW_Device_t *dev, struct sys_sensor_value *sys_temp_val)
+{
+ return gsw_api_wrap(dev,
+ SYS_MISC_PVT_TEMP,
+ sys_temp_val,
+ sizeof(*sys_temp_val),
+ 0,
+ sizeof(*sys_temp_val));
+}
+
+int sys_misc_pvt_voltage(const GSW_Device_t *dev, struct sys_sensor_value *sys_voltage)
+{
+ return gsw_api_wrap(dev,
+ SYS_MISC_PVT_VOLTAGE,
+ sys_voltage,
+ sizeof(*sys_voltage),
+ 0,
+ sizeof(*sys_voltage));
+}
+
+int sys_misc_delay(const GSW_Device_t *dev, struct sys_delay *pdelay)
+{
+ return gsw_api_wrap(dev,
+ SYS_MISC_DELAY,
+ pdelay,
+ sizeof(*pdelay),
+ 0,
+ 0);
+}
+
+int sys_misc_gpio_configure(const GSW_Device_t *dev, struct sys_gpio_config *sys_gpio_conf)
+{
+ return gsw_api_wrap(dev,
+ SYS_MISC_GPIO_CONFIGURE,
+ sys_gpio_conf,
+ sizeof(*sys_gpio_conf),
+ 0,
+ 0);
+}
+
+int sys_misc_reboot(const GSW_Device_t *dev)
+{
+ return gsw_api_wrap(dev,
+ SYS_MISC_REBOOT,
+ NULL,
+ 0,
+ 0,
+ 0);
+}
+
+int sys_misc_reg_rd(const GSW_Device_t *dev, struct sys_reg_rd *sys_reg)
+{
+ return gsw_api_wrap(dev,
+ SYS_MISC_REG_RD,
+ sys_reg,
+ sizeof(*sys_reg),
+ 0,
+ sizeof(*sys_reg));
+}
diff --git a/feed/app/ethswbox/src/switch_ioctl/src/sys_switch_ioctl.c b/feed/app/ethswbox/src/switch_ioctl/src/sys_switch_ioctl.c
new file mode 100644
index 0000000..0b9794a
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_ioctl/src/sys_switch_ioctl.c
@@ -0,0 +1,126 @@
+/*
+ * sys_switch_ioctl.c: switch(ioctl) set API
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <linux/if.h>
+#include "sys_switch_ioctl.h"
+
+#define MTK_PHYIAC_PHY_ACS_ST 0x8000
+#define MTK_PHYIAC_MDIO_PHY_ADDR_SHFT 5
+
+static int esw_fd;
+
+int switch_ioctl_init(void)
+{
+ esw_fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (esw_fd < 0) {
+ perror("socket");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+void switch_ioctl_fin(void)
+{
+ close(esw_fd);
+}
+
+int sys_cl22_mdio_read(uint8_t phyaddr, uint16_t reg, uint16_t *value)
+{
+ struct ra_mii_ioctl_data mii;
+ struct ifreq ifr;
+
+ strncpy(ifr.ifr_name, ETH_DEVNAME, 5);
+ ifr.ifr_data = &mii;
+
+ mii.phy_id = phyaddr;
+ mii.reg_num = reg;
+
+ if (-1 == ioctl(esw_fd, RAETH_MII_READ, &ifr)) {
+ perror("ioctl");
+ close(esw_fd);
+ exit(0);
+ }
+ *value = mii.val_out;
+
+ return 0;
+}
+
+int sys_cl22_mdio_write(uint8_t phyaddr, uint16_t reg, uint16_t value)
+{
+ struct ra_mii_ioctl_data mii;
+ struct ifreq ifr;
+
+ strncpy(ifr.ifr_name, ETH_DEVNAME, 5);
+ ifr.ifr_data = &mii;
+
+ mii.phy_id = phyaddr;
+ mii.reg_num = reg;
+ mii.val_in = value;
+
+ if (-1 == ioctl(esw_fd, RAETH_MII_WRITE, &ifr)) {
+ perror("ioctl");
+ close(esw_fd);
+ exit(0);
+ }
+ return 0;
+}
+
+
+int sys_cl45_mdio_read(uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg, uint16_t *value)
+{
+ struct ra_mii_ioctl_data mii;
+ uint16_t reg_value;
+ struct ifreq ifr;
+
+ strncpy(ifr.ifr_name, ETH_DEVNAME, 5);
+ ifr.ifr_data = &mii;
+
+ reg_value = MTK_PHYIAC_PHY_ACS_ST |
+ (phyaddr << MTK_PHYIAC_MDIO_PHY_ADDR_SHFT) | mmd;
+
+ mii.phy_id = reg_value;
+ mii.reg_num = reg;
+
+ if (-1 == ioctl(esw_fd, RAETH_MII_READ_CL45, &ifr)) {
+ perror("ioctl");
+ close(esw_fd);
+ exit(0);
+ }
+ *value = mii.val_out;
+ return 0;
+}
+
+int sys_cl45_mdio_write(uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg, uint16_t value)
+{
+ struct ra_mii_ioctl_data mii;
+ uint16_t reg_value;
+ struct ifreq ifr;
+
+ strncpy(ifr.ifr_name, ETH_DEVNAME, 5);
+ ifr.ifr_data = &mii;
+
+ reg_value = MTK_PHYIAC_PHY_ACS_ST |
+ (phyaddr << MTK_PHYIAC_MDIO_PHY_ADDR_SHFT) | mmd;
+
+ mii.phy_id = reg_value;
+ mii.reg_num = reg;
+ mii.val_in = value;
+
+ if (-1 == ioctl(esw_fd, RAETH_MII_WRITE_CL45, &ifr)) {
+ perror("ioctl");
+ close(esw_fd);
+ exit(0);
+ }
+ return 0;
+}
diff --git a/feed/app/ethswbox/src/switch_ioctl/src/sys_switch_ioctl.h b/feed/app/ethswbox/src/switch_ioctl/src/sys_switch_ioctl.h
new file mode 100644
index 0000000..5d3e9e8
--- /dev/null
+++ b/feed/app/ethswbox/src/switch_ioctl/src/sys_switch_ioctl.h
@@ -0,0 +1,37 @@
+/*
+ * sys_switch_ioctl.h: switch(ioctl) set API
+ */
+
+#ifndef SYS_SWITCH_IOCTL_H
+#define SYS_SWITCH_IOCTL_H
+
+#define ETH_DEVNAME "eth0"
+
+#define RAETH_MII_READ 0x89F3
+#define RAETH_MII_WRITE 0x89F4
+#define RAETH_ESW_PHY_DUMP 0x89F7
+#define RAETH_MII_READ_CL45 0x89FC
+#define RAETH_MII_WRITE_CL45 0x89FD
+
+struct esw_reg {
+ uint32_t off;
+ uint32_t val;
+};
+
+struct ra_mii_ioctl_data {
+ uint16_t phy_id;
+ uint16_t reg_num;
+ uint32_t val_in;
+ uint32_t val_out;
+};
+
+int sys_cl22_mdio_read(uint8_t phyaddr, uint16_t reg, uint16_t *value);
+int sys_cl22_mdio_write(uint8_t phyaddr, uint16_t reg, uint16_t value);
+int sys_cl45_mdio_read(uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg, uint16_t *value);
+int sys_cl45_mdio_write(uint8_t phyaddr, uint8_t mmd,
+ uint16_t reg, uint16_t value);
+
+int switch_ioctl_init(void);
+
+#endif /* SYS_SWITCH_IOCTL_H */