New Year netchannel release (take20).
Subsystems (3)
Network channel is peer-to-peer protocol agnostic communication channel between hardware and userspace. They allow to work directly with network hardware from userspace without any kind of filtering or processing from kernel.
Network channels are organized into single multidimensional trie, which allows to perform route, netfilter and other types of lookups in one traversal, since it is completely protocol agnostic.
Layering model does not exist in netchannels - layers are the way to design protocols, not implement them, thus actual protocol processing happens on the ends of netchannel - for example in userspace (userspace network stack), which improves cache locality and reduce overhead of unneded layer crossing.
Changes from previous release:
* process NAT directly in enqueue callback instead of postponing work to kernel thread
* fixed obsoleted route update
* fixed netchannel queueing locking
Netchannels featureset includes:
* multidimensional wildcards support
* RCU searching
* single multidimensional trie for different kinds of dataflows
* dedicated processing threads with possibility to
schedule processing on different CPUs for those
netchannel types which are not acked with processing context
* userspace netchannel backend (allows to receive
packets to userspace), which can be used for:
o high-performance sniffers
o tun/tap device replacement
o packet socket replacement (note, that netchannels steal packets from main stack)
o userspace network stack implementation [2]
o own protocol stack implementaion (from VPN tunnels to TOE)
* netfilter netchannel backend (only NAT is supported as the most interesting user, NAT caches appropriate route, so essentially routing becomes part of the netchannel trie)
1. Netchannels homepage.
http://tservice.net.ru/~s0mbre/old/?section=projects&item=netchannel
2. Userspace network stack.
http://tservice.net.ru/~s0mbre/old/?section=projects&item=unetstack
3. Netchannel vs. socket benchmarks.
http://tservice.net.ru/~s0mbre/blog/2006/10/26#2006_10_26
http://tservice.net.ru/~s0mbre/blog/2006/12/21#2006_12_21
4. Netchannels multidimensional wildcard trie testing. userspace test (scales to millions of end nodes)
http://tservice.net.ru/~s0mbre/blog/2006/12/02#2006_12_02
kernelspace test (tens of thousands of netchannels)
http://tservice.net.ru/~s0mbre/blog/2006/12/21#2006_12_21_1
arch/i386/kernel/syscall_table.S +1 -0
@@ -319,3 +319,4 @@ ENTRY(sys_call_table) .long sys_move_pages .long sys_getcpu .long sys_epoll_pwait + .long sys_netchannel_control
arch/x86_64/ia32/ia32entry.S +1 -0
@@ -718,4 +718,5 @@ ia32_sys_call_table: .quad compat_sys_vmsplice .quad compat_sys_move_pages .quad sys_getcpu + .quad sys_netchannel_control ia32_syscall_end:
include/asm-i386/unistd.h +2 -1
@@ -325,10 +325,11 @@#define __NR_move_pages 317#define __NR_getcpu 318#define __NR_epoll_pwait 319 +#define __NR_netchannel_control 320#ifdef __KERNEL__ -#define NR_syscalls 320 +#define NR_syscalls 321#include <linux/err.h> /*
include/asm-x86_64/unistd.h +3 -1
@@ -619,8 +619,10 @@ __SYSCALL(__NR_sync_file_range, sys_sync_file_range) __SYSCALL(__NR_vmsplice, sys_vmsplice)#define __NR_move_pages 279 __SYSCALL(__NR_move_pages, sys_move_pages) +#define __NR_netchannel_control 280 +__SYSCALL(__NR_netchannel_control, sys_netchannel_control) -#define __NR_syscall_max __NR_move_pages +#define __NR_syscall_max __NR_netchannel_control#ifdef __KERNEL__#include <linux/err.h>
include/linux/connector.h +3 -1
@@ -36,9 +36,11 @@#define CN_VAL_CIFS 0x1#define CN_W1_IDX 0x3/* w1 communication */ #define CN_W1_VAL 0x1 +#define CN_NETCHANNELS_IDX 0x04/* Netchannels connection control */ +#define CN_NETCHANNELS_VAL 0x01 -#define CN_NETLINK_USERS 4 +#define CN_NETLINK_USERS 5/* * Maximum connector's message size.
include/linux/netchannel.h new file +175 -0
175 lines not on this page · raw message
include/linux/netdevice.h +9 -0
@@ -707,6 +707,15 @@ extern int dev_hard_start_xmit(struct sk_buff *skb,extern void dev_init (void ); +#ifdef CONFIG_NETCHANNEL +extern int netchannel_recv (struct sk_buff *skb); +#else +static inline int netchannel_recv (struct sk_buff *skb) +{ +return -1 ; +} +#endif +extern int netdev_budget;/* Called by rtnetlink.c:rtnl_unlock() */
include/linux/skbuff.h +12 -0
@@ -338,6 +338,18 @@ static inline struct sk_buff *alloc_skb(unsigned int size,return __alloc_skb (size, priority,0 ); } +#ifdef CONFIG_NETCHANNEL +struct unetchannel ; +extern struct sk_buff *netchannel_alloc (struct unetchannel *unc,unsigned int header_size, +unsigned int total_size,gfp_t gfp_mask); +#else +static struct sk_buff *netchannel_alloc (void *unc,unsigned int header_size, +unsigned int total_size,gfp_t gfp_mask) +{ +return NULL ; +} +#endif +static inline struct sk_buff *alloc_skb_fclone (unsigned int size,gfp_t priority) {
include/linux/syscalls.h +2 -0
@@ -605,4 +605,6 @@ asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct gint kernel_execve (const char *filename,char *const argv[],char *const envp[]); +asmlinkage long sys_netchannel_control (void __user *arg); +#endif
kernel/sys_ni.c +3 -0
@@ -134,9 +134,12 @@ cond_syscall(sys_mincore);cond_syscall (sys_madvise);cond_syscall (sys_mremap);cond_syscall (sys_remap_file_pages); +cond_syscall (compat_sys_move_pages);/* block-layer dependent */ cond_syscall (sys_bdflush);cond_syscall (sys_ioprio_set);cond_syscall (sys_ioprio_get); + +cond_syscall (sys_netchannel_control);
net/Kconfig +2 -0
@@ -66,6 +66,8 @@ source "net/ipv6/Kconfig" endif # if INET +source "net/core/netchannel/Kconfig" + config NETWORK_SECMARK bool "Security Marking" help
net/core/Makefile +1 -0
@@ -16,5 +16,6 @@ obj-$(CONFIG_NET_DIVERT) += dv.o obj-$(CONFIG_NET_PKTGEN) += pktgen.o obj-$(CONFIG_WIRELESS_EXT) += wireless.o obj-$(CONFIG_NETPOLL) += netpoll.o +obj-$(CONFIG_NETCHANNEL) += netchannel/ obj-$(CONFIG_NET_DMA) += user_dma.o obj-$(CONFIG_FIB_RULES) += fib_rules.o
net/core/dev.c +4 -0
@@ -1808,6 +1808,10 @@ int netif_receive_skb(struct sk_buff *skb) } } + ret =netchannel_recv (skb); +if (!ret) + goto out; +#ifdef CONFIG_NET_CLS_ACT if (pt_prev) { ret =deliver_skb (skb, pt_prev, orig_dev);
net/core/netchannel/Kconfig new file +23 -0
@@ -0,0 +1,23 @@ +config NETCHANNEL + bool "Network channels" + ---help--- + Network channels are peer-to-peer abstraction, which allows to create + high performance communications. + Main advantages are unified address cache, protocol processing moved + to userspace, receiving zero-copy support and other interesting features. + +config NETCHANNEL_NAT + bool "NAT over netchannels" + depends on NETCHANNEL && CONNECTOR=y + ---help--- + Network address translation mechanism based on netchannels. + Initialization works over connector. + +config NETCHANNEL_USERSPACE + bool "Userspace netchannels" + depends on NETCHANNEL + ---help--- + Userspace interface (file descriptor) for netchannels, which allows to implement + network stack in userspace, packet-socket-like interface - when userspace can select + set of IP addressed to work with without main kernel stack - like BGP/OSPF daemons, + TUN/TAP interface, VPN proxies and much more.
net/core/netchannel/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-y += netchannel.o trie.o +obj-$(CONFIG_NETCHANNEL_NAT) += nat.o +obj-$(CONFIG_NETCHANNEL_USERSPACE) += user.o
net/core/netchannel/nat.c new file +537 -0
537 lines not on this page · raw message
net/core/netchannel/netchannel.c new file +607 -0
607 lines not on this page · raw message
net/core/netchannel/trie.c new file +417 -0
417 lines not on this page · raw message
net/core/netchannel/user.c new file +395 -0
395 lines not on this page · raw message
--
Evgeniy Polyakov
Netchanel netfilter usage example.
Quoted 3 lines · Evgeniy Polyakov
* netfilter netchannel backend (only NAT is supported as the most interesting user, NAT caches appropriate route, so essentially routing becomes part of the netchannel trie)
Source NAT example:
connctl -p 6-6 -t 0 -T 10.0.0.1 -s 192.168.0.0-255.255.248.0 -d 10.0.0.0-255.255.255.0 -S 80-80 -D 1234-1234
which is equivalent to
iptables -t nat -I POSTROUTING -p tcp -s 192.168.0.0/21 -d 10.0.0.0/24 --sport 80 --dport 1234 -j SNAT --to-source 10.0.0.1
Netchannels scale easily to tens of thousands entries, userspace test showed scaling to millions of entries (consider system with one million of netfilter rules or at least sockets).
Signature · 1 line
Evgeniy Polyakov