summaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp_tunnel_core.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-01-06 13:06:37 -0800
committerJakub Kicinski <kuba@kernel.org>2021-01-07 12:53:29 -0800
commitb9ef3fecd1403fc1c2dd146e67b366691394b80f (patch)
treec051eea4572b565e57efb775a26f51ecc14cc007 /net/ipv4/udp_tunnel_core.c
parent30bfce109420912f201d4f295f9130ff44f04b41 (diff)
downloadlinux-stable-b9ef3fecd1403fc1c2dd146e67b366691394b80f.tar.gz
linux-stable-b9ef3fecd1403fc1c2dd146e67b366691394b80f.tar.bz2
linux-stable-b9ef3fecd1403fc1c2dd146e67b366691394b80f.zip
udp_tunnel: reshuffle NETIF_F_RX_UDP_TUNNEL_PORT checks
Move the NETIF_F_RX_UDP_TUNNEL_PORT feature check into udp_tunnel_nic_*_port() helpers, since they're always done right before the call. Add similar checks before calling the notifier. udp_tunnel_nic invokes the notifier without checking features which could result in some wasted cycles. Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv4/udp_tunnel_core.c')
-rw-r--r--net/ipv4/udp_tunnel_core.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/net/ipv4/udp_tunnel_core.c b/net/ipv4/udp_tunnel_core.c
index 376a085be7ed..b97e3635acf5 100644
--- a/net/ipv4/udp_tunnel_core.c
+++ b/net/ipv4/udp_tunnel_core.c
@@ -90,9 +90,6 @@ void udp_tunnel_push_rx_port(struct net_device *dev, struct socket *sock,
struct sock *sk = sock->sk;
struct udp_tunnel_info ti;
- if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
- return;
-
ti.type = type;
ti.sa_family = sk->sk_family;
ti.port = inet_sk(sk)->inet_sport;
@@ -107,9 +104,6 @@ void udp_tunnel_drop_rx_port(struct net_device *dev, struct socket *sock,
struct sock *sk = sock->sk;
struct udp_tunnel_info ti;
- if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
- return;
-
ti.type = type;
ti.sa_family = sk->sk_family;
ti.port = inet_sk(sk)->inet_sport;
@@ -132,8 +126,6 @@ void udp_tunnel_notify_add_rx_port(struct socket *sock, unsigned short type)
rcu_read_lock();
for_each_netdev_rcu(net, dev) {
- if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
- continue;
udp_tunnel_nic_add_port(dev, &ti);
}
rcu_read_unlock();
@@ -154,8 +146,6 @@ void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type)
rcu_read_lock();
for_each_netdev_rcu(net, dev) {
- if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
- continue;
udp_tunnel_nic_del_port(dev, &ti);
}
rcu_read_unlock();