unsigned int     corkflag;      /* Cork is required */
        __u8             encap_type;    /* Is this an Encapsulation socket? */
        unsigned char    no_check6_tx:1,/* Send zero UDP6 checksums on TX? */
-                        no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */
+                        no_check6_rx:1,/* Allow zero UDP6 checksums on RX? */
+                        convert_csum:1;/* On receive, convert checksum
+                                        * unnecessary to checksum complete
+                                        * if possible.
+                                        */
        /*
         * Following member retains the information to create a UDP header
         * when the socket is uncorked.
        return udp_sk(sk)->no_check6_rx;
 }
 
+static inline void udp_set_convert_csum(struct sock *sk, bool val)
+{
+       udp_sk(sk)->convert_csum = val;
+}
+
+static inline bool udp_get_convert_csum(struct sock *sk)
+{
+       return udp_sk(sk)->convert_csum;
+}
+
 #define udp_portaddr_for_each_entry(__sk, node, list) \
        hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node)
 
 
        if (sk != NULL) {
                int ret;
 
+               if (udp_sk(sk)->convert_csum && uh->check && !IS_UDPLITE(sk))
+                       skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+                                                inet_compute_pseudo);
+
                ret = udp_queue_rcv_skb(sk, skb);
                sock_put(sk);
 
 
 {
        struct udphdr *uh = udp_gro_udphdr(skb);
 
-       /* Don't bother verifying checksum if we're going to flush anyway. */
-       if (unlikely(!uh) ||
-           (!NAPI_GRO_CB(skb)->flush &&
-            skb_gro_checksum_validate_zero_check(skb, IPPROTO_UDP, uh->check,
-                                                 inet_gro_compute_pseudo))) {
-               NAPI_GRO_CB(skb)->flush = 1;
-               return NULL;
-       }
+       if (unlikely(!uh))
+               goto flush;
 
+       /* Don't bother verifying checksum if we're going to flush anyway. */
+       if (!NAPI_GRO_CB(skb)->flush)
+               goto skip;
+
+       if (skb_gro_checksum_validate_zero_check(skb, IPPROTO_UDP, uh->check,
+                                                inet_gro_compute_pseudo))
+               goto flush;
+       else if (uh->check)
+               skb_gro_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+                                            inet_gro_compute_pseudo);
+skip:
        return udp_gro_receive(head, skb, uh);
+
+flush:
+       NAPI_GRO_CB(skb)->flush = 1;
+       return NULL;
 }
 
 int udp_gro_complete(struct sk_buff *skb, int nhoff)
 
                        goto csum_error;
                }
 
+               if (udp_sk(sk)->convert_csum && uh->check && !IS_UDPLITE(sk))
+                       skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+                                                ip6_compute_pseudo);
+
                ret = udpv6_queue_rcv_skb(sk, skb);
                sock_put(sk);
 
 
 {
        struct udphdr *uh = udp_gro_udphdr(skb);
 
+       if (unlikely(!uh))
+               goto flush;
+
        /* Don't bother verifying checksum if we're going to flush anyway. */
-       if (unlikely(!uh) ||
-           (!NAPI_GRO_CB(skb)->flush &&
-            skb_gro_checksum_validate_zero_check(skb, IPPROTO_UDP, uh->check,
-                                                 ip6_gro_compute_pseudo))) {
-               NAPI_GRO_CB(skb)->flush = 1;
-               return NULL;
-       }
+       if (!NAPI_GRO_CB(skb)->flush)
+               goto skip;
 
+       if (skb_gro_checksum_validate_zero_check(skb, IPPROTO_UDP, uh->check,
+                                                ip6_gro_compute_pseudo))
+               goto flush;
+       else if (uh->check)
+               skb_gro_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+                                            ip6_gro_compute_pseudo);
+
+skip:
        return udp_gro_receive(head, skb, uh);
+
+flush:
+       NAPI_GRO_CB(skb)->flush = 1;
+       return NULL;
 }
 
 int udp6_gro_complete(struct sk_buff *skb, int nhoff)