Lines Matching refs:tbl

57 static int pneigh_ifdown_and_unlock(struct neigh_table *tbl,
123 atomic_dec(&n->tbl->gc_entries); in neigh_mark_dead()
133 write_lock_bh(&n->tbl->lock); in neigh_update_gc_list()
147 atomic_dec(&n->tbl->gc_entries); in neigh_update_gc_list()
150 list_add_tail(&n->gc_list, &n->tbl->gc_list); in neigh_update_gc_list()
151 atomic_inc(&n->tbl->gc_entries); in neigh_update_gc_list()
155 write_unlock_bh(&n->tbl->lock); in neigh_update_gc_list()
162 write_lock_bh(&n->tbl->lock); in neigh_update_managed_list()
173 list_add_tail(&n->managed_list, &n->tbl->managed_list); in neigh_update_managed_list()
176 write_unlock_bh(&n->tbl->lock); in neigh_update_managed_list()
209 struct neigh_table *tbl) in neigh_del() argument
218 lockdep_is_held(&tbl->lock)); in neigh_del()
229 bool neigh_remove_one(struct neighbour *ndel, struct neigh_table *tbl) in neigh_remove_one() argument
237 nht = rcu_dereference_protected(tbl->nht, in neigh_remove_one()
238 lockdep_is_held(&tbl->lock)); in neigh_remove_one()
239 hash_val = tbl->hash(pkey, ndel->dev, nht->hash_rnd); in neigh_remove_one()
244 lockdep_is_held(&tbl->lock)))) { in neigh_remove_one()
246 return neigh_del(n, np, tbl); in neigh_remove_one()
252 static int neigh_forced_gc(struct neigh_table *tbl) in neigh_forced_gc() argument
254 int max_clean = atomic_read(&tbl->gc_entries) - in neigh_forced_gc()
255 READ_ONCE(tbl->gc_thresh2); in neigh_forced_gc()
262 NEIGH_CACHE_STAT_INC(tbl, forced_gc_runs); in neigh_forced_gc()
264 write_lock_bh(&tbl->lock); in neigh_forced_gc()
266 list_for_each_entry_safe(n, tmp, &tbl->gc_list, gc_list) { in neigh_forced_gc()
273 (tbl->is_multicast && in neigh_forced_gc()
274 tbl->is_multicast(n->primary_key)) || in neigh_forced_gc()
279 if (remove && neigh_remove_one(n, tbl)) in neigh_forced_gc()
291 WRITE_ONCE(tbl->last_flush, jiffies); in neigh_forced_gc()
293 write_unlock_bh(&tbl->lock); in neigh_forced_gc()
380 static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev, in neigh_flush_dev() argument
386 nht = rcu_dereference_protected(tbl->nht, in neigh_flush_dev()
387 lockdep_is_held(&tbl->lock)); in neigh_flush_dev()
394 lockdep_is_held(&tbl->lock))) != NULL) { in neigh_flush_dev()
405 lockdep_is_held(&tbl->lock))); in neigh_flush_dev()
434 void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev) in neigh_changeaddr() argument
436 write_lock_bh(&tbl->lock); in neigh_changeaddr()
437 neigh_flush_dev(tbl, dev, false); in neigh_changeaddr()
438 write_unlock_bh(&tbl->lock); in neigh_changeaddr()
442 static int __neigh_ifdown(struct neigh_table *tbl, struct net_device *dev, in __neigh_ifdown() argument
445 write_lock_bh(&tbl->lock); in __neigh_ifdown()
446 neigh_flush_dev(tbl, dev, skip_perm); in __neigh_ifdown()
447 pneigh_ifdown_and_unlock(tbl, dev); in __neigh_ifdown()
448 pneigh_queue_purge(&tbl->proxy_queue, dev ? dev_net(dev) : NULL, in __neigh_ifdown()
449 tbl->family); in __neigh_ifdown()
450 if (skb_queue_empty_lockless(&tbl->proxy_queue)) in __neigh_ifdown()
451 del_timer_sync(&tbl->proxy_timer); in __neigh_ifdown()
455 int neigh_carrier_down(struct neigh_table *tbl, struct net_device *dev) in neigh_carrier_down() argument
457 __neigh_ifdown(tbl, dev, true); in neigh_carrier_down()
462 int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev) in neigh_ifdown() argument
464 __neigh_ifdown(tbl, dev, false); in neigh_ifdown()
469 static struct neighbour *neigh_alloc(struct neigh_table *tbl, in neigh_alloc() argument
480 entries = atomic_inc_return(&tbl->gc_entries) - 1; in neigh_alloc()
481 gc_thresh3 = READ_ONCE(tbl->gc_thresh3); in neigh_alloc()
483 (entries >= READ_ONCE(tbl->gc_thresh2) && in neigh_alloc()
484 time_after(now, READ_ONCE(tbl->last_flush) + 5 * HZ))) { in neigh_alloc()
485 if (!neigh_forced_gc(tbl) && entries >= gc_thresh3) { in neigh_alloc()
487 tbl->id); in neigh_alloc()
488 NEIGH_CACHE_STAT_INC(tbl, table_fulls); in neigh_alloc()
494 n = kzalloc(tbl->entry_size + dev->neigh_priv_len, GFP_ATOMIC); in neigh_alloc()
506 n->parms = neigh_parms_clone(&tbl->parms); in neigh_alloc()
509 NEIGH_CACHE_STAT_INC(tbl, allocs); in neigh_alloc()
510 n->tbl = tbl; in neigh_alloc()
516 atomic_inc(&tbl->entries); in neigh_alloc()
522 atomic_dec(&tbl->gc_entries); in neigh_alloc()
577 static struct neigh_hash_table *neigh_hash_grow(struct neigh_table *tbl, in neigh_hash_grow() argument
583 NEIGH_CACHE_STAT_INC(tbl, hash_grows); in neigh_hash_grow()
585 old_nht = rcu_dereference_protected(tbl->nht, in neigh_hash_grow()
586 lockdep_is_held(&tbl->lock)); in neigh_hash_grow()
595 lockdep_is_held(&tbl->lock)); in neigh_hash_grow()
598 hash = tbl->hash(n->primary_key, n->dev, in neigh_hash_grow()
603 lockdep_is_held(&tbl->lock)); in neigh_hash_grow()
608 lockdep_is_held(&tbl->lock))); in neigh_hash_grow()
613 rcu_assign_pointer(tbl->nht, new_nht); in neigh_hash_grow()
618 struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, in neigh_lookup() argument
623 NEIGH_CACHE_STAT_INC(tbl, lookups); in neigh_lookup()
626 n = __neigh_lookup_noref(tbl, pkey, dev); in neigh_lookup()
630 NEIGH_CACHE_STAT_INC(tbl, hits); in neigh_lookup()
639 ___neigh_create(struct neigh_table *tbl, const void *pkey, in ___neigh_create() argument
643 u32 hash_val, key_len = tbl->key_len; in ___neigh_create()
648 n = neigh_alloc(tbl, dev, flags, exempt_from_gc); in ___neigh_create()
649 trace_neigh_create(tbl, dev, pkey, n, exempt_from_gc); in ___neigh_create()
660 if (tbl->constructor && (error = tbl->constructor(n)) < 0) { in ___neigh_create()
682 write_lock_bh(&tbl->lock); in ___neigh_create()
683 nht = rcu_dereference_protected(tbl->nht, in ___neigh_create()
684 lockdep_is_held(&tbl->lock)); in ___neigh_create()
686 if (atomic_read(&tbl->entries) > (1 << nht->hash_shift)) in ___neigh_create()
687 nht = neigh_hash_grow(tbl, nht->hash_shift + 1); in ___neigh_create()
689 hash_val = tbl->hash(n->primary_key, dev, nht->hash_rnd) >> (32 - nht->hash_shift); in ___neigh_create()
697 lockdep_is_held(&tbl->lock)); in ___neigh_create()
700 lockdep_is_held(&tbl->lock))) { in ___neigh_create()
711 list_add_tail(&n->gc_list, &n->tbl->gc_list); in ___neigh_create()
713 list_add_tail(&n->managed_list, &n->tbl->managed_list); in ___neigh_create()
718 lockdep_is_held(&tbl->lock))); in ___neigh_create()
720 write_unlock_bh(&tbl->lock); in ___neigh_create()
726 write_unlock_bh(&tbl->lock); in ___neigh_create()
729 atomic_dec(&tbl->gc_entries); in ___neigh_create()
734 struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey, in __neigh_create() argument
737 return ___neigh_create(tbl, pkey, dev, 0, false, want_ref); in __neigh_create()
767 struct pneigh_entry *__pneigh_lookup(struct neigh_table *tbl, in __pneigh_lookup() argument
770 unsigned int key_len = tbl->key_len; in __pneigh_lookup()
773 return __pneigh_lookup_1(tbl->phash_buckets[hash_val], in __pneigh_lookup()
778 struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl, in pneigh_lookup() argument
783 unsigned int key_len = tbl->key_len; in pneigh_lookup()
786 read_lock_bh(&tbl->lock); in pneigh_lookup()
787 n = __pneigh_lookup_1(tbl->phash_buckets[hash_val], in pneigh_lookup()
789 read_unlock_bh(&tbl->lock); in pneigh_lookup()
805 if (tbl->pconstructor && tbl->pconstructor(n)) { in pneigh_lookup()
812 write_lock_bh(&tbl->lock); in pneigh_lookup()
813 n->next = tbl->phash_buckets[hash_val]; in pneigh_lookup()
814 tbl->phash_buckets[hash_val] = n; in pneigh_lookup()
815 write_unlock_bh(&tbl->lock); in pneigh_lookup()
822 int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *pkey, in pneigh_delete() argument
826 unsigned int key_len = tbl->key_len; in pneigh_delete()
829 write_lock_bh(&tbl->lock); in pneigh_delete()
830 for (np = &tbl->phash_buckets[hash_val]; (n = *np) != NULL; in pneigh_delete()
835 write_unlock_bh(&tbl->lock); in pneigh_delete()
836 if (tbl->pdestructor) in pneigh_delete()
837 tbl->pdestructor(n); in pneigh_delete()
843 write_unlock_bh(&tbl->lock); in pneigh_delete()
847 static int pneigh_ifdown_and_unlock(struct neigh_table *tbl, in pneigh_ifdown_and_unlock() argument
854 np = &tbl->phash_buckets[h]; in pneigh_ifdown_and_unlock()
865 write_unlock_bh(&tbl->lock); in pneigh_ifdown_and_unlock()
869 if (tbl->pdestructor) in pneigh_ifdown_and_unlock()
870 tbl->pdestructor(n); in pneigh_ifdown_and_unlock()
893 NEIGH_CACHE_STAT_INC(neigh->tbl, destroys); in neigh_destroy()
917 atomic_dec(&neigh->tbl->entries); in neigh_destroy()
948 struct neigh_table *tbl = container_of(work, struct neigh_table, gc_work.work); in neigh_periodic_work() local
954 NEIGH_CACHE_STAT_INC(tbl, periodic_gc_runs); in neigh_periodic_work()
956 write_lock_bh(&tbl->lock); in neigh_periodic_work()
957 nht = rcu_dereference_protected(tbl->nht, in neigh_periodic_work()
958 lockdep_is_held(&tbl->lock)); in neigh_periodic_work()
964 if (time_after(jiffies, tbl->last_rand + 300 * HZ)) { in neigh_periodic_work()
967 WRITE_ONCE(tbl->last_rand, jiffies); in neigh_periodic_work()
968 list_for_each_entry(p, &tbl->parms_list, list) in neigh_periodic_work()
973 if (atomic_read(&tbl->entries) < READ_ONCE(tbl->gc_thresh1)) in neigh_periodic_work()
980 lockdep_is_held(&tbl->lock))) != NULL) { in neigh_periodic_work()
1002 lockdep_is_held(&tbl->lock))); in neigh_periodic_work()
1017 write_unlock_bh(&tbl->lock); in neigh_periodic_work()
1019 write_lock_bh(&tbl->lock); in neigh_periodic_work()
1020 nht = rcu_dereference_protected(tbl->nht, in neigh_periodic_work()
1021 lockdep_is_held(&tbl->lock)); in neigh_periodic_work()
1028 queue_delayed_work(system_power_efficient_wq, &tbl->gc_work, in neigh_periodic_work()
1029 NEIGH_VAR(&tbl->parms, BASE_REACHABLE_TIME) >> 1); in neigh_periodic_work()
1030 write_unlock_bh(&tbl->lock); in neigh_periodic_work()
1047 NEIGH_CACHE_STAT_INC(neigh->tbl, res_failed); in neigh_invalidate()
1232 NEIGH_CACHE_STAT_INC(neigh->tbl, unres_discards); in __neigh_event_send()
1510 struct neighbour *neigh_event_ns(struct neigh_table *tbl, in neigh_event_ns() argument
1514 struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev, in neigh_event_ns()
1527 __be16 prot = n->tbl->protocol; in neigh_hh_init()
1609 struct neigh_table *tbl = container_of(work, struct neigh_table, in neigh_managed_work() local
1613 write_lock_bh(&tbl->lock); in neigh_managed_work()
1614 list_for_each_entry(neigh, &tbl->managed_list, managed_list) in neigh_managed_work()
1616 queue_delayed_work(system_power_efficient_wq, &tbl->managed_work, in neigh_managed_work()
1617 NEIGH_VAR(&tbl->parms, INTERVAL_PROBE_TIME_MS)); in neigh_managed_work()
1618 write_unlock_bh(&tbl->lock); in neigh_managed_work()
1623 struct neigh_table *tbl = from_timer(tbl, t, proxy_timer); in neigh_proxy_process() local
1628 spin_lock(&tbl->proxy_queue.lock); in neigh_proxy_process()
1630 skb_queue_walk_safe(&tbl->proxy_queue, skb, n) { in neigh_proxy_process()
1636 neigh_parms_qlen_dec(dev, tbl->family); in neigh_proxy_process()
1637 __skb_unlink(skb, &tbl->proxy_queue); in neigh_proxy_process()
1639 if (tbl->proxy_redo && netif_running(dev)) { in neigh_proxy_process()
1641 tbl->proxy_redo(skb); in neigh_proxy_process()
1651 del_timer(&tbl->proxy_timer); in neigh_proxy_process()
1653 mod_timer(&tbl->proxy_timer, jiffies + sched_next); in neigh_proxy_process()
1654 spin_unlock(&tbl->proxy_queue.lock); in neigh_proxy_process()
1668 void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, in pneigh_enqueue() argument
1681 spin_lock(&tbl->proxy_queue.lock); in pneigh_enqueue()
1682 if (del_timer(&tbl->proxy_timer)) { in pneigh_enqueue()
1683 if (time_before(tbl->proxy_timer.expires, sched_next)) in pneigh_enqueue()
1684 sched_next = tbl->proxy_timer.expires; in pneigh_enqueue()
1688 __skb_queue_tail(&tbl->proxy_queue, skb); in pneigh_enqueue()
1690 mod_timer(&tbl->proxy_timer, sched_next); in pneigh_enqueue()
1691 spin_unlock(&tbl->proxy_queue.lock); in pneigh_enqueue()
1695 static inline struct neigh_parms *lookup_neigh_parms(struct neigh_table *tbl, in lookup_neigh_parms() argument
1700 list_for_each_entry(p, &tbl->parms_list, list) { in lookup_neigh_parms()
1710 struct neigh_table *tbl) in neigh_parms_alloc() argument
1716 p = kmemdup(&tbl->parms, sizeof(*p), GFP_KERNEL); in neigh_parms_alloc()
1718 p->tbl = tbl; in neigh_parms_alloc()
1734 write_lock_bh(&tbl->lock); in neigh_parms_alloc()
1735 list_add(&p->list, &tbl->parms.list); in neigh_parms_alloc()
1736 write_unlock_bh(&tbl->lock); in neigh_parms_alloc()
1752 void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms) in neigh_parms_release() argument
1754 if (!parms || parms == &tbl->parms) in neigh_parms_release()
1756 write_lock_bh(&tbl->lock); in neigh_parms_release()
1759 write_unlock_bh(&tbl->lock); in neigh_parms_release()
1774 void neigh_table_init(int index, struct neigh_table *tbl) in neigh_table_init() argument
1779 INIT_LIST_HEAD(&tbl->parms_list); in neigh_table_init()
1780 INIT_LIST_HEAD(&tbl->gc_list); in neigh_table_init()
1781 INIT_LIST_HEAD(&tbl->managed_list); in neigh_table_init()
1783 list_add(&tbl->parms.list, &tbl->parms_list); in neigh_table_init()
1784 write_pnet(&tbl->parms.net, &init_net); in neigh_table_init()
1785 refcount_set(&tbl->parms.refcnt, 1); in neigh_table_init()
1786 tbl->parms.reachable_time = in neigh_table_init()
1787 neigh_rand_reach_time(NEIGH_VAR(&tbl->parms, BASE_REACHABLE_TIME)); in neigh_table_init()
1788 tbl->parms.qlen = 0; in neigh_table_init()
1790 tbl->stats = alloc_percpu(struct neigh_statistics); in neigh_table_init()
1791 if (!tbl->stats) in neigh_table_init()
1795 if (!proc_create_seq_data(tbl->id, 0, init_net.proc_net_stat, in neigh_table_init()
1796 &neigh_stat_seq_ops, tbl)) in neigh_table_init()
1800 RCU_INIT_POINTER(tbl->nht, neigh_hash_alloc(3)); in neigh_table_init()
1803 tbl->phash_buckets = kzalloc(phsize, GFP_KERNEL); in neigh_table_init()
1805 if (!tbl->nht || !tbl->phash_buckets) in neigh_table_init()
1808 if (!tbl->entry_size) in neigh_table_init()
1809 tbl->entry_size = ALIGN(offsetof(struct neighbour, primary_key) + in neigh_table_init()
1810 tbl->key_len, NEIGH_PRIV_ALIGN); in neigh_table_init()
1812 WARN_ON(tbl->entry_size % NEIGH_PRIV_ALIGN); in neigh_table_init()
1814 rwlock_init(&tbl->lock); in neigh_table_init()
1816 INIT_DEFERRABLE_WORK(&tbl->gc_work, neigh_periodic_work); in neigh_table_init()
1817 queue_delayed_work(system_power_efficient_wq, &tbl->gc_work, in neigh_table_init()
1818 tbl->parms.reachable_time); in neigh_table_init()
1819 INIT_DEFERRABLE_WORK(&tbl->managed_work, neigh_managed_work); in neigh_table_init()
1820 queue_delayed_work(system_power_efficient_wq, &tbl->managed_work, 0); in neigh_table_init()
1822 timer_setup(&tbl->proxy_timer, neigh_proxy_process, 0); in neigh_table_init()
1823 skb_queue_head_init_class(&tbl->proxy_queue, in neigh_table_init()
1826 tbl->last_flush = now; in neigh_table_init()
1827 tbl->last_rand = now + tbl->parms.reachable_time * 20; in neigh_table_init()
1829 neigh_tables[index] = tbl; in neigh_table_init()
1833 int neigh_table_clear(int index, struct neigh_table *tbl) in neigh_table_clear() argument
1837 cancel_delayed_work_sync(&tbl->managed_work); in neigh_table_clear()
1838 cancel_delayed_work_sync(&tbl->gc_work); in neigh_table_clear()
1839 del_timer_sync(&tbl->proxy_timer); in neigh_table_clear()
1840 pneigh_queue_purge(&tbl->proxy_queue, NULL, tbl->family); in neigh_table_clear()
1841 neigh_ifdown(tbl, NULL); in neigh_table_clear()
1842 if (atomic_read(&tbl->entries)) in neigh_table_clear()
1845 call_rcu(&rcu_dereference_protected(tbl->nht, 1)->rcu, in neigh_table_clear()
1847 tbl->nht = NULL; in neigh_table_clear()
1849 kfree(tbl->phash_buckets); in neigh_table_clear()
1850 tbl->phash_buckets = NULL; in neigh_table_clear()
1852 remove_proc_entry(tbl->id, init_net.proc_net_stat); in neigh_table_clear()
1854 free_percpu(tbl->stats); in neigh_table_clear()
1855 tbl->stats = NULL; in neigh_table_clear()
1863 struct neigh_table *tbl = NULL; in neigh_find_table() local
1867 tbl = neigh_tables[NEIGH_ARP_TABLE]; in neigh_find_table()
1870 tbl = neigh_tables[NEIGH_ND_TABLE]; in neigh_find_table()
1874 return tbl; in neigh_find_table()
1900 struct neigh_table *tbl; in neigh_delete() local
1924 tbl = neigh_find_table(ndm->ndm_family); in neigh_delete()
1925 if (tbl == NULL) in neigh_delete()
1928 if (nla_len(dst_attr) < (int)tbl->key_len) { in neigh_delete()
1934 err = pneigh_delete(tbl, net, nla_data(dst_attr), dev); in neigh_delete()
1941 neigh = neigh_lookup(tbl, nla_data(dst_attr), dev); in neigh_delete()
1950 write_lock_bh(&tbl->lock); in neigh_delete()
1952 neigh_remove_one(neigh, tbl); in neigh_delete()
1953 write_unlock_bh(&tbl->lock); in neigh_delete()
1967 struct neigh_table *tbl; in neigh_add() local
2010 tbl = neigh_find_table(ndm->ndm_family); in neigh_add()
2011 if (tbl == NULL) in neigh_add()
2014 if (nla_len(tb[NDA_DST]) < (int)tbl->key_len) { in neigh_add()
2033 pn = pneigh_lookup(tbl, net, dst, dev, 1); in neigh_add()
2048 if (tbl->allow_add && !tbl->allow_add(dev, extack)) { in neigh_add()
2053 neigh = neigh_lookup(tbl, dst, dev); in neigh_add()
2069 neigh = ___neigh_create(tbl, dst, dev, in neigh_add()
2161 static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, in neightbl_fill_info() argument
2173 read_lock_bh(&tbl->lock); in neightbl_fill_info()
2174 ndtmsg->ndtm_family = tbl->family; in neightbl_fill_info()
2178 if (nla_put_string(skb, NDTA_NAME, tbl->id) || in neightbl_fill_info()
2179 nla_put_msecs(skb, NDTA_GC_INTERVAL, READ_ONCE(tbl->gc_interval), in neightbl_fill_info()
2181 nla_put_u32(skb, NDTA_THRESH1, READ_ONCE(tbl->gc_thresh1)) || in neightbl_fill_info()
2182 nla_put_u32(skb, NDTA_THRESH2, READ_ONCE(tbl->gc_thresh2)) || in neightbl_fill_info()
2183 nla_put_u32(skb, NDTA_THRESH3, READ_ONCE(tbl->gc_thresh3))) in neightbl_fill_info()
2187 long flush_delta = now - READ_ONCE(tbl->last_flush); in neightbl_fill_info()
2188 long rand_delta = now - READ_ONCE(tbl->last_rand); in neightbl_fill_info()
2191 .ndtc_key_len = tbl->key_len, in neightbl_fill_info()
2192 .ndtc_entry_size = tbl->entry_size, in neightbl_fill_info()
2193 .ndtc_entries = atomic_read(&tbl->entries), in neightbl_fill_info()
2196 .ndtc_proxy_qlen = READ_ONCE(tbl->proxy_queue.qlen), in neightbl_fill_info()
2200 nht = rcu_dereference(tbl->nht); in neightbl_fill_info()
2218 st = per_cpu_ptr(tbl->stats, cpu); in neightbl_fill_info()
2237 BUG_ON(tbl->parms.dev); in neightbl_fill_info()
2238 if (neightbl_fill_parms(skb, &tbl->parms) < 0) in neightbl_fill_info()
2241 read_unlock_bh(&tbl->lock); in neightbl_fill_info()
2246 read_unlock_bh(&tbl->lock); in neightbl_fill_info()
2252 struct neigh_table *tbl, in neightbl_fill_param_info() argument
2266 read_lock_bh(&tbl->lock); in neightbl_fill_param_info()
2267 ndtmsg->ndtm_family = tbl->family; in neightbl_fill_param_info()
2271 if (nla_put_string(skb, NDTA_NAME, tbl->id) < 0 || in neightbl_fill_param_info()
2275 read_unlock_bh(&tbl->lock); in neightbl_fill_param_info()
2279 read_unlock_bh(&tbl->lock); in neightbl_fill_param_info()
2315 struct neigh_table *tbl; in neightbl_set() local
2334 tbl = neigh_tables[tidx]; in neightbl_set()
2335 if (!tbl) in neightbl_set()
2337 if (ndtmsg->ndtm_family && tbl->family != ndtmsg->ndtm_family) in neightbl_set()
2339 if (nla_strcmp(tb[NDTA_NAME], tbl->id) == 0) { in neightbl_set()
2352 write_lock_bh(&tbl->lock); in neightbl_set()
2368 p = lookup_neigh_parms(tbl, net, ifindex); in neightbl_set()
2458 WRITE_ONCE(tbl->gc_thresh1, nla_get_u32(tb[NDTA_THRESH1])); in neightbl_set()
2461 WRITE_ONCE(tbl->gc_thresh2, nla_get_u32(tb[NDTA_THRESH2])); in neightbl_set()
2464 WRITE_ONCE(tbl->gc_thresh3, nla_get_u32(tb[NDTA_THRESH3])); in neightbl_set()
2467 WRITE_ONCE(tbl->gc_interval, nla_get_msecs(tb[NDTA_GC_INTERVAL])); in neightbl_set()
2472 write_unlock_bh(&tbl->lock); in neightbl_set()
2508 struct neigh_table *tbl; in neightbl_dump_info() local
2522 tbl = neigh_tables[tidx]; in neightbl_dump_info()
2523 if (!tbl) in neightbl_dump_info()
2526 if (tidx < tbl_skip || (family && tbl->family != family)) in neightbl_dump_info()
2529 if (neightbl_fill_info(skb, tbl, NETLINK_CB(cb->skb).portid, in neightbl_dump_info()
2535 p = list_next_entry(&tbl->parms, list); in neightbl_dump_info()
2536 list_for_each_entry_from(p, &tbl->parms_list, list) { in neightbl_dump_info()
2543 if (neightbl_fill_param_info(skb, tbl, p, in neightbl_dump_info()
2586 if (nla_put(skb, NDA_DST, neigh->tbl->key_len, neigh->primary_key)) in neigh_fill_info()
2626 struct neigh_table *tbl) in pneigh_fill_info() argument
2640 ndm->ndm_family = tbl->family; in pneigh_fill_info()
2648 if (nla_put(skb, NDA_DST, tbl->key_len, pn->key)) in pneigh_fill_info()
2704 static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, in neigh_dump_table() argument
2719 nht = rcu_dereference(tbl->nht); in neigh_dump_table()
2751 static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, in pneigh_dump_table() argument
2764 read_lock_bh(&tbl->lock); in pneigh_dump_table()
2769 for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) { in pneigh_dump_table()
2777 RTM_NEWNEIGH, flags, tbl) < 0) { in pneigh_dump_table()
2778 read_unlock_bh(&tbl->lock); in pneigh_dump_table()
2787 read_unlock_bh(&tbl->lock); in pneigh_dump_table()
2861 struct neigh_table *tbl; in neigh_dump_info() local
2882 tbl = neigh_tables[t]; in neigh_dump_info()
2884 if (!tbl) in neigh_dump_info()
2886 if (t < s_t || (family && tbl->family != family)) in neigh_dump_info()
2892 err = pneigh_dump_table(tbl, skb, cb, &filter); in neigh_dump_info()
2894 err = neigh_dump_table(tbl, skb, cb, &filter); in neigh_dump_info()
2904 struct neigh_table **tbl, in neigh_valid_get_req() argument
2936 *tbl = neigh_find_table(ndm->ndm_family); in neigh_valid_get_req()
2937 if (*tbl == NULL) { in neigh_valid_get_req()
2948 if (nla_len(tb[i]) != (int)(*tbl)->key_len) { in neigh_valid_get_req()
3004 u32 pid, u32 seq, struct neigh_table *tbl) in pneigh_get_reply() argument
3013 err = pneigh_fill_info(skb, neigh, pid, seq, RTM_NEWNEIGH, 0, tbl); in pneigh_get_reply()
3029 struct neigh_table *tbl = NULL; in neigh_get() local
3036 err = neigh_valid_get_req(nlh, &tbl, &dst, &dev_idx, &ndm_flags, in neigh_get()
3057 pn = pneigh_lookup(tbl, net, dst, dev, 0); in neigh_get()
3063 nlh->nlmsg_seq, tbl); in neigh_get()
3071 neigh = neigh_lookup(tbl, dst, dev); in neigh_get()
3085 void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie) in neigh_for_each() argument
3091 nht = rcu_dereference(tbl->nht); in neigh_for_each()
3093 read_lock_bh(&tbl->lock); /* avoid resizes */ in neigh_for_each()
3102 read_unlock_bh(&tbl->lock); in neigh_for_each()
3108 void __neigh_for_each_release(struct neigh_table *tbl, in __neigh_for_each_release() argument
3114 nht = rcu_dereference_protected(tbl->nht, in __neigh_for_each_release()
3115 lockdep_is_held(&tbl->lock)); in __neigh_for_each_release()
3122 lockdep_is_held(&tbl->lock))) != NULL) { in __neigh_for_each_release()
3130 lockdep_is_held(&tbl->lock))); in __neigh_for_each_release()
3147 struct neigh_table *tbl; in neigh_xmit() local
3150 tbl = neigh_tables[index]; in neigh_xmit()
3151 if (!tbl) in neigh_xmit()
3159 neigh = __neigh_lookup_noref(tbl, addr, dev); in neigh_xmit()
3162 neigh = __neigh_create(tbl, addr, dev, false); in neigh_xmit()
3294 struct neigh_table *tbl = state->tbl; in pneigh_get_first() local
3300 pn = tbl->phash_buckets[bucket]; in pneigh_get_first()
3317 struct neigh_table *tbl = state->tbl; in pneigh_get_next() local
3326 pn = tbl->phash_buckets[state->bucket]; in pneigh_get_next()
3367 void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl, unsigned int neig… in neigh_seq_start() argument
3368 __acquires(tbl->lock) in neigh_seq_start()
3373 state->tbl = tbl; in neigh_seq_start()
3378 state->nht = rcu_dereference(tbl->nht); in neigh_seq_start()
3379 read_lock_bh(&tbl->lock); in neigh_seq_start()
3413 __releases(tbl->lock) in neigh_seq_stop()
3417 struct neigh_table *tbl = state->tbl; in neigh_seq_stop() local
3419 read_unlock_bh(&tbl->lock); in neigh_seq_stop()
3428 struct neigh_table *tbl = pde_data(file_inode(seq->file)); in neigh_stat_seq_start() local
3438 return per_cpu_ptr(tbl->stats, cpu); in neigh_stat_seq_start()
3445 struct neigh_table *tbl = pde_data(file_inode(seq->file)); in neigh_stat_seq_next() local
3452 return per_cpu_ptr(tbl->stats, cpu); in neigh_stat_seq_next()
3465 struct neigh_table *tbl = pde_data(file_inode(seq->file)); in neigh_stat_seq_show() local
3476 atomic_read(&tbl->entries), in neigh_stat_seq_show()
3814 struct neigh_table *tbl = p->tbl; in neigh_sysctl_register() local
3816 t->neigh_vars[NEIGH_VAR_GC_INTERVAL].data = &tbl->gc_interval; in neigh_sysctl_register()
3817 t->neigh_vars[NEIGH_VAR_GC_THRESH1].data = &tbl->gc_thresh1; in neigh_sysctl_register()
3818 t->neigh_vars[NEIGH_VAR_GC_THRESH2].data = &tbl->gc_thresh2; in neigh_sysctl_register()
3819 t->neigh_vars[NEIGH_VAR_GC_THRESH3].data = &tbl->gc_thresh3; in neigh_sysctl_register()