Skip to content

Commit eff5b66

Browse files
PatrisiousHaddadrleon
authored andcommitted
net/mlx5: Store devcom pointer inside IPsec RoCE
Store the mlx5e priv devcom component within IPsec RoCE to enable the IPsec RoCE code to access the other device's private information. This includes retrieving the necessary device information and the IPsec database, which helps determine if IPsec is configured or not. Signed-off-by: Patrisious Haddad <phaddad@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Link: https://lore.kernel.org/r/5bb3160ceeb07523542302886da54c78eef0d2af.1695296682.git.leon@kernel.org Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent bf11485 commit eff5b66

5 files changed

Lines changed: 15 additions & 6 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ void mlx5e_ipsec_init(struct mlx5e_priv *priv)
870870
}
871871

872872
ipsec->is_uplink_rep = mlx5e_is_uplink_rep(priv);
873-
ret = mlx5e_accel_ipsec_fs_init(ipsec);
873+
ret = mlx5e_accel_ipsec_fs_init(ipsec, &priv->devcom);
874874
if (ret)
875875
goto err_fs_init;
876876

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <net/xfrm.h>
3939
#include <linux/idr.h>
4040
#include "lib/aso.h"
41+
#include "lib/devcom.h"
4142

4243
#define MLX5E_IPSEC_SADB_RX_BITS 10
4344
#define MLX5E_IPSEC_ESN_SCOPE_MID 0x80000000L
@@ -304,7 +305,7 @@ void mlx5e_ipsec_cleanup(struct mlx5e_priv *priv);
304305
void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv);
305306

306307
void mlx5e_accel_ipsec_fs_cleanup(struct mlx5e_ipsec *ipsec);
307-
int mlx5e_accel_ipsec_fs_init(struct mlx5e_ipsec *ipsec);
308+
int mlx5e_accel_ipsec_fs_init(struct mlx5e_ipsec *ipsec, struct mlx5_devcom_comp_dev **devcom);
308309
int mlx5e_accel_ipsec_fs_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry);
309310
void mlx5e_accel_ipsec_fs_del_rule(struct mlx5e_ipsec_sa_entry *sa_entry);
310311
int mlx5e_accel_ipsec_fs_add_pol(struct mlx5e_ipsec_pol_entry *pol_entry);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,8 @@ void mlx5e_accel_ipsec_fs_cleanup(struct mlx5e_ipsec *ipsec)
18881888
}
18891889
}
18901890

1891-
int mlx5e_accel_ipsec_fs_init(struct mlx5e_ipsec *ipsec)
1891+
int mlx5e_accel_ipsec_fs_init(struct mlx5e_ipsec *ipsec,
1892+
struct mlx5_devcom_comp_dev **devcom)
18921893
{
18931894
struct mlx5_core_dev *mdev = ipsec->mdev;
18941895
struct mlx5_flow_namespace *ns, *ns_esw;
@@ -1940,7 +1941,7 @@ int mlx5e_accel_ipsec_fs_init(struct mlx5e_ipsec *ipsec)
19401941
ipsec->tx_esw->ns = ns_esw;
19411942
xa_init_flags(&ipsec->rx_esw->ipsec_obj_id_map, XA_FLAGS_ALLOC1);
19421943
} else if (mlx5_ipsec_device_caps(mdev) & MLX5_IPSEC_CAP_ROCE) {
1943-
ipsec->roce = mlx5_ipsec_fs_roce_init(mdev);
1944+
ipsec->roce = mlx5_ipsec_fs_roce_init(mdev, devcom);
19441945
}
19451946

19461947
return 0;

drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct mlx5_ipsec_fs {
3131
struct mlx5_ipsec_rx_roce ipv4_rx;
3232
struct mlx5_ipsec_rx_roce ipv6_rx;
3333
struct mlx5_ipsec_tx_roce tx;
34+
struct mlx5_devcom_comp_dev **devcom;
3435
};
3536

3637
static void ipsec_fs_roce_setup_udp_dport(struct mlx5_flow_spec *spec,
@@ -337,7 +338,8 @@ void mlx5_ipsec_fs_roce_cleanup(struct mlx5_ipsec_fs *ipsec_roce)
337338
kfree(ipsec_roce);
338339
}
339340

340-
struct mlx5_ipsec_fs *mlx5_ipsec_fs_roce_init(struct mlx5_core_dev *mdev)
341+
struct mlx5_ipsec_fs *mlx5_ipsec_fs_roce_init(struct mlx5_core_dev *mdev,
342+
struct mlx5_devcom_comp_dev **devcom)
341343
{
342344
struct mlx5_ipsec_fs *roce_ipsec;
343345
struct mlx5_flow_namespace *ns;
@@ -363,6 +365,8 @@ struct mlx5_ipsec_fs *mlx5_ipsec_fs_roce_init(struct mlx5_core_dev *mdev)
363365

364366
roce_ipsec->tx.ns = ns;
365367

368+
roce_ipsec->devcom = devcom;
369+
366370
return roce_ipsec;
367371

368372
err_tx:

drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#ifndef __MLX5_LIB_IPSEC_H__
55
#define __MLX5_LIB_IPSEC_H__
66

7+
#include "lib/devcom.h"
8+
79
struct mlx5_ipsec_fs;
810

911
struct mlx5_flow_table *
@@ -20,6 +22,7 @@ int mlx5_ipsec_fs_roce_tx_create(struct mlx5_core_dev *mdev,
2022
struct mlx5_ipsec_fs *ipsec_roce,
2123
struct mlx5_flow_table *pol_ft);
2224
void mlx5_ipsec_fs_roce_cleanup(struct mlx5_ipsec_fs *ipsec_roce);
23-
struct mlx5_ipsec_fs *mlx5_ipsec_fs_roce_init(struct mlx5_core_dev *mdev);
25+
struct mlx5_ipsec_fs *mlx5_ipsec_fs_roce_init(struct mlx5_core_dev *mdev,
26+
struct mlx5_devcom_comp_dev **devcom);
2427

2528
#endif /* __MLX5_LIB_IPSEC_H__ */

0 commit comments

Comments
 (0)