diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2013-03-07 08:21:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-09 16:08:57 -0500 |
commit | f5b1729443fdaf57766f99dd6e18d9b4b6f7a89e (patch) | |
tree | 31bee49ea7a33c93170f871a33d467a6d412305f /net/core/skbuff.c | |
parent | ee579677c29954f20e48e5bb80ae85b30100c2e0 (diff) |
net: Add skb_headers_offset_update helper function.
This function will be used in next VXLAN_GSO patch. This patch does
not change any functionality.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/skbuff.c')
-rw-r--r-- | net/core/skbuff.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 0a48ae20c903..0278c7f787bf 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -867,6 +867,17 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
867 | } | 867 | } |
868 | EXPORT_SYMBOL(skb_clone); | 868 | EXPORT_SYMBOL(skb_clone); |
869 | 869 | ||
870 | static void skb_headers_offset_update(struct sk_buff *skb, int off) | ||
871 | { | ||
872 | /* {transport,network,mac}_header and tail are relative to skb->head */ | ||
873 | skb->transport_header += off; | ||
874 | skb->network_header += off; | ||
875 | if (skb_mac_header_was_set(skb)) | ||
876 | skb->mac_header += off; | ||
877 | skb->inner_transport_header += off; | ||
878 | skb->inner_network_header += off; | ||
879 | } | ||
880 | |||
870 | static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | 881 | static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) |
871 | { | 882 | { |
872 | #ifndef NET_SKBUFF_DATA_USES_OFFSET | 883 | #ifndef NET_SKBUFF_DATA_USES_OFFSET |
@@ -879,13 +890,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
879 | __copy_skb_header(new, old); | 890 | __copy_skb_header(new, old); |
880 | 891 | ||
881 | #ifndef NET_SKBUFF_DATA_USES_OFFSET | 892 | #ifndef NET_SKBUFF_DATA_USES_OFFSET |
882 | /* {transport,network,mac}_header are relative to skb->head */ | 893 | skb_headers_offset_update(new, offset); |
883 | new->transport_header += offset; | ||
884 | new->network_header += offset; | ||
885 | if (skb_mac_header_was_set(new)) | ||
886 | new->mac_header += offset; | ||
887 | new->inner_transport_header += offset; | ||
888 | new->inner_network_header += offset; | ||
889 | #endif | 894 | #endif |
890 | skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size; | 895 | skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size; |
891 | skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs; | 896 | skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs; |
@@ -1077,14 +1082,8 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
1077 | #else | 1082 | #else |
1078 | skb->end = skb->head + size; | 1083 | skb->end = skb->head + size; |
1079 | #endif | 1084 | #endif |
1080 | /* {transport,network,mac}_header and tail are relative to skb->head */ | ||
1081 | skb->tail += off; | 1085 | skb->tail += off; |
1082 | skb->transport_header += off; | 1086 | skb_headers_offset_update(skb, off); |
1083 | skb->network_header += off; | ||
1084 | if (skb_mac_header_was_set(skb)) | ||
1085 | skb->mac_header += off; | ||
1086 | skb->inner_transport_header += off; | ||
1087 | skb->inner_network_header += off; | ||
1088 | /* Only adjust this if it actually is csum_start rather than csum */ | 1087 | /* Only adjust this if it actually is csum_start rather than csum */ |
1089 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 1088 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
1090 | skb->csum_start += nhead; | 1089 | skb->csum_start += nhead; |
@@ -1180,12 +1179,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, | |||
1180 | if (n->ip_summed == CHECKSUM_PARTIAL) | 1179 | if (n->ip_summed == CHECKSUM_PARTIAL) |
1181 | n->csum_start += off; | 1180 | n->csum_start += off; |
1182 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | 1181 | #ifdef NET_SKBUFF_DATA_USES_OFFSET |
1183 | n->transport_header += off; | 1182 | skb_headers_offset_update(n, off); |
1184 | n->network_header += off; | ||
1185 | if (skb_mac_header_was_set(skb)) | ||
1186 | n->mac_header += off; | ||
1187 | n->inner_transport_header += off; | ||
1188 | n->inner_network_header += off; | ||
1189 | #endif | 1183 | #endif |
1190 | 1184 | ||
1191 | return n; | 1185 | return n; |