Skip to content

Commit

Permalink
liblwip/netif/liteethif: follow lwip doc recommendations regarding en…
Browse files Browse the repository at this point in the history
…d of pbuf chain detection
sbourdeauducq committed Apr 23, 2015
1 parent 7290013 commit 459da72
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions soc/runtime/liblwip/netif/liteethif.c
Original file line number Diff line number Diff line change
@@ -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) {
memcpy(q->payload, rxbuffer, q->len);
rxbuffer += q->len;
}
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;

0 comments on commit 459da72

Please sign in to comment.