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: CPSW9G ALE mirror

Part Number: TDA4VM

Hi TI expert,

I have a question about CPSW9G ALE mirror feature.

Base: TDA4VM/ SDK8.2/ QNX+RTOS. we use CPSW9G port1, 3, 4 to the outside.
Requirement: Want make port1 as debug port to monitor/grab all cpsw9g netowrk.

I see that there is mirror feature in ALE, My idea is mirror host port, port3, port 4 to port1 seperately.
I can't find example about mirror. I am not sure about CpswAle_PortMirroringCfg configuration of some parameters. such as matchParams.
I try coding myself, but it not work. Could you please provide a example about mirror feature ?
Or could you please help to check my coding issue below?

static int32_t EnetApp_setupPortMirror(Enet_Handle hEnet,
                                       uint32_t coreId,
                                       uint32_t flowId)
{
    Enet_IoctlPrms prms;
    uint32_t outArgs;
    int32_t status = ENET_SOK;
    CpswAle_PortMirroringCfg ptMrInArgs;

    /* Set PORT0-> PORT1 mirror */
    memset(&ptMrInArgs, 0, sizeof(ptMrInArgs));
    ptMrInArgs.srcEn                 = true;
    ptMrInArgs.dstEnEn               = true;
    ptMrInArgs.matchEn               = true;
    ptMrInArgs.dstPortNum            = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_1);
    ptMrInArgs.toPortNum             = CPSW_ALE_HOST_PORT_NUM;
    //ptMrInArgs.matchParams.dstMacAddrInfo.portNum = CPSW_ALE_HOST_PORT_NUM;
    //ptMrInArgs.matchParams.etherType = ETHTYPE_VLAN;
    //ptMrInArgs.matchParams.vlanIdInfo.vlanId  = 0x08;
    //ptMrInArgs.matchParams.vlanIdInfo.tagType = ENET_VLAN_TAG_TYPE_INNER;
    ptMrInArgs.srcPortNumMask        = (CPSW_ALE_HOST_PORT_MASK |
                                        CPSW_ALE_MACPORT_TO_PORTMASK(ENET_MAC_PORT_3) |
                                        CPSW_ALE_MACPORT_TO_PORTMASK(ENET_MAC_PORT_4));

    ENET_IOCTL_SET_INOUT_ARGS(&prms, &ptMrInArgs, &outArgs);
    Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_SET_PORT_MIRROR_CFG, &prms);

    /* Set PORT3-> PORT1 mirror */
    ptMrInArgs.toPortNum             = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_3);
    ENET_IOCTL_SET_INOUT_ARGS(&prms, &ptMrInArgs, &outArgs);
    Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_SET_PORT_MIRROR_CFG, &prms);

    /* Set PORT4-> PORT1 mirror */
    ptMrInArgs.toPortNum             = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_MAC_PORT_4);
    ENET_IOCTL_SET_INOUT_ARGS(&prms, &ptMrInArgs, &outArgs);
    Enet_ioctl(hEnet, gEthAppObj.coreId, CPSW_ALE_IOCTL_SET_PORT_MIRROR_CFG, &prms);
 
    return status;
}


thanks