From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1br46w-0005bg-OF for qemu-devel@nongnu.org; Mon, 03 Oct 2016 10:20:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1br46s-0004PA-IS for qemu-devel@nongnu.org; Mon, 03 Oct 2016 10:20:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1br46s-0004OB-7n for qemu-devel@nongnu.org; Mon, 03 Oct 2016 10:20:50 -0400 References: <1474872056-24665-1-git-send-email-yuanhan.liu@linux.intel.com> <1474872056-24665-2-git-send-email-yuanhan.liu@linux.intel.com> <20160926221112-mutt-send-email-mst@kernel.org> <20160927031158.GA25823@yliu-dev.sh.intel.com> <20160927224935-mutt-send-email-mst@kernel.org> <20160928022848.GE1597@yliu-dev.sh.intel.com> <20160929205047-mutt-send-email-mst@kernel.org> <2889e609-f750-a4e1-66f8-768bb07a2339@redhat.com> <20160929231252-mutt-send-email-mst@kernel.org> From: Maxime Coquelin Message-ID: <3518935f-1e6d-95e9-8522-19b214ed45db@redhat.com> Date: Mon, 3 Oct 2016 16:20:44 +0200 MIME-Version: 1.0 In-Reply-To: <20160929231252-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] vhost: enable any layout feature List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Yuanhan Liu , Stephen Hemminger , dev@dpdk.org, qemu-devel@nongnu.org On 09/29/2016 10:21 PM, Michael S. Tsirkin wrote: > On Thu, Sep 29, 2016 at 10:05:22PM +0200, Maxime Coquelin wrote: >> > >> > >> > On 09/29/2016 07:57 PM, Michael S. Tsirkin wrote: >>> > > On Thu, Sep 29, 2016 at 05:30:53PM +0200, Maxime Coquelin wrote: >> > ... >>>> > > > >>>> > > > Before enabling anything by default, we should first optimize the 1 slot >>>> > > > case. Indeed, micro-benchmark using testpmd in txonly[0] shows ~17% >>>> > > > perf regression for 64 bytes case: >>>> > > > - 2 descs per packet: 11.6Mpps >>>> > > > - 1 desc per packet: 9.6Mpps >>>> > > > >>>> > > > This is due to the virtio header clearing in virtqueue_enqueue_xmit(). >>>> > > > Removing it, we get better results than with 2 descs (1.20Mpps). >>>> > > > Since the Virtio PMD doesn't support offloads, I wonder whether we can >>>> > > > just drop the memset? >>> > > >>> > > What will happen? Will the header be uninitialized? >> > Yes.. >> > I didn't look closely at the spec, but just looked at DPDK's and Linux >> > vhost implementations. IIUC, the header is just skipped in the two >> > implementations. > In linux guest skbs are initialized AFAIK. See virtio_net_hdr_from_skb > first thing it does is > memset(hdr, 0, sizeof(*hdr)); > > > >>> > > >>> > > The spec says: >>> > > The driver can send a completely checksummed packet. In this case, flags >>> > > will be zero, and gso_type >>> > > will be VIRTIO_NET_HDR_GSO_NONE. >>> > > >>> > > and >>> > > The driver MUST set num_buffers to zero. >>> > > If VIRTIO_NET_F_CSUM is not negotiated, the driver MUST set flags to >>> > > zero and SHOULD supply a fully >>> > > checksummed packet to the device. >>> > > >>> > > and >>> > > If none of the VIRTIO_NET_F_HOST_TSO4, TSO6 or UFO options have been >>> > > negotiated, the driver MUST >>> > > set gso_type to VIRTIO_NET_HDR_GSO_NONE. >>> > > >>> > > so doing this unconditionally would be a spec violation, but if you see >>> > > value in this, we can add a feature bit. >> > Right it would be a spec violation, so it should be done conditionally. >> > If a feature bit is to be added, what about VIRTIO_NET_F_NO_TX_HEADER? >> > It would imply VIRTIO_NET_F_CSUM not set, and no GSO features set. >> > If negotiated, we wouldn't need to prepend a header. > Yes but two points. > > 1. why is this memset expensive? Is the test completely skipping looking > at the packet otherwise? > > 2. As long as we are doing this, see > Alignment vs. Networking > ======================== > in Documentation/unaligned-memory-access.txt This change will not have an impact on the IP header alignment, as is offset in the mbuf will not change. Regards, Maxime