From eedb49598bb88c1e3f032a4b857211e48646fc10 Mon Sep 17 00:00:00 2001 From: Andrew Gallatin Date: Thu, 20 Oct 2016 13:48:29 +0000 Subject: [PATCH] Clear mbuf hashtype on loopback when RSS is enabled. The hashtype on an outgoing mbuf reflects the correct hash on the transmit side of the connection. If this hash persists on loopback, the receiving RSS/PCBGROUP code will use it to look up the pcbgroup for the transmit side, which will often not match the pcbgroup for the receive side of the connection. This leads to TCP connections hanging, and dropping the SYN/ACK packet. This is essentially the same as having a hardware network card generate mbufs with an incorrect RSS hash. There are a number of places which can set the hash on transmit, so the simplest fix is to simply clear the hash at loopback time. Clearing the hash allows a new, correct hash to be calculated in software on the receive side. Reviewed by: jtl Discussed with: adrian Sponsored by: Netflix --- sys/net/if_loop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 4d7de10b3ca6..72b93e213be4 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -36,6 +36,7 @@ #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_rss.h" #include #include @@ -224,6 +225,10 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len); +#ifdef RSS + M_HASHTYPE_CLEAR(m); +#endif + /* BPF writes need to be handled specially. */ if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &af, sizeof(af));