]> www.infradead.org Git - users/griffoul/linux.git/commitdiff
xfrm: restore GSO for SW crypto
authorSabrina Dubroca <sd@queasysnail.net>
Mon, 4 Aug 2025 09:26:25 +0000 (11:26 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Thu, 7 Aug 2025 06:05:10 +0000 (08:05 +0200)
Commit 49431af6c4ef incorrectly assumes that the GSO path is only used
by HW offload, but it's also useful for SW crypto.

This patch re-enables GSO for SW crypto. It's not an exact revert to
preserve the other changes made to xfrm_dev_offload_ok afterwards, but
it reverts all of its effects.

Fixes: 49431af6c4ef ("xfrm: rely on XFRM offload")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_device.c

index d2819baea414f73a7c8fbcf50fe4aa65d0f2ff54..1f88472aaac0afe7e23d68b86b9e7607ac4e4d54 100644 (file)
@@ -415,10 +415,12 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
        struct net_device *dev = x->xso.dev;
        bool check_tunnel_size;
 
-       if (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED)
+       if (!x->type_offload ||
+           (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED && x->encap))
                return false;
 
-       if ((dev == xfrm_dst_path(dst)->dev) && !xdst->child->xfrm) {
+       if ((!dev || dev == xfrm_dst_path(dst)->dev) &&
+           !xdst->child->xfrm) {
                mtu = xfrm_state_mtu(x, xdst->child_mtu_cached);
                if (skb->len <= mtu)
                        goto ok;
@@ -430,6 +432,9 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
        return false;
 
 ok:
+       if (!dev)
+               return true;
+
        check_tunnel_size = x->xso.type == XFRM_DEV_OFFLOAD_PACKET &&
                            x->props.mode == XFRM_MODE_TUNNEL;
        switch (x->props.family) {