[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADvbK_eLTAQkFPNF58fBRqeZzRycBX0EeNk-P=HPc+Z-__JU9g@mail.gmail.com>
Date: Sat, 23 Aug 2025 11:40:52 -0400
From: Xin Long <lucien.xin@...il.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: network dev <netdev@...r.kernel.org>, 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>, 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>,
Benjamin Coddington <bcodding@...hat.com>, Steve Dickson <steved@...hat.com>, Hannes Reinecke <hare@...e.de>,
Alexander Aring <aahringo@...hat.com>, David Howells <dhowells@...hat.com>,
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 v2 08/15] quic: add path management
On Thu, Aug 21, 2025 at 10:18 AM Paolo Abeni <pabeni@...hat.com> wrote:
>
> On 8/18/25 4:04 PM, Xin Long wrote:
> > +/* Lookup a quic_udp_sock in the global hash table. If not found, creates and returns a new one
> > + * associated with the given kernel socket.
> > + */
> > +static struct quic_udp_sock *quic_udp_sock_lookup(struct sock *sk, union quic_addr *a, u16 port)
> > +{
> > + struct net *net = sock_net(sk);
> > + struct quic_hash_head *head;
> > + struct quic_udp_sock *us;
> > +
> > + head = quic_udp_sock_head(net, port);
> > + hlist_for_each_entry(us, &head->head, node) {
> > + if (net != sock_net(us->sk))
> > + continue;
> > + if (a) {
> > + if (quic_cmp_sk_addr(us->sk, &us->addr, a) &&
> > + (!us->bind_ifindex || !sk->sk_bound_dev_if ||
> > + us->bind_ifindex == sk->sk_bound_dev_if))
> > + return us;
> > + continue;
> > + }
> > + if (ntohs(us->addr.v4.sin_port) == port)
> > + return us;
> > + }
> > + return NULL;
> > +}
>
> The function description does not match the actual function implementation.
Right, I forgot to update the description after moving the creation out.
>
> > +
> > +/* Binds a QUIC path to a local port and sets up a UDP socket. */
> > +int quic_path_bind(struct sock *sk, struct quic_path_group *paths, u8 path)
> > +{
> > + union quic_addr *a = quic_path_saddr(paths, path);
> > + int rover, low, high, remaining;
> > + struct net *net = sock_net(sk);
> > + struct quic_hash_head *head;
> > + struct quic_udp_sock *us;
> > + u16 port;
> > +
> > + port = ntohs(a->v4.sin_port);
> > + if (port) {
> > + head = quic_udp_sock_head(net, port);
> > + mutex_lock(&head->m_lock);
> > + us = quic_udp_sock_lookup(sk, a, port);
> > + if (!quic_udp_sock_get(us)) {
> > + us = quic_udp_sock_create(sk, a);
> > + if (!us) {
> > + mutex_unlock(&head->m_lock);
> > + return -EINVAL;
> > + }
> > + }
> > + mutex_unlock(&head->m_lock);
> > +
> > + quic_udp_sock_put(paths->path[path].udp_sk);
> > + paths->path[path].udp_sk = us;
> > + return 0;
> > + }
> > +
> > + inet_get_local_port_range(net, &low, &high);
>
> you could/should use inet_sk_get_local_port_range().
>
True, will update.
Thanks.
Powered by blists - more mailing lists