From owner-freebsd-net@FreeBSD.ORG  Thu Nov 18 18:49:44 2004
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id CEBC916A4CE; Thu, 18 Nov 2004 18:49:44 +0000 (GMT)
Received: from mail.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 9BE1043D39; Thu, 18 Nov 2004 18:49:44 +0000 (GMT)
	(envelope-from julian@elischer.org)
Received: from elischer.org (julian.vicor-nb.com [208.206.78.97])
	by mail.vicor-nb.com (Postfix) with ESMTP
	id 74F3E7A403; Thu, 18 Nov 2004 10:49:44 -0800 (PST)
Message-ID: <419CEEC8.8010203@elischer.org>
Date: Thu, 18 Nov 2004 10:49:44 -0800
From: Julian Elischer <julian@elischer.org>
User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030516
X-Accept-Language: en, hu
MIME-Version: 1.0
To: Robert Watson <rwatson@freebsd.org>
References: <Pine.NEB.3.96L.1041118164144.66045F-100000@fledge.watson.org>
In-Reply-To: <Pine.NEB.3.96L.1041118164144.66045F-100000@fledge.watson.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
cc: Elton Machado <elton.machado@norteglobal.com>
cc: net@freebsd.org
Subject: Re: How can I create and use a Tap device
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 18 Nov 2004 18:49:44 -0000



Robert Watson wrote:

>On Thu, 18 Nov 2004, Elton Machado wrote:
>
>  
>
>>I need a virtual ethernet device, can I use tap for that? 
>>
>>How can I create it? 
>>    
>>
>[...]
>
>A couple of performance caveats:
>
>- Every packet delivery requires going to user space, so possibly a
>  context switch and certainly a system call.
>- Every packet is copied to user space, and/or from user space, so you get
>  a lot of memory copying.
>

You can also use netgraph's eiface node.
thid delivers teh packet to a netgraph interface which can be then used 
for further processing in the kernel..
(e.g. a ksocket node to encapsulate it in UDP)..  No extra context 
switches..


>
>For prototyping or light-weight stuff, tap is a great tool, but to improve
>performance you want to run network code in the kernel, especially if
>there are other applications running (and/or processing packets), which
>will increase the number of context switches.  The cost as it stands isn't
>bad -- I regularly use tap-derived tunnel software for remote network
>access without a hitch.  There were recently some posts made with patches
>to optimize the allocation of kernel memory for packets sent using a tap
>device, which are in the mailing list archives (not sure if they were
>merged yet).
>
>Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
>robert@fledge.watson.org      Principal Research Scientist, McAfee Research
>
>
>_______________________________________________
>freebsd-net@freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-net
>To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
>  
>