Skip to content

Commit

Permalink
xfrm: Support UDP encapsulation in packet offload mode
Browse files Browse the repository at this point in the history
Since mlx5 supports UDP encapsulation in packet offload, change the XFRM
core to allow users to configure it.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Leon Romanovsky authored and Paolo Abeni committed Jul 25, 2023
1 parent d659549 commit 89edf40
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions net/xfrm/xfrm_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,20 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
return -EINVAL;
}

/* We don't yet support UDP encapsulation and TFC padding. */
if (x->encap || x->tfcpad) {
NL_SET_ERR_MSG(extack, "Encapsulation and TFC padding can't be offloaded");
return -EINVAL;
}

if (xuo->flags &
~(XFRM_OFFLOAD_IPV6 | XFRM_OFFLOAD_INBOUND | XFRM_OFFLOAD_PACKET)) {
NL_SET_ERR_MSG(extack, "Unrecognized flags in offload request");
return -EINVAL;
}

is_packet_offload = xuo->flags & XFRM_OFFLOAD_PACKET;

/* We don't yet support UDP encapsulation and TFC padding. */
if ((!is_packet_offload && x->encap) || x->tfcpad) {
NL_SET_ERR_MSG(extack, "Encapsulation and TFC padding can't be offloaded");
return -EINVAL;
}

dev = dev_get_by_index(net, xuo->ifindex);
if (!dev) {
if (!(xuo->flags & XFRM_OFFLOAD_INBOUND)) {
Expand Down

0 comments on commit 89edf40

Please sign in to comment.