qed: Fix possible race for the link state value.
authorSudarsana Reddy Kalluru <sudarsana.kalluru@cavium.com>
Thu, 19 Jul 2018 05:50:03 +0000 (22:50 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Jul 2018 23:19:04 +0000 (16:19 -0700)
There's a possible race where driver can read link status in mid-transition
and see that virtual-link is up yet speed is 0. Since in this
mid-transition we're guaranteed to see a mailbox from MFW soon, we can
afford to treat this as link down.

Fixes: cc875c2e ("qed: Add link support")
Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <ariel.elior@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_mcp.c

index cace28365189edb50932c8c27ac3ac67dd3eca23..cdd645024a32aadc40f54c4e02a88988898ce219 100644 (file)
@@ -1211,6 +1211,7 @@ static void qed_mcp_handle_link_change(struct qed_hwfn *p_hwfn,
                break;
        default:
                p_link->speed = 0;
+               p_link->link_up = 0;
        }
 
        if (p_link->link_up && p_link->speed)