Lines Matching refs:mpi

62 		struct mlx5_ib_multiport_info *mpi;  member
81 struct mlx5_ib_dev *mlx5_ib_get_ibdev_from_mpi(struct mlx5_ib_multiport_info *mpi) in mlx5_ib_get_ibdev_from_mpi() argument
86 dev = mpi->ibdev; in mlx5_ib_get_ibdev_from_mpi()
282 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_get_native_port_mdev() local
297 mpi = ibdev->port[ib_port_num - 1].mp.mpi; in mlx5_ib_get_native_port_mdev()
298 if (mpi && !mpi->unaffiliate) { in mlx5_ib_get_native_port_mdev()
299 mdev = mpi->mdev; in mlx5_ib_get_native_port_mdev()
303 if (!mpi->is_master) in mlx5_ib_get_native_port_mdev()
304 mpi->mdev_refcnt++; in mlx5_ib_get_native_port_mdev()
315 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_put_native_port_mdev() local
324 mpi = ibdev->port[port_num - 1].mp.mpi; in mlx5_ib_put_native_port_mdev()
325 if (mpi->is_master) in mlx5_ib_put_native_port_mdev()
328 mpi->mdev_refcnt--; in mlx5_ib_put_native_port_mdev()
329 if (mpi->unaffiliate) in mlx5_ib_put_native_port_mdev()
330 complete(&mpi->unref_comp); in mlx5_ib_put_native_port_mdev()
2671 ibdev = mlx5_ib_get_ibdev_from_mpi(work->mpi); in mlx5_ib_handle_event()
2742 work->mpi = container_of(nb, struct mlx5_ib_multiport_info, mdev_events); in mlx5_ib_event_slave_port()
3168 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_unbind_slave_port() argument
3170 u32 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_unbind_slave_port()
3181 if (!mpi->ibdev) { in mlx5_ib_unbind_slave_port()
3186 mpi->ibdev = NULL; in mlx5_ib_unbind_slave_port()
3189 if (mpi->mdev_events.notifier_call) in mlx5_ib_unbind_slave_port()
3190 mlx5_notifier_unregister(mpi->mdev, &mpi->mdev_events); in mlx5_ib_unbind_slave_port()
3191 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_unbind_slave_port()
3195 comps = mpi->mdev_refcnt; in mlx5_ib_unbind_slave_port()
3197 mpi->unaffiliate = true; in mlx5_ib_unbind_slave_port()
3198 init_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
3202 wait_for_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
3205 mpi->unaffiliate = false; in mlx5_ib_unbind_slave_port()
3208 port->mp.mpi = NULL; in mlx5_ib_unbind_slave_port()
3212 err = mlx5_nic_vport_unaffiliate_multiport(mpi->mdev); in mlx5_ib_unbind_slave_port()
3226 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_bind_slave_port() argument
3228 u32 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_bind_slave_port()
3234 if (ibdev->port[port_num].mp.mpi) { in mlx5_ib_bind_slave_port()
3241 ibdev->port[port_num].mp.mpi = mpi; in mlx5_ib_bind_slave_port()
3242 mpi->ibdev = ibdev; in mlx5_ib_bind_slave_port()
3243 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_bind_slave_port()
3246 err = mlx5_nic_vport_affiliate_multiport(ibdev->mdev, mpi->mdev); in mlx5_ib_bind_slave_port()
3252 mpi->mdev_events.notifier_call = mlx5_ib_event_slave_port; in mlx5_ib_bind_slave_port()
3253 mlx5_notifier_register(mpi->mdev, &mpi->mdev_events); in mlx5_ib_bind_slave_port()
3260 mlx5_ib_unbind_slave_port(ibdev, mpi); in mlx5_ib_bind_slave_port()
3269 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_init_multiport_master() local
3291 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5_ib_init_multiport_master()
3292 if (!mpi) { in mlx5_ib_init_multiport_master()
3298 mpi->is_master = true; in mlx5_ib_init_multiport_master()
3299 mpi->mdev = dev->mdev; in mlx5_ib_init_multiport_master()
3300 mpi->sys_image_guid = dev->sys_image_guid; in mlx5_ib_init_multiport_master()
3301 dev->port[i].mp.mpi = mpi; in mlx5_ib_init_multiport_master()
3302 mpi->ibdev = dev; in mlx5_ib_init_multiport_master()
3303 mpi = NULL; in mlx5_ib_init_multiport_master()
3307 list_for_each_entry(mpi, &mlx5_ib_unaffiliated_port_list, in mlx5_ib_init_multiport_master()
3309 if (dev->sys_image_guid == mpi->sys_image_guid && in mlx5_ib_init_multiport_master()
3310 (mlx5_core_native_port_num(mpi->mdev) - 1) == i) { in mlx5_ib_init_multiport_master()
3311 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5_ib_init_multiport_master()
3315 dev_dbg(mpi->mdev->device, in mlx5_ib_init_multiport_master()
3318 list_del(&mpi->list); in mlx5_ib_init_multiport_master()
3344 if (dev->port[i].mp.mpi) { in mlx5_ib_cleanup_multiport_master()
3347 kfree(dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
3348 dev->port[i].mp.mpi = NULL; in mlx5_ib_cleanup_multiport_master()
3352 list_add_tail(&dev->port[i].mp.mpi->list, in mlx5_ib_cleanup_multiport_master()
3355 dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
4314 struct mlx5_ib_multiport_info *mpi; in mlx5r_mp_probe() local
4319 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5r_mp_probe()
4320 if (!mpi) in mlx5r_mp_probe()
4323 mpi->mdev = mdev; in mlx5r_mp_probe()
4325 &mpi->sys_image_guid); in mlx5r_mp_probe()
4327 kfree(mpi); in mlx5r_mp_probe()
4333 if (dev->sys_image_guid == mpi->sys_image_guid) in mlx5r_mp_probe()
4334 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5r_mp_probe()
4338 mpi->ibdev->ib_active = true; in mlx5r_mp_probe()
4344 list_add_tail(&mpi->list, &mlx5_ib_unaffiliated_port_list); in mlx5r_mp_probe()
4350 auxiliary_set_drvdata(adev, mpi); in mlx5r_mp_probe()
4356 struct mlx5_ib_multiport_info *mpi; in mlx5r_mp_remove() local
4358 mpi = auxiliary_get_drvdata(adev); in mlx5r_mp_remove()
4360 if (mpi->ibdev) in mlx5r_mp_remove()
4361 mlx5_ib_unbind_slave_port(mpi->ibdev, mpi); in mlx5r_mp_remove()
4363 list_del(&mpi->list); in mlx5r_mp_remove()
4365 kfree(mpi); in mlx5r_mp_remove()