Lines Matching refs:mpi

61 		struct mlx5_ib_multiport_info *mpi;  member
80 struct mlx5_ib_dev *mlx5_ib_get_ibdev_from_mpi(struct mlx5_ib_multiport_info *mpi) in mlx5_ib_get_ibdev_from_mpi() argument
85 dev = mpi->ibdev; in mlx5_ib_get_ibdev_from_mpi()
281 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_get_native_port_mdev() local
296 mpi = ibdev->port[ib_port_num - 1].mp.mpi; in mlx5_ib_get_native_port_mdev()
297 if (mpi && !mpi->unaffiliate) { in mlx5_ib_get_native_port_mdev()
298 mdev = mpi->mdev; in mlx5_ib_get_native_port_mdev()
302 if (!mpi->is_master) in mlx5_ib_get_native_port_mdev()
303 mpi->mdev_refcnt++; in mlx5_ib_get_native_port_mdev()
314 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_put_native_port_mdev() local
323 mpi = ibdev->port[port_num - 1].mp.mpi; in mlx5_ib_put_native_port_mdev()
324 if (mpi->is_master) in mlx5_ib_put_native_port_mdev()
327 mpi->mdev_refcnt--; in mlx5_ib_put_native_port_mdev()
328 if (mpi->unaffiliate) in mlx5_ib_put_native_port_mdev()
329 complete(&mpi->unref_comp); in mlx5_ib_put_native_port_mdev()
2657 ibdev = mlx5_ib_get_ibdev_from_mpi(work->mpi); in mlx5_ib_handle_event()
2728 work->mpi = container_of(nb, struct mlx5_ib_multiport_info, mdev_events); in mlx5_ib_event_slave_port()
3117 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_unbind_slave_port() argument
3119 u32 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_unbind_slave_port()
3130 if (!mpi->ibdev) { in mlx5_ib_unbind_slave_port()
3135 mpi->ibdev = NULL; in mlx5_ib_unbind_slave_port()
3138 if (mpi->mdev_events.notifier_call) in mlx5_ib_unbind_slave_port()
3139 mlx5_notifier_unregister(mpi->mdev, &mpi->mdev_events); in mlx5_ib_unbind_slave_port()
3140 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_unbind_slave_port()
3144 comps = mpi->mdev_refcnt; in mlx5_ib_unbind_slave_port()
3146 mpi->unaffiliate = true; in mlx5_ib_unbind_slave_port()
3147 init_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
3151 wait_for_completion(&mpi->unref_comp); in mlx5_ib_unbind_slave_port()
3154 mpi->unaffiliate = false; in mlx5_ib_unbind_slave_port()
3157 port->mp.mpi = NULL; in mlx5_ib_unbind_slave_port()
3161 err = mlx5_nic_vport_unaffiliate_multiport(mpi->mdev); in mlx5_ib_unbind_slave_port()
3175 struct mlx5_ib_multiport_info *mpi) in mlx5_ib_bind_slave_port() argument
3177 u32 port_num = mlx5_core_native_port_num(mpi->mdev) - 1; in mlx5_ib_bind_slave_port()
3183 if (ibdev->port[port_num].mp.mpi) { in mlx5_ib_bind_slave_port()
3190 ibdev->port[port_num].mp.mpi = mpi; in mlx5_ib_bind_slave_port()
3191 mpi->ibdev = ibdev; in mlx5_ib_bind_slave_port()
3192 mpi->mdev_events.notifier_call = NULL; in mlx5_ib_bind_slave_port()
3195 err = mlx5_nic_vport_affiliate_multiport(ibdev->mdev, mpi->mdev); in mlx5_ib_bind_slave_port()
3206 mpi->mdev_events.notifier_call = mlx5_ib_event_slave_port; in mlx5_ib_bind_slave_port()
3207 mlx5_notifier_register(mpi->mdev, &mpi->mdev_events); in mlx5_ib_bind_slave_port()
3214 mlx5_ib_unbind_slave_port(ibdev, mpi); in mlx5_ib_bind_slave_port()
3223 struct mlx5_ib_multiport_info *mpi; in mlx5_ib_init_multiport_master() local
3245 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5_ib_init_multiport_master()
3246 if (!mpi) { in mlx5_ib_init_multiport_master()
3252 mpi->is_master = true; in mlx5_ib_init_multiport_master()
3253 mpi->mdev = dev->mdev; in mlx5_ib_init_multiport_master()
3254 mpi->sys_image_guid = dev->sys_image_guid; in mlx5_ib_init_multiport_master()
3255 dev->port[i].mp.mpi = mpi; in mlx5_ib_init_multiport_master()
3256 mpi->ibdev = dev; in mlx5_ib_init_multiport_master()
3257 mpi = NULL; in mlx5_ib_init_multiport_master()
3261 list_for_each_entry(mpi, &mlx5_ib_unaffiliated_port_list, in mlx5_ib_init_multiport_master()
3263 if (dev->sys_image_guid == mpi->sys_image_guid && in mlx5_ib_init_multiport_master()
3264 (mlx5_core_native_port_num(mpi->mdev) - 1) == i) { in mlx5_ib_init_multiport_master()
3265 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5_ib_init_multiport_master()
3269 dev_dbg(mpi->mdev->device, in mlx5_ib_init_multiport_master()
3272 list_del(&mpi->list); in mlx5_ib_init_multiport_master()
3298 if (dev->port[i].mp.mpi) { in mlx5_ib_cleanup_multiport_master()
3301 kfree(dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
3302 dev->port[i].mp.mpi = NULL; in mlx5_ib_cleanup_multiport_master()
3306 list_add_tail(&dev->port[i].mp.mpi->list, in mlx5_ib_cleanup_multiport_master()
3309 dev->port[i].mp.mpi); in mlx5_ib_cleanup_multiport_master()
4259 struct mlx5_ib_multiport_info *mpi; in mlx5r_mp_probe() local
4264 mpi = kzalloc(sizeof(*mpi), GFP_KERNEL); in mlx5r_mp_probe()
4265 if (!mpi) in mlx5r_mp_probe()
4268 mpi->mdev = mdev; in mlx5r_mp_probe()
4270 &mpi->sys_image_guid); in mlx5r_mp_probe()
4272 kfree(mpi); in mlx5r_mp_probe()
4278 if (dev->sys_image_guid == mpi->sys_image_guid) in mlx5r_mp_probe()
4279 bound = mlx5_ib_bind_slave_port(dev, mpi); in mlx5r_mp_probe()
4283 mpi->ibdev->ib_active = true; in mlx5r_mp_probe()
4289 list_add_tail(&mpi->list, &mlx5_ib_unaffiliated_port_list); in mlx5r_mp_probe()
4295 auxiliary_set_drvdata(adev, mpi); in mlx5r_mp_probe()
4301 struct mlx5_ib_multiport_info *mpi; in mlx5r_mp_remove() local
4303 mpi = auxiliary_get_drvdata(adev); in mlx5r_mp_remove()
4305 if (mpi->ibdev) in mlx5r_mp_remove()
4306 mlx5_ib_unbind_slave_port(mpi->ibdev, mpi); in mlx5r_mp_remove()
4308 list_del(&mpi->list); in mlx5r_mp_remove()
4310 kfree(mpi); in mlx5r_mp_remove()