From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by dpdk.org (Postfix) with ESMTP id 4778F18F for ; Sun, 30 Mar 2014 17:12:12 +0200 (CEST) Received: by mail-ee0-f49.google.com with SMTP id c41so5691785eek.22 for ; Sun, 30 Mar 2014 08:13:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:references:in-reply-to:subject:date :message-id:mime-version:content-type:content-transfer-encoding :thread-index:content-language; bh=rUCMHyHoh7VIA7iZWIzFgedOC/Fu0NcDp6ro04YD6q8=; b=G1Nmx0QszHup1EKVMt6P/eVr393V+Wg4fmchT8oFcGbh/mGafCYM7hhictx0LIGG/s V8b6M0GinT7D04AIHheszHLrjzYtGV+mr/E50FthUAIlYyeWJT43d7cmcUlAwJKD5GoX 1Txry7wb5Gge6fnDwC172acHRD93xYzmTqmWpRYkZYup3o3VrMfJmNfUMZd10ZrhyliZ iFFM/2iGmroFOLl+s7HkLXibWFyPpaFVHahtbEPAahnVAk8td4CKyZf5yNloP1JDi7qb NzUTv8H3S/neuhk5KZlY1ICwbuAhGI6xGxkfqCpAX+WqES/jENg4kaVhJ1LrwrFkGrGK kWtQ== X-Gm-Message-State: ALoCoQl+TpvWCvY4939Zv2gtk36AI4RVgNe8OmYGyeb9QLe2L2tAlhZzZP+0ZMhtU03z3sBKTq/v X-Received: by 10.15.60.199 with SMTP id g47mr25454054eex.37.1396192426377; Sun, 30 Mar 2014 08:13:46 -0700 (PDT) Received: from YossiBSX1 (site2.amodat.com. [62.90.100.112]) by mx.google.com with ESMTPSA id e42sm26358376eev.32.2014.03.30.08.13.43 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Mar 2014 08:13:44 -0700 (PDT) From: "Yossi Barshishat" To: "'David P. Reed'" References: <02a701cf4be4$a8f3a440$fadaecc0$@imvisiontech.com> <8E2A3E7E-3943-4A03-8BC0-4A385B94927E@tidalscale.com> In-Reply-To: <8E2A3E7E-3943-4A03-8BC0-4A385B94927E@tidalscale.com> Date: Sun, 30 Mar 2014 18:13:42 +0300 Message-ID: <039501cf4c2a$a448de10$ecda9a30$@imvisiontech.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQLrve9zfmmOfw2B/6gBznHqcoU6gwNCKHJPmKa9AmA= Content-Language: he Cc: dev@dpdk.org Subject: Re: [dpdk-dev] zero copy of received segmented IP packet X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Mar 2014 15:12:12 -0000 Thanks David for the detailed answer. In fact I am talking about a proprietary UDP datagrams exchange implementation between two machines. It is not a standard protocol but a proprietary, and it will be the only protocol to be exchanged between the both machines. Performance is important in this application and I hoped there will be a way to really make it zero-copy. Following my very specific needs I believe it is more doable than the general use-case you have described in your answer. Anyway I am more convinced now that this is not doable using the means that DPDK (or alternative tools) provides. Thanks Yossi -----Original Message----- From: David P. Reed [mailto:david.reed@tidalscale.com] Sent: Sunday, March 30, 2014 5:18 PM To: Yossi Barshishat Cc: dev@dpdk.org Subject: Re: [dpdk-dev] zero copy of received segmented IP packet Yossi - You may already understand this, but fragments of IP datagrams ("IP packet" is non-standard slang that confuses IP fragments - packets - with the end-to-end data unit of IP) need to be checksummed together with items from the "virtual header" before delivery to TCP and then userspace. Also, TCP datagrams can overlap each other's sequence space and also be partially "old". There is no rule that says that a later IP datagram cannot transmit the part of the sequence-number range of earlier received IP datagrams. The bytes must be identical, of course. So, for example, if a prior TCP datagram had been received covering sequence numbers 504-508, a subsequent TCP segment might cover sequence number 500-535 (if the sender has not seen the ack up to 508, which can happen for many reasons). 504-508 would be covered by the segment's TCP checksum (along with that segment's virtual header). Whatever you do to handle zero-copy implementation of TCP direct into TCP receiver buffers must, for example, be able to deliver bytes 509-535 directly into the user buffer, if bytes 504-508 have already been delivered. Otherwise it is a non-standard implementation. A simpler approach might work with certain sender-stacks (those that use the same "datagram-boundaries" for retransmission), but hardly all, since the standard does not require retransmission on such boundaries. In the old days, terminal concentrators that used telnet over TCP would retransmit larger segments than the "single character" segments in order to reduce the overhead of catching up with packets dropped. It's dangerous to presume that one's "sending stack" and one's "receiving stack" are in the same version of the same OS - especially dangerous to promote a technique that fails on certain standard cases as a performance improving win. I suspect that a zero-copy TCP requires that at least sometimes, given fragmentation and this "overlapping sequence number" issue, actual copying, especially with fragmentation involved. So if you are talking about "almost always zero-copy with certain senders" that might make the complexity far less. Zero-copy fragment assembly only in the IP layer is much more doable, but it still requires a copy from the reassembled IP datagram into TCP sequence number space. David P. Reed, Ph.D. TidalScale, Inc. On Mar 30, 2014, at 2:52 AM, Yossi Barshishat wrote: > Hi, > > > > Assuming I know ahead that all IP segments related to one single IP > packet ID arrive consequently and I need to forward the entire IP > payload toward the application layer. > > One way to handle this is using a hash table for reassembly of the > packet data (like the ipv4_reassembly example), another way would be > to assume one single bucket (following the above assumption). > > > > However any means the DPDK provides doesn't enable a zero copy > mechanism (it will be required to copy the segments payloads into one larger buffer). > > > > Does anybody has any idea regarding a method to control the place > where each part of the packet will be written to? > > e.g. allocating the first segment regularly while the packet data > buffer is set to the maximum packet length (rather than to MTU size), > and then reading n bytes after the start of each following segment into the data buffer. > > > > That way I can forward the app layer the buffer without copying it. > > > > Thanks, > > > > >