[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ec28c852-e80a-41c9-94ce-a0fce8ee07e7@redhat.com>
Date: Thu, 8 Jan 2026 16:52:31 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Xin Long <lucien.xin@...il.com>, network dev <netdev@...r.kernel.org>,
quic@...ts.linux.dev
Cc: 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 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
> +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?
/P
Powered by blists - more mailing lists