diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-12-05 13:27:30 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-12-05 13:27:30 +0000 |
commit | c39858036ff36ded87fc7f984b1fc11543d25987 (patch) | |
tree | 2b1419ed9268fea66203392b25226562521207d6 /sys/netatalk/ddp_input.c | |
parent | cf8726aa556fcd8e89f7b341edca11f7cbff9028 (diff) | |
download | FreeBSD-src-c39858036ff36ded87fc7f984b1fc11543d25987.zip FreeBSD-src-c39858036ff36ded87fc7f984b1fc11543d25987.tar.gz |
Acquire socket receive buffer mutex before appending and then waking up
a receive socket in DDP. This reduces the number of mutex operations
required to deliver to a socket by two, and is the model used in other
protocols.
Diffstat (limited to 'sys/netatalk/ddp_input.c')
-rw-r--r-- | sys/netatalk/ddp_input.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/netatalk/ddp_input.c b/sys/netatalk/ddp_input.c index 6f84983..8f21ecc 100644 --- a/sys/netatalk/ddp_input.c +++ b/sys/netatalk/ddp_input.c @@ -421,8 +421,10 @@ ddp_input(m, ifp, elh, phase) /* * If we found one, deliver th epacket to the socket */ - if (sbappendaddr(&ddp->ddp_socket->so_rcv, (struct sockaddr *)&from, + SOCKBUF_LOCK(&ddp->ddp_socket->so_rcv); + if (sbappendaddr_locked(&ddp->ddp_socket->so_rcv, (struct sockaddr *)&from, m, NULL) == 0) { + SOCKBUF_UNLOCK(&ddp->ddp_socket->so_rcv); /* * If the socket is full (or similar error) dump the packet. */ @@ -432,7 +434,7 @@ ddp_input(m, ifp, elh, phase) /* * And wake up whatever might be waiting for it */ - sorwakeup(ddp->ddp_socket); + sorwakeup_locked(ddp->ddp_socket); m = NULL; out: DDP_LIST_SUNLOCK(); |