Forum Discussion
Altera_Forum
Honored Contributor
14 years agoSlow UDP receiving with inichestack
Hi, everyone.
I got a problem here with my udp packet receiving. I use TSE as the MAC driver and inichestack TCP/IP, running on the Altera Cyclone 3 C120, I noticed that there is a significant packet loss with my application. After very detailed examinination, I found that the inichestack seems to be slow at packet receiving. After a while there will be this log info: ...... No free buffers for rx No free buffers for rx ....... It seems that the inichestack can not catch up with the TSE and the buffer overflows. By the way, my udp sending rate is only 500kbps. My IDE is quartus 8.0. Anyone who has the same problem with me or Anyone who can drop me a clue, please do contact me. Thanks.12 Replies
- Altera_Forum
Honored Contributor
Hi, Kaushal
How is everything going now? - Altera_Forum
Honored Contributor
Hi, kaushal
I have checked the code and the buffer size definition seems to be all right. You can print out in function "pk_init" to make sure size of "bigfreeq" is 600 and size of "litfreeq" is 300. That can be checked by "bigfreeq.q_len". You also need to check that the udp bandwidth is not too high. The tcp/ip stack can only receive udp bandwidth less than 2Mbps (that's a figure evaluated by me, not an authoritative figure) in the fuction pk_free [pktalloc.c], comment the code: //e = pk_validate(pkt); It will reduce the performance. Good luck! - Altera_Forum
Honored Contributor
Hello there,
Thanking you for your prompt response, OK I have found there are redefinitions about NUMBIGBUFS and NUMLILBUFS in pk_alloc.c (Line No. 55 and 57), as you says get rid of them mean I should comment both of them in pk_alloc.c and Second one “in pk_init the buffer initial size is exact the size that ipport.h defined”, in ipport.h there is no keyword like pk_init. So little confuse …. I have attached my ipport.h and pkalloc.c for your reference please point out where should I edit. Regards kaushal - Altera_Forum
Honored Contributor
In pkalloc.c there are redifinitions about NUMBIGBUFS and NUMLILBUFS, get rid of them and make sure that in pk_init the buffer initial size is exact the size that ipport.h defined.
Good luck! - Altera_Forum
Honored Contributor
Hello gecko,
below instruction again generate the same error "no free buffer for rx"...i am using UDP packet size 512 bytes 1) change the buffer size in ipport.h # define NUMBIGBUFS 600# define NUMLILBUFS 300 /* some maximum packet buffer numbers */# define MAXBIGPKTS 600# define MAXLILPKTS 300# define MAXPACKETS (MAXLILPKTS+MAXBIGPKTS) 2) reset the receiving buffer size (the default size is only 1 K or so) int nRecvBuf=32*1024; setsockopt(s_UdpSock, SOL_SOCKET, SO_RCVBUF,(const char*)&nRecvBuf,sizeof(int)); - Altera_Forum
Honored Contributor
hello Gecko,
Thanx lot, will try this out and get back to you....though i have increase the UDP packet size from 512 to 1472....will sorted out my problem...but i will try this out also. *i have increase the receiver buffer size big enough as you mantioned but not yet set the socket option... regards kaushal - Altera_Forum
Honored Contributor
Hi, everyone,
Sorry to reply late because I didn't follow this issue for long time. You can take these steps to address this : 1) change the buffer size in ipport.h # define NUMBIGBUFS 600# define NUMLILBUFS 300 /* some maximum packet buffer numbers */# define MAXBIGPKTS 600# define MAXLILPKTS 300# define MAXPACKETS (MAXLILPKTS+MAXBIGPKTS) 2) reset the receiving buffer size (the default size is only 1 K or so) int nRecvBuf=32*1024;//设置为32K setsockopt(s_UdpSock, SOL_SOCKET, SO_RCVBUF,(const char*)&nRecvBuf,sizeof(int)); Generally the problem will be addressed if your udp bandwidth is low. thanks. - Altera_Forum
Honored Contributor
Hi,
I am also stucked in the same issue(No free buffers for Rx) as you said that nichestack buffer reading speed is increased to solve this problem. I want to know How? because once stack is started only application is interacting with stack to take data by using recvfrom() in case of UDP. Have you increased clk speed of CPU or else? please help me with regards Hyanki - Altera_Forum
Honored Contributor
--- Quote Start --- Hi everyone,I have solved this problem. There are TCP packets on the net but my application doesn't received them, so the TCP packets will remain in the iniche stack buffers and accumulate until the iniche stack timeout to release. That will abosolutely have greate impact on the udp receiving and degrade the rate.Thanks for your help. --- Quote End --- Hello Gecko, I am facing the similar problem..., as you says that Packets remain in iniche stack buffer and accumulate until the iniche stack timeout to release. my application continuously read this accumulated data without any processing delay, but still same message is there "no free buffer for rx". i am stuck with this error from past several month's but not yet get any solution, could you plz help me out how do i come out from this problem. My UDP receiver Application written in "simple_socket_server.c" kaushal - Altera_Forum
Honored Contributor
Hi everyone,I have solved this problem. There are TCP packets on the net but my application doesn't received them, so the TCP packets will remain in the iniche stack buffers and accumulate until the iniche stack timeout to release. That will abosolutely have greate impact on the udp receiving and degrade the rate.Thanks for your help.