Commit 868c86bc authored by Al Viro's avatar Al Viro Committed by David S. Miller

[NET]: annotate csum_ipv6_magic() callers in net/*

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2bda2853
...@@ -89,9 +89,9 @@ static __inline__ int udp_lib_checksum_complete(struct sk_buff *skb) ...@@ -89,9 +89,9 @@ static __inline__ int udp_lib_checksum_complete(struct sk_buff *skb)
* @skb: sk_buff containing the filled-in UDP header * @skb: sk_buff containing the filled-in UDP header
* (checksum field must be zeroed out) * (checksum field must be zeroed out)
*/ */
static inline u32 udp_csum_outgoing(struct sock *sk, struct sk_buff *skb) static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
{ {
u32 csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0); __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0);
skb_queue_walk(&sk->sk_write_queue, skb) { skb_queue_walk(&sk->sk_write_queue, skb) {
csum = csum_add(csum, skb->csum); csum = csum_add(csum, skb->csum);
......
...@@ -124,10 +124,10 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) ...@@ -124,10 +124,10 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
return cscov; return cscov;
} }
static inline u32 udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
{ {
u32 csum = 0;
int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh);
__wsum csum = 0;
skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
......
...@@ -59,7 +59,7 @@ static void dccp_v6_hash(struct sock *sk) ...@@ -59,7 +59,7 @@ static void dccp_v6_hash(struct sock *sk)
} }
/* add pseudo-header to DCCP checksum stored in skb->csum */ /* add pseudo-header to DCCP checksum stored in skb->csum */
static inline u16 dccp_v6_csum_finish(struct sk_buff *skb, static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb,
struct in6_addr *saddr, struct in6_addr *saddr,
struct in6_addr *daddr) struct in6_addr *daddr)
{ {
......
...@@ -234,7 +234,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct ...@@ -234,7 +234,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
len, fl->proto, len, fl->proto,
skb->csum); skb->csum);
} else { } else {
u32 tmp_csum = 0; __wsum tmp_csum = 0;
skb_queue_walk(&sk->sk_write_queue, skb) { skb_queue_walk(&sk->sk_write_queue, skb) {
tmp_csum = csum_add(tmp_csum, skb->csum); tmp_csum = csum_add(tmp_csum, skb->csum);
...@@ -242,10 +242,10 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct ...@@ -242,10 +242,10 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
tmp_csum = csum_partial((char *)icmp6h, tmp_csum = csum_partial((char *)icmp6h,
sizeof(struct icmp6hdr), tmp_csum); sizeof(struct icmp6hdr), tmp_csum);
tmp_csum = csum_ipv6_magic(&fl->fl6_src, icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src,
&fl->fl6_dst, &fl->fl6_dst,
len, fl->proto, tmp_csum); len, fl->proto,
icmp6h->icmp6_cksum = tmp_csum; tmp_csum);
} }
ip6_push_pending_frames(sk); ip6_push_pending_frames(sk);
out: out:
...@@ -636,8 +636,8 @@ static int icmpv6_rcv(struct sk_buff **pskb) ...@@ -636,8 +636,8 @@ static int icmpv6_rcv(struct sk_buff **pskb)
break; break;
/* fall through */ /* fall through */
case CHECKSUM_NONE: case CHECKSUM_NONE:
skb->csum = ~csum_ipv6_magic(saddr, daddr, skb->len, skb->csum = ~csum_unfold(csum_ipv6_magic(saddr, daddr, skb->len,
IPPROTO_ICMPV6, 0); IPPROTO_ICMPV6, 0));
if (__skb_checksum_complete(skb)) { if (__skb_checksum_complete(skb)) {
LIMIT_NETDEBUG(KERN_DEBUG "ICMPv6 checksum failed [" NIP6_FMT " > " NIP6_FMT "]\n", LIMIT_NETDEBUG(KERN_DEBUG "ICMPv6 checksum failed [" NIP6_FMT " > " NIP6_FMT "]\n",
NIP6(*saddr), NIP6(*daddr)); NIP6(*saddr), NIP6(*daddr));
......
...@@ -91,7 +91,7 @@ struct mld2_grec { ...@@ -91,7 +91,7 @@ struct mld2_grec {
struct mld2_report { struct mld2_report {
__u8 type; __u8 type;
__u8 resv1; __u8 resv1;
__u16 csum; __sum16 csum;
__be16 resv2; __be16 resv2;
__be16 ngrec; __be16 ngrec;
struct mld2_grec grec[0]; struct mld2_grec grec[0];
...@@ -100,7 +100,7 @@ struct mld2_report { ...@@ -100,7 +100,7 @@ struct mld2_report {
struct mld2_query { struct mld2_query {
__u8 type; __u8 type;
__u8 code; __u8 code;
__u16 csum; __sum16 csum;
__be16 mrc; __be16 mrc;
__be16 resv1; __be16 resv1;
struct in6_addr mca; struct in6_addr mca;
......
...@@ -100,12 +100,13 @@ unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, ...@@ -100,12 +100,13 @@ unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
} }
/* fall through */ /* fall through */
case CHECKSUM_NONE: case CHECKSUM_NONE:
skb->csum = ~csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, skb->csum = ~csum_unfold(
csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
skb->len - dataoff, skb->len - dataoff,
protocol, protocol,
csum_sub(0, csum_sub(0,
skb_checksum(skb, 0, skb_checksum(skb, 0,
dataoff, 0))); dataoff, 0))));
csum = __skb_checksum_complete(skb); csum = __skb_checksum_complete(skb);
} }
return csum; return csum;
......
...@@ -370,9 +370,9 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -370,9 +370,9 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
} }
if (skb->ip_summed != CHECKSUM_UNNECESSARY) if (skb->ip_summed != CHECKSUM_UNNECESSARY)
skb->csum = ~csum_ipv6_magic(&skb->nh.ipv6h->saddr, skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
&skb->nh.ipv6h->daddr, &skb->nh.ipv6h->daddr,
skb->len, inet->num, 0); skb->len, inet->num, 0));
if (inet->hdrincl) { if (inet->hdrincl) {
if (skb_checksum_complete(skb)) { if (skb_checksum_complete(skb)) {
...@@ -479,8 +479,8 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, ...@@ -479,8 +479,8 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl,
int offset; int offset;
int len; int len;
int total_len; int total_len;
u32 tmp_csum; __wsum tmp_csum;
u16 csum; __sum16 csum;
if (!rp->checksum) if (!rp->checksum)
goto send; goto send;
...@@ -532,14 +532,13 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, ...@@ -532,14 +532,13 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl,
if (unlikely(csum)) if (unlikely(csum))
tmp_csum = csum_sub(tmp_csum, csum); tmp_csum = csum_sub(tmp_csum, csum);
tmp_csum = csum_ipv6_magic(&fl->fl6_src, csum = csum_ipv6_magic(&fl->fl6_src,
&fl->fl6_dst, &fl->fl6_dst,
total_len, fl->proto, tmp_csum); total_len, fl->proto, tmp_csum);
if (tmp_csum == 0 && fl->proto == IPPROTO_UDP) if (tmp_csum == 0 && fl->proto == IPPROTO_UDP)
tmp_csum = -1; tmp_csum = -1;
csum = tmp_csum;
if (skb_store_bits(skb, offset, &csum, 2)) if (skb_store_bits(skb, offset, &csum, 2))
BUG(); BUG();
......
...@@ -105,10 +105,10 @@ static void tcp_v6_hash(struct sock *sk) ...@@ -105,10 +105,10 @@ static void tcp_v6_hash(struct sock *sk)
} }
} }
static __inline__ u16 tcp_v6_check(struct tcphdr *th, int len, static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len,
struct in6_addr *saddr, struct in6_addr *saddr,
struct in6_addr *daddr, struct in6_addr *daddr,
unsigned long base) __wsum base)
{ {
return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base);
} }
...@@ -1537,8 +1537,8 @@ static int tcp_v6_checksum_init(struct sk_buff *skb) ...@@ -1537,8 +1537,8 @@ static int tcp_v6_checksum_init(struct sk_buff *skb)
} }
} }
skb->csum = ~tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr, skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,
&skb->nh.ipv6h->daddr, 0); &skb->nh.ipv6h->daddr, 0));
if (skb->len <= 76) { if (skb->len <= 76) {
return __skb_checksum_complete(skb); return __skb_checksum_complete(skb);
......
...@@ -383,9 +383,10 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh) ...@@ -383,9 +383,10 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh)
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
if (skb->ip_summed != CHECKSUM_UNNECESSARY) if (skb->ip_summed != CHECKSUM_UNNECESSARY)
skb->csum = ~csum_ipv6_magic(&skb->nh.ipv6h->saddr, skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
&skb->nh.ipv6h->daddr, &skb->nh.ipv6h->daddr,
skb->len, IPPROTO_UDP, 0); ulen, IPPROTO_UDP,
0));
return (UDP_SKB_CB(skb)->partial_cov = 0); return (UDP_SKB_CB(skb)->partial_cov = 0);
} }
...@@ -511,7 +512,7 @@ static int udp_v6_push_pending_frames(struct sock *sk, struct udp_sock *up) ...@@ -511,7 +512,7 @@ static int udp_v6_push_pending_frames(struct sock *sk, struct udp_sock *up)
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
struct flowi *fl = &inet->cork.fl; struct flowi *fl = &inet->cork.fl;
int err = 0; int err = 0;
u32 csum = 0; __wsum csum = 0;
/* Grab the skbuff where UDP header space exists. */ /* Grab the skbuff where UDP header space exists. */
if ((skb = skb_peek(&sk->sk_write_queue)) == NULL) if ((skb = skb_peek(&sk->sk_write_queue)) == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment