|
From: | address@hidden |
Subject: | Re: [lwip-users] low_level_output() tries to send data bigger than MSS |
Date: | Tue, 16 May 2017 21:43:14 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |