Hook for 0-copy (or other optimized) sends and receives trunk
authormatt <matt@NetBSD.org>
Sat, 25 Apr 1998 17:35:18 +0000
branchtrunk
changeset 38812 49bace286cc7
parent 38811 579ea8140b23
child 38813 169179db536e
Hook for 0-copy (or other optimized) sends and receives
sys/kern/sys_socket.c
sys/kern/uipc_socket.c
sys/kern/uipc_socket2.c
sys/kern/uipc_syscalls.c
--- a/sys/kern/sys_socket.c	Sat Apr 25 17:32:24 1998 +0000
+++ b/sys/kern/sys_socket.c	Sat Apr 25 17:35:18 1998 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_socket.c,v 1.16 1998/03/01 02:22:32 fvdl Exp $	*/
+/*	$NetBSD: sys_socket.c,v 1.17 1998/04/25 17:35:18 matt Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -59,8 +59,8 @@
 	struct uio *uio;
 	struct ucred *cred;
 {
-
-	return (soreceive((struct socket *)fp->f_data, (struct mbuf **)0,
+	struct socket *so = (struct socket *) fp->f_data;
+	return ((*so->so_receive)(so, (struct mbuf **)0,
 		uio, (struct mbuf **)0, (struct mbuf **)0, (int *)0));
 }
 
@@ -71,8 +71,8 @@
 	struct uio *uio;
 	struct ucred *cred;
 {
-
-	return (sosend((struct socket *)fp->f_data, (struct mbuf *)0,
+	struct socket *so = (struct socket *) fp->f_data;
+	return ((*so->so_send)(so, (struct mbuf *)0,
 		uio, (struct mbuf *)0, (struct mbuf *)0, 0));
 }
 
--- a/sys/kern/uipc_socket.c	Sat Apr 25 17:32:24 1998 +0000
+++ b/sys/kern/uipc_socket.c	Sat Apr 25 17:35:18 1998 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.32 1998/03/01 02:22:34 fvdl Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.33 1998/04/25 17:35:18 matt Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1990, 1993
@@ -83,6 +83,8 @@
 	TAILQ_INIT(&so->so_q);
 	so->so_type = type;
 	so->so_proto = prp;
+	so->so_send = sosend;
+	so->so_receive = soreceive;
 	error = (*prp->pr_usrreq)(so, PRU_ATTACH, (struct mbuf *)0,
 	    (struct mbuf *)(long)proto, (struct mbuf *)0, p);
 	if (error) {
--- a/sys/kern/uipc_socket2.c	Sat Apr 25 17:32:24 1998 +0000
+++ b/sys/kern/uipc_socket2.c	Sat Apr 25 17:35:18 1998 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket2.c,v 1.23 1998/03/01 02:22:34 fvdl Exp $	*/
+/*	$NetBSD: uipc_socket2.c,v 1.24 1998/04/25 17:35:18 matt Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1990, 1993
@@ -172,6 +172,8 @@
 	so->so_proto = head->so_proto;
 	so->so_timeo = head->so_timeo;
 	so->so_pgid = head->so_pgid;
+	so->so_send = head->so_send;
+	so->so_receive = head->so_receive;
 	(void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat);
 	soqinsque(head, so, soqueue);
 	if ((*so->so_proto->pr_usrreq)(so, PRU_ATTACH,
@@ -321,6 +323,8 @@
 		else if (so->so_pgid > 0 && (p = pfind(so->so_pgid)) != 0)
 			psignal(p, SIGIO);
 	}
+	if (sb->sb_flags & SB_UPCALL)
+		(*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT);
 }
 
 /*
--- a/sys/kern/uipc_syscalls.c	Sat Apr 25 17:32:24 1998 +0000
+++ b/sys/kern/uipc_syscalls.c	Sat Apr 25 17:35:18 1998 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls.c,v 1.29 1998/03/01 02:22:34 fvdl Exp $	*/
+/*	$NetBSD: uipc_syscalls.c,v 1.30 1998/04/25 17:35:19 matt Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -421,6 +421,7 @@
 	register int i;
 	struct mbuf *to, *control;
 	int len, error;
+	struct socket *so;
 #ifdef KTRACE
 	struct iovec *ktriov = NULL;
 #endif
@@ -491,8 +492,8 @@
 	}
 #endif
 	len = auio.uio_resid;
-	error = sosend((struct socket *)fp->f_data, to, &auio,
-		       NULL, control, flags);
+	so = (struct socket *)fp->f_data;
+	error = (*so->so_send)(so, to, &auio, NULL, control, flags);
 	if (error) {
 		if (auio.uio_resid != len && (error == ERESTART ||
 		    error == EINTR || error == EWOULDBLOCK))
@@ -616,6 +617,7 @@
 	register int i;
 	int len, error;
 	struct mbuf *from = 0, *control = 0;
+	struct socket *so;
 #ifdef KTRACE
 	struct iovec *ktriov = NULL;
 #endif
@@ -648,9 +650,9 @@
 	}
 #endif
 	len = auio.uio_resid;
-	error = soreceive((struct socket *)fp->f_data, &from, &auio,
-			  NULL, mp->msg_control ? &control : NULL,
-			  &mp->msg_flags);
+	so = (struct socket *)fp->f_data;
+	error = (*so->so_receive)(so, &from, &auio, NULL,
+			  mp->msg_control ? &control : NULL, &mp->msg_flags);
 	if (error) {
 		if (auio.uio_resid != len && (error == ERESTART ||
 		    error == EINTR || error == EWOULDBLOCK))