mirror of
https://github.com/torvalds/linux.git
synced 2025-08-16 06:31:34 +02:00
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 <yanjun.zhu@linux.dev> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
b6ccf61aa4
commit
49431af6c4
1 changed files with 4 additions and 6 deletions
|
@ -419,13 +419,11 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
|
||||||
struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
|
struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
|
||||||
struct net_device *dev = x->xso.dev;
|
struct net_device *dev = x->xso.dev;
|
||||||
|
|
||||||
if (!x->type_offload ||
|
if (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED)
|
||||||
(x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED && x->encap))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET ||
|
if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET ||
|
||||||
((!dev || (dev == xfrm_dst_path(dst)->dev)) &&
|
((dev == xfrm_dst_path(dst)->dev) && !xdst->child->xfrm)) {
|
||||||
!xdst->child->xfrm)) {
|
|
||||||
mtu = xfrm_state_mtu(x, xdst->child_mtu_cached);
|
mtu = xfrm_state_mtu(x, xdst->child_mtu_cached);
|
||||||
if (skb->len <= mtu)
|
if (skb->len <= mtu)
|
||||||
goto ok;
|
goto ok;
|
||||||
|
@ -437,8 +435,8 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ok:
|
ok:
|
||||||
if (dev && dev->xfrmdev_ops && dev->xfrmdev_ops->xdo_dev_offload_ok)
|
if (dev->xfrmdev_ops->xdo_dev_offload_ok)
|
||||||
return x->xso.dev->xfrmdev_ops->xdo_dev_offload_ok(skb, x);
|
return dev->xfrmdev_ops->xdo_dev_offload_ok(skb, x);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue