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

net: Remove deprecated tunnel specific UDP offload functions

Now that we have all the drivers using udp_tunnel_get_rx_ports,
ndo_add_udp_enc_rx_port, and ndo_del_udp_enc_rx_port we can drop the
function calls that were specific to VXLAN and GENEVE.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Alexander Duyck and committed by
David S. Miller
1938ee1f 5e44f8e2

+14 -113
-38
include/linux/netdevice.h
··· 1026 1026 * not implement this, it is assumed that the hw is not able to have 1027 1027 * multiple net devices on single physical port. 1028 1028 * 1029 - * void (*ndo_add_vxlan_port)(struct net_device *dev, 1030 - * sa_family_t sa_family, __be16 port); 1031 - * Called by vxlan to notify a driver about the UDP port and socket 1032 - * address family that vxlan is listening to. It is called only when 1033 - * a new port starts listening. The operation is protected by the 1034 - * vxlan_net->sock_lock. 1035 - * 1036 - * void (*ndo_add_geneve_port)(struct net_device *dev, 1037 - * sa_family_t sa_family, __be16 port); 1038 - * Called by geneve to notify a driver about the UDP port and socket 1039 - * address family that geneve is listnening to. It is called only when 1040 - * a new port starts listening. The operation is protected by the 1041 - * geneve_net->sock_lock. 1042 - * 1043 - * void (*ndo_del_geneve_port)(struct net_device *dev, 1044 - * sa_family_t sa_family, __be16 port); 1045 - * Called by geneve to notify the driver about a UDP port and socket 1046 - * address family that geneve is not listening to anymore. The operation 1047 - * is protected by the geneve_net->sock_lock. 1048 - * 1049 - * void (*ndo_del_vxlan_port)(struct net_device *dev, 1050 - * sa_family_t sa_family, __be16 port); 1051 - * Called by vxlan to notify the driver about a UDP port and socket 1052 - * address family that vxlan is not listening to anymore. The operation 1053 - * is protected by the vxlan_net->sock_lock. 1054 - * 1055 1029 * void (*ndo_udp_tunnel_add)(struct net_device *dev, 1056 1030 * struct udp_tunnel_info *ti); 1057 1031 * Called by UDP tunnel to notify a driver about the UDP port and socket ··· 1246 1272 struct netdev_phys_item_id *ppid); 1247 1273 int (*ndo_get_phys_port_name)(struct net_device *dev, 1248 1274 char *name, size_t len); 1249 - void (*ndo_add_vxlan_port)(struct net_device *dev, 1250 - sa_family_t sa_family, 1251 - __be16 port); 1252 - void (*ndo_del_vxlan_port)(struct net_device *dev, 1253 - sa_family_t sa_family, 1254 - __be16 port); 1255 - void (*ndo_add_geneve_port)(struct net_device *dev, 1256 - sa_family_t sa_family, 1257 - __be16 port); 1258 - void (*ndo_del_geneve_port)(struct net_device *dev, 1259 - sa_family_t sa_family, 1260 - __be16 port); 1261 1275 void (*ndo_udp_tunnel_add)(struct net_device *dev, 1262 1276 struct udp_tunnel_info *ti); 1263 1277 void (*ndo_udp_tunnel_del)(struct net_device *dev,
-5
include/net/geneve.h
··· 59 59 struct geneve_opt options[]; 60 60 }; 61 61 62 - static inline void geneve_get_rx_port(struct net_device *netdev) 63 - { 64 - udp_tunnel_get_rx_info(netdev); 65 - } 66 - 67 62 #ifdef CONFIG_INET 68 63 struct net_device *geneve_dev_create_fb(struct net *net, const char *name, 69 64 u8 name_assign_type, u16 dst_port);
-5
include/net/vxlan.h
··· 389 389 return vni_field; 390 390 } 391 391 392 - static inline void vxlan_get_rx_port(struct net_device *netdev) 393 - { 394 - udp_tunnel_get_rx_info(netdev); 395 - } 396 - 397 392 static inline unsigned short vxlan_get_sk_family(struct vxlan_sock *vs) 398 393 { 399 394 return vs->sock->sk->sk_family;
+14 -65
net/ipv4/udp_tunnel.c
··· 76 76 } 77 77 EXPORT_SYMBOL_GPL(setup_udp_tunnel_sock); 78 78 79 - static void __udp_tunnel_push_rx_port(struct net_device *dev, 80 - struct udp_tunnel_info *ti) 81 - { 82 - if (dev->netdev_ops->ndo_udp_tunnel_add) { 83 - dev->netdev_ops->ndo_udp_tunnel_add(dev, ti); 84 - return; 85 - } 86 - 87 - switch (ti->type) { 88 - case UDP_TUNNEL_TYPE_VXLAN: 89 - if (!dev->netdev_ops->ndo_add_vxlan_port) 90 - break; 91 - 92 - dev->netdev_ops->ndo_add_vxlan_port(dev, 93 - ti->sa_family, 94 - ti->port); 95 - break; 96 - case UDP_TUNNEL_TYPE_GENEVE: 97 - if (!dev->netdev_ops->ndo_add_geneve_port) 98 - break; 99 - 100 - dev->netdev_ops->ndo_add_geneve_port(dev, 101 - ti->sa_family, 102 - ti->port); 103 - break; 104 - default: 105 - break; 106 - } 107 - } 108 - 109 79 void udp_tunnel_push_rx_port(struct net_device *dev, struct socket *sock, 110 80 unsigned short type) 111 81 { 112 82 struct sock *sk = sock->sk; 113 83 struct udp_tunnel_info ti; 114 84 85 + if (!dev->netdev_ops->ndo_udp_tunnel_add) 86 + return; 87 + 115 88 ti.type = type; 116 89 ti.sa_family = sk->sk_family; 117 90 ti.port = inet_sk(sk)->inet_sport; 118 91 119 - __udp_tunnel_push_rx_port(dev, &ti); 92 + dev->netdev_ops->ndo_udp_tunnel_add(dev, &ti); 120 93 } 121 94 EXPORT_SYMBOL_GPL(udp_tunnel_push_rx_port); 122 95 ··· 106 133 ti.port = inet_sk(sk)->inet_sport; 107 134 108 135 rcu_read_lock(); 109 - for_each_netdev_rcu(net, dev) 110 - __udp_tunnel_push_rx_port(dev, &ti); 136 + for_each_netdev_rcu(net, dev) { 137 + if (!dev->netdev_ops->ndo_udp_tunnel_add) 138 + continue; 139 + dev->netdev_ops->ndo_udp_tunnel_add(dev, &ti); 140 + } 111 141 rcu_read_unlock(); 112 142 } 113 143 EXPORT_SYMBOL_GPL(udp_tunnel_notify_add_rx_port); 114 - 115 - static void __udp_tunnel_pull_rx_port(struct net_device *dev, 116 - struct udp_tunnel_info *ti) 117 - { 118 - if (dev->netdev_ops->ndo_udp_tunnel_del) { 119 - dev->netdev_ops->ndo_udp_tunnel_del(dev, ti); 120 - return; 121 - } 122 - 123 - switch (ti->type) { 124 - case UDP_TUNNEL_TYPE_VXLAN: 125 - if (!dev->netdev_ops->ndo_del_vxlan_port) 126 - break; 127 - 128 - dev->netdev_ops->ndo_del_vxlan_port(dev, 129 - ti->sa_family, 130 - ti->port); 131 - break; 132 - case UDP_TUNNEL_TYPE_GENEVE: 133 - if (!dev->netdev_ops->ndo_del_geneve_port) 134 - break; 135 - 136 - dev->netdev_ops->ndo_del_geneve_port(dev, 137 - ti->sa_family, 138 - ti->port); 139 - break; 140 - default: 141 - break; 142 - } 143 - } 144 144 145 145 /* Notify netdevs that UDP port is no more listening */ 146 146 void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type) ··· 128 182 ti.port = inet_sk(sk)->inet_sport; 129 183 130 184 rcu_read_lock(); 131 - for_each_netdev_rcu(net, dev) 132 - __udp_tunnel_pull_rx_port(dev, &ti); 185 + for_each_netdev_rcu(net, dev) { 186 + if (!dev->netdev_ops->ndo_udp_tunnel_del) 187 + continue; 188 + dev->netdev_ops->ndo_udp_tunnel_del(dev, &ti); 189 + } 133 190 rcu_read_unlock(); 134 191 } 135 192 EXPORT_SYMBOL_GPL(udp_tunnel_notify_del_rx_port);