net: Add L2 RAW channel hidden option

L2 RAW channel allows to use some functions of IP stack for RAW access
of network drivers. It is hidden from user and is selected by 2520 raw
driver.

Change-Id: I91dd09803052072dfddb7989d9d67c3a5840f89e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2016-09-27 15:45:09 +03:00 committed by Jukka Rissanen
commit 7889ebaf5e
6 changed files with 52 additions and 34 deletions

View file

@ -48,6 +48,7 @@ config TI_CC2520
config TI_CC2520_RAW
bool "TI CC2520 Driver RAW channel"
select NET_L2_RAW_CHANNEL
default n
help
Enable TI_CC2520 driver with RAW channel

View file

@ -130,7 +130,12 @@ struct sockaddr_in_ptr {
#define NET_SOCKADDR_MAX_SIZE (sizeof(struct sockaddr_in))
#define NET_SOCKADDR_PTR_MAX_SIZE (sizeof(struct sockaddr_in_ptr))
#else
#if !defined(CONFIG_NET_L2_RAW_CHANNEL)
#error "Either IPv6 or IPv4 needs to be selected."
#else
#define NET_SOCKADDR_MAX_SIZE (sizeof(struct sockaddr_in6))
#define NET_SOCKADDR_PTR_MAX_SIZE (sizeof(struct sockaddr_in6_ptr))
#endif
#endif
struct sockaddr {

View file

@ -80,7 +80,6 @@ source "net/ip/Kconfig"
source "net/yaip/Kconfig"
endif
endmenu

View file

@ -1,6 +1,10 @@
obj-$(CONFIG_NET_BUF) += buf.o
ifeq ($(CONFIG_NET_YAIP),y)
ifeq ($(CONFIG_NET_L2_RAW_CHANNEL),y)
obj-y += yaip/nbuf.o
else
obj-y += yaip/
endif
else
obj-$(CONFIG_NETWORKING) += ip/
endif

View file

@ -19,6 +19,13 @@
menu "New IP stack [EXPERIMENTAL]"
depends on NET_YAIP
# Hidden option
config NET_L2_RAW_CHANNEL
bool
default n
if !NET_L2_RAW_CHANNEL
config NET_INIT_PRIO
int
default 90
@ -110,38 +117,6 @@ config NET_RX_STACK_SIZE
Set the RX fiber stack size in bytes. The RX fiber is waiting
data from network. There is one RX fiber in the system.
config NET_NBUF_RX_COUNT
int "How many network receives can be pending at the same time"
default 2
help
Each RX buffer will occupy smallish amount of memory.
See include/net/nbuf.h and the sizeof(struct nbuf)
config NET_NBUF_TX_COUNT
int "How many network sends can be pending at the same time"
default 2
help
Each TX buffer will occupy smallish amount of memory.
See include/net/nbuf.h and the sizeof(struct nbuf)
config NET_NBUF_DATA_COUNT
int "How many network data buffers are allocated"
default 16
help
Each data buffer will occupy CONFIG_NBUF_DATA_SIZE + smallish
header (sizeof(struct net_buf)) amount of data.
config NET_NBUF_DATA_SIZE
int "Size of each network data fragment"
default 128
help
This value tells what is the size of the data fragment that is
received from the network.
Example: For IEEE 802.15.4, the network packet is 127 bytes long,
which leaves in worst case 81 bytes for user data (MTU).
In order to be able to receive at least full IPv6 packet which
has a size of 1280 bytes, the one should allocate 16 fragments here.
config NET_MAX_CONTEXTS
int "Number of network contexts to allocate"
default 2
@ -192,6 +167,40 @@ config NET_DEBUG_TRICKLE
help
Enables Trickle library output debug messages
endif # NET_L2_RAW_CHANNEL
config NET_NBUF_RX_COUNT
int "How many network receives can be pending at the same time"
default 2
help
Each RX buffer will occupy smallish amount of memory.
See include/net/nbuf.h and the sizeof(struct nbuf)
config NET_NBUF_TX_COUNT
int "How many network sends can be pending at the same time"
default 2
help
Each TX buffer will occupy smallish amount of memory.
See include/net/nbuf.h and the sizeof(struct nbuf)
config NET_NBUF_DATA_COUNT
int "How many network data buffers are allocated"
default 16
help
Each data buffer will occupy CONFIG_NBUF_DATA_SIZE + smallish
header (sizeof(struct net_buf)) amount of data.
config NET_NBUF_DATA_SIZE
int "Size of each network data fragment"
default 128
help
This value tells what is the size of the data fragment that is
received from the network.
Example: For IEEE 802.15.4, the network packet is 127 bytes long,
which leaves in worst case 81 bytes for user data (MTU).
In order to be able to receive at least full IPv6 packet which
has a size of 1280 bytes, the one should allocate 16 fragments here.
source "net/yaip/l2/Kconfig"
source "net/yaip/Kconfig.mgmt"

View file

@ -56,7 +56,7 @@
#endif /* UDP */
#endif /* TCP */
#if defined(CONFIG_NET_IPV6)
#if defined(CONFIG_NET_IPV6) || defined(CONFIG_NET_L2_RAW_CHANNEL)
#define IP_PROTO_LEN NET_IPV6H_LEN
#else
#if defined(CONFIG_NET_IPV4)