Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp996008rdb; Wed, 24 Jan 2024 01:16:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLAEKhFzbuYS9Vk2NDQ46sZ6hDkkWgn5PLzGiR6LNSYhthhbNIXCaKz1saimhytxSKhY6k X-Received: by 2002:a05:622a:1308:b0:42a:59a3:c1ef with SMTP id v8-20020a05622a130800b0042a59a3c1efmr1407712qtk.19.1706087810960; Wed, 24 Jan 2024 01:16:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706087810; cv=pass; d=google.com; s=arc-20160816; b=N+XdoNmyFxGOa29Nl0coPuvkGNjuJfWncE24KwiuiXoRsYNH4G7V6QrExsG0hfwjrG xpN9dkJPRox0SeazFD8o11Z3FbNWpQdGhKUqnephwRk4lz+TzOcUq7/pMh0c9L9fikUI gQTyW1QT2ZOdtJ+WZQLEXScHA/UrIsnySx5Bvcla93vCq2lVEZGJi9s3u8BWuw2+ngMT pQWsp5nNQo3yBKQSw+ZntjTjm6q/AeXLBFLtu1/Y0hN2S0UmuR3Op7XDihgMfax2PGj/ 2Q0WTS+0Sbsrmhs+yRwl+oalynvamWhc62VaviMRSfHTYqY9BZzA3IpVzpRLL3euhwAC xD7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to :references:cc:to:from:date:subject:message-id; bh=3q2dZ2DD4XfcLsZDIL5QqDzPalK+QE9zn+bWJ8QQTac=; fh=AxIFtNbn6xMh6HRsOBVNc1BsIVMzZamo8VxSOmnoVKY=; b=AHJ/sWbyJAZGimAMRJ9cdJfIAfzbJKLhPk7dXP1H37a9YTP6nbM8aduFjrgX+yGZON YsH4GVGSxOXB8TYFIgTmq/6wMBKczec8/bFPtp4uO1VH4F0HfFF33Q9H7XmztNkSICsE Zw/EV/zWowam2DxYSLjIwEZjNbIgBr3CFY3ak0O7bscKEPnjjLvayqlCWhIWQXbDb9+i eHyDRcy9kNm0ttkpbuZJLA3kqSOYDGvR5IiJKXdg0Q5ZTLLR/tKseQJPuMlELOCZKTr6 C3qELjUsr0slTXpaS9FQlS/zb2Zc3tgSX06KPjwvehfJ0L6C+ZlMng+44roEIwyKj1ge 4qhQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-36686-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36686-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o13-20020ac87c4d000000b0042a3c36f800si6840261qtv.457.2024.01.24.01.16.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 01:16:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36686-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-36686-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36686-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B50B81C226A4 for ; Wed, 24 Jan 2024 09:16:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2DC617C79; Wed, 24 Jan 2024 09:16:37 +0000 (UTC) Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BD0C17C65 for ; Wed, 24 Jan 2024 09:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.111 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706087797; cv=none; b=DL5+FbH5rL3Z8X8aHOfmKs7OdtrkFfotx54uXrh/e/XV0QC2IEaf2zG6ldQ+IrQKhv+gYlhmblic39m709lZjpBW1/1AMqdZqdAfIeuBs8HfwLYD6Ng9BdEBl97lh6MV0WrUBp3l2d2sx44b1+XEgleo609+wt6CS6kpt1qddqY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706087797; c=relaxed/simple; bh=Gw027f+IjQyyQbAt7FOQ+4RHmj+3PaRU6TIsxKZu6kY=; h=Message-ID:Subject:Date:From:To:Cc:References:In-Reply-To; b=DMQzyQRTFB46+Fd3ZeJOjJ1W/qzV9SBnlPqSFRsR5UsANUcwu3efXt5m7vWaY6VJ6ocThQE8SEwgLBt5uKSTExZdT3RosPjh1u8fYNQNqEzcQocR7hz/AxK7Xm6zqmbvIGAkh66PdMWshy6UHJR/HiWPYJMkoHRsoukrXQ62fsE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; arc=none smtp.client-ip=115.124.30.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R831e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0W.G52BL_1706087790; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0W.G52BL_1706087790) by smtp.aliyun-inc.com; Wed, 24 Jan 2024 17:16:31 +0800 Message-ID: <1706087654.2583706-2-xuanzhuo@linux.alibaba.com> Subject: Re: [PATCH v2 2/3] virtio_net: Add missing virtio header in skb for XDP_PASS Date: Wed, 24 Jan 2024 17:14:14 +0800 From: Xuan Zhuo To: Liang Chen Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, liangchen.linux@gmail.com, mst@redhat.com, jasowang@redhat.com, hengqi@linux.alibaba.com References: <20240124085721.54442-1-liangchen.linux@gmail.com> <20240124085721.54442-3-liangchen.linux@gmail.com> In-Reply-To: <20240124085721.54442-3-liangchen.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: On Wed, 24 Jan 2024 16:57:20 +0800, Liang Chen wrote: > For the XDP_PASS scenario of the XDP path, the skb constructed with > xdp_buff does not include the virtio header. Adding the virtio header > information back when creating the skb. > > Signed-off-by: Liang Chen > --- > drivers/net/virtio_net.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index b56828804e5f..2de46eb4c661 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1270,6 +1270,9 @@ static struct sk_buff *receive_small_xdp(struct net_device *dev, > if (unlikely(!skb)) > goto err; > > + /* Store the original virtio header for subsequent use by the driver. */ > + memcpy(skb_vnet_common_hdr(skb), &virtnet_xdp.hdr, vi->hdr_len); About this, a spec is waiting for voting. This may change the logic of the csum offset and so on. Please not do this. Thanks. > + > if (metasize) > skb_metadata_set(skb, metasize); > > @@ -1635,6 +1638,9 @@ static struct sk_buff *receive_mergeable_xdp(struct net_device *dev, > head_skb = build_skb_from_xdp_buff(dev, vi, xdp, xdp_frags_truesz); > if (unlikely(!head_skb)) > break; > + /* Store the original virtio header for subsequent use by the driver. */ > + memcpy(skb_vnet_common_hdr(head_skb), &virtnet_xdp.hdr, vi->hdr_len); > + > return head_skb; > > case XDP_TX: > -- > 2.40.1 >