Simeon Trifonov wrote:
My function low_level_output() sometimes tries to send data
bigger than MSS.

First of all you're mixing up things: the low_level_output() function must *always* be prepared to handle packets larger than MSS: MSS limits TCP data while your netif has to send MTU + ETH headers.

Normally for IPv4: MSS=1460, MTU=1500 (MSS + 20 bytes TCP header + 20 bytes IPv4 header), ETH header = 14 bytes --> max. TX frame length = 1514 bytes.

The pointer
p of my function low_level_output() points to a buffer that has a len =
54 and tot_len = 1514. The pointer next also is valid (not NULL) and
points to the next pbuf. But this next pbuf has a len = 1460 and tot_len
= 1460. It doesn't match to the precious buffer.

Before writing a netif driver, you should first understand pbufs. E.g., it helps to read Adam's original paper on lwip (2001: "Design and Implementation of the lwIP TCP/IP Stack"): "In other words, the tot len field is the sum of the len field and the value of the tot len field in the following pbuf in the pbuf chain."

To sum up, there's nothing wrong as long as 1460 + 54 == 1514 (i.e. p->tot_len of the 'p' passed into your output function has to be <= 1514).

Simon

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to