Merge branch 'signal-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / net / vxlan.c
index 977f77e..a8ad710 100644 (file)
@@ -66,6 +66,7 @@ struct vxlan_net {
        struct list_head  vxlan_list;
        struct hlist_head sock_list[PORT_HASH_SIZE];
        spinlock_t        sock_lock;
+       struct notifier_block nexthop_notifier_block;
 };
 
 /* Forwarding table entry */
@@ -2476,7 +2477,7 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
 
        ndst = ipv6_stub->ipv6_dst_lookup_flow(vxlan->net, sock6->sock->sk,
                                               &fl6, NULL);
-       if (unlikely(IS_ERR(ndst))) {
+       if (IS_ERR(ndst)) {
                netdev_dbg(dev, "no route to %pI6\n", daddr);
                return ERR_PTR(-ENETUNREACH);
        }
@@ -3210,7 +3211,7 @@ static const struct net_device_ops vxlan_netdev_ether_ops = {
        .ndo_open               = vxlan_open,
        .ndo_stop               = vxlan_stop,
        .ndo_start_xmit         = vxlan_xmit,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_rx_mode        = vxlan_set_multicast_list,
        .ndo_change_mtu         = vxlan_change_mtu,
        .ndo_validate_addr      = eth_validate_addr,
@@ -3229,7 +3230,7 @@ static const struct net_device_ops vxlan_netdev_raw_ops = {
        .ndo_open               = vxlan_open,
        .ndo_stop               = vxlan_stop,
        .ndo_start_xmit         = vxlan_xmit,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_change_mtu         = vxlan_change_mtu,
        .ndo_fill_metadata_dst  = vxlan_fill_metadata_dst,
 };
@@ -4688,9 +4689,14 @@ static void vxlan_fdb_nh_flush(struct nexthop *nh)
 static int vxlan_nexthop_event(struct notifier_block *nb,
                               unsigned long event, void *ptr)
 {
-       struct nexthop *nh = ptr;
+       struct nh_notifier_info *info = ptr;
+       struct nexthop *nh;
+
+       if (event != NEXTHOP_EVENT_DEL)
+               return NOTIFY_DONE;
 
-       if (!nh || event != NEXTHOP_EVENT_DEL)
+       nh = nexthop_find_by_id(info->net, info->id);
+       if (!nh)
                return NOTIFY_DONE;
 
        vxlan_fdb_nh_flush(nh);
@@ -4698,10 +4704,6 @@ static int vxlan_nexthop_event(struct notifier_block *nb,
        return NOTIFY_DONE;
 }
 
-static struct notifier_block vxlan_nexthop_notifier_block __read_mostly = {
-       .notifier_call = vxlan_nexthop_event,
-};
-
 static __net_init int vxlan_init_net(struct net *net)
 {
        struct vxlan_net *vn = net_generic(net, vxlan_net_id);
@@ -4709,11 +4711,13 @@ static __net_init int vxlan_init_net(struct net *net)
 
        INIT_LIST_HEAD(&vn->vxlan_list);
        spin_lock_init(&vn->sock_lock);
+       vn->nexthop_notifier_block.notifier_call = vxlan_nexthop_event;
 
        for (h = 0; h < PORT_HASH_SIZE; ++h)
                INIT_HLIST_HEAD(&vn->sock_list[h]);
 
-       return register_nexthop_notifier(net, &vxlan_nexthop_notifier_block);
+       return register_nexthop_notifier(net, &vn->nexthop_notifier_block,
+                                        NULL);
 }
 
 static void vxlan_destroy_tunnels(struct net *net, struct list_head *head)
@@ -4745,8 +4749,11 @@ static void __net_exit vxlan_exit_batch_net(struct list_head *net_list)
        LIST_HEAD(list);
 
        rtnl_lock();
-       list_for_each_entry(net, net_list, exit_list)
-               unregister_nexthop_notifier(net, &vxlan_nexthop_notifier_block);
+       list_for_each_entry(net, net_list, exit_list) {
+               struct vxlan_net *vn = net_generic(net, vxlan_net_id);
+
+               unregister_nexthop_notifier(net, &vn->nexthop_notifier_block);
+       }
        list_for_each_entry(net, net_list, exit_list)
                vxlan_destroy_tunnels(net, &list);