diff options
author | Ashish Shah <ashish.n.shah@intel.com> | 2014-08-01 16:27:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-02 22:41:14 -0400 |
commit | fd35886ad38a5b7c71a2105a7d0cac079c735111 (patch) | |
tree | 0d88382498991d1e7763ffd42af63136ef0a893b /drivers/net/ethernet/intel/i40evf | |
parent | 89cb86c3b2a7ec3326dc7ffe5cfb850818f78ea0 (diff) |
i40evf: future-proof vfr_stat state check
Previously defined state I40E_VFR_VFACTIVE uses bit 1 which is now set to
"reserved." Update the state checks to also include I40E_VFR_COMPLETED.
This change will allow the VF to work with both existing and future PFs.
Change-ID: Ifd1d34f79f3b0ffd6d2550ee4dadc55825ff52f8
Signed-off-by: Ashish Shah <ashish.n.shah@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/intel/i40evf')
-rw-r--r-- | drivers/net/ethernet/intel/i40evf/i40evf_main.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c index 937785db7dff..4c01079fc2ff 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c | |||
@@ -1298,12 +1298,16 @@ static void i40evf_watchdog_task(struct work_struct *work) | |||
1298 | struct i40evf_adapter, | 1298 | struct i40evf_adapter, |
1299 | watchdog_task); | 1299 | watchdog_task); |
1300 | struct i40e_hw *hw = &adapter->hw; | 1300 | struct i40e_hw *hw = &adapter->hw; |
1301 | uint32_t rstat_val; | ||
1301 | 1302 | ||
1302 | if (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section)) | 1303 | if (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section)) |
1303 | goto restart_watchdog; | 1304 | goto restart_watchdog; |
1304 | 1305 | ||
1305 | if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) { | 1306 | if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) { |
1306 | if ((rd32(hw, I40E_VFGEN_RSTAT) & 0x3) == I40E_VFR_VFACTIVE) { | 1307 | rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & |
1308 | I40E_VFGEN_RSTAT_VFR_STATE_MASK; | ||
1309 | if ((rstat_val == I40E_VFR_VFACTIVE) || | ||
1310 | (rstat_val == I40E_VFR_COMPLETED)) { | ||
1307 | /* A chance for redemption! */ | 1311 | /* A chance for redemption! */ |
1308 | dev_err(&adapter->pdev->dev, "Hardware came out of reset. Attempting reinit.\n"); | 1312 | dev_err(&adapter->pdev->dev, "Hardware came out of reset. Attempting reinit.\n"); |
1309 | adapter->state = __I40EVF_STARTUP; | 1313 | adapter->state = __I40EVF_STARTUP; |
@@ -1329,8 +1333,11 @@ static void i40evf_watchdog_task(struct work_struct *work) | |||
1329 | goto watchdog_done; | 1333 | goto watchdog_done; |
1330 | 1334 | ||
1331 | /* check for reset */ | 1335 | /* check for reset */ |
1336 | rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & | ||
1337 | I40E_VFGEN_RSTAT_VFR_STATE_MASK; | ||
1332 | if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING) && | 1338 | if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING) && |
1333 | (rd32(hw, I40E_VFGEN_RSTAT) & 0x3) != I40E_VFR_VFACTIVE) { | 1339 | (rstat_val != I40E_VFR_VFACTIVE) && |
1340 | (rstat_val != I40E_VFR_COMPLETED)) { | ||
1334 | adapter->state = __I40EVF_RESETTING; | 1341 | adapter->state = __I40EVF_RESETTING; |
1335 | adapter->flags |= I40EVF_FLAG_RESET_PENDING; | 1342 | adapter->flags |= I40EVF_FLAG_RESET_PENDING; |
1336 | dev_err(&adapter->pdev->dev, "Hardware reset detected\n"); | 1343 | dev_err(&adapter->pdev->dev, "Hardware reset detected\n"); |
@@ -1496,7 +1503,8 @@ static void i40evf_reset_task(struct work_struct *work) | |||
1496 | for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) { | 1503 | for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) { |
1497 | rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & | 1504 | rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & |
1498 | I40E_VFGEN_RSTAT_VFR_STATE_MASK; | 1505 | I40E_VFGEN_RSTAT_VFR_STATE_MASK; |
1499 | if (rstat_val != I40E_VFR_VFACTIVE) | 1506 | if ((rstat_val != I40E_VFR_VFACTIVE) && |
1507 | (rstat_val != I40E_VFR_COMPLETED)) | ||
1500 | break; | 1508 | break; |
1501 | else | 1509 | else |
1502 | msleep(I40EVF_RESET_WAIT_MS); | 1510 | msleep(I40EVF_RESET_WAIT_MS); |
@@ -1510,7 +1518,8 @@ static void i40evf_reset_task(struct work_struct *work) | |||
1510 | for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) { | 1518 | for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) { |
1511 | rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & | 1519 | rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & |
1512 | I40E_VFGEN_RSTAT_VFR_STATE_MASK; | 1520 | I40E_VFGEN_RSTAT_VFR_STATE_MASK; |
1513 | if (rstat_val == I40E_VFR_VFACTIVE) | 1521 | if ((rstat_val == I40E_VFR_VFACTIVE) || |
1522 | (rstat_val == I40E_VFR_COMPLETED)) | ||
1514 | break; | 1523 | break; |
1515 | else | 1524 | else |
1516 | msleep(I40EVF_RESET_WAIT_MS); | 1525 | msleep(I40EVF_RESET_WAIT_MS); |
@@ -1947,8 +1956,10 @@ static int i40evf_check_reset_complete(struct i40e_hw *hw) | |||
1947 | int i; | 1956 | int i; |
1948 | 1957 | ||
1949 | for (i = 0; i < 100; i++) { | 1958 | for (i = 0; i < 100; i++) { |
1950 | rstat = rd32(hw, I40E_VFGEN_RSTAT); | 1959 | rstat = rd32(hw, I40E_VFGEN_RSTAT) & |
1951 | if (rstat == I40E_VFR_VFACTIVE) | 1960 | I40E_VFGEN_RSTAT_VFR_STATE_MASK; |
1961 | if ((rstat == I40E_VFR_VFACTIVE) || | ||
1962 | (rstat == I40E_VFR_COMPLETED)) | ||
1952 | return 0; | 1963 | return 0; |
1953 | udelay(10); | 1964 | udelay(10); |
1954 | } | 1965 | } |