diff options
author | Tom Herbert <therbert@google.com> | 2014-08-31 18:12:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-02 00:36:28 -0400 |
commit | 2abb7cdc0dc84e99b76ef983a1ae1978922aa9b3 (patch) | |
tree | 9bf6029678d74ef6ad12e832d48d769caf88a4ed /include/linux/udp.h | |
parent | d96535a17dbbafd567961d14c08c0984ddda9c3c (diff) |
udp: Add support for doing checksum unnecessary conversion
Add support for doing CHECKSUM_UNNECESSARY to CHECKSUM_COMPLETE
conversion in UDP tunneling path.
In the normal UDP path, we call skb_checksum_try_convert after locating
the UDP socket. The check is that checksum conversion is enabled for
the socket (new flag in UDP socket) and that checksum field is
non-zero.
In the UDP GRO path, we call skb_gro_checksum_try_convert after
checksum is validated and checksum field is non-zero. Since this is
already in GRO we assume that checksum conversion is always wanted.
Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/udp.h')
-rw-r--r-- | include/linux/udp.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/udp.h b/include/linux/udp.h index 247cfdcc4b08..ee3277593222 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
@@ -49,7 +49,11 @@ struct udp_sock { | |||
49 | unsigned int corkflag; /* Cork is required */ | 49 | unsigned int corkflag; /* Cork is required */ |
50 | __u8 encap_type; /* Is this an Encapsulation socket? */ | 50 | __u8 encap_type; /* Is this an Encapsulation socket? */ |
51 | unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */ | 51 | unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */ |
52 | no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */ | 52 | no_check6_rx:1,/* Allow zero UDP6 checksums on RX? */ |
53 | convert_csum:1;/* On receive, convert checksum | ||
54 | * unnecessary to checksum complete | ||
55 | * if possible. | ||
56 | */ | ||
53 | /* | 57 | /* |
54 | * Following member retains the information to create a UDP header | 58 | * Following member retains the information to create a UDP header |
55 | * when the socket is uncorked. | 59 | * when the socket is uncorked. |
@@ -98,6 +102,16 @@ static inline bool udp_get_no_check6_rx(struct sock *sk) | |||
98 | return udp_sk(sk)->no_check6_rx; | 102 | return udp_sk(sk)->no_check6_rx; |
99 | } | 103 | } |
100 | 104 | ||
105 | static inline void udp_set_convert_csum(struct sock *sk, bool val) | ||
106 | { | ||
107 | udp_sk(sk)->convert_csum = val; | ||
108 | } | ||
109 | |||
110 | static inline bool udp_get_convert_csum(struct sock *sk) | ||
111 | { | ||
112 | return udp_sk(sk)->convert_csum; | ||
113 | } | ||
114 | |||
101 | #define udp_portaddr_for_each_entry(__sk, node, list) \ | 115 | #define udp_portaddr_for_each_entry(__sk, node, list) \ |
102 | hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node) | 116 | hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node) |
103 | 117 | ||