Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Oct 2005 23:19:08 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 86090 for review
Message-ID:  <200510302319.j9UNJ8qv081544@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=86090

Change 86090 by rwatson@rwatson_zoo on 2005/10/30 23:18:31

	Modify UDP so it uses sosend_dgram(), although only for consumers
	that properly call pru_sosend() rather than sosend() (i.e., user
	space, but probably not all kernel consumers, which may assume
	sosend()).  A sysctl allows this to be changed at run-time, using
	sosend() as the default.

Affected files ...

.. //depot/projects/netsmp/src/sys/netinet/udp_usrreq.c#4 edit

Differences ...

==== //depot/projects/netsmp/src/sys/netinet/udp_usrreq.c#4 (text+ko) ====

@@ -1114,5 +1114,32 @@
 	.pru_send =		udp_send,
 	.pru_shutdown =		udp_shutdown,
 	.pru_sockaddr =		udp_sockaddr,
+	.pru_sosend =		sosend,
 	.pru_sosetlabel =	in_pcbsosetlabel
 };
+
+static int
+sysctl_net_inet_udp_sosend_dgram(SYSCTL_HANDLER_ARGS)
+{
+	int error, mode;
+
+	if (udp_usrreqs.pru_sosend == sosend_dgram)
+		mode = 1;
+	else
+		mode = 0;
+
+	error = sysctl_handle_int(oidp, &mode, 0, req);
+	if (error || !req->newptr)
+	        return (error);
+ 
+	if (mode)
+	        udp_usrreqs.pru_sosend = sosend_dgram;
+	else
+	        udp_usrreqs.pru_sosend = sosend;
+
+	return (0);
+}
+
+SYSCTL_PROC(_net_inet_udp, OID_AUTO, sosend_dgram, CTLTYPE_INT |
+    CTLFLAG_RW, 0, 0, sysctl_net_inet_udp_sosend_dgram, "I",
+    "Use optimized sosend_dgram instead of sosend for UDP");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510302319.j9UNJ8qv081544>