Date: Fri, 17 Aug 2018 18:39:39 -0500 From: Vincenzo Maffione <v.maffione@gmail.com> To: ipfix5101@gmail.com Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org> Subject: Re: Getting netmap to co-exist with user-space processes that use sockets Message-ID: <CA%2B_eA9in6i_PTSGp_mSxY=r9SoObjzrEUejmyJg6mFHCwrhqDQ@mail.gmail.com> In-Reply-To: <CAMNi=_TDNcBOuEjBNYzxygQWQ3uCj7HvRH=gYO6W8ns=M4tMJA@mail.gmail.com> References: <CAMNi=_TDNcBOuEjBNYzxygQWQ3uCj7HvRH=gYO6W8ns=M4tMJA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <ipfix5101@gmail.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2B_eA9in6i_PTSGp_mSxY=r9SoObjzrEUejmyJg6mFHCwrhqDQ>