Lines Matching refs:mpi
59 struct mlx5_ib_multiport_info *mpi; member
84 struct mlx5_ib_dev *mlx5_ib_get_ibdev_from_mpi(struct mlx5_ib_multiport_info *mpi) in mlx5_ib_get_ibdev_from_mpi() argument
89 dev = mpi->ibdev; in mlx5_ib_get_ibdev_from_mpi()
276 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_get_native_port_mdev() local
291 mpi = ibdev->port[ib_port_num - 1].mp.mpi; in mlx5_ib_get_native_port_mdev()
292 if (mpi && !mpi->unaffiliate) { in mlx5_ib_get_native_port_mdev()
293 mdev = mpi->mdev; in mlx5_ib_get_native_port_mdev()
297 if (!mpi->is_master) in mlx5_ib_get_native_port_mdev()
298 mpi->mdev_refcnt++; in mlx5_ib_get_native_port_mdev()
309 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_put_native_port_mdev() local
318 mpi = ibdev->port[port_num - 1].mp.mpi; in mlx5_ib_put_native_port_mdev()
319 if (mpi->is_master) in mlx5_ib_put_native_port_mdev()
322 mpi->mdev_refcnt--; in mlx5_ib_put_native_port_mdev()
323 if (mpi->unaffiliate) in mlx5_ib_put_native_port_mdev()
324 complete(&mpi->unref_comp); in mlx5_ib_put_native_port_mdev()
2846 ibdev = mlx5_ib_get_ibdev_from_mpi(work->mpi); in mlx5_ib_handle_event()
2917 work->mpi = container_of(nb, struct mlx5_ib_multiport_info, mdev_events); in mlx5_ib_event_slave_port()
3403 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_unbind_slave_port() argument
3405 u8 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_unbind_slave_port()
3416 if (!mpi->ibdev) { in mlx5_ib_unbind_slave_port()
3421 mpi->ibdev = NULL; in mlx5_ib_unbind_slave_port()
3424 if (mpi->mdev_events.notifier_call) in mlx5_ib_unbind_slave_port()
3425 mlx5_notifier_unregister(mpi->mdev, &mpi->mdev_events); in mlx5_ib_unbind_slave_port()
3426 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_unbind_slave_port()
3430 comps = mpi->mdev_refcnt; in mlx5_ib_unbind_slave_port()
3432 mpi->unaffiliate = true; in mlx5_ib_unbind_slave_port()
3433 init_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
3437 wait_for_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
3440 mpi->unaffiliate = false; in mlx5_ib_unbind_slave_port()
3443 port->mp.mpi = NULL; in mlx5_ib_unbind_slave_port()
3445 list_add_tail(&mpi->list, &mlx5_ib_unaffiliated_port_list); in mlx5_ib_unbind_slave_port()
3449 err = mlx5_nic_vport_unaffiliate_multiport(mpi->mdev); in mlx5_ib_unbind_slave_port()
3463 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_bind_slave_port() argument
3465 u8 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_bind_slave_port()
3471 if (ibdev->port[port_num].mp.mpi) { in mlx5_ib_bind_slave_port()
3478 ibdev->port[port_num].mp.mpi = mpi; in mlx5_ib_bind_slave_port()
3479 mpi->ibdev = ibdev; in mlx5_ib_bind_slave_port()
3480 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_bind_slave_port()
3483 err = mlx5_nic_vport_affiliate_multiport(ibdev->mdev, mpi->mdev); in mlx5_ib_bind_slave_port()
3487 err = get_port_caps(ibdev, mlx5_core_native_port_num(mpi->mdev)); in mlx5_ib_bind_slave_port()
3498 mpi->mdev_events.notifier_call = mlx5_ib_event_slave_port; in mlx5_ib_bind_slave_port()
3499 mlx5_notifier_register(mpi->mdev, &mpi->mdev_events); in mlx5_ib_bind_slave_port()
3506 mlx5_ib_unbind_slave_port(ibdev, mpi); in mlx5_ib_bind_slave_port()
3515 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_init_multiport_master() local
3537 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5_ib_init_multiport_master()
3538 if (!mpi) { in mlx5_ib_init_multiport_master()
3544 mpi->is_master = true; in mlx5_ib_init_multiport_master()
3545 mpi->mdev = dev->mdev; in mlx5_ib_init_multiport_master()
3546 mpi->sys_image_guid = dev->sys_image_guid; in mlx5_ib_init_multiport_master()
3547 dev->port[i].mp.mpi = mpi; in mlx5_ib_init_multiport_master()
3548 mpi->ibdev = dev; in mlx5_ib_init_multiport_master()
3549 mpi = NULL; in mlx5_ib_init_multiport_master()
3553 list_for_each_entry(mpi, &mlx5_ib_unaffiliated_port_list, in mlx5_ib_init_multiport_master()
3555 if (dev->sys_image_guid == mpi->sys_image_guid && in mlx5_ib_init_multiport_master()
3556 (mlx5_core_native_port_num(mpi->mdev) - 1) == i) { in mlx5_ib_init_multiport_master()
3557 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5_ib_init_multiport_master()
3561 dev_dbg(mpi->mdev->device, in mlx5_ib_init_multiport_master()
3564 list_del(&mpi->list); in mlx5_ib_init_multiport_master()
3592 if (dev->port[i].mp.mpi) { in mlx5_ib_cleanup_multiport_master()
3595 kfree(dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
3596 dev->port[i].mp.mpi = NULL; in mlx5_ib_cleanup_multiport_master()
3599 mlx5_ib_unbind_slave_port(dev, dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
4744 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_add_slave_port() local
4749 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5_ib_add_slave_port()
4750 if (!mpi) in mlx5_ib_add_slave_port()
4753 mpi->mdev = mdev; in mlx5_ib_add_slave_port()
4756 &mpi->sys_image_guid); in mlx5_ib_add_slave_port()
4758 kfree(mpi); in mlx5_ib_add_slave_port()
4764 if (dev->sys_image_guid == mpi->sys_image_guid) in mlx5_ib_add_slave_port()
4765 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5_ib_add_slave_port()
4774 list_add_tail(&mpi->list, &mlx5_ib_unaffiliated_port_list); in mlx5_ib_add_slave_port()
4780 return mpi; in mlx5_ib_add_slave_port()
4829 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_remove() local
4838 mpi = context; in mlx5_ib_remove()
4840 if (mpi->ibdev) in mlx5_ib_remove()
4841 mlx5_ib_unbind_slave_port(mpi->ibdev, mpi); in mlx5_ib_remove()
4842 list_del(&mpi->list); in mlx5_ib_remove()
4844 kfree(mpi); in mlx5_ib_remove()