Lines Matching refs:mpi
64 struct mlx5_ib_multiport_info *mpi; member
83 struct mlx5_ib_dev *mlx5_ib_get_ibdev_from_mpi(struct mlx5_ib_multiport_info *mpi) in mlx5_ib_get_ibdev_from_mpi() argument
88 dev = mpi->ibdev; in mlx5_ib_get_ibdev_from_mpi()
311 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_get_native_port_mdev() local
334 mpi = ibdev->port[ib_port_num - 1].mp.mpi; in mlx5_ib_get_native_port_mdev()
335 if (mpi && !mpi->unaffiliate) { in mlx5_ib_get_native_port_mdev()
336 mdev = mpi->mdev; in mlx5_ib_get_native_port_mdev()
340 if (!mpi->is_master) in mlx5_ib_get_native_port_mdev()
341 mpi->mdev_refcnt++; in mlx5_ib_get_native_port_mdev()
352 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_put_native_port_mdev() local
361 mpi = ibdev->port[port_num - 1].mp.mpi; in mlx5_ib_put_native_port_mdev()
362 if (mpi->is_master) in mlx5_ib_put_native_port_mdev()
365 mpi->mdev_refcnt--; in mlx5_ib_put_native_port_mdev()
366 if (mpi->unaffiliate) in mlx5_ib_put_native_port_mdev()
367 complete(&mpi->unref_comp); in mlx5_ib_put_native_port_mdev()
2748 ibdev = mlx5_ib_get_ibdev_from_mpi(work->mpi); in mlx5_ib_handle_event()
2819 work->mpi = container_of(nb, struct mlx5_ib_multiport_info, mdev_events); in mlx5_ib_event_slave_port()
3449 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_unbind_slave_port() argument
3451 u32 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_unbind_slave_port()
3462 mlx5_core_mp_event_replay(mpi->mdev, in mlx5_ib_unbind_slave_port()
3469 if (!mpi->ibdev) { in mlx5_ib_unbind_slave_port()
3474 mpi->ibdev = NULL; in mlx5_ib_unbind_slave_port()
3477 if (mpi->mdev_events.notifier_call) in mlx5_ib_unbind_slave_port()
3478 mlx5_notifier_unregister(mpi->mdev, &mpi->mdev_events); in mlx5_ib_unbind_slave_port()
3479 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_unbind_slave_port()
3483 comps = mpi->mdev_refcnt; in mlx5_ib_unbind_slave_port()
3485 mpi->unaffiliate = true; in mlx5_ib_unbind_slave_port()
3486 init_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
3490 wait_for_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
3493 mpi->unaffiliate = false; in mlx5_ib_unbind_slave_port()
3496 port->mp.mpi = NULL; in mlx5_ib_unbind_slave_port()
3500 err = mlx5_nic_vport_unaffiliate_multiport(mpi->mdev); in mlx5_ib_unbind_slave_port()
3514 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_bind_slave_port() argument
3516 u32 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_bind_slave_port()
3523 if (ibdev->port[port_num].mp.mpi) { in mlx5_ib_bind_slave_port()
3530 ibdev->port[port_num].mp.mpi = mpi; in mlx5_ib_bind_slave_port()
3531 mpi->ibdev = ibdev; in mlx5_ib_bind_slave_port()
3532 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_bind_slave_port()
3535 err = mlx5_nic_vport_affiliate_multiport(ibdev->mdev, mpi->mdev); in mlx5_ib_bind_slave_port()
3541 mpi->mdev_events.notifier_call = mlx5_ib_event_slave_port; in mlx5_ib_bind_slave_port()
3542 mlx5_notifier_register(mpi->mdev, &mpi->mdev_events); in mlx5_ib_bind_slave_port()
3546 key = mpi->mdev->priv.adev_idx; in mlx5_ib_bind_slave_port()
3547 mlx5_core_mp_event_replay(mpi->mdev, in mlx5_ib_bind_slave_port()
3557 mlx5_ib_unbind_slave_port(ibdev, mpi); in mlx5_ib_bind_slave_port()
3601 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_init_multiport_master() local
3623 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5_ib_init_multiport_master()
3624 if (!mpi) { in mlx5_ib_init_multiport_master()
3630 mpi->is_master = true; in mlx5_ib_init_multiport_master()
3631 mpi->mdev = dev->mdev; in mlx5_ib_init_multiport_master()
3632 mpi->sys_image_guid = dev->sys_image_guid; in mlx5_ib_init_multiport_master()
3633 dev->port[i].mp.mpi = mpi; in mlx5_ib_init_multiport_master()
3634 mpi->ibdev = dev; in mlx5_ib_init_multiport_master()
3635 mpi = NULL; in mlx5_ib_init_multiport_master()
3639 list_for_each_entry(mpi, &mlx5_ib_unaffiliated_port_list, in mlx5_ib_init_multiport_master()
3641 if (dev->sys_image_guid == mpi->sys_image_guid && in mlx5_ib_init_multiport_master()
3642 (mlx5_core_native_port_num(mpi->mdev) - 1) == i) { in mlx5_ib_init_multiport_master()
3643 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5_ib_init_multiport_master()
3647 dev_dbg(mpi->mdev->device, in mlx5_ib_init_multiport_master()
3650 list_del(&mpi->list); in mlx5_ib_init_multiport_master()
3676 if (dev->port[i].mp.mpi) { in mlx5_ib_cleanup_multiport_master()
3679 kfree(dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
3680 dev->port[i].mp.mpi = NULL; in mlx5_ib_cleanup_multiport_master()
3684 list_add_tail(&dev->port[i].mp.mpi->list, in mlx5_ib_cleanup_multiport_master()
3687 dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
4755 struct mlx5_ib_multiport_info *mpi; in mlx5r_mp_probe() local
4760 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5r_mp_probe()
4761 if (!mpi) in mlx5r_mp_probe()
4764 mpi->mdev = mdev; in mlx5r_mp_probe()
4766 &mpi->sys_image_guid); in mlx5r_mp_probe()
4768 kfree(mpi); in mlx5r_mp_probe()
4774 if (dev->sys_image_guid == mpi->sys_image_guid) in mlx5r_mp_probe()
4775 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5r_mp_probe()
4779 mpi->ibdev->ib_active = true; in mlx5r_mp_probe()
4785 list_add_tail(&mpi->list, &mlx5_ib_unaffiliated_port_list); in mlx5r_mp_probe()
4791 auxiliary_set_drvdata(adev, mpi); in mlx5r_mp_probe()
4797 struct mlx5_ib_multiport_info *mpi; in mlx5r_mp_remove() local
4799 mpi = auxiliary_get_drvdata(adev); in mlx5r_mp_remove()
4801 if (mpi->ibdev) in mlx5r_mp_remove()
4802 mlx5_ib_unbind_slave_port(mpi->ibdev, mpi); in mlx5r_mp_remove()
4804 list_del(&mpi->list); in mlx5r_mp_remove()
4806 kfree(mpi); in mlx5r_mp_remove()