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 C1D1F175D53 for ; Mon, 10 Mar 2025 04:01:15 +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=1741579277; cv=none; b=tSMo57Vi0kJrS0Dkxtim1jrN7NStVByYPafgP3bvL89d/Dyj+GNGW4Rv2yuUqaGluXUDqsp4bhczHAzs7Agq54D2YRhgB/2Ws32jcNvN543HpsAePx4Oa5d+8rR8cBeJuU5aL0zVr7jiOghpSuhiOiYIA8hQ3WfCDOhN/OxH3eU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741579277; c=relaxed/simple; bh=y2jgmxgCkCS0866p0uhw4Z/wKL7ZAlvCJDAr0KB4Wp8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=qXOHDthuChqT2L9tbVLgC6/3KcLEkReqa4v59UquG6EiEnYbkNS6jZfLPxMkWdwbbRYGRvPAw+Yw6GhH4j02HwdMF0VtQitlNV7eWOFQ1KPK4DqrOpyRbBJ9UAIx0cgB6xWywpCaY9ErknOrx/WOt/cWQSldQ8Gii+hZR6CoRf8= 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=TqFPCmp6; 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="TqFPCmp6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741579274; 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=baDSD60KKAXA2YV4cwTHazyMng6zqZ9j6/BH6ENwQIo=; b=TqFPCmp6FldnTqNHM9ffUXFPQbuMHMY+8uF5yS4iUpfs1qGhIFxWR2DWxPevrGMRgjWfuy fW9doVJlPPFzhPvMq/3s14KwPYPw4x//GlcMa6sIPw8rQvlT0B8r2I5IdMQZ5i+i5yN4uO gDt5RGpKIqfwCQId4tnYJfed5FyuRrc= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-119-ZKxbPzBEMk-3a9rfy1Aszg-1; Mon, 10 Mar 2025 00:01:12 -0400 X-MC-Unique: ZKxbPzBEMk-3a9rfy1Aszg-1 X-Mimecast-MFC-AGG-ID: ZKxbPzBEMk-3a9rfy1Aszg_1741579271 Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2ff8c5d185aso5953821a91.1 for ; Sun, 09 Mar 2025 21:01:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741579271; x=1742184071; 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=baDSD60KKAXA2YV4cwTHazyMng6zqZ9j6/BH6ENwQIo=; b=QTW3uLSfkrcuO0Daa7oD5igeH5VPZqb1wjPcFZ5SuFwrBILdt01I7oqkdBQLo6+GGo RyZz48q2whlTF1g1KfnkOiHNXIp/fC65FtqmfeaZxv4tm4tC1tpNnpDIz8PmFbt6Q9VS PlE9hxhkrLmBxRvOLdiOH87UisSJhBeaZeUS6x8Ne+Ff1UnhyQTjv4Z+/5+OHFO/Y4Cc oXxK6o2ruq+LB+uET5YZKMYNvOTaRdB8ks8I73vXr3wJGlUbcZN5PbLe4WRRLN1PYSGk +tywy9N0h5GSpx7b4+rM7KO86M/y17gsFeuUkKzOO9rQspGqrdHSweFJGsLIMuL4gwwa daSg== X-Forwarded-Encrypted: i=1; AJvYcCWP0Om4WIQOcNpdrB9pP4MZRW6zegaD/LnRSwcDugM7WpXxFYEdWNJzpNOTZI4wZLZjy9/nJTU=@vger.kernel.org X-Gm-Message-State: AOJu0YwJk7shz9nSTnsualFN5sy/jcRpanfHRrzcO9dVocN8strHji/6 QNm+hi07CPVLqiA6RQdz9OS0R3gVLGaWm9wSyVOOjwzNrwXMF0DbfiSfEznXIDGtmtQ9jHmM26T +Ue4NrsicpMxBJJxWKZ7h7NXonAS/hHTNlkZqv2TmRro0zP5zhgZOMR5SliDk3Thdk13P+8ZusN cwRgv/sE9MpWsm70yfbBt2YMCTMbEU X-Gm-Gg: ASbGncsiSLhF65eMF3dDhK5gLEWdEOfcoHaCT7OaU2+NAm7B0XPPiC9LCKwsFaX7ndg UY1eRFgJP3UdJ7tJbhQmLZRd3+pgClhE075FyRdxx25Fk+AOWD1DcuRjuSUKUT0iQapxqJvjhfw == X-Received: by 2002:a17:90b:1b0b:b0:2fc:c262:ef4b with SMTP id 98e67ed59e1d1-2ff7cea9a99mr22401411a91.18.1741579271530; Sun, 09 Mar 2025 21:01:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9DOsUxA9Z0UU+zFKp4XwB12kvLD6PT8eYjbCh1DLy1GK1oX1uE/LbhxDyNJ0rRDiXuxTT1vCPASJg6+fMr/4= X-Received: by 2002:a17:90b:1b0b:b0:2fc:c262:ef4b with SMTP id 98e67ed59e1d1-2ff7cea9a99mr22401364a91.18.1741579271097; Sun, 09 Mar 2025 21:01:11 -0700 (PDT) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250307-rss-v9-0-df76624025eb@daynix.com> <20250307-rss-v9-3-df76624025eb@daynix.com> In-Reply-To: From: Jason Wang Date: Mon, 10 Mar 2025 12:01:00 +0800 X-Gm-Features: AQ5f1JpaV-Y2lOTdTlLng-Bakedv0t_hz074LEAN3YdWqqKw7pRKMp2RrCa8b3E Message-ID: Subject: Re: [PATCH net-next v9 3/6] tun: Introduce virtio-net hash feature 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 Mon, Mar 10, 2025 at 11:55=E2=80=AFAM Jason Wang w= rote: > > On Fri, Mar 7, 2025 at 7:01=E2=80=AFPM Akihiko Odaki wrote: > > > > Hash reporting > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > Allow the guest to reuse the hash value to make receive steering > > consistent between the host and guest, and to save hash computation. > > > > RSS > > =3D=3D=3D > > > > RSS is a receive steering algorithm that can be negotiated to use with > > virtio_net. Conventionally the hash calculation was done by the VMM. > > However, computing the hash after the queue was chosen defeats the > > purpose of RSS. > > > > Another approach is to use eBPF steering program. This approach has > > another downside: it cannot report the calculated hash due to the > > restrictive nature of eBPF steering program. > > > > Introduce the code to perform RSS to the kernel in order to overcome > > thse challenges. An alternative solution is to extend the eBPF steering > > program so that it will be able to report to the userspace, but I didn'= t > > opt for it because extending the current mechanism of eBPF steering > > program as is because it relies on legacy context rewriting, and > > introducing kfunc-based eBPF will result in non-UAPI dependency while > > the other relevant virtualization APIs such as KVM and vhost_net are > > UAPIs. > > > > Signed-off-by: Akihiko Odaki > > Tested-by: Lei Yang > > --- > > Documentation/networking/tuntap.rst | 7 ++ > > drivers/net/Kconfig | 1 + > > drivers/net/tap.c | 68 ++++++++++++++- > > drivers/net/tun.c | 98 +++++++++++++++++----- > > drivers/net/tun_vnet.h | 159 ++++++++++++++++++++++++++++= ++++++-- > > include/linux/if_tap.h | 2 + > > include/linux/skbuff.h | 3 + > > include/uapi/linux/if_tun.h | 75 +++++++++++++++++ > > net/core/skbuff.c | 4 + > > 9 files changed, 386 insertions(+), 31 deletions(-) [...] > > + * > > + * The %TUN_VNET_HASH_REPORT flag set with this ioctl will be effectiv= e only > > + * after calling the %TUNSETVNETHDRSZ ioctl with a number greater than= or equal > > + * to the size of &struct virtio_net_hdr_v1_hash. > > So you had a dependency check already for vnet hdr len. I'd still > suggest to split this into rss and hash as they are separated > features. Then we can use separate data structure for them instead of > a container struct. > Besides this, I think we still need to add new bits to TUNGETIFF to let userspace know about the new ability. Thanks