From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 3FBC4592C for ; Wed, 11 Jan 2017 09:23:01 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id r126so5535842wmr.0 for ; Wed, 11 Jan 2017 00:23:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:date:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6xpQ+WMe/tH+APR56om3cBm1xGcmkhwyZZTHrN2+wJM=; b=OiyIgJbQaDFyQgqcCpuvn3udDOXwohsJ8/liP91nDuB3SWY1/Zb5xDgbGh5Z5snN0c JAtp87AC3ebnxSEcH4id6MFdgc53ygoicYrB7jqWSgZ8O2ptu3zUfLvib1zJXzDErKXU Ibxcsjeo1rnVZD5HTiYn5nRi1/kvHHRQV8Py1ymLaI+ZYAnjg2MDKtPzJs+kHPKfOwem eUtgt6L7qYW5QoK7Rp555/bTR53hvvxO3zPZA+8sRIRzgvptCkLebcrk4plnZ2z33v1z HXVn38qOj+gDmlZelSdLgrzv3VV5LxW5kDNszN9MwaZuGbRVqXJfdObmeNiZdHzkU9KS 5NHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6xpQ+WMe/tH+APR56om3cBm1xGcmkhwyZZTHrN2+wJM=; b=PXVJIGy2F5fV9WJlkGO7C/14EwmNQbhe3COle1/OZn8X71NrKQKjNSbGd/LpTPuDHh uw59O2Gq0Rtjqozhf+fHIABXTZBsenWN/7F4LRHPEep5XtpzOU/vBqWiJ56qmNCLLaFt QoQvM7y6o/T2c8Yy+VDlmg683ZweXWACJm3iE421yftt6vmSk1GlGRfY13Q4sXpVbNn9 Fg9znX3/sEZCYcI/gZqA0iqSFeTFdSpQHoMX+JqsBRxrsTjpuocFtOVsSh8+VwHuKugC jGY51le2a45+UaKV1jdLBn2dG2DT8i6wKyG+NscoZKstP8q4iXL7P0Sv2eBHQJXMGXLT /f0g== X-Gm-Message-State: AIkVDXJaLXbty05DGR3s/UENHb0kLLCZW7Mo9m4sAPMlIfggokiu/ExQnRuEGYkbiX3EZnoX X-Received: by 10.223.178.9 with SMTP id u9mr4432243wra.125.1484122981669; Wed, 11 Jan 2017 00:23:01 -0800 (PST) Received: from glumotte.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id x140sm28405805wme.19.2017.01.11.00.23.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jan 2017 00:23:01 -0800 (PST) From: Olivier MATZ X-Google-Original-From: Olivier MATZ Date: Wed, 11 Jan 2017 09:22:53 +0100 To: Maxime Coquelin Cc: Yuanhan Liu , dev@dpdk.org, Tan Jianfeng , Wang Zhihong , Olivier Matz , "Michael S. Tsirkin" , stable@dpdk.org Message-ID: <20170111092253.559b688f@glumotte.dev.6wind.com> In-Reply-To: References: <1484108832-19907-1-git-send-email-yuanhan.liu@linux.intel.com> <1484108832-19907-2-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/2] net/virtio: fix performance regression due to TSO enabling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2017 08:23:02 -0000 Hi Yuanhan, Thanks for the fix. On Wed, 11 Jan 2017 08:59:28 +0100, Maxime Coquelin wrote: > On 01/11/2017 05:27 AM, Yuanhan Liu wrote: > > TSO is now enabled, but it's not actually being used by default in a > > simple L2 forward mode. In such case, we have to zero the virtio net > > headers, to inform the vhost backend that no offload is being used: > > > > hdr->csum_start = 0; > > hdr->csum_offset = 0; > > hdr->flags = 0; > > > > hdr->gso_type = 0; > > hdr->gso_size = 0; > > hdr->hdr_len = 0; > > > > Such writes could be very costly; it introduces severe cache issues: > > The above operations introduce cache write for each packet, which > > stalls the read operation from the vhost backend. > > > > The fact that virtio net header is initiated to zero in PMD driver > > init stage means that these costly writes are unnecessary and could > > be avoided: > > > > if (hdr->csum_start != 0) > > hdr->csum_start = 0; > > > > And that's what the macro ASSIGN_UNLESS_EQUAL does. With this, the > > performance drop introduced by TSO enabling is recovered: it could > > be up to 20% in micro benchmarking. > Very nice! Yep, I'm also impressed by the result. I would have think this is something already done by the hardware and transparent to the software. > > > > > Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload") > > Fixes: 696573046e9e ("net/virtio: support TSO") > > > > Cc: Olivier Matz > > Cc: Maxime Coquelin > > Cc: Michael S. Tsirkin > > Cc: stable@dpdk.org > > Signed-off-by: Yuanhan Liu > > [...] > > Reviewed-by: Maxime Coquelin Reviewed-by: Olivier Matz