Lines Matching refs:mpi
89 struct mlx5_ib_multiport_info *mpi; member
114 struct mlx5_ib_dev *mlx5_ib_get_ibdev_from_mpi(struct mlx5_ib_multiport_info *mpi) in mlx5_ib_get_ibdev_from_mpi() argument
119 dev = mpi->ibdev; in mlx5_ib_get_ibdev_from_mpi()
306 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_get_native_port_mdev() local
324 mpi = ibdev->port[ib_port_num - 1].mp.mpi; in mlx5_ib_get_native_port_mdev()
325 if (mpi && !mpi->unaffiliate) { in mlx5_ib_get_native_port_mdev()
326 mdev = mpi->mdev; in mlx5_ib_get_native_port_mdev()
330 if (!mpi->is_master) in mlx5_ib_get_native_port_mdev()
331 mpi->mdev_refcnt++; in mlx5_ib_get_native_port_mdev()
342 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_put_native_port_mdev() local
351 mpi = ibdev->port[port_num - 1].mp.mpi; in mlx5_ib_put_native_port_mdev()
352 if (mpi->is_master) in mlx5_ib_put_native_port_mdev()
355 mpi->mdev_refcnt--; in mlx5_ib_put_native_port_mdev()
356 if (mpi->unaffiliate) in mlx5_ib_put_native_port_mdev()
357 complete(&mpi->unref_comp); in mlx5_ib_put_native_port_mdev()
4620 ibdev = mlx5_ib_get_ibdev_from_mpi(work->mpi); in mlx5_ib_handle_event()
4691 work->mpi = container_of(nb, struct mlx5_ib_multiport_info, mdev_events); in mlx5_ib_event_slave_port()
5834 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_unbind_slave_port() argument
5836 u8 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_unbind_slave_port()
5847 if (!mpi->ibdev) { in mlx5_ib_unbind_slave_port()
5852 mpi->ibdev = NULL; in mlx5_ib_unbind_slave_port()
5855 if (mpi->mdev_events.notifier_call) in mlx5_ib_unbind_slave_port()
5856 mlx5_notifier_unregister(mpi->mdev, &mpi->mdev_events); in mlx5_ib_unbind_slave_port()
5857 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_unbind_slave_port()
5861 comps = mpi->mdev_refcnt; in mlx5_ib_unbind_slave_port()
5863 mpi->unaffiliate = true; in mlx5_ib_unbind_slave_port()
5864 init_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
5868 wait_for_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
5871 mpi->unaffiliate = false; in mlx5_ib_unbind_slave_port()
5874 port->mp.mpi = NULL; in mlx5_ib_unbind_slave_port()
5876 list_add_tail(&mpi->list, &mlx5_ib_unaffiliated_port_list); in mlx5_ib_unbind_slave_port()
5880 err = mlx5_nic_vport_unaffiliate_multiport(mpi->mdev); in mlx5_ib_unbind_slave_port()
5894 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_bind_slave_port() argument
5896 u8 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_bind_slave_port()
5902 if (ibdev->port[port_num].mp.mpi) { in mlx5_ib_bind_slave_port()
5909 ibdev->port[port_num].mp.mpi = mpi; in mlx5_ib_bind_slave_port()
5910 mpi->ibdev = ibdev; in mlx5_ib_bind_slave_port()
5911 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_bind_slave_port()
5914 err = mlx5_nic_vport_affiliate_multiport(ibdev->mdev, mpi->mdev); in mlx5_ib_bind_slave_port()
5918 err = get_port_caps(ibdev, mlx5_core_native_port_num(mpi->mdev)); in mlx5_ib_bind_slave_port()
5929 mpi->mdev_events.notifier_call = mlx5_ib_event_slave_port; in mlx5_ib_bind_slave_port()
5930 mlx5_notifier_register(mpi->mdev, &mpi->mdev_events); in mlx5_ib_bind_slave_port()
5937 mlx5_ib_unbind_slave_port(ibdev, mpi); in mlx5_ib_bind_slave_port()
5946 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_init_multiport_master() local
5968 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5_ib_init_multiport_master()
5969 if (!mpi) { in mlx5_ib_init_multiport_master()
5975 mpi->is_master = true; in mlx5_ib_init_multiport_master()
5976 mpi->mdev = dev->mdev; in mlx5_ib_init_multiport_master()
5977 mpi->sys_image_guid = dev->sys_image_guid; in mlx5_ib_init_multiport_master()
5978 dev->port[i].mp.mpi = mpi; in mlx5_ib_init_multiport_master()
5979 mpi->ibdev = dev; in mlx5_ib_init_multiport_master()
5980 mpi = NULL; in mlx5_ib_init_multiport_master()
5984 list_for_each_entry(mpi, &mlx5_ib_unaffiliated_port_list, in mlx5_ib_init_multiport_master()
5986 if (dev->sys_image_guid == mpi->sys_image_guid && in mlx5_ib_init_multiport_master()
5987 (mlx5_core_native_port_num(mpi->mdev) - 1) == i) { in mlx5_ib_init_multiport_master()
5988 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5_ib_init_multiport_master()
5992 dev_dbg(mpi->mdev->device, in mlx5_ib_init_multiport_master()
5995 list_del(&mpi->list); in mlx5_ib_init_multiport_master()
6023 if (dev->port[i].mp.mpi) { in mlx5_ib_cleanup_multiport_master()
6026 kfree(dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
6027 dev->port[i].mp.mpi = NULL; in mlx5_ib_cleanup_multiport_master()
6030 mlx5_ib_unbind_slave_port(dev, dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
6860 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_add_slave_port() local
6865 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5_ib_add_slave_port()
6866 if (!mpi) in mlx5_ib_add_slave_port()
6869 mpi->mdev = mdev; in mlx5_ib_add_slave_port()
6872 &mpi->sys_image_guid); in mlx5_ib_add_slave_port()
6874 kfree(mpi); in mlx5_ib_add_slave_port()
6880 if (dev->sys_image_guid == mpi->sys_image_guid) in mlx5_ib_add_slave_port()
6881 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5_ib_add_slave_port()
6890 list_add_tail(&mpi->list, &mlx5_ib_unaffiliated_port_list); in mlx5_ib_add_slave_port()
6896 return mpi; in mlx5_ib_add_slave_port()
6941 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_remove() local
6950 mpi = context; in mlx5_ib_remove()
6952 if (mpi->ibdev) in mlx5_ib_remove()
6953 mlx5_ib_unbind_slave_port(mpi->ibdev, mpi); in mlx5_ib_remove()
6954 list_del(&mpi->list); in mlx5_ib_remove()
6956 kfree(mpi); in mlx5_ib_remove()