summaryrefslogtreecommitdiffstats
path: root/net/ipv6/esp6_offload.c
diff options
context:
space:
mode:
authorIlan Tayari <ilant@mellanox.com>2017-08-01 12:49:05 +0300
committerSteffen Klassert <steffen.klassert@secunet.com>2017-08-02 11:00:15 +0200
commite51a64727079f46fc3a99f380de384d5ab01fffa (patch)
tree4898eade0fed1b5bffdaccd9852ee7eeeb24baf8 /net/ipv6/esp6_offload.c
parentec9567a9e008d1248e4d88f7ff1026ba68133621 (diff)
downloadlinux-e51a64727079f46fc3a99f380de384d5ab01fffa.tar.gz
linux-e51a64727079f46fc3a99f380de384d5ab01fffa.tar.bz2
linux-e51a64727079f46fc3a99f380de384d5ab01fffa.zip
esp6: Support RX checksum with crypto offload
Keep the device's reported ip_summed indication in case crypto was offloaded by the device. Subtract the csum values of the stripped parts (esp header+iv, esp trailer+auth_data) to keep value correct. Note: CHECKSUM_COMPLETE should be indicated only if skb->csum has the post-decryption offload csum value. Signed-off-by: Ariel Levkovich <lariel@mellanox.com> Signed-off-by: Ilan Tayari <ilant@mellanox.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/ipv6/esp6_offload.c')
-rw-r--r--net/ipv6/esp6_offload.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c
index f02f131f6435..eec3add177fe 100644
--- a/net/ipv6/esp6_offload.c
+++ b/net/ipv6/esp6_offload.c
@@ -209,11 +209,13 @@ out:
static int esp6_input_tail(struct xfrm_state *x, struct sk_buff *skb)
{
struct crypto_aead *aead = x->data;
+ struct xfrm_offload *xo = xfrm_offload(skb);
if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead)))
return -EINVAL;
- skb->ip_summed = CHECKSUM_NONE;
+ if (!(xo->flags & CRYPTO_DONE))
+ skb->ip_summed = CHECKSUM_NONE;
return esp6_input_done2(skb, 0);
}