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.

TMS320C6678: C6678 NDK raw ethernet - receive promiscuous mode

Part Number: TMS320C6678

Hi,

I need to able to receive raw ethernet packet in promiscuous mode on C6678 evm.

I found the following thread: 

However, the suggested patch doesn't fit my setup.

I use ndk_3_61_01_01 with pdk_c667x_2_0_16.

In the file: pdk_c667x_2_0_16\packages\ti\transport\ndk\nimu\src\v1\nimu_eth.c

I modified the following:

/* Set the 'initial' Receive Filter */
//ptr_pvt_data->pdi.Filter = ETH_PKTFLT_MULTICAST;
ptr_pvt_data->pdi.Filter = ETH_PKTFLT_ALL;

in static int EmacStart (NETIF_DEVICE* ptr_net_device)

and added 

CSL_CPGMAC_SL_enableRxCEF(macPortNum);

in void Init_MAC (uint32_t macPortNum, uint8_t macAddress[6], uint32_t mtu)

What other changes are needed?

When i send the packets from an FPGA,

I see that packet arrive if I add debug print inside  "EmacPktService (NETIF_DEVICE* ptr_net_device)" function but i don't see them at higher sw abstractions.

Thanks!

Pavel

  • Hi Pavel,

    I see you missed out another place in the file: pdk_c667x_2_0_16\packages\ti\transport\ndk\nimu\src\v1\nimu_eth.c

    memcpy (&ethInfo.dst[0], ptr_pvt_data->pdi.bMacAddr, sizeof(paMacAddr_t)); --> Change to memset(&ethInfo.dst[0], 0, sizeof(paMacAddr_t));

    /* Set up the MAC Address LUT*/
    if (Add_MACAddress (&ethInfo, &routeInfo) != 0)
    {
    NIMU_drv_log ("Add_MACAddress failed \n");
    return -1;
    }

    memcpy (&ethInfo.dst[0], broadcast_mac_addr, sizeof(paMacAddr_t)); --> Change to memset(&ethInfo.dst[0], 0, sizeof(paMacAddr_t));
    /* Set up the MAC Address LUT for Broadcast */
    if (Add_MACAddress (&ethInfo, &routeInfo) != 0)
    {
    NIMU_drv_log ("Add_MACAddress failed \n");
    return -1;
    }

  • Thanks Aravind,

    But with these changes i no longer receive any packets.. 

    Are you sure this is what needed?

    Regards,

    Pavel

  • Hi Pavel,

    Sorry, that it did not help.

    The suggestion that I provided before, is for the Packet accelerator LUT to ignore the destination mac ID field (That change should enable any MAC destination packets entering the PA to be passed to the system).Let me restart this and understand what are you are trying to do.

    You can ignore my previous changes (please revert to what it was before).

    Can you please explain what are you trying to do? From your previous response, it appears to me that you got some packets to the host? What other types of packets are missed out? 

    I will check with NDK experts on how to support promiscuous mode in NDK.

    Appeared to me you are looking to "not filter" packets and want to route everything to host? Is this a correct understanding?

  • Hi Pavel,

    Got below information from NDK expert.

    You can find info in the following sections of the NDK_API_Reference.html document included in the NDK: 

    • 3.4 Raw Ethernet Sockets Programming Interface
    • A.15 Raw Ethernet Module

     The latter section has a block diagram that will help in understanding how the data flow goes.

    Also, please note that you would need to disable all filtering in the driver so that packets/frames whose MAC address do not match the MAC of the 6678 won’t get dropped. If they’re not dropped/filtered, then they should get enqueued in a (PBMQ) queue, and popped out and sent up the stack in the call to pkt_service (that’s one of the NIMU fxns) 

    Please note that, one of the places, where it may get filtered in NIMU layer is the location that I mentioned in earlier thread.

    I am assuming you got the Ethernet switch configured to forward all the packets to the host port.

    The below is one of the changes you may need in NIMU layer to disable the MAC filtering.

    Make sure the ethInfo.dst[0] has all '0', to disable the filter of MAC of the C6678 only. This helps to get all MAC IDs to be sent up the stack. However, Please note that, if you do this, the traffic can be very high for NIMU to handle. So, you may want to start pumping the ethernet traffic at a lower rate first to test the software updates/changes are good, and then increase the traffic rate to manageable rates.

    memcpy (&ethInfo.dst[0], ptr_pvt_data->pdi.bMacAddr, sizeof(paMacAddr_t));

    /* Set up the MAC Address LUT*/
    if (Add_MACAddress (&ethInfo, &routeInfo) != 0)
    {
    NIMU_drv_log ("Add_MACAddress failed \n");
    return -1;
    }

    Please let me know how it goes.

    Thanks,

    Aravind 

  • Hi Pavel,

    I am assuming you are going through the NDK documentation that we got from NDK expert and making those changes.

    Meanwhile, all the NIMU specific changes, we think are complete.

    I will close the issue as "we think it as resolved" after a week, if you do not have anything to discuss with NDK experts.

    Thank you very much!

    Appreciate you share all the changes you did for NDK along with NIMU with us.

    -Thanks,
    Aravind

  • Hi Pavel,

    I hope you resolved the issue going through the inputs from NDK expert.

    I am moving this to Resolved state.

    Thanks,

    Aravind