From owner-svn-src-head@freebsd.org Wed Apr 15 19:28:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BA042BF61E; Wed, 15 Apr 2020 19:28:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 492XTc0qMzz4GwV; Wed, 15 Apr 2020 19:28:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 175DC23FBB; Wed, 15 Apr 2020 19:28:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03FJSpsR057640; Wed, 15 Apr 2020 19:28:51 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03FJSpUU057637; Wed, 15 Apr 2020 19:28:51 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004151928.03FJSpUU057637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 15 Apr 2020 19:28:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359983 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 359983 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2020 19:28:52 -0000 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;