From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQbzU-0003DV-MM for qemu-devel@nongnu.org; Wed, 25 Feb 2015 08:27:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQbzQ-00022b-VS for qemu-devel@nongnu.org; Wed, 25 Feb 2015 08:27:04 -0500 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:63689) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQbzQ-00022X-Ob for qemu-devel@nongnu.org; Wed, 25 Feb 2015 08:27:00 -0500 Received: by mail-wi0-f181.google.com with SMTP id r20so5027305wiv.2 for ; Wed, 25 Feb 2015 05:26:59 -0800 (PST) Date: Wed, 25 Feb 2015 13:26:57 +0000 From: Stefan Hajnoczi Message-ID: <20150225132657.GA2922@stefanha-thinkpad.redhat.com> References: <54ED7FC0.1010808@freescale.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gBBFr7Ir9EOA20Yy" Content-Disposition: inline In-Reply-To: <54ED7FC0.1010808@freescale.com> Subject: Re: [Qemu-devel] net devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vasile Catalin-B50542 Cc: qemu-devel@nongnu.org --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --gBBFr7Ir9EOA20Yy Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJU7c2hAAoJEJykq7OBq3PIsqUH/17BtfNxgEdbVtjYy69Iwp+0 rNsbHBZDnJCPMVmpTujtrNOHGJy6M5VJzisYC1bFfrPXATSVgOCxZsydHQVoJRSB SvFv1bBeItjRQ37SPqwXHNM1aAjJbKqUyX3+d7rHbrDb7ZUsgHWBxdHeUCZeP/M9 Y9JNr9ON0iraBtNg1sZ3/SiH6FDgpgB5amXniv4rY9mT7FZHTTEoHyEMQvR1PHh6 uh+dCmZHcpqNHlAQWMRK3cKlEVIGS5uCNbtc3NuUimTfo9HlbR6SL/Ofs6fTHEqZ UO4C4Bog1ly/koKV3w6xhEYVdfa/mcBfHNR1Bl+iFPgiX06sH+1L+jNdUIpqiQM= =yv48 -----END PGP SIGNATURE----- --gBBFr7Ir9EOA20Yy--