This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: how to configure vlans in ethfw

Part Number: TDA4VM

Hi, TI experts

I encountered a problem when configuring the vlan


I'm running software version sdk-8.6-j721e.

I read the document [FAQ] TDA4VM: How to Configure CPSW 5G/9G ALE - Processors forum - Processors - TI E2E support forums

I configured a vlan for ports 3 and host, and another vlan for port 5, as per the reference in the documentation.

Connect port 3 to a test machine, and port 5 to a PC. The test machine sends multicast packets and uses the tcpdump function on the board to capture multicast packets. Then, wireshark can be used to capture the packets on the PC.

How can I configure port5 to filter out packets from different vlan ports and forward the packets correctly when the port vlan is the same?

Here is my vlan configuration code

/*
 *
 * Copyright (c) 2020 Texas Instruments Incorporated
 *
 * All rights reserved not granted herein.
 *
 * Limited License.
 *
 * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
 * license under copyrights and patents it now or hereafter owns or controls to make,
 * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
 * terms herein.  With respect to the foregoing patent license, such license is granted
 * solely to the extent that any such patent is necessary to Utilize the software alone.
 * The patent license shall not apply to any combinations which include this software,
 * other than combinations with devices manufactured by or for TI ("TI Devices").
 * No hardware patent is licensed hereunder.
 *
 * Redistributions must preserve existing copyright notices and reproduce this license
 * (including the above copyright notice and the disclaimer and (if applicable) source
 * code license limitations below) in the documentation and/or other materials provided
 * with the distribution
 *
 * Redistribution and use in binary form, without modification, are permitted provided
 * that the following conditions are met:
 *
 * *       No reverse engineering, decompilation, or disassembly of this software is
 * permitted with respect to any software provided in binary form.
 *
 * *       any redistribution and use are licensed by TI for use only with TI Devices.
 *
 * *       Nothing shall obligate TI to provide you with source code for the software
 * licensed and provided to you in object code.
 *
 * If software source code is provided to you, modification and redistribution of the
 * source code are permitted provided that the following conditions are met:
 *
 * *       any redistribution and use of the source code, including any resulting derivative
 * works, are licensed by TI for use only with TI Devices.
 *
 * *       any redistribution and use of any object code compiled from the source code
 * and any resulting derivative works, are licensed by TI for use only with TI Devices.
 *
 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
 *
 * may be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * DISCLAIMER.
 *
 * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "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 TI AND TI'S LICENSORS 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.
 *
 */

#include "app_ethfw_priv.h"

/* ========================================================================== */
/*                            Global Variables                                */
/* ========================================================================== */

#if defined(SAFERTOS)
#define ETHAPP_LWIP_TASK_STACKSIZE      (16U * 1024U)
#define ETHAPP_LWIP_TASK_STACKALIGN     ETHAPP_LWIP_TASK_STACKSIZE
#else
#define ETHAPP_LWIP_TASK_STACKSIZE      (4U * 1024U)
#define ETHAPP_LWIP_TASK_STACKALIGN     (32U)
#endif

static uint8_t gEthAppLwipStackBuf[ETHAPP_LWIP_TASK_STACKSIZE] __attribute__ ((section(".bss:taskStackSection"))) __attribute__((aligned(ETHAPP_LWIP_TASK_STACKALIGN)));

/* lwIP features that EthFw relies on */
#ifndef LWIP_IPV4
#error "LWIP_IPV4 is not enabled"
#endif
#ifndef LWIP_NETIF_STATUS_CALLBACK
#error "LWIP_NETIF_STATUS_CALLBACK is not enabled"
#endif
#ifndef LWIP_NETIF_LINK_CALLBACK
#error "LWIP_NETIF_LINK_CALLBACK is not enabled"
#endif

/* DHCP or static IP */
#define ETHAPP_LWIP_USE_DHCP            (1)
#if !ETHAPP_LWIP_USE_DHCP
#define ETHFW_SERVER_IPADDR(addr)       IP4_ADDR((addr), 192,168,1,200)
#define ETHFW_SERVER_GW(addr)           IP4_ADDR((addr), 192,168,1,1)
#define ETHFW_SERVER_NETMASK(addr)      IP4_ADDR((addr), 255,255,255,0)
#endif

/* BridgeIf configuration parameters */
#define ETHAPP_LWIP_BRIDGE_MAX_PORTS (4U)
#define ETHAPP_LWIP_BRIDGE_MAX_DYNAMIC_ENTRIES (32U)
#define ETHAPP_LWIP_BRIDGE_MAX_STATIC_ENTRIES (8U)

/* BridgeIf port IDs
 * Used for creating CoreID to Bridge PortId Map
 */
#define ETHAPP_BRIDGEIF_PORT1_ID        (1U)
#define ETHAPP_BRIDGEIF_PORT2_ID        (2U)
#define ETHAPP_BRIDGEIF_CPU_PORT_ID     BRIDGEIF_MAX_PORTS

/* Inter-core netif IDs */
#define ETHAPP_NETIF_IC_MCU2_0_MCU2_1_IDX   (0U)
#define ETHAPP_NETIF_IC_MCU2_0_A72_IDX      (1U)
#define ETHAPP_NETIF_IC_MAX_IDX             (2U)

/* Max length of shared mcast address list */
#define ETHAPP_MAX_SHARED_MCAST_ADDR        (8U)

/* Required size of the MAC address pool (specific to the TI EVM configuration):
 *  1 x MAC address for Ethernet Firmware
 *  2 x MAC address for mpu1_0 virtual switch and MAC-only ports (Linux, 1 for QNX)
 *  2 x MAC address for mcu2_1 virtual switch and MAC-only ports (RTOS)
 *  1 x MAC address for mcu2_1 virtual switch port (AUTOSAR) */
#define ETHAPP_MAC_ADDR_POOL_SIZE           (6U)

#define TEST_VID_A72                    (100U)

static EthAppObj gEthAppObj =
{
    .enetType = ENET_CPSW_9G,
    .hEthFw = NULL,
    .hUdmaDrv = NULL,
    .instId   = 0U,
};

static Enet_MacPort gEthAppPorts[] =
{
#if defined(SOC_J721E)
    /* On J721E EVM to use all 8 ports simultaneously, we use below configuration
       RGMII Ports - 1,3,4,8. QSGMII ports - 2,5,6,7 */
    ENET_MAC_PORT_1, /* RGMII */
    ENET_MAC_PORT_3, /* RGMII */
    ENET_MAC_PORT_4, /* RGMII */
    ENET_MAC_PORT_8, /* RGMII */
    ENET_MAC_PORT_2, /* QSGMII main */
    ENET_MAC_PORT_5, /* QSGMII sub */
    ENET_MAC_PORT_6, /* QSGMII sub */
#if defined(ENABLE_QSGMII_PORTS)
    // ENET_MAC_PORT_2, /* QSGMII main */
    // ENET_MAC_PORT_5, /* QSGMII sub */
    // ENET_MAC_PORT_6, /* QSGMII sub */
    ENET_MAC_PORT_7, /* QSGMII sub */
#endif
#elif defined(SOC_J784S4)
    ENET_MAC_PORT_1, /* QSGMII main */
    ENET_MAC_PORT_3, /* QSGMII sub */
    ENET_MAC_PORT_4, /* QSGMII sub */
    ENET_MAC_PORT_5, /* QSGMII sub */
#endif
};

static EthFw_VirtPortCfg gEthApp_virtPortCfg[] =
{
    {
        .remoteCoreId = IPC_MPU1_0,
        .portId       = ETHREMOTECFG_SWITCH_PORT_0,
    },
    {
        .remoteCoreId = IPC_MCU2_1,
        .portId       = ETHREMOTECFG_SWITCH_PORT_1,
    },
    {
        .remoteCoreId = IPC_MPU1_0,
        .portId       = ETHREMOTECFG_MAC_PORT_2,
    },
    {
        .remoteCoreId = IPC_MCU2_1,
        .portId       = ETHREMOTECFG_MAC_PORT_4,
    },
};

static EthFw_VirtPortCfg gEthApp_autosarVirtPortCfg[] =
{
    {
        .remoteCoreId = IPC_MCU2_1,
        .portId       = ETHREMOTECFG_SWITCH_PORT_1,
    },
};

#if defined(SAFERTOS)
static sys_sem_t gEthApp_lwipMainTaskSemObj;
#endif

/* ========================================================================== */
/*                          Function Declarations                             */
/* ========================================================================== */

static void EthApp_lwipMain(void *a0,
                            void *a1);

static void EthApp_initLwip(void *arg);

static void EthApp_initNetif(void);

static void EthApp_netifStatusCb(struct netif *netif);

static int32_t EthApp_initEthFw(void);

static void EthApp_startSwInterVlan(char *recvBuff,
                                    char *sendBuff);

static void EthApp_startHwInterVlan(char *recvBuff,
                                    char *sendBuff);

static int32_t EthApp_addRemoteCoreStaticCfg(Enet_Handle hEnet,
                                             uint32_t coreId,
                                             uint32_t flowId);

static void EthApp_delRemoteCoreStaticCfg(Enet_Handle hEnet,
                                          uint32_t coreId,
                                          uint32_t flowId);

#if defined(ETHAPP_ENABLE_INTERCORE_ETH)
static void EthApp_filterAddMacSharedCb(const uint8_t *mac_address,
                                        const uint8_t hostId);

static void EthApp_filterDelMacSharedCb(const uint8_t *mac_address,
                                        const uint8_t hostId);

/* Array to store coreId to lwip bridge portId map */
static uint8_t gEthApp_lwipBridgePortIdMap[IPC_MAX_PROCS];

/* Shared multicast address table */
typedef struct
{
    /*! Shared Mcast address */
    uint8_t macAddr[ENET_MAC_ADDR_LEN];
    /*! lwIP Bridge port mask */
    bridgeif_portmask_t portMask;
} EthApp_SharedMcastAddrTable;

/* Must not exceed ETHAPP_MAX_SHARED_MCAST_ADDR entries */
static EthApp_SharedMcastAddrTable gEthApp_sharedMcastAddrTable[] =
{
    {
        /* MCast IP ADDR: 224.0.0.1 */
        .macAddr = {0x01,0x00,0x5E,0x00,0x00,0x01},
        .portMask= 0U,
    },
    {
        /* MCast IP ADDR: 224.0.0.251 */
        .macAddr = {0x01,0x00,0x5E,0x00,0x00,0xFB},
        .portMask= 0U,
    },
    {
        /* MCast IP ADDR: 224.0.0.252 */
        .macAddr = {0x01,0x00,0x5E,0x00,0x00,0xFC},
        .portMask= 0U,
    },
    {
        .macAddr = {0x33,0x33,0x00,0x00,0x00,0x01},
        .portMask= 0U,
    },
    {
        .macAddr = {0x33,0x33,0xFF,0x1D,0x92,0xC2},
        .portMask= 0U,
    },
    {
        .macAddr = {0x01,0x80,0xC2,0x00,0x00,0x00},
        .portMask= 0U,
    },
    {
        .macAddr = {0x01,0x80,0xC2,0x00,0x00,0x03},
        .portMask= 0U,
    },
    {   /* TestMac IP ADDR: 224.0.0.252 */
        .macAddr = {0x01, 0x00, 0x5e, 0x1, 0x1, 0x01},
        .portMask= 0U,
    },
};
#endif

/* List of multicast addresses reserved for EthFw. Currently, this list is populated
 * only with PTP related multicast addresses which are used by the test PTP stack
 * used by EthFw.
 * Note: Must not exceed ETHFW_RSVD_MCAST_LIST_LEN */
static uint8_t gEthApp_rsvdMcastAddrTable[][ENET_MAC_ADDR_LEN] =
{
    /* PTP - Peer delay messages */
    {
        0x01, 0x80, 0xc2, 0x00, 0x00, 0x0E,
    },
    /* PTP - Non peer delay messages */
    {
        0x01, 0x1b, 0x19, 0x00, 0x00, 0x00,
    },
};

static struct netif netif;
#if defined(ETHAPP_ENABLE_INTERCORE_ETH)
static struct netif netif_ic[ETHAPP_NETIF_IC_MAX_IDX];

static uint32_t netif_ic_state[IC_ETH_MAX_VIRTUAL_IF] =
{
    IC_ETH_IF_MCU2_0_MCU2_1,
    IC_ETH_IF_MCU2_1_MCU2_0,
    IC_ETH_IF_MCU2_0_A72
};

static struct netif netif_bridge;
bridgeif_initdata_t bridge_initdata;
#endif /* ETHAPP_ENABLE_INTERCORE_ETH */
void appEthFwEarlyInit()
{
    SemaphoreP_Params semParams;

    /* Create semaphore used to synchronize EthFw and NDK init.
     * EthFw opens the CPSW driver which is required by NDK during NIMU
     * initialization, hence EthFw init must complete first.
     * Currently, there is no control over NDK initialization time and its
     * task runs right away after BIOS_start() hence causing a race
     * condition with EthFw init */
    SemaphoreP_Params_init(&semParams);
    semParams.mode = SemaphoreP_Mode_BINARY;
    gEthAppObj.hInitSem = SemaphoreP_create(0, &semParams);
}

int32_t appEthFwInit()
{
    int32_t status = ETHAPP_OK;
    uint32_t flags = 0U;

    appLogPrintf("ETHFW: Init ... !!!\n");

    gEthAppObj.coreId = EnetSoc_getCoreId();

    /* Board related initialization */
#if defined(SOC_J721E)
    flags |= ETHFW_BOARD_GESI_ENABLE;
#if defined(ENABLE_QSGMII_PORTS)
    flags |= ETHFW_BOARD_QENET_ENABLE;
#endif
#elif defined(SOC_J784S4)
    flags |= (ETHFW_BOARD_QENET_ENABLE | ETHFW_BOARD_SERDES_CONFIG);
#endif

    /* Board related initialization */
    status = EthFwBoard_init(flags);
    if (status != ENET_SOK)
    {
        appLogPrintf("ETHFW: Board initialization failed\n");
    }

    /* Open UDMA driver */
    if (status == ENET_SOK)
    {
        gEthAppObj.hUdmaDrv = appUdmaGetObj();
        if (gEthAppObj.hUdmaDrv == NULL)
        {
            appLogPrintf("ETHFW: ERROR: failed to open UDMA driver\n");
            status = -1;
        }
    }

    /* Initialize Ethernet Firmware */
    if (status == ETHAPP_OK)
    {
        status = EthApp_initEthFw();
    }

    /* Initialize lwIP */
    if (status == ENET_SOK)
    {
        TaskP_Params taskParams;

        TaskP_Params_init(&taskParams);
        taskParams.priority  = DEFAULT_THREAD_PRIO;
        taskParams.stack     = &gEthAppLwipStackBuf[0];
        taskParams.stacksize = sizeof(gEthAppLwipStackBuf);
        taskParams.name      = "lwIP main loop";
#if defined(SAFERTOS)
        taskParams.userData  = &gEthApp_lwipMainTaskSemObj;
#endif

        TaskP_create(&EthApp_lwipMain, &taskParams);
    }

    if (status == ETHAPP_OK)
    {
        appLogPrintf("ETHFW: Init ... DONE !!!\n");
    }
    else
    {
        appLogPrintf("ETHFW: Init ... ERROR !!!\n");
    }


    return status;
}

int32_t appEthFwDeInit()
{
    int32_t status = 0;

    EthFw_deinit(gEthAppObj.hEthFw);

    return status;
}

int32_t appEthFwRemoteServerInit()
{
    int32_t status;

    appLogPrintf("ETHFW: Remove server Init ... !!!\n");

    /* Initialize the Remote Config server (CPSW Proxy Server) */
    status = EthFw_initRemoteConfig(gEthAppObj.hEthFw);
    if (status != ENET_SOK)
    {
        appLogPrintf("ETHFW: Remove server Init ... ERROR (%d) !!! \n", status);
    }
    else
    {
        appLogPrintf("ETHFW: Remove server Init ... DONE !!!\n");
    }

    return status;
}

void LwipifEnetAppCb_getHandle(LwipifEnetAppIf_GetHandleInArgs *inArgs,
                               LwipifEnetAppIf_GetHandleOutArgs *outArgs)
{
    /* Wait for EthFw to be initialized */
    SemaphoreP_pend(gEthAppObj.hInitSem, SemaphoreP_WAIT_FOREVER);

    EthFwCallbacks_lwipifCpswGetHandle(inArgs, outArgs);

    /* Save host port MAC address */
    EnetUtils_copyMacAddr(&gEthAppObj.hostMacAddr[0U],
                          &outArgs->rxInfo[0U].macAddr[0U]);
}

void LwipifEnetAppCb_releaseHandle(LwipifEnetAppIf_ReleaseHandleInfo *releaseInfo)
{
    EthFwCallbacks_lwipifCpswReleaseHandle(releaseInfo);
}

static int32_t EthApp_initEthFw(void)
{
    EthFw_Version ver;
    EthFw_Config ethFwCfg;
    Cpsw_Cfg *cpswCfg = &ethFwCfg.cpswCfg;
    EnetUdma_Cfg dmaCfg;
    EnetRm_MacAddressPool *pool = &cpswCfg->resCfg.macList;
    uint32_t poolSize;
    int32_t status = ETHAPP_OK;
    int32_t i;

    /* Set EthFw config params */
    EthFw_initConfigParams(gEthAppObj.enetType, &ethFwCfg);

    dmaCfg.rxChInitPrms.dmaPriority = UDMA_DEFAULT_RX_CH_DMA_PRIORITY;
    dmaCfg.hUdmaDrv = gEthAppObj.hUdmaDrv;
    cpswCfg->dmaCfg = (void *)&dmaCfg;

    /* Populate MAC address pool */
    poolSize = EnetUtils_min(ENET_ARRAYSIZE(pool->macAddress), ETHAPP_MAC_ADDR_POOL_SIZE);
    pool->numMacAddress = EthFwBoard_getMacAddrPool(pool->macAddress, poolSize);

    /* Set hardware port configuration parameters */
    ethFwCfg.ports = &gEthAppPorts[0];
    ethFwCfg.numPorts = ARRAY_SIZE(gEthAppPorts);
    ethFwCfg.setPortCfg = EthFwBoard_setPortCfg;

    /* Set virtual port configuration parameters */
    ethFwCfg.virtPortCfg  = &gEthApp_virtPortCfg[0];
    ethFwCfg.numVirtPorts = ARRAY_SIZE(gEthApp_virtPortCfg);

    /* Set AUTOSAR virtual port configuration parameters */
    ethFwCfg.autosarVirtPortCfg  = &gEthApp_autosarVirtPortCfg[0];
    ethFwCfg.numAutosarVirtPorts = ARRAY_SIZE(gEthApp_autosarVirtPortCfg);

    /* CPTS_RFT_CLK is sourced from MAIN_SYSCLK0 (500MHz) */
    cpswCfg->cptsCfg.cptsRftClkFreq = CPSW_CPTS_RFTCLK_FREQ_500MHZ;

    /* Overwrite config params with those for hardware interVLAN */
    EthHwInterVlan_setOpenPrms(&ethFwCfg.cpswCfg);

    /* Set static configuration functions */
    ethFwCfg.addStaticCfg = &EthApp_addRemoteCoreStaticCfg;
    ethFwCfg.delStaticCfg = &EthApp_delRemoteCoreStaticCfg;

#if defined(ETHAPP_ENABLE_INTERCORE_ETH)
    if (ARRAY_SIZE(gEthApp_sharedMcastAddrTable) > ETHAPP_MAX_SHARED_MCAST_ADDR)
    {
        appLogPrintf("ETHFW error: No. of shared mcast addr cannot exceed %d\n",
                    ETHAPP_MAX_SHARED_MCAST_ADDR);
        status = ETHAPP_ERROR;
    }
    else
    {
        for (i = 0U; i < ARRAY_SIZE(gEthApp_sharedMcastAddrTable); i++)
        {
            EnetUtils_copyMacAddr(&ethFwCfg.sharedMcastCfg.macAddrList[i][0],
                                  &gEthApp_sharedMcastAddrTable[i].macAddr[0]);
        }

        ethFwCfg.sharedMcastCfg.numMacAddr = ARRAY_SIZE(gEthApp_sharedMcastAddrTable);
        ethFwCfg.sharedMcastCfg.filterAddMacSharedCb = EthApp_filterAddMacSharedCb;
        ethFwCfg.sharedMcastCfg.filterDelMacSharedCb = EthApp_filterDelMacSharedCb;
    }
#endif

    if (status == ETHAPP_OK)
    {
        if (ARRAY_SIZE(gEthApp_rsvdMcastAddrTable) > ETHFW_RSVD_MCAST_LIST_LEN)
        {
            appLogPrintf("ETHFW error: No. of rsvd mcast addr cannot exceed %d\n",
                         ETHFW_RSVD_MCAST_LIST_LEN);
            status = ETHAPP_ERROR;
        }
        else
        {
            for (i = 0U; i < ARRAY_SIZE(gEthApp_rsvdMcastAddrTable); i++)
            {
                EnetUtils_copyMacAddr(&ethFwCfg.rsvdMcastCfg.macAddrList[i][0],
                                      &gEthApp_rsvdMcastAddrTable[i][0]);
            }

            ethFwCfg.rsvdMcastCfg.numMacAddr = ARRAY_SIZE(gEthApp_rsvdMcastAddrTable);
        }
    }

    /* Initialize the EthFw */
    if (status == ETHAPP_OK)
    {
        gEthAppObj.hEthFw = EthFw_init(gEthAppObj.enetType, &ethFwCfg);
        if (gEthAppObj.hEthFw == NULL)
        {
            appLogPrintf("ETHFW: failed to initialize the firmware\n");
            status = ETHAPP_ERROR;
        }
    }

    /* Get and print EthFw version */
    if (status == ETHAPP_OK)
    {
        EthFw_getVersion(gEthAppObj.hEthFw, &ver);
        appLogPrintf("ETHFW Version   : %d.%02d.%02d\n", ver.major, ver.minor, ver.rev);
        appLogPrintf("ETHFW Build Date: %s %s, %s\n", ver.month, ver.date, ver.year);
        appLogPrintf("ETHFW Build Time: %s:%s:%s\n", ver.hour, ver.min, ver.sec);
        appLogPrintf("ETHFW Commit SHA: %s\n\n", ver.commitHash);
    }

    /* Post semaphore so that lwip or NIMU/NDK can continue with their initialization */
    if (status == ETHAPP_OK)
    {
        SemaphoreP_post(gEthAppObj.hInitSem);
    }

    return status;
}

/* lwIP callbacks (exact name required) */

bool EthFwCallbacks_isPortLinked(struct netif *netif,
                                 Enet_Handle hEnet)
{
    bool linked = false;
    uint32_t i;

    /* Report port linked as long as any port owned by EthFw is up */
    for (i = 0U; (i < ARRAY_SIZE(gEthAppPorts)) && !linked; i++)
    {
        linked = EnetAppUtils_isPortLinkUp(hEnet,
                                           gEthAppObj.coreId,
                                           gEthAppPorts[i]);
    }

    return linked;
}

static void EthApp_lwipMain(void *a0,
                            void *a1)
{
    err_t err;
    sys_sem_t initSem;

    appUtilsTaskInit();

    /* initialize lwIP stack and network interfaces */
    err = sys_sem_new(&initSem, 0);
    LWIP_ASSERT("failed to create initSem", err == ERR_OK);
    LWIP_UNUSED_ARG(err);

    tcpip_init(EthApp_initLwip, &initSem);

    /* we have to wait for initialization to finish before
     * calling update_adapter()! */
    sys_sem_wait(&initSem);
    sys_sem_free(&initSem);

#if (LWIP_SOCKET || LWIP_NETCONN) && LWIP_NETCONN_SEM_PER_THREAD
    netconn_thread_init();
#endif
}

static void EthApp_initLwip(void *arg)
{
    sys_sem_t *initSem;

    LWIP_ASSERT("arg != NULL", arg != NULL);
    initSem = (sys_sem_t*)arg;

    /* init randomizer again (seed per thread) */
    srand((unsigned int)sys_now()/1000);

    /* init network interfaces */
    EthApp_initNetif();

    sys_sem_signal(initSem);
}

static void EthApp_initNetif(void)
{
    ip4_addr_t ipaddr, netmask, gw;
#if ETHAPP_LWIP_USE_DHCP
    err_t err;
#endif

    ip4_addr_set_zero(&gw);
    ip4_addr_set_zero(&ipaddr);
    ip4_addr_set_zero(&netmask);

#if ETHAPP_LWIP_USE_DHCP
    appLogPrintf("Starting lwIP, local interface IP is dhcp-enabled\n");
#else /* ETHAPP_LWIP_USE_DHCP */
    ETHFW_SERVER_GW(&gw);
    ETHFW_SERVER_IPADDR(&ipaddr);
    ETHFW_SERVER_NETMASK(&netmask);
    appLogPrintf("Starting lwIP, local interface IP is %s\n", ip4addr_ntoa(&ipaddr));
#endif /* ETHAPP_LWIP_USE_DHCP */

#if defined(ETHAPP_ENABLE_INTERCORE_ETH)
    /* Create Enet LLD ethernet interface */
    netif_add(&netif, NULL, NULL, NULL, NULL, LWIPIF_LWIP_init, tcpip_input);

    /* Create inter-core virtual ethernet interface: MCU2_0 <-> MCU2_1 */
    netif_add(&netif_ic[ETHAPP_NETIF_IC_MCU2_0_MCU2_1_IDX], NULL, NULL, NULL,
              (void*)&netif_ic_state[IC_ETH_IF_MCU2_0_MCU2_1],
              LWIPIF_LWIP_IC_init, tcpip_input);

    /* Create inter-core virtual ethernet interface: MCU2_0 <-> A72 */
    netif_add(&netif_ic[ETHAPP_NETIF_IC_MCU2_0_A72_IDX], NULL, NULL, NULL,
              (void*)&netif_ic_state[IC_ETH_IF_MCU2_0_A72],
              LWIPIF_LWIP_IC_init, tcpip_input);

    /* Create bridge interface */
    bridge_initdata.max_ports = ETHAPP_LWIP_BRIDGE_MAX_PORTS;
    bridge_initdata.max_fdb_dynamic_entries = ETHAPP_LWIP_BRIDGE_MAX_DYNAMIC_ENTRIES;
    bridge_initdata.max_fdb_static_entries = ETHAPP_LWIP_BRIDGE_MAX_STATIC_ENTRIES;
    EnetUtils_copyMacAddr(&bridge_initdata.ethaddr.addr[0U], &gEthAppObj.hostMacAddr[0U]);

    netif_add(&netif_bridge, &ipaddr, &netmask, &gw, &bridge_initdata, bridgeif_init, netif_input);

    /* Add all netifs to the bridge and create coreId to bridge portId map */
    bridgeif_add_port(&netif_bridge, &netif);
    gEthApp_lwipBridgePortIdMap[IPC_MCU2_0] = ETHAPP_BRIDGEIF_CPU_PORT_ID;

    bridgeif_add_port(&netif_bridge, &netif_ic[0]);
    gEthApp_lwipBridgePortIdMap[IPC_MCU2_1] = ETHAPP_BRIDGEIF_PORT1_ID;

    bridgeif_add_port(&netif_bridge, &netif_ic[1]);
    gEthApp_lwipBridgePortIdMap[IPC_MPU1_0] = ETHAPP_BRIDGEIF_PORT2_ID;

    /* Set bridge interface as the default */
    netif_set_default(&netif_bridge);
#else
    netif_add(&netif, &ipaddr, &netmask, &gw, NULL, LWIPIF_LWIP_init, tcpip_input);
    netif_set_default(&netif);
#endif

    netif_set_status_callback(netif_default, EthApp_netifStatusCb);

    dhcp_set_struct(netif_default, &gEthAppObj.dhcpNetif);

#if defined(ETHAPP_ENABLE_INTERCORE_ETH)
    netif_set_up(&netif);
    netif_set_up(&netif_ic[ETHAPP_NETIF_IC_MCU2_0_MCU2_1_IDX]);
    netif_set_up(&netif_ic[ETHAPP_NETIF_IC_MCU2_0_A72_IDX]);
    netif_set_up(&netif_bridge);
#else
    netif_set_up(netif_default);
#endif

#if ETHAPP_LWIP_USE_DHCP
    err = dhcp_start(netif_default);
    if (err != ERR_OK)
    {
        appLogPrintf("Failed to start DHCP: %d\n", err);
    }
#endif /* ETHAPP_LWIP_USE_DHCP */
}

static void EthApp_netifStatusCb(struct netif *netif)
{
    Enet_MacPort macPort = ENET_MAC_PORT_1;
    int32_t status;

    if (netif_is_up(netif))
    {
        const ip4_addr_t *ipAddr = netif_ip4_addr(netif);

        appLogPrintf("Added interface '%c%c%d', IP is %s\n",
                     netif->name[0], netif->name[1], netif->num, ip4addr_ntoa(ipAddr));

        if (ipAddr->addr != 0)
        {
            gEthAppObj.hostIpAddr = lwip_ntohl(ip_addr_get_ip4_u32(ipAddr));

            /* MAC port used for PTP */
            macPort = ENET_MAC_PORT_3;

            /* Initialize and enable PTP stack */
            EthFw_initTimeSyncPtp(gEthAppObj.hostIpAddr,
                                  &gEthAppObj.hostMacAddr[0U],
                                  ENET_BIT(ENET_MACPORT_NORM(macPort)));

            /* Assign functions that are to be called based on actions in GUI.
             * These cannot be dynamically pushed to function pointer array, as the
             * index is used in GUI as command */
            EnetCfgServer_fxn_table[9] = &EthApp_startSwInterVlan;
            EnetCfgServer_fxn_table[10] = &EthApp_startHwInterVlan;

            /* Start Configuration server */
            status = EnetCfgServer_init(gEthAppObj.enetType, gEthAppObj.instId);
            EnetAppUtils_assert(ENET_SOK == status);

            /* Start the software-based interVLAN routing */
            EthSwInterVlan_setupRouting(gEthAppObj.enetType, ETH_SWINTERVLAN_TASK_PRI);
        }
    }
    else
    {
        appLogPrintf("Removed interface '%c%c%d'\n", netif->name[0], netif->name[1], netif->num);
    }
}

/* Functions called from Config server library based on selection from GUI */

static void EthApp_startSwInterVlan(char *recvBuff,
                                    char *sendBuff)
{
    EnetCfgServer_InterVlanConfig *pInterVlanCfg;
    int32_t status;

    if (recvBuff != NULL)
    {
        pInterVlanCfg = (EnetCfgServer_InterVlanConfig *)recvBuff;
        status = EthSwInterVlan_addClassifierEntries(pInterVlanCfg);
        EnetAppUtils_assert(ENET_SOK == status);
    }
}

static void EthApp_startHwInterVlan(char *recvBuff,
                                    char *sendBuff)
{
    EnetCfgServer_InterVlanConfig *pInterVlanCfg;

    if (recvBuff != NULL)
    {
        pInterVlanCfg = (EnetCfgServer_InterVlanConfig *)recvBuff;
        EthHwInterVlan_setupRouting(gEthAppObj.enetType, pInterVlanCfg);
    }
}

#if defined(ETHAPP_ENABLE_INTERCORE_ETH)
/* Application callback function to handle addition of a shared mcast
 * address in the ALE */
static void EthApp_filterAddMacSharedCb(const uint8_t *mac_address,
                                        const uint8_t hostId)
{
    uint8_t idx = 0;
    bridgeif_portmask_t portMask;
    struct eth_addr ethaddr;
    bool matchFound = false;
    int32_t errVal = 0;

    /* Search the mac_address in the shared mcast addr table */
    for (idx = 0; idx < ARRAY_SIZE(gEthApp_sharedMcastAddrTable); idx++)
    {
        if (EnetUtils_cmpMacAddr(mac_address,
                    &gEthApp_sharedMcastAddrTable[idx].macAddr[0]))
        {
            matchFound = true;
            /* Read and update stored port mask */
            portMask = gEthApp_sharedMcastAddrTable[idx].portMask;
            portMask |= (0x01 << gEthApp_lwipBridgePortIdMap[hostId]);
            gEthApp_sharedMcastAddrTable[idx].portMask = portMask;

            /* Update bridge fdb entry for this mac_address */
            EnetUtils_copyMacAddr(&ethaddr.addr[0U], mac_address);

            /* There will be a delay between removing existing FDB entry
             * and adding the updated one. During this time, multicast
             * packets will be flodded to all the bridge ports
             */
            bridgeif_fdb_remove(&netif_bridge, &ethaddr);

            errVal = bridgeif_fdb_add(&netif_bridge,
                                      &ethaddr,
                                      gEthApp_sharedMcastAddrTable[idx].portMask);

            if (errVal)
            {
                appLogPrintf("addMacSharedCb: bridgeif_fdb_add failed (%d)\n", errVal);
            }

            /* The array should have unique mcast addresses,
             * so no other match is expected
             */
            break;
        }
    }

    if (!matchFound)
    {
        appLogPrintf("addMacSharedCb: Address not found\n");
    }
}

/* Application callback function to handle deletion of a shared mcast
 * address from the ALE */
static void EthApp_filterDelMacSharedCb(const uint8_t *mac_address,
                                        const uint8_t hostId)
{
    uint8_t idx = 0;
    bridgeif_portmask_t portMask;
    struct eth_addr ethaddr;
    bool matchFound = false;
    int32_t errVal = 0;

    /* Search the mac_address in the shared mcast addr table */
    for (idx = 0; idx < ARRAY_SIZE(gEthApp_sharedMcastAddrTable); idx++)
    {
        if (EnetUtils_cmpMacAddr(mac_address,
                    &gEthApp_sharedMcastAddrTable[idx].macAddr[0]))
        {
            matchFound = true;
            /* Read and update stored port mask */
            portMask = gEthApp_sharedMcastAddrTable[idx].portMask;
            portMask &= ~(0x01 << gEthApp_lwipBridgePortIdMap[hostId]);
            gEthApp_sharedMcastAddrTable[idx].portMask = portMask;

            /* Update bridge fdb entry for this mac_address */
            EnetUtils_copyMacAddr(&ethaddr.addr[0U], mac_address);

            /* There will be a delay between removing existing FDB entry
             * and adding the updated one. During this time, multicast
             * packets will be flodded to all the bridge ports
             */
            bridgeif_fdb_remove(&netif_bridge, &ethaddr);

            if (gEthApp_sharedMcastAddrTable[idx].portMask)
            {
                errVal = bridgeif_fdb_add(&netif_bridge,
                                          &ethaddr,
                                          gEthApp_sharedMcastAddrTable[idx].portMask);
            }

            if (errVal)
            {
                appLogPrintf("delMacSharedCb: bridgeif_fdb_add failed (%d)\n", errVal);
            }

            /* The array should have unique mcast addresses,
             * so no other match is expected
             */
            break;
        }
    }

    if (!matchFound)
    {
        appLogPrintf("delMacSharedCb: Address not found\n");
    }
}
#endif

static int32_t EthApp_addMpu10StaticCfg(Enet_Handle hEnet,
                                        uint32_t coreId,
                                        uint32_t flowId)
{
    const uint8_t mcastAddr[ENET_MAC_ADDR_LEN] = {0x01, 0x99, 0xc2, 0x00, 0x01, 0x0E};
    CpswAle_SetPolicerEntryInArgs polInArgs;
    CpswAle_SetPolicerEntryOutArgs polOutArgs;
    CpswAle_SetMcastEntryInArgs mcastInArgs;
    Enet_IoctlPrms prms;
    uint32_t entry;
    int32_t status;
#if 1
    CpswAle_VlanEntryInfo inArgs;
    uint32_t outArgs;

    /* Add VLAN entry */
    memset(&inArgs, 0U, sizeof (CpswAle_VlanEntryInfo));
    inArgs.vlanIdInfo.vlanId = TEST_VID_A72;
    inArgs.vlanIdInfo.tagType = ENET_VLAN_TAG_TYPE_INNER;
    inArgs.vlanMemberList = (1 << CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_3)) | \
                            CPSW_ALE_HOST_PORT_MASK;
    inArgs.unregMcastFloodMask = (1 << CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_3)) | \
                                 CPSW_ALE_HOST_PORT_MASK;
    inArgs.regMcastFloodMask = (1 << CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_3)) | \
                               CPSW_ALE_HOST_PORT_MASK;
    inArgs.forceUntaggedEgressMask = 0;
    inArgs.noLearnMask = 0U;
    inArgs.vidIngressCheck = true;
    inArgs.limitIPNxtHdr = false;
    inArgs.disallowIPFrag = false;

    ENET_IOCTL_SET_INOUT_ARGS(&prms, &inArgs, &outArgs);

    status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_ADD_VLAN, &prms);
    if (status != ENET_SOK)
    {
        appLogPrintf("%s() failed ADD_VLAN ioctl failed: %d\n", __func__, status);
    }

    memset(&inArgs, 0U, sizeof (CpswAle_VlanEntryInfo));
    inArgs.vlanIdInfo.vlanId = (TEST_VID_A72+10);
    inArgs.vlanIdInfo.tagType = ENET_VLAN_TAG_TYPE_INNER;
    inArgs.vlanMemberList = (1 << CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_5));
    inArgs.unregMcastFloodMask = (1 << CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_5));
    inArgs.regMcastFloodMask = (1 << CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_5));
    inArgs.forceUntaggedEgressMask = 0;
    inArgs.noLearnMask = 0U;
    inArgs.vidIngressCheck = true;
    inArgs.limitIPNxtHdr = false;
    inArgs.disallowIPFrag = false;

    status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_ADD_VLAN, &prms);
    if (status != ENET_SOK)
    {
        appLogPrintf("%s() failed ADD_VLAN ioctl failed: %d\n", __func__, status);
    }


#endif
    polInArgs.policerMatch.policerMatchEnMask = 0U;

    /* Add policer entry for port 1 and dstmac */
    polInArgs.policerMatch.policerMatchEnMask = CPSW_ALE_POLICER_MATCH_PORT;
    polInArgs.policerMatch.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_1);
    polInArgs.policerMatch.portIsTrunk = false;

    polInArgs.policerMatch.policerMatchEnMask |= CPSW_ALE_POLICER_MATCH_MACDST;
    polInArgs.policerMatch.dstMacAddrInfo.portNum = CPSW_ALE_HOST_PORT_NUM;
    polInArgs.policerMatch.dstMacAddrInfo.addr.vlanId = 0;
    EnetUtils_copyMacAddr(&polInArgs.policerMatch.dstMacAddrInfo.addr.addr[0], &mcastAddr[0]);

    polInArgs.threadIdEn = true;
    polInArgs.threadId   = flowId;
    polInArgs.peakRateInBitsPerSec   = 0U;
    polInArgs.commitRateInBitsPerSec = 0U;

    ENET_IOCTL_SET_INOUT_ARGS(&prms, &polInArgs, &polOutArgs);

    status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_SET_POLICER, &prms);
    if (status != ENET_SOK)
    {
        appLogPrintf("Failed to register PORT1 | MACDST policer: %d\n", status);
    }


    /* Add policer entry for port 6 and dstmac */
    if (status == ENET_SOK)
    {
        memset(&polInArgs, 0U, sizeof (polInArgs));
        polInArgs.policerMatch.policerMatchEnMask = CPSW_ALE_POLICER_MATCH_PORT;
        polInArgs.policerMatch.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_5);
        polInArgs.policerMatch.portIsTrunk = false;

        polInArgs.policerMatch.policerMatchEnMask |= CPSW_ALE_POLICER_MATCH_MACDST;
        polInArgs.policerMatch.dstMacAddrInfo.portNum = CPSW_ALE_HOST_PORT_NUM;
        polInArgs.policerMatch.dstMacAddrInfo.addr.vlanId = 0;
        EnetUtils_copyMacAddr(&polInArgs.policerMatch.dstMacAddrInfo.addr.addr[0], &mcastAddr[0]);

        polInArgs.policerMatch.policerMatchEnMask |= CPSW_ALE_POLICER_MATCH_IVLAN;
        polInArgs.policerMatch.ivlanId = (TEST_VID_A72+10);

        polInArgs.threadIdEn = true;
        polInArgs.threadId   = flowId;
        polInArgs.peakRateInBitsPerSec   = 0U;
        polInArgs.commitRateInBitsPerSec = 0U;
        ENET_IOCTL_SET_INOUT_ARGS(&prms, &polInArgs, &polOutArgs);

        status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_SET_POLICER, &prms);
        if (status != ENET_SOK)
        {
            appLogPrintf("Failed to register PORT3 | MACDST policer: %d\n", status);
        }
    }

    /* Add policer entry for port 3 and dstmac */
    if (status == ENET_SOK)
    {

        memset(&polInArgs, 0U, sizeof (polInArgs));
        polInArgs.policerMatch.policerMatchEnMask = CPSW_ALE_POLICER_MATCH_PORT;
        polInArgs.policerMatch.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_3);
        polInArgs.policerMatch.portIsTrunk = false;

        polInArgs.policerMatch.policerMatchEnMask |= CPSW_ALE_POLICER_MATCH_MACDST;
        polInArgs.policerMatch.dstMacAddrInfo.portNum = CPSW_ALE_HOST_PORT_NUM;
        polInArgs.policerMatch.dstMacAddrInfo.addr.vlanId = 0;
        EnetUtils_copyMacAddr(&polInArgs.policerMatch.dstMacAddrInfo.addr.addr[0], &mcastAddr[0]);

        polInArgs.policerMatch.policerMatchEnMask |= CPSW_ALE_POLICER_MATCH_IVLAN;
        polInArgs.policerMatch.ivlanId = (TEST_VID_A72);

        polInArgs.threadIdEn = true;
        polInArgs.threadId   = flowId;
        polInArgs.peakRateInBitsPerSec   = 0U;
        polInArgs.commitRateInBitsPerSec = 0U;
        ENET_IOCTL_SET_INOUT_ARGS(&prms, &polInArgs, &polOutArgs);

        status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_SET_POLICER, &prms);
        if (status != ENET_SOK)
        {
            appLogPrintf("Failed to register PORT3 | MACDST policer: %d\n", status);
        }
    }

    /* Add multicast entry with port mask: host port, MAC port 1 and MAC port 3 */
    if (status == ENET_SOK)
    {
        mcastInArgs.addr.vlanId = 0U;
        EnetUtils_copyMacAddr(&mcastInArgs.addr.addr[0], &mcastAddr[0]);

        mcastInArgs.info.super    = false;
        mcastInArgs.info.fwdState = CPSW_ALE_FWDSTLVL_FWD;
        mcastInArgs.info.portMask = (CPSW_ALE_HOST_PORT_MASK |
                                     CPSW_ALE_MACPORT_TO_PORTMASK(ENET_MAC_PORT_1) |
                                     CPSW_ALE_MACPORT_TO_PORTMASK(ENET_MAC_PORT_5) |
                                     CPSW_ALE_MACPORT_TO_PORTMASK(ENET_MAC_PORT_3));
        mcastInArgs.info.numIgnBits = 0U;

        ENET_IOCTL_SET_INOUT_ARGS(&prms, &mcastInArgs, &entry);

        status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_ADD_MCAST, &prms);
        if (status != ENET_SOK)
        {
            appLogPrintf("Failed to add mcast ports: %d\n", status);
        }
    }

    return status;
}

static void EthApp_delMpu10StaticCfg(Enet_Handle hEnet,
                                     uint32_t coreId,
                                     uint32_t flowId)
{
    const uint8_t mcastAddr[ENET_MAC_ADDR_LEN] = {0x01, 0x80, 0xc2, 0x00, 0x01, 0x0E};
    CpswAle_DelPolicerEntryInArgs polInArgs;
    Enet_IoctlPrms prms;
    int32_t status;

    polInArgs.policerMatch.policerMatchEnMask = 0U;

    /* Delete policer entry for port 1 and dstmac */
    polInArgs.policerMatch.policerMatchEnMask = CPSW_ALE_POLICER_MATCH_PORT;
    polInArgs.policerMatch.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_1);
    polInArgs.policerMatch.portIsTrunk = false;

    polInArgs.policerMatch.policerMatchEnMask |= CPSW_ALE_POLICER_MATCH_MACDST;
    polInArgs.policerMatch.dstMacAddrInfo.portNum = CPSW_ALE_HOST_PORT_NUM;
    polInArgs.policerMatch.dstMacAddrInfo.addr.vlanId = 0U;
    EnetUtils_copyMacAddr(&polInArgs.policerMatch.dstMacAddrInfo.addr.addr[0], &mcastAddr[0]);

    polInArgs.aleEntryMask = CPSW_ALE_POLICER_MATCH_PORT;

    ENET_IOCTL_SET_IN_ARGS(&prms, &polInArgs);

    status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_DEL_POLICER, &prms);
    if (status != ENET_SOK)
    {
        appLogPrintf("Failed to delete PORT1 | MACDST policer: %d\n", status);
    }

    /* Delete policer entry for port 6 and dstmac */
    if (status == ENET_SOK)
    {
        polInArgs.policerMatch.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_5);

        ENET_IOCTL_SET_IN_ARGS(&prms, &polInArgs);

        status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_DEL_POLICER, &prms);
        if (status != ENET_SOK)
        {
            appLogPrintf("Failed to delete PORT3 | MACDST policer: %d\n", status);
        }
    }
    /* Delete policer entry for port 3 and dstmac */
    if (status == ENET_SOK)
    {
        polInArgs.policerMatch.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_3);
        polInArgs.policerMatch.policerMatchEnMask |= CPSW_ALE_POLICER_MATCH_IVLAN;
        polInArgs.policerMatch.ivlanId = TEST_VID_A72;

        ENET_IOCTL_SET_IN_ARGS(&prms, &polInArgs);

        status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_DEL_POLICER, &prms);
        if (status != ENET_SOK)
        {
            appLogPrintf("Failed to delete PORT3 | MACDST policer: %d\n", status);
        }
    }

}

static int32_t EthApp_addRemoteCoreStaticCfg(Enet_Handle hEnet,
                                             uint32_t coreId,
                                             uint32_t flowId)
{
    int32_t status = ENET_SOK;

    switch (coreId)
    {
        case IPC_MPU1_0:
            appLogPrintf("Add static config for mpu1_0\n");
            status = EthApp_addMpu10StaticCfg(hEnet, coreId, flowId);
            break;

        default:
            break;
    }

    return status;
}

static void EthApp_delRemoteCoreStaticCfg(Enet_Handle hEnet,
                                          uint32_t coreId,
                                          uint32_t flowId)
{
    switch (coreId)
    {
        case IPC_MPU1_0:
            appLogPrintf("Delete static config for mpu1_0\n");
            EthApp_delMpu10StaticCfg(hEnet, coreId, flowId);
            break;

        default:
            break;
    }
}

Regards,

liang

  • Sudheer, kindly please look into this ticket in priority and provide some suggestions to customer to try it out. thanks. 

  • Hi, TI experts

    I do not know how to configure the access function of vlan in ethfw. I set policermate. portIsTrunk to false, but the vlan tag of the sent packet is not removed when it is sent. What should I do

    Regards,

    liang

  • Hi,

    Packet forwarding from one port to other will be depends upon Destination MAC address.

    In your case, you are configuring the Multicast MAC Address with Port-3 and Port-5. This is the reason for seeing the packet sent from Test machine via port-3 in PC connected to Port-5.

    you can register the Multicast address only for Port-3 then you can't see packet on Port-5.

    Best Regards,
    Sudheer

  • Hi,

    If I configure a multicast mac address only for port-3, port 5 cannot see data because the mac address is filtered instead of the vlan.I want to know how to use vlan filtering to forward packets.

    For example, if the VLAN ID for port 3 is set to 10 and 30, and the VLAN ID for port 5 is set to 20 and 30. If port 3 receives packets from VLAN 10, port-5 does not forward the packets. If port 3 receives packets from VLAN 30, port 5 forwards the port correctly.

    Here I found another problem,For example, if I set the vlan of port-3 to 100, port-3 can normally send and receive packets from vlan 100. Then, if I set the vlan of port-5 to 100, port-5 can normally receive packets from vlan 100.port-3 cannot send or receive packets with vlan 100. How can I solve this problem?

    Regards,

    liang

     

  • Hi,

    Can you please share the ALE & Policer entries for our reference, Refer to FAQ [how to print ALE entries] for collecting ALE table.

    Best Regards,
    Sudheer

  • Hi,

    Here is the ALE table. I first added a vlan id of 50 for port-3, and then added a vlan id of 50 for port-5

    root@j7-evm:/opt/vision_apps# ./hirain_ale.out add-pvid pvid 50 port 3
    APP: Init ... !!!
    MEM: Init ... !!!
    MEM: Initialized DMA HEAP (fd=4) !!!
    MEM: Init ... Done !!!
    IPC: Init ... !!!
    IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
         0.000000 s: GTC Frequency = 0 MHz
    APP: Init ... Done !!!
         0.000000 s:  VX_ZONE_INIT:Enabled
         0.000000 s:  VX_ZONE_ERROR:Enabled
         0.000000 s:  VX_ZONE_WARNING:Enabled
         0.000000 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
         0.000000 s:  VX_ZONE_INIT:[tivxHostInitLocal:93] Initialization Done for HOST !!!
         0.000000 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:107] De-Initialization Done for HOST !!!
    [MCU2_0]     71.723423 s: HirainMainR5FRemoteServiceHandler()  ADD_VLAN ioctl success: 0,id:50,port:3,list:9
    [MCU2_0]     71.723532 s: HIRAIN_CMD_CPSW9G_PVID_TEST exec end!
         0.000000 s:  VX_ZONE_INIT:[tivxDeInitLocal:193] De-Initialization Done !!!
    APP: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... Done !!!
    IPC: Deinit ... !!!
    IPC: DeInit ... Done !!!
    MEM: Deinit ... !!!
    DDR_SHARED_MEM: Alloc's: 0 alloc's of 0 bytes
    DDR_SHARED_MEM: Free's : 0 free's  of 0 bytes
    DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes
    DDR_SHARED_MEM: Total size: 536870912 bytes
    MEM: Deinit ... Done !!!
    APP: Deinit ... Done !!!
    root@j7-evm:/opt/vision_apps# ./hirain_ale.out add-pvid pvid 50 port 5
    APP: Init ... !!!
    MEM: Init ... !!!
    MEM: Initialized DMA HEAP (fd=4) !!!
    MEM: Init ... Done !!!
    IPC: Init ... !!!
    IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
         0.000000 s: GTC Frequency = 0 MHz
    APP: Init ... Done !!!
         0.000000 s:  VX_ZONE_INIT:Enabled
         0.000000 s:  VX_ZONE_ERROR:Enabled
         0.000000 s:  VX_ZONE_WARNING:Enabled
         0.000000 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
         0.000000 s:  VX_ZONE_INIT:[tivxHostInitLocal:93] Initialization Done for HOST !!!
         0.000000 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:107] De-Initialization Done for HOST !!!
    [MCU2_0]     78.107303 s: HirainMainR5FRemoteServiceHandler()  ADD_VLAN ioctl success: 0,id:50,port:5,list:21
    [MCU2_0]     78.107421 s: HIRAIN_CMD_CPSW9G_PVID_TEST exec end!
         0.000000 s:  VX_ZONE_INIT:[tivxDeInitLocal:193] De-Initialization Done !!!
    APP: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... Done !!!
    IPC: Deinit ... !!!
    IPC: DeInit ... Done !!!
    MEM: Deinit ... !!!
    DDR_SHARED_MEM: Alloc's: 0 alloc's of 0 bytes
    DDR_SHARED_MEM: Free's : 0 free's  of 0 bytes
    DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes
    DDR_SHARED_MEM: Total size: 536870912 bytes
    MEM: Deinit ... Done !!!
    APP: Deinit ... Done !!!
    root@j7-evm:/opt/vision_apps#
    root@j7-evm:/opt/vision_apps#
    root@j7-evm:/opt/vision_apps#
    root@j7-evm:/opt/vision_apps#
    root@j7-evm:/opt/vision_apps# ./hirain_ale.out 9g
    APP: Init ... !!!
    MEM: Init ... !!!
    MEM: Initialized DMA HEAP (fd=4) !!!
    MEM: Init ... Done !!!
    IPC: Init ... !!!
    IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
         0.000000 s: GTC Frequency = 0 MHz
    APP: Init ... Done !!!
         0.000000 s:  VX_ZONE_INIT:Enabled
         0.000000 s:  VX_ZONE_ERROR:Enabled
         0.000000 s:  VX_ZONE_WARNING:Enabled
         0.000000 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
         0.000000 s:  VX_ZONE_INIT:[tivxHostInitLocal:93] Initialization Done for HOST !!!
         0.000000 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:107] De-Initialization Done for HOST !!!
         0.000000 s:  VX_ZONE_INIT:[tivxDeInitLocal:193] De-Initialization Done !!!
    APP: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... !!!
    [MCU2_0]     85.089130 s: ---------------------------------------------
    [MCU2_0]     85.089207 s: -------CPSWnG ALE TABLE----------------------
    [MCU2_0]     85.089248 s: ---------------------------------------------
    [MCU2_0]     85.089284 s: ---------------------------------------------
    [MCU2_0]     85.089317 s:  Entry 0 - VLAN INNER
    [MCU2_0]     85.089347 s: ---------------------------------------------
    [MCU2_0]     85.089380 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.089407 s: IVLAN_ID           = 50
    [MCU2_0]     85.089436 s: NO FRAG           = 0
    [MCU2_0]     85.089463 s: REG_MCAST_FLOOD   = 511
    [MCU2_0]     85.089491 s: VLAN FWD Untagged Egress = 256
    [MCU2_0]     85.089521 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.089549 s: UNREG_MCAST_FLOOD = 511
    [MCU2_0]     85.089577 s: VLAN_MEMBER_LIST  = 33
    [MCU2_0]     85.089605 s: ---------------------------------------------
    [MCU2_0]     85.089636 s:  Entry 1 - VLAN INNER
    [MCU2_0]     85.089662 s: ---------------------------------------------
    [MCU2_0]     85.089692 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.089718 s: IVLAN_ID           = 300
    [MCU2_0]     85.089746 s: NO FRAG           = 0
    [MCU2_0]     85.089773 s: REG_MCAST_FLOOD   = 511
    [MCU2_0]     85.089800 s: VLAN FWD Untagged Egress = 511
    [MCU2_0]     85.089829 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.089857 s: UNREG_MCAST_FLOOD = 0
    [MCU2_0]     85.089885 s: VLAN_MEMBER_LIST  = 511
    [MCU2_0]     85.089912 s: ---------------------------------------------
    [MCU2_0]     85.089942 s:  Entry 2 - VLAN INNER
    [MCU2_0]     85.089968 s: ---------------------------------------------
    [MCU2_0]     85.089998 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.090024 s: IVLAN_ID           = 1
    [MCU2_0]     85.090051 s: NO FRAG           = 0
    [MCU2_0]     85.090141 s: REG_MCAST_FLOOD   = 363
    [MCU2_0]     85.090173 s: VLAN FWD Untagged Egress = 107
    [MCU2_0]     85.090206 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.090233 s: UNREG_MCAST_FLOOD = 0
    [MCU2_0]     85.090260 s: VLAN_MEMBER_LIST  = 363
    [MCU2_0]     85.090288 s: ---------------------------------------------
    [MCU2_0]     85.090319 s:  Entry 3 - VLAN INNER
    [MCU2_0]     85.090345 s: ---------------------------------------------
    [MCU2_0]     85.090374 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.090400 s: IVLAN_ID           = 0
    [MCU2_0]     85.090426 s: NO FRAG           = 0
    [MCU2_0]     85.090452 s: REG_MCAST_FLOOD   = 21
    [MCU2_0]     85.090478 s: VLAN FWD Untagged Egress = 277
    [MCU2_0]     85.090507 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.090534 s: UNREG_MCAST_FLOOD = 21
    [MCU2_0]     85.090560 s: VLAN_MEMBER_LIST  = 21
    [MCU2_0]     85.090587 s: ---------------------------------------------
    [MCU2_0]     85.090618 s:  Entry 4 - VLAN INNER
    [MCU2_0]     85.090644 s: ---------------------------------------------
    [MCU2_0]     85.090673 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.090698 s: IVLAN_ID           = 406
    [MCU2_0]     85.090725 s: NO FRAG           = 0
    [MCU2_0]     85.090751 s: REG_MCAST_FLOOD   = 511
    [MCU2_0]     85.090778 s: VLAN FWD Untagged Egress = 511
    [MCU2_0]     85.090807 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.090833 s: UNREG_MCAST_FLOOD = 0
    [MCU2_0]     85.090859 s: VLAN_MEMBER_LIST  = 511
    [MCU2_0]     85.090886 s: ---------------------------------------------
    [MCU2_0]     85.090916 s:  Entry 5 - Multicast
    [MCU2_0]     85.090944 s: ---------------------------------------------
    [MCU2_0]     85.090974 s: PORT_MASK        = 1ff
    [MCU2_0]     85.091002 s: SUPER            = 0
    [MCU2_0]     85.091029 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.091095 s: MCAST_FWD_STATE  = 0
    REMOTE_SERVICE: Deinit ... Done !!!
    IPC: Deinit ... !!!
    [MCU2_0]     85.091134 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.091163 s: MULTICAST_ADDR   = ffff ffffffff
    [MCU2_0]     85.091198 s: ---------------------------------------------
    [MCU2_0]     85.091227 s:  Entry 6 - Multicast
    [MCU2_0]     85.091254 s: ---------------------------------------------
    [MCU2_0]     85.091283 s: PORT_MASK        = 1ff
    [MCU2_0]     85.091310 s: SUPER            = 0
    [MCU2_0]     85.091335 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.091360 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.091386 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.091411 s: MULTICAST_ADDR   = 100 5e7f0001
    [MCU2_0]     85.091445 s: ---------------------------------------------
    [MCU2_0]     85.091474 s:  Entry 7 - Multicast
    [MCU2_0]     85.091501 s: ---------------------------------------------
    [MCU2_0]     85.091530 s: PORT_MASK        = 1ff
    [MCU2_0]     85.091558 s: SUPER            = 0
    [MCU2_0]     85.091585 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.091611 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.091637 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.091664 s: MULTICAST_ADDR   = 100 5e303401
    [MCU2_0]     85.091697 s: ---------------------------------------------
    [MCU2_0]     85.091728 s:  Entry 8 - Multicast
    [MCU2_0]     85.091755 s: ---------------------------------------------
    [MCU2_0]     85.091786 s: PORT_MASK        = 1ff
    [MCU2_0]     85.091813 s: SUPER            = 0
    [MCU2_0]     85.091841 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.091867 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.091894 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.091920 s: MULTICAST_ADDR   = 100 5e010101
    [MCU2_0]     85.091952 s: ---------------------------------------------
    [MCU2_0]     85.091982 s:  Entry 9 - Unicast
    [MCU2_0]     85.092007 s: ---------------------------------------------
    [MCU2_0]     85.092036 s: TRUNK            = 0
    [MCU2_0]     85.092095 s: PORT_NUMBER      = 0
    [MCU2_0]     85.092134 s: BLOCK            = 0
    [MCU2_0]     85.092165 s: SECURE           = 1
    [MCU2_0]     85.092192 s: TOUCH            = 0
    [MCU2_0]     85.092221 s: AGEABLE          = 0
    [MCU2_0]     85.092248 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.092274 s: UNICAST_ADDR     = 70ff 761d92c3
    [MCU2_0]     85.092308 s: ---------------------------------------------
    [MCU2_0]     85.092337 s:  Entry 11 - Unicast
    [MCU2_0]     85.092363 s: ---------------------------------------------
    [MCU2_0]     85.092392 s: TRUNK            = 0
    IPC: DeInit ... Done !!!
    [MCU2_0]     85.092418 s: PORT_NUMBER      = 0
    MEM: Deinit ... !!!
    [MCU2_0]     85.092444 s: BLOCK            = 0
    DDR_SHARED_MEM: Alloc's: 0 alloc's of 0 bytes
    DDR_SHARED_MEM: Free's : 0 free's  of 0 bytes
    DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes
    [MCU2_0]     85.092470 s: SECURE           = 1
    DDR_SHARED_MEM: Total size: 536870912 bytes
    MEM: Deinit ... Done !!!
    [MCU2_0]     85.092496 s: TOUCH            = 0
    [MCU2_0]     85.092522 s: AGEABLE          = 0
    APP: Deinit ... Done !!!
    [MCU2_0]     85.092548 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.092574 s: UNICAST_ADDR     = e46 2201a202
    [MCU2_0]     85.092607 s: ---------------------------------------------
    [MCU2_0]     85.092637 s:  Entry 12 - Unicast
    [MCU2_0]     85.092663 s: ---------------------------------------------
    [MCU2_0]     85.092692 s: TRUNK            = 0
    [MCU2_0]     85.092720 s: PORT_NUMBER      = 0
    [MCU2_0]     85.092747 s: BLOCK            = 0
    [MCU2_0]     85.092773 s: SECURE           = 0
    [MCU2_0]     85.092800 s: TOUCH            = 0
    [MCU2_0]     85.092825 s: AGEABLE          = 0
    [MCU2_0]     85.092851 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.092877 s: UNICAST_ADDR     = e46 2202a306
    [MCU2_0]     85.092928 s: ---------------------------------------------
    [MCU2_0]     85.092959 s:  Entry 13 - VLAN INNER
    [MCU2_0]     85.092986 s: ---------------------------------------------
    [MCU2_0]     85.093016 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.093042 s: IVLAN_ID           = 100
    [MCU2_0]     85.093145 s: NO FRAG           = 0
    [MCU2_0]     85.093181 s: REG_MCAST_FLOOD   = 9
    [MCU2_0]     85.093210 s: VLAN FWD Untagged Egress = 0
    [MCU2_0]     85.093240 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.093266 s: UNREG_MCAST_FLOOD = 9
    [MCU2_0]     85.093292 s: VLAN_MEMBER_LIST  = 9
    [MCU2_0]     85.093319 s: ---------------------------------------------
    [MCU2_0]     85.093349 s:  Entry 14 - VLAN INNER
    [MCU2_0]     85.093376 s: ---------------------------------------------
    [MCU2_0]     85.093405 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.093431 s: IVLAN_ID           = 110
    [MCU2_0]     85.093458 s: NO FRAG           = 0
    [MCU2_0]     85.093484 s: REG_MCAST_FLOOD   = 33
    [MCU2_0]     85.093512 s: VLAN FWD Untagged Egress = 0
    [MCU2_0]     85.093541 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.093569 s: UNREG_MCAST_FLOOD = 33
    [MCU2_0]     85.093595 s: VLAN_MEMBER_LIST  = 33
    [MCU2_0]     85.093624 s: ---------------------------------------------
    [MCU2_0]     85.093654 s:  Entry 15 - Multicast
    [MCU2_0]     85.093681 s: ---------------------------------------------
    [MCU2_0]     85.093712 s: PORT_MASK        = 2b
    [MCU2_0]     85.093738 s: SUPER            = 0
    [MCU2_0]     85.093764 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.093789 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.093815 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.093841 s: MULTICAST_ADDR   = 199 c200010e
    [MCU2_0]     85.093875 s: ---------------------------------------------
    [MCU2_0]     85.093905 s:  Entry 16 - VLAN OUTER
    [MCU2_0]     85.093932 s: ---------------------------------------------
    [MCU2_0]     85.093961 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.093988 s: OVLAN_ID           = 110
    [MCU2_0]     85.094015 s: NO FRAG           = 0
    [MCU2_0]     85.094040 s: REG_MCAST_FLOOD   = 0
    [MCU2_0]     85.094109 s: VLAN FWD Untagged Egress = 0
    [MCU2_0]     85.094145 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.094174 s: UNREG_MCAST_FLOOD = 0
    [MCU2_0]     85.094201 s: VLAN_MEMBER_LIST  = 0
    [MCU2_0]     85.094229 s: ---------------------------------------------
    [MCU2_0]     85.094260 s:  Entry 17 - VLAN OUTER
    [MCU2_0]     85.094287 s: ---------------------------------------------
    [MCU2_0]     85.094316 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.094343 s: OVLAN_ID           = 100
    [MCU2_0]     85.094370 s: NO FRAG           = 0
    [MCU2_0]     85.094395 s: REG_MCAST_FLOOD   = 0
    [MCU2_0]     85.094421 s: VLAN FWD Untagged Egress = 0
    [MCU2_0]     85.094449 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.094475 s: UNREG_MCAST_FLOOD = 0
    [MCU2_0]     85.094501 s: VLAN_MEMBER_LIST  = 0
    [MCU2_0]     85.094528 s: ---------------------------------------------
    [MCU2_0]     85.094558 s:  Entry 18 - Multicast
    [MCU2_0]     85.094586 s: ---------------------------------------------
    [MCU2_0]     85.094616 s: PORT_MASK        = 16b
    [MCU2_0]     85.094644 s: SUPER            = 0
    [MCU2_0]     85.094670 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.094695 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.094721 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.094747 s: MULTICAST_ADDR   = 3333 1
    [MCU2_0]     85.094778 s: ---------------------------------------------
    [MCU2_0]     85.094808 s:  Entry 19 - Multicast
    [MCU2_0]     85.094834 s: ---------------------------------------------
    [MCU2_0]     85.094865 s: PORT_MASK        = 16b
    [MCU2_0]     85.094891 s: SUPER            = 0
    [MCU2_0]     85.094917 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.094942 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.094968 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.094994 s: MULTICAST_ADDR   = 100 5e000001
    [MCU2_0]     85.095027 s: ---------------------------------------------
    [MCU2_0]     85.095090 s:  Entry 20 - Multicast
    [MCU2_0]     85.095133 s: ---------------------------------------------
    [MCU2_0]     85.095167 s: PORT_MASK        = 16b
    [MCU2_0]     85.095194 s: SUPER            = 0
    [MCU2_0]     85.095221 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.095247 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.095273 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.095298 s: MULTICAST_ADDR   = 3333 ff02a306
    [MCU2_0]     85.095331 s: ---------------------------------------------
    [MCU2_0]     85.095360 s:  Entry 21 - Multicast
    [MCU2_0]     85.095388 s: ---------------------------------------------
    [MCU2_0]     85.095417 s: PORT_MASK        = 16b
    [MCU2_0]     85.095444 s: SUPER            = 0
    [MCU2_0]     85.095469 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.095495 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.095520 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.095545 s: MULTICAST_ADDR   = 180 c2000000
    [MCU2_0]     85.095579 s: ---------------------------------------------
    [MCU2_0]     85.095608 s:  Entry 22 - Multicast
    [MCU2_0]     85.095635 s: ---------------------------------------------
    [MCU2_0]     85.095665 s: PORT_MASK        = 16b
    [MCU2_0]     85.095692 s: SUPER            = 0
    [MCU2_0]     85.095718 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.095743 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.095768 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.095794 s: MULTICAST_ADDR   = 180 c2000003
    [MCU2_0]     85.095827 s: ---------------------------------------------
    [MCU2_0]     85.095857 s:  Entry 23 - Multicast
    [MCU2_0]     85.095884 s: ---------------------------------------------
    [MCU2_0]     85.095913 s: PORT_MASK        = 16b
    [MCU2_0]     85.095941 s: SUPER            = 0
    [MCU2_0]     85.095966 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.095991 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.096017 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.096043 s: MULTICAST_ADDR   = 100 5e0000fc
    [MCU2_0]     85.096119 s: ---------------------------------------------
    [MCU2_0]     85.096156 s:  Entry 24 - Multicast
    [MCU2_0]     85.096186 s: ---------------------------------------------
    [MCU2_0]     85.096217 s: PORT_MASK        = 16b
    [MCU2_0]     85.096244 s: SUPER            = 0
    [MCU2_0]     85.096270 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.096296 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.096321 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.096347 s: MULTICAST_ADDR   = 3333 fb
    [MCU2_0]     85.096378 s: ---------------------------------------------
    [MCU2_0]     85.096408 s:  Entry 25 - Multicast
    [MCU2_0]     85.096434 s: ---------------------------------------------
    [MCU2_0]     85.096464 s: PORT_MASK        = 16b
    [MCU2_0]     85.096491 s: SUPER            = 0
    [MCU2_0]     85.096516 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.096542 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.096568 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.096593 s: MULTICAST_ADDR   = 100 5e0000fb
    [MCU2_0]     85.096626 s: ---------------------------------------------
    [MCU2_0]     85.096656 s:  Entry 26 - Multicast
    [MCU2_0]     85.096682 s: ---------------------------------------------
    [MCU2_0]     85.096713 s: PORT_MASK        = 16b
    [MCU2_0]     85.096739 s: SUPER            = 0
    [MCU2_0]     85.096765 s: MCAST IGNORE BITS= 0
    [MCU2_0]     85.096791 s: MCAST_FWD_STATE  = 0
    [MCU2_0]     85.096817 s: ENTRY_TYPE       = 1
    [MCU2_0]     85.096844 s: MULTICAST_ADDR   = 3333 10003
    [MCU2_0]     85.096878 s: ---------------------------------------------
    [MCU2_0]     85.096909 s:  Entry 27 - VLAN INNER
    [MCU2_0]     85.096935 s: ---------------------------------------------
    [MCU2_0]     85.096965 s: ENTRY_TYPE        = 2
    [MCU2_0]     85.096990 s: IVLAN_ID           = 50
    [MCU2_0]     85.097017 s: NO FRAG           = 0
    [MCU2_0]     85.097043 s: REG_MCAST_FLOOD   = 511
    [MCU2_0]     85.097116 s: VLAN FWD Untagged Egress = 256
    [MCU2_0]     85.097152 s: LMT NEXT HDR      = 0
    [MCU2_0]     85.097182 s: UNREG_MCAST_FLOOD = 511
    [MCU2_0]     85.097211 s: VLAN_MEMBER_LIST  = 33
    [MCU2_0]     85.098157 s: Completed analysis of 1024 ALE entries
    [MCU2_0]     85.098206 s: HIRAIN_CMD_CPSW9G_ALE_PRINT exec end!
    root@j7-evm:/opt/vision_apps#
    

    Here is the code for my printed form

    #define CPSW_9G_PORT_NUM        8
    #define CPSW_2G_PORT_NUM        1
    #define WR_MEM_32(addr, data)   *(uint32_t*)(addr) = (uint32_t)(data)
    #define RD_MEM_32(addr)         *(uint32_t*)(addr)
    
    
    #include <ethremotecfg/server/include/cpsw_proxy_mac.h>
    #include <ctype.h>
    #include <stdarg.h>
    #include <stdint.h>
    #include <stdio.h>
    #include <stdlib.h>
    #define MEMORY "/dev/mem"
    #define MAIN_CTRLMMR_ENET0_CTRL         (0x00104044)
    
    #define CPSW_RGMII_ID_ENABLED     (0U)
    #define CPSW_RGMII_ID_DISABLED    (1U)
    
    #define BOARD_CPSW9G_PORT0_MAC_MODE (CPSW_MAC_MODE_RGMII)
    #define BOARD_CPSW9G_PORT0_RGMII_ID (CPSW_RGMII_ID_DISABLED)
    
    #define BOARD_CPSW9G_PORT1_MAC_MODE (CPSW_MAC_MODE_RGMII)
    #define BOARD_CPSW9G_PORT1_RGMII_ID (CPSW_RGMII_ID_DISABLED)
    
    #define BOARD_CPSW9G_PORT2_MAC_MODE (CPSW_MAC_MODE_RGMII)
    #define BOARD_CPSW9G_PORT2_RGMII_ID (CPSW_RGMII_ID_DISABLED)
    
    #define BOARD_CPSW9G_PORT3_MAC_MODE (CPSW_MAC_MODE_RGMII)
    #define BOARD_CPSW9G_PORT3_RGMII_ID (CPSW_RGMII_ID_DISABLED)
    
    #define BOARD_CPSW9G_PORT7_MAC_MODE (CPSW_MAC_MODE_RMII)
    #define CPSW_MAC_MODE_GMII       (0U)
    #define CPSW_MAC_MODE_RMII       (1U)
    #define CPSW_MAC_MODE_RGMII      (2U)
    #define CPSW_MAC_MODE_SGMII      (3U)
    #define CPSW_MAC_MODE_QSGMII     (4U)
    #define CPSW_MAC_MODE_QSGMII_SUB (6U)
    
    #define CPSW_2G_MAC_PORT_NUM         (1U)
    #define CPSW_5G_MAC_PORT_NUM         (4U)
    #define CPSW_9G_MAC_PORT_NUM         (8U)
    
    #define ALE_TBLCTL_2G              0x4603E020
    #define ALE_TBLW2_2G               0x4603E034
    #define ALE_TBLW1_2G               0x4603E038
    #define ALE_TBLW0_2G               0x4603E03C
    
    #define ALE_TBLCTL_9G              0x0C03E020
    #define ALE_TBLW2_9G               0x0C03E034
    #define ALE_TBLW1_9G               0x0C03E038
    #define ALE_TBLW0_9G               0x0C03E03C
    
    #define ALE_TABLE_DEPTH_2G         64
    #define ALE_TABLE_DEPTH_5G         512
    #define ALE_TABLE_DEPTH_9G         1024
    
    
    #define ALE_ENTRY_EMTPY         0x0
    #define ALE_ENTRY_ADDR          0x1
    #define ALE_ENTRY_VLAN          0x2
    #define ALE_ENTRY_VLAN_ADDR     0x3
    
    #define CPSW5G_BASE_ADDR                            (0x0C000000)
    #define CPSW9G_BASE_ADDR                            (0x0C000000)
    #define CPSW2G_BASE_ADDR                            (0x46000000)
    
    #define CSL_CPSW_NU_CPSW_NU_ETH_PN_MAC_CONTROL_REG                      (0x00022330U)
    #define CSL_CPSW_NU_CPSW_NU_ETH_PN_MAC_STATUS_REG                       (0x00022334U)
    /*! Macro to get bit at given bit position  */
    #define ENET_GET_BIT(val, n)            ((val & (1 << n)) >> n)
    int      fd;
    
    unsigned page_size, mapped_size, offset_in_page;
    void *   map_base, *virt_addr;
    int      fd;
    
    void cpsw_addr_read(uint32_t addr)
    {
        int regVal = RD_MEM_32(addr);
        appLogPrintf("Read address:0x%X <-------> value:0x%08X\n", addr, regVal);
    }
    int mdio_addr_read(uint32_t addr)
    {
        int regVal = (int)RD_MEM_32(addr);
        appLogPrintf("Read address:0x%X <-------> value:0x%08X\n", addr, regVal);
        return regVal;
    }
    int mdio_addr_read_noprint(uint32_t addr)
    {
        int regVal = (int)RD_MEM_32(addr);
        return regVal;
    }
    void cpsw_addr_write_noprint(uint32_t addr, uint32_t value)
    {
        WR_MEM_32(addr, value);
    }
    void cpsw_addr_write(uint32_t addr, uint32_t value)
    {
    
        WR_MEM_32(addr, value);
        appLogPrintf("You will write address:0x%X -------> value:0x%08X\n", addr, value);
        uint32_t regVal = RD_MEM_32(addr);
        if(regVal == value)
        {
            appLogPrintf("Write Success!Read address:0x%X -------> value:0x%08X\n",addr, regVal);
        }
        else
        {
            appLogPrintf("Write Failed!Read address:0x%X -------> value:0x%08X\n",addr, regVal);
        }
    }
    
    void cpsw_print_stat_with_index_nonzero(char* regName, uint32_t portnum, uint32_t regIdx, uint32_t regAddr)
    {
        uint32_t regVal = RD_MEM_32(regAddr);
        if (0 != regVal)
        {
                appLogPrintf("STAT_%d_%s[%d](RegAddr:0x%08X)= 0x%X\n",portnum, regName, regIdx, regAddr, regVal);
        }
    }
    
    void cpsw_print_stat_nonzero(char* regName, uint32_t portnum, uint32_t regAddr)
    {
        uint32_t regVal = RD_MEM_32(regAddr);
        if (0 != regVal)
        {
                appLogPrintf("STAT_%d_%s(RegAddr:0x%08X)= 0x%X\n",portnum, regName, regAddr, regVal);
        }
    }
    void Cpsw_ng_PrintMACCfg_local(int portBaseAddr, int cpsw2gFlag)
    {
        int macCtrl, macStatus;
    
        macCtrl   = mdio_addr_read(portBaseAddr + CSL_CPSW_NU_CPSW_NU_ETH_PN_MAC_CONTROL_REG);
        macStatus = mdio_addr_read(portBaseAddr + CSL_CPSW_NU_CPSW_NU_ETH_PN_MAC_STATUS_REG);
    
        appLogPrintf("MAC Control \n");
        appLogPrintf(" FULLDUPLEX          = %d \n", ENET_GET_BIT(macCtrl, 0U));
        appLogPrintf(" LOOPBACK            = %d \n", ENET_GET_BIT(macCtrl, 1U));
        appLogPrintf(" MTEST               = %d \n", ENET_GET_BIT(macCtrl, 2U));
        appLogPrintf(" RX_FLOW_EN          = %d \n", ENET_GET_BIT(macCtrl, 3U));
        appLogPrintf(" TX_FLOW_EN          = %d \n", ENET_GET_BIT(macCtrl, 4U));
        appLogPrintf(" GMII_EN             = %d \n", ENET_GET_BIT(macCtrl, 5U));
        appLogPrintf(" TX_PACE             = %d \n", ENET_GET_BIT(macCtrl, 6U));
        appLogPrintf(" GIG                 = %d \n", ENET_GET_BIT(macCtrl, 7U));
        if (0U == cpsw2gFlag)
        {
            appLogPrintf(" XGIG                 = %d \n", ENET_GET_BIT(macCtrl, 8U));
        }
        appLogPrintf(" TX_SHORT_GAP_ENABLE = %d \n", ENET_GET_BIT(macCtrl, 10U));
        appLogPrintf(" CMD_IDLE            = %d \n", ENET_GET_BIT(macCtrl, 11U));
        appLogPrintf(" CRC_TYPE            = %d \n", ENET_GET_BIT(macCtrl, 12U));
        if (0U == cpsw2gFlag)
        {
            appLogPrintf(" XGMII EN            = %d \n", ENET_GET_BIT(macCtrl, 13U));
        }
        appLogPrintf(" IFCTL_A             = %d \n", ENET_GET_BIT(macCtrl, 15U));
        appLogPrintf(" IFCTL_B             = %d \n", ENET_GET_BIT(macCtrl, 16U));
        appLogPrintf(" GIG_FORCE           = %d \n", ENET_GET_BIT(macCtrl, 17U));
        appLogPrintf(" EXT CTL_EN          = %d \n", ENET_GET_BIT(macCtrl, 18U));
        appLogPrintf(" EXT_RX_FLOW_EN      = %d \n", ENET_GET_BIT(macCtrl, 19U));
        appLogPrintf(" EXT_TX_FLOW_EN      = %d \n", ENET_GET_BIT(macCtrl, 20U));
        appLogPrintf(" TX_SHORT_GAP_LIM_EN = %d \n", ENET_GET_BIT(macCtrl, 21U));
        appLogPrintf(" RX_CEF_EN           = %d \n", ENET_GET_BIT(macCtrl, 22U));
        appLogPrintf(" RX_CSF_EN           = %d \n", ENET_GET_BIT(macCtrl, 23U));
        appLogPrintf(" RX_CMF_EN           = %d \n", ENET_GET_BIT(macCtrl, 24U));
        if (0U == cpsw2gFlag)
        {
            appLogPrintf(" EXT_EN_XGIG         = %d \n", ENET_GET_BIT(macCtrl, 25U));
        }
    
        /* PN_MAC_STATUS_REG */
        appLogPrintf("MAC Status \n");
        appLogPrintf(" TX_FLOW_ACT     = %d \n", ENET_GET_BIT(macStatus, 0U));
        appLogPrintf(" RX_FLOW_ACT     = %d \n", ENET_GET_BIT(macStatus, 1U));
        appLogPrintf(" EXT_FULLDUPLEX  = %d \n", ENET_GET_BIT(macStatus, 3U));
        appLogPrintf(" EXT_GIG         = %d \n", ENET_GET_BIT(macStatus, 4U));
        appLogPrintf(" EXT_TX_FLOW_EN  = %d \n", ENET_GET_BIT(macStatus, 5U));
        appLogPrintf(" EXT_RX_FLOW_EN  = %d \n", ENET_GET_BIT(macStatus, 6U));
        appLogPrintf(" RX_PFC_FLOW_ACT = %d \n", CSL_FEXTR(macStatus, 15, 8));
        appLogPrintf(" TX_PFC_FLOW_ACT = %d \n", CSL_FEXTR(macStatus, 23, 16));
        appLogPrintf(" TORF_PRI        = %d \n", CSL_FEXTR(macStatus, 26, 24));
        appLogPrintf(" TORF            = %d \n", ENET_GET_BIT(macStatus, 27U));
        appLogPrintf(" MAC_TX_IDLE     = %d \n", ENET_GET_BIT(macStatus, 28U));
        appLogPrintf(" P_IDLE          = %d \n", ENET_GET_BIT(macStatus, 29U));
        appLogPrintf(" E_IDLE          = %d \n", ENET_GET_BIT(macStatus, 30U));
        appLogPrintf(" IDLE            = %d \n", ENET_GET_BIT(macStatus, 31U));
    }
    
    void cpsw_2g_statsprint_nonzero(void)
    {
        uint32_t i, regAddr, portnum;
    
        appLogPrintf("          STATS          \n");
    
        portnum = 0;
        appLogPrintf("--------------------------------\n");
        appLogPrintf("          PORT%d STATS          \n",portnum);
        appLogPrintf("--------------------------------\n");
        cpsw_print_stat_nonzero("RXGOODFRAMES              ", portnum, (0x4603A000U));
        cpsw_print_stat_nonzero("RXBROADCASTFRAMES         ", portnum, (0x4603A004U));
        cpsw_print_stat_nonzero("RXMULTICASTFRAMES         ", portnum, (0x4603A008U));
        cpsw_print_stat_nonzero("RXCRCERRORS               ", portnum, (0x4603A010U));
        cpsw_print_stat_nonzero("RXOVERSIZEDFRAMES         ", portnum, (0x4603A018U));
        cpsw_print_stat_nonzero("RXUNDERSIZEDFRAMES        ", portnum, (0x4603A020U));
        cpsw_print_stat_nonzero("RXFRAGMENTS               ", portnum, (0x4603A024U));
        cpsw_print_stat_nonzero("ALE_DROP                  ", portnum, (0x4603A028U));
        cpsw_print_stat_nonzero("ALE_OVERRUN_DROP          ", portnum, (0x4603A02CU));
        cpsw_print_stat_nonzero("RXOCTETS                  ", portnum, (0x4603A030U));
        cpsw_print_stat_nonzero("TXGOODFRAMES              ", portnum, (0x4603A034U));
        cpsw_print_stat_nonzero("TXBROADCASTFRAMES         ", portnum, (0x4603A038U));
        cpsw_print_stat_nonzero("TXMULTICASTFRAMES         ", portnum, (0x4603A03CU));
        cpsw_print_stat_nonzero("TXOCTETS                  ", portnum, (0x4603A064U));
        cpsw_print_stat_nonzero("OCTETFRAMES64             ", portnum, (0x4603A068U));
        cpsw_print_stat_nonzero("OCTETFRAMES65T127         ", portnum, (0x4603A06CU));
        cpsw_print_stat_nonzero("OCTETFRAMES128T255        ", portnum, (0x4603A070U));
        cpsw_print_stat_nonzero("OCTETFRAMES256T511        ", portnum, (0x4603A074U));
        cpsw_print_stat_nonzero("OCTETFRAMES512T1023       ", portnum, (0x4603A078U));
        cpsw_print_stat_nonzero("OCTETFRAMES1024TUP        ", portnum, (0x4603A07CU));
        cpsw_print_stat_nonzero("NETOCTETS                 ", portnum, (0x4603A080U));
        cpsw_print_stat_nonzero("RX_BOTTOM_OF_FIFO_DROP    ", portnum, (0x4603A084U));
        cpsw_print_stat_nonzero("PORTMASK_DROP             ", portnum, (0x4603A088U));
        cpsw_print_stat_nonzero("RX_TOP_OF_FIFO_DROP       ", portnum, (0x4603A08CU));
        cpsw_print_stat_nonzero("ALE_RATE_LIMIT_DROP       ", portnum, (0x4603A090U));
        cpsw_print_stat_nonzero("ALE_VID_INGRESS_DROP      ", portnum, (0x4603A094U));
        cpsw_print_stat_nonzero("ALE_DA_EQ_SA_DROP         ", portnum, (0x4603A098U));
        cpsw_print_stat_nonzero("ALE_BLOCK_DROP            ", portnum, (0x4603A09CU));
        cpsw_print_stat_nonzero("ALE_SECURE_DROP           ", portnum, (0x4603A0A0U));
        cpsw_print_stat_nonzero("ALE_AUTH_DROP             ", portnum, (0x4603A0A4U));
        cpsw_print_stat_nonzero("ALE_UNKN_UNI              ", portnum, (0x4603A0A8U));
        cpsw_print_stat_nonzero("ALE_UNKN_UNI_BCNT         ", portnum, (0x4603A0ACU));
        cpsw_print_stat_nonzero("ALE_UNKN_MLT              ", portnum, (0x4603A0B0U));
        cpsw_print_stat_nonzero("ALE_UNKN_MLT_BCNT         ", portnum, (0x4603A0B4U));
        cpsw_print_stat_nonzero("ALE_UNKN_BRD              ", portnum, (0x4603A0B8U));
        cpsw_print_stat_nonzero("ALE_UNKN_BRD_BCNT         ", portnum, (0x4603A0BCU));
        cpsw_print_stat_nonzero("ALE_POL_MATCH             ", portnum, (0x4603A0C0U));
        cpsw_print_stat_nonzero("ALE_POL_MATCH_RED         ", portnum, (0x4603A0C4U));
        cpsw_print_stat_nonzero("ALE_POL_MATCH_YELLOW      ", portnum, (0x4603A0C8U));
        cpsw_print_stat_nonzero("TX_MEMORY_PROTECT_ERROR   ", portnum, (0x4603A17CU));
    
        portnum = 1;
        appLogPrintf("--------------------------------\n");
        appLogPrintf("          PORT%d STATS          \n",portnum);
        appLogPrintf("--------------------------------\n");
        cpsw_print_stat_nonzero("RXGOODFRAMES              ", portnum, (0x4603A200U));
        cpsw_print_stat_nonzero("RXBROADCASTFRAMES         ", portnum, (0x4603A204U));
        cpsw_print_stat_nonzero("RXMULTICASTFRAMES         ", portnum, (0x4603A208U));
        cpsw_print_stat_nonzero("RXPAUSEFRAMES             ", portnum, (0x4603A20CU));
        cpsw_print_stat_nonzero("RXCRCERRORS               ", portnum, (0x4603A210U));
        cpsw_print_stat_nonzero("RXALIGNCODEERRORS         ", portnum, (0x4603A214U));
        cpsw_print_stat_nonzero("RXOVERSIZEDFRAMES         ", portnum, (0x4603A218U));
        cpsw_print_stat_nonzero("RXJABBERFRAMES            ", portnum, (0x4603A21CU));
        cpsw_print_stat_nonzero("RXUNDERSIZEDFRAMES        ", portnum, (0x4603A220U));
        cpsw_print_stat_nonzero("RXFRAGMENTS               ", portnum, (0x4603A224U));
        cpsw_print_stat_nonzero("ALE_DROP                  ", portnum, (0x4603A228U));
        cpsw_print_stat_nonzero("ALE_OVERRUN_DROP          ", portnum, (0x4603A22CU));
        cpsw_print_stat_nonzero("RXOCTETS                  ", portnum, (0x4603A230U));
        cpsw_print_stat_nonzero("TXGOODFRAMES              ", portnum, (0x4603A234U));
        cpsw_print_stat_nonzero("TXBROADCASTFRAMES         ", portnum, (0x4603A238U));
        cpsw_print_stat_nonzero("TXMULTICASTFRAMES         ", portnum, (0x4603A23CU));
        cpsw_print_stat_nonzero("TXPAUSEFRAMES             ", portnum, (0x4603A240U));
        cpsw_print_stat_nonzero("TXDEFERREDFRAMES          ", portnum, (0x4603A244U));
        cpsw_print_stat_nonzero("TXCOLLISIONFRAMES         ", portnum, (0x4603A248U));
        cpsw_print_stat_nonzero("TXSINGLECOLLFRAMES        ", portnum, (0x4603A24CU));
        cpsw_print_stat_nonzero("TXMULTCOLLFRAMES          ", portnum, (0x4603A250U));
        cpsw_print_stat_nonzero("TXEXCESSIVECOLLISIONS     ", portnum, (0x4603A254U));
        cpsw_print_stat_nonzero("TXLATECOLLISIONS          ", portnum, (0x4603A258U));
        cpsw_print_stat_nonzero("RXIPGERROR                ", portnum, (0x4603A25CU));
        cpsw_print_stat_nonzero("TXCARRIERSENSEERRORS      ", portnum, (0x4603A260U));
        cpsw_print_stat_nonzero("TXOCTETS                  ", portnum, (0x4603A264U));
        cpsw_print_stat_nonzero("OCTETFRAMES64             ", portnum, (0x4603A268U));
        cpsw_print_stat_nonzero("OCTETFRAMES65T127         ", portnum, (0x4603A26CU));
        cpsw_print_stat_nonzero("OCTETFRAMES128T255        ", portnum, (0x4603A270U));
        cpsw_print_stat_nonzero("OCTETFRAMES256T511        ", portnum, (0x4603A274U));
        cpsw_print_stat_nonzero("OCTETFRAMES512T1023       ", portnum, (0x4603A278U));
        cpsw_print_stat_nonzero("OCTETFRAMES1024TUP        ", portnum, (0x4603A27CU));
        cpsw_print_stat_nonzero("NETOCTETS                 ", portnum, (0x4603A280U));
        cpsw_print_stat_nonzero("RX_BOTTOM_OF_FIFO_DROP    ", portnum, (0x4603A284U));
        cpsw_print_stat_nonzero("PORTMASK_DROP             ", portnum, (0x4603A288U));
        cpsw_print_stat_nonzero("RX_TOP_OF_FIFO_DROP       ", portnum, (0x4603A28CU));
        cpsw_print_stat_nonzero("ALE_RATE_LIMIT_DROP       ", portnum, (0x4603A290U));
        cpsw_print_stat_nonzero("ALE_VID_INGRESS_DROP      ", portnum, (0x4603A294U));
        cpsw_print_stat_nonzero("ALE_DA_EQ_SA_DROP         ", portnum, (0x4603A298U));
        cpsw_print_stat_nonzero("ALE_BLOCK_DROP            ", portnum, (0x4603A29CU));
        cpsw_print_stat_nonzero("ALE_SECURE_DROP           ", portnum, (0x4603A2A0U));
        cpsw_print_stat_nonzero("ALE_AUTH_DROP             ", portnum, (0x4603A2A4U));
        cpsw_print_stat_nonzero("ALE_UNKN_UNI              ", portnum, (0x4603A2A8U));
        cpsw_print_stat_nonzero("ALE_UNKN_UNI_BCNT         ", portnum, (0x4603A2ACU));
        cpsw_print_stat_nonzero("ALE_UNKN_MLT              ", portnum, (0x4603A2B0U));
        cpsw_print_stat_nonzero("ALE_UNKN_MLT_BCNT         ", portnum, (0x4603A2B4U));
        cpsw_print_stat_nonzero("ALE_UNKN_BRD              ", portnum, (0x4603A2B8U));
        cpsw_print_stat_nonzero("ALE_UNKN_BRD_BCNT         ", portnum, (0x4603A2BCU));
        cpsw_print_stat_nonzero("ALE_POL_MATCH             ", portnum, (0x4603A2C0U));
        cpsw_print_stat_nonzero("ALE_POL_MATCH_RED         ", portnum, (0x4603A2C4U));
        cpsw_print_stat_nonzero("ALE_POL_MATCH_YELLOW      ", portnum, (0x4603A2C8U));
        cpsw_print_stat_nonzero("TX_MEMORY_PROTECT_ERROR   ", portnum, (0x4603A37CU));
    
        for (i = 0; i < 8; i++)
        {
            regAddr = 0x4603A380U + (i * 0x4U);
            cpsw_print_stat_with_index_nonzero("TX_PRI_REG             ", portnum, i, regAddr);
        }
    
        for (i = 0; i < 8; i++)
        {
            regAddr = 0x4603A3A0U + (i * 0x4U);
            cpsw_print_stat_with_index_nonzero("TX_PRI_BCNT_REG        ", portnum, i, regAddr);
        }
    
        for (i = 0; i < 8; i++)
        {
            regAddr = 0x4603A3C0U + (i * 0x4U);
            cpsw_print_stat_with_index_nonzero("TX_PRI_DROP_REG        ", portnum, i, regAddr);
        }
    
        for (i = 0; i < 8; i++)
        {
            regAddr = 0x4603A3E0U + (i * 0x4U);
            cpsw_print_stat_with_index_nonzero("TX_PRI_DROP_BCNT_REG   ", portnum, i, regAddr);
        }
    }
    int Cpsw_getMacMod(int enetCtrl)
    {
        return (enetCtrl & 0x7);
    }
    
    int Cpsw_getRgmiiId(int enetCtrl)
    {
        return ((enetCtrl >> 4) & 0x1);
    }
    
    char* Cpsw_printMacMode(int mode)
    {
        if (CPSW_MAC_MODE_GMII == mode)
        {
            return("Mode: GMII");
        }
        else if (CPSW_MAC_MODE_RMII == mode)
        {
            return("Mode: RMII");
        }
        else if (CPSW_MAC_MODE_RGMII == mode)
        {
            return("Mode: RGMII");
        }
        else if (CPSW_MAC_MODE_SGMII == mode)
        {
            return("Mode: SGMII");
        }
        else if (CPSW_MAC_MODE_QSGMII == mode)
        {
            return("Mode: QSGMII");
        }
        else if (CPSW_MAC_MODE_QSGMII_SUB == mode)
        {
            return("Mode: QSGMII_SUB");
        }
        else
        {
            return("ERROR!");
        }
    }
    char* Cpsw_printRgmiiIdCfg(int rgmiiIdVal)
    {
        if (CPSW_RGMII_ID_DISABLED == rgmiiIdVal)
        {
            return ("RGMII-ID:Disabled");
        }
        else
        {
            return("RGMII-ID:Enabled");
        }
    }
    
    void Cpsw_matchEnetCntlCfg(int expMacMode,
                           int currMacMode,
                           int expRgmiiId,
                           int currRgmiiId)
    
    {
        if (expMacMode == currMacMode)
        {
            if ((expMacMode == CPSW_MAC_MODE_RGMII) && (expRgmiiId == currRgmiiId))
            {
               appLogPrintf("   Config Matches\n");
            }
            else
            {
               appLogPrintf("   Config Matches\n");
            }
        }
        else
        {
            if (expMacMode != currMacMode)
            {
               appLogPrintf("   ERROR: Expected: %s, Actual: %s \n",
                                Cpsw_printMacMode(expMacMode), Cpsw_printMacMode(currMacMode));
            }
            if ((expRgmiiId != currRgmiiId) && (expMacMode == CPSW_MAC_MODE_RGMII))
            {
               appLogPrintf("   ERROR: Expected: %s, Actual: %s \n",
                              Cpsw_printRgmiiIdCfg(expRgmiiId),
                              Cpsw_printRgmiiIdCfg(currRgmiiId));
            }
        }
    }
    
    
    void Cpsw_printCfg(int portNum, int mode, int rgmiiIdVal)
    {
        if (2U == mode)
        {
            appLogPrintf("Port %d: %s, %s \n",
                    portNum, Cpsw_printMacMode(mode), Cpsw_printRgmiiIdCfg(rgmiiIdVal));
        }
        else
        {
            appLogPrintf("Port %d: %s\n",portNum, Cpsw_printMacMode(mode));
        }
    }
    
    void show_ale_entry_multicast_2g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - Multicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("PORT_MASK        = %x\n", (word2 >>  2) & 0x1FF);
        appLogPrintf("SUPER            = %u\n", (word2 >>  1) & 0x1);
        appLogPrintf("MCAST_FWD_STATE  = %u\n", (word1 >> 30) & 0x3);
        appLogPrintf("ENTRY_TYPE       = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("MULTICAST_ADDR   = %x %x\n", (word1 >>  0) & 0xFFFF, word0);
    }
    
    void show_ale_entry_multicast_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - Multicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("PORT_MASK        = %x\n", (word2 >>  2) & 0x1FF);
        appLogPrintf("SUPER            = %u\n", (word2 >>  1) & 0x1);
        appLogPrintf("MCAST IGNORE BITS= %u\n", (word2 >>  0) & 0x1);
        appLogPrintf("MCAST_FWD_STATE  = %u\n", (word1 >> 30) & 0x3);
        appLogPrintf("ENTRY_TYPE       = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("MULTICAST_ADDR   = %x %x\n", (word1 >>  0) & 0xFFFF, word0);
    }
    
    void show_ale_entry_vlan_multicast_2g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN/Multicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("PORT_MASK        = %x\n", (word2 >>  2) & 0x1FF);
        appLogPrintf("SUPER            = %u\n", (word2 >>  1) & 0x1);
        appLogPrintf("MCAST_FWD_STATE  = %u\n", (word1 >> 30) & 0x3);
        appLogPrintf("ENTRY_TYPE       = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("VLAN_ID          = %u\n", (word1 >> 16) & 0xFFF);
        appLogPrintf("MULTICAST_ADDR   = %x %x\n", (word1 >>  0) & 0xFFFF, word0);
    }
    
    void show_ale_entry_vlan_multicast_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN/Multicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("PORT_MASK        = %x\n", (word2 >>  2) & 0x1FF);
        appLogPrintf("SUPER            = %u\n", (word2 >>  1) & 0x1);
        appLogPrintf("MCAST_FWD_STATE  = %u\n", (word1 >> 30) & 0x3);
        appLogPrintf("ENTRY_TYPE       = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("VLAN_ID          = %u\n", (word1 >> 16) & 0xFFF);
        appLogPrintf("MULTICAST_ADDR   = %x %x\n", (word1 >>  0) & 0xFFFF, word0);
    }
    
    void show_ale_entry_unicast_2g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - Unicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("PORT_NUMBER      = %u\n", (word2 >>  2) & 0x1FF);
        appLogPrintf("BLOCK            = %u\n", (word2 >>  1) & 0x1);
        appLogPrintf("SECURE           = %u\n", (word2 >>  0) & 0x1);
        appLogPrintf("UNICAST_TYPE     = %u\n", (word1 >> 30) & 0x3);
        appLogPrintf("ENTRY_TYPE       = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("UNICAST_ADDR     = %x %x\n", (word1 >>  0) & 0xFFFF, word0);
    }
    
    void show_ale_entry_unicast_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - Unicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("TRUNK            = %u\n", (word2 >> 10) & 0x1);
        appLogPrintf("PORT_NUMBER      = %u\n", (word2 >> 2) & 0xF);
        appLogPrintf("BLOCK            = %u\n", (word2 >> 1) & 0x1);
        appLogPrintf("SECURE           = %u\n", (word2 >> 0) & 0x1);
        appLogPrintf("TOUCH            = %u\n", (word1 >> 31) & 0x1);
        appLogPrintf("AGEABLE          = %u\n", (word1 >> 30) & 0x1);
        appLogPrintf("ENTRY_TYPE       = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("UNICAST_ADDR     = %x %x\n", (word1 >>  0) & 0xFFFF, word0);
    }
    
    void show_ale_entry_oui_unicast_2g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - OUI Unicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("UNICAST_TYPE     = %u\n", (word1 >> 30) & 0x3);
        appLogPrintf("ENTRY_TYPE       = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("UNICAST_OUI      = %x %x\n", (word1 >>  0) & 0xFFFF, (word0 >> 24) & 0xFF);
    }
    
    void show_ale_entry_oui_unicast_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - OUI Unicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("ENTRY_TYPE       = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("UNICAST_OUI      = %x %x\n", (word1 >>  0) & 0xFFFF, (word0 >> 24) & 0xFF);
    }
    
    void show_ale_entry_vlan_unicast_2g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN/Unicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("PORT_NUMBER       = %u\n", (word2 >>  2) & 0x1FF);
        appLogPrintf("BLOCK             = %u\n", (word2 >>  1) & 0x1);
        appLogPrintf("SECURE            = %u\n", (word2 >>  0) & 0x1);
        appLogPrintf("UNICAST_TYPE      = %u\n", (word1 >> 30) & 0x3);
        appLogPrintf("ENTRY_TYPE        = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("VLAN_ID           = %u\n", (word1 >> 16) & 0xFFF);
        appLogPrintf("UNICAST_ADDR      = %x %x\n", (word1 >>  0) & 0xFFFF, word0);
    }
    
    void show_ale_entry_vlan_unicast_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN/Unicast\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("TRUNK             = %u\n", (word2 >> 10) & 0x1);
        appLogPrintf("PORT_NUMBER       = %u\n", (word2 >> 2) & 0x1FF);
        appLogPrintf("BLOCK             = %u\n", (word2 >> 1) & 0x1);
        appLogPrintf("TOUCH             = %u\n", (word1 >> 31) & 0x1);
        appLogPrintf("AGEABLE           = %u\n", (word1 >> 30) & 0x1);
        appLogPrintf("SECURE            = %u\n", (word2 >> 0) & 0x1);
        appLogPrintf("ENTRY_TYPE        = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("VLAN_ID           = %u\n", (word1 >> 16) & 0xFFF);
        appLogPrintf("UNICAST_ADDR      = %x %x\n", (word1 >> 0) & 0xFFFF, word0);
    }
    
    void show_ale_entry_vlan_2g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("ENTRY_TYPE        = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("VLAN_ID           = %u\n", (word1 >> 16) & 0xFFF);
        appLogPrintf("FORCE_UNTAG_EG    = %u\n", (word0 >> 24) & 0x1FF);
        appLogPrintf("REG_MCAST_FLOOD   = %u\n", (word0 >> 16) & 0x1FF);
        appLogPrintf("UNREG_MCAST_FLOOD = %u\n", (word0 >>  8) & 0x1FF);
        appLogPrintf("VLAN_MEMBER_LIST  = %u\n", (word0 >>  0) & 0x1FF);
    }
    
    void show_ale_entry_vlan_inner_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN INNER \n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("ENTRY_TYPE        = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("IVLAN_ID           = %u\n", (word1 >> 16) & 0xFFF);
        appLogPrintf("NO FRAG           = %u\n", (word1 >> 15) & 0x1);
        appLogPrintf("REG_MCAST_FLOOD   = %u\n", (word1 >> 4) & 0x1FF);
        appLogPrintf("VLAN FWD Untagged Egress = %u\n",
                                    ((word1 >> 0U) & 0x100) + (word0 >> 24) & 0x1FF);
        appLogPrintf("LMT NEXT HDR      = %u\n", (word0 >> 23) & 0x1);
        appLogPrintf("UNREG_MCAST_FLOOD = %u\n", (word0 >> 12) & 0x1FF);
        appLogPrintf("VLAN_MEMBER_LIST  = %u\n", (word0 >>  0) & 0x1FF);
    }
    
    void show_ale_entry_vlan_outer_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN OUTER\n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("ENTRY_TYPE        = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("OVLAN_ID           = %u\n", (word1 >> 16) & 0xFFF);
        appLogPrintf("NO FRAG           = %u\n", (word1 >> 15) & 0x1);
        appLogPrintf("REG_MCAST_FLOOD   = %u\n", (word1 >> 4) & 0x1FF);
        appLogPrintf("VLAN FWD Untagged Egress = %u\n",
                                    ((word1 >> 0U) & 0x100) + (word0 >> 24) & 0x1FF);
        appLogPrintf("LMT NEXT HDR      = %u\n", (word0 >> 23) & 0x1);
        appLogPrintf("UNREG_MCAST_FLOOD = %u\n", (word0 >> 12) & 0x1FF);
        appLogPrintf("VLAN_MEMBER_LIST  = %u\n", (word0 >>  0) & 0x1FF);
    }
    
    void show_ale_entry_vlan_ethertype_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN ETHERTYPE \n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("ENTRY_TYPE        = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("ETHERTYPE  = %u\n", (word0 >>  0) & 0xFFFF);
    }
    
    void show_ale_entry_vlan_ip4_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN IPV4 \n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("IGNORE BITS       = %u\n", (word2 >> 1) & 0x1F);
        appLogPrintf("ENTRY_TYPE        = %u\n", (word1 >> 28) & 0x3);
        appLogPrintf("IPV4 ADDR  = %u\n", word0);
    }
    
    void show_ale_entry_vlan_ip6_9g(uint32_t index, uint32_t word0, uint32_t word1, uint32_t word2)
    {
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf(" Entry %u - VLAN IPV6 \n", index);
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("Understanding Gap hence not printing :(");
    }
    
    void cpsw_print_ale_table_2g()
    {
        uint32_t word0, word1, word2;
        uint32_t type;
        int i;
    
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("-------CPSW2G ALE TABLE----------------------\n");
        appLogPrintf("---------------------------------------------\n");
    
        for (i = 0; i < ALE_TABLE_DEPTH_2G; i++)
        {
            cpsw_addr_write_noprint(ALE_TBLCTL_2G, i);
    
            word0 = mdio_addr_read_noprint(ALE_TBLW0_2G);
            word1 = mdio_addr_read_noprint(ALE_TBLW1_2G);
            word2 = mdio_addr_read_noprint(ALE_TBLW2_2G);
    
            if (0)
            {
    
                appLogPrintf("WORD1  = %u\n", word0);
                appLogPrintf("WORD1  = %u\n", word1);
                appLogPrintf("WORD1  = %u\n", word2);
            }
    
            /* ENTRY_TYPE (bits 61:60) */
            type = (word1 >> 28) & 0x3;
    
            if (type == ALE_ENTRY_EMTPY) {
                //appLogPrintf(" Entry %u - Empty\n", i);
            } else if (type == ALE_ENTRY_ADDR) {
                if ((word1 >> 8) & 0x1) {
                    show_ale_entry_multicast_2g(i, word0, word1, word2);
    //            } else if ((word1 >> 30) & 0x3) {
    //                show_ale_entry_oui_unicast(i, word0, word1, word2);
                } else {
                    show_ale_entry_unicast_2g(i, word0, word1, word2);
                }
            } else if (type == ALE_ENTRY_VLAN) {
                show_ale_entry_vlan_2g(i, word0, word1, word2);
            } else if (type == ALE_ENTRY_VLAN_ADDR) {
                if ((word1 >> 8) & 0x1) {
                    show_ale_entry_vlan_multicast_2g(i, word0, word1, word2);
                } else {
                    show_ale_entry_vlan_unicast_2g(i, word0, word1, word2);
                }
            }
        }
    
        appLogPrintf("Completed analysis of %u ALE entries\n", i);
    }
    void cpsw_print_ale_table_ng(int numAleEntries)
    {
        uint32_t word0, word1, word2;
        uint32_t type;
        uint32_t vlanEntryType;
        int i;
    
        appLogPrintf("---------------------------------------------\n");
        appLogPrintf("-------CPSWnG ALE TABLE----------------------\n");
        appLogPrintf("---------------------------------------------\n");
        for (i = 0; i < numAleEntries; i++)
        {
            cpsw_addr_write_noprint(ALE_TBLCTL_9G, i);
    
            word0 = mdio_addr_read_noprint(ALE_TBLW0_9G);
            word1 = mdio_addr_read_noprint(ALE_TBLW1_9G);
            word2 = mdio_addr_read_noprint(ALE_TBLW2_9G);
    
            if (0)
            {
                appLogPrintf("WORD0  = %x\n", word0);
                appLogPrintf("WORD1  = %x\n", word1);
                appLogPrintf("WORD2  = %x\n", word2);
            }
    
            /* ENTRY_TYPE (bits 61:60) */
            type = (word1 >> 28) & 0x3;
    
            if (type == ALE_ENTRY_EMTPY)
            {
                //appLogPrintf(" Entry %u - Empty\n", i);
            }
            else if (type == ALE_ENTRY_ADDR)
            {
                if ((word1 >> 8) & 0x1)
                {
                    show_ale_entry_multicast_9g(i, word0, word1, word2);
                }
                else if ( ((word1 >> 30) & 0x3) == 0x2 )
                {
                   show_ale_entry_oui_unicast_9g(i, word0, word1, word2);
                }
                else
                {
                    show_ale_entry_unicast_9g(i, word0, word1, word2);
                }
            }
            else if (type == ALE_ENTRY_VLAN)
            {
                vlanEntryType = ((word1 >> 30) & 0x3);
                vlanEntryType |= ((word2 >> 0) & 0x1);
    
                if ( 0x0 == vlanEntryType)
                {
                    show_ale_entry_vlan_inner_9g(i, word0, word1, word2);
                }
                else if ( 0x2 == vlanEntryType)
                {
                    show_ale_entry_vlan_outer_9g(i, word0, word1, word2);
                }
                else if ( 0x4 == vlanEntryType)
                {
                    show_ale_entry_vlan_ethertype_9g(i, word0, word1, word2);
                }
                else if ( 0x6 == vlanEntryType )
                {
                    show_ale_entry_vlan_ip4_9g(i, word0, word1, word2);
                }
                else if ((word1 >> 30) & 0x1)
                {
                    show_ale_entry_vlan_ip6_9g(i, word0, word1, word2);
                }
    
            }
            else if (type == ALE_ENTRY_VLAN_ADDR)
            {
                if ((word1 >> 8) & 0x1)
                {
                    show_ale_entry_vlan_multicast_9g(i, word0, word1, word2);
                }
                else {
                    show_ale_entry_vlan_unicast_9g(i, word0, word1, word2);
                }
            }
        }
    
        appLogPrintf("Completed analysis of %u ALE entries\n", i);
    }
    void cpsw_print_ale_table_9g()
    {
        cpsw_print_ale_table_ng(ALE_TABLE_DEPTH_9G);
    }
    void cpsw_9g_statsprint_nonzero(void)
    {
        uint32_t i, regAddr, portnum;
        uint32_t baseAddr;
        uint32_t numMacPorts = CPSW_9G_PORT_NUM;
        appLogPrintf("          STATS          \n");
    
        portnum = 0;
        appLogPrintf("--------------------------------\n");
        appLogPrintf("          PORT%d STATS          \n",portnum);
        appLogPrintf("--------------------------------\n");
        cpsw_print_stat_nonzero("RXGOODFRAMES              ", portnum, (0x0C03A000U));
        cpsw_print_stat_nonzero("RXBROADCASTFRAMES         ", portnum, (0x0C03A004U));
        cpsw_print_stat_nonzero("RXMULTICASTFRAMES         ", portnum, (0x0C03A008U));
        cpsw_print_stat_nonzero("RXCRCERRORS               ", portnum, (0x0C03A010U));
        cpsw_print_stat_nonzero("RXOVERSIZEDFRAMES         ", portnum, (0x0C03A018U));
        cpsw_print_stat_nonzero("RXUNDERSIZEDFRAMES        ", portnum, (0x0C03A020U));
        cpsw_print_stat_nonzero("RXFRAGMENTS               ", portnum, (0x0C03A024U));
        cpsw_print_stat_nonzero("ALE_DROP                  ", portnum, (0x0C03A028U));
        cpsw_print_stat_nonzero("ALE_OVERRUN_DROP          ", portnum, (0x0C03A02CU));
        cpsw_print_stat_nonzero("RXOCTETS                  ", portnum, (0x0C03A030U));
        cpsw_print_stat_nonzero("TXGOODFRAMES              ", portnum, (0x0C03A034U));
        cpsw_print_stat_nonzero("TXBROADCASTFRAMES         ", portnum, (0x0C03A038U));
        cpsw_print_stat_nonzero("TXMULTICASTFRAMES         ", portnum, (0x0C03A03CU));
        cpsw_print_stat_nonzero("TXOCTETS                  ", portnum, (0x0C03A064U));
        cpsw_print_stat_nonzero("OCTETFRAMES64             ", portnum, (0x0C03A068U));
        cpsw_print_stat_nonzero("OCTETFRAMES65T127         ", portnum, (0x0C03A06CU));
        cpsw_print_stat_nonzero("OCTETFRAMES128T255        ", portnum, (0x0C03A070U));
        cpsw_print_stat_nonzero("OCTETFRAMES256T511        ", portnum, (0x0C03A074U));
        cpsw_print_stat_nonzero("OCTETFRAMES512T1023       ", portnum, (0x0C03A078U));
        cpsw_print_stat_nonzero("OCTETFRAMES1024TUP        ", portnum, (0x0C03A07CU));
        cpsw_print_stat_nonzero("NETOCTETS                 ", portnum, (0x0C03A080U));
        cpsw_print_stat_nonzero("RX_BOTTOM_OF_FIFO_DROP    ", portnum, (0x0C03A084U));
        cpsw_print_stat_nonzero("PORTMASK_DROP             ", portnum, (0x0C03A088U));
        cpsw_print_stat_nonzero("RX_TOP_OF_FIFO_DROP       ", portnum, (0x0C03A08CU));
        cpsw_print_stat_nonzero("ALE_RATE_LIMIT_DROP       ", portnum, (0x0C03A090U));
        cpsw_print_stat_nonzero("ALE_VID_INGRESS_DROP      ", portnum, (0x0C03A094U));
        cpsw_print_stat_nonzero("ALE_DA_EQ_SA_DROP         ", portnum, (0x0C03A098U));
        cpsw_print_stat_nonzero("ALE_BLOCK_DROP            ", portnum, (0x0C03A09CU));
        cpsw_print_stat_nonzero("ALE_SECURE_DROP           ", portnum, (0x0C03A0A0U));
        cpsw_print_stat_nonzero("ALE_AUTH_DROP             ", portnum, (0x0C03A0A4U));
        cpsw_print_stat_nonzero("ALE_UNKN_UNI              ", portnum, (0x0C03A0A8U));
        cpsw_print_stat_nonzero("ALE_UNKN_UNI_BCNT         ", portnum, (0x0C03A0ACU));
        cpsw_print_stat_nonzero("ALE_UNKN_MLT              ", portnum, (0x0C03A0B0U));
        cpsw_print_stat_nonzero("ALE_UNKN_MLT_BCNT         ", portnum, (0x0C03A0B4U));
        cpsw_print_stat_nonzero("ALE_UNKN_BRD              ", portnum, (0x0C03A0B8U));
        cpsw_print_stat_nonzero("ALE_UNKN_BRD_BCNT         ", portnum, (0x0C03A0BCU));
        cpsw_print_stat_nonzero("ALE_POL_MATCH             ", portnum, (0x0C03A0C0U));
        cpsw_print_stat_nonzero("ALE_POL_MATCH_RED         ", portnum, (0x0C03A0C4U));
        cpsw_print_stat_nonzero("ALE_POL_MATCH_YELLOW      ", portnum, (0x0C03A0C8U));
        cpsw_print_stat_nonzero("TX_MEMORY_PROTECT_ERROR   ", portnum, (0x0C03A17CU));
    
        for (i = 0; i < 8; i++)
        {
            regAddr = 0x0C03A180U + (i * 0x4U);
            cpsw_print_stat_with_index_nonzero("TX_PRI_REG             ", portnum, i, regAddr);
        }
    
        for (i = 0; i < 8; i++)
        {
            regAddr = 0x0C03A1A0U + (i * 0x4U);
            cpsw_print_stat_with_index_nonzero("TX_PRI_BCNT_REG        ", portnum, i, regAddr);
        }
    
        for (i = 0; i < 8; i++)
        {
            regAddr = 0x0C03A1C0U + (i * 0x4U);
            cpsw_print_stat_with_index_nonzero("TX_PRI_DROP_REG        ", portnum, i, regAddr);
        }
    
        for (i = 0; i < 8; i++)
        {
            regAddr = 0x0C03A1E0U + (i * 0x4U);
            cpsw_print_stat_with_index_nonzero("TX_PRI_DROP_BCNT_REG   ", portnum, i, regAddr);
        }
    
        for (portnum = 1; portnum <= numMacPorts; portnum++)
        {
            appLogPrintf("--------------------------------\n");
            appLogPrintf("          PORT%d STATS          \n",portnum);
            appLogPrintf("--------------------------------\n");
            baseAddr = 0x0C03A200U + ((portnum-1) * 0x200);
    
            cpsw_print_stat_nonzero("RXGOODFRAMES              ", portnum, (baseAddr));
            cpsw_print_stat_nonzero("RXBROADCASTFRAMES         ", portnum, (baseAddr + 0x4U));
            cpsw_print_stat_nonzero("RXMULTICASTFRAMES         ", portnum, (baseAddr + 0x8U));
            cpsw_print_stat_nonzero("RXPAUSEFRAMES             ", portnum, (baseAddr + 0xCU));
            cpsw_print_stat_nonzero("RXCRCERRORS               ", portnum, (baseAddr + 0x10U));
            cpsw_print_stat_nonzero("RXALIGNCODEERRORS         ", portnum, (baseAddr + 0x14U));
            cpsw_print_stat_nonzero("RXOVERSIZEDFRAMES         ", portnum, (baseAddr + 0x18U));
            cpsw_print_stat_nonzero("RXJABBERFRAMES            ", portnum, (baseAddr + 0x1CU));
            cpsw_print_stat_nonzero("RXUNDERSIZEDFRAMES        ", portnum, (baseAddr + 0x20U));
            cpsw_print_stat_nonzero("RXFRAGMENTS               ", portnum, (baseAddr + 0x24U));
            cpsw_print_stat_nonzero("ALE_DROP                  ", portnum, (baseAddr + 0x28U));
            cpsw_print_stat_nonzero("ALE_OVERRUN_DROP          ", portnum, (baseAddr + 0x2CU));
            cpsw_print_stat_nonzero("RXOCTETS                  ", portnum, (baseAddr + 0x30U));
            cpsw_print_stat_nonzero("TXGOODFRAMES              ", portnum, (baseAddr + 0x34U));
            cpsw_print_stat_nonzero("TXBROADCASTFRAMES         ", portnum, (baseAddr + 0x38U));
            cpsw_print_stat_nonzero("TXMULTICASTFRAMES         ", portnum, (baseAddr + 0x3CU));
            cpsw_print_stat_nonzero("TXPAUSEFRAMES             ", portnum, (baseAddr + 0x40U));
            cpsw_print_stat_nonzero("TXDEFERREDFRAMES          ", portnum, (baseAddr + 0x44U));
            cpsw_print_stat_nonzero("TXCOLLISIONFRAMES         ", portnum, (baseAddr + 0x48U));
            cpsw_print_stat_nonzero("TXSINGLECOLLFRAMES        ", portnum, (baseAddr + 0x4CU));
            cpsw_print_stat_nonzero("TXMULTCOLLFRAMES          ", portnum, (baseAddr + 0x50U));
            cpsw_print_stat_nonzero("TXEXCESSIVECOLLISIONS     ", portnum, (baseAddr + 0x54U));
            cpsw_print_stat_nonzero("TXLATECOLLISIONS          ", portnum, (baseAddr + 0x58U));
            cpsw_print_stat_nonzero("RXIPGERROR                ", portnum, (baseAddr + 0x5CU));
            cpsw_print_stat_nonzero("TXCARRIERSENSEERRORS      ", portnum, (baseAddr + 0x60U));
            cpsw_print_stat_nonzero("TXOCTETS                  ", portnum, (baseAddr + 0x64U));
            cpsw_print_stat_nonzero("OCTETFRAMES64             ", portnum, (baseAddr + 0x68U));
            cpsw_print_stat_nonzero("OCTETFRAMES65T127         ", portnum, (baseAddr + 0x6CU));
            cpsw_print_stat_nonzero("OCTETFRAMES128T255        ", portnum, (baseAddr + 0x70U));
            cpsw_print_stat_nonzero("OCTETFRAMES256T511        ", portnum, (baseAddr + 0x74U));
            cpsw_print_stat_nonzero("OCTETFRAMES512T1023       ", portnum, (baseAddr + 0x78U));
            cpsw_print_stat_nonzero("OCTETFRAMES1024TUP        ", portnum, (baseAddr + 0x7CU));
            cpsw_print_stat_nonzero("NETOCTETS                 ", portnum, (baseAddr + 0x80U));
            cpsw_print_stat_nonzero("RX_BOTTOM_OF_FIFO_DROP    ", portnum, (baseAddr + 0x84U));
            cpsw_print_stat_nonzero("PORTMASK_DROP             ", portnum, (baseAddr + 0x88U));
            cpsw_print_stat_nonzero("RX_TOP_OF_FIFO_DROP       ", portnum, (baseAddr + 0x8CU));
            cpsw_print_stat_nonzero("ALE_RATE_LIMIT_DROP       ", portnum, (baseAddr + 0x90U));
            cpsw_print_stat_nonzero("ALE_VID_INGRESS_DROP      ", portnum, (baseAddr + 0x94U));
            cpsw_print_stat_nonzero("ALE_DA_EQ_SA_DROP         ", portnum, (baseAddr + 0x98U));
            cpsw_print_stat_nonzero("ALE_BLOCK_DROP            ", portnum, (baseAddr + 0x9CU));
            cpsw_print_stat_nonzero("ALE_SECURE_DROP           ", portnum, (baseAddr + 0xA0U));
            cpsw_print_stat_nonzero("ALE_AUTH_DROP             ", portnum, (baseAddr + 0xA4U));
            cpsw_print_stat_nonzero("ALE_UNKN_UNI              ", portnum, (baseAddr + 0xA8U));
            cpsw_print_stat_nonzero("ALE_UNKN_UNI_BCNT         ", portnum, (baseAddr + 0xACU));
            cpsw_print_stat_nonzero("ALE_UNKN_MLT              ", portnum, (baseAddr + 0xB0U));
            cpsw_print_stat_nonzero("ALE_UNKN_MLT_BCNT         ", portnum, (baseAddr + 0xB4U));
            cpsw_print_stat_nonzero("ALE_UNKN_BRD              ", portnum, (baseAddr + 0xB8U));
            cpsw_print_stat_nonzero("ALE_UNKN_BRD_BCNT         ", portnum, (baseAddr + 0xBCU));
            cpsw_print_stat_nonzero("ALE_POL_MATCH             ", portnum, (baseAddr + 0xC0U));
            cpsw_print_stat_nonzero("ALE_POL_MATCH_RED         ", portnum, (baseAddr + 0xC4U));
            cpsw_print_stat_nonzero("ALE_POL_MATCH_YELLOW      ", portnum, (baseAddr + 0xC8U));
            cpsw_print_stat_nonzero("TX_MEMORY_PROTECT_ERROR   ", portnum, (baseAddr + 0x17CU));
    
            for (i = 0; i < 8; i++)
            {
                regAddr = (baseAddr + 0x180U) + (i * 0x4U);
                cpsw_print_stat_with_index_nonzero("TX_PRI_REG             ", portnum, i, regAddr);
            }
    
            for (i = 0; i < 8; i++)
            {
                regAddr = (baseAddr + 0x1A0U) + (i * 0x4U);
                cpsw_print_stat_with_index_nonzero("TX_PRI_BCNT_REG        ", portnum, i, regAddr);
            }
    
            for (i = 0; i < 8; i++)
            {
                regAddr = (baseAddr + 0x1C0U) + (i * 0x4U);
                cpsw_print_stat_with_index_nonzero("TX_PRI_DROP_REG        ", portnum, i, regAddr);
            }
    
            for (i = 0; i < 8; i++)
            {
                regAddr = (baseAddr + 0x1E0U) + (i * 0x4U);
                cpsw_print_stat_with_index_nonzero("TX_PRI_DROP_BCNT_REG   ", portnum, i, regAddr);
            }
        }
    }
    
    void Cpsw9g_PrintEnetCtrl()
    {
        int enetCtrl;
        int portNum;
    
       appLogPrintf("\n");
       appLogPrintf("==============================\n");
       appLogPrintf("     CPSW9G MAC Mode Config   \n");
       appLogPrintf("==============================\n");
    
        for (portNum = 0; portNum < CPSW_9G_PORT_NUM; portNum++)
        {
            enetCtrl = mdio_addr_read(MAIN_CTRLMMR_ENET0_CTRL + (portNum * 0x04));
            Cpsw_printCfg(portNum, Cpsw_getMacMod(enetCtrl), Cpsw_getRgmiiId(enetCtrl));
        }
    }
    
    void Board_Cpsw9g_VerifyEnetCtrl()
    {
        int currMacMode, currRgmiiId, enetCtrl, portNum;
    
        for (portNum = 0; portNum < CPSW_9G_PORT_NUM; portNum++)
        {
            enetCtrl = mdio_addr_read(MAIN_CTRLMMR_ENET0_CTRL + (portNum * 0x04));
            currMacMode = Cpsw_getMacMod(enetCtrl);
            currRgmiiId = Cpsw_getRgmiiId(enetCtrl);
    
           appLogPrintf("CPSW9G Port %d \n",portNum);
            if (0U == portNum)
            {
                Cpsw_matchEnetCntlCfg(BOARD_CPSW9G_PORT0_MAC_MODE,
                                       currMacMode,
                                       BOARD_CPSW9G_PORT0_RGMII_ID,
                                       currRgmiiId);
            }
            else if (1U == portNum)
            {
                Cpsw_matchEnetCntlCfg(BOARD_CPSW9G_PORT1_MAC_MODE,
                                       currMacMode,
                                       BOARD_CPSW9G_PORT1_RGMII_ID,
                                       currRgmiiId);
            }
            else if (2U == portNum)
            {
                Cpsw_matchEnetCntlCfg(BOARD_CPSW9G_PORT2_MAC_MODE,
                                       currMacMode,
                                       BOARD_CPSW9G_PORT2_RGMII_ID,
                                       currRgmiiId);
            }
            else if (3U == portNum)
            {
                Cpsw_matchEnetCntlCfg(BOARD_CPSW9G_PORT3_MAC_MODE,
                                       currMacMode,
                                       BOARD_CPSW9G_PORT3_RGMII_ID,
                                       currRgmiiId);
            }
            else if (7U == portNum)
            {
                Cpsw_matchEnetCntlCfg(BOARD_CPSW9G_PORT7_MAC_MODE,
                                       currMacMode,
                                       0U, /* don't care */
                                       currRgmiiId);
            }
            else
            {
               appLogPrintf("   Not configured \n");
            }
        }
       appLogPrintf("\n");
    }
    void Cpsw9g_PrintMACCfg()
    {
        int portNum;
        int portBaseAddr;
    
        for (portNum = 1; portNum < CPSW_9G_MAC_PORT_NUM; portNum++)
        {
            portBaseAddr = CPSW5G_BASE_ADDR + (portNum * 0x1000);
           appLogPrintf("CPSW5G Port %d \n",portNum);
            Cpsw_ng_PrintMACCfg_local(portBaseAddr, 0U);
        }
    }
    
    void cpsw_clear_stat(uint32_t  regAddr)
    {
        uint32_t regVal = RD_MEM_32(regAddr);
        WR_MEM_32(regAddr, regVal);
    }
    
    void cpsw_2g_clear_stats(void)
    {
        uint32_t portnum, baseAddr, numStats;
    
        for (portnum = 0; portnum <= CPSW_2G_PORT_NUM; portnum++)
        {
            baseAddr = 0x4603A000U + (portnum * 0x200);
    
            appLogPrintf("Clearing stats for port[%d]\n",portnum);
            for (numStats = 0; numStats < 128U; numStats++)
            {
                cpsw_clear_stat(baseAddr + (numStats*0x4));
            }
        }
    
        appLogPrintf("--------CLEARED ALL STATS-------\n");
    }
    
    void cpsw_9g_clear_stats(void)
    {
        uint32_t portnum, baseAddr, numStats, numMacPorts;
    		numMacPorts = CPSW_9G_PORT_NUM;
        for (portnum = 0; portnum <= numMacPorts; portnum++)
        {
            baseAddr = 0x0C03A000U + (portnum * 0x200);
    
            appLogPrintf("Clearing stats for port[%d]\n",portnum);
            for (numStats = 0; numStats < 128U; numStats++)
            {
                cpsw_clear_stat(baseAddr + (numStats*0x4));
            }
        }
    
        appLogPrintf("--------CLEARED ALL STATS-------\n");
    }
    
    
    

    This is the interface where I added PVID

    /*A72 -> R5F COMMAND*/
    int32_t HirainMainR5FRemoteServiceHandler(char *service_name, uint32_t cmd, void *prm, uint32_t prm_size, uint32_t flags)
    {
        int32_t rtnVal = IPC_SOK;
        int32_t status = 0;
        int16_t log_index = 0;
    
        Enet_Handle hEnet;
        Enet_IoctlPrms prms;
        uint32_t *data = (uint32_t *)prm;
    
        prm_size = prm_size / 4;
        switch (cmd)
        {
            case HIRAIN_CMD_CPSW2G_ALE_PRINT:
            {
                cpsw_print_ale_table_2g();
                appLogPrintf("HIRAIN_CMD_CPSW2G_ALE_PRINT exec end!\n\n\n\n\n");
            }
            break;
            case HIRAIN_CMD_CPSW9G_ALE_PRINT:
            {
                cpsw_print_ale_table_9g();
                appLogPrintf("HIRAIN_CMD_CPSW9G_ALE_PRINT exec end!\n\n\n\n\n");
            }
            break;
            case HIRAIN_CMD_CPSW9G_VLAN_TEST:
            {
                if (5 != prm_size)
                {
                    appLogPrintf("UnValid prm_size (cmd = %08x, prm_size = %d B\n", cmd, prm_size);
                    break;
                }
                if (data[2] >= 9 || data[2] == 0)
                {
                    appLogPrintf("UnValid Port Num (cmd = %08x, data[0] = %d B\n", cmd, data[2]);
                    break;
                }
    
                CpswAle_VlanEntryInfo inArgs;
                uint32_t outArgs = 0;
    
                memset(&inArgs, 0U, sizeof (CpswAle_VlanEntryInfo));
                inArgs.vlanIdInfo.vlanId = (int16_t)data[1];
                inArgs.vlanIdInfo.tagType = ENET_VLAN_TAG_TYPE_INNER;
                inArgs.vlanMemberList = (1 << CPSW_ALE_MACPORT_TO_ALEPORT(data[2]-1));
                inArgs.unregMcastFloodMask = 0x0;
                inArgs.regMcastFloodMask = CPSW_ALE_ALL_PORTS_MASK;
                inArgs.forceUntaggedEgressMask =  CPSW_ALE_ALL_PORTS_MASK;
                inArgs.noLearnMask = 0U;
                inArgs.vidIngressCheck = true;
                inArgs.limitIPNxtHdr = false;
                inArgs.disallowIPFrag = false;
    
                ENET_IOCTL_SET_INOUT_ARGS(&prms, &inArgs, &outArgs);
                hEnet = Enet_getHandle(ENET_CPSW_9G, 0U);
                status = Enet_ioctl(hEnet, EnetSoc_getCoreId(), CPSW_ALE_IOCTL_ADD_VLAN, &prms);
                if (status != ENET_SOK)
                {
                    appLogPrintf("%s() failed ADD_VLAN ioctl failed: %d\n", __func__, status);
                }
                else
                {
                    appLogPrintf("Valid Port Num (cmd = %08x, PORT_MEMBER List = %d vlan id %d\n", cmd, data[2], data[1]);
                    appLogPrintf("%s()  ADD_VLAN ioctl success: %d\n", __func__, status);
                }
                appLogPrintf("HIRAIN_CMD_CPSW9G_VLAN_TEST exec end!\n\n\n\n\n");
            }
            break;
            case HIRAIN_CMD_CPSW9G_VLAN_REMOVE:
            {
                if (3 != prm_size)
                {
                    appLogPrintf("UnValid prm_size (cmd = %08x, prm_size = %d B\n", cmd, prm_size);
                    break;
                }
                CpswAle_VlanIdInfo inArgs  =
                {
                    .vlanId = (int16_t)data[1],
                };
                inArgs.tagType       = ENET_VLAN_TAG_TYPE_INNER;
                ENET_IOCTL_SET_IN_ARGS(&prms, &inArgs);
                hEnet = Enet_getHandle(ENET_CPSW_9G, 0U);
                status = Enet_ioctl(hEnet, EnetSoc_getCoreId(), CPSW_ALE_IOCTL_REMOVE_VLAN, &prms);
                if (status != ENET_SOK)
                {
                    EnetAppUtils_print("%s: REMOVE_VLAN ioctl failed: %d\n",  __func__,
                                        status);
                }
                appLogPrintf("HIRAIN_CMD_CPSW9G_VLAN_REMOVE exec end!\n\n\n\n\n");
            }
            break;
            case HIRAIN_CMD_CPSW9G_PVID_TEST:
            {
                if (5 != prm_size)
                {
                    appLogPrintf("UnValid prm_size (cmd = %08x, prm_size = %d B\n", cmd, prm_size);
                    break;
                }
                if (data[2] >= 9 || data[2] == 0)
                {
                    appLogPrintf("UnValid Port Num (cmd = %08x, data[2] = %d B\n", cmd, data[2]);
                    break;
                }
                CpswAle_VlanEntryInfo inArgs;
                uint32_t outArgs;
    
                inArgs.vlanIdInfo.vlanId = (int16_t)data[1];
                inArgs.vlanIdInfo.tagType = ENET_VLAN_TAG_TYPE_INNER;
                inArgs.vlanMemberList = (1 << CPSW_ALE_MACPORT_TO_ALEPORT(data[2]-1)) | CPSW_ALE_HOST_PORT_MASK;
                inArgs.unregMcastFloodMask = CPSW_ALE_ALL_PORTS_MASK;
                inArgs.regMcastFloodMask = CPSW_ALE_ALL_PORTS_MASK;
                inArgs.forceUntaggedEgressMask =  0;
                inArgs.noLearnMask = 0U;
                inArgs.vidIngressCheck = true;
                inArgs.limitIPNxtHdr = false;
                inArgs.disallowIPFrag = false;
    
                ENET_IOCTL_SET_INOUT_ARGS(&prms, &inArgs, &outArgs);
                hEnet = Enet_getHandle(ENET_CPSW_9G, 0U);
                status = Enet_ioctl(hEnet, EnetSoc_getCoreId(), CPSW_ALE_IOCTL_ADD_VLAN, &prms);
                if (status != ENET_SOK)
                {
                    appLogPrintf("%s() failed ADD_PVID ioctl failed: %d\n", __func__, status);
                }
                else
                {
                    appLogPrintf("%s()  ADD_VLAN ioctl success: %d,id:%d,port:%d,list:%x\n", __func__, status,data[1],data[2],inArgs.vlanMemberList);
                }
                appLogPrintf("HIRAIN_CMD_CPSW9G_PVID_TEST exec end!\n\n\n\n\n");
            }
            break;
            default:
            {
                status = -1;
                appLogPrintf("UnValid command (cmd = %08x, prm_size = %d B\n", cmd, prm_size);
            }
            break;
        }
    
        return status;
    }
    

    Regards,

    liang

  • Hi,

    From ALE table dump I can see following VLANs configured.
    P0 & P5 -> Inner VLAN 50
    All Ports -> Inner VLAN 300, 406
    P8, P6, P5, P3, P1, P0 -> Inner VLAN 1
    P4, P2, P0 -> Inner VLAN 0
    P3, P0 -> Inner VLAN 100
    P5, P0 -> Inner VLAN 110
    100 & 110 -> Outer VLAN

    Please set "reg_mcast_flood_mask" as similar to VLAN member List because forwarding rules uses this as port mask.



    Also, confirm whether CPSW_ALE_CONTROL(0x0C03E008).ALE_VLAN_AWARE is enabled or not?



    Please check after correcting as per above.

    Best Regards,
    Sudheer