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
@ -72,7 +72,7 @@ static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk,
|
||||
int is_multicast = ipv6_addr_is_multicast(loc_addr);
|
||||
|
||||
sk_for_each_from(sk, node)
|
||||
if (inet_sk(sk)->num == num) {
|
||||
if (inet_sk(sk)->inet_num == num) {
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
|
||||
if (!net_eq(sock_net(sk), net))
|
||||
@ -298,7 +298,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
|
||||
dev_put(dev);
|
||||
}
|
||||
|
||||
inet->rcv_saddr = inet->saddr = v4addr;
|
||||
inet->inet_rcv_saddr = inet->inet_saddr = v4addr;
|
||||
ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr);
|
||||
if (!(addr_type & IPV6_ADDR_MULTICAST))
|
||||
ipv6_addr_copy(&np->saddr, &addr->sin6_addr);
|
||||
@ -415,14 +415,14 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
skb_network_header_len(skb));
|
||||
if (!csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||
&ipv6_hdr(skb)->daddr,
|
||||
skb->len, inet->num, skb->csum))
|
||||
skb->len, inet->inet_num, skb->csum))
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
}
|
||||
if (!skb_csum_unnecessary(skb))
|
||||
skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||
&ipv6_hdr(skb)->daddr,
|
||||
skb->len,
|
||||
inet->num, 0));
|
||||
inet->inet_num, 0));
|
||||
|
||||
if (inet->hdrincl) {
|
||||
if (skb_checksum_complete(skb)) {
|
||||
@ -765,8 +765,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
|
||||
proto = ntohs(sin6->sin6_port);
|
||||
|
||||
if (!proto)
|
||||
proto = inet->num;
|
||||
else if (proto != inet->num)
|
||||
proto = inet->inet_num;
|
||||
else if (proto != inet->inet_num)
|
||||
return(-EINVAL);
|
||||
|
||||
if (proto > 255)
|
||||
@ -799,7 +799,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
|
||||
if (sk->sk_state != TCP_ESTABLISHED)
|
||||
return -EDESTADDRREQ;
|
||||
|
||||
proto = inet->num;
|
||||
proto = inet->inet_num;
|
||||
daddr = &np->daddr;
|
||||
fl.fl6_flowlabel = np->flow_label;
|
||||
}
|
||||
@ -966,7 +966,7 @@ static int do_rawv6_setsockopt(struct sock *sk, int level, int optname,
|
||||
|
||||
switch (optname) {
|
||||
case IPV6_CHECKSUM:
|
||||
if (inet_sk(sk)->num == IPPROTO_ICMPV6 &&
|
||||
if (inet_sk(sk)->inet_num == IPPROTO_ICMPV6 &&
|
||||
level == IPPROTO_IPV6) {
|
||||
/*
|
||||
* RFC3542 tells that IPV6_CHECKSUM socket
|
||||
@ -1006,7 +1006,7 @@ static int rawv6_setsockopt(struct sock *sk, int level, int optname,
|
||||
break;
|
||||
|
||||
case SOL_ICMPV6:
|
||||
if (inet_sk(sk)->num != IPPROTO_ICMPV6)
|
||||
if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
|
||||
return -EOPNOTSUPP;
|
||||
return rawv6_seticmpfilter(sk, level, optname, optval,
|
||||
optlen);
|
||||
@ -1029,7 +1029,7 @@ static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname,
|
||||
case SOL_RAW:
|
||||
break;
|
||||
case SOL_ICMPV6:
|
||||
if (inet_sk(sk)->num != IPPROTO_ICMPV6)
|
||||
if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
|
||||
return -EOPNOTSUPP;
|
||||
return rawv6_seticmpfilter(sk, level, optname, optval, optlen);
|
||||
case SOL_IPV6:
|
||||
@ -1086,7 +1086,7 @@ static int rawv6_getsockopt(struct sock *sk, int level, int optname,
|
||||
break;
|
||||
|
||||
case SOL_ICMPV6:
|
||||
if (inet_sk(sk)->num != IPPROTO_ICMPV6)
|
||||
if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
|
||||
return -EOPNOTSUPP;
|
||||
return rawv6_geticmpfilter(sk, level, optname, optval,
|
||||
optlen);
|
||||
@ -1109,7 +1109,7 @@ static int compat_rawv6_getsockopt(struct sock *sk, int level, int optname,
|
||||
case SOL_RAW:
|
||||
break;
|
||||
case SOL_ICMPV6:
|
||||
if (inet_sk(sk)->num != IPPROTO_ICMPV6)
|
||||
if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
|
||||
return -EOPNOTSUPP;
|
||||
return rawv6_geticmpfilter(sk, level, optname, optval, optlen);
|
||||
case SOL_IPV6:
|
||||
@ -1156,7 +1156,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
|
||||
|
||||
static void rawv6_close(struct sock *sk, long timeout)
|
||||
{
|
||||
if (inet_sk(sk)->num == IPPROTO_RAW)
|
||||
if (inet_sk(sk)->inet_num == IPPROTO_RAW)
|
||||
ip6_ra_control(sk, -1);
|
||||
ip6mr_sk_done(sk);
|
||||
sk_common_release(sk);
|
||||
@ -1175,7 +1175,7 @@ static int rawv6_init_sk(struct sock *sk)
|
||||
{
|
||||
struct raw6_sock *rp = raw6_sk(sk);
|
||||
|
||||
switch (inet_sk(sk)->num) {
|
||||
switch (inet_sk(sk)->inet_num) {
|
||||
case IPPROTO_ICMPV6:
|
||||
rp->checksum = 1;
|
||||
rp->offset = 2;
|
||||
@ -1225,7 +1225,7 @@ static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
|
||||
dest = &np->daddr;
|
||||
src = &np->rcv_saddr;
|
||||
destp = 0;
|
||||
srcp = inet_sk(sp)->num;
|
||||
srcp = inet_sk(sp)->inet_num;
|
||||
seq_printf(seq,
|
||||
"%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
|
||||
"%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n",
|
||||
|
Reference in New Issue
Block a user