qlcnic: Add code to tune FW dump
authorAnirban Chakraborty <anirban.chakraborty@qlogic.com>
Wed, 22 Jun 2011 02:52:19 +0000 (02:52 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Jun 2011 08:17:06 +0000 (01:17 -0700)
To accommodate change in FW dump template, it is required to modify the
FW dump routine that captures cache data. Also, the default mask is changed
to capture a dump that would cover all the protocols that this FW supports.

Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/qlcnic/qlcnic.h
drivers/net/qlcnic/qlcnic_hw.c

index 194376e584e6e7cbf1b327a0aefdf10de14465dc..e5bb33253f94f46ba03aa236ccba10b90f677db2 100644 (file)
@@ -1220,8 +1220,7 @@ struct __ctrl {
 
 struct __cache {
        __le32  addr;
-       u8      stride;
-       u8      rsvd;
+       __le16  stride;
        __le16  init_tag_val;
        __le32  size;
        __le32  no_ops;
@@ -1319,7 +1318,7 @@ enum op_codes {
 #define QLCNIC_DUMP_SKIP       BIT_7
 
 #define QLCNIC_DUMP_MASK_MIN           3
-#define QLCNIC_DUMP_MASK_DEF           0x0f
+#define QLCNIC_DUMP_MASK_DEF           0x7f
 #define QLCNIC_DUMP_MASK_MAX           0xff
 #define QLCNIC_FORCE_FW_DUMP_KEY       0xdeadfeed
 
index 1947f817bf235d238583bbe9e1ba63f7987289ab..81de563ee96c153c0c65826529c9aa180193cf57 100644 (file)
@@ -1509,18 +1509,26 @@ qlcnic_dump_l2_cache(struct qlcnic_adapter *adapter,
 
        for (i = 0; i < l2->no_ops; i++) {
                QLCNIC_WR_DUMP_REG(l2->addr, base, val);
-               do {
+               if (LSW(l2->ctrl_val))
                        QLCNIC_WR_DUMP_REG(l2->ctrl_addr, base,
                                LSW(l2->ctrl_val));
+               if (!poll_mask)
+                       goto skip_poll;
+               do {
                        QLCNIC_RD_DUMP_REG(l2->ctrl_addr, base, &data);
                        if (!(data & poll_mask))
                                break;
                        msleep(1);
                        time_out++;
                } while (time_out <= poll_to);
-               if (time_out > poll_to)
-                       return -EINVAL;
 
+               if (time_out > poll_to) {
+                       dev_err(&adapter->pdev->dev,
+                               "Timeout exceeded in %s, aborting dump\n",
+                               __func__);
+                       return -EINVAL;
+               }
+skip_poll:
                addr = l2->read_addr;
                cnt = l2->read_addr_num;
                while (cnt) {