rk: revert to v3.10
[firefly-linux-kernel-4.4.55.git] / net / core / neighbour.c
index cdd77161e99f298f3517c9a6e65e786a19f80536..5c56b217b999d114ea7954a9e6060a77d906ceff 100644 (file)
@@ -231,7 +231,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev)
                                   we must kill timers etc. and move
                                   it to safe state.
                                 */
-                               __skb_queue_purge(&n->arp_queue);
+                               skb_queue_purge(&n->arp_queue);
                                n->arp_queue_len_bytes = 0;
                                n->output = neigh_blackhole;
                                if (n->nud_state & NUD_VALID)
@@ -286,7 +286,7 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl, struct net_device
        if (!n)
                goto out_entries;
 
-       __skb_queue_head_init(&n->arp_queue);
+       skb_queue_head_init(&n->arp_queue);
        rwlock_init(&n->lock);
        seqlock_init(&n->ha_lock);
        n->updated        = n->used = now;
@@ -708,9 +708,7 @@ void neigh_destroy(struct neighbour *neigh)
        if (neigh_del_timer(neigh))
                pr_warn("Impossible event\n");
 
-       write_lock_bh(&neigh->lock);
-       __skb_queue_purge(&neigh->arp_queue);
-       write_unlock_bh(&neigh->lock);
+       skb_queue_purge(&neigh->arp_queue);
        neigh->arp_queue_len_bytes = 0;
 
        if (dev->netdev_ops->ndo_neigh_destroy)
@@ -764,6 +762,9 @@ static void neigh_periodic_work(struct work_struct *work)
        nht = rcu_dereference_protected(tbl->nht,
                                        lockdep_is_held(&tbl->lock));
 
+       if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
+               goto out;
+
        /*
         *      periodically recompute ReachableTime from random function
         */
@@ -776,9 +777,6 @@ static void neigh_periodic_work(struct work_struct *work)
                                neigh_rand_reach_time(p->base_reachable_time);
        }
 
-       if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
-               goto out;
-
        for (i = 0 ; i < (1 << nht->hash_shift); i++) {
                np = &nht->hash_buckets[i];
 
@@ -860,7 +858,7 @@ static void neigh_invalidate(struct neighbour *neigh)
                neigh->ops->error_report(neigh, skb);
                write_lock(&neigh->lock);
        }
-       __skb_queue_purge(&neigh->arp_queue);
+       skb_queue_purge(&neigh->arp_queue);
        neigh->arp_queue_len_bytes = 0;
 }
 
@@ -928,7 +926,6 @@ static void neigh_timer_handler(unsigned long arg)
                        neigh->nud_state = NUD_PROBE;
                        neigh->updated = jiffies;
                        atomic_set(&neigh->probes, 0);
-                       notify = 1;
                        next = now + neigh->parms->retrans_time;
                }
        } else {
@@ -1156,8 +1153,6 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
 
        if (new != old) {
                neigh_del_timer(neigh);
-               if (new & NUD_PROBE)
-                       atomic_set(&neigh->probes, 0);
                if (new & NUD_IN_TIMER)
                        neigh_add_timer(neigh, (jiffies +
                                                ((new & NUD_REACHABLE) ?
@@ -1215,7 +1210,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
 
                        write_lock_bh(&neigh->lock);
                }
-               __skb_queue_purge(&neigh->arp_queue);
+               skb_queue_purge(&neigh->arp_queue);
                neigh->arp_queue_len_bytes = 0;
        }
 out:
@@ -1277,7 +1272,7 @@ int neigh_compat_output(struct neighbour *neigh, struct sk_buff *skb)
 
        if (dev_hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL,
                            skb->len) < 0 &&
-           dev_rebuild_header(skb))
+           dev->header_ops->rebuild(skb))
                return 0;
 
        return dev_queue_xmit(skb);
@@ -1448,18 +1443,16 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
                atomic_set(&p->refcnt, 1);
                p->reachable_time =
                                neigh_rand_reach_time(p->base_reachable_time);
-               dev_hold(dev);
-               p->dev = dev;
-               write_pnet(&p->net, hold_net(net));
-               p->sysctl_table = NULL;
 
                if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) {
-                       release_net(net);
-                       dev_put(dev);
                        kfree(p);
                        return NULL;
                }
 
+               dev_hold(dev);
+               p->dev = dev;
+               write_pnet(&p->net, hold_net(net));
+               p->sysctl_table = NULL;
                write_lock_bh(&tbl->lock);
                p->next         = tbl->parms.next;
                tbl->parms.next = p;