]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlx4_core: print more info when command times out
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Mon, 11 Feb 2013 16:44:14 +0000 (18:44 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:08 +0000 (14:45 -0700)
To assist in diagnosing command timeouts, print the
go-bit status and toggle-bit status in the warning
output.

In addition, print an indication of the pci_bus is offline.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/net/ethernet/mellanox/mlx4/cmd.c

index 529ef0594b902ebaf2838cf478ef914a0b69d5b7..a3d99554c1321b36b30d2973d33e31f1f3d0f1ee 100644 (file)
@@ -679,6 +679,19 @@ void mlx4_cmd_event(struct mlx4_dev *dev, u16 token, u8 status, u64 out_param)
        complete(&context->done);
 }
 
+static int get_status(struct mlx4_dev *dev, u32 *status, int *go_bit,
+                     int *t_bit)
+{
+       if (pci_channel_offline(dev->persist->pdev))
+               return -EIO;
+
+       *status = readl(mlx4_priv(dev)->cmd.hcr + HCR_STATUS_OFFSET);
+       *t_bit = !!(*status & swab32(1 << HCR_T_BIT));
+       *go_bit = !!(*status & swab32(1 << HCR_GO_BIT));
+
+       return 0;
+}
+
 static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
                         int out_is_imm, u32 in_modifier, u8 op_modifier,
                         u16 op, unsigned long timeout)
@@ -686,6 +699,8 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
        struct mlx4_cmd *cmd = &mlx4_priv(dev)->cmd;
        struct mlx4_cmd_context *context;
        int err = 0;
+       int go_bit = 0, t_bit = 0, stat_err;
+       u32 status = 0;
 
        down(&cmd->event_sem);
 
@@ -712,8 +727,11 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
 
        if (!wait_for_completion_timeout(&context->done,
                                         msecs_to_jiffies(timeout))) {
-               mlx4_warn(dev, "command 0x%x timed out (go bit not cleared)\n",
-                         op);
+               stat_err = get_status(dev, &status, &go_bit, &t_bit);
+               mlx4_warn(dev, "command 0x%x timed out: "
+                         "get_status err=%d, status=0x%x, go_bit=%d, "
+                         "t_bit=%d, toggle=0x%x\n", op, stat_err, status,
+                         go_bit, t_bit, mlx4_priv(dev)->cmd.toggle);
                if (op == MLX4_CMD_NOP) {
                        err = -EBUSY;
                        goto out;