From owner-freebsd-current Sat Jan 11 12:55:51 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id MAA05533 for current-outgoing; Sat, 11 Jan 1997 12:55:51 -0800 (PST) Received: from halloran-eldar.lcs.mit.edu (halloran-eldar.lcs.mit.edu [18.26.0.159]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id MAA05528 for ; Sat, 11 Jan 1997 12:55:49 -0800 (PST) Received: by halloran-eldar.lcs.mit.edu; (5.65v3.2/1.1.8.2/19Aug95-0530PM) id AA06082; Sat, 11 Jan 1997 15:55:46 -0500 Date: Sat, 11 Jan 1997 15:55:46 -0500 From: Garrett Wollman Message-Id: <9701112055.AA06082@halloran-eldar.lcs.mit.edu> To: grog@lemis.de (Greg Lehey) Cc: FreeBSD-current@freebsd.org (FreeBSD current users) Subject: PF_LOCAL vs PF_INET (was: Re: What's happened to nfsd and mountd?) In-Reply-To: <199701101947.NAA00382@papillon.lemis.de> References: <199701100612.BAA27329@skynet.ctr.columbia.edu> <199701101947.NAA00382@papillon.lemis.de> Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk < said: > The situation certainly seems to be crying out for a better solution. > I never got round to looking at the code: is AF_UNIX faster than > AF_INET to localhost? Make that PF_LOCAL versus PF_INET. The answer is ``absolutely, yes''. Remember that a PF_INET datagram socket, to pick the simplest case, still has to: - Fiddle with ports and local addresses. - Cons up a UDP header - Cons up an IP header - Compute the pseudo-header+data checksum - Compute the header checksum - Hand it off to the loopback interface - Take a software interrupt - Take it from the loopback interface - Verify the header checksum - Verify that it's a local address - Verify the pseudo-header+data checksum - Pass it up to UDP - Strip the headers - Look in the PCB table for a PCB matching this datagram - Look again to deal with wildcards - Find the socket buffer of the remote end - Stick the packet in the remote end's socket buffer - Wakeup the remote end For PF_LOCAL, the process is much simpler: - Locate the socket buffer of the remote end - Stick the packet in the remote end's socket buffer - Wakeup the remote end -GAWollman -- Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same wollman@lcs.mit.edu | O Siem / The fires of freedom Opinions not those of| Dance in the burning flame MIT, LCS, ANA, or NSA| - Susan Aglukark and Chad Irschick