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.

AM2732: How to configure the code to receive the non-zero priority VLAN message?

Genius 13655 points
Part Number: AM2732

Hello Champs,

SW: mcu_plus_sdk_am273x_08_01_00_34

Customer ran C:\ti\mcu_plus_sdk_am273x_08_03_00_18\examples\networking\enet_loopback example, he can receive the message of VLAN with priority=0. But he can't receive the message of VLAN with non-zero priority. 

How to configure the code to receive the non-zero priority VLAN message?

Thanks
Rgds
Shine

  • Hi Shine,

    For receiving the non-zero priority VLAN, you need to add a policer entry with required priority using CPSW_ALE_IOCTL_SET_POLICER  IOCTL.

    AM273x MCU+ SDK: Enet LLD IOCTL interface (ti.com)

    AM273x MCU+ SDK: CpswAle_PolicerMatchParams Struct Reference (ti.com)

    AM273x MCU+ SDK: CPSW Address Lookup Engine (ALE) (ti.com)

    For using the Enet IOCTLs, you can refer to existing examples in mcu_plus_sdk_am273x_08_03_00_18\examples\networking.

    Regards,

    Prasad

  • Hello Shine,

    Please ignore my previous response. I assumed you made changed to loopback code to enable specific priority handling.

    Regarding your issue, can you please share how you send non-zero priority messages? Did you modify loopback example to create new VLAN packets?

    Can you please share log and CPSW statistics (you can print stats using below)?

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1040141/faq-mcu-plus-sdk-am243x-how-do-i-get-cpsw-diagnostic-statistics-using-debug-gels-in-mcu-sdk-enet-lld 

    Regards,

    Prasad

  • Hi Prasad,

    Thanks for your great support. 

    Customer removed POLICER, the MSS_CPSW base address is set to 0x07000000, below is the log:

    Cortex_R5_0: GEL Output: --->>> CPSW Gel Load In Progress... <<<---
    Cortex_R5_0: GEL Output: --->>> CPSW Gel Load DONE! <<<---
    Cortex_R5_0: GEL Output: STATS
    Cortex_R5_0: GEL Output: --------------------------------
    Cortex_R5_0: GEL Output: PORT0 STATS
    Cortex_R5_0: GEL Output: --------------------------------
    Cortex_R5_0: GEL Output: STAT_0_RXGOODFRAMES = 0x0000001C
    Cortex_R5_0: GEL Output: STAT_0_RXBROADCASTFRAMES = 0x0000001C
    Cortex_R5_0: GEL Output: STAT_0_RXOCTETS = 0x00000B98
    Cortex_R5_0: GEL Output: STAT_0_TXGOODFRAMES = 0x00000019
    Cortex_R5_0: GEL Output: STAT_0_TXBROADCASTFRAMES = 0x00000010
    Cortex_R5_0: GEL Output: STAT_0_TXMULTICASTFRAMES = 0x00000009
    Cortex_R5_0: GEL Output: STAT_0_TXOCTETS = 0x000009CF
    Cortex_R5_0: GEL Output: STAT_0_OCTETFRAMES65T127 = 0x00000034
    Cortex_R5_0: GEL Output: STAT_0_OCTETFRAMES128T255 = 0x00000001
    Cortex_R5_0: GEL Output: STAT_0_NETOCTETS = 0x00001567
    Cortex_R5_0: GEL Output: STAT_0_ALE_UNKN_BRD = 0x00000003
    Cortex_R5_0: GEL Output: STAT_0_ALE_UNKN_BRD_BCNT = 0x0000013E
    Cortex_R5_0: GEL Output: --------------------------------
    Cortex_R5_0: GEL Output: PORT1 STATS
    Cortex_R5_0: GEL Output: --------------------------------
    Cortex_R5_0: GEL Output: STAT_1_RXGOODFRAMES = 0x00000019
    Cortex_R5_0: GEL Output: STAT_1_RXBROADCASTFRAMES = 0x00000010
    Cortex_R5_0: GEL Output: STAT_1_RXMULTICASTFRAMES = 0x00000009
    Cortex_R5_0: GEL Output: STAT_1_RXOCTETS = 0x000009CF
    Cortex_R5_0: GEL Output: STAT_1_TXGOODFRAMES = 0x0000001C
    Cortex_R5_0: GEL Output: STAT_1_TXBROADCASTFRAMES = 0x0000001C
    Cortex_R5_0: GEL Output: STAT_1_TXOCTETS = 0x00000B98
    Cortex_R5_0: GEL Output: STAT_1_OCTETFRAMES65T127 = 0x00000034
    Cortex_R5_0: GEL Output: STAT_1_OCTETFRAMES128T255 = 0x00000001
    Cortex_R5_0: GEL Output: STAT_1_NETOCTETS = 0x00001567
    Cortex_R5_0: GEL Output: STAT_1_ALE_UNKN_MLT = 0x00000002
    Cortex_R5_0: GEL Output: STAT_1_ALE_UNKN_MLT_BCNT = 0x00000105
    Cortex_R5_0: GEL Output: STAT_1_ALE_UNKN_BRD = 0x00000001
    Cortex_R5_0: GEL Output: STAT_1_ALE_UNKN_BRD_BCNT = 0x0000006A
    Cortex_R5_0: GEL Output: STAT_1_TX_PRI_REG [0]= 0x0000001C
    Cortex_R5_0: GEL Output: STAT_1_TX_PRI_BCNT_REG [0]= 0x00000B98
    Cortex_R5_0: GEL Output: STATS
    Cortex_R5_0: GEL Output: --------------------------------
    Cortex_R5_0: GEL Output: PORT0 STATS
    Cortex_R5_0: GEL Output: --------------------------------
    Cortex_R5_0: GEL Output: STAT_0_RXGOODFRAMES = 0x00000021
    Cortex_R5_0: GEL Output: STAT_0_RXBROADCASTFRAMES = 0x00000021
    Cortex_R5_0: GEL Output: STAT_0_RXOCTETS = 0x00000DAA
    Cortex_R5_0: GEL Output: STAT_0_TXGOODFRAMES = 0x00000025
    Cortex_R5_0: GEL Output: STAT_0_TXBROADCASTFRAMES = 0x00000016
    Cortex_R5_0: GEL Output: STAT_0_TXMULTICASTFRAMES = 0x0000000F
    Cortex_R5_0: GEL Output: STAT_0_TXOCTETS = 0x00000E23
    Cortex_R5_0: GEL Output: STAT_0_OCTETFRAMES65T127 = 0x00000045
    Cortex_R5_0: GEL Output: STAT_0_OCTETFRAMES128T255 = 0x00000001
    Cortex_R5_0: GEL Output: STAT_0_NETOCTETS = 0x00001BCD
    Cortex_R5_0: GEL Output: STAT_0_ALE_UNKN_BRD = 0x00000003
    Cortex_R5_0: GEL Output: STAT_0_ALE_UNKN_BRD_BCNT = 0x0000013E
    Cortex_R5_0: GEL Output: --------------------------------
    Cortex_R5_0: GEL Output: PORT1 STATS
    Cortex_R5_0: GEL Output: --------------------------------
    Cortex_R5_0: GEL Output: STAT_1_RXGOODFRAMES = 0x00000025
    Cortex_R5_0: GEL Output: STAT_1_RXBROADCASTFRAMES = 0x00000016
    Cortex_R5_0: GEL Output: STAT_1_RXMULTICASTFRAMES = 0x0000000F
    Cortex_R5_0: GEL Output: STAT_1_RXOCTETS = 0x00000E23
    Cortex_R5_0: GEL Output: STAT_1_TXGOODFRAMES = 0x00000021
    Cortex_R5_0: GEL Output: STAT_1_TXBROADCASTFRAMES = 0x00000021
    Cortex_R5_0: GEL Output: STAT_1_TXOCTETS = 0x00000DAA
    Cortex_R5_0: GEL Output: STAT_1_OCTETFRAMES65T127 = 0x00000045
    Cortex_R5_0: GEL Output: STAT_1_OCTETFRAMES128T255 = 0x00000001
    Cortex_R5_0: GEL Output: STAT_1_NETOCTETS = 0x00001BCD
    Cortex_R5_0: GEL Output: STAT_1_ALE_UNKN_MLT = 0x00000002
    Cortex_R5_0: GEL Output: STAT_1_ALE_UNKN_MLT_BCNT = 0x00000105
    Cortex_R5_0: GEL Output: STAT_1_ALE_UNKN_BRD = 0x00000001
    Cortex_R5_0: GEL Output: STAT_1_ALE_UNKN_BRD_BCNT = 0x0000006A
    Cortex_R5_0: GEL Output: STAT_1_TX_PRI_REG [0]= 0x00000021
    Cortex_R5_0: GEL Output: STAT_1_TX_PRI_BCNT_REG [0]= 0x00000DAA

    Thanks
    Rgds
    Shine

  • Hi Shine, 

    Our experts are on leave please expect some delay in response. We will get back to you before end of next week.

    BR

    Nilabh

  • Hi Nilabh,

    Thanks for your great support. 

    Update some information. 

    Customer found that ALE_STATUS is always zero which may cause the POLICER match issue. 

    How to make POLCNTDIV8 is non zero?

    Thanks.
    Rgds
    Shine

  • Hi Shine,

    Apologies for delay in response.

    How to make POLCNTDIV8 is non zero?

    This is a read only register.

    Let me get back by tomorrow with more info on this.

    BR

    Nilabh A.

  • Hi Shine,

    To debug this issue further I would need the below info here. As the example by default does not uses sample vlan packets and its configured for vlan unaware mode. And the example is configured for 0 vlan id UNICAST packets reception.

    Regarding your issue, can you please share how you send non-zero priority messages? Did you modify loopback example to create new VLAN packets?

    For speeding up debug process, Can you please share example project(modified for vlan handling) by customer.

    BR

    Nilabh A.

  • Hi Nilabh,

    Thanks for your support.

    Customer defined the structures for the protocol header including the vlan, then added these structures to ethernet buf, and used send() API to send it. 

    Thanks

    Rgds
    Shine

  • Hi Shine,

    Let me check it on my end and get back on it.

    BR

    Nilabh A.

  • Hi Nilabh,

    Thanks for your help.

    Any updates are appreciated.

    Thanks
    Rgds
    Shine

  • Hi Shine,

    Apologies for delay in response, I will get back by end of this week.

    BR

    Nilabh A.

  • Hi Nilabh,

    Sorry to disturb you again.

    Any updates for the issue?

    Thanks
    Rgds
    Shine

  • Hi Shine,

    Debug is still in progress on our end. Can you please help with the example project which customer is using so it could fasten up our debug also if the customer is using PHY loopback how are they seeing packet on wireshark?

    Regards

    Nilabh A.

  • Hi Nilabh,

    Thanks for your help.

    Sorry that customer's 
    project is under NDA, so he can't send his code. He suggested us to do below test: configure the lwip demo, use xcap to send vlan priority-4 message to the board, then the board receive the message and send to PC. 

    Rgds
    Shine

  • Hi Shine,

    For VLAN Support in LWIP example following changes are to be made for enabling vlan id 4U packets:

    1. Enable macro 

    #define ETHARP_SUPPORT_VLAN             1

    in file mcu_plus_sdk\source\networking\lwip\lwip-stack\src\include\lwip\opt.h

    2. In the same above file add below two lines:

    +#define ETHARP_VLAN_CHECK 4

     +#define LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type) (4U)

    3. Rebuild lwip stack and lwip contrib and enet_cpsw libraries.

    4. Rebuild the example and run.

    Let me know if this works for you.

    BR

    Nilabh A.

  • Hi Nilabh,

    Thanks for your help.

    Customer configured his code as you mentioned. Below is his configuration.

    #define ETHARP_SUPPORT_VLAN 1
    #define VLAN_VID 104
    #define VLAN_PRI 4
    #define VLAN_CFI 0
    #define LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type) ((VLAN_PRI << 13) | (VLAN_CFI << 12) | VLAN_VID)

    He wanted to receive Priority 4 VLAN message instead of VLAN ID 4 message. There is no problem with the configuration of LWIP. 

    BTW, he migrated to the newest SDK, he still failed. 

    He wanted to know to change the VLAN priority by using Policer. He failed because reading the ALE_STATUS register is 0. 

    Thanks.
    Rgds
    Shine


  • Hi Shine,

    I will get back on this after feedback from software team.

    BR

    Nilabh A.

  • Hi Nilabh,

    Thank your very much.

    Do we have some update on this issue?

    Thanks.
    Rgds
    Shine

  • Hi Shine,

    Please refer below:

    1. Please follow example: mcu_plus_sdk\examples\networking\enet_layer2_multi_channel example to setup ALE and vlan priority filtering.

    2.Use below code as a sample to configure the ALE:

     

    void EnetApp_setCpswPolicer(EnetApp_PerCtxt *perCtxt)
    {
        int32_t status;
        Enet_IoctlPrms prms;
        CpswAle_SetPolicerEntryOutArgs setPolicerOutArgs;
        CpswAle_SetPolicerEntryInArgs setPolicerInArgs;
    
        /* Set the Policer configuration */
        memset(&setPolicerInArgs, 0, sizeof(setPolicerInArgs));
        setPolicerInArgs.policerMatch.policerMatchEnMask = CPSW_ALE_POLICER_MATCH_MACSRC |
                                                           CPSW_ALE_POLICER_MATCH_ETHERTYPE |
                                                           CPSW_ALE_POLICER_MATCH_PORT | 
                                                           CPSW_ALE_POLICER_MATCH_PRIORITY;
        setPolicerInArgs.policerMatch.etherType = 0x8100;
        setPolicerInArgs.policerMatch.priority = 4U;
        setPolicerInArgs.policerMatch.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_TEST_POLICER_INGRESS_PORT);
        memcpy(&setPolicerInArgs.policerMatch.srcMacAddrInfo.addr.addr[0U], testSrcAddr, sizeof(setPolicerInArgs.policerMatch.srcMacAddrInfo.addr.addr));
        setPolicerInArgs.policerMatch.srcMacAddrInfo.addr.vlanId = 0;
        setPolicerInArgs.policerMatch.srcMacAddrInfo.portNum = CPSW_ALE_MACPORT_TO_ALEPORT(ENET_TEST_POLICER_INGRESS_PORT);
    
        ENET_IOCTL_SET_INOUT_ARGS(&prms, &setPolicerInArgs, &setPolicerOutArgs);
        ENET_IOCTL(perCtxt->hEnet, gEnetApp.coreId, CPSW_ALE_IOCTL_SET_POLICER, &prms, status);
        if (status != ENET_SOK)
        {
            EnetAppUtils_print("\nEnetApp_setCpswPolicer() failed CPSW_ALE_IOCTL_SET_POLICER: %d\n", status);
        }
        else
        {
            EnetAppUtils_print("\nRate limiting Enabled port %d on Src MAC " , CPSW_ALE_MACPORT_TO_ALEPORT(ENET_TEST_POLICER_INGRESS_PORT));
            EnetAppUtils_printMacAddr(testSrcAddr);
        }
    }

    3. Rebuild the example.

    Please let me know if you need any help with this.

    BR

    Nilabh A.

  • Hi Nilabh,

    It's still can't receive the vlan priority=4 message.

    Can you give us the test pass example?

    Thank you.

    Jeff

  • Hi Nilabh,

    Thank you very much. 

    Customer has added your code, but he still couldn't receive the non-zero VLAN message. Besides, the code doesn't configure the VLAN priority in MatchEnmask. 

    Thanks
    Rgds
    Shine

  • Hi Shine,

    Please ask customer to follow the mcu_plus_sdk\examples\networking\enet_layer2_multi_channel example to setup ALE and vlan priority filtering.

  • Hi Nilabh,

    O.K. I'll tell it to the customer.

    Thank you very much.
    Rgds

    Shine

  • Hi Anand,

    May i know which version of MCU plus sdk we need to use for this demo? The latest version from TI.com is  08.04.00.17. 

    Thank you.

    Regards,

    Allen

  • Yes Allan, 

    You can use 08.04.17

    BR

    Nilabh A.

  • Did they add CPSW_ALE_POLICER_MATCH_PRIORITY, this enables : priority matching

  • Hello Anand,

      Thanks for your reply.

    Jeff

  • Pls close this issue.

  • Pls close this issue.

    Hi Jeff,

    Has your issue been resolved?

    If resolved, would you please kindly share us the detailed steps you resolve it?

    Thanks in advance!

    Rgds
    Shine

  • Hi, Shine

    Thanks four help and give us the refer link,  our test can recv pri=1 ptp message in ptp recv task.

    Our project cancel the vlan use.

    Has your issue been resolved?

    No,  we still can't recv the  priority=4 echo packets in the echo recv task, but the host stat tx packets num is increasing.

    Regards.

    Jeff

  • Hi Jeff,

    The am273 device does not have the channel over ride feature, i.e. The dma channel ID1 can support only priority 1 packets. You cannot override it to allow priority4 packets. If you want to use vlan priority 4 you need to create a channel with channel ID 4. 

    You can see that PTP channel has channel ID as 1 i.e why it is able to receive priority 1 packets.

  • Hi Shine,

    Thanks for your reply.

    How to open channel ID 4?We can open channel 4 only?

    Regards.

    Jeff

  • Jeff,

    In 8.4 SDK, Go to syscfg and add DMA channels as below, make sure you pass the channel4 parameters in open dma function in mcu_plus_sdk\examples\networking\enet_layer2_multi_channel\V1\multi_channel_dataflow.c.

    BR

    Nilabh A.

  • Hi Shine,

    Thank you.

    BR

    The configuration as up figure will open all five rx DMA channel in driverOpen, and then I getRxDmaHanldle to pass the 4 for the DmaChId. Is that rihgt?

    Regards.

    Jeff

  • Yes Jeff 

    Thats right.

  • Hi Nilabh,

    Yes, I received the eth packets.

    Thanks again.

    Best Regards.

    Jeff

  • Good to hear that Jeff, You can close this ticket.

    BR

    Nilabh A.