netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Jason Wang <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	linux-kselftest@vger.kernel.org, bpf@vger.kernel.org,
	davem@davemloft.net, kuba@kernel.org, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com,
	songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com,
	kpsingh@kernel.org, rdunlap@infradead.org, willemb@google.com,
	gustavoars@kernel.org, herbert@gondor.apana.org.au,
	steffen.klassert@secunet.com, nogikh@google.com,
	pablo@netfilter.org, decui@microsoft.com, cai@lca.pw,
	jakub@cloudflare.com, elver@google.com, pabeni@redhat.com,
	Yuri Benditovich <yuri.benditovich@daynix.com>
Subject: Re: [RFC PATCH 1/7] net: skbuff: Add tun_vnet_hash flag
Date: Mon, 9 Oct 2023 04:52:56 +0900	[thread overview]
Message-ID: <4f2ce89f-a018-4a43-97b6-e9d43020e158@daynix.com> (raw)
In-Reply-To: <CAF=yD-K0RR5XCuPdHS8gPwppM-HAmodSOVBpS=v+j8X7=Su2Rg@mail.gmail.com>

On 2023/10/09 3:39, Willem de Bruijn wrote:
> On Sun, Oct 8, 2023 at 7:22 AM Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>>
>> tun_vnet_hash can use this flag to indicate it stored virtio-net hash
>> cache to cb.
>>
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>>   include/linux/skbuff.h | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>> index 4174c4b82d13..e638f157c13c 100644
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -837,6 +837,7 @@ typedef unsigned char *sk_buff_data_t;
>>    *     @truesize: Buffer size
>>    *     @users: User count - see {datagram,tcp}.c
>>    *     @extensions: allocated extensions, valid if active_extensions is nonzero
>> + *     @tun_vnet_hash: tun stored virtio-net hash cache to cb
>>    */
>>
>>   struct sk_buff {
>> @@ -989,6 +990,7 @@ struct sk_buff {
>>   #if IS_ENABLED(CONFIG_IP_SCTP)
>>          __u8                    csum_not_inet:1;
>>   #endif
>> +       __u8                    tun_vnet_hash:1;
> 
> sk_buff space is very limited.
> 
> No need to extend it, especially for code that stays within a single
> subsystem (tun).
> 
> To a lesser extent the same point applies to the qdisc_skb_cb.

I had to extend sk_buff because it does not stay in tun but moves back 
and forth between qdisc and tun.

The new members of sk_buff and qdisc_skb_cb are stored by tun's 
ndo_select_queue(). The control will go back to qdisc after 
ndo_select_queue() function finishes. Eventually tun's ndo_start_xmit() 
will be called by qdisc and consumes the stored members. qdisc is 
required to keep the stored members intact.

tun_vnet_hash is a bit special. It is put into sk_buff because 
ndo_select_queue() is not always called and it may be left 
uninitialized. ndo_start_xmit() may read some garbage from cb's old user 
if it is put into cb.

  reply	other threads:[~2023-10-08 19:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-08  5:20 [RFC PATCH 0/7] tun: Introduce virtio-net hashing feature Akihiko Odaki
2023-10-08  5:20 ` [RFC PATCH 1/7] net: skbuff: Add tun_vnet_hash flag Akihiko Odaki
2023-10-08 18:39   ` Willem de Bruijn
2023-10-08 19:52     ` Akihiko Odaki [this message]
2023-10-08  5:20 ` [RFC PATCH 2/7] net/core: Ensure qdisc_skb_cb will not be overwritten Akihiko Odaki
2023-10-08  5:20 ` [RFC PATCH 3/7] net: sched: Add members to qdisc_skb_cb Akihiko Odaki
2023-10-08  5:20 ` [RFC PATCH 4/7] virtio_net: Add functions for hashing Akihiko Odaki
2023-10-08  5:20 ` [RFC PATCH 5/7] tun: Introduce virtio-net hashing feature Akihiko Odaki
2023-10-08 19:07   ` Willem de Bruijn
2023-10-08 20:04     ` Akihiko Odaki
2023-10-08 20:08       ` Willem de Bruijn
2023-10-08 20:46         ` Akihiko Odaki
2023-10-09  8:04           ` Willem de Bruijn
2023-10-09  8:57             ` Akihiko Odaki
2023-10-09  9:57               ` Willem de Bruijn
2023-10-09 10:01                 ` Akihiko Odaki
2023-10-09 10:06                   ` Willem de Bruijn
2023-10-09 10:12                     ` Akihiko Odaki
2023-10-09 10:44                       ` Willem de Bruijn
2023-10-10  1:52                         ` Akihiko Odaki
2023-10-10  5:45                           ` Jason Wang
2023-10-10  5:51                             ` Akihiko Odaki
2023-10-10  6:00                               ` Jason Wang
2023-10-10  6:19                                 ` Akihiko Odaki
2023-10-11  3:18                                   ` Jason Wang
2023-10-11  3:57                                     ` Akihiko Odaki
2023-10-09  8:13   ` Willem de Bruijn
2023-10-09  8:44     ` Akihiko Odaki
2023-10-09  9:54       ` Willem de Bruijn
2023-10-09 10:05         ` Akihiko Odaki
2023-10-09 10:07           ` Willem de Bruijn
2023-10-09 10:11             ` Akihiko Odaki
2023-10-09 10:32               ` Willem de Bruijn
2023-10-09 11:50       ` Michael S. Tsirkin
2023-10-10  2:34         ` Akihiko Odaki
2023-10-09 11:38   ` Michael S. Tsirkin
2023-10-10  2:32     ` Akihiko Odaki
2023-10-08  5:20 ` [RFC PATCH 6/7] selftest: tun: Add tests for virtio-net hashing Akihiko Odaki
2023-10-20  1:52   ` kernel test robot
2023-10-08  5:20 ` [RFC PATCH 7/7] vhost_net: Support VIRTIO_NET_F_HASH_REPORT Akihiko Odaki
2023-10-08 18:36 ` [RFC PATCH 0/7] tun: Introduce virtio-net hashing feature Willem de Bruijn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f2ce89f-a018-4a43-97b6-e9d43020e158@daynix.com \
    --to=akihiko.odaki@daynix.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cai@lca.pw \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=elver@google.com \
    --cc=gustavoars@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jakub@cloudflare.com \
    --cc=jasowang@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nogikh@google.com \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=rdunlap@infradead.org \
    --cc=songliubraving@fb.com \
    --cc=steffen.klassert@secunet.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yhs@fb.com \
    --cc=yuri.benditovich@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).