inet: rename some inet_sock fields
In order to have better cache layouts of struct sock (separate zones for rx/tx paths), we need this preliminary patch. Goal is to transfert fields used at lookup time in the first read-mostly cache line (inside struct sock_common) and move sk_refcnt to a separate cache line (only written by rx path) This patch adds inet_ prefix to daddr, rcv_saddr, dport, num, saddr, sport and id fields. This allows a future patch to define these fields as macros, like sk_refcnt, without name clashes. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
988ade6b8e
commit
c720c7e838
@@ -185,7 +185,7 @@ lookup_protocol:
|
||||
inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0;
|
||||
|
||||
if (SOCK_RAW == sock->type) {
|
||||
inet->num = protocol;
|
||||
inet->inet_num = protocol;
|
||||
if (IPPROTO_RAW == protocol)
|
||||
inet->hdrincl = 1;
|
||||
}
|
||||
@@ -228,12 +228,12 @@ lookup_protocol:
|
||||
*/
|
||||
sk_refcnt_debug_inc(sk);
|
||||
|
||||
if (inet->num) {
|
||||
if (inet->inet_num) {
|
||||
/* It assumes that any protocol which allows
|
||||
* the user to assign a number at socket
|
||||
* creation time automatically shares.
|
||||
*/
|
||||
inet->sport = htons(inet->num);
|
||||
inet->inet_sport = htons(inet->inet_num);
|
||||
sk->sk_prot->hash(sk);
|
||||
}
|
||||
if (sk->sk_prot->init) {
|
||||
@@ -281,7 +281,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
||||
lock_sock(sk);
|
||||
|
||||
/* Check these errors (active socket, double bind). */
|
||||
if (sk->sk_state != TCP_CLOSE || inet->num) {
|
||||
if (sk->sk_state != TCP_CLOSE || inet->inet_num) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@@ -353,8 +353,8 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
||||
}
|
||||
}
|
||||
|
||||
inet->rcv_saddr = v4addr;
|
||||
inet->saddr = v4addr;
|
||||
inet->inet_rcv_saddr = v4addr;
|
||||
inet->inet_saddr = v4addr;
|
||||
|
||||
ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr);
|
||||
|
||||
@@ -375,9 +375,9 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
||||
}
|
||||
if (snum)
|
||||
sk->sk_userlocks |= SOCK_BINDPORT_LOCK;
|
||||
inet->sport = htons(inet->num);
|
||||
inet->dport = 0;
|
||||
inet->daddr = 0;
|
||||
inet->inet_sport = htons(inet->inet_num);
|
||||
inet->inet_dport = 0;
|
||||
inet->inet_daddr = 0;
|
||||
out:
|
||||
release_sock(sk);
|
||||
return err;
|
||||
@@ -441,12 +441,12 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
|
||||
sin->sin6_flowinfo = 0;
|
||||
sin->sin6_scope_id = 0;
|
||||
if (peer) {
|
||||
if (!inet->dport)
|
||||
if (!inet->inet_dport)
|
||||
return -ENOTCONN;
|
||||
if (((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_SYN_SENT)) &&
|
||||
peer == 1)
|
||||
return -ENOTCONN;
|
||||
sin->sin6_port = inet->dport;
|
||||
sin->sin6_port = inet->inet_dport;
|
||||
ipv6_addr_copy(&sin->sin6_addr, &np->daddr);
|
||||
if (np->sndflow)
|
||||
sin->sin6_flowinfo = np->flow_label;
|
||||
@@ -456,7 +456,7 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
|
||||
else
|
||||
ipv6_addr_copy(&sin->sin6_addr, &np->rcv_saddr);
|
||||
|
||||
sin->sin6_port = inet->sport;
|
||||
sin->sin6_port = inet->inet_sport;
|
||||
}
|
||||
if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
|
||||
sin->sin6_scope_id = sk->sk_bound_dev_if;
|
||||
@@ -655,8 +655,8 @@ int inet6_sk_rebuild_header(struct sock *sk)
|
||||
fl.fl6_flowlabel = np->flow_label;
|
||||
fl.oif = sk->sk_bound_dev_if;
|
||||
fl.mark = sk->sk_mark;
|
||||
fl.fl_ip_dport = inet->dport;
|
||||
fl.fl_ip_sport = inet->sport;
|
||||
fl.fl_ip_dport = inet->inet_dport;
|
||||
fl.fl_ip_sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
|
||||
if (np->opt && np->opt->srcrt) {
|
||||
|
Reference in New Issue
Block a user