Module Name:    src
Committed By:   knakahara
Date:           Fri Feb 16 04:48:33 UTC 2018

Modified Files:
        src/sys/net: Makefile files.net
Added Files:
        src/sys/net: rss_config.c rss_config.h

Log Message:
Introduce very simple Receive Side Scaling (RSS) utility.

ok by msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/net/Makefile
cvs rdiff -u -r1.14 -r1.15 src/sys/net/files.net
cvs rdiff -u -r0 -r1.1 src/sys/net/rss_config.c src/sys/net/rss_config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/Makefile
diff -u src/sys/net/Makefile:1.34 src/sys/net/Makefile:1.35
--- src/sys/net/Makefile:1.34	Wed Jan 10 10:56:30 2018
+++ src/sys/net/Makefile	Fri Feb 16 04:48:32 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2018/01/10 10:56:30 knakahara Exp $
+#	$NetBSD: Makefile,v 1.35 2018/02/16 04:48:32 knakahara Exp $
 
 INCSDIR= /usr/include/net
 
@@ -8,7 +8,7 @@ INCS=	bpf.h bpfjit.h bpfdesc.h dlt.h eth
 	if_pflog.h if_ppp.h if_pppoe.h if_l2tp.h if_sppp.h if_srt.h if_stf.h \
 	if_tap.h if_token.h if_tun.h if_types.h if_vlanvar.h net_stats.h \
 	netisr.h pfil.h pfkeyv2.h pfvar.h ppp-comp.h ppp_defs.h radix.h \
-	raw_cb.h route.h slcompress.h slip.h zlib.h
+	raw_cb.h route.h rss_config.h slcompress.h slip.h zlib.h
 
 SUBDIR=	agr npf
 

Index: src/sys/net/files.net
diff -u src/sys/net/files.net:1.14 src/sys/net/files.net:1.15
--- src/sys/net/files.net:1.14	Wed Jan 10 10:56:30 2018
+++ src/sys/net/files.net	Fri Feb 16 04:48:32 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.net,v 1.14 2018/01/10 10:56:30 knakahara Exp $
+#	$NetBSD: files.net,v 1.15 2018/02/16 04:48:32 knakahara Exp $
 
 # XXX CLEANUP
 define	net
@@ -48,6 +48,7 @@ file	net/radix.c			net
 file	net/raw_cb.c			net
 file	net/raw_usrreq.c		net
 file	net/route.c			net
+file	net/rss_config.c		net
 file	net/rtbl.c			net
 file	net/rtsock.c			net
 file	net/slcompress.c		sl | ppp | strip | (irip & irip_vj)

Added files:

Index: src/sys/net/rss_config.c
diff -u /dev/null src/sys/net/rss_config.c:1.1
--- /dev/null	Fri Feb 16 04:48:33 2018
+++ src/sys/net/rss_config.c	Fri Feb 16 04:48:32 2018
@@ -0,0 +1,76 @@
+/*	$NetBSD: rss_config.c,v 1.1 2018/02/16 04:48:32 knakahara Exp $  */
+
+/*
+ * Copyright (c) 2018 Internet Initiative Japan Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: rss_config.c,v 1.1 2018/02/16 04:48:32 knakahara Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+
+#include <net/rss_config.h>
+
+/*
+ * Same as FreeBSD.
+ *
+ * This rss key is assumed for verification suite in many intel Gigabit and
+ * 10 Gigabit Controller specifications.
+ */
+static uint8_t rss_default_key[RSS_KEYSIZE] = {
+	0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
+	0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
+	0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
+	0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
+	0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa,
+};
+
+#ifdef NOTYET
+/*
+ * Same as DragonFlyBSD.
+ *
+ * This rss key make rss hash value symmetric, that is, the hash value
+ * calculated by func("source address", "destination address") equals to
+ * the hash value calculated by func("destination address", "source address").
+ */
+static uint8_t rss_symmetric_key[RSS_KEYSIZE] = {
+	0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a,
+	0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a,
+	0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a,
+	0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a,
+};
+#endif
+
+/*
+ * sizeof(key) must be more than or equal to RSS_KEYSIZE.
+ */
+void
+rss_getkey(uint8_t *key)
+{
+
+	memcpy(key, rss_default_key, sizeof(rss_default_key));
+}
Index: src/sys/net/rss_config.h
diff -u /dev/null src/sys/net/rss_config.h:1.1
--- /dev/null	Fri Feb 16 04:48:33 2018
+++ src/sys/net/rss_config.h	Fri Feb 16 04:48:32 2018
@@ -0,0 +1,36 @@
+/*	$NetBSD: rss_config.h,v 1.1 2018/02/16 04:48:32 knakahara Exp $  */
+
+/*
+ * Copyright (c) 2018 Internet Initiative Japan Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _NET_RSS_CONFIG_H_
+#define _NET_RSS_CONFIG_H_
+
+#define RSS_KEYSIZE 40
+
+void	rss_getkey(uint8_t *);
+
+#endif /* _NET_RSS_CONFIG_H_ */

Reply via email to