Skip to contentSkip to conversation

Netchannels. The 22'th century release.

PATCH Evgeniy Polyakov 1 participant 1 message Dec 4, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi.

This is the 22'th release of the netchannels, a peer-to-peer protocol agnostic communication channel between hardware and users. It uses unified cache to store channels, allows to allocate buffers for data from userspace mapped area or from other preallocated set of pages (like VFS cache). All protocol processing happens in process context.

Users of the system can be for example userspace - it allows to receive and send traffic from the wire without any kernel interference, to implement own protocols and offload its processing to the hardware.

This idea was originally proposed and implemented by Van Jacobson. This patchset (with userspace netowrk stack) is a logical continuation of the idea with move to the full peer-to-peer processing.

One of its users is userspace network stack [2].

Short changelog:
* update cached route in the netchannel when it expires.

Thanks to Salvatore Del Popolo <[email protected]> for testing.

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

arch/i386/kernel/syscall_table.S +1 -0
index 2697e92..3231b22 100644
@@ -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
index b4aa875..d35d4d8 100644
@@ -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
index beeeaf6..33242f8 100644
@@ -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
index 777288e..16f1aac 100644
@@ -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
index 4c02119..bdf6432 100644
@@ -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
index 9264139..a3bc419 100644
@@ -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
index 85577a4..ff2bdf9 100644
@@ -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
index 1912c6c..a42e608 100644
@@ -605,4 +605,6 @@ asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct g
 
 int 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
index 0e53314..275e3e8 100644
@@ -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
index a81aca4..da6edfe 100644
@@ -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
index 1195680..98c165e 100644
@@ -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
index 81c426a..33ba1ff 100644
@@ -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 +16 -0
new file mode 100644
index 0000000..760d1d5
@@ -0,0 +1,16 @@
+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_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 +2 -0
new file mode 100644
index 0000000..337ed35
@@ -0,0 +1,2 @@
+obj-y += netchannel.o trie.o
+obj-$(CONFIG_NETCHANNEL_USERSPACE) += user.o
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 +403 -0

403 lines not on this page · raw message

Signature · 1 line
	Evgeniy Polyakov