From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 14 16:11:24 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6A2D516A4CE for ; Mon, 14 Jun 2004 16:11:24 +0000 (GMT) Received: from oasis.uptsoft.com (oasis.uptsoft.com [217.20.165.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0AA6643D2D for ; Mon, 14 Jun 2004 16:10:41 +0000 (GMT) (envelope-from devnull@oasis.uptsoft.com) Received: (from devnull@localhost) by oasis.uptsoft.com (8.11.6/linuxconf) id i5EG8eP09504 for freebsd-hackers@freebsd.org; Mon, 14 Jun 2004 19:08:40 +0300 Date: Mon, 14 Jun 2004 19:08:40 +0300 From: Sergey Lyubka To: freebsd-hackers@freebsd.org Message-ID: <20040614190840.A29587@oasis.uptsoft.com> Mail-Followup-To: freebsd-hackers@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from emaste@sandvine.com on Mon, Jun 14, 2004 at 08:38:57AM -0400 X-OS: FreeBSD 4.5-STABLE Subject: Re: memory mapped packet capturing - bpf replacement ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2004 16:11:24 -0000 Hi Ed, > I did my benchmark by increasing the packet rate until I found > the point at which packets started to be dropped. A bit offtopic - what traffic generator you use ? > In my testing I found the call to microtime() to be quite > expensive. (It will vary depending on which timecounter is > being used.) I haven't added the timestamp to the header yet, so what would you recommed to use ? > Is this in a SMP or uniprocesor environment? I think your gain > from a ringbuffer interface will be more significant in the SMP > case. I gonna test it much more on both SMP and UP machines > Does the ng_hub cause the packet to be copied? If so you've > still got the same number of copies as vanilla BPF. I think ng_hub does not do a copy, instead it passes mbufs through. Originally, I wanted this architecture: ng_ether / \ (lower) (upper) \ / ng_hub | ng_bpf | ng_mmq This way, you intercept all Ethernet traffic trough ng_hub. Then, ng_bpf does BPF filtering, if any. If no filtering is needed, then ng_bpf node may be omitted. And, at last, ng_mmq does queuing. > Are you using the same snap length (or copying the entire packet) > in each case? Hmm not sure what are you mean here. I am copying whole mbuf chain the same way BPF does. mbuf chain comes from the hook, and it can arrive to the hook from whatever source. > As for question 3, be careful that you're atomically modifying > the head and tail indices/pointers. But yes, you can do it > without a mutex. Any points how to do that ? the only thing I can think of is having atomic variable in shared memory chunk, and using spinlock + atomic change. sergey