Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bcd1f8a4 authored by Steffen Klassert's avatar Steffen Klassert
Browse files

xfrm: Prepare the GRO codepath for hardware offloading.



On IPsec hardware offloading, we already get a secpath with
valid state attached when the packet enters the GRO handlers.
So check for hardware offload and skip the state lookup in this
case.

Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent f1bd7d65
Loading
Loading
Loading
Loading
+23 −19
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ static struct sk_buff **esp4_gro_receive(struct sk_buff **head,
	if ((err = xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq)) != 0)
		goto out;

	xo = xfrm_offload(skb);
	if (!xo || !(xo->flags & CRYPTO_DONE)) {
		err = secpath_set(skb);
		if (err)
			goto out;
@@ -64,6 +66,8 @@ static struct sk_buff **esp4_gro_receive(struct sk_buff **head,
			xfrm_state_put(x);
			goto out;
		}
	}

	xo->flags |= XFRM_GRO;

	XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL;
+23 −19
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ static struct sk_buff **esp6_gro_receive(struct sk_buff **head,
	if ((err = xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq)) != 0)
		goto out;

	xo = xfrm_offload(skb);
	if (!xo || !(xo->flags & CRYPTO_DONE)) {
		err = secpath_set(skb);
		if (err)
			goto out;
@@ -66,6 +68,8 @@ static struct sk_buff **esp6_gro_receive(struct sk_buff **head,
			xfrm_state_put(x);
			goto out;
		}
	}

	xo->flags |= XFRM_GRO;

	XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL;
+25 −25
Original line number Diff line number Diff line
@@ -223,11 +223,10 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
			seq = XFRM_SKB_CB(skb)->seq.input.low;
			goto resume;
		}

		/* encap_type < -1 indicates a GRO call. */
		encap_type = 0;
		seq = XFRM_SPI_SKB_CB(skb)->seq;
		goto lock;
	}

		if (xo && (xo->flags & CRYPTO_DONE)) {
			crypto_done = true;
@@ -256,6 +255,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
				XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
				goto drop;
			}
		}

		goto lock;
	}