mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-03 11:30:53 +00:00
Bug fix: update packet attributes in queued packets in CSMA instead of doing a full packetbuf copy after transmissions. The lower layers often add their own headers to packetbuf.
This commit is contained in:
parent
6a1469aeb2
commit
e8a96dc202
@ -244,9 +244,7 @@ packet_sent(void *ptr, int status, int num_transmissions)
|
|||||||
|
|
||||||
/* This is needed to correctly attribute energy that we spent
|
/* This is needed to correctly attribute energy that we spent
|
||||||
transmitting this packet. */
|
transmitting this packet. */
|
||||||
q = list_head(queued_packet_list);
|
queuebuf_update_attr_from_packetbuf(q->buf);
|
||||||
queuebuf_free(q->buf);
|
|
||||||
q->buf = queuebuf_new_from_packetbuf();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PRINTF("csma: drop with status %d after %d transmissions, %d collisions\n",
|
PRINTF("csma: drop with status %d after %d transmissions, %d collisions\n",
|
||||||
|
@ -163,6 +163,12 @@ queuebuf_new_from_packetbuf(void)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
queuebuf_update_attr_from_packetbuf(struct queuebuf *buf)
|
||||||
|
{
|
||||||
|
packetbuf_attr_copyto(buf->attrs, buf->addrs);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
queuebuf_free(struct queuebuf *buf)
|
queuebuf_free(struct queuebuf *buf)
|
||||||
{
|
{
|
||||||
if(memb_inmemb(&bufmem, buf)) {
|
if(memb_inmemb(&bufmem, buf)) {
|
||||||
|
@ -78,6 +78,7 @@ struct queuebuf *queuebuf_new_from_packetbuf_debug(const char *file, int line);
|
|||||||
#else /* QUEUEBUF_DEBUG */
|
#else /* QUEUEBUF_DEBUG */
|
||||||
struct queuebuf *queuebuf_new_from_packetbuf(void);
|
struct queuebuf *queuebuf_new_from_packetbuf(void);
|
||||||
#endif /* QUEUEBUF_DEBUG */
|
#endif /* QUEUEBUF_DEBUG */
|
||||||
|
void queuebuf_update_attr_from_packetbuf(struct queuebuf *b);
|
||||||
|
|
||||||
void queuebuf_to_packetbuf(struct queuebuf *b);
|
void queuebuf_to_packetbuf(struct queuebuf *b);
|
||||||
void queuebuf_free(struct queuebuf *b);
|
void queuebuf_free(struct queuebuf *b);
|
||||||
|
Loading…
Reference in New Issue
Block a user