Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

udp_tunnel: hard-wire NDOs to udp_tunnel_nic_*_port() helpers

All drivers use udp_tunnel_nic_*_port() helpers, prepare for
NDO removal by invoking those helpers directly.

The helpers are safe to call on all devices, they check if
device has the UDP tunnel state initialized.

Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+7 -13
+1 -1
net/core/dev.c
··· 10002 10002 dev->hw_features |= (NETIF_F_SOFT_FEATURES | NETIF_F_SOFT_FEATURES_OFF); 10003 10003 dev->features |= NETIF_F_SOFT_FEATURES; 10004 10004 10005 - if (dev->netdev_ops->ndo_udp_tunnel_add) { 10005 + if (dev->udp_tunnel_nic_info) { 10006 10006 dev->features |= NETIF_F_RX_UDP_TUNNEL_PORT; 10007 10007 dev->hw_features |= NETIF_F_RX_UDP_TUNNEL_PORT; 10008 10008 }
+6 -12
net/ipv4/udp_tunnel_core.c
··· 90 90 struct sock *sk = sock->sk; 91 91 struct udp_tunnel_info ti; 92 92 93 - if (!dev->netdev_ops->ndo_udp_tunnel_add || 94 - !(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) 93 + if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) 95 94 return; 96 95 97 96 ti.type = type; 98 97 ti.sa_family = sk->sk_family; 99 98 ti.port = inet_sk(sk)->inet_sport; 100 99 101 - dev->netdev_ops->ndo_udp_tunnel_add(dev, &ti); 100 + udp_tunnel_nic_add_port(dev, &ti); 102 101 } 103 102 EXPORT_SYMBOL_GPL(udp_tunnel_push_rx_port); 104 103 ··· 107 108 struct sock *sk = sock->sk; 108 109 struct udp_tunnel_info ti; 109 110 110 - if (!dev->netdev_ops->ndo_udp_tunnel_del || 111 - !(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) 111 + if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) 112 112 return; 113 113 114 114 ti.type = type; 115 115 ti.sa_family = sk->sk_family; 116 116 ti.port = inet_sk(sk)->inet_sport; 117 117 118 - dev->netdev_ops->ndo_udp_tunnel_del(dev, &ti); 118 + udp_tunnel_nic_del_port(dev, &ti); 119 119 } 120 120 EXPORT_SYMBOL_GPL(udp_tunnel_drop_rx_port); 121 121 ··· 132 134 133 135 rcu_read_lock(); 134 136 for_each_netdev_rcu(net, dev) { 135 - if (!dev->netdev_ops->ndo_udp_tunnel_add) 136 - continue; 137 137 if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) 138 138 continue; 139 - dev->netdev_ops->ndo_udp_tunnel_add(dev, &ti); 139 + udp_tunnel_nic_add_port(dev, &ti); 140 140 } 141 141 rcu_read_unlock(); 142 142 } ··· 154 158 155 159 rcu_read_lock(); 156 160 for_each_netdev_rcu(net, dev) { 157 - if (!dev->netdev_ops->ndo_udp_tunnel_del) 158 - continue; 159 161 if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) 160 162 continue; 161 - dev->netdev_ops->ndo_udp_tunnel_del(dev, &ti); 163 + udp_tunnel_nic_del_port(dev, &ti); 162 164 } 163 165 rcu_read_unlock(); 164 166 }