[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADvbK_dKYZ6_NyxcsweKRPkFEq046+1RENA7vH9hBhG-6xNxxw@mail.gmail.com>
Date: Thu, 8 Jan 2026 13:07:42 -0500
From: Xin Long <lucien.xin@...il.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: network dev <netdev@...r.kernel.org>, quic@...ts.linux.dev, davem@...emloft.net,
kuba@...nel.org, Eric Dumazet <edumazet@...gle.com>, Simon Horman <horms@...nel.org>,
Stefan Metzmacher <metze@...ba.org>, Moritz Buhl <mbuhl@...nbsd.org>, Tyler Fanelli <tfanelli@...hat.com>,
Pengtao He <hepengtao@...omi.com>, Thomas Dreibholz <dreibh@...ula.no>, linux-cifs@...r.kernel.org,
Steve French <smfrench@...il.com>, Namjae Jeon <linkinjeon@...nel.org>,
Paulo Alcantara <pc@...guebit.com>, Tom Talpey <tom@...pey.com>, kernel-tls-handshake@...ts.linux.dev,
Chuck Lever <chuck.lever@...cle.com>, Jeff Layton <jlayton@...nel.org>,
Steve Dickson <steved@...hat.com>, Hannes Reinecke <hare@...e.de>, Alexander Aring <aahringo@...hat.com>,
David Howells <dhowells@...hat.com>, Matthieu Baerts <matttbe@...nel.org>,
John Ericson <mail@...nericson.me>, Cong Wang <xiyou.wangcong@...il.com>,
"D . Wythe" <alibuda@...ux.alibaba.com>, Jason Baron <jbaron@...mai.com>,
illiliti <illiliti@...tonmail.com>, Sabrina Dubroca <sd@...asysnail.net>,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>, Daniel Stenberg <daniel@...x.se>,
Andy Gospodarek <andrew.gospodarek@...adcom.com>
Subject: Re: [PATCH net-next v6 07/16] quic: add connection id management
On Thu, Jan 8, 2026 at 10:52 AM Paolo Abeni <pabeni@...hat.com> wrote:
>
> On 1/5/26 3:04 PM, Xin Long wrote:
> > +/* Remove connection IDs from the set with sequence numbers less than or equal to a number. */
> > +void quic_conn_id_remove(struct quic_conn_id_set *id_set, u32 number)
> > +{
> > + struct quic_common_conn_id *common, *tmp;
> > + struct list_head *list;
> > +
> > + list = &id_set->head;
> > + list_for_each_entry_safe(common, tmp, list, list) {
> > + if (common->number <= number) {
> > + if (id_set->active == common)
> > + id_set->active = tmp;
> > + quic_conn_id_del(common);
> > + id_set->count--;
> > + }
>
> Since the list is sorted by number you could break the loop as soon as
> common->number > number.
>
> > + }
> > +}
> > +
> > +struct quic_conn_id *quic_conn_id_find(struct quic_conn_id_set *id_set, u32 number)
> > +{
> > + struct quic_common_conn_id *common;
> > +
> > + list_for_each_entry(common, &id_set->head, list)
> > + if (common->number == number)
> > + return &common->id;
>
> Same here, you can break the loop when common->number > number
>
Yup, this will save some rounds.
>
> > +static inline u32 quic_conn_id_first_number(struct quic_conn_id_set *id_set)
> > +{
> > + struct quic_common_conn_id *common;
> > +
> > + common = list_first_entry(&id_set->head, struct quic_common_conn_id, list);
>
> id_set can be empty at creation time. The above assumes it contains at
> least an element. Does the caller need to check for such condition?
> Possibly moving the check here would simplify the code?
>
quic_conn_id_first_number() is always called in the socket that is not
in CLOSE state,
and there must be at least one ID in the id_set in such states. I will
leave a comment
in this function if you're okay with it.
Thanks.
Powered by blists - more mailing lists