Dear,
We are using lwip 1.4.1 ported with version resale TivaWare_C_Series-2.1.4.178 utilizing Free RTOS
we use tcp server using RAM_RAW at size of 32KB.
The App, sends each 10msec a buffer of 14KB.
after a while we encounter that the PBUF is out of memory (cant allocate the tcp_write return MEM_ERR)
we saw there were issues with PBUF free, and the corrections applied to tiva-tm4c129.c were taken and merge.
the issues with the PBUF leak seems to be solved on the lwip 2.2017 at least what was stated.
Q:
1. can you post the latest source file tiva-tm4c129.c with all the mentioned fixes applied to it?
2. when are you planning to port the tiva-tm4c129.c to new lwip release ?
3. any ideas how to overcome the pbuf leak ?
added lwipopts.h
#define PBUF_POOL_SIZE 42//16 //1024
#define TCP_MSS 1460//1476
#define TCP_WND (3*TCP_MSS) //(2*TCP_MSS)
#define TCP_SND_BUF (32*1024) //65535
#define TCP_OVERSIZE TCP_MSS
#define TCP_SND_QUEUELEN 256 //128 //(2 * TCP_SND_BUF/TCP_MSS)
#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN //200 //512
the sender task codes partial is :
if (tcp_sndbuf(pState->pConnectPCB)
&& (pState->pConnectPCB->snd_queuelen < TCP_SND_QUEUELEN))
{
//MEM_STATS_DISPLAY();
//TCP_STATS_DISPLAY();
// Here, we have data, and we have space. Set the total amount
// of data we will process to the lesser of data available or
// space available.
pState->pConnectPCB->flags |= (TF_NODELAY |TF_ACK_NOW);
Count = len;
if (tcp_sndbuf(pState->pConnectPCB) < Count)
{
Count = tcp_sndbuf(pState->pConnectPCB);
ASSERT(0);
}
// While we have data remaining to process, continue in this
// loop.
while ((Count)
&& (pState->pConnectPCB->snd_queuelen < TCP_SND_QUEUELEN))
{
//LEDOn(0); //d1
if (Count < TCP_MSS)
{
// Write the local buffer into the TCP buffer.
tcpErr = tcp_write(
pState->pConnectPCB, Data + Index, Count,
TCP_WRITE_FLAG_COPY /*| TCP_WRITE_FLAG_MORE*/); // 1 copy 2 more TCP_WRITE_FLAG_MORE
if(tcpErr != ERR_OK) {
ASSERT(0);
stam = Index+Count;
}
Index += Count;
Count = 0;
}
else
{
// Write the local buffer into the TCP buffer.
tcpErr = tcp_write(
pState->pConnectPCB, Data + Index,
TCP_MSS,
TCP_WRITE_FLAG_COPY | TCP_WRITE_FLAG_MORE); // 1 copy 2 more
if(tcpErr != ERR_OK) {
ASSERT(0);
stam = Index+Count;
}
Index += TCP_MSS;
Count -= TCP_MSS;
}
// Flush the data that has been written into the TCP output
tcpErr = tcpip_callback(tcp_output, pState->pConnectPCB);
pState->ui32LastTCPSendTime = 0; //g_SysTimeStamp;
if(tcpErr != ERR_OK) {
//ASSERT(0);
stam = Index+len;
}
}
//LEDOff(0); //d1
len -= Index;