forked from M-Labs/artiq
1
0
Fork 0

liblwip/netif/liteethif: follow lwip doc recommendations regarding end of pbuf chain detection

This commit is contained in:
Sebastien Bourdeauducq 2015-04-23 17:21:42 +08:00
parent 7290013671
commit 459da723d3
1 changed files with 14 additions and 6 deletions

View File

@ -59,10 +59,15 @@ static err_t liteeth_low_level_output(struct netif *netif, struct pbuf *p)
struct pbuf *q;
txlen = 0;
for(q = p; q != NULL; q = q->next) {
q = p;
while(q) {
memcpy(txbuffer, q->payload, q->len);
txbuffer += q->len;
txlen += q->len;
if(q->tot_len != q->len)
q = q->next;
else
q = NULL;
}
ethmac_sram_reader_slot_write(txslot);
@ -91,11 +96,14 @@ static struct pbuf *liteeth_low_level_input(struct netif *netif)
rxbuffer = rxbuffer0;
p = pbuf_alloc(PBUF_RAW, rxlen, PBUF_POOL);
if(p != NULL) {
for(q = p; q != NULL; q = q->next) {
q = p;
while(q) {
memcpy(q->payload, rxbuffer, q->len);
rxbuffer += q->len;
}
if(q->tot_len != q->len)
q = q->next;
else
q = NULL;
}
return p;