Date: Wed, 15 Apr 2020 19:28:51 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359983 - head/sys/dev/cxgbe/tom Message-ID: <202004151928.03FJSpUU057637@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Apr 15 19:28:51 2020 New Revision: 359983 URL: https://svnweb.freebsd.org/changeset/base/359983 Log: Set inp_flowid's for TOE connections. KTLS uses the flowid to distribute software encryption tasks among its pool of worker threads. Without this change, all software KTLS requests for TOE sockets ended up on the first worker thread. Note that the flowid for TOE sockets created via connect() is not a hash of the 4-tuple, but is instead the id of the TOE pcb (tid). The flowid of TOE sockets created from TOE listen sockets do use the 4-tuple RSS hash as the flowid since the firmware provides the hash in the message containing the original SYN. Reviewed by: np (earlier version) Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D24348 Modified: head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Wed Apr 15 19:23:53 2020 (r359982) +++ head/sys/dev/cxgbe/tom/t4_connect.c Wed Apr 15 19:28:51 2020 (r359983) @@ -101,6 +101,8 @@ do_act_establish(struct sge_iq *iq, const struct rss_h make_established(toep, be32toh(cpl->snd_isn) - 1, be32toh(cpl->rcv_isn) - 1, cpl->tcp_opt); + inp->inp_flowtype = M_HASHTYPE_OPAQUE; + inp->inp_flowid = tid; if (ulp_mode(toep) == ULP_MODE_TLS) tls_establish(toep); Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Wed Apr 15 19:23:53 2020 (r359982) +++ head/sys/dev/cxgbe/tom/t4_listen.c Wed Apr 15 19:28:51 2020 (r359983) @@ -946,9 +946,7 @@ t4_offload_socket(struct toedev *tod, void *arg, struc { struct adapter *sc = tod->tod_softc; struct synq_entry *synqe = arg; -#ifdef INVARIANTS struct inpcb *inp = sotoinpcb(so); -#endif struct toepcb *toep = synqe->toep; NET_EPOCH_ASSERT(); /* prevents bad race with accept() */ @@ -962,6 +960,9 @@ t4_offload_socket(struct toedev *tod, void *arg, struc toep->flags |= TPF_CPL_PENDING; update_tid(sc, synqe->tid, toep); synqe->flags |= TPF_SYNQE_EXPANDED; + inp->inp_flowtype = (inp->inp_vflag & INP_IPV6) ? + M_HASHTYPE_RSS_TCP_IPV6 : M_HASHTYPE_RSS_TCP_IPV4; + inp->inp_flowid = synqe->rss_hash; } static void @@ -1299,6 +1300,8 @@ found: NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(true); } + MPASS(rss->hash_type == RSS_HASH_TCP); + synqe->rss_hash = be32toh(rss->hash_val); atomic_store_int(&synqe->ok_to_respond, 0); init_conn_params(vi, &settings, &inc, so, &cpl->tcpopt, e->idx, Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Wed Apr 15 19:23:53 2020 (r359982) +++ head/sys/dev/cxgbe/tom/t4_tom.h Wed Apr 15 19:28:51 2020 (r359983) @@ -242,6 +242,7 @@ struct synq_entry { uint32_t iss; uint32_t irs; uint32_t ts; + uint32_t rss_hash; __be16 tcp_opt; /* from cpl_pass_establish */ struct toepcb *toep;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004151928.03FJSpUU057637>