From owner-freebsd-net@freebsd.org Wed Apr 12 07:50:55 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4D07D3BEF0 for ; Wed, 12 Apr 2017 07:50:55 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: from mail-oi0-x233.google.com (mail-oi0-x233.google.com [IPv6:2607:f8b0:4003:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 786F8BEF for ; Wed, 12 Apr 2017 07:50:55 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: by mail-oi0-x233.google.com with SMTP id g204so22899294oib.1 for ; Wed, 12 Apr 2017 00:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=b8qWAt0pwNNXA2baqbvzhC24H6m9FEj1kohBswnwg1s=; b=lFIYjzyeF2BM48kCidPt+r/DrpIOT36/K8gCNf+krgKFe1IhBfTUJhPDMoFQdXaVEk 7SnMZ/znAHHC5Iv6lKODWcIwESF5ycOZxwyHFc1qbB2C8/LSIUD2kWTbK5/jYClTv6B/ BEz5GQ6kSVF8Dt0vJotd57Tr5iwBt4ngCZeXvqgyhAxeVpewGYzAX8X5LRxmRRxdGAr3 P0C14XSPmOyFWKYG00M6AOMvlzZ+LGLzUI9rmDql5lB2nj6wRNNiCgDmY//DIZwx9Py7 HPECBnas9mDkcSVXCLyKAz0m30/8OfcxHyzR06hC3DG8X+29G1ngV3eYX3wiOmuxIMDr HIiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=b8qWAt0pwNNXA2baqbvzhC24H6m9FEj1kohBswnwg1s=; b=mpBS6S3NG2yBjv2LE7CexCluLz14fYD1n1ndLK8uTw4xQIutssokPuapH56OqO6QwO D8ZVqmMnxF/lt1XWAie64hVfoLPLNMnUSmdzM+egUe+q9Wu5NpKHySK/YeZgPdt0A3F7 E+CfbsjwKhBNIjlXtBo5sgmwpZIcj777ygnKF7oN5AQPVBYaowVSWTRlLT1yOtzAIsTX ufRtDTeSCHwjYuB6zq+tdkOHr1COJBUjDbAYXq+EU/XTukeONftRnJdtHSxAMlE/uac6 Ojgr+13sJER679Z/1Pv5ABzKsWok1WMaTocwBX2CeAIUKs29ZmH9H0yoQlniEv+Gl2/L PPtw== X-Gm-Message-State: AN3rC/4T3eC2AK+uZAqWbQ0rTPbyrm6ytXSTajgr+PAPy7eAmvuFBVnhmD/CBbVHakLjR1WyAH+9OFu027q4uw== X-Received: by 10.202.204.193 with SMTP id c184mr17096217oig.104.1491983454766; Wed, 12 Apr 2017 00:50:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.1.134 with HTTP; Wed, 12 Apr 2017 00:50:54 -0700 (PDT) In-Reply-To: References: From: Vincenzo Maffione Date: Wed, 12 Apr 2017 09:50:54 +0200 Message-ID: Subject: Re: Netmap pipe zero-copy with NIC buffer? To: Paras Jha Cc: FreeBSD Net Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Apr 2017 07:50:55 -0000 netmap applications always bypass the kernel (network stack). There is only a distinction between ports opened in "native" mode and "emulated" mode. If NIC driver doesn't have native netmap support, the legacy driver is internally used by netmap to transmit and receive (and this is called "emulated mode"). In any case (both in native and emulated mode) the netmap application sees netmap rings, and can zerocopy between two rings (in the same memory area) by simply swapping the ring slots. Of course, in emulated mode netmap internally transforms each ring slot into and mbuf and the other way around, possibly requiring a copy. And the whole thing is way slower. But this is unrelated to the zerocopy thing: your application isn't aware of the emulated or native mode and can zerocopy slots between netmap rings. Cheers, Vincenzo 2017-04-12 4:04 GMT+02:00 Paras Jha : > Apologies, by KB I meant kernel bypass, since it is possible to open a > netmap port without bypassing the kernel. I didn't know if this would > affect it or not. > > On Sun, Apr 9, 2017 at 3:20 AM, Vincenzo Maffione > wrote: > >> Hi, >> Yes, when you nm_open("netmap:em3{2", ...), you're opening a netmap >> pipe in the same netmap memory area as the one used by >> nm_open("netmap:em3", ...). >> As a result, you can zero-copy packets from NIC rings to pipe rings. >> >> What do you mean by "KB mode"? >> >> Cheers, >> Vincenzo >> >> 2017-04-08 19:56 GMT+02:00 Paras Jha : >> >>> Hi all, >>> >>> Is it possible to have a netmap pipe share memory with a netmap port >>> opened >>> in KB mode for zero-copy purposes? >>> >>> All the best >>> _______________________________________________ >>> freebsd-net@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-net >>> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >>> >> >> >> >> -- >> Vincenzo Maffione >> > > -- Vincenzo Maffione