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: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
Родитель
f1bd7d659e
Коммит
bcd1f8a45e
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче