cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Visitor
Visitor
856 Views
Registered: ‎08-08-2019

lwIP netif: 'unable to alloc pbuf in recv_handler' message

Jump to solution

Hi,

I'm using an ultrazed eg board; LWIP 2.1.1; FreeRTOS V10.1.1;

I have 3 ethernet lines: two 1Gig and one 100M connections.

Initially one 1Gig and the 100M was brought up, and it worked fine.

On adding the third 1Gig line, I first got "ERR: Max Queues allocated" error message

So I navigated to lwip211_v1_0\src\contrib\ports\xilinx\netif\xpqueue.c and changed NUM_QUEUES to 3.

That resolved the previous error.

Then I started getting 'unable to alloc pbuf in recv_handler' message.

I found other solutions on this forum that suggested increasing certain memory sizes.

The default settings were 

pbuf_pool_bufsize 1770

pbuf_pool_size 256

pbuf_pool_size 256 worked for 2 ethernet lines. didn't get the allocation message.

For 3 ethernet lines: increasing pbuf_pool_bufsize had no effect, but increasing pbuf_pool_size seems to DELAY the time until I get the message.

How is pbuf_pool_size related to the number of ethernet lines (mathematically and logically)?

How should I resolve this?

Thanks for any help

0 Kudos
Reply
1 Solution

Accepted Solutions
Moderator
Moderator
772 Views
Registered: ‎07-31-2012

Hi @shrinir ,

We could compiled a Baremetal lwIP application with RAW sockets, and enabled the Jumbo Frame settings as below.

/**********************************************************************/

 total_heap_size = 262140

  LIBRARY_NAME = lwip211

  API_MODE = SOCKET_API

  dhcp_does_arp_check = true

  lwip_dhcp = true

  mem_size = 524288

  memp_n_pbuf = 1024

  memp_num_netbuf = 4096

  tcpip_mbox_size = 4096

  default_udp_recvmbox_size = 4096

  lwip_tcpip_core_locking_input = true

  n_rx_descriptors = 512

  pbuf_pool_size = 20480

 

For MTU more than default 1500 to 9000 did the below settings

 

"temac_use_jumbo_frames" under the category "temac_adapter_options" to true

"pbuf_pool_bufsize" under the category "pbuf_options" to 20480.

"ip_reass_bufsize" under the category "lwip_ip_options" from the default 5760 to 65535.

 "ip_frag_max_mtu" under the category "lwip_ip_options" from the default 1500 to 9000.

"tcp_mss" under the category "tcp_options" from the default 1460 to 8060.

"mem_size" under the category "lwip_memory_options" from the default 131072 to 524288.

 

Also, extend stack and heap size for e.g. from 0xA000 to 186A0 i.e. 100kb in the linker script of Vitis application.

/*******************************************************************************************/

 

With the above settings, we could observed “unable to alloc pbuf in recv_handler” while receiving packets of size 8000 bytes from the host system.

Similary, you may have to do for freeRTOS.

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------

View solution in original post

1 Reply
Moderator
Moderator
773 Views
Registered: ‎07-31-2012

Hi @shrinir ,

We could compiled a Baremetal lwIP application with RAW sockets, and enabled the Jumbo Frame settings as below.

/**********************************************************************/

 total_heap_size = 262140

  LIBRARY_NAME = lwip211

  API_MODE = SOCKET_API

  dhcp_does_arp_check = true

  lwip_dhcp = true

  mem_size = 524288

  memp_n_pbuf = 1024

  memp_num_netbuf = 4096

  tcpip_mbox_size = 4096

  default_udp_recvmbox_size = 4096

  lwip_tcpip_core_locking_input = true

  n_rx_descriptors = 512

  pbuf_pool_size = 20480

 

For MTU more than default 1500 to 9000 did the below settings

 

"temac_use_jumbo_frames" under the category "temac_adapter_options" to true

"pbuf_pool_bufsize" under the category "pbuf_options" to 20480.

"ip_reass_bufsize" under the category "lwip_ip_options" from the default 5760 to 65535.

 "ip_frag_max_mtu" under the category "lwip_ip_options" from the default 1500 to 9000.

"tcp_mss" under the category "tcp_options" from the default 1460 to 8060.

"mem_size" under the category "lwip_memory_options" from the default 131072 to 524288.

 

Also, extend stack and heap size for e.g. from 0xA000 to 186A0 i.e. 100kb in the linker script of Vitis application.

/*******************************************************************************************/

 

With the above settings, we could observed “unable to alloc pbuf in recv_handler” while receiving packets of size 8000 bytes from the host system.

Similary, you may have to do for freeRTOS.

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------

View solution in original post