xfrm: Use the XFRM_GRO to indicate a GRO call on input
authorSteffen Klassert <steffen.klassert@secunet.com>
Wed, 4 Oct 2023 13:05:10 +0000 (15:05 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Fri, 6 Oct 2023 05:29:52 +0000 (07:29 +0200)
This is needed to support GRO for ESP in UDP encapsulation.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Co-developed-by: Antony Antony <antony.antony@secunet.com>
Signed-off-by: Antony Antony <antony.antony@secunet.com>
Reviewed-by: Eyal Birger <eyal.birger@gmail.com>
net/ipv4/esp4_offload.c
net/ipv6/esp6_offload.c
net/xfrm/xfrm_input.c

index 10e96ed6c9e395254f24abbc2dbb9ce0382ef45b..5b487d12d0cf478522c4795f82d4765a9fa003bc 100644 (file)
@@ -77,7 +77,7 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head,
 
        /* We don't need to handle errors from xfrm_input, it does all
         * the error handling and frees the resources on error. */
-       xfrm_input(skb, IPPROTO_ESP, spi, -2);
+       xfrm_input(skb, IPPROTO_ESP, spi, 0);
 
        return ERR_PTR(-EINPROGRESS);
 out_reset:
index a189e08370a5ea34db6de23929b99b5dd2147fd6..19ff2bceb4e19b16e559ab73fdb1e6a7cb0d6bd8 100644 (file)
@@ -104,7 +104,7 @@ static struct sk_buff *esp6_gro_receive(struct list_head *head,
 
        /* We don't need to handle errors from xfrm_input, it does all
         * the error handling and frees the resources on error. */
-       xfrm_input(skb, IPPROTO_ESP, spi, -2);
+       xfrm_input(skb, IPPROTO_ESP, spi, 0);
 
        return ERR_PTR(-EINPROGRESS);
 out_reset:
index d5ee96789d4bf3ba3ec2869edeeea5d91a92d677..bd4ce21d76d7551d8f0a4a11f4b75705a7f634c5 100644 (file)
@@ -462,7 +462,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
        struct xfrm_offload *xo = xfrm_offload(skb);
        struct sec_path *sp;
 
-       if (encap_type < 0) {
+       if (encap_type < 0 || (xo && xo->flags & XFRM_GRO)) {
                x = xfrm_input_state(skb);
 
                if (unlikely(x->km.state != XFRM_STATE_VALID)) {
@@ -485,9 +485,7 @@ 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;
+               /* GRO call */
                seq = XFRM_SPI_SKB_CB(skb)->seq;
 
                if (xo && (xo->flags & CRYPTO_DONE)) {