lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Options


From: Adam Fullerton
Subject: [lwip-users] Options
Date: Thu, 10 Jun 2010 19:48:57 +0100

Hi,

Basic TCP/IP appears to be working for small transfers but when lwip_write is used to send 512 bytes it all goes horribly wrong.

IP_FRAG is set to 0, IP_FRAG_MAX_MTU is set to 1500, TCP_MSS is set to 1460. There is no shortage of RAM in the system so I have set MEMP_NUM_TCP_SEG, TCP_SND_BUF and TCP_SND_QUEUELEN to 32768.

Attached is a Wireshark capture showing what look like the data being placed on the link without any transport headers (frame 14).

The link output functions look like this:

/*****************************************************************************
Function Name: ipOutputStatus
Description:   Task to monitor the status of outgoing packets and to get the
               status of the transfer and inform lwIP that they have completed
Parameters:    IN  pEtherC - Pointer to the data structure
Return value:  none
*****************************************************************************/
static void ipOutputStatus(PRTEIP pEtherC)
{
   
int      iEtherC = pEtherC->iEtherC;
   
while (true )
    {
       
/* Wait for a transmision to be completed */
        uint32_t    uiIndex = eventWait(pEtherC->ppWriteEventList,
                                        ETHERNET_SIMULTANEOUS_WRITES,
                                       
true );
       
if (uiIndex >= 0)
        {
           
/* Get a pointer to the overlapped data structure */
            POLD    pOlWrite = &pEtherC->pOlWrite[uiIndex];
           
/* Free the buffer */
            pbuf_free(pEtherC->ppWriteBufferList[uiIndex]);
           
/* Mark as being ready for re-use */
            pEtherC->ppWriteBufferList[uiIndex] = NULL;
           
/* Get the result of the transfer lwIP does not care about the result */
            ioctl(iEtherC, CTL_GET_OVERLAPPED_WRITE_RESULT, pOlWrite);
        }
       
else
        {
            TRACE((
"ipOutputStatus: Error\r\n"));
        }
    }
}
/*****************************************************************************
End of function  ipOutputStatus
******************************************************************************/

/*****************************************************************************
Function Name: ipOutput
Description:   This function is called by the ARP module when it wants
               to send a packet on the interface. This function outputs
               the pbuf as-is on the link medium.
Parameters:    IN  pIpNetIf - Pointer to the network interface
               IN  pPacket - Pointer to the lwIP pbuf structure
Return value:  ERR_OK
*****************************************************************************/
static err_t ipOutput( struct netif *pIpNetIf, struct pbuf *pPacket)
{
    PRTEIP  pEtherC = (PRTEIP)pIpNetIf->state;
   
int      iEtherC = pEtherC->iEtherC;
   
while (pPacket)
    {
       
int      iIndex = ipGetOlWrite(pEtherC);
        uint8_t *pbyPacket = pPacket->payload;
        uint32_t uiLength = (uint32_t)pPacket->len;
        POLD    pOlWrite = &pEtherC->pOlWrite[iIndex];
       
/* Keep a pointer to this buffer so the output status task can free
           it when the transfer has completed */
        pEtherC->ppWriteBufferList[iIndex] = pPacket;
       
/* Add a reference to this packet so it is kept until it is
           freed when the completion event is set by the driver. This
           wakes the ipOutputStatus task which frees it */
        pbuf_ref(pPacket);
       
/* Set the overlapped event */
        ioctl(iEtherC, CTL_SET_OVERLAPPED_WRITE_EVENT, pOlWrite);
       
/* Write the packet of data */
        write(iEtherC, pbyPacket, uiLength);
       
/* Advance to the next packet  */
        pPacket = pPacket->next;
       
/* With IP_FRAG set to 0 this should be NULL? */
        if (pPacket)
        {
            TRACE((
"IpFrag\r\n"));
        }
    }
   
return ERR_OK;
}
/*****************************************************************************
End of function  ipOutput
******************************************************************************/

It is like it won't send a TCP packet bigger than 566 bytes, but I can send UDP packets up to the MTU (1460 bytes of data). I am not expecting to see the IpFrag debug print statement but I do. Does any one know what configuration parameter I have got wrong?

Cheers,

Adam.

Attachment: TcpProblem2.pcap
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]