From nobody Thu May 23 19:12:21 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vld8j1cwnz5L6mF; Thu, 23 May 2024 19:12:21 +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 4Vld8j18JZz51bh; Thu, 23 May 2024 19:12:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716491541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sDdiGNL7ywUi7FpbVcdoRZepmfFdgC0OoZvH/tzhjDA=; b=flLxUt1tFyULixClKeeesR0J38EYndJ9lzdYqe9zteHu0Lnvn6/zfj2WBkxRrJXcsUg1yC M3ZCQlM1YFtPoLRX7XuZpkl+xUkBDqD+HZ5sHFyHGMlqblzJRTZBRB/x16rhgnlOs5SPGo ZiRI2TtGZKLL0M2Cc0mbcl2yWC7OzZ4OCj/3/U+6WumvNmMxDZNWCAt51HHhrcZzBYqCBJ zBoJ/MfeLais7i6LwTqBQ5y54bGrke/NgZWasDYRcVT3UInzroJvRHDQ5XIL5G0a5e/IPj lxs+dASPaIBwdUpsuTQ+7ZDi98go695VLEshryD6WeoyIqMcB1VPzH39nWMSzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716491541; a=rsa-sha256; cv=none; b=sLEKgToVpMuSsIFOkFd9GTDYyeWVu3jR7FuA2cRCGbDeELgjxd74bJ6AHfFBL3UG91q5cb PBsiYUuPiCOvkQSUVTw344tkU4QOyyAiAJb4K67tAHWRXHwQfqZ+i02ZHoayZ7KGAICWjm jjHAJ0/mL44c9MSYzV+VopCtOnRR1NJIyCtRyUXeniNNXcrUSkkE3DChd0bkY5M1iMWgX4 FDWhOcqEK/E+sE0Qqao2ItfNNxReTOO3hK4gEdI77FvZdmGPphtTGG2CXwz2WA1XFqWIDO i0qQY+m2wOPa4m+IBvwfEDaTemtACCvlLbolOXlGQ2yN0WxKqgKYmMZ25IMIJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716491541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sDdiGNL7ywUi7FpbVcdoRZepmfFdgC0OoZvH/tzhjDA=; b=Zy4eeXBxrsz4uhora+puoRtsjlbvlOKUPxz9yiMftN8XGlDocAKOYRc5eoIXVdVLvQKAeq VZlTvjex7ciOLQvESIbn+HUflbHmzaSjG2/Bdj2ocyf/DqEn7DnHOdm2HK/Zb5AA6z3woO pIX+tm96Q8Oby/jzNnS2VmfA1Wrz/3YdftwUau0na3vD1eqadeko5iRSgaU9D5OGeVCy07 tZGrEQD6Dx+Ya4SuwJFJ6SeYRXrLUurT4oas8eOL0/SvoyG0ko+/Fk/9rpnITqlCRRtWQC c946fxMKjRghv9yYOilSrihnQPTgO0eIzlMw5krhiSpO+ADNEyJAmlCE4jeC8Q== 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 4Vld8j0m7zz12JJ; Thu, 23 May 2024 19:12:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44NJCL2u032050; Thu, 23 May 2024 19:12:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44NJCLja032047; Thu, 23 May 2024 19:12:21 GMT (envelope-from git) Date: Thu, 23 May 2024 19:12:21 GMT Message-Id: <202405231912.44NJCLja032047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 0d3789584915 - main - ctl: use socket buffer mutexes in struct socket directly List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d37895849150e1646485068d12c3a8ff26809f9 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0d37895849150e1646485068d12c3a8ff26809f9 commit 0d37895849150e1646485068d12c3a8ff26809f9 Author: Gleb Smirnoff AuthorDate: 2024-05-23 19:11:54 +0000 Commit: Gleb Smirnoff CommitDate: 2024-05-23 19:11:54 +0000 ctl: use socket buffer mutexes in struct socket directly A mechanical change performed with sed(1) script: s/SOCKBUF_LOCK\(&so->so_rcv\)/SOCK_RECVBUF_LOCK(so)/ s/SOCKBUF_UNLOCK\(&so->so_rcv\)/SOCK_RECVBUF_UNLOCK(so)/ s/SOCKBUF_MTX\(&so->so_rcv\)/SOCK_RECVBUF_MTX(so)/ s/SOCKBUF_LOCK\(&so->so_snd\)/SOCK_SENDBUF_LOCK(so)/ s/SOCKBUF_UNLOCK\(&so->so_snd\)/SOCK_SENDBUF_UNLOCK(so)/ s/SOCKBUF_MTX\(&so->so_snd\)/SOCK_SENDBUF_MTX(so)/ Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D45190 --- sys/cam/ctl/ctl_ha.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/sys/cam/ctl/ctl_ha.c b/sys/cam/ctl/ctl_ha.c index 695006ed99e1..e94708028ee4 100644 --- a/sys/cam/ctl/ctl_ha.c +++ b/sys/cam/ctl/ctl_ha.c @@ -164,17 +164,17 @@ ctl_ha_close(struct ha_softc *softc) report = 1; } if (so) { - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); soupcall_clear(so, SO_RCV); while (softc->ha_receiving) { wakeup(&softc->ha_receiving); - msleep(&softc->ha_receiving, SOCKBUF_MTX(&so->so_rcv), + msleep(&softc->ha_receiving, SOCK_RECVBUF_MTX(so), 0, "ha_rx exit", 0); } - SOCKBUF_UNLOCK(&so->so_rcv); - SOCKBUF_LOCK(&so->so_snd); + SOCK_RECVBUF_UNLOCK(so); + SOCK_SENDBUF_LOCK(so); soupcall_clear(so, SO_SND); - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); softc->ha_so = NULL; if (softc->ha_connect) pause("reconnect", hz / 2); @@ -218,7 +218,7 @@ ctl_ha_rx_thread(void *arg) next = wire_hdr.length; else next = sizeof(wire_hdr); - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); while (sbavail(&so->so_rcv) < next || softc->ha_disconnect) { if (softc->ha_connected == 0 || softc->ha_disconnect || so->so_error || @@ -226,10 +226,10 @@ ctl_ha_rx_thread(void *arg) goto errout; } so->so_rcv.sb_lowat = next; - msleep(&softc->ha_receiving, SOCKBUF_MTX(&so->so_rcv), + msleep(&softc->ha_receiving, SOCK_RECVBUF_MTX(so), 0, "-", 0); } - SOCKBUF_UNLOCK(&so->so_rcv); + SOCK_RECVBUF_UNLOCK(so); if (wire_hdr.length == 0) { iov.iov_base = &wire_hdr; @@ -246,7 +246,7 @@ ctl_ha_rx_thread(void *arg) if (error != 0) { printf("%s: header receive error %d\n", __func__, error); - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); goto errout; } } else { @@ -259,7 +259,7 @@ ctl_ha_rx_thread(void *arg) errout: softc->ha_receiving = 0; wakeup(&softc->ha_receiving); - SOCKBUF_UNLOCK(&so->so_rcv); + SOCK_RECVBUF_UNLOCK(so); ctl_ha_conn_wake(softc); kthread_exit(); } @@ -280,13 +280,13 @@ ctl_ha_send(struct ha_softc *softc) break; } } - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); if (sbspace(&so->so_snd) < softc->ha_sending->m_pkthdr.len) { so->so_snd.sb_lowat = softc->ha_sending->m_pkthdr.len; - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); break; } - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); error = sosend(softc->ha_so, NULL, NULL, softc->ha_sending, NULL, MSG_DONTWAIT, curthread); softc->ha_sending = NULL; @@ -309,14 +309,14 @@ ctl_ha_sock_setup(struct ha_softc *softc) if (error) printf("%s: soreserve failed %d\n", __func__, error); - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); so->so_rcv.sb_lowat = sizeof(struct ha_msg_wire); soupcall_set(so, SO_RCV, ctl_ha_rupcall, softc); - SOCKBUF_UNLOCK(&so->so_rcv); - SOCKBUF_LOCK(&so->so_snd); + SOCK_RECVBUF_UNLOCK(so); + SOCK_SENDBUF_LOCK(so); so->so_snd.sb_lowat = sizeof(struct ha_msg_wire); soupcall_set(so, SO_SND, ctl_ha_supcall, softc); - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); bzero(&opt, sizeof(struct sockopt)); opt.sopt_dir = SOPT_SET;