Skip to content

Commit 49431af

Browse files
rleonklassert
authored andcommitted
xfrm: rely on XFRM offload
After change of initialization of x->type_offload pointer to be valid only for offloaded SAs. There is no need to rely on both x->type_offload and x->xso.type to determine if SA is offloaded or not. Reviewed-by: Zhu Yanjun <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent b6ccf61 commit 49431af

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

net/xfrm/xfrm_device.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,11 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
419419
struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
420420
struct net_device *dev = x->xso.dev;
421421

422-
if (!x->type_offload ||
423-
(x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED && x->encap))
422+
if (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED)
424423
return false;
425424

426425
if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET ||
427-
((!dev || (dev == xfrm_dst_path(dst)->dev)) &&
428-
!xdst->child->xfrm)) {
426+
((dev == xfrm_dst_path(dst)->dev) && !xdst->child->xfrm)) {
429427
mtu = xfrm_state_mtu(x, xdst->child_mtu_cached);
430428
if (skb->len <= mtu)
431429
goto ok;
@@ -437,8 +435,8 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
437435
return false;
438436

439437
ok:
440-
if (dev && dev->xfrmdev_ops && dev->xfrmdev_ops->xdo_dev_offload_ok)
441-
return x->xso.dev->xfrmdev_ops->xdo_dev_offload_ok(skb, x);
438+
if (dev->xfrmdev_ops->xdo_dev_offload_ok)
439+
return dev->xfrmdev_ops->xdo_dev_offload_ok(skb, x);
442440

443441
return true;
444442
}

0 commit comments

Comments
 (0)