Lines Matching refs:base
196 struct inet_peer_base *base) in lookup_rcu() argument
198 struct inet_peer *u = rcu_dereference(base->root); in lookup_rcu()
222 #define lookup_rightempty(start, base) \ argument
228 for (u = rcu_deref_locked(*v, base); \
232 u = rcu_deref_locked(*v, base); \
243 struct inet_peer_base *base) in peer_avl_rebalance() argument
251 node = rcu_deref_locked(*nodep, base); in peer_avl_rebalance()
252 l = rcu_deref_locked(node->avl_left, base); in peer_avl_rebalance()
253 r = rcu_deref_locked(node->avl_right, base); in peer_avl_rebalance()
259 ll = rcu_deref_locked(l->avl_left, base); in peer_avl_rebalance()
260 lr = rcu_deref_locked(l->avl_right, base); in peer_avl_rebalance()
271 lrl = rcu_deref_locked(lr->avl_left, base);/* lrl: RH or RH-1 */ in peer_avl_rebalance()
272 lrr = rcu_deref_locked(lr->avl_right, base);/* lrr: RH or RH-1 */ in peer_avl_rebalance()
287 rr = rcu_deref_locked(r->avl_right, base); in peer_avl_rebalance()
288 rl = rcu_deref_locked(r->avl_left, base); in peer_avl_rebalance()
299 rlr = rcu_deref_locked(rl->avl_right, base);/* rlr: LH or LH-1 */ in peer_avl_rebalance()
300 rll = rcu_deref_locked(rl->avl_left, base);/* rll: LH or LH-1 */ in peer_avl_rebalance()
319 #define link_to_pool(n, base) \ argument
326 peer_avl_rebalance(stack, stackptr, base); \
334 static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base, in unlink_from_pool() argument
339 if (lookup(&p->daddr, stack, base) != p) in unlink_from_pool()
348 t = lookup_rightempty(p, base); in unlink_from_pool()
349 BUG_ON(rcu_deref_locked(*stackptr[-1], base) != t); in unlink_from_pool()
361 peer_avl_rebalance(stack, stackptr, base); in unlink_from_pool()
362 base->total--; in unlink_from_pool()
367 static int inet_peer_gc(struct inet_peer_base *base, in inet_peer_gc() argument
375 if (base->total >= inet_peer_threshold) in inet_peer_gc()
380 base->total / inet_peer_threshold * HZ; in inet_peer_gc()
384 p = rcu_deref_locked(**stackptr, base); in inet_peer_gc()
398 unlink_from_pool(p, base, stack); in inet_peer_gc()
403 struct inet_peer *inet_getpeer(struct inet_peer_base *base, in inet_getpeer() argument
416 sequence = read_seqbegin(&base->lock); in inet_getpeer()
417 p = lookup_rcu(daddr, base); in inet_getpeer()
418 invalidated = read_seqretry(&base->lock, sequence); in inet_getpeer()
431 write_seqlock_bh(&base->lock); in inet_getpeer()
433 p = lookup(daddr, stack, base); in inet_getpeer()
436 write_sequnlock_bh(&base->lock); in inet_getpeer()
440 gccnt = inet_peer_gc(base, stack, stackptr); in inet_getpeer()
458 link_to_pool(p, base); in inet_getpeer()
459 base->total++; in inet_getpeer()
461 write_sequnlock_bh(&base->lock); in inet_getpeer()
527 void inetpeer_invalidate_tree(struct inet_peer_base *base) in inetpeer_invalidate_tree() argument
531 write_seqlock_bh(&base->lock); in inetpeer_invalidate_tree()
533 root = rcu_deref_locked(base->root, base); in inetpeer_invalidate_tree()
535 base->root = peer_avl_empty_rcu; in inetpeer_invalidate_tree()
536 base->total = 0; in inetpeer_invalidate_tree()
540 write_sequnlock_bh(&base->lock); in inetpeer_invalidate_tree()