net: Initial commit for the new IP stack

This is a placeholder that compiles but does nothing else.

Change-Id: I9689fa26eb13bc23d29940938f7b3c11f32b2ff1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-04-29 15:52:09 +03:00
parent 96c4a4b3a3
commit a3b88f53c4
7 changed files with 116 additions and 0 deletions

View file

@ -14,4 +14,8 @@
* limitations under the License.
*/
#if defined(CONFIG_NET_YAIP)
#include <net/yaip/net_core.h>
#else
#include <net/uip/net_core.h>
#endif

View file

@ -14,4 +14,8 @@
* limitations under the License.
*/
#if defined(CONFIG_NET_YAIP)
#include <net/yaip/net_ip.h>
#else
#include <net/uip/net_ip.h>
#endif

View file

@ -14,4 +14,8 @@
* limitations under the License.
*/
#if defined(CONFIG_NET_YAIP)
#include <net/yaip/net_socket.h>
#else
#include <net/uip/net_socket.h>
#endif

View file

@ -41,6 +41,11 @@ config NET_UIP
bool "uIP"
help
Choose this if unsure.
config NET_YAIP
bool "New IP stack [EXPERIMENTAL]"
help
New IP stack.
endchoice
if NETWORKING && NET_UIP
@ -604,6 +609,10 @@ endif
if NETWORKING
if NET_YAIP
source "net/yaip/Kconfig"
endif
source "net/ip/Kconfig.debug"
endif

17
net/yaip/Kconfig Normal file
View file

@ -0,0 +1,17 @@
# Kconfig.yaip - Yet another IP stack config
#
# Copyright (c) 2016 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

2
net/yaip/Makefile Normal file
View file

@ -0,0 +1,2 @@
ccflags-y += -I${srctree}/net/ip
obj-y = net_core.o

76
net/yaip/net_core.c Normal file
View file

@ -0,0 +1,76 @@
/** @file
* @brief Network initialization
*
* Initialize the network IP stack. Create two fibers, one for reading data
* from applications (Tx fiber) and one for reading data from IP stack
* and passing that data to applications (Rx fiber).
*/
/*
* Copyright (c) 2016 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef CONFIG_NETWORKING_WITH_LOGGING
#define DEBUG 1
#endif
#include <nanokernel.h>
#include <toolchain.h>
#include <sections.h>
#include <string.h>
#include <errno.h>
/* Stacks for the rx fiber.
*/
#if !defined(CONFIG_NET_RX_STACK_SIZE)
#define CONFIG_NET_RX_STACK_SIZE 1024
#endif
static char __noinit __stack rx_fiber_stack[CONFIG_IP_RX_STACK_SIZE];
static struct nano_fifo rx_queue;
static void net_rx_fiber(int unused1, int unused2)
{
while (0) {
/* FIXME - implementation missing */
}
}
static void init_rx_queue(void)
{
nano_fifo_init(&rx_queue);
fiber_start(rx_fiber_stack, sizeof(rx_fiber_stack),
net_rx_fiber, 0, 0, 7, 0);
}
static int network_initialization(void)
{
return 0;
}
int net_init(void)
{
static uint8_t initialized;
if (initialized)
return -EALREADY;
initialized = 1;
init_rx_queue();
return network_initialization();
}