Skip to content

Commit 5589b8f

Browse files
raed-salemSaeed Mahameed
authored andcommitted
net/mlx5e: Add IPsec support to uplink representor
Add the xfrm xdo and ipsec_init/cleanup to uplink representor to support IPsec in SRIOV switchdev mode. Signed-off-by: Raed Salem <[email protected]> Signed-off-by: Huy Nguyen <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent e8c8276 commit 5589b8f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ int mlx5e_ipsec_init(struct mlx5e_priv *priv)
428428
spin_lock_init(&ipsec->sadb_rx_lock);
429429
ida_init(&ipsec->halloc);
430430
ipsec->en_priv = priv;
431-
ipsec->en_priv->ipsec = ipsec;
432431
ipsec->no_trailer = !!(mlx5_accel_ipsec_device_caps(priv->mdev) &
433432
MLX5_ACCEL_IPSEC_CAP_RX_NO_TRAILER);
434433
ipsec->wq = alloc_ordered_workqueue("mlx5e_ipsec: %s", 0,
@@ -438,6 +437,7 @@ int mlx5e_ipsec_init(struct mlx5e_priv *priv)
438437
return -ENOMEM;
439438
}
440439

440+
priv->ipsec = ipsec;
441441
mlx5e_accel_ipsec_fs_init(priv);
442442
netdev_dbg(priv->netdev, "IPSec attached to netdevice\n");
443443
return 0;

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include "lib/mlx5.h"
5252
#define CREATE_TRACE_POINTS
5353
#include "diag/en_rep_tracepoint.h"
54+
#include "en_accel/ipsec.h"
5455

5556
#define MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE \
5657
max(0x7, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)
@@ -630,13 +631,19 @@ static int mlx5e_init_ul_rep(struct mlx5_core_dev *mdev,
630631
struct net_device *netdev)
631632
{
632633
struct mlx5e_priv *priv = netdev_priv(netdev);
634+
int err;
635+
636+
err = mlx5e_ipsec_init(priv);
637+
if (err)
638+
mlx5_core_err(mdev, "Uplink rep IPsec initialization failed, %d\n", err);
633639

634640
mlx5e_vxlan_set_netdev_info(priv);
635641
return mlx5e_init_rep(mdev, netdev);
636642
}
637643

638644
static void mlx5e_cleanup_rep(struct mlx5e_priv *priv)
639645
{
646+
mlx5e_ipsec_cleanup(priv);
640647
}
641648

642649
static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv)

0 commit comments

Comments
 (0)