|
@@ -2608,7 +2608,7 @@ static struct device_type vxlan_type = {
|
|
* supply the listening VXLAN udp ports. Callers are expected
|
|
* supply the listening VXLAN udp ports. Callers are expected
|
|
* to implement the ndo_udp_tunnel_add.
|
|
* to implement the ndo_udp_tunnel_add.
|
|
*/
|
|
*/
|
|
-static void vxlan_push_rx_ports(struct net_device *dev)
|
|
|
|
|
|
+static void vxlan_offload_rx_ports(struct net_device *dev, bool push)
|
|
{
|
|
{
|
|
struct vxlan_sock *vs;
|
|
struct vxlan_sock *vs;
|
|
struct net *net = dev_net(dev);
|
|
struct net *net = dev_net(dev);
|
|
@@ -2617,11 +2617,19 @@ static void vxlan_push_rx_ports(struct net_device *dev)
|
|
|
|
|
|
spin_lock(&vn->sock_lock);
|
|
spin_lock(&vn->sock_lock);
|
|
for (i = 0; i < PORT_HASH_SIZE; ++i) {
|
|
for (i = 0; i < PORT_HASH_SIZE; ++i) {
|
|
- hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist)
|
|
|
|
- udp_tunnel_push_rx_port(dev, vs->sock,
|
|
|
|
- (vs->flags & VXLAN_F_GPE) ?
|
|
|
|
- UDP_TUNNEL_TYPE_VXLAN_GPE :
|
|
|
|
- UDP_TUNNEL_TYPE_VXLAN);
|
|
|
|
|
|
+ hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) {
|
|
|
|
+ unsigned short type;
|
|
|
|
+
|
|
|
|
+ if (vs->flags & VXLAN_F_GPE)
|
|
|
|
+ type = UDP_TUNNEL_TYPE_VXLAN_GPE;
|
|
|
|
+ else
|
|
|
|
+ type = UDP_TUNNEL_TYPE_VXLAN;
|
|
|
|
+
|
|
|
|
+ if (push)
|
|
|
|
+ udp_tunnel_push_rx_port(dev, vs->sock, type);
|
|
|
|
+ else
|
|
|
|
+ udp_tunnel_drop_rx_port(dev, vs->sock, type);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
spin_unlock(&vn->sock_lock);
|
|
spin_unlock(&vn->sock_lock);
|
|
}
|
|
}
|
|
@@ -3632,8 +3640,9 @@ static int vxlan_netdevice_event(struct notifier_block *unused,
|
|
|
|
|
|
if (event == NETDEV_UNREGISTER)
|
|
if (event == NETDEV_UNREGISTER)
|
|
vxlan_handle_lowerdev_unregister(vn, dev);
|
|
vxlan_handle_lowerdev_unregister(vn, dev);
|
|
- else if (event == NETDEV_UDP_TUNNEL_PUSH_INFO)
|
|
|
|
- vxlan_push_rx_ports(dev);
|
|
|
|
|
|
+ else if (event == NETDEV_UDP_TUNNEL_PUSH_INFO ||
|
|
|
|
+ event == NETDEV_UDP_TUNNEL_DROP_INFO)
|
|
|
|
+ vxlan_offload_rx_ports(dev, event == NETDEV_UDP_TUNNEL_PUSH_INFO);
|
|
|
|
|
|
return NOTIFY_DONE;
|
|
return NOTIFY_DONE;
|
|
}
|
|
}
|