I am using LWIP 1.3 with Xilinx (SDK).
My settings:
- TCP_SND_BUF 64240
- TCP_MSS 1460
My problem:
- If I am do tcp_write with 18720 Bytes the transfer is well going.
- If I am writing with 19968 Bytes the transfer with some PCs is well going,
but with other PCs the return of tcp_write is -1.
- If I am writing with 21504 Bytes or more then with all connected PCs I
will return -1 of tcp_write.
Does anybody know this issue or has any idea to solve this?
Thanks for your replies.
Regards,
Daniel
_______________________________________________
lwip-users mailing list
lwip-...@nongnu.org
http://lists.nongnu.org/mailman/listinfo/lwip-users
first of all please update to LWIP 1.32. I can only recommend that.
Second what's your MEM_SIZE, TCP_SND_QUEUELEN, MEMP_NUM_PBUF?
Do you have access to the Debug messages, that could really help.
I think it could be maybe a memory problem.
I don't know how I can update in Xilinx to LWIP 1.32.
- MEM_SIZE 524288
- TCP_SND_QUEUELEN 16 * TCP_SND_BUF/TCP_MSS
- MEMP_N_PBUF 16
These are the debug information:
The packet with the length of 1518 Bytes doesn't go out. With wireshark I
don't see it. After a timeout the connection will be closed.
Regards,
Daniel
---
State: ESTABLISHED
tcp_receive: ACK for 19bd, unacked->seqno 19b7:19bd
tcp_receive: removing 19b7:19bd from pcb->unacked
pbuf_free(0x8802ffc0)
pbuf_free: deallocating 0x8802ffc0
tcp_write(pcb=0x880b1800, data=0x8d2785d0, len=14, apiflags=1)
tcp_enqueue(pcb=0x880b1800, arg=0x8d2785d0, len=14, flags=0, apiflags=1)
pbuf_alloc(length=14)
pbuf_alloc(length=14) == 0x8802ffc0
pbuf_header: old 0x88030040 new 0x8803002c (20)
tcp_enqueue: queueing 19bd:19cb (0x0)
tcp_output_segment: 19bd:19cb
pbuf_header: old 0x8803002c new 0x88030018 (20)
pbuf_header: old 0x88030018 new 0x8803000a (14)
tcp_recved: recveived 6 bytes, wnd 8192 (0).
pbuf_free(0x88276080)
pbuf_free: deallocating 0x88276080
tcp_output: nothing to send (0x0)
State: ESTABLISHED
tcp_fasttmr: delayed ACK
pbuf_alloc(length=20)
pbuf_alloc(length=20) == 0x880300c0
tcp_output: sending ACK for f589592a
pbuf_header: old 0x88030140 new 0x8803012c (20)
pbuf_header: old 0x8803012c new 0x8803011e (14)
pbuf_free(0x880300c0)
pbuf_free: deallocating 0x880300c0
pbuf_alloc(length=1518)
pbuf_alloc: allocated pbuf 0x88276080
pbuf_alloc(length=1518) == 0x88276080
pbuf_free(0x88276080)
pbuf_free: deallocating 0x88276080
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_output: nothing to send (0x0)
pbuf_alloc(length=1518)
pbuf_alloc: allocated pbuf 0x88276080
pbuf_alloc(length=1518) == 0x88276080
pbuf_header: old 0x882760c0 new 0x882760ce (-14)
pbuf_header: old 0x882760ce new 0x882760e2 (-20)
pbuf_free(0x88276080)
pbuf_free: deallocating 0x88276080
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_output: nothing to send (0x0)
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_output: nothing to send (0x0)
pbuf_alloc(length=1518)
pbuf_alloc: allocated pbuf 0x88276080
pbuf_alloc(length=1518) == 0x88276080
pbuf_header: old 0x882760c0 new 0x882760ce (-14)
TCP header:
+-------------------------------+
| 4006 | 9999 | (src port, dest port)
+-------------------------------+
| 00f589592a | (seq no)
+-------------------------------+
| 00000019cb | (ack no)
+-------------------------------+
| 5 | |010000| 65455 | (hdrlen, flags (ACK ), win)
+-------------------------------+
| 0x53ea | 0 | (chksum, urgp)
+-------------------------------+
pbuf_header: old 0x882760ce new 0x882760e2 (-20)
pbuf_header: old 0x882760e2 new 0x882760f6 (-20)
+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags ACK
-+-+-+-+-+-+-+-+-+-+-+-+-+-+
State: ESTABLISHED
tcp_receive: ACK for 19cb, unacked->seqno 19bd:19cb
tcp_receive: removing 19bd:19cb from pcb->unacked
pbuf_free(0x8802ffc0)
pbuf_free: deallocating 0x8802ffc0
tcp_output: nothing to send (0x0)
pbuf_free(0x88276080)
pbuf_free: deallocating 0x88276080
State: ESTABLISHED
pbuf_alloc(length=1518)
pbuf_alloc: allocated pbuf 0x88276080
pbuf_alloc(length=1518) == 0x88276080
pbuf_header: old 0x882760c0 new 0x882760ce (-14)
TCP header:
+-------------------------------+
| 4006 | 9999 | (src port, dest port)
+-------------------------------+
| 00f589592a | (seq no)
+-------------------------------+
| 00000019cb | (ack no)
+-------------------------------+
| 5 | |010001| 65455 | (hdrlen, flags (FIN ACK ), win)
+-------------------------------+
| 0x53e9 | 0 | (chksum, urgp)
+-------------------------------+
pbuf_header: old 0x882760ce new 0x882760e2 (-20)
pbuf_header: old 0x882760e2 new 0x882760f6 (-20)
+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags FIN ACK
-+-+-+-+-+-+-+-+-+-+-+-+-+-+
State: ESTABLISHED
tcp_receive: received FIN.
tcp_close: closing in State: CLOSE_WAIT
---
Gesendet: Montag, 2. August 2010 10:26 Von: mgr...@demmel.com
Just try to increase your TCP_SND_QUEUELEN and MEMP_N_PBUF to 32.
It's a bit strange with the debug messages, because you are closing the
connection with this package: (There is a FIN flag.)
+-------------------------------+
| 4006 | 9999 | (src port, dest port)
+-------------------------------+
| 00f589592a | (seq no)
+-------------------------------+
| 00000019cb | (ack no)
+-------------------------------+
| 5 | |010001| 65455 | (hdrlen, flags (FIN ACK ), win)
+-------------------------------+
| 0x53e9 | 0 | (chksum, urgp)
+-------------------------------+
Maybe you check your application why it is closing the connection.
Best regards,
Matthias
I increased MEMP_N_PBUF to 32, and it is running well. (TCP_SND_QUEUELEN
seems to be fixed.)
Thanx a lot!
Regards,
Daniel
Gesendet: Montag, 2. August 2010 13:32 Von: mgr...@demmel.com
Note that while this has avoided the problem it isn't entirely solved.
lwIP will still refuse your writes if you make them big enough, or if
there is already enough stuff enqueued. You need to cope with this in
your application and either try again later, try a smaller write, or
something similar.
Kieran
> Hello,
>
> I'm using lwip too (1.4), but in my case I just can send data till 384 Bytes
> When I try 768 don't send nothing!
>
> Before I was using uIP and I sent data bigger than 20Mbytes but the throughput
> is too slow, like 8kbytes/s, and because of that I changed to lwip!
>
> What can I do?
>
> I tried to change the variables that u told, but nothing changed ;/
Which API are you using? Can you give an example of your source code? Could you show us your lwipopts.h file?
Thanks
I would check what return codes you're getting from these. If there's a problem they're likely trying to tell you what it is but you're ignoring them!
> Kieran Mansley <kieran@...> writes:
>
>>
>>
>> On 10 Dec 2010, at 19:52, Diego wrote:
>>>
>>> tcp_write(pcb, SndBuffer, SndBufferLen, 0);
>>> tcp_output(pcb);
>>
>> I would check what return codes you're getting from these. If there's a
> problem they're likely trying to
>> tell you what it is but you're ignoring them!
>>
>> Kieran
>
> How can I check this?
rc = tcp_write();
if(rc != 0)
printf("tcp_write error %d",rc);
Have a read of doc/rawapi.txt or look at the lwIP wiki for some detail of what error numbers to expect and what they might mean.
> ERRORS:
>
> #define ERR_OK 0 /* No error, everything OK. */
> #define ERR_MEM -1 /* Out of memory error. */
> #define ERR_BUF -2 /* Buffer error. */
>
>
> #define ERR_ABRT -3 /* Connection aborted. */
> #define ERR_RST -4 /* Connection reset. */
> #define ERR_CLSD -5 /* Connection closed. */
> #define ERR_CONN -6 /* Not connected. */
>
>
> So, when I try to send 768 bytes or more I got Error -1: Out of memory error.
> Do u know what it wanna mean?
As I said before (expecting that this might be your next question): "Have a read of doc/rawapi.txt or look at the lwIP wiki for some detail of what error numbers to expect and what they might mean."
doc/rawapi.txt says:
The tcp_write() function will fail and return ERR_MEM if the length
of the data exceeds the current send buffer size or if the length of
the queue of outgoing segment is larger than the upper limit defined
in lwipopts.h. The number of bytes available in the output queue can
be retrieved with the tcp_sndbuf() function.