Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

PA broadcast packet routing configuration

$
0
0

Hello.
I use this routine PA_emacExample_exampleProject. I can receive packets that match the MAC address / IP address / port number.
But I can not receive broadcast packets.  Later, I know because I did not add the broadcast MAC.
I added broadcast MAC with the following piece of code:

Int32 Add_BroadcastMACAddress (Void)
{
    Int32                       j;
    UInt16                      cmdSize;
    Qmss_Queue                  cmdReplyQInfo;
    paEthInfo_t                 ethInfo;
    paRouteInfo_t               routeInfo;
    paRouteInfo_t               nFailInfo;
    paCmdReply_t                cmdReplyInfo;
    paReturn_t        retVal;
    paEntryHandle_t   retHandle;
    Int32             handleType, cmdDest;
    UInt32            psCmd       =   ((UInt32)(4 << 5) << 24);
    UInt32            myswinfo[]  =   {0x11112222, 0x33334444};
    Cppi_HostDesc*    pHostDesc;
    Qmss_Queue rxQInfo;

    ethInfo.src[0] = 0x00;
    ethInfo.src[1] = 0x00;
    ethInfo.src[2] = 0x00;
    ethInfo.src[3] = 0x00;
    ethInfo.src[4] = 0x00;
    ethInfo.src[5] = 0x00;
    ethInfo.dst[0] = 0xFF;
    ethInfo.dst[1] = 0xFF;
    ethInfo.dst[2] = 0xFF;
    ethInfo.dst[3] = 0xFF;
    ethInfo.dst[4] = 0xFF;
    ethInfo.dst[5] = 0xFF;
    ethInfo.vlan = 0;
    ethInfo.ethertype = 0;
    ethInfo.mplsTag = 0;
    ethInfo.inport = 0;

   // rxQInfo = Qmss_getQueueNumber(gRxQHnd);

    routeInfo.dest = pa_DEST_HOST;
    routeInfo.flowId = 0;
    routeInfo.queue = 0;//rxQInfo.qNum;
    routeInfo.mRouteIndex = 0;
    routeInfo.swInfo0 = 0;
    routeInfo.swInfo1 = 0;
    routeInfo.customType = 0;
    routeInfo.customIndex = 0;
    routeInfo.pktType_emacCtrl = 0;
    routeInfo.pCmd = NULL;


    nFailInfo.dest = pa_DEST_DISCARD;
    nFailInfo.flowId = 0;
    nFailInfo.queue = 0;
    nFailInfo.mRouteIndex = pa_NO_MULTI_ROUTE;
    nFailInfo.swInfo0 = 0;
    nFailInfo.swInfo1 = 0;
    nFailInfo.customType = 0;
    nFailInfo.customIndex = 0;
    nFailInfo.pktType_emacCtrl = 0;
    nFailInfo.pCmd = NULL;

    cmdReplyInfo.dest = pa_DEST_HOST;
    cmdReplyInfo.replyId = 0;
    cmdReplyInfo.queue = 0;
    cmdReplyInfo.flowId = 0;

    /* 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);

    /* Populate the Rx free descriptor with the fixed command buffer. */
    Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (UInt8 *)Convert_CoreLocal2GlobalAddr((UInt32)gPaCmdBuf1), sizeof

(gPaCmdBuf1));

    /* Save original buffer information */
    Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (UInt8 *)Convert_CoreLocal2GlobalAddr((UInt32)gPaCmdBuf1), sizeof

(gPaCmdBuf1));

    cmdSize                 =   pHostDesc->buffLen;
    cmdReplyInfo.replyId    =   0x33333333;  /* 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,
                            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 */
    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 < 100; j++)
    {
        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);

            if (pHostDesc->softwareInfo0 != cmdReplyInfo.replyId)
            {
                System_printf ("Found an entry in PA response queue with swinfo0 = 0x%08x, expected 0x%08x\n",
                                pHostDesc->softwareInfo0, cmdReplyInfo.replyId);
                pHostDesc->buffLen  =   pHostDesc->origBufferLen;
                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;
            Qmss_queuePush (gRxFreeQHnd, pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);

            break;
        }
    }

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

    return 0;
}

However, when receiving broadcast packets, the interrupt function  does not respond。
I think that the packets has not yet triggered the interrupt.Packet is filtered out in the PA.
My purpose  is very simple:
1、Normally,receiving the packets whose MAC address /IP address / port number match the MAC address/IP address/ port number stored in PA .
2、When the received packet is a broadcast packet, then it is routed directly to the host.
How can I modify the PA_emacExample_exampleProject routine to acchieve this target.
thank you!


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>