On 8 Dec 2011, at 18:51, Gary Spivey wrote:

> What is the preferred way to configure lwip so that I can either accept 
> packets larger than PBUF_POOL_BUFSIZE or ensure that I don’t receive them?

To accept packets larger than PBUF_POOL_BUFSIZE you should, when you receive 
them, copy them into the chain of pbufs that you get when you alloc, being 
careful to split the received data across the pbufs as necessary.

To ensure that you don't receive packets larger than PBUF_POOL_BUFSIZE, set 
that value larger than the biggest packet you can receive.  This is a property 
of the LAN you are connected to (i.e. it is a value that should be known by all 
the hosts and configured the same) and can vary, so I can't tell you a good 
value.  

In the default, we assume that the largest value on the network is 
MSS+40+PBUF_LINK_HLEN, where the 40 is for IP and TCP headers.  It is possible 
for TCP headers to be bigger than that (if there are options included for 
example) or for another host on the network to have a larger MSS and MTU than 
lwIP's default, and so you may need to adjust PBUF_POOL_BUFSIZE to match if you 
want to fit a frame into a single buffer.

I'm not sure whey DHCP didn't work when you started splitting packets across 
buffers.  It should.  It's either a bug in lwIP or a bug in the way you were 
filling the buffers.  If you can get more information on the reason for the 
failure that would be useful.

Note that you should also handle chains of pbufs on the send path in your 
driver.  With a relatively small PBUF_POOL_BUFSIZE lwIP can pass packets for 
transmission to the driver as a chain as well.

Hope that helps,

Kieran
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to