mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
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>
This commit is contained in:
parent
d96535a17d
commit
2abb7cdc0d
5 changed files with 58 additions and 17 deletions
|
@ -49,7 +49,11 @@ struct udp_sock {
|
|||
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.
|
||||
|
@ -98,6 +102,16 @@ static inline bool udp_get_no_check6_rx(struct sock *sk)
|
|||
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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue