diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-04-09 14:59:07 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:28:40 -0400 |
commit | 663ead3bb8d5b561e70fc3bb3861c9220b5a77eb (patch) | |
tree | 551d031fc9c904487ced4d8d3363e5ed8f369794 /include/linux | |
parent | ac758e3c55c529714354fc268892ca4d23ca1e99 (diff) |
[NET]: Use csum_start offset instead of skb_transport_header
The skb transport pointer is currently used to specify the start
of the checksum region for transmit checksum offload. Unfortunately,
the same pointer is also used during receive side processing.
This creates a problem when we want to retransmit a received
packet with partial checksums since the skb transport pointer
would be overwritten.
This patch solves this problem by creating a new 16-bit csum_start
offset value to replace the skb transport header for the purpose
of checksums. This offset is calculated from skb->head so that
it does not have to change when skb->data changes.
No extra space is required since csum_offset itself fits within
a 16-bit word so we can use the other 16 bits for csum_start.
For backwards compatibility, just before we push a packet with
partial checksums off into the device driver, we set the skb
transport header to what it would have been under the old scheme.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/skbuff.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 9b2957d203c9..910560e85561 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -205,7 +205,9 @@ typedef unsigned char *sk_buff_data_t; | |||
205 | * @len: Length of actual data | 205 | * @len: Length of actual data |
206 | * @data_len: Data length | 206 | * @data_len: Data length |
207 | * @mac_len: Length of link layer header | 207 | * @mac_len: Length of link layer header |
208 | * @csum: Checksum | 208 | * @csum: Checksum (must include start/offset pair) |
209 | * @csum_start: Offset from skb->head where checksumming should start | ||
210 | * @csum_offset: Offset from csum_start where checksum should be stored | ||
209 | * @local_df: allow local fragmentation | 211 | * @local_df: allow local fragmentation |
210 | * @cloned: Head may be cloned (check refcnt to be sure) | 212 | * @cloned: Head may be cloned (check refcnt to be sure) |
211 | * @nohdr: Payload reference only, must not modify header | 213 | * @nohdr: Payload reference only, must not modify header |
@@ -261,7 +263,10 @@ struct sk_buff { | |||
261 | mac_len; | 263 | mac_len; |
262 | union { | 264 | union { |
263 | __wsum csum; | 265 | __wsum csum; |
264 | __u32 csum_offset; | 266 | struct { |
267 | __u16 csum_start; | ||
268 | __u16 csum_offset; | ||
269 | }; | ||
265 | }; | 270 | }; |
266 | __u32 priority; | 271 | __u32 priority; |
267 | __u8 local_df:1, | 272 | __u8 local_df:1, |