[MLX4] improved error logging: write command failures to Event Log with error code...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 30 Oct 2008 15:09:53 +0000 (15:09 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 30 Oct 2008 15:09:53 +0000 (15:09 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1714 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mlx4/kernel/bus/net/cmd.c

index a27a638..b754946 100644 (file)
@@ -208,6 +208,7 @@ static int mlx4_cmd_poll(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
        u8 __iomem *hcr = priv->cmd.hcr;
        int err = 0;
        u64 end;
+       u8 status;
 
        down(&priv->cmd.poll_sem);
 
@@ -232,8 +233,11 @@ static int mlx4_cmd_poll(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
                        (u64) be32_to_cpu((__force __be32)
                                          __raw_readl(hcr + HCR_OUT_PARAM_OFFSET + 4));
 
-       err = mlx4_status_to_errno((u8)(be32_to_cpu((__force __be32)
-                                              __raw_readl(hcr + HCR_STATUS_OFFSET)) >> 24));
+       status = (u8)(be32_to_cpu((__force __be32)__raw_readl(hcr + HCR_STATUS_OFFSET)) >> 24);
+       err = mlx4_status_to_errno(status);
+       if (status)
+               mlx4_err(dev, "Command failed: op %#hx, status %d, errno %d.\n", 
+                       op, status, err);
 
 out:
        up(&priv->cmd.poll_sem);
@@ -251,6 +255,10 @@ void mlx4_cmd_event(struct mlx4_dev *dev, u16 token, u8 status, u64 out_param)
                return;
 
        context->result    = mlx4_status_to_errno(status);
+       
+       if (status)
+               mlx4_err(dev, "Command failed: token %#hx, status %d, errno %d.\n", 
+                       token, status, context->result);
        context->out_param = out_param;
 
        complete(&context->done);
@@ -280,7 +288,7 @@ 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))) {
                if (!context->done.done) {
-                       static int spam_limit = 10;
+                       static int spam_limit = 5;
                        err = -EBUSY;
                        if (spam_limit-- > 0)
                                mlx4_err(dev, "mlx4_cmd_wait: Command %02x completed with timeout after %d secs \n",