mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-15 19:01:45 -04:00
RDMA/mlx5: Allocate IB device with net namespace supplied from core dev
Use the new ib_alloc_device_with_net() API to allocate the IB device so that it is properly bound to the network namespace obtained via mlx5_core_net(). This change ensures correct namespace association (e.g., for containerized setups). Additionally, expose mlx5_core_net so that RDMA driver can use it. Signed-off-by: Shay Drory <shayd@nvidia.com> Signed-off-by: Mark Bloch <mbloch@nvidia.com> Reviewed-by: Parav Pandit <parav@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
This commit is contained in:
committed by
Leon Romanovsky
parent
8cffca866b
commit
611d08207d
@@ -88,7 +88,8 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
|
||||
else
|
||||
return mlx5_ib_set_vport_rep(lag_master, rep, vport_index);
|
||||
|
||||
ibdev = ib_alloc_device(mlx5_ib_dev, ib_dev);
|
||||
ibdev = ib_alloc_device_with_net(mlx5_ib_dev, ib_dev,
|
||||
mlx5_core_net(lag_master));
|
||||
if (!ibdev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -4793,7 +4793,8 @@ static struct ib_device *mlx5_ib_add_sub_dev(struct ib_device *parent,
|
||||
!MLX5_CAP_GEN_2(mparent->mdev, multiplane_qp_ud))
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
|
||||
mplane = ib_alloc_device(mlx5_ib_dev, ib_dev);
|
||||
mplane = ib_alloc_device_with_net(mlx5_ib_dev, ib_dev,
|
||||
mlx5_core_net(mparent->mdev));
|
||||
if (!mplane)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
@@ -4907,7 +4908,8 @@ static int mlx5r_probe(struct auxiliary_device *adev,
|
||||
|
||||
num_ports = max(MLX5_CAP_GEN(mdev, num_ports),
|
||||
MLX5_CAP_GEN(mdev, num_vhca_ports));
|
||||
dev = ib_alloc_device(mlx5_ib_dev, ib_dev);
|
||||
dev = ib_alloc_device_with_net(mlx5_ib_dev, ib_dev,
|
||||
mlx5_core_net(mdev));
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -45,11 +45,6 @@ int mlx5_crdump_enable(struct mlx5_core_dev *dev);
|
||||
void mlx5_crdump_disable(struct mlx5_core_dev *dev);
|
||||
int mlx5_crdump_collect(struct mlx5_core_dev *dev, u32 *cr_data);
|
||||
|
||||
static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
|
||||
{
|
||||
return devlink_net(priv_to_devlink(dev));
|
||||
}
|
||||
|
||||
static inline struct net_device *mlx5_uplink_netdev_get(struct mlx5_core_dev *mdev)
|
||||
{
|
||||
return mdev->mlx5e_res.uplink_netdev;
|
||||
|
||||
@@ -1349,4 +1349,9 @@ enum {
|
||||
};
|
||||
|
||||
bool mlx5_wc_support_get(struct mlx5_core_dev *mdev);
|
||||
|
||||
static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
|
||||
{
|
||||
return devlink_net(priv_to_devlink(dev));
|
||||
}
|
||||
#endif /* MLX5_DRIVER_H */
|
||||
|
||||
Reference in New Issue
Block a user