We did hack memcache to get packets directly from the device. You can search for this example, it might be good enough for you
On Apr 12, 2017 7:12 AM, "Nadav Har'El" <[email protected]> wrote: > > On Mon, Apr 10, 2017 at 1:05 AM, Rick Payne (Offshore) < > [email protected]> wrote: > >> Hi, >> >> Is there a good example that uses the virtio network interfaces direct? >> ie. an application that uses ‘assign-net’ and talks directly to the network >> interface code in OSv? >> >> I’m looking for a sample I can learn from. >> > > Unfortunately, we never documented the "assigned virtio" API. > > Basically, the "assigned virtio" idea was to allow OSv to set up the > virtio-net device, and then give the application an API to control it > directly. > Before a virtio device can be assigned to the application, OSv needs to > know not to use it itself. The boot-time option --assign-net tells OSv > *not* to use a virtio-net device given to it by the host (if any), and > instead assign it to the application. > > You can see see include/osv/virtio-assign.hh for the full API. > For example, the application can then use osv::assigned_virtio::get() to > get access to this device, and properly set it up and use it. Then the > application can use this API to access the rings, to kick, and to get > notifications. > > The only place we ever used this API (and even that we haven't tested in a > long time, so I hope it didn't rot too much...) was in Seastar. Check out > commit f497299f446846767eda74a7265411b573b5a280 for how we used it in > Seastar > > It would be nice to turn this feature into something more lively and used, > and better documented. > > Nadav. > > -- > You received this message because you are subscribed to the Google Groups > "OSv Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
