Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jan 1997 15:55:46 -0500
From:      Garrett Wollman <wollman@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?)
Message-ID:  <9701112055.AA06082@halloran-eldar.lcs.mit.edu>
In-Reply-To: <199701101947.NAA00382@papillon.lemis.de>
References:  <199701100612.BAA27329@skynet.ctr.columbia.edu> <199701101947.NAA00382@papillon.lemis.de>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Fri, 10 Jan 1997 13:47:32 -0600 (CST), Greg Lehey <grog@lemis.de> 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



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