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.

problem on add MAC in PA PDSP for multicore application

Other Parts Discussed in Thread: SYSBIOS

Hi to all

i try to classify packet using PA . i run PA_multicore example (from PDK 2_1_2_6) successfully on c6678 EVM and received packet classified based on MAC, IP , Port and each 8 core receive specified packet

but when i boot Linux c6x on core 0 and run modified version of PA_multicore (sys/bios application) on core 1 , PA PDSP not response to command packet and code report "Timeout waiting for reply from PA to Pa_addMac command" 

QMSS,cppi initialized correctly and when i remove Setup_PASS () function, sys/bios send packet correctly and Linux c6x work without problem (PA_multicore send packet without using PA and QMSS forward packets from host to switch directly)

this is my Add_MACAddress function (changed line specified by //EA:2):

Int32 Add_MACAddress (Void)
{
    Int32                       j;
    UInt16                      cmdSize;
    Qmss_Queue                  cmdReplyQInfo;
    paEthInfo_t                 ethInfo     =   {   { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },     /* Src mac = dont care */   
                                                    { 0x00, 0x17, 0xea, 0xd0, 0x18, 0x9c },     /*EA:2 Dest mac */
                                                    0,                                          /* vlan = dont care */      
                                                    0x0800,                             		/* ether type = IPv4 */     
                                                    0,                                          /* MPLS tag = dont care */
                                                    0                                           /* Input EMAC port = dont care */  
                                                }; 
    paRouteInfo_t               routeInfo =     {   pa_DEST_CONTINUE_PARSE_LUT1,                /* Continue parsing */
                                                    0,                                          /* Flow Id = dont care */          
                                                    0,                                          /* queue = dont care */
                                                    0,                                          /* multi route = dont care */
                                                    0,                                          /* swinfo0 = dont care */          
                                                    0,                                          /* SwInfo 1 is dont care */
                                                    0,                                          /* customType = pa_CUSTOM_TYPE_NONE */         \
                                                    0,                                          /* customIndex: not used */        \
                                                    0,                                          /* pkyType: for SRIO only */       \
                                                    NULL                                        /* No commands */
                                                };
    paRouteInfo_t               nFailInfo =     {   pa_DEST_DISCARD,                            /* Toss the packet  */           
	                                                0,                                          /* Flow Id = dont care */        
                                                    0,                                          /* queue = dont care */          
                                                    0,                                          /* mutli route = dont care */    
                                                    0,                                          /* swinfo0 = dont care */        
                                                    0,                                          /* SwInfo 1 is dont care */
                                                    0,                                          /* customType = pa_CUSTOM_TYPE_NONE */         \
                                                    0,                                          /* customIndex: not used */        \
                                                    0,                                          /* pkyType: for SRIO only */       \
                                                    NULL                                        /* No commands */
                                                };
    paCmdReply_t                cmdReplyInfo =  {   pa_DEST_HOST,                               /* Replies go to the host */            
                                                    0,                                          /* User chosen ID to go to swinfo0 */     
                                                    0,                                          /* Destination queue */                   
                                                    0                                           /* Flow ID */  
                                                };
    paReturn_t                  retVal;
    paEntryHandle_t             retHandle;
    Int32                       handleType, cmdDest;
    UInt32                      psCmd       =   ((UInt32)(4 << 5) << 24);  
    UInt32                      myswinfo[]  =   {0x11112222, 0x33334444};
    Cppi_HostDesc*              pHostDesc;

    /* Get a Tx free descriptor to send a command to the PA PDSP */
    if ((pHostDesc = Qmss_queuePop (gTxFreeQHnd)) == NULL)
    {
        System_printf ("Error obtaining a Tx free descriptor \n");            
        return -1;
    }

    /* The descriptor address returned from the hardware has the 
     * descriptor size appended to the address in the last 4 bits.
     *
     * To get the true descriptor pointer, always mask off the last 
     * 4 bits of the address.
     */
    pHostDesc = (Ptr) ((UInt32) pHostDesc & 0xFFFFFFF0);
    CSL_XMC_invalidatePrefetchBuffer();
    SYS_CACHE_INV (pHostDesc, SIZE_HOST_DESC, CACHE_FENCE_WAIT);
    SYS_CACHE_INV ((Ptr)pHostDesc->buffPtr, pHostDesc->buffLen, CACHE_FENCE_WAIT);
    pHostDesc->buffLen      =   pHostDesc->origBufferLen;
    cmdSize                 =   pHostDesc->buffLen;
    cmdReplyInfo.replyId    =   0x55550000;  /* unique for each add mac command */

    /* Get the PA response queue number and populate the destination queue number
     * in the PA response configuration.
     */
    cmdReplyQInfo           =   Qmss_getQueueNumber (gPaCfgCmdRespQHnd);
    cmdReplyInfo.queue      =   cmdReplyQInfo.qNum;
    cmdReplyInfo.flowId     =   (uint8_t)Cppi_getFlowId(gRxFlowHnd);

    retVal  =   Pa_addMac  (gPAInstHnd,
                            10,//EA:2 pa_LUT1_INDEX_NOT_SPECIFIED,
                            &ethInfo,
                            &routeInfo,
                            &nFailInfo,
                            &gPaL2Handles[0],
                            (paCmd_t) pHostDesc->buffPtr,
                            &cmdSize,
                            &cmdReplyInfo,
                            &cmdDest);
    if (retVal != pa_OK)  
    {
        System_printf ("Pa_addMac returned error %d\n", retVal);
        return -1;
    }
    
    /* This sets the extended info for descriptors, and this is required so PS info
     * goes to the right spot 
     */                   
    Cppi_setSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (UInt8 *)myswinfo);

    /* Set the buffer length to the size used. It will be restored when the descriptor
     * is returned 
     */
    Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, cmdSize);
    pHostDesc->buffLen  =   cmdSize;
    
    /* Mark the packet as a configuration packet */
    Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (UInt8 *)&psCmd, 4);
       
    /* Send the command to the PA and wait for the return */
    SYS_CACHE_WB (pHostDesc, SIZE_HOST_DESC, CACHE_FENCE_WAIT);
    SYS_CACHE_WB ((Ptr)pHostDesc->buffPtr, pHostDesc->buffLen, CACHE_FENCE_WAIT);
    Qmss_queuePush (gPaTxQHnd[cmdDest - pa_CMD_TX_DEST_0], 
                    pHostDesc, 
                    pHostDesc->buffLen, 
                    SIZE_HOST_DESC, 
                    Qmss_Location_TAIL
                   );
    
    /* Poll on the PA response queue to see if response from PA has come */
    for (j = 0; j < 1000; j++)//EA:2
    {
        CycleDelay (1000);

        if (Qmss_getQueueEntryCount (gPaCfgCmdRespQHnd) > 0)   
        {
            /* We have a response from PA PDSP for the command we submitted earlier for 
             * MAC address addition.
             */
            pHostDesc = Qmss_queuePop (gPaCfgCmdRespQHnd);

            /* Clear the size bytes */
            pHostDesc = (Ptr) ((UInt32) pHostDesc & 0xFFFFFFF0);
            SYS_CACHE_INV (pHostDesc, SIZE_HOST_DESC, CACHE_FENCE_WAIT);
            SYS_CACHE_INV ((Ptr)pHostDesc->buffPtr, pHostDesc->buffLen, CACHE_FENCE_WAIT);                  

            if (pHostDesc->softwareInfo0 != cmdReplyInfo.replyId)  
            {
                System_printf ("Add_MACAddress: Found an entry in PA response queue with swinfo0 = 0x%08x, expected 0x%08x\n", 
                                pHostDesc->softwareInfo0, cmdReplyInfo.replyId);
                pHostDesc->buffLen  =   pHostDesc->origBufferLen;
                SYS_CACHE_WB (pHostDesc, SIZE_HOST_DESC, CACHE_FENCE_WAIT);
                Qmss_queuePush (gRxFreeQHnd, pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);

                return -1;
            }
            

            retVal  =   Pa_forwardResult (gPAInstHnd, (Ptr)pHostDesc->buffPtr, &retHandle, &handleType, &cmdDest);
            if (retVal != pa_OK)  
            {
                System_printf ("PA sub-system rejected Pa_addMac command\n");
                return -1;
            }
        
            /* Reset the buffer lenght and put the descriptor back on the Tx free queue */
            pHostDesc->buffLen = pHostDesc->origBufferLen;
            SYS_CACHE_WB (pHostDesc, SIZE_HOST_DESC, CACHE_FENCE_WAIT);
            Qmss_queuePush (gRxFreeQHnd, pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);

            break;
        }
    }

    if (j == 1000)//EA:2
    {
        System_printf ("Timeout waiting for reply from PA to Pa_addMac command\n");
        return -1;
    }

    return 0;
}

in this post  said :

"Linux statically takes several indexes in PA entries which the example should avoid"

i change index in PA_addMac "pa_LUT1_INDEX_NOT_SPECIFIED" to 10 

i see some E2E post with similar problem (all of this post Not Answered)

"Timeout waiting for reply from PA to Pa_addMac command"

Pa_addMAC fails when integrating with SRIO

PA PDSP designed to multiple classify and route packets.any body can help me to add multiple route in my multicore applications ?

thanks for reading

Ebi

  • Hi Ebi,

    Please refer below threads as well,

  • Raja,

    thanks for your reply and good links

    at the first link  explain how to forward received packet from Ethernet switch to host base on MAC using queue -> i need classify packet base on MAC,IP, Port and this solution can't help me

    pa_addMac , pa_addIp ,pa_addPort function work correctly in PA_multicore example (without Linux c6x on core 0) but when i boot Linux on core 0 PA not response to pa_addxxx i forget something in config !

    i remove Download_PAFirmware () function in PA_multicore (firmeware download by Linux)

    and refer to this post :

    i change flow id in Setup_Rx (Void) from

    rxFlowCfg.flowIdNum             =   CPPI_PARAM_NOT_SPECIFIED;

    to

    rxFlowCfg.flowIdNum             =   10;//EA:2

    (i'm glad to hear your insight)

    best regards

    Ebi

  • Hi to all

    my issue not resolved yet !
    PA not response without report error (Timeout waiting for reply from PA) and i don't know what's wrong ?!
    Does anybody have an idea about this problem?


    thanks
    Ebi
  • Sorry for the late response! I need some understanding how you use Linux and SYSBIOS at the same time.

    Linux is running on core 0, it initialized CPPI, QMSS and downloaded the PA firmware, correct? and it is working fine.

    On the core 1, the SYSBIOS is running, so there is no additional CPPI, QMSS init and PA firmware downloaded? If you didn't call Setup_PASS(), then what added in PA entries was done by Linux earlier, what do you mean "QMSS,cppi initialized correctly and when i remove Setup_PASS () function, sys/bios send packet correctly and Linux c6x work without problem (PA_multicore send packet without using PA and QMSS forward packets from host to switch directly)"? Does both Tx and Rx directions work for both Linux and Sysbios?

    In Pa_addMac(), how do you know that index 10 is not used by Linux? Without running Linux, can SYSBIOS program with index 10 working properly (you have to add the cppi/qmss/firmware back) on core 1?

    What is the DSP boot mode? Is it no boot? How do you load Linux to core 0 and sysbios to core 1, using CCS/JTAG or some bootloader? If bootloader, they may also have code do some initialization.

    Regards, Eric

     

  • hi Eric

    thanks for your reply

    lding said:
    Linux is running on core 0, it initialized CPPI, QMSS and downloaded the PA firmware, correct? and it is working fine.

    yes it's correct

    lding said:
    On the core 1, the SYSBIOS is running, so there is no additional CPPI, QMSS init and PA firmware downloaded? If you didn't call Setup_PASS(), then what added in PA entries was done by Linux earlier, what do you mean "QMSS,cppi initialized correctly and when i remove Setup_PASS () function, sys/bios send packet correctly and Linux c6x work without problem (PA_multicore send packet without using PA and QMSS forward packets from host to switch directly)"? Does both Tx and Rx directions work for both Linux and Sysbios?

    in this post i explain detail of QMSS and CPPI modification :

    when i remove Setup_PASS() , sys/bios application can send (only send) packet to PC (i check by wireshark) and Linux can send and receive correctly (i check by simple ping)

    in PA_multicore Packet forward from core to ethernet switch trough Q648 (don't use PA)

    i understand from this test QMSS and CCPI configured correctly (please confirm if it's correct)

    lding said:
    In Pa_addMac(), how do you know that index 10 is not used by Linux? Without running Linux, can SYSBIOS program with index 10 working properly (you have to add the cppi/qmss/firmware back) on core 1?

    i check with some other index but problem not resolved can you please suggest me how can i get more information about configuration of PA by Linux c6x ? (index used , L2 L3 L4 LUT ,...)

    PA_multicore work correctly on core 0 with index 5 ,10 ,...

    lding said:
    What is the DSP boot mode? Is it no boot? How do you load Linux to core 0 and sysbios to core 1, using CCS/JTAG or some bootloader? If bootloader, they may also have code do some initialization.

    i try to use mcoreloader for load sys/bios application but for easier test i use NAND boot for boot linux on core 0 => connect to core 1 by jtag => load .out file to core 1 (i don't use gel file for loading on core1) and run core 1 by jtag (refer to above screenshot)

    can you please confirm that Linux c6x and sysbios can work at same time without using resource manager ?(for example semaphore , ...)

    thanks for reading 

    Ebi