summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorPeter Lawrence <[email protected]>2020-10-24 17:29:47 -0500
committerPeter Lawrence <[email protected]>2020-10-24 17:29:47 -0500
commitf5b72f5796554910e14040cf747d6eea9505ee1a (patch)
tree57ca08a2fb188cb874bebe5fc8a891ec4b4e9275 /src/class
parent43cb5fabfd6d0fca749e9512cc2061deab0adafd (diff)
net_device: tweak 'pbuf chain' implementation
Diffstat (limited to 'src/class')
-rw-r--r--src/class/net/net_device.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/class/net/net_device.c b/src/class/net/net_device.c
index 1d7f9ce3a..238d64d81 100644
--- a/src/class/net/net_device.c
+++ b/src/class/net/net_device.c
@@ -374,8 +374,8 @@ static void handle_incoming_packet(uint32_t len)
if (p)
{
+ /* pbuf_alloc() has already initialized struct; all we need to do is copy the data */
memcpy(p->payload, pnt, size);
- p->len = size;
accepted = tud_network_recv_cb(p);
if (!accepted) pbuf_free(p);
@@ -441,11 +441,13 @@ void tud_network_xmit(struct pbuf *p)
len = (_netd_itf.ecm_mode) ? 0 : CFG_TUD_NET_PACKET_PREFIX_LEN;
data = transmitted + len;
+ /* traverse the "pbuf chain"; see ./lwip/src/core/pbuf.c for more info */
for(q = p; q != NULL; q = q->next)
{
memcpy(data, (char *)q->payload, q->len);
data += q->len;
len += q->len;
+ if (q->len == q->tot_len) break;
}
if (!_netd_itf.ecm_mode)