浏览代码

[NET]: Annotate __skb_checksum_complete() and friends.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Al Viro 18 年之前
父节点
当前提交
b51655b958

+ 3 - 3
include/linux/netfilter.h

@@ -290,7 +290,7 @@ extern u_int16_t nf_proto_csum_update(struct sk_buff *skb,
 
 
 struct nf_afinfo {
 struct nf_afinfo {
 	unsigned short	family;
 	unsigned short	family;
-	unsigned int	(*checksum)(struct sk_buff *skb, unsigned int hook,
+	__sum16		(*checksum)(struct sk_buff *skb, unsigned int hook,
 				    unsigned int dataoff, u_int8_t protocol);
 				    unsigned int dataoff, u_int8_t protocol);
 	void		(*saveroute)(const struct sk_buff *skb,
 	void		(*saveroute)(const struct sk_buff *skb,
 				     struct nf_info *info);
 				     struct nf_info *info);
@@ -305,12 +305,12 @@ static inline struct nf_afinfo *nf_get_afinfo(unsigned short family)
 	return rcu_dereference(nf_afinfo[family]);
 	return rcu_dereference(nf_afinfo[family]);
 }
 }
 
 
-static inline unsigned int
+static inline __sum16
 nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
 nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
 	    u_int8_t protocol, unsigned short family)
 	    u_int8_t protocol, unsigned short family)
 {
 {
 	struct nf_afinfo *afinfo;
 	struct nf_afinfo *afinfo;
-	unsigned int csum = 0;
+	__sum16 csum = 0;
 
 
 	rcu_read_lock();
 	rcu_read_lock();
 	afinfo = nf_get_afinfo(family);
 	afinfo = nf_get_afinfo(family);

+ 1 - 1
include/linux/netfilter_ipv4.h

@@ -79,7 +79,7 @@ enum nf_ip_hook_priorities {
 #ifdef __KERNEL__
 #ifdef __KERNEL__
 extern int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type);
 extern int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type);
 extern int ip_xfrm_me_harder(struct sk_buff **pskb);
 extern int ip_xfrm_me_harder(struct sk_buff **pskb);
-extern unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
+extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
 				   unsigned int dataoff, u_int8_t protocol);
 				   unsigned int dataoff, u_int8_t protocol);
 #endif /*__KERNEL__*/
 #endif /*__KERNEL__*/
 
 

+ 1 - 1
include/linux/netfilter_ipv6.h

@@ -74,7 +74,7 @@ enum nf_ip6_hook_priorities {
 
 
 #ifdef CONFIG_NETFILTER
 #ifdef CONFIG_NETFILTER
 extern int ip6_route_me_harder(struct sk_buff *skb);
 extern int ip6_route_me_harder(struct sk_buff *skb);
-extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
+extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
 				    unsigned int dataoff, u_int8_t protocol);
 				    unsigned int dataoff, u_int8_t protocol);
 
 
 extern int ipv6_netfilter_init(void);
 extern int ipv6_netfilter_init(void);

+ 1 - 1
include/linux/skbuff.h

@@ -1398,7 +1398,7 @@ static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *
 
 
 extern void __net_timestamp(struct sk_buff *skb);
 extern void __net_timestamp(struct sk_buff *skb);
 
 
-extern unsigned int __skb_checksum_complete(struct sk_buff *skb);
+extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
 
 
 /**
 /**
  *	skb_checksum_complete - Calculate checksum of an entire packet
  *	skb_checksum_complete - Calculate checksum of an entire packet

+ 1 - 1
include/net/tcp.h

@@ -814,7 +814,7 @@ static inline __sum16 tcp_v4_check(struct tcphdr *th, int len,
 	return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
 	return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
 }
 }
 
 
-static inline int __tcp_checksum_complete(struct sk_buff *skb)
+static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb)
 {
 {
 	return __skb_checksum_complete(skb);
 	return __skb_checksum_complete(skb);
 }
 }

+ 4 - 4
include/net/udp.h

@@ -69,15 +69,15 @@ struct sk_buff;
 /*
 /*
  *	Generic checksumming routines for UDP(-Lite) v4 and v6
  *	Generic checksumming routines for UDP(-Lite) v4 and v6
  */
  */
-static inline u16  __udp_lib_checksum_complete(struct sk_buff *skb)
+static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb)
 {
 {
 	if (! UDP_SKB_CB(skb)->partial_cov)
 	if (! UDP_SKB_CB(skb)->partial_cov)
 		return __skb_checksum_complete(skb);
 		return __skb_checksum_complete(skb);
-	return  csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov,
-			  skb->csum));
+	return csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov,
+				      skb->csum));
 }
 }
 
 
-static __inline__ int udp_lib_checksum_complete(struct sk_buff *skb)
+static inline __sum16 udp_lib_checksum_complete(struct sk_buff *skb)
 {
 {
 	return skb->ip_summed != CHECKSUM_UNNECESSARY &&
 	return skb->ip_summed != CHECKSUM_UNNECESSARY &&
 		__udp_lib_checksum_complete(skb);
 		__udp_lib_checksum_complete(skb);

+ 1 - 1
net/core/datagram.c

@@ -411,7 +411,7 @@ fault:
 	return -EFAULT;
 	return -EFAULT;
 }
 }
 
 
-unsigned int __skb_checksum_complete(struct sk_buff *skb)
+__sum16 __skb_checksum_complete(struct sk_buff *skb)
 {
 {
 	__sum16 sum;
 	__sum16 sum;
 
 

+ 2 - 2
net/core/netpoll.c

@@ -77,8 +77,8 @@ static void queue_process(void *p)
 	}
 	}
 }
 }
 
 
-static int checksum_udp(struct sk_buff *skb, struct udphdr *uh,
-			unsigned short ulen, __be32 saddr, __be32 daddr)
+static __sum16 checksum_udp(struct sk_buff *skb, struct udphdr *uh,
+			    unsigned short ulen, __be32 saddr, __be32 daddr)
 {
 {
 	__wsum psum;
 	__wsum psum;
 
 

+ 2 - 2
net/ipv4/netfilter.c

@@ -162,11 +162,11 @@ static int nf_ip_reroute(struct sk_buff **pskb, const struct nf_info *info)
 	return 0;
 	return 0;
 }
 }
 
 
-unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
+__sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
 			    unsigned int dataoff, u_int8_t protocol)
 			    unsigned int dataoff, u_int8_t protocol)
 {
 {
 	struct iphdr *iph = skb->nh.iph;
 	struct iphdr *iph = skb->nh.iph;
-	unsigned int csum = 0;
+	__sum16 csum = 0;
 
 
 	switch (skb->ip_summed) {
 	switch (skb->ip_summed) {
 	case CHECKSUM_COMPLETE:
 	case CHECKSUM_COMPLETE:

+ 2 - 2
net/ipv4/tcp_input.c

@@ -3790,9 +3790,9 @@ static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen)
 	return err;
 	return err;
 }
 }
 
 
-static int __tcp_checksum_complete_user(struct sock *sk, struct sk_buff *skb)
+static __sum16 __tcp_checksum_complete_user(struct sock *sk, struct sk_buff *skb)
 {
 {
-	int result;
+	__sum16 result;
 
 
 	if (sock_owned_by_user(sk)) {
 	if (sock_owned_by_user(sk)) {
 		local_bh_enable();
 		local_bh_enable();

+ 1 - 1
net/ipv4/tcp_ipv4.c

@@ -1544,7 +1544,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
 	return sk;
 	return sk;
 }
 }
 
 
-static int tcp_v4_checksum_init(struct sk_buff *skb)
+static __sum16 tcp_v4_checksum_init(struct sk_buff *skb)
 {
 {
 	if (skb->ip_summed == CHECKSUM_COMPLETE) {
 	if (skb->ip_summed == CHECKSUM_COMPLETE) {
 		if (!tcp_v4_check(skb->h.th, skb->len, skb->nh.iph->saddr,
 		if (!tcp_v4_check(skb->h.th, skb->len, skb->nh.iph->saddr,

+ 2 - 2
net/ipv6/netfilter.c

@@ -80,11 +80,11 @@ static int nf_ip6_reroute(struct sk_buff **pskb, const struct nf_info *info)
 	return 0;
 	return 0;
 }
 }
 
 
-unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
+__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
 			     unsigned int dataoff, u_int8_t protocol)
 			     unsigned int dataoff, u_int8_t protocol)
 {
 {
 	struct ipv6hdr *ip6h = skb->nh.ipv6h;
 	struct ipv6hdr *ip6h = skb->nh.ipv6h;
-	unsigned int csum = 0;
+	__sum16 csum = 0;
 
 
 	switch (skb->ip_summed) {
 	switch (skb->ip_summed) {
 	case CHECKSUM_COMPLETE:
 	case CHECKSUM_COMPLETE:

+ 1 - 1
net/ipv6/tcp_ipv6.c

@@ -1527,7 +1527,7 @@ out:
 	return NULL;
 	return NULL;
 }
 }
 
 
-static int tcp_v6_checksum_init(struct sk_buff *skb)
+static __sum16 tcp_v6_checksum_init(struct sk_buff *skb)
 {
 {
 	if (skb->ip_summed == CHECKSUM_COMPLETE) {
 	if (skb->ip_summed == CHECKSUM_COMPLETE) {
 		if (!tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,
 		if (!tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,