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-Q1: SDK9.1-CPSW9G-PORT2-VLAN12-FAILED

Part Number: TDA4VM-Q1
Other Parts Discussed in Thread: TDA4VM

Tool/software:

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

HI,TI experts:

1:we use TDA4VM SDK 9.1 CPSW9G use virtual port 0 and macport 2 

vconfig add eth0 12
ifconfig eth0.12 192.168.20.10 netmask 255.255.255.0 up

the code to add entry VLAN 12 

---------------------------------------------
Entry 7 - VLAN INNER
---------------------------------------------
ENTRY_TYPE = 2
IVLAN_ID = 11
NO FRAG = 0
REG_MCAST_FLOOD = 5
VLAN FWD Untagged Egress = 80
LMT NEXT HDR = 0
UNREG_MCAST_FLOOD = 5
VLAN_MEMBER_LIST = 5
---------------------------------------------
Entry 8 - VLAN INNER
---------------------------------------------
ENTRY_TYPE = 2
IVLAN_ID = 12
NO FRAG = 0
REG_MCAST_FLOOD = 5
VLAN FWD Untagged Egress = 80
LMT NEXT HDR = 0
UNREG_MCAST_FLOOD = 5
VLAN_MEMBER_LIST = 5 

Q1: the VLAN FWD Untagged Egress is 80 , is right ?

Q2: how to setup vlan12 to port2? 

  • Haitang

       VLAN FWD Untagged Egress, means VLAN egress out this port without VLAN, if you want the port send out frame without VLAN

       you should configure this port in untagged mode,

       port2 should be added to VLAN 12, make port2 a member of VLAN 12, 

       you can check the ALE table to check whether the VLAN has correctly add port member, and if MAC address is learned with VLAN 12, with tool cpsw_all_reg_print

    Regards

       Semon

  •  Hi,Semon

       VLAN FWD Untagged Egress how to setup ?

  • Hi,Semon

    This is cpsw_all_reg_print tool dump ALE table 

    Entry 8 - VLAN INNER
    ---------------------------------------------
    ENTRY_TYPE = 2
    IVLAN_ID = 12
    NO FRAG = 0
    REG_MCAST_FLOOD = 5
    VLAN FWD Untagged Egress = 80
    LMT NEXT HDR = 0
    UNREG_MCAST_FLOOD = 5
    VLAN_MEMBER_LIST = 5 

  •  VLAN FWD Untagged Egress how to setup ?

    Hi Haitang

        configre the untagged port when adding VLAN, refer to example:

    static void EnetCfgServer_addVlanEntry(char *recvBuff,
                                           char *sendBuff)
    {
    ........
            inArgs.disallowIPFrag           = false;
            inArgs.forceUntaggedEgressMask  = 0U;
            inArgs.limitIPNxtHdr            = false;
            inArgs.noLearnMask              = 0U;
            inArgs.regMcastFloodMask        = vlanMemberMask;
            inArgs.unregMcastFloodMask      = 0U;
            inArgs.vidIngressCheck          = false;
            inArgs.vlanMemberList           = vlanMemberMask;
            inArgs.vlanIdInfo.vlanId        = vlanId;
            inArgs.vlanIdInfo.tagType = ENET_VLAN_TAG_TYPE_INNER;
            ENET_IOCTL_SET_INOUT_ARGS(&prms, &inArgs, &aleEntryIdx);

            status = Enet_ioctl(gEnetCfgServerObj.hEnet,
                                gEnetCfgServerObj.coreId,
                                CPSW_ALE_IOCTL_ADD_VLAN,
                                &prms);
            if (status != ENET_SOK)
            {
                getVlanInArgs.vlanId        = vlanId;
                getVlanInArgs.tagType = ENET_VLAN_TAG_TYPE_INNER;
                ENET_IOCTL_SET_INOUT_ARGS(&prms, &getVlanInArgs, &getVlanOutArgs);

                status = Enet_ioctl(gEnetCfgServerObj.hEnet,
                                    gEnetCfgServerObj.coreId,
                                    CPSW_ALE_IOCTL_LOOKUP_VLAN,
                                    &prms);
    ----------------------------------
  • Hi,semon:

    my code is   inArgs.forceUntaggedEgressMask = 0; 

    but dump the table  

    VLAN FWD Untagged Egress = 80 

    is right ?

  • Hi,Semon 

    Q2: how to setup vlan12 to port2 ?

           6355.vlan_config_patch we use this patch 

      

    From ab6202a076f88e0990e4e782ca8b9b53dfc5e423 Mon Sep 17 00:00:00 2001
    From: Sudheer Doredla <s-doredla@ti.com>
    Date: Wed, 4 Jan 2023 17:30:17 +0530
    Subject: [PATCH] Vlan Configuration
    
    Signed-off-by: Sudheer Doredla <s-doredla@ti.com>
    ---
     .../app_remoteswitchcfg_server/mcu_2_0/main.c | 180 ++++++++++++++++++
     ethfw/ethfw/ethfw.h                           |  37 ++++
     ethfw/ethfw/src/ethfw.c                       |  22 +++
     .../server/include/cpsw_proxy_server.h        |  37 ++++
     .../server/src/cpsw_proxy_server.c            |  33 ++++
     5 files changed, 309 insertions(+)
    
    diff --git a/ethfw/apps/app_remoteswitchcfg_server/mcu_2_0/main.c b/ethfw/apps/app_remoteswitchcfg_server/mcu_2_0/main.c
    index 67b866e7..3b792d67 100644
    --- a/ethfw/apps/app_remoteswitchcfg_server/mcu_2_0/main.c
    +++ b/ethfw/apps/app_remoteswitchcfg_server/mcu_2_0/main.c
    @@ -218,6 +218,8 @@
      *  1 x MAC address for mcu2_1 virtual switch port (AUTOSAR) */
     #define ETHAPP_MAC_ADDR_POOL_SIZE               (6U)
     
    +#define TEST_VID_A72                    (100U)
    +
     /* Define A72_QNX_OS if A72 is running Qnx. Qnx doesn't load resource table. */
     /* #define A72_QNX_OS */
     
    @@ -265,6 +267,14 @@ typedef struct
     /*                          Function Declarations                             */
     /* ========================================================================== */
     
    +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);
    +
     void appLogPrintf(const char *format, ...);
     
     static void EthApp_waitForDebugger(void);
    @@ -854,6 +864,10 @@ static int32_t EthApp_initEthFw(void)
             }
         }
     
    +    /* Set static configuration functions */
    +    ethFwCfg.addStaticCfg = &EthApp_addRemoteCoreStaticCfg;
    +    ethFwCfg.delStaticCfg = &EthApp_delRemoteCoreStaticCfg;
    +
         /* Initialize the EthFw */
         if (status == ETHAPP_OK)
         {
    @@ -877,6 +891,172 @@ static int32_t EthApp_initEthFw(void)
         return status;
     }
     
    +static int32_t EthApp_addMpu10StaticCfg(Enet_Handle hEnet,
    +                                        uint32_t coreId,
    +                                        uint32_t flowId)
    +{
    +    CpswAle_SetPolicerEntryInArgs polInArgs;
    +    CpswAle_SetPolicerEntryOutArgs polOutArgs;
    +    Enet_IoctlPrms prms;
    +    int32_t status;
    +
    +    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);
    +    }
    +
    +    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_3);
    +    polInArgs.policerMatch.portIsTrunk = false;
    +
    +    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 | VLAN policer: %d\n", status);
    +    }
    +    return status;
    +}
    +
    +static void EthApp_delMpu10StaticCfg(Enet_Handle hEnet,
    +                                     uint32_t coreId,
    +                                     uint32_t flowId)
    +{
    +    CpswAle_DelPolicerEntryInArgs polInArgs;
    +    Enet_IoctlPrms prms;
    +    int32_t status;
    +
    +    CpswAle_PolicerEntryOutArgs polOutArgs;
    +    CpswAle_PolicerMatchParams policerMatch;
    +
    +    CpswAle_VlanEntryInfo inArgs;
    +
    +   
    +    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_3);
    +    polInArgs.policerMatch.portIsTrunk = false;
    +
    +    polInArgs.policerMatch.policerMatchEnMask |= CPSW_ALE_POLICER_MATCH_IVLAN;
    +    polInArgs.policerMatch.ivlanId = TEST_VID_A72;
    +
    +    polInArgs.aleEntryMask = CPSW_ALE_POLICER_MATCH_PORT;
    +    polInArgs.policerMatch.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_3);
    +    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 | VLAN policer: %d\n", status);
    +    }
    +
    +    /* Check if any policer entry is available with VLAN entry*/
    +    memset(&policerMatch, 0, sizeof(policerMatch));
    +               
    +    policerMatch.policerMatchEnMask = CPSW_ALE_POLICER_MATCH_PORT;
    +    policerMatch.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_3);
    +    policerMatch.portIsTrunk = false;
    +
    +    policerMatch.policerMatchEnMask |= CPSW_ALE_POLICER_MATCH_IVLAN;
    +    policerMatch.ivlanId = TEST_VID_A72;
    +
    +    ENET_IOCTL_SET_INOUT_ARGS(&prms, &policerMatch, &polOutArgs);
    +
    +    status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_GET_POLICER, &prms);
    +
    +    /* Delete VLAN entry when no policer dependes on VLAN entry*/
    +    if(status != ENET_SOK) 
    +    {
    +        memset(&inArgs, 0U, sizeof (CpswAle_VlanEntryInfo));
    +        inArgs.vlanIdInfo.vlanId = TEST_VID_A72;
    +        inArgs.vlanIdInfo.tagType = ENET_VLAN_TAG_TYPE_INNER;
    +
    +        ENET_IOCTL_SET_IN_ARGS(&prms, &inArgs);
    +
    +        status = Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_REMOVE_VLAN, &prms);
    +
    +        if (status != ENET_SOK)
    +        {
    +            appLogPrintf("Failed to delete VLAN entry: %d\n", status);
    +        }
    +    }
    +    else
    +    {
    +        appLogPrintf("Found policer depends on VLAN entry, keeping entry: %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;
    +    }
    +}
    +
     static int32_t EthApp_initRemoteServices(void)
     {
         int32_t status;
    diff --git a/ethfw/ethfw/ethfw.h b/ethfw/ethfw/ethfw.h
    index 3efe2ede..af441fe1 100644
    --- a/ethfw/ethfw/ethfw.h
    +++ b/ethfw/ethfw/ethfw.h
    @@ -260,6 +260,35 @@ typedef int32_t (*EthFw_setPortCfg)(Enet_MacPort macPort,
                                         EnetPhy_Cfg *phyCfg,
                                         EnetMacPort_LinkCfg *linkCfg);
     
    +/*!
    + * \brief Add static configuration.
    + *
    + * Add static configuration that is applicable only to specific remote cores.
    + *
    + * \param hEnet        Handle to Enet LLD
    + * \param coreId       Remote core's IPC core id
    + * \param flowId       Remote core's flow id
    + *
    + * \return 0 if no error. Negative value otherwise.
    + */
    +typedef int32_t (*EthFw_addStaticCfg)(Enet_Handle hEnet,
    +                                      uint32_t coreId,
    +                                      uint32_t flowId);
    +
    +/*!
    + * \brief Delete static configuration.
    + *
    + * Delete static configuration that is applicable only to specific remote cores.
    + *
    + * \param hEnet        Handle to Enet LLD
    + * \param coreId       Remote core's IPC core id
    + * \param flowId       Remote core's flow id
    + */
    +typedef void (*EthFw_delStaticCfg)(Enet_Handle hEnet,
    +                                   uint32_t coreId,
    +                                   uint32_t flowId);
    +
    +
     /*!
      * \brief Ethernet Firmware configuration
      *
    @@ -307,6 +336,14 @@ typedef struct EthFw_Config_s
         /*! Callback function for application to set port link parameters
          *  (MII, PHY, speed, duplexity, etc) */
         EthFw_setPortCfg setPortCfg;
    +
    +
    +    /* Add static configuration that is applicable only to specific remote cores */
    +    EthFw_addStaticCfg addStaticCfg;
    +
    +    /* Delete static configuration that is applicable only to specific remote cores */
    +    EthFw_delStaticCfg delStaticCfg;
    +
     } EthFw_Config;
     
     /*!
    diff --git a/ethfw/ethfw/src/ethfw.c b/ethfw/ethfw/src/ethfw.c
    index 72888d4a..dc27d58a 100644
    --- a/ethfw/ethfw/src/ethfw.c
    +++ b/ethfw/ethfw/src/ethfw.c
    @@ -227,6 +227,13 @@ typedef struct EthFw_Obj_s
     
         /*! Callback function for application to set port link parameters */
         EthFw_setPortCfg setPortCfg;
    +
    +    /* Add static configuration that is applicable only to specific remote cores */
    +    EthFw_addStaticCfg addStaticCfg;
    +
    +    /* Delete static configuration that is applicable only to specific remote cores */
    +    EthFw_delStaticCfg delStaticCfg;
    +
     } EthFw_Obj;
     
     /* ========================================================================== */
    @@ -812,6 +819,11 @@ void EthFw_initConfigParams(Enet_Type enetType,
     
         memset(config, 0, sizeof(*config));
     
    +    /* Initialize Static config function pointers */
    +    config->addStaticCfg = NULL;
    +    config->delStaticCfg = NULL;
    +
    +
         /* MAC port ownership */
         config->ports = NULL;
         config->numPorts = 0U;
    @@ -874,6 +886,11 @@ EthFw_Handle EthFw_init(Enet_Type enetType,
     
         memset(&gEthFwObj, 0, sizeof(gEthFwObj));
     
    +    /* Save static config function pointers */
    +    gEthFwObj.addStaticCfg = config->addStaticCfg;
    +    gEthFwObj.delStaticCfg = config->delStaticCfg;
    +
    +
         /* Save config parameters */
         gEthFwObj.cpswCfg = config->cpswCfg;
     
    @@ -1083,6 +1100,11 @@ int32_t EthFw_initRemoteConfig(EthFw_Handle hEthFw)
         cfg.dfltVlanIdMacOnlyPorts = gEthFwObj.dfltVlanIdMacOnlyPorts;
         cfg.dfltVlanIdSwitchPorts  = gEthFwObj.dfltVlanIdSwitchPorts;
     
    +    /* Static configuration callbacks */
    +    cfg.addStaticCfg = gEthFwObj.addStaticCfg;
    +    cfg.delStaticCfg = gEthFwObj.delStaticCfg;
    +
    +
         status = CpswProxyServer_init(&cfg);
         if (status != ENET_SOK)
         {
    diff --git a/ethfw/ethremotecfg/server/include/cpsw_proxy_server.h b/ethfw/ethremotecfg/server/include/cpsw_proxy_server.h
    index cc220666..4eabafc3 100644
    --- a/ethfw/ethremotecfg/server/include/cpsw_proxy_server.h
    +++ b/ethfw/ethremotecfg/server/include/cpsw_proxy_server.h
    @@ -291,6 +291,36 @@ typedef struct CpswProxyServer_RsvdMcastCfg_s
         uint32_t numMacAddr;
     } CpswProxyServer_RsvdMcastCfg;
     
    +/*!
    + * \brief Add static configuration.
    + *
    + * Add static configuration that is applicable only to specific remote cores.
    + *
    + * \param hEnet        Handle to Enet LLD
    + * \param coreId       Remote core's IPC core id
    + * \param flowId       Remote core's flow id
    + *
    + * \return 0 if no error. Negative value otherwise.
    + */
    +typedef int32_t (*CpswProxyServer_addStaticCfg)(Enet_Handle hEnet,
    +                                                uint32_t coreId,
    +                                                uint32_t flowId);
    +
    +/*!
    + * \brief Delete static configuration.
    + *
    + * Delete static configuration that is applicable only to specific remote cores.
    + *
    + * \param hEnet        Handle to Enet LLD
    + * \param coreId       Remote core's IPC core id
    + * \param flowId       Remote core's flow id
    + */
    +typedef void (*CpswProxyServer_delStaticCfg)(Enet_Handle hEnet,
    +                                             uint32_t coreId,
    +                                             uint32_t flowId);
    +
    +
    +
     /*!
      * \brief Cpsw Proxy Server Remote Configuration structure
      *
    @@ -349,6 +379,13 @@ typedef struct CpswProxyServer_Config_s
     
         /*! Reserved multicast configuration */
         CpswProxyServer_RsvdMcastCfg rsvdMcastCfg;
    +
    +    /* Add static configuration that is applicable only to specific remote cores */
    +    CpswProxyServer_addStaticCfg addStaticCfg;
    +
    +    /* Delete static configuration that is applicable only to specific remote cores */
    +    CpswProxyServer_delStaticCfg delStaticCfg;
    +
     } CpswProxyServer_Config_t;
     
     /*!
    diff --git a/ethfw/ethremotecfg/server/src/cpsw_proxy_server.c b/ethfw/ethremotecfg/server/src/cpsw_proxy_server.c
    index 497c2043..76f92c6f 100644
    --- a/ethfw/ethremotecfg/server/src/cpsw_proxy_server.c
    +++ b/ethfw/ethremotecfg/server/src/cpsw_proxy_server.c
    @@ -189,6 +189,14 @@ typedef struct CpswProxyServer_Obj_s
         CpswProxyServer_SharedMcastTable      sharedMcastTbl;
         CpswProxyServer_FilterAddMacSharedCb  filterAddMacSharedCb;
         CpswProxyServer_FilterDelMacSharedCb  filterDelMacSharedCb;
    +
    +
    +    /* Add static configuration that is applicable only to specific remote cores */
    +    CpswProxyServer_addStaticCfg addStaticCfg;
    +
    +    /* Delete static configuration that is applicable only to specific remote cores */
    +    CpswProxyServer_delStaticCfg delStaticCfg;
    +
         uint32_t alePortMask;
         uint32_t aleMacOnlyPortMask;
         uint16_t dfltVlanIdMacOnlyPorts;
    @@ -758,6 +766,18 @@ static int32_t CpswProxyServer_registerMacHandlerCb(EthRemoteCfg_VirtPort virtPo
                                                     flow_idx_offset);
         }
     
    +    if (ENET_SOK == status)
    +    {
    +        if (hProxyServer->addStaticCfg != NULL)
    +        {
    +            status = hProxyServer->addStaticCfg(hEnet, host_id, flow_idx_offset);
    +            if (ENET_SOK != status)
    +            {
    +                appLogPrintf("Failed to add static config for coreId=%u: %d\n", host_id, status);
    +            }
    +        }
    +    }
    +
         return CPSWPROXY_ENET2RPMSG_ERR(status);
     }
     
    @@ -768,12 +788,15 @@ static int32_t CpswProxyServer_unregisterMacHandlerCb(EthRemoteCfg_VirtPort virt
                                                           u8 *mac_address,
                                                           uint32_t flow_idx)
     {
    +    CpswProxyServer_Obj *hProxyServer;
         Enet_Handle hEnet = (Enet_Handle)((uintptr_t)handle);
         Enet_MacPort macPort = EthRemoteCfg_getMacPort(virtPort);
         bool isSwitchPort = EthRemoteCfg_isSwitchPort(virtPort);
         uint32_t start_flow_idx, flow_idx_offset;
         int32_t status;
     
    +    hProxyServer = CpswProxyServer_getHandle();
    +
         CpswProxyServer_validateHandle(hEnet);
         EnetAppUtils_absFlowIdx2FlowIdxOffset(hEnet, host_id, flow_idx, &start_flow_idx, &flow_idx_offset);
         appLogPrintf("Function:%s,HostId:%u,Handle:%p,CoreKey:%x, MacAddress:%x:%x:%x:%x:%x:%x, FlowIdx:%u, FlowIdOffset:%u\n",
    @@ -808,6 +831,13 @@ static int32_t CpswProxyServer_unregisterMacHandlerCb(EthRemoteCfg_VirtPort virt
                                                       start_flow_idx,
                                                       flow_idx_offset);
         }
    +    if (ENET_SOK == status)
    +    {
    +	if (hProxyServer->delStaticCfg != NULL)
    +	{
    +	    hProxyServer->delStaticCfg(hEnet, host_id, flow_idx_offset);
    +	}
    +    }
     
         return CPSWPROXY_ENET2RPMSG_ERR(status);
     }
    @@ -2423,6 +2453,9 @@ int32_t CpswProxyServer_init(CpswProxyServer_Config_t *cfg)
         appLogPrintf("CpswProxyServer: initialization %s (core: mcu2_0)\r\n",
                      (status == CPSWPROXYSERVER_SOK) ? "completed" : "failed");
     
    +    hProxyServer->addStaticCfg = cfg->addStaticCfg;
    +    hProxyServer->delStaticCfg = cfg->delStaticCfg;
    +
         return status;
     }
     
    -- 
    2.17.1
    
    

    can work on SDK 9.1 ?

  • Haitang

        it should be ok to run on SDK9.1, these IOCTLs are supported on sdk9.1

        you can refer to following function in sdk 9.1.

    ----------------------

    static int32_t EthFwVlan_setupVlan(Enet_Handle hEnet,
                                       uint16_t vlanId,
                                       uint32_t memberMask,
                                       uint32_t regMcastFloodMask,
                                       uint32_t unregMcastFloodMask,
                                       uint32_t untagMask)
    {
        CpswAle_VlanEntryInfo vlanInArgs;
        CpswAle_SetMcastEntryInArgs mcastInArgs;
        Enet_IoctlPrms prms;
        uint32_t aleEntry;
        uint32_t coreId;
        int32_t status = ENET_SOK;

        coreId = EnetSoc_getCoreId();

        /* Add ALE VLAN entry */
        memset(&vlanInArgs, 0U, sizeof (CpswAle_VlanEntryInfo));
        vlanInArgs.vlanIdInfo.vlanId       = vlanId;
        vlanInArgs.vlanIdInfo.tagType      = ENET_VLAN_TAG_TYPE_INNER;
        vlanInArgs.vlanMemberList          = memberMask;
        vlanInArgs.regMcastFloodMask       = regMcastFloodMask;
        vlanInArgs.unregMcastFloodMask     = unregMcastFloodMask;
        vlanInArgs.forceUntaggedEgressMask = untagMask;
        vlanInArgs.noLearnMask             = 0U;
        vlanInArgs.vidIngressCheck         = true;
        vlanInArgs.limitIPNxtHdr           = false;
        vlanInArgs.disallowIPFrag          = true;

        ENET_IOCTL_SET_INOUT_ARGS(&prms, &vlanInArgs, &aleEntry);

        status = Enet_ioctl(hEnet, coreId, CPSW_ALE_IOCTL_ADD_VLAN, &prms);
        ETHFWTRACE_ERR_IF((status != ENET_SOK), status, "Failed to add ALE VLAN %u entry", vlanId);

        /* Add broadcast entry for the VLAN */
        if (status == ENET_SOK)
        {
            EnetUtils_copyMacAddr(&mcastInArgs.addr.addr[0], &gEthFwVlan_bcastAddr[0U]);
            mcastInArgs.addr.vlanId     = vlanId;
            mcastInArgs.info.super      = false;
            mcastInArgs.info.fwdState   = CPSW_ALE_FWDSTLVL_FWD;
            mcastInArgs.info.portMask   = memberMask;
            mcastInArgs.info.numIgnBits = 0U;

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

            status = Enet_ioctl(hEnet, coreId, CPSW_ALE_IOCTL_ADD_MCAST, &prms);
            ETHFWTRACE_ERR_IF((status != ENET_SOK), status, "Failed to add VLAN %u bcast ALE entry", vlanId);
        }

        return status;
    }
    -------------------

    Regards

       Semon

  • Hi,Semon:

            VLAN join EthFwVlan_join in SDK9.1 ,we cant find linux clinet driver to add host port VLAN member 

            

  • VLAN join EthFwVlan_join in SDK9.1 ,we cant find linux clinet driver to add host port VLAN member 

    when call EthFwVlan_join to add VLAN in RTOS, port member should be added when calling  EthFwVlan_join 

    Regards

       Semon

  • Hi,Semon

    we add the gEthApp_sharedMcastCfgTable  like below:

    static EthFwMcast_McastCfg gEthApp_sharedMcastCfgTable[] =
    {
    {
    /* MCast IP ADDR: 224.0.0.118 */
    .macAddr = {0x01, 0x00, 0x5E, 0x00, 0x00, 0x76},
    .vlanId = 3U,
    .portMask = ETHAPP_DFLT_PORT_MASK,
    .virtPortMask = ETHAPP_DFLT_VIRT_PORT_MASK,
    },
    {
    /* MCast IP ADDR: 224.0.0.119 */
    .macAddr = {0x01, 0x00, 0x5E, 0x00, 0x00, 0x77},
    .vlanId = 4U,
    .portMask = ETHAPP_DFLT_PORT_MASK,
    .virtPortMask = ETHAPP_DFLT_VIRT_PORT_MASK,
    },
    {
    /* MCast IP ADDR: 224.0.0.121 */
    .macAddr = {0x01, 0x00, 0x5E, 0x00, 0x00, 0x79},
    .vlanId = 5U,
    .portMask = ETHAPP_DFLT_PORT_MASK,
    .virtPortMask = ETHAPP_DFLT_VIRT_PORT_MASK,
    },
    {
    /* MCast IP ADDR: 224.0.0.122 */
    .macAddr = {0x01, 0x00, 0x5E, 0x00, 0x00, 0x7A},
    .vlanId = 6U,
    .portMask = ETHAPP_DFLT_PORT_MASK,
    .virtPortMask = ETHAPP_DFLT_VIRT_PORT_MASK,
    },
    {
    /* MCast IP ADDR: 224.0.0.123 */
    .macAddr = {0x01, 0x00, 0x5E, 0x00, 0x00, 0x7B},
    .vlanId = 7U,
    .portMask = ETHAPP_DFLT_PORT_MASK,
    .virtPortMask = ETHAPP_DFLT_VIRT_PORT_MASK,
    },
    {
    /* MCast IP ADDR: 224.0.0.124 */
    .macAddr = {0x01, 0x00, 0x5E, 0x00, 0x00, 0x7c},
    .vlanId = 8U,
    .portMask = ETHAPP_DFLT_PORT_MASK,
    .virtPortMask = ETHAPP_DFLT_VIRT_PORT_MASK,
    },
    {
    /* MCast IP ADDR: 224.0.0.125 */
    .macAddr = {0x01, 0x00, 0x5E, 0x00, 0x00, 0x7D},
    .vlanId = 11U,
    .portMask = ETHAPP_DFLT_PORT_MASK,
    .virtPortMask = ETHAPP_DFLT_VIRT_PORT_MASK,
    },

    };

    the MCU2_0 LOG below 


    [MCU2_0] 45.778044 s: ETHFW: 01:00:5e:00:00:76
    [MCU2_0] 45.778081 s: ETHFW: 01:00:5e:00:00:77
    [MCU2_0] 45.778111 s: ETHFW: 01:00:5e:00:00:79
    [MCU2_0] 45.778141 s: ETHFW: 01:00:5e:00:00:7a
    [MCU2_0] 45.778169 s: ETHFW: 01:00:5e:00:00:7b
    [MCU2_0] 45.778199 s: ETHFW: 01:00:5e:00:00:7c
    [MCU2_0] 45.778227 s: ETHFW: 01:00:5e:00:00:7d
    [MCU2_0] 45.778255 s: ETHFW: 01:00:5e:00:00:7e
    [MCU2_0] 45.778285 s: ETHFW: 01:80:c2:00:00:00
    [MCU2_0] 45.778313 s: ETHFW: 01:80:c2:00:00:03

    but use the cpsw_all_reg_print tool dump the ALE table below :


    Entry 13 - VLAN/Multicast
    ---------------------------------------------
    PORT_MASK = 15
    SUPER = 0
    MCAST_FWD_STATE = 0
    ENTRY_TYPE = 3
    VLAN_ID = 7
    MULTICAST_ADDR = ffff ffffffff
    ---------------------------------------------

    ---------------------------------------------
    Entry 17 - VLAN/Multicast
    ---------------------------------------------
    PORT_MASK = 15
    SUPER = 0
    MCAST_FWD_STATE = 0
    ENTRY_TYPE = 3
    VLAN_ID = 11
    MULTICAST_ADDR = ffff ffffffff
    ---------------------------------------------

    ---------------------------------------------
    Entry 15 - VLAN/Multicast
    ---------------------------------------------
    PORT_MASK = 15
    SUPER = 0
    MCAST_FWD_STATE = 0
    ENTRY_TYPE = 3
    VLAN_ID = 8
    MULTICAST_ADDR = ffff ffffffff
    ---------------------------------------------

    the muticast add is 0xffffffffff  is right ?

  • static EthFwMcast_McastCfg gEthApp_sharedMcastCfgTable[[/quote]

    Hi Haitang

         it's incorrect, you can compare it to the default multicast group added by ETHFW itself, it should be the multicast-MAC added 

         not all "" MAC address

    Regards

       Semon

  • Hi,Semon:

    please update cpsw_ale_entry_print the tools ,because we dont have this tools ,thanks。

  • please update cpsw_ale_entry_print the tools ,because we dont have this tools ,thanks。

    Haitao

        please refer to following link:

    (+) [FAQ] TDA4VM: How to Configure CPSW 5G/9G ALE - Processors forum - Processors - TI E2E support forums

    you can download the source file cpsw_ale_print.c and compile it

  • Hi,Semon

    we add the user muticast address but not show on the ALE table,you can try add the new muticast address 。Thx

  • we add the user muticast address but not show on the ALE table,you can try add the new muticast address 。Thx

    Hi Haitang

        verified on SDK9.1 Jacinto7,

      multicast frame can be received on A72 Linux

      see following debug log:

    ------------------------

    8 packets captured
    8 packets received by filter
    0 packets drop[ 468.766973] device eth1 left promiscuous mode
    ped by kernel
    [ 468.776654] audit: type=1700 audit(1651168211.460:16): dev=eth1 prom=0 old_prom=256 auid=4294967295 uid=0 gid=0 ses=4294967295
    root@j7200-evm:/home# ifconfig eth1
    eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 192.168.1.220 netmask 255.255.255.0 broadcast 192.168.1.255
    inet6 fe80::7250:55ff:fe71:17c8 prefixlen 64 scopeid 0x20<link>
    ether 70:50:55:71:17:c8 txqueuelen 1000 (Ethernet)
    RX packets 58 bytes 6391 (6.2 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 96 bytes 12998 (12.6 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    root@j7200-evm:/home#
    root@j7200-evm:/home#
    root@j7200-evm:/home# ip maddr show
    1: lo
    inet 224.0.0.251
    inet 224.0.0.1
    inet6 ff02::fb
    inet6 ff02::1
    inet6 ff01::1
    2: eth0
    link 33:33:00:00:00:01
    link 01:00:5e:00:00:01
    inet 224.0.0.1
    inet6 ff02::1
    inet6 ff01::1
    3: eth1
    link 33:33:00:00:00:01 users 2
    link 01:00:5e:00:00:01 users 2
    link 33:33:ff:71:17:c8 users 2
    link 01:80:c2:00:00:00 users 2
    link 01:80:c2:00:00:03 users 2
    link 01:80:c2:00:00:0e users 2
    link 33:33:00:00:00:fb users 2
    link 33:33:00:01:00:03 users 2
    link 01:00:5e:00:00:fb users 2
    link 01:00:5e:00:00:fc users 2
    inet 224.0.0.252
    inet 224.0.0.251
    inet 224.0.0.1
    inet6 ff02::1:3
    inet6 ff02::fb
    inet6 ff02::1:ff71:17c8
    inet6 ff02::1 users 2
    inet6 ff01::1
    4: eth2
    link 33:33:00:00:00:01
    link 01:00:5e:00:00:01
    link 33:33:ff:00:64:5c
    link 01:80:c2:00:00:00
    link 01:80:c2:00:00:03
    link 01:80:c2:00:00:0e
    link 33:33:00:00:00:fb
    link 33:33:00:01:00:03
    inet 224.0.0.1
    inet6 ff02::1:3
    inet6 ff02::fb
    inet6 ff02::1:ff00:645c
    inet6 ff02::1 users 2
    inet6 ff01::1
    root@j7200-evm:/home#
    root@j7200-evm:/home# ip maddr add eth1 01:00:5e:01:01:a0 dev eth1
    Error: Invalid address length 1 - must be 6 bytes
    root@j7200-evm:/home# ip maddr add 01:00:5e:01:01:a0 dev eth1
    root@j7200-evm:/home#
    root@j7200-evm:/home# ip maddr show
    1: lo
    inet 224.0.0.251
    inet 224.0.0.1
    inet6 ff02::fb
    inet6 ff02::1
    inet6 ff01::1
    2: eth0
    link 33:33:00:00:00:01
    link 01:00:5e:00:00:01
    inet 224.0.0.1
    inet6 ff02::1
    inet6 ff01::1
    3: eth1
    link 33:33:00:00:00:01 users 2
    link 01:00:5e:00:00:01 users 2
    link 33:33:ff:71:17:c8 users 2
    link 01:80:c2:00:00:00 users 2
    link 01:80:c2:00:00:03 users 2
    link 01:80:c2:00:00:0e users 2
    link 33:33:00:00:00:fb users 2
    link 33:33:00:01:00:03 users 2
    link 01:00:5e:00:00:fb users 2
    link 01:00:5e:00:00:fc users 2
    link 01:00:5e:01:01:a0 users 2 static
    inet 224.0.0.252
    inet 224.0.0.251
    inet 224.0.0.1
    inet6 ff02::1:3
    inet6 ff02::fb
    inet6 ff02::1:ff71:17c8
    inet6 ff02::1 users 2
    inet6 ff01::1
    4: eth2
    link 33:33:00:00:00:01
    link 01:00:5e:00:00:01
    link 33:33:ff:00:64:5c
    link 01:80:c2:00:00:00
    link 01:80:c2:00:00:03
    link 01:80:c2:00:00:0e
    link 33:33:00:00:00:fb
    link 33:33:00:01:00:03
    inet 224.0.0.1
    inet6 ff02::1:3
    inet6 ff02::fb
    inet6 ff02::1:ff00:645c
    inet6 ff02::1 users 2
    inet6 ff01::1
    root@j7200-evm:/home# tcpdump -i eth1 -xx
    [ 787.914576] device eth1 entered promiscuous mode
    [ 787.919305] audit: type=1700 audit(1651168530.596:17): dev=eth1 prom=256 old_prom=0 auid=4294967295 uid=0 gid=0 ses=4294967295
    [ 787.930770] audit: type=1300 audit(1651168530.596:17): arch=c00000b7 syscall=208 success=yes exit=0 a0=4 a1=107 a2=1 a3=ffffea275af0 items=0 ppid=762 pid=803 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=ttyS2 ses=4294967295 comm="tcpdump" exe="/usr/bin/tcpdump" key=(null)
    [ 787.957523] audit: type=1327 audit(1651168530.596:17): proctitle=74637064756D70002D690065746831002D7878
    tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
    listening on eth1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
    17:55:39.023538 IP 192.168.1.110.4563 > 192.168.1.250.7658: UDP, length 879
    0x0000: 0100 5e01 01a0 bce9 2fb2 7d3e 0800 4500
    0x0010: 038b 1234 4000 ff11 e174 c0a8 016e c0a8
    0x0020: 01fa 11d3 1dea 0377 0896 4848 4848 4848
    0x0030: 4848 4848 4848 4848 4848 4848 4848 4848
    0x0040: 4848 4848 4848 4848 4848 4848 4848 4848

    ----------------

    Regards

       Semon

  • Haitang

    sdk 9.1, ALE works with VLAN+MAC mode, so multicast group should be added with correct VLAN ID, and ALE should have the VLAN+multicast-address entry in the ALE table

    Regards

       Semon

  • Hi,

    In SDK 9.1 the Linux virtual client driver does not support VLAN. We had a requirement to support VLAN on client driver. It will be available in 10.1 release.

    Once it is available, you can back port the VLAN feature.

    As of now, we can avoid ALE entry creation at ETHFW with VLAN3 (default switch port VLAN). So, the entry will be MAC only entry.
    Please integrate the below change in ETHFW for Multicast MAC only entry creation.



    Also, make sure that client JOIN the VLAN of required with ETHFW or Add Static VLAN entry in ETHFW.

    Best Regards,
    Sudheer