From owner-svn-src-all@freebsd.org Fri Dec 13 23:33:54 2019 Return-Path: Delivered-To: svn-src-all@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 D6AD71DA03A; Fri, 13 Dec 2019 23:33:54 +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 47ZRnZ5HM3z4fZm; Fri, 13 Dec 2019 23:33:54 +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 B09771BD48; Fri, 13 Dec 2019 23:33:54 +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 xBDNXsTb012848; Fri, 13 Dec 2019 23:33:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBDNXsmS012846; Fri, 13 Dec 2019 23:33:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912132333.xBDNXsmS012846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 13 Dec 2019 23:33:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355740 - 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: 355740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 23:33:54 -0000 Author: jhb Date: Fri Dec 13 23:33:54 2019 New Revision: 355740 URL: https://svnweb.freebsd.org/changeset/base/355740 Log: Expand net epoch in the cxgbe TOE driver to satisfy assertions. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D22483 Modified: head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Fri Dec 13 23:28:52 2019 (r355739) +++ head/sys/dev/cxgbe/tom/t4_connect.c Fri Dec 13 23:33:54 2019 (r355740) @@ -237,6 +237,7 @@ t4_connect(struct toedev *tod, struct socket *so, stru struct tcpcb *tp = intotcpcb(inp); int reason; struct offload_settings settings; + struct epoch_tracker et; uint16_t vid = 0xfff, pcp = 0; INP_WLOCK_ASSERT(inp); @@ -371,7 +372,9 @@ t4_connect(struct toedev *tod, struct socket *so, stru } offload_socket(so, toep); + NET_EPOCH_ENTER(et); rc = t4_l2t_send(sc, wr, toep->l2te); + NET_EPOCH_EXIT(et); if (rc == 0) { toep->flags |= TPF_CPL_PENDING; return (0); Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Fri Dec 13 23:28:52 2019 (r355739) +++ head/sys/dev/cxgbe/tom/t4_listen.c Fri Dec 13 23:33:54 2019 (r355740) @@ -1235,8 +1235,11 @@ found: * SYN must be directed to an IP6 address on this ifnet. This * is more restrictive than in6_localip. */ - if (!in6_ifhasaddr(ifp, &inc.inc6_laddr)) + NET_EPOCH_ENTER(et); + if (!in6_ifhasaddr(ifp, &inc.inc6_laddr)) { + NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(true); + } ntids = 2; } else { @@ -1249,23 +1252,26 @@ found: * SYN must be directed to an IP address on this ifnet. This * is more restrictive than in_localip. */ - if (!in_ifhasaddr(ifp, inc.inc_laddr)) + NET_EPOCH_ENTER(et); + if (!in_ifhasaddr(ifp, inc.inc_laddr)) { + NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(true); + } ntids = 1; } e = get_l2te_for_nexthop(pi, ifp, &inc); - if (e == NULL) + if (e == NULL) { + NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(true); + } /* Don't offload if the 4-tuple is already in use */ - NET_EPOCH_ENTER(et); /* for 4-tuple check */ if (toe_4tuple_check(&inc, &th, ifp) != 0) { NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(false); } - NET_EPOCH_EXIT(et); inp = lctx->inp; /* listening socket, not owned by TOE */ INP_WLOCK(inp); @@ -1273,6 +1279,7 @@ found: /* Don't offload if the listening socket has closed */ if (__predict_false(inp->inp_flags & INP_DROPPED)) { INP_WUNLOCK(inp); + NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(false); } so = inp->inp_socket; @@ -1282,12 +1289,14 @@ found: rw_runlock(&sc->policy_lock); if (!settings.offload) { INP_WUNLOCK(inp); + NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(true); /* Rejected by COP. */ } synqe = alloc_synqe(sc, lctx, M_NOWAIT); if (synqe == NULL) { INP_WUNLOCK(inp); + NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(true); } atomic_store_int(&synqe->ok_to_respond, 0); @@ -1318,15 +1327,19 @@ found: remove_tid(sc, tid, ntids); m = synqe->syn; synqe->syn = NULL; + NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(true); } CTR6(KTR_CXGBE, "%s: stid %u, tid %u, synqe %p, opt0 %#016lx, opt2 %#08x", __func__, stid, tid, synqe, be64toh(opt0), be32toh(opt2)); - } else + } else { + NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(false); + } + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); return (0); reject: