geneve/vxlan: offload ports on register/unregister events
authorSabrina Dubroca <sd@queasysnail.net>
Fri, 21 Jul 2017 10:49:33 +0000 (12:49 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Jul 2017 20:52:59 +0000 (13:52 -0700)
This improves consistency of handling when moving a netdev to another
netns. Most drivers currently do a full reset when the device goes up,
so that will flush the offload state anyway.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/geneve.c
drivers/net/vxlan.c

index 74545ecb94318e7621f8ff7bbe649d68c88d4018..745d57ae95d7708844d81bb5f945df28dc463a29 100644 (file)
@@ -1567,8 +1567,13 @@ static int geneve_netdevice_event(struct notifier_block *unused,
        struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 
        if (event == NETDEV_UDP_TUNNEL_PUSH_INFO ||
-           event == NETDEV_UDP_TUNNEL_DROP_INFO)
+           event == NETDEV_UDP_TUNNEL_DROP_INFO) {
                geneve_offload_rx_ports(dev, event == NETDEV_UDP_TUNNEL_PUSH_INFO);
+       } else if (event == NETDEV_UNREGISTER) {
+               geneve_offload_rx_ports(dev, false);
+       } else if (event == NETDEV_REGISTER) {
+               geneve_offload_rx_ports(dev, true);
+       }
 
        return NOTIFY_DONE;
 }
index 4642d5be2fa00a434f1444b58d0d00af7dff5a06..dbca067540d01adf53845ced90fd2c83a4d97f47 100644 (file)
@@ -3638,11 +3638,15 @@ static int vxlan_netdevice_event(struct notifier_block *unused,
        struct net_device *dev = netdev_notifier_info_to_dev(ptr);
        struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
 
-       if (event == NETDEV_UNREGISTER)
+       if (event == NETDEV_UNREGISTER) {
+               vxlan_offload_rx_ports(dev, false);
                vxlan_handle_lowerdev_unregister(vn, dev);
-       else if (event == NETDEV_UDP_TUNNEL_PUSH_INFO ||
-                event == NETDEV_UDP_TUNNEL_DROP_INFO)
+       } else if (event == NETDEV_REGISTER) {
+               vxlan_offload_rx_ports(dev, true);
+       } 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;
 }