git: e5738ee04bf0 - main - Under RSS, assign a TCP flow's inp_flowid anyway.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 May 2023 19:16:05 UTC
The branch main has been updated by cc:
URL: https://cgit.FreeBSD.org/src/commit/?id=e5738ee04bf07edde5a394da83ac119b13c4f9e9
commit e5738ee04bf07edde5a394da83ac119b13c4f9e9
Author: Cheng Cui <cc@FreeBSD.org>
AuthorDate: 2023-05-11 09:06:04 +0000
Commit: Cheng Cui <cc@FreeBSD.org>
CommitDate: 2023-05-18 15:11:53 +0000
Under RSS, assign a TCP flow's inp_flowid anyway.
Summary:
This brings some benefit of a tcp flow identification for some kernel
modules, such as siftr.
Reviewers: rrs, rscheff, tuexen, #transport!
Approved by: tuexen (mentor), rrs
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40061
---
sys/netinet/tcp_input.c | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 55d3e41a07c1..10daab2d61ba 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
+#include "opt_rss.h"
#include <sys/param.h>
#include <sys/arb.h>
@@ -83,6 +84,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
+#include <net/rss_config.h>
#include <net/vnet.h>
#define TCPSTATES /* for logging */
@@ -90,6 +92,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
#include <netinet/in_kdtrace.h>
#include <netinet/in_pcb.h>
+#include <netinet/in_rss.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h> /* required for icmp_var.h */
@@ -99,6 +102,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
#include <netinet6/in6_pcb.h>
+#include <netinet6/in6_rss.h>
#include <netinet6/in6_var.h>
#include <netinet6/ip6_var.h>
#include <netinet6/nd6.h>
@@ -936,10 +940,35 @@ findpcb:
INP_LOCK_ASSERT(inp);
if ((inp->inp_flowtype == M_HASHTYPE_NONE) &&
- (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) &&
!SOLISTENING(inp->inp_socket)) {
- inp->inp_flowid = m->m_pkthdr.flowid;
- inp->inp_flowtype = M_HASHTYPE_GET(m);
+ if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
+ inp->inp_flowid = m->m_pkthdr.flowid;
+ inp->inp_flowtype = M_HASHTYPE_GET(m);
+#ifdef RSS
+ } else {
+ /* assign flowid by software RSS hash */
+#ifdef INET6
+ if (isipv6) {
+ rss_proto_software_hash_v6(&inp->in6p_faddr,
+ &inp->in6p_laddr,
+ inp->inp_fport,
+ inp->inp_lport,
+ IPPROTO_TCP,
+ &inp->inp_flowid,
+ &inp->inp_flowtype);
+ } else
+#endif /* INET6 */
+ {
+ rss_proto_software_hash_v4(inp->inp_faddr,
+ inp->inp_laddr,
+ inp->inp_fport,
+ inp->inp_lport,
+ IPPROTO_TCP,
+ &inp->inp_flowid,
+ &inp->inp_flowtype);
+ }
+#endif /* RSS */
+ }
}
#if defined(IPSEC) || defined(IPSEC_SUPPORT)
#ifdef INET6