The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=774c4c82ff72558182d14908d698bac8578adfaa

commit 774c4c82ff72558182d14908d698bac8578adfaa
Author:     John Baldwin <j...@freebsd.org>
AuthorDate: 2021-04-13 23:31:04 +0000
Commit:     John Baldwin <j...@freebsd.org>
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);
_______________________________________________
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"

Reply via email to