net: Convert net_buf_put() to use new nano_fifo_put_list() API
This is the only safe way, especially when doing the call from a task. Change-Id: Ic50b73e04c4b831ac481dd56596f9d36cf0e2ccc Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
53c3106520
commit
195216d471
1 changed files with 4 additions and 13 deletions
17
net/buf.c
17
net/buf.c
|
@ -106,22 +106,13 @@ struct net_buf *net_buf_get(struct nano_fifo *fifo, size_t reserve_head)
|
|||
|
||||
void net_buf_put(struct nano_fifo *fifo, struct net_buf *buf)
|
||||
{
|
||||
int mask;
|
||||
struct net_buf *tail;
|
||||
|
||||
mask = irq_lock();
|
||||
|
||||
while (buf) {
|
||||
struct net_buf *frag = buf->frags;
|
||||
|
||||
if (frag) {
|
||||
buf->flags |= NET_BUF_FRAGS;
|
||||
}
|
||||
|
||||
nano_fifo_put(fifo, buf);
|
||||
buf = frag;
|
||||
for (tail = buf; tail->frags; tail = tail->frags) {
|
||||
tail->flags |= NET_BUF_FRAGS;
|
||||
}
|
||||
|
||||
irq_unlock(mask);
|
||||
nano_fifo_put_list(fifo, buf, tail);
|
||||
}
|
||||
|
||||
void net_buf_unref(struct net_buf *buf)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue