: Reorganize struct dccp_sock to save 8 bytes
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): 1201904616-4944-1-git-send-email-y
A message that is not in the archive (sent off-list or not yet received): 1201904616-4944-2-git-send-email-y
A message that is not in the archive (sent off-list or not yet received): 1201904616-4944-3-git-send-email-y
PATCH 3/5 : Reorganize struct dccp_sock to save 8 bytes
From: Arnaldo Carvalho de Melo <[email protected]>
/home/acme/git/net-2.6/net/dccp/ipv6.c:
struct dccp_sock | -8 struct dccp6_sock | -8
2 structs changed
--- include/linux/dccp.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/dccp.h +1 -1
@@ -525,6 +525,7 @@ struct dccp_sock {__u64 dccps_gsr;__u64 dccps_gar;__be32 dccps_service; +__u32 dccps_mss_cache;struct dccp_service_list *dccps_service_list;__u32 dccps_timestamp_echo;__u32 dccps_timestamp_time;
@@ -533,7 +534,6 @@ struct dccp_sock {__u16 dccps_pcslen;__u16 dccps_pcrlen;unsigned long dccps_ndp_count; -__u32 dccps_mss_cache;unsigned long dccps_rate_last;struct dccp_minisock dccps_minisock;struct dccp_ackvec *dccps_hc_rx_ackvec;
Signature · 1 line
1.5.3.8
A message that is not in the archive (sent off-list or not yet received): 1201904616-4944-4-git-send-email-y
A message that is not in the archive (sent off-list or not yet received): 1201904616-4944-5-git-send-email-y
PATCH 5/5 : Reorg struct ifmcaddr6 to save some bytes
From: Arnaldo Carvalho de Melo <[email protected]>
/home/acme/git/net-2.6/net/ipv6/mcast.c:
struct ifmcaddr6 | -8
1 struct changed
igmp6_group_dropped | -6 add_grec | -3 mld_ifc_timer_expire | -18 ip6_mc_add_src | -3 ip6_mc_del_src | -3 igmp6_group_added | -3
6 functions changed, 36 bytes removed, diff: -36
ipv6.ko:
6 functions changed, 36 bytes removed, diff: -36
--- include/net/if_inet6.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/net/if_inet6.h +1 -1
@@ -112,13 +112,13 @@ struct ifmcaddr6struct ip6_sf_list *mca_sources;struct ip6_sf_list *mca_tomb;unsigned int mca_sfmode; +unsigned char mca_crcount;unsigned long mca_sfcount[2 ];struct timer_list mca_timer;unsigned mca_flags;int mca_users;atomic_t mca_refcnt;spinlock_t mca_lock; -unsigned char mca_crcount;unsigned long mca_cstamp;unsigned long mca_tstamp; };
Signature · 1 line
1.5.3.8
PATCH 4/5 : Reorganize struct inet_timewait_sock to save some bytes
In reply to a message not in the archiveFrom: Arnaldo Carvalho de Melo <[email protected]>
/home/acme/git/net-2.6/net/ipv6/tcp_ipv6.c:
struct inet_timewait_sock | -8 struct tcp_timewait_sock | -8
2 structs changed
tcp_v6_rcv | -6
1 function changed, 6 bytes removed, diff: -6
--- include/net/inet_timewait_sock.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/net/inet_timewait_sock.h +1 -1
@@ -116,6 +116,7 @@ struct inet_timewait_sock {#define tw_hash __tw_common.skc_hash#define tw_prot __tw_common.skc_prot#define tw_net __tw_common.skc_net +int tw_timeout;volatile unsigned char tw_substate;/* 3 bits hole, try to pack */ unsigned char tw_rcv_wscale;
@@ -130,7 +131,6 @@ struct inet_timewait_sock { __u8 tw_ipv6only:1;/* 15 bits hole, try to pack */ __u16 tw_ipv6_offset; -int tw_timeout;unsigned long tw_ttd;struct inet_bind_bucket *tw_tb;struct hlist_node tw_death_node;
Signature · 1 line
1.5.3.8
PATCH 2/5 : Reorganize struct inet6_dev to save 8 bytes
In reply to a message not in the archiveFrom: Arnaldo Carvalho de Melo <[email protected]>
And make it a multiple of a 64 bytes, reducing cacheline trashing:
Before:
[acme@doppio net-2.6]$ pahole -C inet6_dev net/dccp/ipv6.o
struct inet6_dev {
<SNIP>
long unsigned int mc_maxdelay; /* 48 8 */
unsigned char mc_qrv; /* 56 1 */
unsigned char mc_gq_running; /* 57 1 */
unsigned char mc_ifc_count; /* 58 1 */
/* XXX 5 bytes hole, try to pack */
/* --- cacheline 1 boundary (64 bytes) --- */
struct timer_list mc_gq_timer; /* 64 48 */
<SNIP>
__u32 if_flags; /* 180 4 */
int dead; /* 184 4 */
u8 rndid[8]; /* 188 8 */
/* XXX 4 bytes hole, try to pack */
/* --- cacheline 3 boundary (192 bytes) was 8 bytes ago --- */
struct timer_list regen_timer; /* 200 48 */
<SNIP>
/* size: 456, cachelines: 8 */
/* sum members: 447, holes: 2, sum holes: 9 */
/* last cacheline: 8 bytes */
};After:
net-2.6/net/ipv6/af_inet6.c:
struct inet6_dev | -8
1 struct changed
--- include/net/if_inet6.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/net/if_inet6.h +2 -2
@@ -166,11 +166,11 @@ struct inet6_devstruct ifmcaddr6 *mc_list;struct ifmcaddr6 *mc_tomb;rwlock_t mc_lock; -unsigned long mc_v1_seen; -unsigned long mc_maxdelay;unsigned char mc_qrv;unsigned char mc_gq_running;unsigned char mc_ifc_count; +unsigned long mc_v1_seen; +unsigned long mc_maxdelay;struct timer_list mc_gq_timer;/* general query timer */ struct timer_list mc_ifc_timer;/* interface change timer */
Signature · 1 line
1.5.3.8
PATCH 1/5 proto: Add hashinfo member to struct proto
In reply to a message not in the archiveFrom: Arnaldo Carvalho de Melo <[email protected]>
This way we can remove TCP and DCCP specific versions of
sk->sk_prot->get_port: both v4 and v6 use inet_csk_get_portsk->sk_prot->hash: inet_hash is directly used, only v6 need
a specific version to deal with mapped socketssk->sk_prot->unhash: both v4 and v6 use inet_hash directly
struct inet_connection_sock_af_ops also gets a new member, bind_conflict, so that inet_csk_get_port can find the per family routine.
Now only the lookup routines receive as a parameter a struct inet_hashtable.
With this we further reuse code, reducing the difference among INET transport protocols.
Eventually work has to be done on UDP and SCTP to make them share this infrastructure and get as a bonus inet_diag interfaces so that iproute can be used with these protocols.
net-2.6/net/ipv4/inet_hashtables.c:
struct proto | +8
struct inet_connection_sock_af_ops | +8
2 structs changed
__inet_hash_nolisten | +18 __inet_hash | -210 inet_put_port | +8 inet_bind_bucket_create | +1 __inet_hash_connect | -8
5 functions changed, 27 bytes added, 218 bytes removed, diff: -191
net-2.6/net/core/sock.c:
proto_seq_show | +3
1 function changed, 3 bytes added, diff: +3
net-2.6/net/ipv4/inet_connection_sock.c:
inet_csk_get_port | +15
1 function changed, 15 bytes added, diff: +15
net-2.6/net/ipv4/tcp.c:
tcp_set_state | -7
1 function changed, 7 bytes removed, diff: -7
net-2.6/net/ipv4/tcp_ipv4.c:
tcp_v4_get_port | -31 tcp_v4_hash | -48 tcp_v4_destroy_sock | -7 tcp_v4_syn_recv_sock | -2 tcp_unhash | -179
5 functions changed, 267 bytes removed, diff: -267
net-2.6/net/ipv6/inet6_hashtables.c:
__inet6_hash | +8
1 function changed, 8 bytes added, diff: +8
net-2.6/net/ipv4/inet_hashtables.c:
inet_unhash | +190
inet_hash | +242
2 functions changed, 432 bytes added, diff: +432
vmlinux:
16 functions changed, 485 bytes added, 492 bytes removed, diff: -7
/home/acme/git/net-2.6/net/ipv6/tcp_ipv6.c:
tcp_v6_get_port | -31 tcp_v6_hash | -7 tcp_v6_syn_recv_sock | -9
3 functions changed, 47 bytes removed, diff: -47
/home/acme/git/net-2.6/net/dccp/proto.c:
dccp_destroy_sock | -7 dccp_unhash | -179 dccp_hash | -49 dccp_set_state | -7 dccp_done | +1
5 functions changed, 1 bytes added, 242 bytes removed, diff: -241
/home/acme/git/net-2.6/net/dccp/ipv4.c:
dccp_v4_get_port | -31
dccp_v4_request_recv_sock | -2
2 functions changed, 33 bytes removed, diff: -33
/home/acme/git/net-2.6/net/dccp/ipv6.c:
dccp_v6_get_port | -31 dccp_v6_hash | -7 dccp_v6_request_recv_sock | +5
3 functions changed, 5 bytes added, 38 bytes removed, diff: -33
--- include/net/inet6_hashtables.h | 2 +- include/net/inet_connection_sock.h | 8 ++--- include/net/inet_hashtables.h | 51 +++++-------------------------- include/net/sock.h | 3 ++ net/dccp/dccp.h | 2 - net/dccp/ipv4.c | 18 ++++------- net/dccp/ipv6.c | 20 +++++------- net/dccp/proto.c | 18 +---------- net/ipv4/inet_connection_sock.c | 8 ++--- net/ipv4/inet_hashtables.c | 58 +++++++++++++++++++++++++++++------ net/ipv4/tcp.c | 2 +- net/ipv4/tcp_ipv4.c | 31 +++++-------------- net/ipv6/inet6_hashtables.c | 4 +- net/ipv6/tcp_ipv6.c | 19 +++++------- 14 files changed, 103 insertions(+), 141 deletions(-)
include/net/inet6_hashtables.h +1 -1
@@ -49,7 +49,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)return inet6_ehashfn (laddr, lport, faddr, fport); } -extern void __inet6_hash (struct inet_hashinfo *hashinfo,struct sock *sk); +extern void __inet6_hash (struct sock *sk);/* * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
include/net/inet_connection_sock.h +3 -5
@@ -29,7 +29,6 @@#undef INET_CSK_CLEAR_TIMERSstruct inet_bind_bucket ; -struct inet_hashinfo ;struct tcp_congestion_ops ;/*
@@ -59,6 +58,8 @@ struct inet_connection_sock_af_ops { int level, int optname, char __user *optval, int __user *optlen);void (*addr2sockaddr)(struct sock *sk,struct sockaddr *); +int (*bind_conflict)(const struct sock *sk, +const struct inet_bind_bucket *tb); };/** inet_connection_sock - INET connection oriented sock
@@ -244,10 +245,7 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk, const __be32 laddr);extern int inet_csk_bind_conflict (const struct sock *sk,const struct inet_bind_bucket *tb); -extern int inet_csk_get_port (struct inet_hashinfo *hashinfo, -struct sock *sk,unsigned short snum, -int (*bind_conflict)(const struct sock *sk, -const struct inet_bind_bucket *tb)); +extern int inet_csk_get_port (struct sock *sk,unsigned short snum);extern struct dst_entry *inet_csk_route_req (struct sock *sk,const struct request_sock *req);
include/net/inet_hashtables.h +9 -42
81 lines not on this page · raw message
include/net/sock.h +3 -0
@@ -496,6 +496,7 @@ extern int sk_wait_data(struct sock *sk, long *timeo);struct request_sock_ops ;struct timewait_sock_ops ; +struct inet_hashinfo ;/* Networking protocol blocks we attach to sockets. * socket layer -> transport layer interface
@@ -578,6 +579,8 @@ struct proto {struct request_sock_ops *rsk_prot;struct timewait_sock_ops *twsk_prot; +struct inet_hashinfo *hashinfo; +struct module *owner;char name[32 ];
net/dccp/dccp.h +0 -2
@@ -271,8 +271,6 @@ extern struct sk_buff *dccp_make_response(struct sock *sk,extern int dccp_connect (struct sock *sk);extern int dccp_disconnect (struct sock *sk,int flags); -extern void dccp_hash (struct sock *sk); -extern void dccp_unhash (struct sock *sk);extern int dccp_getsockopt (struct sock *sk,int level,int optname,char __user *optval,int __user *optlen); extern int dccp_setsockopt(struct sock *sk, int level, int optname,
net/dccp/ipv4.c +7 -11
@@ -38,12 +38,6 @@*/ static struct socket *dccp_v4_ctl_socket; -static int dccp_v4_get_port (struct sock *sk,const unsigned short snum) -{ -return inet_csk_get_port (&dccp_hashinfo, sk, snum, - inet_csk_bind_conflict); -} -int dccp_v4_connect (struct sock *sk,struct sockaddr *uaddr,int addr_len) {struct inet_sock *inet =inet_sk (sk);
@@ -408,8 +402,8 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,dccp_sync_mss (newsk,dst_mtu (dst)); -__inet_hash_nolisten (&dccp_hashinfo, newsk); -__inet_inherit_port (&dccp_hashinfo, sk, newsk); +__inet_hash_nolisten (newsk); +__inet_inherit_port (sk, newsk);return newsk;
@@ -898,6 +892,7 @@ static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { .getsockopt = ip_getsockopt, .addr2sockaddr = inet_csk_addr2sockaddr, .sockaddr_len = sizeof(struct sockaddr_in), + .bind_conflict = inet_csk_bind_conflict, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_ip_setsockopt, .compat_getsockopt = compat_ip_getsockopt,
@@ -937,10 +932,10 @@ static struct proto dccp_v4_prot = { .sendmsg = dccp_sendmsg, .recvmsg = dccp_recvmsg, .backlog_rcv = dccp_v4_do_rcv, - .hash = dccp_hash, - .unhash = dccp_unhash, + .hash = inet_hash, + .unhash = inet_unhash, .accept = inet_csk_accept, - .get_port = dccp_v4_get_port, + .get_port = inet_csk_get_port, .shutdown = dccp_shutdown, .destroy = dccp_destroy_sock, .orphan_count = &dccp_orphan_count,
@@ -948,6 +943,7 @@ static struct proto dccp_v4_prot = { .obj_size = sizeof(struct dccp_sock), .rsk_prot = &dccp_request_sock_ops, .twsk_prot = &dccp_timewait_sock_ops, + .hashinfo = &dccp_hashinfo, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_dccp_setsockopt, .compat_getsockopt = compat_dccp_getsockopt,
net/dccp/ipv6.c +8 -12
@@ -39,21 +39,15 @@ static struct socket *dccp_v6_ctl_socket;static struct inet_connection_sock_af_ops dccp_ipv6_mapped;static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; -static int dccp_v6_get_port (struct sock *sk,unsigned short snum) -{ -return inet_csk_get_port (&dccp_hashinfo, sk, snum, - inet6_csk_bind_conflict); -} -static void dccp_v6_hash (struct sock *sk) {if (sk->sk_state !=DCCP_CLOSED ) {if (inet_csk (sk)->icsk_af_ops == &dccp_ipv6_mapped) { -dccp_hash (sk); +inet_hash (sk);return ; }local_bh_disable (); -__inet6_hash (&dccp_hashinfo, sk); +__inet6_hash (sk);local_bh_enable (); } }
@@ -630,8 +624,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, newinet->daddr = newinet->saddr = newinet->rcv_saddr =LOOPBACK4_IPV6 ; -__inet6_hash (&dccp_hashinfo, newsk); -inet_inherit_port (&dccp_hashinfo, sk, newsk); +__inet6_hash (newsk); +inet_inherit_port (sk, newsk);return newsk;
@@ -1054,6 +1048,7 @@ static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = { .getsockopt = ipv6_getsockopt, .addr2sockaddr = inet6_csk_addr2sockaddr, .sockaddr_len = sizeof(struct sockaddr_in6), + .bind_conflict = inet6_csk_bind_conflict, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_ipv6_setsockopt, .compat_getsockopt = compat_ipv6_getsockopt,
@@ -1123,9 +1118,9 @@ static struct proto dccp_v6_prot = { .recvmsg = dccp_recvmsg, .backlog_rcv = dccp_v6_do_rcv, .hash = dccp_v6_hash, - .unhash = dccp_unhash, + .unhash = inet_unhash, .accept = inet_csk_accept, - .get_port = dccp_v6_get_port, + .get_port = inet_csk_get_port, .shutdown = dccp_shutdown, .destroy = dccp_v6_destroy_sock, .orphan_count = &dccp_orphan_count,
@@ -1133,6 +1128,7 @@ static struct proto dccp_v6_prot = { .obj_size = sizeof(struct dccp6_sock), .rsk_prot = &dccp6_request_sock_ops, .twsk_prot = &dccp6_timewait_sock_ops, + .hashinfo = &dccp_hashinfo, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_dccp_setsockopt, .compat_getsockopt = compat_dccp_getsockopt,
net/dccp/proto.c +2 -16
@@ -78,7 +78,7 @@ void dccp_set_state(struct sock *sk, const int state) sk->sk_prot->unhash (sk);if (inet_csk (sk)->icsk_bind_hash !=NULL && !(sk->sk_userlocks &SOCK_BINDPORT_LOCK )) -inet_put_port (&dccp_hashinfo, sk); +inet_put_port (sk);/* fall through */ default :if (oldstate ==DCCP_OPEN )
@@ -173,20 +173,6 @@ const char *dccp_state_name(const int state)EXPORT_SYMBOL_GPL (dccp_state_name); -void dccp_hash (struct sock *sk) -{ -inet_hash (&dccp_hashinfo, sk); -} - -EXPORT_SYMBOL_GPL (dccp_hash); - -void dccp_unhash (struct sock *sk) -{ -inet_unhash (&dccp_hashinfo, sk); -} - -EXPORT_SYMBOL_GPL (dccp_unhash); -int dccp_init_sock (struct sock *sk,const __u8 ctl_sock_initialized) {struct dccp_sock *dp =dccp_sk (sk);
@@ -268,7 +254,7 @@ int dccp_destroy_sock(struct sock *sk)/* Clean up a referenced DCCP bind bucket. */ if (inet_csk (sk)->icsk_bind_hash !=NULL ) -inet_put_port (&dccp_hashinfo, sk); +inet_put_port (sk);kfree (dp->dccps_service_list); dp->dccps_service_list =NULL ;
net/ipv4/inet_connection_sock.c +3 -5
@@ -78,11 +78,9 @@ EXPORT_SYMBOL_GPL(inet_csk_bind_conflict);/* Obtain a reference to a local port for the given sock, * if snum is zero it means select any available local port. */ -int inet_csk_get_port (struct inet_hashinfo *hashinfo, -struct sock *sk,unsigned short snum, -int (*bind_conflict)(const struct sock *sk, -const struct inet_bind_bucket *tb)) +int inet_csk_get_port (struct sock *sk,unsigned short snum) { +struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo;struct inet_bind_hashbucket *head;struct hlist_node *node;struct inet_bind_bucket *tb;
@@ -142,7 +140,7 @@ tb_found: goto success; }else { ret =1 ; -if (bind_conflict (sk, tb)) +if (inet_csk (sk)->icsk_af_ops->bind_conflict (sk, tb)) goto fail_unlock; } }
net/ipv4/inet_hashtables.c +48 -10
114 lines not on this page · raw message
net/ipv4/tcp.c +1 -1
@@ -1669,7 +1669,7 @@ void tcp_set_state(struct sock *sk, int state) sk->sk_prot->unhash (sk);if (inet_csk (sk)->icsk_bind_hash && !(sk->sk_userlocks &SOCK_BINDPORT_LOCK )) -inet_put_port (&tcp_hashinfo, sk); +inet_put_port (sk);/* fall through */ default :if (oldstate==TCP_ESTABLISHED )
net/ipv4/tcp_ipv4.c +8 -23
@@ -108,22 +108,6 @@ struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait), }; -static int tcp_v4_get_port (struct sock *sk,unsigned short snum) -{ -return inet_csk_get_port (&tcp_hashinfo, sk, snum, - inet_csk_bind_conflict); -} - -static void tcp_v4_hash (struct sock *sk) -{ -inet_hash (&tcp_hashinfo, sk); -} - -void tcp_unhash (struct sock *sk) -{ -inet_unhash (&tcp_hashinfo, sk); -} -static inline __u32 tcp_v4_init_sequence (struct sk_buff *skb) { return secure_tcp_sequence_number(ip_hdr(skb)->daddr,
@@ -1478,8 +1462,8 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, }#endif -__inet_hash_nolisten (&tcp_hashinfo, newsk); -__inet_inherit_port (&tcp_hashinfo, sk, newsk); +__inet_hash_nolisten (newsk); +__inet_inherit_port (sk, newsk);return newsk;
@@ -1827,6 +1811,7 @@ struct inet_connection_sock_af_ops ipv4_specific = { .getsockopt = ip_getsockopt, .addr2sockaddr = inet_csk_addr2sockaddr, .sockaddr_len = sizeof(struct sockaddr_in), + .bind_conflict = inet_csk_bind_conflict, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_ip_setsockopt, .compat_getsockopt = compat_ip_getsockopt,
@@ -1926,7 +1911,7 @@ int tcp_v4_destroy_sock(struct sock *sk)/* Clean up a referenced TCP bind bucket. */ if (inet_csk (sk)->icsk_bind_hash) -inet_put_port (&tcp_hashinfo, sk); +inet_put_port (sk);/* * If sendmsg cached page exists, toss it.
@@ -2435,9 +2420,9 @@ struct proto tcp_prot = { .getsockopt = tcp_getsockopt, .recvmsg = tcp_recvmsg, .backlog_rcv = tcp_v4_do_rcv, - .hash = tcp_v4_hash, - .unhash = tcp_unhash, - .get_port = tcp_v4_get_port, + .hash = inet_hash, + .unhash = inet_unhash, + .get_port = inet_csk_get_port, .enter_memory_pressure = tcp_enter_memory_pressure, .sockets_allocated = &tcp_sockets_allocated, .orphan_count = &tcp_orphan_count,
@@ -2450,6 +2435,7 @@ struct proto tcp_prot = { .obj_size = sizeof(struct tcp_sock), .twsk_prot = &tcp_timewait_sock_ops, .rsk_prot = &tcp_request_sock_ops, + .hashinfo = &tcp_hashinfo, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_tcp_setsockopt, .compat_getsockopt = compat_tcp_getsockopt,
@@ -2467,7 +2453,6 @@ void __init tcp_v4_init(struct net_proto_family *ops)EXPORT_SYMBOL (ipv4_specific);EXPORT_SYMBOL (tcp_hashinfo);EXPORT_SYMBOL (tcp_prot); -EXPORT_SYMBOL (tcp_unhash);EXPORT_SYMBOL (tcp_v4_conn_request);EXPORT_SYMBOL (tcp_v4_connect);EXPORT_SYMBOL (tcp_v4_do_rcv);
net/ipv6/inet6_hashtables.c +2 -2
@@ -22,9 +22,9 @@#include <net/inet6_hashtables.h> #include <net/ip.h> -void __inet6_hash (struct inet_hashinfo *hashinfo, -struct sock *sk) +void __inet6_hash (struct sock *sk) { +struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo;struct hlist_head *list;rwlock_t *lock;
net/ipv6/tcp_ipv6.c +8 -11
@@ -86,12 +86,6 @@ static struct tcp_sock_af_ops tcp_sock_ipv6_specific;static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific;#endif -static int tcp_v6_get_port (struct sock *sk,unsigned short snum) -{ -return inet_csk_get_port (&tcp_hashinfo, sk, snum, - inet6_csk_bind_conflict); -} -static void tcp_v6_hash (struct sock *sk) {if (sk->sk_state !=TCP_CLOSE ) {
@@ -100,7 +94,7 @@ static void tcp_v6_hash(struct sock *sk)return ; }local_bh_disable (); -__inet6_hash (&tcp_hashinfo, sk); +__inet6_hash (sk);local_bh_enable (); } }
@@ -1504,8 +1498,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, }#endif -__inet6_hash (&tcp_hashinfo, newsk); -inet_inherit_port (&tcp_hashinfo, sk, newsk); +__inet6_hash (newsk); +inet_inherit_port (sk, newsk);return newsk;
@@ -1833,6 +1827,7 @@ static struct inet_connection_sock_af_ops ipv6_specific = { .getsockopt = ipv6_getsockopt, .addr2sockaddr = inet6_csk_addr2sockaddr, .sockaddr_len = sizeof(struct sockaddr_in6), + .bind_conflict = inet6_csk_bind_conflict, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_ipv6_setsockopt, .compat_getsockopt = compat_ipv6_getsockopt,
@@ -1864,6 +1859,7 @@ static struct inet_connection_sock_af_ops ipv6_mapped = { .getsockopt = ipv6_getsockopt, .addr2sockaddr = inet6_csk_addr2sockaddr, .sockaddr_len = sizeof(struct sockaddr_in6), + .bind_conflict = inet6_csk_bind_conflict, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_ipv6_setsockopt, .compat_getsockopt = compat_ipv6_getsockopt,
@@ -2127,8 +2123,8 @@ struct proto tcpv6_prot = { .recvmsg = tcp_recvmsg, .backlog_rcv = tcp_v6_do_rcv, .hash = tcp_v6_hash, - .unhash = tcp_unhash, - .get_port = tcp_v6_get_port, + .unhash = inet_unhash, + .get_port = inet_csk_get_port, .enter_memory_pressure = tcp_enter_memory_pressure, .sockets_allocated = &tcp_sockets_allocated, .memory_allocated = &tcp_memory_allocated,
@@ -2141,6 +2137,7 @@ struct proto tcpv6_prot = { .obj_size = sizeof(struct tcp6_sock), .twsk_prot = &tcp6_timewait_sock_ops, .rsk_prot = &tcp6_request_sock_ops, + .hashinfo = &tcp_hashinfo, #ifdef CONFIG_COMPAT .compat_setsockopt = compat_tcp_setsockopt, .compat_getsockopt = compat_tcp_getsockopt,
Signature · 1 line
1.5.3.8