From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlZmF-0007Bc-PU for qemu-devel@nongnu.org; Sun, 09 Jun 2013 03:11:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UlZmD-0002It-Hd for qemu-devel@nongnu.org; Sun, 09 Jun 2013 03:10:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlZmD-0002Ip-9s for qemu-devel@nongnu.org; Sun, 09 Jun 2013 03:10:57 -0400 Date: Sun, 9 Jun 2013 10:11:27 +0300 From: "Michael S. Tsirkin" Message-ID: <20130609071127.GC13082@redhat.com> References: <20130606095456.GA7865@redhat.com> <87hahar7ms.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87hahar7ms.fsf@rustcorp.com.au> Subject: Re: [Qemu-devel] [PATCH] virtio-net: put virtio net header inline with data List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Rusty Russell Cc: Cong Wang , qemu-devel@nongnu.org, netdev@vger.kernel.org, Jason Wang , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Dave Jones , Amos Kong , "David S. Miller" On Fri, Jun 07, 2013 at 11:42:43AM +0930, Rusty Russell wrote: > "Michael S. Tsirkin" writes: > > For small packets we can simplify xmit processing by linearizing buffers > > with the header: most packets seem to have enough head room we can use > > for this purpose. > > > > Since some older hypervisors (e.g. qemu before version 1.5) > > required that header is the first s/g element, > > we need a feature bit for this. > > OK, we know this is horrible. But I will sleep better knowing that we > this feature need never make it into a final 1.0 spec, since it can be > assumed at that point... Nod. Though if we want to require this for all devices, virtio-blk scsi command passthrough will need to change - I sent a spec patch a while ago virtio-spec: add field for scsi command size any comments on it? > > pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest); > > + if (vi->mergeable_rx_bufs) > > + hdr_len = sizeof hdr->mhdr; > > + else > > + hdr_len = sizeof hdr->hdr; > > + > > + can_push = vi->any_header_sg && > > + !((unsigned long)skb->data & (__alignof__(*hdr) - 1)) && > > + !skb_header_cloned(skb) && skb_headroom(skb) >= hdr_len; > > Idle thought: how often does this fail? I think it's mostly doesn't fail in my testing. It's probably a good idea to add a counter here, then if it starts triggering we can optimize. I think things like skb_header_cloned depend on guest config really, e.g. tcpdump running on the interface in guest can cause this. > Would it suck if we copied > headers which didn't let us prepend data? I think it will - copies are generally best avoided, and header is easily 1K of data. > Or could we bump > dev->hard_header_len appropriately? Needs some thought, though from experience it's a pain. > Thanks, > Rusty.