aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2015-02-02 19:07:34 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-04 16:54:07 -0500
commitdcdc8994697faa789669c3fdaca1a8bc27a8f356 (patch)
treea105b07298d337a0b04b114422638768c3ee9266 /net/ipv4
parent9a05dde59a35eee5643366d3d1e1f43fc9069adb (diff)
net: add skb functions to process remote checksum offload
This patch adds skb_remcsum_process and skb_gro_remcsum_process to perform the appropriate adjustments to the skb when receiving remote checksum offload. Updated vxlan and gue to use these functions. Tested: Ran TCP_RR and TCP_STREAM netperf for VXLAN and GUE, did not see any change in performance. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fou.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index 3bc0cf07661c..92ddea1e6457 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -70,7 +70,6 @@ static struct guehdr *gue_remcsum(struct sk_buff *skb, struct guehdr *guehdr,
70 size_t start = ntohs(pd[0]); 70 size_t start = ntohs(pd[0]);
71 size_t offset = ntohs(pd[1]); 71 size_t offset = ntohs(pd[1]);
72 size_t plen = hdrlen + max_t(size_t, offset + sizeof(u16), start); 72 size_t plen = hdrlen + max_t(size_t, offset + sizeof(u16), start);
73 __wsum delta;
74 73
75 if (skb->remcsum_offload) { 74 if (skb->remcsum_offload) {
76 /* Already processed in GRO path */ 75 /* Already processed in GRO path */
@@ -82,14 +81,7 @@ static struct guehdr *gue_remcsum(struct sk_buff *skb, struct guehdr *guehdr,
82 return NULL; 81 return NULL;
83 guehdr = (struct guehdr *)&udp_hdr(skb)[1]; 82 guehdr = (struct guehdr *)&udp_hdr(skb)[1];
84 83
85 if (unlikely(skb->ip_summed != CHECKSUM_COMPLETE)) 84 skb_remcsum_process(skb, (void *)guehdr + hdrlen, start, offset);
86 __skb_checksum_complete(skb);
87
88 delta = remcsum_adjust((void *)guehdr + hdrlen,
89 skb->csum, start, offset);
90
91 /* Adjust skb->csum since we changed the packet */
92 skb->csum = csum_add(skb->csum, delta);
93 85
94 return guehdr; 86 return guehdr;
95} 87}
@@ -228,7 +220,6 @@ static struct guehdr *gue_gro_remcsum(struct sk_buff *skb, unsigned int off,
228 size_t start = ntohs(pd[0]); 220 size_t start = ntohs(pd[0]);
229 size_t offset = ntohs(pd[1]); 221 size_t offset = ntohs(pd[1]);
230 size_t plen = hdrlen + max_t(size_t, offset + sizeof(u16), start); 222 size_t plen = hdrlen + max_t(size_t, offset + sizeof(u16), start);
231 __wsum delta;
232 223
233 if (skb->remcsum_offload) 224 if (skb->remcsum_offload)
234 return guehdr; 225 return guehdr;
@@ -243,12 +234,7 @@ static struct guehdr *gue_gro_remcsum(struct sk_buff *skb, unsigned int off,
243 return NULL; 234 return NULL;
244 } 235 }
245 236
246 delta = remcsum_adjust((void *)guehdr + hdrlen, 237 skb_gro_remcsum_process(skb, (void *)guehdr + hdrlen, start, offset);
247 NAPI_GRO_CB(skb)->csum, start, offset);
248
249 /* Adjust skb->csum since we changed the packet */
250 skb->csum = csum_add(skb->csum, delta);
251 NAPI_GRO_CB(skb)->csum = csum_add(NAPI_GRO_CB(skb)->csum, delta);
252 238
253 skb->remcsum_offload = 1; 239 skb->remcsum_offload = 1;
254 240