aboutsummaryrefslogtreecommitdiff
path: root/net/ipv4/xfrm4_mode_transport.c
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2014-08-13 16:14:13 -0500
committerDavid Barksdale <amatus@amatus.name>2014-08-13 16:14:13 -0500
commitace6c6d243016e272050787c14e27a83ecd94a25 (patch)
treec837edb1ca98b2552fbc7edba47aeb63f98ca1f0 /net/ipv4/xfrm4_mode_transport.c
parent1b6e1688bd215cd7c9cb75650fa815a1ec6567e1 (diff)
Diffstat (limited to 'net/ipv4/xfrm4_mode_transport.c')
-rw-r--r--net/ipv4/xfrm4_mode_transport.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/net/ipv4/xfrm4_mode_transport.c b/net/ipv4/xfrm4_mode_transport.c
index fd840c7d75e..bf1498c138e 100644
--- a/net/ipv4/xfrm4_mode_transport.c
+++ b/net/ipv4/xfrm4_mode_transport.c
@@ -23,6 +23,15 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
struct iphdr *iph = ip_hdr(skb);
int ihl = iph->ihl * 4;
+ if (x->alg_flags & XFRM_ALGO_FLAGS_OFFLOAD_TRANPORT) {
+ /* Hardware offload will take care of moving the IP header */
+ skb_set_network_header(skb, -x->props.header_len);
+ skb->mac_header = skb->network_header +
+ offsetof(struct iphdr, protocol);
+ skb->transport_header = skb->network_header + ihl;
+ return 0;
+ }
+
skb_set_network_header(skb, -x->props.header_len);
skb->mac_header = skb->network_header +
offsetof(struct iphdr, protocol);
@@ -42,8 +51,16 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
*/
static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)
{
- int ihl = skb->data - skb_transport_header(skb);
+ int ihl;
+
+ if (x->alg_flags & XFRM_ALGO_FLAGS_OFFLOAD_TRANPORT) {
+ /* Hardware offload will take care of move the IP header */
+ skb->network_header = skb->transport_header;
+ skb_reset_transport_header(skb);
+ return 0;
+ }
+ ihl = skb->data - skb_transport_header(skb);
if (skb->transport_header != skb->network_header) {
memmove(skb_transport_header(skb),
skb_network_header(skb), ihl);