Lines Matching refs:dev
50 static int read_vendor_id(struct mlx4_dev *dev) in read_vendor_id() argument
55 ret = pci_read_config_word(dev->persist->pdev, 0, &vendor_id); in read_vendor_id()
57 mlx4_err(dev, "Failed to read vendor ID, ret=%d\n", ret); in read_vendor_id()
62 mlx4_err(dev, "PCI can't be accessed to read vendor id\n"); in read_vendor_id()
69 static int mlx4_reset_master(struct mlx4_dev *dev) in mlx4_reset_master() argument
73 if (mlx4_is_master(dev)) in mlx4_reset_master()
74 mlx4_report_internal_err_comm_event(dev); in mlx4_reset_master()
76 if (!pci_channel_offline(dev->persist->pdev)) { in mlx4_reset_master()
77 err = read_vendor_id(dev); in mlx4_reset_master()
84 err = mlx4_reset(dev); in mlx4_reset_master()
86 mlx4_err(dev, "Fail to reset HCA\n"); in mlx4_reset_master()
92 static int mlx4_reset_slave(struct mlx4_dev *dev) in mlx4_reset_slave() argument
101 struct mlx4_priv *priv = mlx4_priv(dev); in mlx4_reset_slave()
103 if (pci_channel_offline(dev->persist->pdev)) in mlx4_reset_slave()
109 mlx4_err(dev, "VF reset is not needed\n"); in mlx4_reset_slave()
113 if (!(dev->caps.vf_caps & MLX4_VF_CAP_FLAG_RESET)) { in mlx4_reset_slave()
114 mlx4_err(dev, "VF reset is not supported\n"); in mlx4_reset_slave()
123 mlx4_err(dev, "Communication channel isn't sync, fail to send reset\n"); in mlx4_reset_slave()
128 mlx4_warn(dev, "VF is sending reset request to Firmware\n"); in mlx4_reset_slave()
148 mlx4_warn(dev, "VF Reset succeed\n"); in mlx4_reset_slave()
153 mlx4_err(dev, "Fail to send reset over the communication channel\n"); in mlx4_reset_slave()
166 struct mlx4_dev *dev; in mlx4_enter_error_state() local
175 dev = persist->dev; in mlx4_enter_error_state()
176 mlx4_err(dev, "device is going to be reset\n"); in mlx4_enter_error_state()
177 if (mlx4_is_slave(dev)) { in mlx4_enter_error_state()
178 err = mlx4_reset_slave(dev); in mlx4_enter_error_state()
180 mlx4_crdump_collect(dev); in mlx4_enter_error_state()
181 err = mlx4_reset_master(dev); in mlx4_enter_error_state()
185 mlx4_err(dev, "device was reset successfully\n"); in mlx4_enter_error_state()
190 if (!pci_channel_offline(dev->persist->pdev)) in mlx4_enter_error_state()
193 dev->persist->state |= MLX4_DEVICE_STATE_INTERNAL_ERROR; in mlx4_enter_error_state()
197 mlx4_dispatch_event(dev, MLX4_DEV_EVENT_CATASTROPHIC_ERROR, NULL); in mlx4_enter_error_state()
198 mlx4_cmd_wake_completions(dev); in mlx4_enter_error_state()
207 struct mlx4_dev *dev = persist->dev; in mlx4_handle_error_state() local
212 devlink = priv_to_devlink(mlx4_priv(dev)); in mlx4_handle_error_state()
218 mlx4_info(persist->dev, "mlx4_restart_one was ended, ret=%d\n", in mlx4_handle_error_state()
225 static void dump_err_buf(struct mlx4_dev *dev) in dump_err_buf() argument
227 struct mlx4_priv *priv = mlx4_priv(dev); in dump_err_buf()
231 mlx4_err(dev, "Internal error detected:\n"); in dump_err_buf()
233 mlx4_err(dev, " buf[%02x]: %08x\n", in dump_err_buf()
240 struct mlx4_dev *dev = &priv->dev; in poll_catas() local
243 if (mlx4_is_slave(dev)) { in poll_catas()
246 mlx4_warn(dev, "Internal error detected on the communication channel\n"); in poll_catas()
250 dump_err_buf(dev); in poll_catas()
254 if (dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { in poll_catas()
255 mlx4_warn(dev, "Internal error mark was detected on device\n"); in poll_catas()
265 queue_work(dev->persist->catas_wq, &dev->persist->catas_work); in poll_catas()
277 void mlx4_start_catas_poll(struct mlx4_dev *dev) in mlx4_start_catas_poll() argument
279 struct mlx4_priv *priv = mlx4_priv(dev); in mlx4_start_catas_poll()
286 if (!mlx4_is_slave(dev)) { in mlx4_start_catas_poll()
287 addr = pci_resource_start(dev->persist->pdev, in mlx4_start_catas_poll()
293 mlx4_warn(dev, "Failed to map internal error buffer at 0x%llx\n", in mlx4_start_catas_poll()
304 void mlx4_stop_catas_poll(struct mlx4_dev *dev) in mlx4_stop_catas_poll() argument
306 struct mlx4_priv *priv = mlx4_priv(dev); in mlx4_stop_catas_poll()
315 if (dev->persist->interface_state & MLX4_INTERFACE_STATE_DELETION) in mlx4_stop_catas_poll()
316 flush_workqueue(dev->persist->catas_wq); in mlx4_stop_catas_poll()
319 int mlx4_catas_init(struct mlx4_dev *dev) in mlx4_catas_init() argument
321 INIT_WORK(&dev->persist->catas_work, catas_reset); in mlx4_catas_init()
322 dev->persist->catas_wq = create_singlethread_workqueue("mlx4_health"); in mlx4_catas_init()
323 if (!dev->persist->catas_wq) in mlx4_catas_init()
329 void mlx4_catas_end(struct mlx4_dev *dev) in mlx4_catas_end() argument
331 if (dev->persist->catas_wq) { in mlx4_catas_end()
332 destroy_workqueue(dev->persist->catas_wq); in mlx4_catas_end()
333 dev->persist->catas_wq = NULL; in mlx4_catas_end()