Lines Matching refs:dev

41 /* intf dev list mutex */
45 static bool is_eth_rep_supported(struct mlx5_core_dev *dev)
50 if (!MLX5_ESWITCH_MANAGER(dev))
53 if (!is_mdev_switchdev_mode(dev))
59 bool mlx5_eth_supported(struct mlx5_core_dev *dev)
64 if (MLX5_CAP_GEN(dev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
67 if (!MLX5_CAP_GEN(dev, eth_net_offloads)) {
68 mlx5_core_warn(dev, "Missing eth_net_offloads capability\n");
72 if (!MLX5_CAP_GEN(dev, nic_flow_table)) {
73 mlx5_core_warn(dev, "Missing nic_flow_table capability\n");
77 if (!MLX5_CAP_ETH(dev, csum_cap)) {
78 mlx5_core_warn(dev, "Missing csum_cap capability\n");
82 if (!MLX5_CAP_ETH(dev, max_lso_cap)) {
83 mlx5_core_warn(dev, "Missing max_lso_cap capability\n");
87 if (!MLX5_CAP_ETH(dev, vlan_cap)) {
88 mlx5_core_warn(dev, "Missing vlan_cap capability\n");
92 if (!MLX5_CAP_ETH(dev, rss_ind_tbl_cap)) {
93 mlx5_core_warn(dev, "Missing rss_ind_tbl_cap capability\n");
97 if (MLX5_CAP_FLOWTABLE(dev,
99 mlx5_core_warn(dev, "max_ft_level < 3\n");
103 if (!MLX5_CAP_ETH(dev, self_lb_en_modifiable))
104 mlx5_core_warn(dev, "Self loop back prevention is not supported\n");
105 if (!MLX5_CAP_GEN(dev, cq_moderation))
106 mlx5_core_warn(dev, "CQ moderation is not supported\n");
111 bool mlx5_vnet_supported(struct mlx5_core_dev *dev)
116 if (mlx5_core_is_pf(dev))
119 if (!(MLX5_CAP_GEN_64(dev, general_obj_types) &
123 if (!(MLX5_CAP_DEV_VDPA_EMULATION(dev, event_mode) &
127 if (!MLX5_CAP_DEV_VDPA_EMULATION(dev, eth_frame_offload_type))
133 static bool is_vnet_enabled(struct mlx5_core_dev *dev)
138 err = devl_param_driverinit_value_get(priv_to_devlink(dev),
144 static bool is_ib_rep_supported(struct mlx5_core_dev *dev)
149 if (dev->priv.flags & MLX5_PRIV_FLAGS_DISABLE_IB_ADEV)
152 if (!is_eth_rep_supported(dev))
155 if (mlx5_core_mp_enabled(dev))
161 static bool is_mp_supported(struct mlx5_core_dev *dev)
166 if (dev->priv.flags & MLX5_PRIV_FLAGS_DISABLE_IB_ADEV)
169 if (is_ib_rep_supported(dev))
172 if (MLX5_CAP_GEN(dev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
175 if (!mlx5_core_is_mp_slave(dev))
181 bool mlx5_rdma_supported(struct mlx5_core_dev *dev)
186 if (dev->priv.flags & MLX5_PRIV_FLAGS_DISABLE_IB_ADEV)
189 if (is_ib_rep_supported(dev))
192 if (is_mp_supported(dev))
198 static bool is_ib_enabled(struct mlx5_core_dev *dev)
203 err = devl_param_driverinit_value_get(priv_to_devlink(dev),
222 bool (*is_supported)(struct mlx5_core_dev *dev);
223 bool (*is_enabled)(struct mlx5_core_dev *dev);
252 int mlx5_adev_init(struct mlx5_core_dev *dev)
254 struct mlx5_priv *priv = &dev->priv;
264 void mlx5_adev_cleanup(struct mlx5_core_dev *dev)
266 struct mlx5_priv *priv = &dev->priv;
271 static void adev_release(struct device *dev)
274 container_of(dev, struct mlx5_adev, adev.dev);
282 static struct mlx5_adev *add_adev(struct mlx5_core_dev *dev, int idx)
294 adev->id = dev->priv.adev_idx;
296 adev->dev.parent = dev->device;
297 adev->dev.release = adev_release;
298 madev->mdev = dev;
321 void mlx5_dev_set_lightweight(struct mlx5_core_dev *dev)
324 dev->priv.flags |= MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV;
328 bool mlx5_dev_is_lightweight(struct mlx5_core_dev *dev)
330 return dev->priv.flags & MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV;
333 int mlx5_attach_device(struct mlx5_core_dev *dev)
335 struct mlx5_priv *priv = &dev->priv;
340 devl_assert_locked(priv_to_devlink(dev));
350 enabled = mlx5_adev_devices[i].is_enabled(dev);
356 is_supported = mlx5_adev_devices[i].is_supported(dev);
361 priv->adev[i] = add_adev(dev, i);
372 if (!adev->dev.driver)
374 adrv = to_auxiliary_drv(adev->dev.driver);
380 mlx5_core_warn(dev, "Device[%d] (%s) failed to load\n",
390 void mlx5_detach_device(struct mlx5_core_dev *dev, bool suspend)
392 struct mlx5_priv *priv = &dev->priv;
398 devl_assert_locked(priv_to_devlink(dev));
407 enabled = mlx5_adev_devices[i].is_enabled(dev);
414 if (!adev->dev.driver)
417 adrv = to_auxiliary_drv(adev->dev.driver);
432 int mlx5_register_device(struct mlx5_core_dev *dev)
436 devl_assert_locked(priv_to_devlink(dev));
438 dev->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV;
439 ret = mlx5_rescan_drivers_locked(dev);
442 mlx5_unregister_device(dev);
447 void mlx5_unregister_device(struct mlx5_core_dev *dev)
449 devl_assert_locked(priv_to_devlink(dev));
451 dev->priv.flags = MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV;
452 mlx5_rescan_drivers_locked(dev);
456 static int add_drivers(struct mlx5_core_dev *dev)
458 struct mlx5_priv *priv = &dev->priv;
468 !(mlx5_adev_devices[i].is_enabled(dev)))
472 is_supported = mlx5_adev_devices[i].is_supported(dev);
477 priv->adev[i] = add_adev(dev, i);
479 mlx5_core_warn(dev, "Device[%d] (%s) failed to load\n",
491 static void delete_drivers(struct mlx5_core_dev *dev)
493 struct mlx5_priv *priv = &dev->priv;
508 enabled = mlx5_adev_devices[i].is_enabled(dev);
514 is_supported = mlx5_adev_devices[i].is_supported(dev);
527 int mlx5_rescan_drivers_locked(struct mlx5_core_dev *dev)
529 struct mlx5_priv *priv = &dev->priv;
535 delete_drivers(dev);
539 return add_drivers(dev);
542 bool mlx5_same_hw_devs(struct mlx5_core_dev *dev, struct mlx5_core_dev *peer_dev)
546 fsystem_guid = mlx5_query_nic_system_image_guid(dev);
552 static u32 mlx5_gen_pci_id(const struct mlx5_core_dev *dev)
554 return (u32)((pci_domain_nr(dev->pdev->bus) << 16) |
555 (dev->pdev->bus->number << 8) |
556 PCI_SLOT(dev->pdev->devfn));
583 static int next_phys_dev_lag(struct device *dev, const void *data)
587 mdev = pci_get_other_drvdata(this->device, dev);
597 static struct mlx5_core_dev *mlx5_get_next_dev(struct mlx5_core_dev *dev,
598 int (*match)(struct device *dev, const void *data))
602 if (!mlx5_core_is_pf(dev))
605 next = bus_find_device(&pci_bus_type, NULL, dev, match);
614 struct mlx5_core_dev *mlx5_get_next_phys_dev_lag(struct mlx5_core_dev *dev)
617 return mlx5_get_next_dev(dev, &next_phys_dev_lag);