Lines Matching refs:tb

71 	struct inet_bind_bucket *tb = kmem_cache_alloc(cachep, GFP_ATOMIC);  in inet_bind_bucket_create()  local
73 if (tb) { in inet_bind_bucket_create()
74 write_pnet(&tb->ib_net, net); in inet_bind_bucket_create()
75 tb->l3mdev = l3mdev; in inet_bind_bucket_create()
76 tb->port = snum; in inet_bind_bucket_create()
77 tb->fastreuse = 0; in inet_bind_bucket_create()
78 tb->fastreuseport = 0; in inet_bind_bucket_create()
79 INIT_HLIST_HEAD(&tb->bhash2); in inet_bind_bucket_create()
80 hlist_add_head_rcu(&tb->node, &head->chain); in inet_bind_bucket_create()
82 return tb; in inet_bind_bucket_create()
88 void inet_bind_bucket_destroy(struct inet_bind_bucket *tb) in inet_bind_bucket_destroy() argument
90 if (hlist_empty(&tb->bhash2)) { in inet_bind_bucket_destroy()
91 hlist_del_rcu(&tb->node); in inet_bind_bucket_destroy()
92 kfree_rcu(tb, rcu); in inet_bind_bucket_destroy()
96 bool inet_bind_bucket_match(const struct inet_bind_bucket *tb, const struct net *net, in inet_bind_bucket_match() argument
99 return net_eq(ib_net(tb), net) && tb->port == port && in inet_bind_bucket_match()
100 tb->l3mdev == l3mdev; in inet_bind_bucket_match()
106 struct inet_bind_bucket *tb, in inet_bind2_bucket_init() argument
110 tb2->l3mdev = tb->l3mdev; in inet_bind2_bucket_init()
111 tb2->port = tb->port; in inet_bind2_bucket_init()
126 hlist_add_head(&tb2->bhash_node, &tb->bhash2); in inet_bind2_bucket_init()
132 struct inet_bind_bucket *tb, in inet_bind2_bucket_create() argument
138 inet_bind2_bucket_init(tb2, net, head, tb, sk); in inet_bind2_bucket_create()
144 void inet_bind2_bucket_destroy(struct kmem_cache *cachep, struct inet_bind2_bucket *tb) in inet_bind2_bucket_destroy() argument
146 if (hlist_empty(&tb->owners)) { in inet_bind2_bucket_destroy()
147 __hlist_del(&tb->node); in inet_bind2_bucket_destroy()
148 __hlist_del(&tb->bhash_node); in inet_bind2_bucket_destroy()
149 kmem_cache_free(cachep, tb); in inet_bind2_bucket_destroy()
166 void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, in inet_bind_hash() argument
170 inet_csk(sk)->icsk_bind_hash = tb; in inet_bind_hash()
183 struct inet_bind_bucket *tb; in __inet_put_port() local
191 tb = inet_csk(sk)->icsk_bind_hash; in __inet_put_port()
205 inet_bind_bucket_destroy(tb); in __inet_put_port()
226 struct inet_bind_bucket *tb; in __inet_inherit_port() local
235 tb = inet_csk(sk)->icsk_bind_hash; in __inet_inherit_port()
237 if (unlikely(!tb || !tb2)) { in __inet_inherit_port()
242 if (tb->port != port) { in __inet_inherit_port()
250 inet_bind_bucket_for_each(tb, &head->chain) { in __inet_inherit_port()
251 if (inet_bind_bucket_match(tb, net, port, l3mdev)) in __inet_inherit_port()
254 if (!tb) { in __inet_inherit_port()
255 tb = inet_bind_bucket_create(table->bind_bucket_cachep, in __inet_inherit_port()
257 if (!tb) { in __inet_inherit_port()
274 net, head2, tb, child); in __inet_inherit_port()
280 inet_csk_update_fastreuse(tb, child); in __inet_inherit_port()
281 inet_bind_hash(child, tb, tb2, port); in __inet_inherit_port()
289 inet_bind_bucket_destroy(tb); in __inet_inherit_port()
722 struct inet_bind_bucket *tb = inet_csk(sk)->icsk_bind_hash; in inet_reuseport_add_sock() local
732 inet_csk(sk2)->icsk_bind_hash == tb && in inet_reuseport_add_sock()
829 static bool inet_bind2_bucket_match(const struct inet_bind2_bucket *tb, in inet_bind2_bucket_match() argument
833 if (!net_eq(ib2_net(tb), net) || tb->port != port || in inet_bind2_bucket_match()
834 tb->l3mdev != l3mdev) in inet_bind2_bucket_match()
837 return inet_bind2_bucket_addr_match(tb, sk); in inet_bind2_bucket_match()
840 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
843 if (!net_eq(ib2_net(tb), net) || tb->port != port || in inet_bind2_bucket_match_addr_any()
844 tb->l3mdev != l3mdev) in inet_bind2_bucket_match_addr_any()
848 if (tb->addr_type == IPV6_ADDR_ANY) in inet_bind2_bucket_match_addr_any()
851 if (tb->addr_type != IPV6_ADDR_MAPPED) in inet_bind2_bucket_match_addr_any()
858 return tb->rcv_saddr == 0; in inet_bind2_bucket_match_addr_any()
1021 struct inet_bind_bucket *tb; in __inet_hash_connect() local
1069 hlist_for_each_entry_rcu(tb, &head->chain, node) { in __inet_hash_connect()
1070 if (!inet_bind_bucket_match(tb, net, port, l3mdev)) in __inet_hash_connect()
1072 if (tb->fastreuse >= 0 || tb->fastreuseport >= 0) { in __inet_hash_connect()
1089 inet_bind_bucket_for_each(tb, &head->chain) { in __inet_hash_connect()
1090 if (inet_bind_bucket_match(tb, net, port, l3mdev)) { in __inet_hash_connect()
1091 if (tb->fastreuse >= 0 || in __inet_hash_connect()
1092 tb->fastreuseport >= 0) in __inet_hash_connect()
1094 WARN_ON(hlist_empty(&tb->bhash2)); in __inet_hash_connect()
1103 tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, in __inet_hash_connect()
1105 if (!tb) { in __inet_hash_connect()
1110 tb->fastreuse = -1; in __inet_hash_connect()
1111 tb->fastreuseport = -1; in __inet_hash_connect()
1136 head2, tb, sk); in __inet_hash_connect()
1150 inet_bind_hash(sk, tb, tb2, port); in __inet_hash_connect()
1187 inet_bind_bucket_destroy(tb); in __inet_hash_connect()