“I realize this isn’t an LwIP problem, but I bet a lot of people have this problem waiting to happen as soon as a short chained packet is sent.”
And that is what these lists are for! Thanks for sharing! From: [email protected] [mailto:[email protected]] On Behalf Of Jeremy Spiller Sent: Thursday, March 28, 2013 12:44 PM To: [email protected] Subject: Re: [lwip-users] LwIP stops sending data (but keeps retrying forever) - caused by buffer chaining The problem isn’t with the LwIP code, but with the Ethernet hardware driver (hdkif.c: hdkif_output). The driver ensures that packets are always at least 60 bytes long. The implementation I have (from TI for the Hercules Device – RM46L852) has this code: /* adjust the packet length if less than minimum required */ if(p->tot_len < MIN_PKT_LEN) { p->tot_len = MIN_PKT_LEN; p->len = MIN_PKT_LEN; } This works as long as buffers are not chained. When the buffers are chained, the packet is permanently destroyed so re-transmits will always fail. The fix is to change the above code to: /* adjust the packet length if less than minimum required */ if(p->tot_len < MIN_PKT_LEN) { struct pbuf *temp_p; int diff_len = MIN_PKT_LEN - p->tot_len; for (temp_p = p; temp_p->next != NULL; temp_p = temp_p->next) temp_p->tot_len += diff_len; temp_p->tot_len += diff_len; temp_p->len += diff_len; } I realize this isn’t an LwIP problem, but I bet a lot of people have this problem waiting to happen as soon as a short chained packet is sent. -Jeremy
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
