From patchwork Thu Feb 16 12:29:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Fleytman X-Patchwork-Id: 9577017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A9EF600C5 for ; Thu, 16 Feb 2017 12:31:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 327452856A for ; Thu, 16 Feb 2017 12:31:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26FBC284A5; Thu, 16 Feb 2017 12:31:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A3202284A5 for ; Thu, 16 Feb 2017 12:31:31 +0000 (UTC) Received: from localhost ([::1]:46122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceLDe-0003j2-P9 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Feb 2017 07:31:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceLCz-0003gZ-J1 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 07:30:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceLCw-00087C-FS for qemu-devel@nongnu.org; Thu, 16 Feb 2017 07:30:49 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34561) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ceLCw-00086u-5E for qemu-devel@nongnu.org; Thu, 16 Feb 2017 07:30:46 -0500 Received: by mail-wm0-x241.google.com with SMTP id c85so2903898wmi.1 for ; Thu, 16 Feb 2017 04:30:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NoWow3BvTiyTYA7PFStHxrLDWH5TGgkUiy92tWtujkU=; b=fjLF7U6G+VpL5mvGgljCz1IlFAL630FTKFUPc9vNemAwIVc2wzsH0WFjBlIrwAMrTn RP00oY3IdsDmhyC22AUxeo0yC2V8bKw5Y2ZJ8ZkhFB5YvyvZrwIph8XwTqYS1rfIrwyp imZS1jJx4qS4GvKCdkhUnFNs/TwpWSnZ6FyFbIJq3t638pUuF5oA1fhgzapVw5/5GLb+ 98A3CjQS5sF44vfw9Q95kVTRrpMfJBabshWeYFGfCqOUREszM6NTs1j2IBGFUEg+Jf/z K9JnGMzUMoXDS5t5aUP5dx3qU+4oZTpycJj4VxiCvQ8xz6gBwKbeVCHPCpiIVanaRY4U Fu6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NoWow3BvTiyTYA7PFStHxrLDWH5TGgkUiy92tWtujkU=; b=Bn593alnf9zALuD02toEfpDXH2i6RfuvuQRU1Lf7Igfsq8x2T68VOAwI5a/EqH17x3 1GXJDmkrbVAxNWloJKCVH9IEv56sDfikZFbyQq+FWvd6IYYkf4fE/HGUxsYiN/PDJ4ru mrMAZBRGkZpOQ1JqToD5c71qvybM9JaqTpy7DQtrSOtLYgviStuk7YaQh00cdJuJ/OGa vWlkc6ELqpYtToha93pAodSOMpgVN3BNvR5PoS1ohrNEUbATDvBv1+4AAdnuIzYEu9uN yS8AehS2CYz52TlSKKNKhndXNNlPl3k5FVfi05maZao8w+N+gXrMcydOQ+VQjc7jbd0a 2fiw== X-Gm-Message-State: AMke39n2Q3qjBDfL/N+KhtmuMzBozCLGrCtdDJRORosQUxfIj7qva63pIIfhq3EpI72iBw== X-Received: by 10.28.230.91 with SMTP id d88mr12008752wmh.129.1487248245237; Thu, 16 Feb 2017 04:30:45 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id b51sm8827365wrd.39.2017.02.16.04.30.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 04:30:44 -0800 (PST) From: Dmitry Fleytman To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 14:29:35 +0200 Message-Id: <1487248176-29602-5-git-send-email-dmitry@daynix.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487248176-29602-1-git-send-email-dmitry@daynix.com> References: <1487248176-29602-1-git-send-email-dmitry@daynix.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PATCH 4/5] NetRxPkt: Account buffer with ETH header in IOV length X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer , Dmitry Fleytman , Jason Wang , P J P Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In case of VLAN stripping ETH header is stored in a separate chunk and length of IOV should take this into account. This patch fixes checksum validation for RX packets with VLAN header. Devices affected by this problem: e1000e and vmxnet3. Signed-off-by: Dmitry Fleytman --- hw/net/net_rx_pkt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index d38babe..c7ae33d 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -97,7 +97,7 @@ net_rx_pkt_pull_data(struct NetRxPkt *pkt, pkt->tot_len = iov_size(iov, iovcnt) - ploff + pkt->ehdr_buf_len; pkt->vec_len = iov_copy(pkt->vec + 1, pkt->vec_len_total - 1, iov, iovcnt, ploff, - pkt->tot_len - pkt->ehdr_buf_len); + pkt->tot_len - pkt->ehdr_buf_len) + 1; } else { net_rx_pkt_iovec_realloc(pkt, iovcnt);