From owner-dev-commits-src-all@freebsd.org Tue Apr 13 23:32:00 2021 Return-Path: Delivered-To: dev-commits-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 695575F07EC; Tue, 13 Apr 2021 23:32:00 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FKhhc2bPHz3m80; Tue, 13 Apr 2021 23:32:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BEF313A54; Tue, 13 Apr 2021 23:32:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13DNW0SP042188; Tue, 13 Apr 2021 23:32:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13DNW0aR042187; Tue, 13 Apr 2021 23:32:00 GMT (envelope-from git) Date: Tue, 13 Apr 2021 23:32:00 GMT Message-Id: <202104132332.13DNW0aR042187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 774c4c82ff72 - main - TOE: Use a read lock on the PCB for syncache_add(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 774c4c82ff72558182d14908d698bac8578adfaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2021 23:32:00 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=774c4c82ff72558182d14908d698bac8578adfaa commit 774c4c82ff72558182d14908d698bac8578adfaa Author: John Baldwin AuthorDate: 2021-04-13 23:31:04 +0000 Commit: John Baldwin CommitDate: 2021-04-13 23:31:04 +0000 TOE: Use a read lock on the PCB for syncache_add(). Reviewed by: np, glebius Fixes: 08d9c9202755a30f97617758595214a530afcaea Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29739 --- sys/dev/cxgbe/tom/t4_listen.c | 10 +++++----- sys/netinet/toecore.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index 9cf527925fcc..0245acfe005b 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -643,7 +643,7 @@ alloc_synqe(struct adapter *sc __unused, struct listen_ctx *lctx, int flags) { struct synq_entry *synqe; - INP_WLOCK_ASSERT(lctx->inp); + INP_RLOCK_ASSERT(lctx->inp); MPASS(flags == M_WAITOK || flags == M_NOWAIT); synqe = malloc(sizeof(*synqe), M_CXGBE, flags); @@ -1323,11 +1323,11 @@ found: } inp = lctx->inp; /* listening socket, not owned by TOE */ - INP_WLOCK(inp); + INP_RLOCK(inp); /* Don't offload if the listening socket has closed */ if (__predict_false(inp->inp_flags & INP_DROPPED)) { - INP_WUNLOCK(inp); + INP_RUNLOCK(inp); NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(false); } @@ -1337,14 +1337,14 @@ found: EVL_MAKETAG(0xfff, 0, 0), inp); rw_runlock(&sc->policy_lock); if (!settings.offload) { - INP_WUNLOCK(inp); + INP_RUNLOCK(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); + INP_RUNLOCK(inp); NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(true); } diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c index f602319ef701..480aa64c1bf7 100644 --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -349,7 +349,7 @@ toe_syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct inpcb *inp, void *tod, void *todctx, uint8_t iptos) { - INP_WLOCK_ASSERT(inp); + INP_RLOCK_ASSERT(inp); (void )syncache_add(inc, to, th, inp, inp->inp_socket, NULL, tod, todctx, iptos);