Is there any problem in my ethernet receive handler? - VxWorks

This is a discussion on Is there any problem in my ethernet receive handler? - VxWorks ; Here is my receive handler in my net driver. I use EthGetFrame to get a frame from MAC controller, and use EthPutBackFrame to send the frame back. I can see all the frame are received correctly (I use sniffer to ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Is there any problem in my ethernet receive handler?

  1. Is there any problem in my ethernet receive handler?

    Here is my receive handler in my net driver.
    I use EthGetFrame to get a frame from MAC controller, and use
    EthPutBackFrame to send the frame back.

    I can see all the frame are received correctly (I use sniffer to
    monitor the network).
    When the bootrom try to use ftpXfer to download image, I can see these
    frames:
    1. vxworks send arp.
    2. PC send arp ack.
    3. vxworks send the first TCP connect packet, (the target MAC address
    is correct.)
    4. PC send ack
    5. PC send ack retransmission packet
    6. vxworks resend TCP connect packet.

    It seems the upper layer have not received the data if the packet is
    large than arp packet.
    I don't know what to do now. Any help is appreciated.

    LOCAL STATUS EthHandleRcvInt( DRV_CTRL *pDrvCtrl)
    {
    USHORT len = 0;
    M_BLK_ID pMblk = NULL;
    char* pCluster = NULL;
    CL_BLK_ID pClBlk = NULL;

    /*
    * We implicitly are loaning here, if copying is necessary this
    * step may be skipped, but the data must be copied before being
    * passed up to the protocols.
    */

    pCluster = netClusterGet (pDrvCtrl->endObj.pNetPool,
    pDrvCtrl->pClPoolId);
    if (pCluster == NULL)
    {
    printf("Cannot loan!\n");
    END_ERR_ADD (&pDrvCtrl->endObj, MIB2_IN_ERRS, +1);
    goto cleanRXD;
    }

    /* Grab a cluster block to marry to the cluster we received. */
    if ((pMblk = mBlkGet (pDrvCtrl->endObj.pNetPool, M_DONTWAIT,
    MT_DATA)) == NULL)
    {
    printf( "Out of M Blocks!\n");
    END_ERR_ADD (&pDrvCtrl->endObj, MIB2_IN_ERRS, +1);
    goto cleanRXD;
    }

    if ((pClBlk = netClBlkGet (pDrvCtrl->endObj.pNetPool, M_DONTWAIT))
    == NULL)
    {
    printf ("Out of Cluster Blocks!\n");
    END_ERR_ADD (&pDrvCtrl->endObj, MIB2_IN_ERRS, +1);
    goto cleanRXD;
    }

    /* Join the cluster to the MBlock */

    netClBlkJoin (pClBlk, pCluster, EP93END_BUFSIZ, NULL, 0, 0, 0);
    netMblkClJoin (pMblk, pClBlk);

    EthGetFrame(pDrvCtrl->pChipData, pCluster, &len);
    if(len <= 0)
    {
    printf("Cannot loan!\n");
    END_ERR_ADD (&pDrvCtrl->endObj, MIB2_IN_ERRS, +1);
    goto cleanRXD;
    }

    EthPutBackFrame((char*)pMblk->m_data, len);

    END_ERR_ADD (&pDrvCtrl->endObj, MIB2_IN_UCAST, +1);
    pMblk->mBlkHdr.mLen = len;
    pMblk->mBlkHdr.mFlags |= M_PKTHDR;
    pMblk->mBlkPktHdr.len = len;

    CACHE_DMA_INVALIDATE (pMblk->mBlkHdr.mData, len);

    /* Call the upper layer's receive routine.*/
    END_RCV_RTN_CALL(&pDrvCtrl->endObj, pMblk);


    return (OK);

    cleanRXD:
    if (pCluster != NULL)
    netClFree (pDrvCtrl->endObj.pNetPool, pCluster);
    if (pClBlk != NULL)
    clBlkFree (pDrvCtrl->endObj.pNetPool, (CL_BLK_ID)pClBlk);
    if (pMblk != NULL)
    netMblkFree (pDrvCtrl->endObj.pNetPool, (M_BLK_ID)pMblk);
    return (OK);
    }


  2. Re: Is there any problem in my ethernet receive handler?

    I still have no progress on this issue.

    I uploaded a sniffer file at
    http://yujiangzheng.googlepages.com/Snif_tcp_failed.cap.
    This can clearly show the problem.

    The function EthPutBackFrame sends back the entire received frame with
    a extra header:
    void EthPutBackFrame(char* pbData, int len)
    {
    static unsigned char sFrame[1524];
    memcpy(sFrame+16, pbData, len );
    sFrame[0] = 0x00;
    sFrame[1] = 0x06;
    sFrame[2] = 0x5B;
    sFrame[3] = 0xd3;
    sFrame[4] = 0xFC;
    sFrame[5] = 0x98;
    sFrame[6] = 0x00;
    sFrame[7] = 0x00;
    sFrame[8] = 0x00;
    sFrame[9] = 0x00;
    sFrame[10] = 0x00;
    sFrame[11] = 0x00;
    sFrame[12] = 0x01;
    sFrame[13] = 0x02;
    sFrame[14] = 0x03;
    sFrame[15] = 0x04;
    SendFrame(sFrame,len + 16);
    }

    All the data are received correctly, but seems vxworks ignored it.
    I have no idea about it now.
    Any help are greatly appreciated.

    BTW:
    I noticed the TCP frame sends by vxworks always have timestamp options.
    How to disable it?


+ Reply to Thread