Skip to contentSkip to conversation

net: remove unused argument in checksum unnecessary conversion

PATCH Applied Willem de Bruijn 3 participants 3 messages Nov 2, 2016 – Nov 3, 2016

Subsystems (3)
lore
Share & tools
lore

Willem de Bruijn

author maintainer
#0 lore raw

PATCH 1/1 net: remove unused argument in checksum unnecessary conversion

From: Willem de Bruijn <[email protected]>

The check argument is never used. This code has not changed since the original introduction in d96535a17dbb ("net: Infrastructure for checksum unnecessary conversions"). Remove the unused argument and update all callers.

---
 include/linux/netdevice.h | 6 +++---
 include/linux/skbuff.h    | 8 +++-----
 net/ipv4/gre_demux.c      | 3 +--
 net/ipv4/gre_offload.c    | 2 +-
 net/ipv4/udp.c            | 2 +-
 net/ipv4/udp_offload.c    | 2 +-
 net/ipv6/udp.c            | 2 +-
 net/ipv6/udp_offload.c    | 2 +-
 8 files changed, 12 insertions(+), 15 deletions(-)
include/linux/netdevice.h +3 -3
index 66fd61c..ede9e45 100644
@@ -2582,16 +2582,16 @@ static inline bool __skb_gro_checksum_convert_check(struct sk_buff *skb)
 }
 
 static inline void __skb_gro_checksum_convert(struct sk_buff *skb,
-					      __sum16 check, __wsum pseudo)
+					      __wsum pseudo)
 {
 	NAPI_GRO_CB(skb)->csum = ~pseudo;
 	NAPI_GRO_CB(skb)->csum_valid = 1;
 }
 
-#define skb_gro_checksum_try_convert(skb, proto, check, compute_pseudo)	\
+#define skb_gro_checksum_try_convert(skb, proto, compute_pseudo)	\
 do {									\
 	if (__skb_gro_checksum_convert_check(skb))			\
-		__skb_gro_checksum_convert(skb, check,			\
+		__skb_gro_checksum_convert(skb,				\
 					   compute_pseudo(skb, proto));	\
 } while (0)
 
include/linux/skbuff.h +3 -5
index cc6e23e..e138591 100644
@@ -3492,18 +3492,16 @@ static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
 		skb->csum_valid && !skb->csum_bad);
 }
 
-static inline void __skb_checksum_convert(struct sk_buff *skb,
-					  __sum16 check, __wsum pseudo)
+static inline void __skb_checksum_convert(struct sk_buff *skb, __wsum pseudo)
 {
 	skb->csum = ~pseudo;
 	skb->ip_summed = CHECKSUM_COMPLETE;
 }
 
-#define skb_checksum_try_convert(skb, proto, check, compute_pseudo)	\
+#define skb_checksum_try_convert(skb, proto, compute_pseudo)		\
 do {									\
 	if (__skb_checksum_convert_check(skb))				\
-		__skb_checksum_convert(skb, check,			\
-				       compute_pseudo(skb, proto));	\
+		__skb_checksum_convert(skb, compute_pseudo(skb, proto));\
 } while (0)
 
 static inline void skb_remcsum_adjust_partial(struct sk_buff *skb, void *ptr,
net/ipv4/gre_demux.c +1 -2
index b798862..05eecf0 100644
@@ -91,8 +91,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
 			return -EINVAL;
 		}
 
-		skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
-					 null_compute_pseudo);
+		skb_checksum_try_convert(skb, IPPROTO_GRE, null_compute_pseudo);
 		options++;
 	}
 
net/ipv4/gre_offload.c +1 -1
index d5cac99..600ecd7 100644
@@ -190,7 +190,7 @@ static struct sk_buff **gre_gro_receive(struct sk_buff **head,
 		if (skb_gro_checksum_simple_validate(skb))
 			goto out_unlock;
 
-		skb_gro_checksum_try_convert(skb, IPPROTO_GRE, 0,
+		skb_gro_checksum_try_convert(skb, IPPROTO_GRE,
 					     null_compute_pseudo);
 	}
 
net/ipv4/udp.c +1 -1
index 195992e..48bad11 100644
@@ -1869,7 +1869,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
 		int ret;
 
 		if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
-			skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+			skb_checksum_try_convert(skb, IPPROTO_UDP,
 						 inet_compute_pseudo);
 
 		ret = udp_queue_rcv_skb(sk, skb);
net/ipv4/udp_offload.c +1 -1
index b2be1d9..96c2b44 100644
@@ -321,7 +321,7 @@ static struct sk_buff **udp4_gro_receive(struct sk_buff **head,
 						 inet_gro_compute_pseudo))
 		goto flush;
 	else if (uh->check)
-		skb_gro_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+		skb_gro_checksum_try_convert(skb, IPPROTO_UDP,
 					     inet_gro_compute_pseudo);
 skip:
 	NAPI_GRO_CB(skb)->is_ipv6 = 0;
net/ipv6/udp.c +1 -1
index a7700bb..bf3e703 100644
@@ -804,7 +804,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
 		}
 
 		if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
-			skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+			skb_checksum_try_convert(skb, IPPROTO_UDP,
 						 ip6_compute_pseudo);
 
 		ret = udpv6_queue_rcv_skb(sk, skb);
net/ipv6/udp_offload.c +1 -1
index ac858c4..6df7be0 100644
@@ -135,7 +135,7 @@ static struct sk_buff **udp6_gro_receive(struct sk_buff **head,
 						 ip6_gro_compute_pseudo))
 		goto flush;
 	else if (uh->check)
-		skb_gro_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+		skb_gro_checksum_try_convert(skb, IPPROTO_UDP,
 					     ip6_gro_compute_pseudo);
 
 skip:
Signature · 1 line
2.8.0.rc3.226.g39d4020
Acked-by on v1 1/1
#1 lore raw
Quoted 149 lines · Willem de Bruijn

From: Willem de Bruijn <[email protected]>

The check argument is never used. This code has not changed since the original introduction in d96535a17dbb ("net: Infrastructure for checksum unnecessary conversions"). Remove the unused argument and update all callers.

---
 include/linux/netdevice.h | 6 +++---
 include/linux/skbuff.h    | 8 +++-----
 net/ipv4/gre_demux.c      | 3 +--
 net/ipv4/gre_offload.c    | 2 +-
 net/ipv4/udp.c            | 2 +-
 net/ipv4/udp_offload.c    | 2 +-
 net/ipv6/udp.c            | 2 +-
 net/ipv6/udp_offload.c    | 2 +-
 8 files changed, 12 insertions(+), 15 deletions(-)
include/linux/netdevice.h +3 -3
index 66fd61c..ede9e45 100644
@@ -2582,16 +2582,16 @@ static inline bool __skb_gro_checksum_convert_check(struct sk_buff *skb)
 }
 
 static inline void __skb_gro_checksum_convert(struct sk_buff *skb,
-                                             __sum16 check, __wsum pseudo)
+                                             __wsum pseudo)
 {
        NAPI_GRO_CB(skb)->csum = ~pseudo;
        NAPI_GRO_CB(skb)->csum_valid = 1;
 }
 
-#define skb_gro_checksum_try_convert(skb, proto, check, compute_pseudo)        \
+#define skb_gro_checksum_try_convert(skb, proto, compute_pseudo)       \
 do {                                                                   \
        if (__skb_gro_checksum_convert_check(skb))                      \
-               __skb_gro_checksum_convert(skb, check,                  \
+               __skb_gro_checksum_convert(skb,                         \
                                           compute_pseudo(skb, proto)); \
 } while (0)
 
include/linux/skbuff.h +3 -5
index cc6e23e..e138591 100644
@@ -3492,18 +3492,16 @@ static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
                skb->csum_valid && !skb->csum_bad);
 }
 
-static inline void __skb_checksum_convert(struct sk_buff *skb,
-                                         __sum16 check, __wsum pseudo)
+static inline void __skb_checksum_convert(struct sk_buff *skb, __wsum pseudo)
 {
        skb->csum = ~pseudo;
        skb->ip_summed = CHECKSUM_COMPLETE;
 }
 
-#define skb_checksum_try_convert(skb, proto, check, compute_pseudo)    \
+#define skb_checksum_try_convert(skb, proto, compute_pseudo)           \
 do {                                                                   \
        if (__skb_checksum_convert_check(skb))                          \
-               __skb_checksum_convert(skb, check,                      \
-                                      compute_pseudo(skb, proto));     \
+               __skb_checksum_convert(skb, compute_pseudo(skb, proto));\
 } while (0)
 
 static inline void skb_remcsum_adjust_partial(struct sk_buff *skb, void *ptr,
net/ipv4/gre_demux.c +1 -2
index b798862..05eecf0 100644
@@ -91,8 +91,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
                        return -EINVAL;
                }
 
-               skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
-                                        null_compute_pseudo);
+               skb_checksum_try_convert(skb, IPPROTO_GRE, null_compute_pseudo);
                options++;
        }
 
net/ipv4/gre_offload.c +1 -1
index d5cac99..600ecd7 100644
@@ -190,7 +190,7 @@ static struct sk_buff **gre_gro_receive(struct sk_buff **head,
                if (skb_gro_checksum_simple_validate(skb))
                        goto out_unlock;
 
-               skb_gro_checksum_try_convert(skb, IPPROTO_GRE, 0,
+               skb_gro_checksum_try_convert(skb, IPPROTO_GRE,
                                             null_compute_pseudo);
        }
 
net/ipv4/udp.c +1 -1
index 195992e..48bad11 100644
@@ -1869,7 +1869,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
                int ret;
 
                if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
-                       skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+                       skb_checksum_try_convert(skb, IPPROTO_UDP,
                                                 inet_compute_pseudo);
 
                ret = udp_queue_rcv_skb(sk, skb);
net/ipv4/udp_offload.c +1 -1
index b2be1d9..96c2b44 100644
@@ -321,7 +321,7 @@ static struct sk_buff **udp4_gro_receive(struct sk_buff **head,
                                                 inet_gro_compute_pseudo))
                goto flush;
        else if (uh->check)
-               skb_gro_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+               skb_gro_checksum_try_convert(skb, IPPROTO_UDP,
                                             inet_gro_compute_pseudo);
 skip:
        NAPI_GRO_CB(skb)->is_ipv6 = 0;
net/ipv6/udp.c +1 -1
index a7700bb..bf3e703 100644
@@ -804,7 +804,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
                }
 
                if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
-                       skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+                       skb_checksum_try_convert(skb, IPPROTO_UDP,
                                                 ip6_compute_pseudo);
 
                ret = udpv6_queue_rcv_skb(sk, skb);
net/ipv6/udp_offload.c +1 -2
index ac858c4..6df7be0 100644
@@ -135,7 +135,7 @@ static struct sk_buff **udp6_gro_receive(struct sk_buff **head,
                                                 ip6_gro_compute_pseudo))
                goto flush;
        else if (uh->check)
-               skb_gro_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+               skb_gro_checksum_try_convert(skb, IPPROTO_UDP,
                                             ip6_gro_compute_pseudo);
 
 skip:
--
Quoted 2 lines

2.8.0.rc3.226.g39d4020

maintainer Applied
#2 lore raw
In reply to Willem de Bruijn

From: Willem de Bruijn <[email protected]>
Date: Wed, 2 Nov 2016 16:14:11 -0400

Quoted 8 lines

From: Willem de Bruijn <[email protected]>

The check argument is never used. This code has not changed since the original introduction in d96535a17dbb ("net: Infrastructure for checksum unnecessary conversions"). Remove the unused argument and update all callers.

Applied.