Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp852146rdb; Tue, 23 Jan 2024 18:13:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCnE2tmTMI5Htm5gH59j/smlVIkJxvv2ZmMcc+6iU81N4Qq2g5du+QGaq8/iB9yqXrGn61 X-Received: by 2002:a05:620a:1d88:b0:783:48dd:3203 with SMTP id pj8-20020a05620a1d8800b0078348dd3203mr6801755qkn.60.1706062393256; Tue, 23 Jan 2024 18:13:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706062393; cv=pass; d=google.com; s=arc-20160816; b=Pwy7lJWei1FaRfwzQz+SsIoKm249IUAxgNjqlNjr6ChDiPAwZJVMIAh3L1hUCo1xOM HdgSKZJpwXBrGY6vE4cKJuumB44ezrlZEx554B1jW0mWSEBbfE5aU07f0J1y0k93bEhz p52/WOKETzfw2hUmawpahHitpgIeY6XZxIzy8sR9fLrj8M9bmy9cc3XF8msS6vGHa+v/ SnpLkXnZ3XnIhG83K2G8RYVkFOjd3Itd6YUidiLxXlxQaWTRs2DmazPej4Bn1E4ra05V KUHwxDlI9od6V9mg8p2Sq+tQkMaET78+Zm++O7nUFpb1Gk1W/JSe9isS704XIxM1T5t4 eoHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=BcX6ZTJW6jDsbwZncNxHncjf49E26ZAqFDwn/qtQ/ko=; fh=vfiAGUd190fA1jEyMWkabAPAQVlbRoSbyeFuDbxUX5s=; b=eS6+z1EW1GHucWzRkkTUzNHqiGFn9b8Chr//H0iVR5iKhraHEYxw0s3w3YhO1pOZef kfUIAY5rg6dQx5HC7S5aUV6N7Esz2RkUb14gb+b0vyg6asj3T8+5YR6A0Y9yR94hZrfi tpVkuhx4gVCtdx7OqB6ApVWUD+HzDpHT3QfdjJpbQBxEAmuR+YggmrANHFe/B93lBicn KYwrix50MZc4dONa+3hU57j4zVLtph3lFR99hLRd74T7IlPy8dWFOy8ZZZ7w3m5c1tC6 gbgfbF2I+8je/br0OmISN6caNo1fp966M8JeScVQuqasMXwC4xzvqBnYHLc06tHRJ8SA wBow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Jmx+02C6; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-36300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36300-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pc40-20020a05620a842800b0077f4e80e131si8785429qkn.692.2024.01.23.18.13.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 18:13:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Jmx+02C6; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-36300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36300-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 0972F1C24430 for ; Wed, 24 Jan 2024 02:13:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9116D1854; Wed, 24 Jan 2024 02:13:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Jmx+02C6" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 154C95C97 for ; Wed, 24 Jan 2024 02:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706062380; cv=none; b=dMNMMQhvv+eyJ+0Tq+CLHn89s20htLtBV0edt64xKVtTfG0r8CmumPudLKX8bba+NW+sk63jKLPotTQhJcy9vNOkR4Bz1kysBTKmtaFIVs9nMrX/p7fKSGzw2pf3TDYnC1p5eUW6QAT0NFiTWr0PyDLWUxPMp1oz80MqVh+U6+s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706062380; c=relaxed/simple; bh=lFdIGOrsLJDCPMyERIOrFMHqIa0XrdR2y2Y6ka89vkE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=cCJrZ9MNU148lv6KqoW2OlbOrjo7LiK5lz4rDfj7YdH9eqB2Hp4vQJg2Lh88dS8y5pLJjjIz9QQhpPkRr7EFdimjeNT7bKecipfa1xdFxPhJ8pvS0tV1Fepl2a1cGVf7qO5iEixHKJiEWa4FHJb1A1N6Nib0pkWHiL/QfU7l2tA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Jmx+02C6; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706062378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BcX6ZTJW6jDsbwZncNxHncjf49E26ZAqFDwn/qtQ/ko=; b=Jmx+02C6u/XVppohwbvwVgyZQFcT577XdSpZHDjIlCCDWsNGBL9Z7r53I1ABFOFtjAhs14 iCIw39XrbXhZOAPOTP1ronn74DtIVP/OwbU7lXmlnGeoOuDM8hXOexls956713cVZCIlc3 dakDH/VxzNHMCtFl1k1LaLPsmMr/0hE= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-Ncr3usC9OlqinstkJwj8Ow-1; Tue, 23 Jan 2024 21:12:56 -0500 X-MC-Unique: Ncr3usC9OlqinstkJwj8Ow-1 Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-6dd7ad4009dso1378888b3a.0 for ; Tue, 23 Jan 2024 18:12:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706062375; x=1706667175; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BcX6ZTJW6jDsbwZncNxHncjf49E26ZAqFDwn/qtQ/ko=; b=ZSen6HlUVif1bWUTBkgVrOXdcMsgOEKqI32c6cV5O4DgNqW6Cf22fKtXISdQv3Gq/G aZcLPHZxh9tBaCjljz11tQJzhuZbx7zRILJAqxgb1aibmG75rlHQKS9403GXmPVR0j8b A7GTLyNd4IHAVqlGxfr3+p3ZINWxvOJHS1LfkwVHOW1zMOvjFCTdBEQOpHtjXJ3ERAQT ao2AnjjXYvSVSxG2ISO0ibuyZcxyzP5rnpWngAY0UzMXs+XT89fbcPRz3cjc6t6dpykp GOP/rq00nPT8lkYxXAroveZ4PI76Zn1NQoTbr6nu5uGTLfj6GRuhX92IiQI+2kkrKchx BDYQ== X-Gm-Message-State: AOJu0YzXxUd5oQF/QNarfXawTNKt+bEPivaqXzLOOCVudW+gFJujTOSB E2dbcWrwiNKK4SUaDfzZYuSXNbCAA8utqsA/JecWperY1lxpABZIVwJcMygaeAsT6vAITtwPHsk V3T0bl5WwaAJRtmXHO63ANXi97+Hfuu7QavBOq8crtkSHIkcr8pwQzjJLi/fG9pGE0Pchc8aqLn kuMxdLD6FwsuNk85k/Z1jrr2WkRz0rjOs6gphCspwiJ1EQ X-Received: by 2002:a05:6a20:2d0a:b0:19a:834f:3b05 with SMTP id g10-20020a056a202d0a00b0019a834f3b05mr246694pzl.47.1706062374955; Tue, 23 Jan 2024 18:12:54 -0800 (PST) X-Received: by 2002:a05:6a20:2d0a:b0:19a:834f:3b05 with SMTP id g10-20020a056a202d0a00b0019a834f3b05mr246687pzl.47.1706062374696; Tue, 23 Jan 2024 18:12:54 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240122102256.261374-1-liangchen.linux@gmail.com> In-Reply-To: <20240122102256.261374-1-liangchen.linux@gmail.com> From: Jason Wang Date: Wed, 24 Jan 2024 10:12:43 +0800 Message-ID: Subject: Re: [PATCH] virtio_net: Support RX hash XDP hint To: Liang Chen Cc: mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 22, 2024 at 6:23=E2=80=AFPM Liang Chen wrote: > > The RSS hash report is a feature that's part of the virtio specification. > Currently, virtio backends like qemu, vdpa (mlx5), and potentially vhost > (still a work in progress as per [1]) support this feature. While the > capability to obtain the RSS hash has been enabled in the normal path, > it's currently missing in the XDP path. Therefore, we are introducing XDP > hints through kfuncs to allow XDP programs to access the RSS hash. > > Signed-off-by: Liang Chen > --- > drivers/net/virtio_net.c | 56 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index d7ce4a1011ea..1463a4709e3c 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -4579,6 +4579,60 @@ static void virtnet_set_big_packets(struct virtnet= _info *vi, const int mtu) > } > } > > +static int virtnet_xdp_rx_hash(const struct xdp_md *_ctx, u32 *hash, > + enum xdp_rss_hash_type *rss_type) > +{ > + const struct xdp_buff *xdp =3D (void *)_ctx; > + struct virtio_net_hdr_v1_hash *hdr_hash; > + struct virtnet_info *vi; > + > + if (!(xdp->rxq->dev->features & NETIF_F_RXHASH)) > + return -ENODATA; > + > + vi =3D netdev_priv(xdp->rxq->dev); > + hdr_hash =3D (struct virtio_net_hdr_v1_hash *)(xdp->data - vi->hd= r_len); Is there a guarantee that the hdr is not modified? Thanks