Thread (32 messages) 32 messages, 4 authors, 2026-01-08

Re: [PATCH net-next v6 07/16] quic: add connection id management

From: Xin Long <lucien.xin@gmail.com>
Date: 2026-01-08 18:07:54
Also in: linux-cifs

On Thu, Jan 8, 2026 at 10:52 AM Paolo Abeni [off-list ref] wrote:
On 1/5/26 3:04 PM, Xin Long wrote:
quoted
+/* 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.
quoted
+     }
+}
+
+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.
quoted
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help