From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 8EE477EE4B for ; Fri, 18 Oct 2013 14:20:19 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of anil@recoil.org) identity=pra; client-ip=89.16.177.154; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="avsm@dark.recoil.org"; x-sender="anil@recoil.org"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of avsm@dark.recoil.org) identity=mailfrom; client-ip=89.16.177.154; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="avsm@dark.recoil.org"; x-sender="avsm@dark.recoil.org"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@dark.recoil.org) identity=helo; client-ip=89.16.177.154; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="avsm@dark.recoil.org"; x-sender="postmaster@dark.recoil.org"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtcBAB0mYVJZELGal2dsb2JhbABagz+qYJVMDgEBAQEBCBYHPIIlAQEDAjobJBALGAklDwVciAoIwFuPc4QTA5gIAYEvk307 X-IPAS-Result: AtcBAB0mYVJZELGal2dsb2JhbABagz+qYJVMDgEBAQEBCBYHPIIlAQEDAjobJBALGAklDwVciAoIwFuPc4QTA5gIAYEvk307 X-IronPort-AV: E=Sophos;i="4.93,522,1378850400"; d="scan'208";a="30872487" Received: from recoil.dh.bytemark.co.uk (HELO dark.recoil.org) ([89.16.177.154]) by mail3-smtp-sop.national.inria.fr with SMTP; 18 Oct 2013 14:20:19 +0200 Received: (qmail 23763 invoked by uid 10000); 18 Oct 2013 12:20:18 -0000 Date: Fri, 18 Oct 2013 13:20:18 +0100 From: Anil Madhavapeddy To: rixed@happyleptic.org Cc: OCaml Mailing List Message-ID: <20131018122018.GJ25839@dark.recoil.org> References: <20131018115553.GA28679@ombreroze.happyleptic.org> <20131018115955.GG25839@dark.recoil.org> <20131018121612.GB28679@ombreroze.happyleptic.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131018121612.GB28679@ombreroze.happyleptic.org> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [Caml-list] IPv6 packet parsing On Fri, Oct 18, 2013 at 02:16:12PM +0200, rixed@happyleptic.org wrote: > -[ Fri, Oct 18, 2013 at 12:59:55PM +0100, Anil Madhavapeddy ]---- > > One feature I'd really like to see in Bitstring is support for Bigarray, > > since that avoids a copy into the OCaml heap and lets us do quite high > > performance parsing. If I remember right, there was a patch on the > > Bitstring issue tracker, but it wasn't parameterised (so it's either > > Bistring+string or Bitstring+bigarray, which isn't ideal). > > Pardon my lack of familiarity with bigarrays, but I can't see what's the > difference between copying packets from pcap ring buffer into a bigarray > or into a string. Or do you mean using Bigarray.map_file on the whole > raw ring buffer and handle it without pcap help? We have a number of use-cases that run OCaml in kernel mode, directly operating on packets read from a network driver that's also written in OCaml. Bigarrays are used as the mechanism for passing around externally allocated memory (i.e. network card buffers) directly, whereas inspecting them with a string-based Bigarray requires an expensive data copy. See: http://anil.recoil.org/papers/2013-asplos-mirage.pdf or http://www.openmirage.org -- Anil Madhavapeddy http://anil.recoil.org