From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 990631AF0D7 for ; Mon, 10 Mar 2025 04:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741581847; cv=none; b=TpqDGpXStNsZJVSo1XcgAQvyW6q+OTZtl488ajx4gqkWaW1NdeaVLIUvZHrRa4IN46wGKf+hjzk7dWPWx4E686EWNbUXv5hAggdTMQ+Ky5R9ryrl/by6inRtVVqOja3/RL1sMywcMuKQNJ5g+5wUV3nKumNqbXQha/d9eNRS7Aw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741581847; c=relaxed/simple; bh=pnQvGp7bnGzzq9tz0+YpYB/XyZel5rpIl6e/BWSRiQc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=a7V+9Z14Otn5nM1zGFKhJ3+V+R+06V+Dj1eTqfmijfaELCloXrEYrbbx1RDybQDZvrqelgWn66Sv18w/NlsUHfjXjuhVGZcj1m8YTlE3+OA+zO+ha4+UZzyBp03B5uoSmpysuBfpYjXPKnYABhHzcJ3Qm8AZgA0g8DtMSsKpo+k= 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=hBmctgN5; arc=none smtp.client-ip=170.10.129.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hBmctgN5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741581844; 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=Nev8trpbSnvGVyf58rmxXxAuQy7W5eOvjY/xcGE3UB8=; b=hBmctgN503UD5JwobuU4xHYpGL99V8vjdPKysJ344HE0jI0LbsbsebUrzGN4gICF9ou06c pnbOR4iDSQb+DdvPwMOw+KaY8tvEGKH+1X9HiOifmSlpOb++uVkELP0+pwevcabKpgTmdM HcBxaTXPaIFsPlI+BAKDQwQIclvSirM= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-529-ut_YfqCfOWGjBC895ZJ05w-1; Mon, 10 Mar 2025 00:44:03 -0400 X-MC-Unique: ut_YfqCfOWGjBC895ZJ05w-1 X-Mimecast-MFC-AGG-ID: ut_YfqCfOWGjBC895ZJ05w_1741581842 Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2ff8a2c7912so3178048a91.1 for ; Sun, 09 Mar 2025 21:44:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741581842; x=1742186642; 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=Nev8trpbSnvGVyf58rmxXxAuQy7W5eOvjY/xcGE3UB8=; b=ZMdWgS7aB3qBeZr5z+Rd8Ko5ACW7t3URgVffSh31NxoNEzFCHKa4Y4tnNTRK8Sillj YwvxBAAA+6zL0RyHMjlmPQhYjlmWQ6m3btECmC+YcJBEIfDl04AjqGE1oxwBEghyP2YK ZfB+ZQlDJ0fF3KcwWRfNL4d4kncIM/4TG3z4p8XvWmxs2h+Qwqhoh1UjGIdMfeEivk42 /6kTLJQdYnPMrn1d5DJRvYbanhgES3WkJ3hFiy49aVbPxhEO0t+Czmk/U1H4ipx93Zr4 1XNshLSj1CDFw/bgMp/UJf0yVbgBlVQdek7k8apCdiptIdz0bU8ZGM93Y03lrgMr+EJ6 pnVQ== X-Forwarded-Encrypted: i=1; AJvYcCXEYHi269QolngZ1Syof8EavIfD125+TVgMj00UlxoneHu43vHJ4/W/yG1ek24PL/LbJ/vW2J2A1co=@vger.kernel.org X-Gm-Message-State: AOJu0YxELrxOOgCcR1RLU38KrfQQbRSyVnB7VYS6stI5ST9zQyfl1RJA SnvpWzPe1g03qlYd3oWQfooCKj+TkZ0h5nfLn3FFbaaz8jPnUA8slPoStIu7Z2NKRUWS+BITvp1 zDEP7UYSTKQA0xckLyqoRM7vOk1rQQ/+6Dh0DiXBpIXH37guGaJZ9zhXQ+dr+VEowyABvEFlIx/ 8MunVuYv/tcwahcQLNApzA6D1IZhu3xO17 X-Gm-Gg: ASbGnct55/BMiYnpJbyNkMNvpsdh8rX1O/ZaTKPRmZsXLqGb2qSKNP3ZihFlitT71mB ueBgiXRISpOq5ecn7QBCC795l5Z4/u0RM8TJVERMUOKO+9GACL7SftGPUSv2/GwwVjUUt/eVFVw == X-Received: by 2002:a17:90b:3942:b0:2fa:17e4:b1cf with SMTP id 98e67ed59e1d1-2ffbc1478f7mr13296299a91.2.1741581841796; Sun, 09 Mar 2025 21:44:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8596SYY1uEmihx+dPY4+l8IPJzpuHXJkSLoctuIwB7FVBBOLd5nfEBl/a/ZkxNYUOiGzN8PvHZYIw/V0LgT0= X-Received: by 2002:a17:90b:3942:b0:2fa:17e4:b1cf with SMTP id 98e67ed59e1d1-2ffbc1478f7mr13296259a91.2.1741581841334; Sun, 09 Mar 2025 21:44:01 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250307-rss-v9-0-df76624025eb@daynix.com> <20250307-rss-v9-6-df76624025eb@daynix.com> In-Reply-To: <20250307-rss-v9-6-df76624025eb@daynix.com> From: Jason Wang Date: Mon, 10 Mar 2025 12:43:50 +0800 X-Gm-Features: AQ5f1JphlQ4HfYrWzbh5cl4IywdRmeziUaHOc-Ga-IvwGUrEMgYGcXCVclvp0A0 Message-ID: Subject: Re: [PATCH net-next v9 6/6] vhost/net: Support VIRTIO_NET_F_HASH_REPORT To: Akihiko Odaki Cc: Jonathan Corbet , Willem de Bruijn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Xuan Zhuo , Shuah Khan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kselftest@vger.kernel.org, Yuri Benditovich , Andrew Melnychenko , Stephen Hemminger , gur.stavi@huawei.com, Lei Yang , Simon Horman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 7, 2025 at 7:02=E2=80=AFPM Akihiko Odaki wrote: > > VIRTIO_NET_F_HASH_REPORT allows to report hash values calculated on the > host. When VHOST_NET_F_VIRTIO_NET_HDR is employed, it will report no > hash values (i.e., the hash_report member is always set to > VIRTIO_NET_HASH_REPORT_NONE). Otherwise, the values reported by the > underlying socket will be reported. > > VIRTIO_NET_F_HASH_REPORT requires VIRTIO_F_VERSION_1. > > Signed-off-by: Akihiko Odaki > Tested-by: Lei Yang > --- > drivers/vhost/net.c | 49 +++++++++++++++++++++++++++++------------------= -- > 1 file changed, 29 insertions(+), 20 deletions(-) > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index b9b9e9d40951856d881d77ac74331d914473cd56..16b241b44f89820a42c302f35= 86ea6bb5e0d4289 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -73,6 +73,7 @@ enum { > VHOST_NET_FEATURES =3D VHOST_FEATURES | > (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) | > (1ULL << VIRTIO_NET_F_MRG_RXBUF) | > + (1ULL << VIRTIO_NET_F_HASH_REPORT) | > (1ULL << VIRTIO_F_ACCESS_PLATFORM) | > (1ULL << VIRTIO_F_RING_RESET) > }; > @@ -1097,9 +1098,11 @@ static void handle_rx(struct vhost_net *net) > .msg_controllen =3D 0, > .msg_flags =3D MSG_DONTWAIT, > }; > - struct virtio_net_hdr hdr =3D { > - .flags =3D 0, > - .gso_type =3D VIRTIO_NET_HDR_GSO_NONE > + struct virtio_net_hdr_v1_hash hdr =3D { > + .hdr =3D { > + .flags =3D 0, > + .gso_type =3D VIRTIO_NET_HDR_GSO_NONE > + } > }; > size_t total_len =3D 0; > int err, mergeable; > @@ -1110,7 +1113,6 @@ static void handle_rx(struct vhost_net *net) > bool set_num_buffers; > struct socket *sock; > struct iov_iter fixup; > - __virtio16 num_buffers; > int recv_pkts =3D 0; > > mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_RX); > @@ -1191,30 +1193,30 @@ static void handle_rx(struct vhost_net *net) > vhost_discard_vq_desc(vq, headcount); > continue; > } > + hdr.hdr.num_buffers =3D cpu_to_vhost16(vq, headcount); > /* Supply virtio_net_hdr if VHOST_NET_F_VIRTIO_NET_HDR */ > if (unlikely(vhost_hlen)) { > - if (copy_to_iter(&hdr, sizeof(hdr), > - &fixup) !=3D sizeof(hdr)) { > + if (copy_to_iter(&hdr, vhost_hlen, > + &fixup) !=3D vhost_hlen) { > vq_err(vq, "Unable to write vnet_hdr " > "at addr %p\n", vq->iov->iov_base)= ; > goto out; Is this an "issue" specific to RSS/HASH? If it's not, we need a separate pa= tch. Honestly, I'm not sure if it's too late to fix this. Others look fine. Thanks