net: Add function that feeds data to RX fifo

Network drivers should call this when new data has been
received from network.

Change-Id: Ife78fa0683b8c410c38358300a6a18e9325f0ef8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-05-03 10:41:25 +03:00
commit 920a5f5e38
2 changed files with 75 additions and 0 deletions

View file

@ -32,6 +32,9 @@
#include <string.h>
#include <errno.h>
#include <net/net_if.h>
#include <net/buf.h>
/* Stack for the rx fiber.
*/
#if !defined(CONFIG_NET_RX_STACK_SIZE)
@ -55,6 +58,18 @@ static void init_rx_queue(void)
net_rx_fiber, 0, 0, 7, 0);
}
/* Called by driver when an IP packet has been received */
int net_recv(struct net_if *iface, struct net_buf *buf)
{
if (!buf->frags) {
return -ENODATA;
}
nano_fifo_put(&rx_queue, buf);
return 0;
}
static int network_initialization(void)
{