summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-01-12 10:48:04 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-01-12 10:48:04 +0000
commit2edc9b01fff044b91e483c62241d8c17a0898ad4 (patch)
tree6b76df34dbcb229b4f11e113bf21afb4255f1f5c /sys/kern/uipc_socket.c
parent723452bd35c53d1437fa7192a7d7935be6be4a8e (diff)
Send UDP packets in parallel.
Sending UDP packets via datagram socket is MP safe now. Same applies to raw IPv4 and IPv6, and divert sockets. Switch sosend() from exclusive net lock to shared net lock in combination with per socket lock. TCP and GRE still use exclusive net lock. tested by otto@ and florian@ OK mvs@
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 913649f1f81..9da3bdd2040 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.313 2024/01/11 14:15:11 bluhm Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.314 2024/01/12 10:48:03 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -582,7 +582,7 @@ sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
#define snderr(errno) { error = errno; goto release; }
- solock(so);
+ solock_shared(so);
restart:
if ((error = sblock(so, &so->so_snd, SBLOCKWAIT(flags))) != 0)
goto out;
@@ -635,9 +635,9 @@ restart:
if (flags & MSG_EOR)
top->m_flags |= M_EOR;
} else {
- sounlock(so);
+ sounlock_shared(so);
error = m_getuio(&top, atomic, space, uio);
- solock(so);
+ solock_shared(so);
if (error)
goto release;
space -= top->m_pkthdr.len;
@@ -665,7 +665,7 @@ release:
so->so_snd.sb_state &= ~SS_ISSENDING;
sbunlock(so, &so->so_snd);
out:
- sounlock(so);
+ sounlock_shared(so);
m_freem(top);
m_freem(control);
return (error);