Socket buffer

Joel Sherrill joel.sherrill at
Sun Oct 11 15:14:58 UTC 2009


This may not help since my head is foggy this morning.  But
The factors that go into the default socket buffering are
tunable in RTEMS.  Look in rtems_bsdnet.h and the documentation.

When you do this though, you have to tell the stack
to reserve enough memory for the mbufs.  You probably
haven't increased the reserved buffers.


Leon Pollak wrote:
> Hello, all.
> I searched WEB and Wiki - was not able to find an answer...:-(
> --
> I see the message "not delivered. Socket buffer full" in 
> rtems_bsdnet_show_udp_stats report.
> Ok, I now tried to increase the socket buffer (from 1MB to 2MB) by the command 
> setsockopt(so,SOL_SOCKET,SO_RCVBUF,&Size,sizeof(Size)).
>  - failed. 
> Debugging shows that function sbreserve fails in the first check:
> /*
>  * Allot mbufs to a sockbuf.
>  * Attempt to scale mbmax so that mbcnt doesn't become limiting
>  * if buffering efficiency is near the normal case.
>  */
> int
> sbreserve(sb, cc)
> 	struct sockbuf *sb;
> 	u_long cc;
> {
> 	if (cc > sb_max * MCLBYTES / (MSIZE + MCLBYTES))
> 		return (0);
> ......
> Now, when I set sb_max to be 1MB, the max socket buffer size may be also not 
> more then 1MB.
> And I cannot set it higher to 2MB, as the calculation of sb_max * MCLBYTES 
> (which is 2048) exits the 32bit limit.
> This makes me think that increasing the socket buffer to such extend is 
> incorrect. If so, what can I do to avoid this error?
> I thought that the cause may be in the lack of CPU time, but 
> rtems_cpu_usage_report shows that about 35% CPU spends in IDLE task...
> Thanks a lot for any hint.

More information about the users mailing list