From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6Hth-0006X0-Nj for qemu-devel@nongnu.org; Mon, 14 Nov 2016 09:06:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6Hte-00008S-GV for qemu-devel@nongnu.org; Mon, 14 Nov 2016 09:06:09 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36372) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c6Hte-000087-A1 for qemu-devel@nongnu.org; Mon, 14 Nov 2016 09:06:06 -0500 Received: by mail-wm0-x242.google.com with SMTP id m203so15602438wma.3 for ; Mon, 14 Nov 2016 06:06:06 -0800 (PST) Date: Mon, 14 Nov 2016 14:06:03 +0000 From: Stefan Hajnoczi Message-ID: <20161114140603.GC26198@stefanha-x1.localdomain> References: <201611051850530152761@gmail.com> <201611091858142738325@gmail.com> <20161110103253.GC17332@stefanha-x1.localdomain> <2016111020163477037720@gmail.com> <20161111120347.GB8930@stefanha-x1.localdomain> <201611121643189598926@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="da4uJneut+ArUgXk" Content-Disposition: inline In-Reply-To: <201611121643189598926@gmail.com> Subject: Re: [Qemu-devel] virtIO question List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "zhunxun@gmail.com" Cc: qemu --da4uJneut+ArUgXk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Nov 12, 2016 at 04:43:21PM +0800, zhunxun@gmail.com wrote: > Thanks,the expression is not the key problem,I just write it wrong,the key problem is that what I get from the code is everytime dirver add a sg ,it will call virtqueue_kick,such as network driver,in start_xmit function ,it called xmit_skb generate a sg list and add it to the queue,then called virtqueue_kick ,why it handle like this??can you explain it to me??thank you very much!!! I can see there *are* cases in Linux 4.9-rc1 virtio_net.c:start_xmit() where virtqueue_kick() is skipped so that multiple tx packets can be added to the virtqueue in a single kick. static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) { ... bool kick = !skb->xmit_more; ... if (kick || netif_xmit_stopped(txq)) virtqueue_kick(sq->vq); ... } Also keep in mind that the virtio driver APIs in Linux are used by multiple device drivers (virtio_net.ko, virtio_blk.ko, etc). virtio_net.ko does not use all features offered by the API. Stefan --da4uJneut+ArUgXk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJYKcTLAAoJEJykq7OBq3PI3HIH/3e1pEehOzH812L8se8eDo9F VFu+6sC5Kb9KlV5Dg+z73maJ7hYc1f/3MxKo75rs2s9XUnmBev0GHwqEkBe+5o9m UqdAsNI4PL2yUI2C6+2HQKWnBRMVDn+lVVrdXEUYQFrZZ5B2DI+Z5BWJ7HkQxczp yW5pgfLzIzkFVBGDEjaCt04kk65yaRIYjhlaOT2Yne2wM4hyPCwjWL1EXIJPMhwB moQuEGe2nLaKLKJ7a16WV28rzz+2Ww/5z2AD9TeW5psrtSlfVaXZFrkcdX3HBvbY miGIrPvT6rd+zPRFD+jlKav3YD+QXssnXBfnOGHtjOcFb1izwy3KKLv5VJvAoe4= =oMGI -----END PGP SIGNATURE----- --da4uJneut+ArUgXk--