net/qede/base: fix index printing of multi-bit attentions
authorRasesh Mody <rasesh.mody@cavium.com>
Sat, 18 Mar 2017 06:50:22 +0000 (23:50 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 16:59:44 +0000 (18:59 +0200)
Fix the logic for identifying which bit amongst the Multi-bit
attention sources is set.

Fixes: e6051bd6b07d ("qede: add interrupt handling support")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
drivers/net/qede/base/ecore_int.c

index 1a157a5..3d6c2f1 100644 (file)
@@ -913,18 +913,24 @@ static enum _ecore_status_t ecore_int_deassertion(struct ecore_hwfn *p_hwfn,
 
                                bit = bit_idx;
                                bit_len = ATTENTION_LENGTH(p_aeu->flags);
-                               if (p_aeu->flags & ATTENTION_PAR_INT) {
+                               if (p_aeu->flags & ATTENTION_PAR) {
                                        /* Skip Parity */
                                        bit++;
                                        bit_len--;
                                }
 
+                               /* Find the bits relating to HW-block, then
+                                * shift so they'll become LSB.
+                                */
                                bitmask = bits & (((1 << bit_len) - 1) << bit);
+                               bitmask >>= bit;
+
                                if (bitmask) {
                                        u32 flags = p_aeu->flags;
                                        char bit_name[30];
+                                       u8 num;
 
-                                       bit = (u8)OSAL_FIND_FIRST_BIT(&bitmask,
+                                       num = (u8)OSAL_FIND_FIRST_BIT(&bitmask,
                                                                bit_len);
 
                                        /* Some bits represent more than a
@@ -936,11 +942,17 @@ static enum _ecore_status_t ecore_int_deassertion(struct ecore_hwfn *p_hwfn,
                                            ATTENTION_LENGTH(flags) > 1))
                                                OSAL_SNPRINTF(bit_name, 30,
                                                              p_aeu->bit_name,
-                                                             bit);
+                                                             num);
                                        else
                                                OSAL_STRNCPY(bit_name,
                                                             p_aeu->bit_name,
                                                             30);
+
+                                       /* We now need to pass bitmask in its
+                                        * correct position.
+                                        */
+                                       bitmask <<= bit;
+
                                        /* Handle source of the attention */
                                        ecore_int_deassertion_aeu_bit(p_hwfn,
                                                                      p_aeu,