summaryrefslogtreecommitdiffstats
path: root/drivers/net/netdevsim/ipsec.c
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2022-12-02 19:41:28 +0100
committerSteffen Klassert <steffen.klassert@secunet.com>2022-12-05 10:32:44 +0100
commit62f6eca5de103c6823f6ca2abbf2ee242e132207 (patch)
tree0f12f6e5c4e0a97d25e1f7b1c29171c22ac94763 /drivers/net/netdevsim/ipsec.c
parentxfrm: add new packet offload flag (diff)
downloadlinux-62f6eca5de103c6823f6ca2abbf2ee242e132207.tar.xz
linux-62f6eca5de103c6823f6ca2abbf2ee242e132207.zip
xfrm: allow state packet offload mode
Allow users to configure xfrm states with packet offload mode. The packet mode must be requested both for policy and state, and such requires us to do not implement fallback. We explicitly return an error if requested packet mode can't be configured. Reviewed-by: Raed Salem <raeds@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'drivers/net/netdevsim/ipsec.c')
-rw-r--r--drivers/net/netdevsim/ipsec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/netdevsim/ipsec.c b/drivers/net/netdevsim/ipsec.c
index 386336a38f34..b93baf5c8bee 100644
--- a/drivers/net/netdevsim/ipsec.c
+++ b/drivers/net/netdevsim/ipsec.c
@@ -149,6 +149,11 @@ static int nsim_ipsec_add_sa(struct xfrm_state *xs)
return -EINVAL;
}
+ if (xs->xso.type != XFRM_DEV_OFFLOAD_CRYPTO) {
+ netdev_err(dev, "Unsupported ipsec offload type\n");
+ return -EINVAL;
+ }
+
/* find the first unused index */
ret = nsim_ipsec_find_empty_idx(ipsec);
if (ret < 0) {