Lines Matching refs:tb
79 struct inet_bind_bucket *tb = kmem_cache_alloc(cachep, GFP_ATOMIC); in inet_bind_bucket_create() local
81 if (tb) { in inet_bind_bucket_create()
82 write_pnet(&tb->ib_net, net); in inet_bind_bucket_create()
83 tb->l3mdev = l3mdev; in inet_bind_bucket_create()
84 tb->port = snum; in inet_bind_bucket_create()
85 tb->fastreuse = 0; in inet_bind_bucket_create()
86 tb->fastreuseport = 0; in inet_bind_bucket_create()
87 INIT_HLIST_HEAD(&tb->bhash2); in inet_bind_bucket_create()
88 hlist_add_head_rcu(&tb->node, &head->chain); in inet_bind_bucket_create()
90 return tb; in inet_bind_bucket_create()
96 void inet_bind_bucket_destroy(struct inet_bind_bucket *tb) in inet_bind_bucket_destroy() argument
100 if (hlist_empty(&tb->bhash2)) { in inet_bind_bucket_destroy()
101 hlist_del_rcu(&tb->node); in inet_bind_bucket_destroy()
102 kfree_rcu(tb, rcu); in inet_bind_bucket_destroy()
106 if (tb->fastreuse == -1 && tb->fastreuseport == -1) in inet_bind_bucket_destroy()
108 hlist_for_each_entry(tb2, &tb->bhash2, bhash_node) { in inet_bind_bucket_destroy()
112 tb->fastreuse = -1; in inet_bind_bucket_destroy()
113 tb->fastreuseport = -1; in inet_bind_bucket_destroy()
116 bool inet_bind_bucket_match(const struct inet_bind_bucket *tb, const struct net *net, in inet_bind_bucket_match() argument
119 return net_eq(ib_net(tb), net) && tb->port == port && in inet_bind_bucket_match()
120 tb->l3mdev == l3mdev; in inet_bind_bucket_match()
126 struct inet_bind_bucket *tb, in inet_bind2_bucket_init() argument
130 tb2->l3mdev = tb->l3mdev; in inet_bind2_bucket_init()
131 tb2->port = tb->port; in inet_bind2_bucket_init()
148 hlist_add_head(&tb2->bhash_node, &tb->bhash2); in inet_bind2_bucket_init()
154 struct inet_bind_bucket *tb, in inet_bind2_bucket_create() argument
160 inet_bind2_bucket_init(tb2, net, head, tb, sk); in inet_bind2_bucket_create()
166 void inet_bind2_bucket_destroy(struct kmem_cache *cachep, struct inet_bind2_bucket *tb) in inet_bind2_bucket_destroy() argument
170 if (hlist_empty(&tb->owners)) { in inet_bind2_bucket_destroy()
171 __hlist_del(&tb->node); in inet_bind2_bucket_destroy()
172 __hlist_del(&tb->bhash_node); in inet_bind2_bucket_destroy()
173 kmem_cache_free(cachep, tb); in inet_bind2_bucket_destroy()
177 if (tb->fastreuse == -1 && tb->fastreuseport == -1) in inet_bind2_bucket_destroy()
179 sk_for_each_bound(sk, &tb->owners) { in inet_bind2_bucket_destroy()
183 tb->fastreuse = -1; in inet_bind2_bucket_destroy()
184 tb->fastreuseport = -1; in inet_bind2_bucket_destroy()
200 void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, in inet_bind_hash() argument
204 inet_csk(sk)->icsk_bind_hash = tb; in inet_bind_hash()
217 struct inet_bind_bucket *tb; in __inet_put_port() local
225 tb = inet_csk(sk)->icsk_bind_hash; in __inet_put_port()
240 inet_bind_bucket_destroy(tb); in __inet_put_port()
261 struct inet_bind_bucket *tb; in __inet_inherit_port() local
270 tb = inet_csk(sk)->icsk_bind_hash; in __inet_inherit_port()
272 if (unlikely(!tb || !tb2)) { in __inet_inherit_port()
277 if (tb->port != port) { in __inet_inherit_port()
285 inet_bind_bucket_for_each(tb, &head->chain) { in __inet_inherit_port()
286 if (inet_bind_bucket_match(tb, net, port, l3mdev)) in __inet_inherit_port()
289 if (!tb) { in __inet_inherit_port()
290 tb = inet_bind_bucket_create(table->bind_bucket_cachep, in __inet_inherit_port()
292 if (!tb) { in __inet_inherit_port()
309 net, head2, tb, child); in __inet_inherit_port()
315 inet_csk_update_fastreuse(child, tb, tb2); in __inet_inherit_port()
316 inet_bind_hash(child, tb, tb2, port); in __inet_inherit_port()
324 inet_bind_bucket_destroy(tb); in __inet_inherit_port()
761 struct inet_bind_bucket *tb = inet_csk(sk)->icsk_bind_hash; in inet_reuseport_add_sock() local
771 inet_csk(sk2)->icsk_bind_hash == tb && in inet_reuseport_add_sock()
852 static bool inet_bind2_bucket_match(const struct inet_bind2_bucket *tb, in inet_bind2_bucket_match() argument
856 if (!net_eq(ib2_net(tb), net) || tb->port != port || in inet_bind2_bucket_match()
857 tb->l3mdev != l3mdev) in inet_bind2_bucket_match()
860 return inet_bind2_bucket_addr_match(tb, sk); in inet_bind2_bucket_match()
863 bool inet_bind2_bucket_match_addr_any(const struct inet_bind2_bucket *tb, const struct net *net, in inet_bind2_bucket_match_addr_any() argument
866 if (!net_eq(ib2_net(tb), net) || tb->port != port || in inet_bind2_bucket_match_addr_any()
867 tb->l3mdev != l3mdev) in inet_bind2_bucket_match_addr_any()
871 if (tb->addr_type == IPV6_ADDR_ANY) in inet_bind2_bucket_match_addr_any()
874 if (tb->addr_type != IPV6_ADDR_MAPPED) in inet_bind2_bucket_match_addr_any()
881 return tb->rcv_saddr == 0; in inet_bind2_bucket_match_addr_any()
1048 struct inet_bind_bucket *tb; in __inet_hash_connect() local
1096 hlist_for_each_entry_rcu(tb, &head->chain, node) { in __inet_hash_connect()
1097 if (!inet_bind_bucket_match(tb, net, port, l3mdev)) in __inet_hash_connect()
1099 if (tb->fastreuse >= 0 || tb->fastreuseport >= 0) { in __inet_hash_connect()
1116 inet_bind_bucket_for_each(tb, &head->chain) { in __inet_hash_connect()
1117 if (inet_bind_bucket_match(tb, net, port, l3mdev)) { in __inet_hash_connect()
1118 if (tb->fastreuse >= 0 || in __inet_hash_connect()
1119 tb->fastreuseport >= 0) in __inet_hash_connect()
1121 WARN_ON(hlist_empty(&tb->bhash2)); in __inet_hash_connect()
1130 tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, in __inet_hash_connect()
1132 if (!tb) { in __inet_hash_connect()
1137 tb->fastreuse = -1; in __inet_hash_connect()
1138 tb->fastreuseport = -1; in __inet_hash_connect()
1163 head2, tb, sk); in __inet_hash_connect()
1179 inet_bind_hash(sk, tb, tb2, port); in __inet_hash_connect()
1217 inet_bind_bucket_destroy(tb); in __inet_hash_connect()