From owner-freebsd-usb@FreeBSD.ORG Wed Nov 24 00:37:07 2010 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 795691065672; Wed, 24 Nov 2010 00:37:07 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Weongyo Jeong Date: Tue, 23 Nov 2010 19:36:47 -0500 User-Agent: KMail/1.6.2 References: <201011231852.40484.jkim@FreeBSD.org> <20101124001832.GI92881@weongyo> In-Reply-To: <20101124001832.GI92881@weongyo> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011231936.57818.jkim@FreeBSD.org> Cc: freebsd-usb@freebsd.org Subject: Re: [RFC] USBdump patches X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 00:37:07 -0000 On Tuesday 23 November 2010 07:18 pm, Weongyo Jeong wrote: > On Tue, Nov 23, 2010 at 06:52:36PM -0500, Jung-uk Kim wrote: > > On Tuesday 23 November 2010 06:31 pm, Jung-uk Kim wrote: > > > [CC sanitized] > > > > > > On Tuesday 23 November 2010 06:01 pm, Hans Petter Selasky wrote: > > > > Dear Weongyo, > > > > > > > > > NACK. You already could recognize that the patch is quite > > > > > big and multiple patches are mixed into one. Please > > > > > separate into smallest pieces then send freebsd-usb@ again. > > > > > I don't want to do a jumbo jump. > > > > Technically, I don't like the copy-and-pasted code from bpf.c and > > bpf_filter.c. Was it really necessary? Is the dump file in PCAP > > format? > > > > Please enlighten me if I missed something. > > The following paragraph is extracted from email I sent to rwatson@ > because he also asked same question to me. And I added CC to > freebsd-usb@ to share my story with other developers who might > think similar. > > Hello Roberts, > > I understand what you're worry and agree with you that if I could > remove this duplication it'd be best one. I think it could be > happen enough later if we could reach the consensus. > > The biggest confusions I encountered during implementing? > (porting) it for USB packet filter were as follows. Please let me > know if there are something I missed: > > - BPF was normally for ethernet frames (most operations were > based on mbuf including the machine filter and there were a lot of > assumptions the input buffer is mbuf type. For example, handling > BPF_LD|BPF_W|BPF_ABS). However the USB packet isn't like mbuf > style that it's just a linear buffer. So the most important code > or assumption wasn't compatible. BPF can deal with linear buffer just fine. For example, ng_bpf(4) does it. Please see sys/netgraph/ng_bpf.c. > - Just making the patch for BPF code, it looked like a trick or > a hack to me because I couldn't define what BPF should be. If you don't want to touch bpf.c for some reason, netgraph(4) (-> ng_bpf) may be an alternate solution for you. > - I could not define BPF exactly myself that what BPF should > cover. I agreed with that BPF is for ethernet packet filtering but > could not make sure myself that BPF could cover USB packets. BPF is a generic packet filter machine, i.e., bytecode is generic enough for any type of data stream. Jung-uk Kim