Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Introduce very simple Receive Side Scaling (RSS) uti...
details: https://anonhg.NetBSD.org/src/rev/2e14e12d0add
branches: trunk
changeset: 829870:2e14e12d0add
user: knakahara <knakahara%NetBSD.org@localhost>
date: Fri Feb 16 04:48:32 2018 +0000
description:
Introduce very simple Receive Side Scaling (RSS) utility.
ok by msaitoh@n.o.
diffstat:
sys/net/Makefile | 4 +-
sys/net/files.net | 3 +-
sys/net/rss_config.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
sys/net/rss_config.h | 36 ++++++++++++++++++++++++
4 files changed, 116 insertions(+), 3 deletions(-)
diffs (155 lines):
diff -r 67b22123d1d3 -r 2e14e12d0add sys/net/Makefile
--- a/sys/net/Makefile Fri Feb 16 01:54:18 2018 +0000
+++ b/sys/net/Makefile Fri Feb 16 04:48:32 2018 +0000
@@ -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 @@
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
diff -r 67b22123d1d3 -r 2e14e12d0add sys/net/files.net
--- a/sys/net/files.net Fri Feb 16 01:54:18 2018 +0000
+++ b/sys/net/files.net Fri Feb 16 04:48:32 2018 +0000
@@ -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/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)
diff -r 67b22123d1d3 -r 2e14e12d0add sys/net/rss_config.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/net/rss_config.c Fri Feb 16 04:48:32 2018 +0000
@@ -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));
+}
diff -r 67b22123d1d3 -r 2e14e12d0add sys/net/rss_config.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/net/rss_config.h Fri Feb 16 04:48:32 2018 +0000
@@ -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_ */
Home |
Main Index |
Thread Index |
Old Index