Lines Matching refs:ibdev
114 dev = mpi->ibdev; in mlx5_ib_get_ibdev_from_mpi()
141 static int get_port_state(struct ib_device *ibdev, in get_port_state() argument
149 ret = ibdev->query_port(ibdev, port_num, &attr); in get_port_state()
162 struct mlx5_ib_dev *ibdev; in mlx5_netdev_event() local
164 ibdev = roce->dev; in mlx5_netdev_event()
165 mdev = mlx5_ib_get_native_port_mdev(ibdev, port_num, NULL); in mlx5_netdev_event()
173 if (ibdev->rep) { in mlx5_netdev_event()
174 struct mlx5_eswitch *esw = ibdev->mdev->priv.eswitch; in mlx5_netdev_event()
178 ibdev->rep->vport); in mlx5_netdev_event()
201 && ibdev->ib_active) { in mlx5_netdev_event()
205 if (get_port_state(&ibdev->ib_dev, port_num, in mlx5_netdev_event()
213 ibev.device = &ibdev->ib_dev; in mlx5_netdev_event()
231 mlx5_ib_put_native_port_mdev(ibdev, port_num); in mlx5_netdev_event()
238 struct mlx5_ib_dev *ibdev = to_mdev(device); in mlx5_ib_get_netdev() local
242 mdev = mlx5_ib_get_native_port_mdev(ibdev, port_num, NULL); in mlx5_ib_get_netdev()
252 read_lock(&ibdev->roce[port_num - 1].netdev_lock); in mlx5_ib_get_netdev()
253 ndev = ibdev->roce[port_num - 1].netdev; in mlx5_ib_get_netdev()
256 read_unlock(&ibdev->roce[port_num - 1].netdev_lock); in mlx5_ib_get_netdev()
259 mlx5_ib_put_native_port_mdev(ibdev, port_num); in mlx5_ib_get_netdev()
263 struct mlx5_core_dev *mlx5_ib_get_native_port_mdev(struct mlx5_ib_dev *ibdev, in mlx5_ib_get_native_port_mdev() argument
267 enum rdma_link_layer ll = mlx5_ib_port_link_layer(&ibdev->ib_dev, in mlx5_ib_get_native_port_mdev()
273 if (!mlx5_core_mp_enabled(ibdev->mdev) || in mlx5_ib_get_native_port_mdev()
277 return ibdev->mdev; in mlx5_ib_get_native_port_mdev()
283 port = &ibdev->port[ib_port_num - 1]; in mlx5_ib_get_native_port_mdev()
288 mpi = ibdev->port[ib_port_num - 1].mp.mpi; in mlx5_ib_get_native_port_mdev()
302 void mlx5_ib_put_native_port_mdev(struct mlx5_ib_dev *ibdev, u8 port_num) in mlx5_ib_put_native_port_mdev() argument
304 enum rdma_link_layer ll = mlx5_ib_port_link_layer(&ibdev->ib_dev, in mlx5_ib_put_native_port_mdev()
309 if (!mlx5_core_mp_enabled(ibdev->mdev) || ll != IB_LINK_LAYER_ETHERNET) in mlx5_ib_put_native_port_mdev()
312 port = &ibdev->port[port_num - 1]; in mlx5_ib_put_native_port_mdev()
315 mpi = ibdev->port[port_num - 1].mp.mpi; in mlx5_ib_put_native_port_mdev()
549 static int mlx5_get_vport_access_method(struct ib_device *ibdev) in mlx5_get_vport_access_method() argument
551 if (mlx5_use_mad_ifc(to_mdev(ibdev))) in mlx5_get_vport_access_method()
554 if (mlx5_ib_port_link_layer(ibdev, 1) == in mlx5_get_vport_access_method()
606 static int mlx5_query_system_image_guid(struct ib_device *ibdev, in mlx5_query_system_image_guid() argument
609 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_query_system_image_guid()
614 switch (mlx5_get_vport_access_method(ibdev)) { in mlx5_query_system_image_guid()
616 return mlx5_query_mad_ifc_system_image_guid(ibdev, in mlx5_query_system_image_guid()
638 static int mlx5_query_max_pkeys(struct ib_device *ibdev, in mlx5_query_max_pkeys() argument
641 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_query_max_pkeys()
644 switch (mlx5_get_vport_access_method(ibdev)) { in mlx5_query_max_pkeys()
646 return mlx5_query_mad_ifc_max_pkeys(ibdev, max_pkeys); in mlx5_query_max_pkeys()
659 static int mlx5_query_vendor_id(struct ib_device *ibdev, in mlx5_query_vendor_id() argument
662 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_query_vendor_id()
664 switch (mlx5_get_vport_access_method(ibdev)) { in mlx5_query_vendor_id()
666 return mlx5_query_mad_ifc_vendor_id(ibdev, vendor_id); in mlx5_query_vendor_id()
723 static int mlx5_ib_query_device(struct ib_device *ibdev, in mlx5_ib_query_device() argument
727 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_ib_query_device()
749 err = mlx5_query_system_image_guid(ibdev, in mlx5_ib_query_device()
754 err = mlx5_query_max_pkeys(ibdev, &props->max_pkeys); in mlx5_ib_query_device()
758 err = mlx5_query_vendor_id(ibdev, &props->vendor_id); in mlx5_ib_query_device()
930 if (mlx5_ib_port_link_layer(ibdev, 1) == in mlx5_ib_query_device()
1097 static int translate_active_width(struct ib_device *ibdev, u8 active_width, in translate_active_width() argument
1100 struct mlx5_ib_dev *dev = to_mdev(ibdev); in translate_active_width()
1158 static int translate_max_vl_num(struct ib_device *ibdev, u8 vl_hw_cap, in translate_max_vl_num() argument
1185 static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port, in mlx5_query_hca_port() argument
1188 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_query_hca_port()
1228 err = translate_active_width(ibdev, ib_link_width_oper, in mlx5_query_hca_port()
1248 err = translate_max_vl_num(ibdev, vl_hw_cap, in mlx5_query_hca_port()
1255 int mlx5_ib_query_port(struct ib_device *ibdev, u8 port, in mlx5_ib_query_port() argument
1261 switch (mlx5_get_vport_access_method(ibdev)) { in mlx5_ib_query_port()
1263 ret = mlx5_query_mad_ifc_port(ibdev, port, props); in mlx5_ib_query_port()
1267 ret = mlx5_query_hca_port(ibdev, port, props); in mlx5_ib_query_port()
1271 ret = mlx5_query_port_roce(ibdev, port, props); in mlx5_ib_query_port()
1279 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_ib_query_port()
1300 static int mlx5_ib_rep_query_port(struct ib_device *ibdev, u8 port, in mlx5_ib_rep_query_port() argument
1306 ret = mlx5_query_port_roce(ibdev, port, props); in mlx5_ib_rep_query_port()
1316 static int mlx5_ib_query_gid(struct ib_device *ibdev, u8 port, int index, in mlx5_ib_query_gid() argument
1319 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_ib_query_gid()
1322 switch (mlx5_get_vport_access_method(ibdev)) { in mlx5_ib_query_gid()
1324 return mlx5_query_mad_ifc_gids(ibdev, port, index, gid); in mlx5_ib_query_gid()
1335 static int mlx5_query_hca_nic_pkey(struct ib_device *ibdev, u8 port, in mlx5_query_hca_nic_pkey() argument
1338 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_query_hca_nic_pkey()
1362 static int mlx5_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index, in mlx5_ib_query_pkey() argument
1365 switch (mlx5_get_vport_access_method(ibdev)) { in mlx5_ib_query_pkey()
1367 return mlx5_query_mad_ifc_pkey(ibdev, port, index, pkey); in mlx5_ib_query_pkey()
1371 return mlx5_query_hca_nic_pkey(ibdev, port, index, pkey); in mlx5_ib_query_pkey()
1377 static int mlx5_ib_modify_device(struct ib_device *ibdev, int mask, in mlx5_ib_modify_device() argument
1380 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_ib_modify_device()
1401 memcpy(ibdev->node_desc, props->node_desc, IB_DEVICE_NODE_DESC_MAX); in mlx5_ib_modify_device()
1440 static int mlx5_ib_modify_port(struct ib_device *ibdev, u8 port, int mask, in mlx5_ib_modify_port() argument
1443 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_ib_modify_port()
1449 bool is_ib = (mlx5_ib_port_link_layer(ibdev, port) == in mlx5_ib_modify_port()
1466 err = ib_query_port(ibdev, port, &attr); in mlx5_ib_modify_port()
1621 static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, in mlx5_ib_alloc_ucontext() argument
1624 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_ib_alloc_ucontext()
1736 if (mlx5_ib_port_link_layer(ibdev, 1) != IB_LINK_LAYER_ETHERNET) { in mlx5_ib_alloc_ucontext()
1770 if (mlx5_ib_port_link_layer(ibdev, 1) == IB_LINK_LAYER_ETHERNET) { in mlx5_ib_alloc_ucontext()
2233 struct ib_dm *mlx5_ib_alloc_dm(struct ib_device *ibdev, in mlx5_ib_alloc_dm() argument
2239 struct mlx5_memic *memic = &to_mdev(ibdev)->memic; in mlx5_ib_alloc_dm()
2250 …mlx5_ib_dbg(to_mdev(ibdev), "alloc_memic req: user_length=0x%llx act_length=0x%llx log_alignment=%… in mlx5_ib_alloc_dm()
2314 static struct ib_pd *mlx5_ib_alloc_pd(struct ib_device *ibdev, in mlx5_ib_alloc_pd() argument
2326 err = mlx5_core_alloc_pd(to_mdev(ibdev)->mdev, &pd->pdn); in mlx5_ib_alloc_pd()
2335 mlx5_core_dealloc_pd(to_mdev(ibdev)->mdev, pd->pdn); in mlx5_ib_alloc_pd()
3132 static int read_flow_counters(struct ib_device *ibdev, in read_flow_counters() argument
3136 struct mlx5_ib_dev *dev = to_mdev(ibdev); in read_flow_counters()
4120 static void mlx5_ib_handle_internal_error(struct mlx5_ib_dev *ibdev) in mlx5_ib_handle_internal_error() argument
4133 spin_lock_irqsave(&ibdev->reset_flow_resource_lock, flags); in mlx5_ib_handle_internal_error()
4134 list_for_each_entry(mqp, &ibdev->qp_list, qps_list) { in mlx5_ib_handle_internal_error()
4176 spin_unlock_irqrestore(&ibdev->reset_flow_resource_lock, flags); in mlx5_ib_handle_internal_error()
4203 struct mlx5_ib_dev *ibdev; in mlx5_ib_handle_event() local
4209 ibdev = mlx5_ib_get_ibdev_from_mpi(work->context); in mlx5_ib_handle_event()
4210 if (!ibdev) in mlx5_ib_handle_event()
4213 ibdev = work->context; in mlx5_ib_handle_event()
4219 mlx5_ib_handle_internal_error(ibdev); in mlx5_ib_handle_event()
4229 if (mlx5_ib_port_link_layer(&ibdev->ib_dev, port) == in mlx5_ib_handle_event()
4243 schedule_work(&ibdev->devr.ports[port - 1].pkey_change_work); in mlx5_ib_handle_event()
4254 schedule_work(&ibdev->delay_drop.delay_drop_work); in mlx5_ib_handle_event()
4260 ibev.device = &ibdev->ib_dev; in mlx5_ib_handle_event()
4263 if (!rdma_is_port_valid(&ibdev->ib_dev, port)) { in mlx5_ib_handle_event()
4264 mlx5_ib_warn(ibdev, "warning: event on port %d\n", port); in mlx5_ib_handle_event()
4268 if (ibdev->ib_active) in mlx5_ib_handle_event()
4272 ibdev->ib_active = false; in mlx5_ib_handle_event()
4661 static u32 get_core_cap_flags(struct ib_device *ibdev, in get_core_cap_flags() argument
4664 struct mlx5_ib_dev *dev = to_mdev(ibdev); in get_core_cap_flags()
4665 enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, 1); in get_core_cap_flags()
4695 static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, in mlx5_port_immutable() argument
4699 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_port_immutable()
4700 enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num); in mlx5_port_immutable()
4704 err = ib_query_port(ibdev, port_num, &attr); in mlx5_port_immutable()
4717 immutable->core_cap_flags = get_core_cap_flags(ibdev, &rep); in mlx5_port_immutable()
4724 static int mlx5_port_rep_immutable(struct ib_device *ibdev, u8 port_num, in mlx5_port_rep_immutable() argument
4732 err = ib_query_port(ibdev, port_num, &attr); in mlx5_port_rep_immutable()
4743 static void get_dev_fw_str(struct ib_device *ibdev, char *str) in get_dev_fw_str() argument
4746 container_of(ibdev, struct mlx5_ib_dev, ib_dev); in get_dev_fw_str()
5038 static struct rdma_hw_stats *mlx5_ib_alloc_hw_stats(struct ib_device *ibdev, in mlx5_ib_alloc_hw_stats() argument
5041 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_ib_alloc_hw_stats()
5112 static int mlx5_ib_get_hw_stats(struct ib_device *ibdev, in mlx5_ib_get_hw_stats() argument
5116 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_ib_get_hw_stats()
5307 mlx5_ib_get_vector_affinity(struct ib_device *ibdev, int comp_vector) in mlx5_ib_get_vector_affinity() argument
5309 struct mlx5_ib_dev *dev = to_mdev(ibdev); in mlx5_ib_get_vector_affinity()
5315 static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev, in mlx5_ib_unbind_slave_port() argument
5319 struct mlx5_ib_port *port = &ibdev->port[port_num]; in mlx5_ib_unbind_slave_port()
5324 mlx5_ib_cleanup_cong_debugfs(ibdev, port_num); in mlx5_ib_unbind_slave_port()
5327 if (!mpi->ibdev) { in mlx5_ib_unbind_slave_port()
5331 mpi->ibdev = NULL; in mlx5_ib_unbind_slave_port()
5334 mlx5_remove_netdev_notifier(ibdev, port_num); in mlx5_ib_unbind_slave_port()
5358 mlx5_ib_dbg(ibdev, "unaffiliated port %d\n", port_num + 1); in mlx5_ib_unbind_slave_port()
5363 mlx5_ib_err(ibdev, "Failed to unaffiliate port %u\n", in mlx5_ib_unbind_slave_port()
5366 ibdev->roce[port_num].last_port_state = IB_PORT_DOWN; in mlx5_ib_unbind_slave_port()
5370 static bool mlx5_ib_bind_slave_port(struct mlx5_ib_dev *ibdev, in mlx5_ib_bind_slave_port() argument
5376 spin_lock(&ibdev->port[port_num].mp.mpi_lock); in mlx5_ib_bind_slave_port()
5377 if (ibdev->port[port_num].mp.mpi) { in mlx5_ib_bind_slave_port()
5378 mlx5_ib_dbg(ibdev, "port %d already affiliated.\n", in mlx5_ib_bind_slave_port()
5380 spin_unlock(&ibdev->port[port_num].mp.mpi_lock); in mlx5_ib_bind_slave_port()
5384 ibdev->port[port_num].mp.mpi = mpi; in mlx5_ib_bind_slave_port()
5385 mpi->ibdev = ibdev; in mlx5_ib_bind_slave_port()
5386 spin_unlock(&ibdev->port[port_num].mp.mpi_lock); in mlx5_ib_bind_slave_port()
5388 err = mlx5_nic_vport_affiliate_multiport(ibdev->mdev, mpi->mdev); in mlx5_ib_bind_slave_port()
5392 err = get_port_caps(ibdev, mlx5_core_native_port_num(mpi->mdev)); in mlx5_ib_bind_slave_port()
5396 err = mlx5_add_netdev_notifier(ibdev, port_num); in mlx5_ib_bind_slave_port()
5398 mlx5_ib_err(ibdev, "failed adding netdev notifier for port %u\n", in mlx5_ib_bind_slave_port()
5403 err = mlx5_ib_init_cong_debugfs(ibdev, port_num); in mlx5_ib_bind_slave_port()
5410 mlx5_ib_unbind_slave_port(ibdev, mpi); in mlx5_ib_bind_slave_port()
5452 mpi->ibdev = dev; in mlx5_ib_init_multiport_master()
6370 if (mpi->ibdev) in mlx5_ib_remove()
6371 mlx5_ib_unbind_slave_port(mpi->ibdev, mpi); in mlx5_ib_remove()