qed: Correct PF-sanity check
authorYuval Mintz <Yuval.Mintz@qlogic.com>
Sun, 15 May 2016 11:48:05 +0000 (14:48 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 May 2016 17:59:18 +0000 (13:59 -0400)
Seems like something broke in commit 1408cc1fa48c ("qed: Introduce VFs")
and the function no longer verifies that the vf is indeed a valid one.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_sriov.c

index d4df406ac0a46c0e57aca5d58228e654aecee72a..2c4f9b038db2cffe4dbdec19a962d881dc4d434e 100644 (file)
@@ -476,12 +476,12 @@ int qed_iov_hw_info(struct qed_hwfn *p_hwfn)
 static bool qed_iov_pf_sanity_check(struct qed_hwfn *p_hwfn, int vfid)
 {
        /* Check PF supports sriov */
-       if (!IS_QED_SRIOV(p_hwfn->cdev) || !IS_PF_SRIOV_ALLOC(p_hwfn))
+       if (IS_VF(p_hwfn->cdev) || !IS_QED_SRIOV(p_hwfn->cdev) ||
+           !IS_PF_SRIOV_ALLOC(p_hwfn))
                return false;
 
        /* Check VF validity */
-       if (IS_VF(p_hwfn->cdev) || !IS_QED_SRIOV(p_hwfn->cdev) ||
-           !IS_PF_SRIOV_ALLOC(p_hwfn))
+       if (!qed_iov_is_valid_vfid(p_hwfn, vfid, true))
                return false;
 
        return true;