From owner-p4-projects@FreeBSD.ORG Sun Oct 30 23:19:09 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4010E16A421; Sun, 30 Oct 2005 23:19:09 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E674C16A41F for ; Sun, 30 Oct 2005 23:19:08 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id ADFF443D45 for ; Sun, 30 Oct 2005 23:19:08 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j9UNJ8v2081547 for ; Sun, 30 Oct 2005 23:19:08 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j9UNJ8qv081544 for perforce@freebsd.org; Sun, 30 Oct 2005 23:19:08 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sun, 30 Oct 2005 23:19:08 GMT Message-Id: <200510302319.j9UNJ8qv081544@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 86090 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Oct 2005 23:19:10 -0000 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");