aboutsummaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorSepherosa Ziehau <sephe@FreeBSD.org>2017-09-05 05:28:52 +0000
committerSepherosa Ziehau <sephe@FreeBSD.org>2017-09-05 05:28:52 +0000
commit0f3af0411d3793f37fe655e697cff5c423fc3995 (patch)
treea5c37c1691fd3842d75fc73378032cff31ef51cf /sys/net
parentafd2f355fb5524b1a7e53c28523d0581a50c2380 (diff)
downloadsrc-0f3af0411d3793f37fe655e697cff5c423fc3995.tar.gz
src-0f3af0411d3793f37fe655e697cff5c423fc3995.zip
if: Add ioctls to get RSS key and hash type/function.
It will be needed by hn(4) to configure its RSS key and hash type/function in the transparent VF mode in order to match VF's RSS settings. The description of the transparent VF mode and the RSS hash value issue are here: https://svnweb.freebsd.org/base?view=revision&revision=322299 https://svnweb.freebsd.org/base?view=revision&revision=322485 These are generic enough to promise two independent IOCs instead of abusing SIOCGDRVSPEC. Setting RSS key and hash type/function is a different story, which probably requires more discussion. Comment about UDP_{IPV4,IPV6,IPV6_EX} were only in the patch in the review request; these hash types are standardized now. Reviewed by: gallatin MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12174
Notes
Notes: svn path=/head/; revision=323170
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c2
-rw-r--r--sys/net/if.h36
2 files changed, 38 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 3e018a61f28d..bc6c5a2cfa80 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2661,6 +2661,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
case SIOCGIFMEDIA:
case SIOCGIFXMEDIA:
case SIOCGIFGENERIC:
+ case SIOCGIFRSSKEY:
+ case SIOCGIFRSSHASH:
if (ifp->if_ioctl == NULL)
return (EOPNOTSUPP);
error = (*ifp->if_ioctl)(ifp, cmd, data);
diff --git a/sys/net/if.h b/sys/net/if.h
index e3b801b8b9c5..91a6786d4fec 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -526,6 +526,42 @@ struct ifi2creq {
uint8_t data[8]; /* read buffer */
};
+/*
+ * RSS hash.
+ */
+
+#define RSS_FUNC_NONE 0 /* RSS disabled */
+#define RSS_FUNC_PRIVATE 1 /* non-standard */
+#define RSS_FUNC_TOEPLITZ 2
+
+#define RSS_TYPE_IPV4 0x00000001
+#define RSS_TYPE_TCP_IPV4 0x00000002
+#define RSS_TYPE_IPV6 0x00000004
+#define RSS_TYPE_IPV6_EX 0x00000008
+#define RSS_TYPE_TCP_IPV6 0x00000010
+#define RSS_TYPE_TCP_IPV6_EX 0x00000020
+#define RSS_TYPE_UDP_IPV4 0x00000040
+#define RSS_TYPE_UDP_IPV6 0x00000080
+#define RSS_TYPE_UDP_IPV6_EX 0x00000100
+
+#define RSS_KEYLEN 128
+
+struct ifrsskey {
+ char ifrk_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ uint8_t ifrk_func; /* RSS_FUNC_ */
+ uint8_t ifrk_spare0;
+ uint16_t ifrk_keylen;
+ uint8_t ifrk_key[RSS_KEYLEN];
+};
+
+struct ifrsshash {
+ char ifrh_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ uint8_t ifrh_func; /* RSS_FUNC_ */
+ uint8_t ifrh_spare0;
+ uint16_t ifrh_spare1;
+ uint32_t ifrh_types; /* RSS_TYPE_ */
+};
+
#endif /* __BSD_VISIBLE */
#ifdef _KERNEL