From: Kuniyuki Iwashima <kuniyu@google.com>
To: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@google.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: [PATCH v1 net-next 03/15] udp_tunnel: Pass struct sock to udp_tunnel6_dst_lookup().
Date: Sat, 2 May 2026 03:12:56 +0000 [thread overview]
Message-ID: <20260502031401.3557229-4-kuniyu@google.com> (raw)
In-Reply-To: <20260502031401.3557229-1-kuniyu@google.com>
None of the udp_tunnel users need struct socket in their
fast paths; it is only used for tunnel setup / teardown.
Even udp_tunnel6_dst_lookup() does not need struct socket.
Let's change udp_tunnel6_dst_lookup() to take struct sock
instead of struct socket.
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
drivers/net/bareudp.c | 4 ++--
drivers/net/geneve.c | 4 ++--
drivers/net/vxlan/vxlan_core.c | 4 ++--
include/net/udp_tunnel.h | 2 +-
net/ipv6/ip6_udp_tunnel.c | 6 +++---
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index 169ab90393cc..073ac8a15354 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -396,7 +396,7 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
sport = udp_flow_src_port(bareudp->net, skb,
bareudp->sport_min, USHRT_MAX,
true);
- dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock, 0, &saddr,
+ dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock->sk, 0, &saddr,
key, sport, bareudp->port, key->tos,
use_cache ?
(struct dst_cache *) &info->dst_cache : NULL);
@@ -532,7 +532,7 @@ static int bareudp_fill_metadata_dst(struct net_device *dev,
if (!sock)
return -ESHUTDOWN;
- dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock,
+ dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock->sk,
0, &saddr, &info->key,
sport, bareudp->port, info->key.tos,
use_cache ? &info->dst_cache : NULL);
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index c3a7736cd6fc..4b7081b97015 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1424,7 +1424,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
geneve->cfg.port_min,
geneve->cfg.port_max, true);
- dst = udp_tunnel6_dst_lookup(skb, dev, geneve->net, gs6->sock, 0,
+ dst = udp_tunnel6_dst_lookup(skb, dev, geneve->net, gs6->sock->sk, 0,
&saddr, key, sport,
geneve->cfg.info.key.tp_dst, prio,
use_cache ?
@@ -1592,7 +1592,7 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
geneve->cfg.port_min,
geneve->cfg.port_max, true);
- dst = udp_tunnel6_dst_lookup(skb, dev, geneve->net, gs6->sock, 0,
+ dst = udp_tunnel6_dst_lookup(skb, dev, geneve->net, gs6->sock->sk, 0,
&saddr, &info->key, sport,
geneve->cfg.info.key.tp_dst, prio,
use_cache ? &info->dst_cache : NULL);
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 394801c068b3..a19f951e05f1 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -2559,7 +2559,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
if (!ifindex)
ifindex = sock6->sock->sk->sk_bound_dev_if;
- ndst = udp_tunnel6_dst_lookup(skb, dev, vxlan->net, sock6->sock,
+ ndst = udp_tunnel6_dst_lookup(skb, dev, vxlan->net, sock6->sock->sk,
ifindex, &saddr, pkey,
src_port, dst_port, tos,
use_cache ? dst_cache : NULL);
@@ -3254,7 +3254,7 @@ static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
if (!sock6)
return -EIO;
- ndst = udp_tunnel6_dst_lookup(skb, dev, vxlan->net, sock6->sock,
+ ndst = udp_tunnel6_dst_lookup(skb, dev, vxlan->net, sock6->sock->sk,
0, &info->key.u.ipv6.src,
&info->key,
sport, dport, info->key.tos,
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
index 49324e28ec27..14a9c5155608 100644
--- a/include/net/udp_tunnel.h
+++ b/include/net/udp_tunnel.h
@@ -188,7 +188,7 @@ struct rtable *udp_tunnel_dst_lookup(struct sk_buff *skb,
struct dst_entry *udp_tunnel6_dst_lookup(struct sk_buff *skb,
struct net_device *dev,
struct net *net,
- struct socket *sock, int oif,
+ struct sock *sk, int oif,
struct in6_addr *saddr,
const struct ip_tunnel_key *key,
__be16 sport, __be16 dport, u8 dsfield,
diff --git a/net/ipv6/ip6_udp_tunnel.c b/net/ipv6/ip6_udp_tunnel.c
index 405ef1cb8864..9adb5775487f 100644
--- a/net/ipv6/ip6_udp_tunnel.c
+++ b/net/ipv6/ip6_udp_tunnel.c
@@ -118,7 +118,7 @@ EXPORT_SYMBOL_GPL(udp_tunnel6_xmit_skb);
* @skb: Packet for which lookup is done
* @dev: Tunnel device
* @net: Network namespace of tunnel device
- * @sock: Socket which provides route info
+ * @sk: Socket which provides route info
* @oif: Index of the output interface
* @saddr: Memory to store the src ip address
* @key: Tunnel information
@@ -135,7 +135,7 @@ EXPORT_SYMBOL_GPL(udp_tunnel6_xmit_skb);
struct dst_entry *udp_tunnel6_dst_lookup(struct sk_buff *skb,
struct net_device *dev,
struct net *net,
- struct socket *sock,
+ struct sock *sk,
int oif,
struct in6_addr *saddr,
const struct ip_tunnel_key *key,
@@ -162,7 +162,7 @@ struct dst_entry *udp_tunnel6_dst_lookup(struct sk_buff *skb,
fl6.fl6_dport = dport;
fl6.flowlabel = ip6_make_flowinfo(dsfield, key->label);
- dst = ip6_dst_lookup_flow(net, sock->sk, &fl6, NULL);
+ dst = ip6_dst_lookup_flow(net, sk, &fl6, NULL);
if (IS_ERR(dst)) {
netdev_dbg(dev, "no route to %pI6\n", &fl6.daddr);
return ERR_PTR(-ENETUNREACH);
--
2.54.0.545.g6539524ca2-goog
next prev parent reply other threads:[~2026-05-02 3:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-02 3:12 [PATCH v1 net-next 00/15] udp_tunnel: Speed up UDP tunnel device destruction (Part I) Kuniyuki Iwashima
2026-05-02 3:12 ` [PATCH v1 net-next 01/15] udp_tunnel: Pass struct sock to udp_tunnel_sock_release() Kuniyuki Iwashima
2026-05-03 18:43 ` Kuniyuki Iwashima
2026-05-02 3:12 ` [PATCH v1 net-next 02/15] udp_tunnel: Pass struct sock to setup_udp_tunnel_sock() Kuniyuki Iwashima
2026-05-02 3:12 ` Kuniyuki Iwashima [this message]
2026-05-02 3:12 ` [PATCH v1 net-next 04/15] udp_tunnel: Pass struct sock to udp_tunnel_{push,drop}_rx_port() Kuniyuki Iwashima
2026-05-02 3:12 ` [PATCH v1 net-next 05/15] udp_tunnel: Pass struct sock to udp_tunnel_notify_{add,del}_rx_port() Kuniyuki Iwashima
2026-05-02 3:12 ` [PATCH v1 net-next 06/15] vxlan: Fix potential null-ptr-deref in vxlan_gro_prepare_receive() Kuniyuki Iwashima
2026-05-02 3:13 ` [PATCH v1 net-next 07/15] vxlan: Store struct sock in struct vxlan_sock Kuniyuki Iwashima
2026-05-02 3:13 ` [PATCH v1 net-next 08/15] vxlan: Free vxlan_sock with kfree_rcu() Kuniyuki Iwashima
2026-05-02 3:13 ` [PATCH v1 net-next 09/15] geneve: Store struct sock in struct geneve_sock Kuniyuki Iwashima
2026-05-02 3:13 ` [PATCH v1 net-next 10/15] bareudp: Store struct sock in struct bareudp_dev Kuniyuki Iwashima
2026-05-03 18:47 ` Kuniyuki Iwashima
2026-05-02 3:13 ` [PATCH v1 net-next 11/15] fou: Store struct sock in struct fou Kuniyuki Iwashima
2026-05-03 18:52 ` Kuniyuki Iwashima
2026-05-02 3:13 ` [PATCH v1 net-next 12/15] amt: Store struct sock in struct amt_dev Kuniyuki Iwashima
2026-05-03 18:55 ` Kuniyuki Iwashima
2026-05-02 3:13 ` [PATCH v1 net-next 13/15] pfcp: Store struct sock in struct pfcp_dev Kuniyuki Iwashima
2026-05-03 19:00 ` Kuniyuki Iwashima
2026-05-02 3:13 ` [PATCH v1 net-next 14/15] tipc: Store struct sock in struct udp_bearer Kuniyuki Iwashima
2026-05-03 19:05 ` Kuniyuki Iwashima
2026-05-02 3:13 ` [PATCH v1 net-next 15/15] udp_tunnel: Remove synchronize_rcu() in udp_tunnel_sock_release() Kuniyuki Iwashima
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260502031401.3557229-4-kuniyu@google.com \
--to=kuniyu@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox