Commit 868c86bcb5bdea7ed8d45979b17bb919af9254db

Authored by Al Viro
Committed by David S. Miller
1 parent 2bda285315

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

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 9 changed files with 31 additions and 30 deletions Side-by-side Diff

... ... @@ -89,9 +89,9 @@
89 89 * @skb: sk_buff containing the filled-in UDP header
90 90 * (checksum field must be zeroed out)
91 91 */
92   -static inline u32 udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
  92 +static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
93 93 {
94   - u32 csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0);
  94 + __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0);
95 95  
96 96 skb_queue_walk(&sk->sk_write_queue, skb) {
97 97 csum = csum_add(csum, skb->csum);
include/net/udplite.h
... ... @@ -124,10 +124,10 @@
124 124 return cscov;
125 125 }
126 126  
127   -static inline u32 udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
  127 +static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
128 128 {
129   - u32 csum = 0;
130 129 int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh);
  130 + __wsum csum = 0;
131 131  
132 132 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
133 133  
... ... @@ -59,7 +59,7 @@
59 59 }
60 60  
61 61 /* add pseudo-header to DCCP checksum stored in skb->csum */
62   -static inline u16 dccp_v6_csum_finish(struct sk_buff *skb,
  62 +static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb,
63 63 struct in6_addr *saddr,
64 64 struct in6_addr *daddr)
65 65 {
... ... @@ -234,7 +234,7 @@
234 234 len, fl->proto,
235 235 skb->csum);
236 236 } else {
237   - u32 tmp_csum = 0;
  237 + __wsum tmp_csum = 0;
238 238  
239 239 skb_queue_walk(&sk->sk_write_queue, skb) {
240 240 tmp_csum = csum_add(tmp_csum, skb->csum);
... ... @@ -242,10 +242,10 @@
242 242  
243 243 tmp_csum = csum_partial((char *)icmp6h,
244 244 sizeof(struct icmp6hdr), tmp_csum);
245   - tmp_csum = csum_ipv6_magic(&fl->fl6_src,
246   - &fl->fl6_dst,
247   - len, fl->proto, tmp_csum);
248   - icmp6h->icmp6_cksum = tmp_csum;
  245 + icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src,
  246 + &fl->fl6_dst,
  247 + len, fl->proto,
  248 + tmp_csum);
249 249 }
250 250 ip6_push_pending_frames(sk);
251 251 out:
... ... @@ -636,8 +636,8 @@
636 636 break;
637 637 /* fall through */
638 638 case CHECKSUM_NONE:
639   - skb->csum = ~csum_ipv6_magic(saddr, daddr, skb->len,
640   - IPPROTO_ICMPV6, 0);
  639 + skb->csum = ~csum_unfold(csum_ipv6_magic(saddr, daddr, skb->len,
  640 + IPPROTO_ICMPV6, 0));
641 641 if (__skb_checksum_complete(skb)) {
642 642 LIMIT_NETDEBUG(KERN_DEBUG "ICMPv6 checksum failed [" NIP6_FMT " > " NIP6_FMT "]\n",
643 643 NIP6(*saddr), NIP6(*daddr));
... ... @@ -91,7 +91,7 @@
91 91 struct mld2_report {
92 92 __u8 type;
93 93 __u8 resv1;
94   - __u16 csum;
  94 + __sum16 csum;
95 95 __be16 resv2;
96 96 __be16 ngrec;
97 97 struct mld2_grec grec[0];
... ... @@ -100,7 +100,7 @@
100 100 struct mld2_query {
101 101 __u8 type;
102 102 __u8 code;
103   - __u16 csum;
  103 + __sum16 csum;
104 104 __be16 mrc;
105 105 __be16 resv1;
106 106 struct in6_addr mca;
net/ipv6/netfilter.c
... ... @@ -100,12 +100,13 @@
100 100 }
101 101 /* fall through */
102 102 case CHECKSUM_NONE:
103   - skb->csum = ~csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
  103 + skb->csum = ~csum_unfold(
  104 + csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
104 105 skb->len - dataoff,
105 106 protocol,
106 107 csum_sub(0,
107 108 skb_checksum(skb, 0,
108   - dataoff, 0)));
  109 + dataoff, 0))));
109 110 csum = __skb_checksum_complete(skb);
110 111 }
111 112 return csum;
... ... @@ -370,9 +370,9 @@
370 370 skb->ip_summed = CHECKSUM_UNNECESSARY;
371 371 }
372 372 if (skb->ip_summed != CHECKSUM_UNNECESSARY)
373   - skb->csum = ~csum_ipv6_magic(&skb->nh.ipv6h->saddr,
  373 + skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
374 374 &skb->nh.ipv6h->daddr,
375   - skb->len, inet->num, 0);
  375 + skb->len, inet->num, 0));
376 376  
377 377 if (inet->hdrincl) {
378 378 if (skb_checksum_complete(skb)) {
... ... @@ -479,8 +479,8 @@
479 479 int offset;
480 480 int len;
481 481 int total_len;
482   - u32 tmp_csum;
483   - u16 csum;
  482 + __wsum tmp_csum;
  483 + __sum16 csum;
484 484  
485 485 if (!rp->checksum)
486 486 goto send;
487 487  
... ... @@ -532,14 +532,13 @@
532 532 if (unlikely(csum))
533 533 tmp_csum = csum_sub(tmp_csum, csum);
534 534  
535   - tmp_csum = csum_ipv6_magic(&fl->fl6_src,
  535 + csum = csum_ipv6_magic(&fl->fl6_src,
536 536 &fl->fl6_dst,
537 537 total_len, fl->proto, tmp_csum);
538 538  
539 539 if (tmp_csum == 0 && fl->proto == IPPROTO_UDP)
540 540 tmp_csum = -1;
541 541  
542   - csum = tmp_csum;
543 542 if (skb_store_bits(skb, offset, &csum, 2))
544 543 BUG();
545 544  
... ... @@ -105,10 +105,10 @@
105 105 }
106 106 }
107 107  
108   -static __inline__ u16 tcp_v6_check(struct tcphdr *th, int len,
  108 +static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len,
109 109 struct in6_addr *saddr,
110 110 struct in6_addr *daddr,
111   - unsigned long base)
  111 + __wsum base)
112 112 {
113 113 return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base);
114 114 }
... ... @@ -1537,8 +1537,8 @@
1537 1537 }
1538 1538 }
1539 1539  
1540   - skb->csum = ~tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,
1541   - &skb->nh.ipv6h->daddr, 0);
  1540 + skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,
  1541 + &skb->nh.ipv6h->daddr, 0));
1542 1542  
1543 1543 if (skb->len <= 76) {
1544 1544 return __skb_checksum_complete(skb);
... ... @@ -383,9 +383,10 @@
383 383 skb->ip_summed = CHECKSUM_UNNECESSARY;
384 384  
385 385 if (skb->ip_summed != CHECKSUM_UNNECESSARY)
386   - skb->csum = ~csum_ipv6_magic(&skb->nh.ipv6h->saddr,
387   - &skb->nh.ipv6h->daddr,
388   - skb->len, IPPROTO_UDP, 0);
  386 + skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
  387 + &skb->nh.ipv6h->daddr,
  388 + ulen, IPPROTO_UDP,
  389 + 0));
389 390  
390 391 return (UDP_SKB_CB(skb)->partial_cov = 0);
391 392 }
... ... @@ -511,7 +512,7 @@
511 512 struct inet_sock *inet = inet_sk(sk);
512 513 struct flowi *fl = &inet->cork.fl;
513 514 int err = 0;
514   - u32 csum = 0;
  515 + __wsum csum = 0;
515 516  
516 517 /* Grab the skbuff where UDP header space exists. */
517 518 if ((skb = skb_peek(&sk->sk_write_queue)) == NULL)