Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/interfaces/csp_if_can_pbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void csp_can_pbuf_free(csp_can_interface_data_t * ifdata, csp_packet_t * buffer,
csp_buffer_free_isr(packet);
}
}

return;
}

prev = packet;
Expand Down Expand Up @@ -73,14 +73,16 @@ void csp_can_pbuf_cleanup(csp_can_interface_data_t * ifdata, int * task_woken) {

while (packet) {

csp_packet_t * next = packet->next;

/* Perform cleanup in used pbufs */
if (now - packet->last_used > PBUF_TIMEOUT_MS) {

/* Erase from list prev->next = next */
if (prev) {
prev->next = packet->next;
prev->next = next;
} else {
ifdata->pbufs = packet->next;
ifdata->pbufs = next;
}

if (task_woken == NULL) {
Expand All @@ -89,10 +91,13 @@ void csp_can_pbuf_cleanup(csp_can_interface_data_t * ifdata, int * task_woken) {
csp_buffer_free_isr(packet);
}

packet = next;
continue;

}

prev = packet;
packet = packet->next;
packet = next;
}

}
Expand Down
12 changes: 9 additions & 3 deletions src/interfaces/csp_if_eth_pbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void csp_eth_pbuf_free(csp_eth_interface_data_t * ifdata, csp_packet_t * buffer,
csp_buffer_free_isr(packet);
}
}
return;
}

prev = packet;
Expand Down Expand Up @@ -68,14 +69,16 @@ void csp_eth_pbuf_cleanup(csp_eth_interface_data_t * ifdata, uint32_t now, int *

while (packet) {

csp_packet_t * next = packet->next;

/* Perform cleanup in used pbufs */
if ((now - packet->last_used) > PBUF_TIMEOUT_MS) {

/* Erase from list prev->next = next */
if (prev) {
prev->next = packet->next;
prev->next = next;
} else {
ifdata->pbufs = packet->next;
ifdata->pbufs = next;
}

if (task_woken == NULL) {
Expand All @@ -84,10 +87,13 @@ void csp_eth_pbuf_cleanup(csp_eth_interface_data_t * ifdata, uint32_t now, int *
csp_buffer_free_isr(packet);
}

packet = next;
continue;

}

prev = packet;
packet = packet->next;
packet = next;
}

}
Expand Down