On Wed, Feb 25, 2015 at 09:54:40AM +0200, Vasile Catalin-B50542 wrote: > I'm looking through the qemu sources and I'm trying to understand how net > devices work. > What is considered a net_client inside qemu sources? > I'm asking about this because I came upon two functions which (because of > their name) sound like > they should be doing the same thing. The functions' name are: > 1. qemu_new_nic() > 2. qemu_new_net_client() > More specifically I'm looking through the virtio-net vhost-net sources.
NetClientState is the concept send/receive packet abstraction. Both netdevs (tap, socket, ...) and NICs need to use NetClientState to transmit packets. A NICState has one or more NetClientStates (for multi-queue NICs). These NetClientStates have a NetClientOptionsKind of NET_CLIENT_OPTIONS_KIND_NIC to distinguish them from the -netdevs like tap, socket, etc. Emulated NICs use qemu_new_nic() while netdevs use qemu_new_net_client(). NICs and netdev vary slightly in their removal behavior, so you'll see code that checks the NetClientState type to see whether it is NET_CLIENT_OPTIONS_KIND_NIC. Stefan
pgp2yJLnB15ww.pgp
Description: PGP signature