mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
udp_tunnel: Pass struct sock to udp_tunnel_notify_{add,del}_rx_port().
None of the udp_tunnel users need struct socket in their
fast paths; it is only used for tunnel setup / teardown.
Even udp_tunnel_notify_{add,del}_rx_port() do not need
struct socket.
Let's change udp_tunnel_notify_{add,del}_rx_port() to take
struct sock instead of struct socket.
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260502031401.3557229-6-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
8d0012ce1b
commit
af3f903fbb
|
|
@ -995,7 +995,7 @@ static struct geneve_sock *geneve_socket_create(struct net *net, __be16 port,
|
|||
INIT_HLIST_HEAD(&gs->vni_list[h]);
|
||||
|
||||
/* Initialize the geneve udp offloads structure */
|
||||
udp_tunnel_notify_add_rx_port(gs->sock, UDP_TUNNEL_TYPE_GENEVE);
|
||||
udp_tunnel_notify_add_rx_port(gs->sock->sk, UDP_TUNNEL_TYPE_GENEVE);
|
||||
|
||||
/* Mark socket as an encapsulation socket */
|
||||
memset(&tunnel_cfg, 0, sizeof(tunnel_cfg));
|
||||
|
|
@ -1017,7 +1017,7 @@ static void __geneve_sock_release(struct geneve_sock *gs)
|
|||
return;
|
||||
|
||||
list_del(&gs->list);
|
||||
udp_tunnel_notify_del_rx_port(gs->sock, UDP_TUNNEL_TYPE_GENEVE);
|
||||
udp_tunnel_notify_del_rx_port(gs->sock->sk, UDP_TUNNEL_TYPE_GENEVE);
|
||||
udp_tunnel_sock_release(gs->sock->sk);
|
||||
kfree_rcu(gs, rcu);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1493,7 +1493,7 @@ static bool __vxlan_sock_release_prep(struct vxlan_sock *vs)
|
|||
return false;
|
||||
|
||||
hlist_del_rcu(&vs->hlist);
|
||||
udp_tunnel_notify_del_rx_port(vs->sock,
|
||||
udp_tunnel_notify_del_rx_port(vs->sock->sk,
|
||||
(vs->flags & VXLAN_F_GPE) ?
|
||||
UDP_TUNNEL_TYPE_VXLAN_GPE :
|
||||
UDP_TUNNEL_TYPE_VXLAN);
|
||||
|
|
@ -3600,7 +3600,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6,
|
|||
vs->flags = (flags & VXLAN_F_RCV_FLAGS);
|
||||
|
||||
hlist_add_head_rcu(&vs->hlist, vs_head(net, port));
|
||||
udp_tunnel_notify_add_rx_port(sock,
|
||||
udp_tunnel_notify_add_rx_port(sock->sk,
|
||||
(vs->flags & VXLAN_F_GPE) ?
|
||||
UDP_TUNNEL_TYPE_VXLAN_GPE :
|
||||
UDP_TUNNEL_TYPE_VXLAN);
|
||||
|
|
|
|||
|
|
@ -131,8 +131,8 @@ void udp_tunnel_push_rx_port(struct net_device *dev, struct sock *sk,
|
|||
unsigned short type);
|
||||
void udp_tunnel_drop_rx_port(struct net_device *dev, struct sock *sk,
|
||||
unsigned short type);
|
||||
void udp_tunnel_notify_add_rx_port(struct socket *sock, unsigned short type);
|
||||
void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type);
|
||||
void udp_tunnel_notify_add_rx_port(struct sock *sk, unsigned short type);
|
||||
void udp_tunnel_notify_del_rx_port(struct sock *sk, unsigned short type);
|
||||
|
||||
/* Transmit the skb using UDP encapsulation. */
|
||||
void udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb,
|
||||
|
|
|
|||
|
|
@ -124,9 +124,8 @@ void udp_tunnel_drop_rx_port(struct net_device *dev, struct sock *sk,
|
|||
EXPORT_SYMBOL_GPL(udp_tunnel_drop_rx_port);
|
||||
|
||||
/* Notify netdevs that UDP port started listening */
|
||||
void udp_tunnel_notify_add_rx_port(struct socket *sock, unsigned short type)
|
||||
void udp_tunnel_notify_add_rx_port(struct sock *sk, unsigned short type)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct net *net = sock_net(sk);
|
||||
struct udp_tunnel_info ti;
|
||||
struct net_device *dev;
|
||||
|
|
@ -146,9 +145,8 @@ void udp_tunnel_notify_add_rx_port(struct socket *sock, unsigned short type)
|
|||
EXPORT_SYMBOL_GPL(udp_tunnel_notify_add_rx_port);
|
||||
|
||||
/* Notify netdevs that UDP port is no more listening */
|
||||
void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type)
|
||||
void udp_tunnel_notify_del_rx_port(struct sock *sk, unsigned short type)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct net *net = sock_net(sk);
|
||||
struct udp_tunnel_info ti;
|
||||
struct net_device *dev;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user