Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3159738ybv; Mon, 24 Feb 2020 19:32:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxGA1V+pN51WLx2K4uLZiS1G0lPzo9E6PGJUtEd45b+LShmVAQJsLippZP/xDLbAwNknQxQ X-Received: by 2002:aca:2813:: with SMTP id 19mr1904382oix.76.1582601563042; Mon, 24 Feb 2020 19:32:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582601563; cv=none; d=google.com; s=arc-20160816; b=hQEjVsNLy97XjChr/nrqlvnY2PeWBhBHwSjl+d9f39f+1V0LD6xHbwIdzQeB+QhXi7 bvR9TnRckw7FiHvfWnSbbAkMY/oq9qEslo+pX0d18EAGpFdZflogvHY6+v9DBur5mMdu ENNjK59IIoREbgMk0CoSmCSlS5e90nBcjGMf6kjgX6L1TeESZj65qanKQabqSPm+5mdP viz1/Dqhb5xT7Hq3VrPybnWiBPYyxPF4LTaq1CiB0s6CW+2YJ5nqRvSm8mkBPfUf9tdM 41AQnb7KFt8oxD6EgsQ8ocBaSYAZzcMe2q40G8W8TOssA0SCII+M2jti87UI8DM7qYK9 ILJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/Pbt342k1OXmh+Pxr0Wxb2t1e7Z4oOL/0F3HAHBpB7Y=; b=Yql2qIpXC5CWATNCYmLyjXG8OMrSRm7Ru9iWTIg27YPHXehSHkIsURSf9DcAMEYGVc 8rs92xan4WVu/A8m7yAiv5RMf0hiL5G2bPJmT9YTd1RH3+JTK1PLXqm0qGymDkjcuwAA PsFrwDw7V5K/HiL1tIHdtrNfbPReu4eKUAnWfORKRKY49YmnkkJfB/MPUX8IRE+hgfPC n12bqhUFUf/yjxO4v5SBLg0AUI836GTz1se2PlE2VBQtyVx2Jrs3bRczzgyVwCnULEUu h9tUdaCpCiWWaJAl14KfzHFMxgvzY0ZGmnoktppbXG+HHLZv3NdvtRDoHPYrG7nzFSy5 Zt5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="kKKu2Er/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si6892804otp.292.2020.02.24.19.32.30; Mon, 24 Feb 2020 19:32:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="kKKu2Er/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728903AbgBYDcU (ORCPT + 99 others); Mon, 24 Feb 2020 22:32:20 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39800 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgBYDcU (ORCPT ); Mon, 24 Feb 2020 22:32:20 -0500 Received: by mail-pf1-f196.google.com with SMTP id 84so6437077pfy.6; Mon, 24 Feb 2020 19:32:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/Pbt342k1OXmh+Pxr0Wxb2t1e7Z4oOL/0F3HAHBpB7Y=; b=kKKu2Er/WfLLJHimBkMyl2Ff5QWpltx4tU8wdrigPD+wLXhyddAldgn0qjNl4fzqDo v8WWv0dzBRfEnaF99WyEO/zsqtFyTyoeP2AOz/UEmY8pRIudYoXSWda0RUi2AzJL3Fu0 Ijn39EvWC5VZRxpBnfu6cBGDtFhNqCeF2JmvbRB+O8vlXFyt+FVqsnm1UFOYwMjCXrfx zE76zREDQRzWZNA1+mPVucOkIEzYUk4U5uYHQfcr8iIhdEGjsXgxe4KO2GoKAexOMiU6 rt92LY6vxJlskXow7Tfugt7OiEOFLHDQ26Rl8FaWdpAnOeuLp7vqYMA2zsAS7uuEmf27 9cMQ== 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:mime-version:content-transfer-encoding; bh=/Pbt342k1OXmh+Pxr0Wxb2t1e7Z4oOL/0F3HAHBpB7Y=; b=mzZ9mnqXfKlsVeuCDWWEB9LGe3e9bTVSFLZuedIkUx38Y25WPgpQ6zV+lRAqF3vu9n VrF/G7lQmXXt5UwLNRVbrp4qO/BeVrQcuIrt/cuPA/djYy4YiY6qX2zNE/QH8t08EDxX qeYyKOad31/wiIE5RwP1/B/bptoGxKo5Kf1Btbt/pI35j3uaaYOYLxqFWo+zpteYBDEv eAePyNi/NPSRRO67H9m9LWfyJeJeBQE7UgHM2iTItpDtz7iz9XNbSy+m4Tzx7pt5Hegd Ci+/JlZk6JKHVDs9Wf6YXvpFSsNRQzNizbBdnxt1sESCsjP5vaO+CthiOfWNZ539BgpC l1UQ== X-Gm-Message-State: APjAAAW2ixTXwE11rU8SVLNAgIP8PDV9eab4tnft6Usc4TVAsaUrgRHP XQI/vuifasC9LbGB5gx+OzM= X-Received: by 2002:a65:6412:: with SMTP id a18mr30009737pgv.10.1582601539703; Mon, 24 Feb 2020 19:32:19 -0800 (PST) Received: from localhost.localdomain ([103.202.217.14]) by smtp.gmail.com with ESMTPSA id u1sm14322493pfn.133.2020.02.24.19.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 19:32:19 -0800 (PST) From: Yuya Kusakabe To: jasowang@redhat.com Cc: andriin@fb.com, ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, davem@davemloft.net, hawk@kernel.org, john.fastabend@gmail.com, kafai@fb.com, kuba@kernel.org, linux-kernel@vger.kernel.org, mst@redhat.com, netdev@vger.kernel.org, songliubraving@fb.com, yhs@fb.com, yuya.kusakabe@gmail.com Subject: [PATCH bpf-next v6 1/2] virtio_net: keep vnet header zeroed if XDP is loaded for small buffer Date: Tue, 25 Feb 2020 12:32:11 +0900 Message-Id: <20200225033212.437563-1-yuya.kusakabe@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200225033103.437305-1-yuya.kusakabe@gmail.com> References: <20200225033103.437305-1-yuya.kusakabe@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We do not want to care about the vnet header in receive_small() if XDP is loaded, since we can not know whether or not the packet is modified by XDP. Fixes: f6b10209b90d ("virtio-net: switch to use build_skb() for small buffer") Signed-off-by: Yuya Kusakabe --- drivers/net/virtio_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 2fe7a3188282..f39d0218bdaa 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -735,10 +735,10 @@ static struct sk_buff *receive_small(struct net_device *dev, } skb_reserve(skb, headroom - delta); skb_put(skb, len); - if (!delta) { + if (!xdp_prog) { buf += header_offset; memcpy(skb_vnet_hdr(skb), buf, vi->hdr_len); - } /* keep zeroed vnet hdr since packet was changed by bpf */ + } /* keep zeroed vnet hdr since XDP is loaded */ err: return skb; -- 2.24.1