From owner-freebsd-net@freebsd.org Tue Aug 21 06:25:35 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7539C108AB63 for ; Tue, 21 Aug 2018 06:25:35 +0000 (UTC) (envelope-from ipfix5101@gmail.com) Received: from mail-oi0-x22d.google.com (mail-oi0-x22d.google.com [IPv6:2607:f8b0:4003:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 014A3752E9 for ; Tue, 21 Aug 2018 06:25:35 +0000 (UTC) (envelope-from ipfix5101@gmail.com) Received: by mail-oi0-x22d.google.com with SMTP id m11-v6so30245137oic.2 for ; Mon, 20 Aug 2018 23:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lQxRnKw2NRq57K+3CVft5u6vnlYDS1xgQSD1lPMvDO0=; b=XdATVqiEZwZFWPc9KtCadGy/+hWzAuYRv1GYeS+ZRaoLRMyQEx8dmfIEp4Ng1uPxG0 DjOBzMTyGNRszj4Awxuq7FIlZDy7NZFmCRFFbGbeff+7MKMzZfVeNtGmfbcNAkz47N+Y FEjnkseF1cGNkKe7iGKvMTV2WBv/UADPWkqUHXopfsHAnpvzHfwAWvIfnz76s9FziCNb Y/z9I8hExbUmGzDR0Sgn3LcPDAo1VhaH1gJb2JAu66CAZtMh2mfGknI2N6W2lNe2f+wu Y3iBdzAkzqmwYRfb4Qx8JKy8MHmbYJF/2Uq7x/sVAP1MUZlyTxM37xhrBeZynrtm6eAg uJ4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lQxRnKw2NRq57K+3CVft5u6vnlYDS1xgQSD1lPMvDO0=; b=nv398Rz4bU2BoM0KHV4o2lIlbaaTwSrUZUdx4G2lQGSB5s2VPpyeA6yiAAkSUj8OAx 9lrcU74t9Yj3GAS0TIsZey8nprFgkQtiXPixmqannAjVvoBgXengZ8a2rHlXhAgm4TCg pWw18zn4jQAcNtr/Aip7ZmZfaDMDs/f//jt45lXX/RFYLXprLjKZkKWqdwUtESfkkeq6 XEKdyFmkUq1VTnlseEEDwfhUuVmIJYdzBCoHR/Ht04DsjTFOX2D3YF/vTUMi+c1pYih/ j0GBCEgM/ukzICIBqDEYh0upQCseorBGnfKBSvjR7GU3xhp9rtnUKQydolQG3EoKvN9g dmmA== X-Gm-Message-State: AOUpUlEh5T91ZhwK26gFysW+WMjhRmdxYZvfix8affolXkMs/ddUVNnP zOseP7Rzr1p6RVDwT7tHoe2yt4neOaGUPqCd0sg= X-Google-Smtp-Source: AA+uWPyf1Y9KbBoJGtANYDO8e2hveZibnMkQZdrsD0rx/0EbJ6xO77SQabsN1Uu/LkrhnfoO9b3wIqVPFKzaKW6Idfg= X-Received: by 2002:aca:e6cd:: with SMTP id d196-v6mr16147154oih.94.1534832734266; Mon, 20 Aug 2018 23:25:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: VO Ipfix Date: Mon, 20 Aug 2018 23:25:22 -0700 Message-ID: Subject: Re: Getting netmap to co-exist with user-space processes that use sockets To: v.maffione@gmail.com Cc: freebsd-net@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Aug 2018 06:25:35 -0000 Awesome, this was what I was looking for! Regards, Victor On Fri, Aug 17, 2018 at 4:39 PM Vincenzo Maffione wrote: > Hi, > What you want to do is definitely possible using the "host rings", aka > "sw rings". > The idea is that netmap intercepts all the packets arriving from the NIC > RX "hardware" ring(s). Your netmap program should then look at the packets > and decide which ones should be forwarded to the host kernel (e.g. to > sockets), and which ones are instead to be processed by your netmap program. > All the packets to be forwarded to the host kernel can be transmitted to > the "host TX ring". The host TX ring is a special ring that simply injects > packets into the kernel. > > A similar thing happens for the egress side. Netmap intercepts all the > packets that the host kernel tries to transmit on eth0. Those packets will > show up in the "host RX ring", which is again a special ring. Your netmap > program can then process those, for instance simply forwarding them to the > hardware TX ring(s), so that they exit the eth0 interface. > > On a NIC with just 1 RX/TX hardware ring, you basically have 4 netmap > rings. TX0 and RX0 are the hardware rings for transmission and reception. > TX1 and RX1 are host rings, as explained above. > > I highly recommend to have a look at the netmap tutorial here > https://github.com/netmap-unipi/netmap-tutorial > Host rings are explained there. There is also a codelab with examples and > solutions you can play with to learn the netmap API. > From the netmap API point of view, host rings are not different from > hardware rings. > Also having a look at the netmap man page can help. > Remember to disable the NIC offloadings like checksumming and TSO or > things won't work. > > Cheers, > Vincenzo > > Il giorno ven 17 ago 2018 alle ore 11:33 VO Ipfix > ha scritto: > >> Hello there, I would like to use netmap with pptk (emulated driver) to >> generate send traffic from an interface, but still allow rx/tx to get to >> the the kernel so that other user-space networking processes function as >> normal. Currently, if I open an interface eg netmap:eth0, other user space >> processes are unable to perform any networking via sockets. How could I go >> about solving this? >> >> Thanks, >> Victor >> _______________________________________________ >> 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 >