mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
tcp: Remove dead code and fields for bhash2.
Now all sockets including TIME_WAIT are linked to bhash2 using sock_common.skc_bind_node. We no longer use inet_bind2_bucket.deathrow, sock.sk_bind2_node, and inet_timewait_sock.tw_bind2_node. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
770041d337
commit
8191792c18
@ -107,10 +107,6 @@ struct inet_bind2_bucket {
|
|||||||
struct hlist_node bhash_node;
|
struct hlist_node bhash_node;
|
||||||
/* List of sockets hashed to this bucket */
|
/* List of sockets hashed to this bucket */
|
||||||
struct hlist_head owners;
|
struct hlist_head owners;
|
||||||
/* bhash has twsk in owners, but bhash2 has twsk in
|
|
||||||
* deathrow not to add a member in struct sock_common.
|
|
||||||
*/
|
|
||||||
struct hlist_head deathrow;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct net *ib_net(const struct inet_bind_bucket *ib)
|
static inline struct net *ib_net(const struct inet_bind_bucket *ib)
|
||||||
|
@ -75,13 +75,9 @@ struct inet_timewait_sock {
|
|||||||
struct timer_list tw_timer;
|
struct timer_list tw_timer;
|
||||||
struct inet_bind_bucket *tw_tb;
|
struct inet_bind_bucket *tw_tb;
|
||||||
struct inet_bind2_bucket *tw_tb2;
|
struct inet_bind2_bucket *tw_tb2;
|
||||||
struct hlist_node tw_bind2_node;
|
|
||||||
};
|
};
|
||||||
#define tw_tclass tw_tos
|
#define tw_tclass tw_tos
|
||||||
|
|
||||||
#define twsk_for_each_bound_bhash2(__tw, list) \
|
|
||||||
hlist_for_each_entry(__tw, list, tw_bind2_node)
|
|
||||||
|
|
||||||
static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
|
static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
|
||||||
{
|
{
|
||||||
return (struct inet_timewait_sock *)sk;
|
return (struct inet_timewait_sock *)sk;
|
||||||
|
@ -352,7 +352,6 @@ struct sk_filter;
|
|||||||
* @sk_txtime_report_errors: set report errors mode for SO_TXTIME
|
* @sk_txtime_report_errors: set report errors mode for SO_TXTIME
|
||||||
* @sk_txtime_unused: unused txtime flags
|
* @sk_txtime_unused: unused txtime flags
|
||||||
* @ns_tracker: tracker for netns reference
|
* @ns_tracker: tracker for netns reference
|
||||||
* @sk_bind2_node: bind node in the bhash2 table
|
|
||||||
*/
|
*/
|
||||||
struct sock {
|
struct sock {
|
||||||
/*
|
/*
|
||||||
@ -544,7 +543,6 @@ struct sock {
|
|||||||
#endif
|
#endif
|
||||||
struct rcu_head sk_rcu;
|
struct rcu_head sk_rcu;
|
||||||
netns_tracker ns_tracker;
|
netns_tracker ns_tracker;
|
||||||
struct hlist_node sk_bind2_node;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sk_pacing {
|
enum sk_pacing {
|
||||||
@ -890,8 +888,6 @@ static inline void sk_add_bind_node(struct sock *sk,
|
|||||||
hlist_for_each_entry_safe(__sk, tmp, list, sk_node)
|
hlist_for_each_entry_safe(__sk, tmp, list, sk_node)
|
||||||
#define sk_for_each_bound(__sk, list) \
|
#define sk_for_each_bound(__sk, list) \
|
||||||
hlist_for_each_entry(__sk, list, sk_bind_node)
|
hlist_for_each_entry(__sk, list, sk_bind_node)
|
||||||
#define sk_for_each_bound_bhash2(__sk, list) \
|
|
||||||
hlist_for_each_entry(__sk, list, sk_bind2_node)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sk_for_each_entry_offset_rcu - iterate over a list at a given struct offset
|
* sk_for_each_entry_offset_rcu - iterate over a list at a given struct offset
|
||||||
|
@ -216,7 +216,6 @@ static bool inet_bhash2_conflict(const struct sock *sk,
|
|||||||
bool relax, bool reuseport_cb_ok,
|
bool relax, bool reuseport_cb_ok,
|
||||||
bool reuseport_ok)
|
bool reuseport_ok)
|
||||||
{
|
{
|
||||||
struct inet_timewait_sock *tw2;
|
|
||||||
struct sock *sk2;
|
struct sock *sk2;
|
||||||
|
|
||||||
sk_for_each_bound(sk2, &tb2->owners) {
|
sk_for_each_bound(sk2, &tb2->owners) {
|
||||||
@ -225,14 +224,6 @@ static bool inet_bhash2_conflict(const struct sock *sk,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
twsk_for_each_bound_bhash2(tw2, &tb2->deathrow) {
|
|
||||||
sk2 = (struct sock *)tw2;
|
|
||||||
|
|
||||||
if (__inet_bhash2_conflict(sk, sk2, sk_uid, relax,
|
|
||||||
reuseport_cb_ok, reuseport_ok))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,10 +231,6 @@ static bool inet_bhash2_conflict(const struct sock *sk,
|
|||||||
hlist_for_each_entry(__tb2, &(__tb)->bhash2, bhash_node) \
|
hlist_for_each_entry(__tb2, &(__tb)->bhash2, bhash_node) \
|
||||||
sk_for_each_bound(sk2, &(__tb2)->owners)
|
sk_for_each_bound(sk2, &(__tb2)->owners)
|
||||||
|
|
||||||
#define twsk_for_each_bound_bhash(__sk, __tb2, __tb) \
|
|
||||||
hlist_for_each_entry(__tb2, &(__tb)->bhash2, bhash_node) \
|
|
||||||
sk_for_each_bound_bhash2(sk2, &(__tb2)->deathrow)
|
|
||||||
|
|
||||||
/* This should be called only when the tb and tb2 hashbuckets' locks are held */
|
/* This should be called only when the tb and tb2 hashbuckets' locks are held */
|
||||||
static int inet_csk_bind_conflict(const struct sock *sk,
|
static int inet_csk_bind_conflict(const struct sock *sk,
|
||||||
const struct inet_bind_bucket *tb,
|
const struct inet_bind_bucket *tb,
|
||||||
@ -283,14 +270,6 @@ static int inet_csk_bind_conflict(const struct sock *sk,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
twsk_for_each_bound_bhash(sk2, tb2, tb) {
|
|
||||||
if (!inet_bind_conflict(sk, sk2, uid, relax, reuseport_cb_ok, reuseport_ok))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (inet_rcv_saddr_equal(sk, sk2, true))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,6 @@ static void inet_bind2_bucket_init(struct inet_bind2_bucket *tb2,
|
|||||||
tb2->rcv_saddr = sk->sk_rcv_saddr;
|
tb2->rcv_saddr = sk->sk_rcv_saddr;
|
||||||
#endif
|
#endif
|
||||||
INIT_HLIST_HEAD(&tb2->owners);
|
INIT_HLIST_HEAD(&tb2->owners);
|
||||||
INIT_HLIST_HEAD(&tb2->deathrow);
|
|
||||||
hlist_add_head(&tb2->node, &head->chain);
|
hlist_add_head(&tb2->node, &head->chain);
|
||||||
hlist_add_head(&tb2->bhash_node, &tb->bhash2);
|
hlist_add_head(&tb2->bhash_node, &tb->bhash2);
|
||||||
}
|
}
|
||||||
@ -144,7 +143,7 @@ struct inet_bind2_bucket *inet_bind2_bucket_create(struct kmem_cache *cachep,
|
|||||||
/* Caller must hold hashbucket lock for this tb with local BH disabled */
|
/* Caller must hold hashbucket lock for this tb with local BH disabled */
|
||||||
void inet_bind2_bucket_destroy(struct kmem_cache *cachep, struct inet_bind2_bucket *tb)
|
void inet_bind2_bucket_destroy(struct kmem_cache *cachep, struct inet_bind2_bucket *tb)
|
||||||
{
|
{
|
||||||
if (hlist_empty(&tb->owners) && hlist_empty(&tb->deathrow)) {
|
if (hlist_empty(&tb->owners)) {
|
||||||
__hlist_del(&tb->node);
|
__hlist_del(&tb->node);
|
||||||
__hlist_del(&tb->bhash_node);
|
__hlist_del(&tb->bhash_node);
|
||||||
kmem_cache_free(cachep, tb);
|
kmem_cache_free(cachep, tb);
|
||||||
|
Loading…
Reference in New Issue
Block a user