diff options
Diffstat (limited to 'include/net/udplite.h')
-rw-r--r-- | include/net/udplite.h | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/include/net/udplite.h b/include/net/udplite.h index 67ac5142430..635b0eafca9 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
@@ -47,11 +47,10 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
47 | return 1; | 47 | return 1; |
48 | } | 48 | } |
49 | 49 | ||
50 | UDP_SKB_CB(skb)->partial_cov = 0; | ||
51 | cscov = ntohs(uh->len); | 50 | cscov = ntohs(uh->len); |
52 | 51 | ||
53 | if (cscov == 0) /* Indicates that full coverage is required. */ | 52 | if (cscov == 0) /* Indicates that full coverage is required. */ |
54 | cscov = skb->len; | 53 | ; |
55 | else if (cscov < 8 || cscov > skb->len) { | 54 | else if (cscov < 8 || cscov > skb->len) { |
56 | /* | 55 | /* |
57 | * Coverage length violates RFC 3828: log and discard silently. | 56 | * Coverage length violates RFC 3828: log and discard silently. |
@@ -60,42 +59,16 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
60 | cscov, skb->len); | 59 | cscov, skb->len); |
61 | return 1; | 60 | return 1; |
62 | 61 | ||
63 | } else if (cscov < skb->len) | 62 | } else if (cscov < skb->len) { |
64 | UDP_SKB_CB(skb)->partial_cov = 1; | 63 | UDP_SKB_CB(skb)->partial_cov = 1; |
65 | 64 | UDP_SKB_CB(skb)->cscov = cscov; | |
66 | UDP_SKB_CB(skb)->cscov = cscov; | 65 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
67 | 66 | skb->ip_summed = CHECKSUM_NONE; | |
68 | /* | 67 | } |
69 | * There is no known NIC manufacturer supporting UDP-Lite yet, | ||
70 | * hence ip_summed is always (re-)set to CHECKSUM_NONE. | ||
71 | */ | ||
72 | skb->ip_summed = CHECKSUM_NONE; | ||
73 | 68 | ||
74 | return 0; | 69 | return 0; |
75 | } | 70 | } |
76 | 71 | ||
77 | static __inline__ int udplite4_csum_init(struct sk_buff *skb, struct udphdr *uh) | ||
78 | { | ||
79 | int rc = udplite_checksum_init(skb, uh); | ||
80 | |||
81 | if (!rc) | ||
82 | skb->csum = csum_tcpudp_nofold(skb->nh.iph->saddr, | ||
83 | skb->nh.iph->daddr, | ||
84 | skb->len, IPPROTO_UDPLITE, 0); | ||
85 | return rc; | ||
86 | } | ||
87 | |||
88 | static __inline__ int udplite6_csum_init(struct sk_buff *skb, struct udphdr *uh) | ||
89 | { | ||
90 | int rc = udplite_checksum_init(skb, uh); | ||
91 | |||
92 | if (!rc) | ||
93 | skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr, | ||
94 | &skb->nh.ipv6h->daddr, | ||
95 | skb->len, IPPROTO_UDPLITE, 0)); | ||
96 | return rc; | ||
97 | } | ||
98 | |||
99 | static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) | 72 | static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) |
100 | { | 73 | { |
101 | int cscov = up->len; | 74 | int cscov = up->len; |
@@ -128,14 +101,14 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) | |||
128 | 101 | ||
129 | static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) | 102 | static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) |
130 | { | 103 | { |
131 | int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); | 104 | int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); |
132 | __wsum csum = 0; | 105 | __wsum csum = 0; |
133 | 106 | ||
134 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ | 107 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ |
135 | 108 | ||
136 | skb_queue_walk(&sk->sk_write_queue, skb) { | 109 | skb_queue_walk(&sk->sk_write_queue, skb) { |
137 | off = skb->h.raw - skb->data; | 110 | const int off = skb_transport_offset(skb); |
138 | len = skb->len - off; | 111 | const int len = skb->len - off; |
139 | 112 | ||
140 | csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); | 113 | csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); |
141 | 114 | ||