Driver should poll FW heartbeat, reset_counter with the frequency * advertised by FW in HWRM_ERROR_RECOVERY_QCFG. * When the driver detects heartbeat stop or change in reset_counter, * it has to trigger a reset to recover from the error condition. * A “primary function” is the function who will have the privilege to * initiate the chimp reset. The primary function will be elected by the * fi
| 4583 | * firmware and will be notified through async message. |
| 4584 | */ |
| 4585 | static void bnxt_check_fw_health(void *arg) |
| 4586 | { |
| 4587 | struct bnxt *bp = arg; |
| 4588 | struct bnxt_error_recovery_info *info = bp->recovery_info; |
| 4589 | uint32_t val = 0, wait_msec; |
| 4590 | |
| 4591 | if (!info || !bnxt_is_recovery_enabled(bp) || |
| 4592 | is_bnxt_in_error(bp)) |
| 4593 | return; |
| 4594 | |
| 4595 | val = bnxt_read_fw_status_reg(bp, BNXT_FW_HEARTBEAT_CNT_REG); |
| 4596 | if (val == info->last_heart_beat) |
| 4597 | goto reset; |
| 4598 | |
| 4599 | info->last_heart_beat = val; |
| 4600 | |
| 4601 | val = bnxt_read_fw_status_reg(bp, BNXT_FW_RECOVERY_CNT_REG); |
| 4602 | if (val != info->last_reset_counter) |
| 4603 | goto reset; |
| 4604 | |
| 4605 | info->last_reset_counter = val; |
| 4606 | |
| 4607 | rte_eal_alarm_set(US_PER_MS * info->driver_polling_freq, |
| 4608 | bnxt_check_fw_health, (void *)bp); |
| 4609 | |
| 4610 | return; |
| 4611 | reset: |
| 4612 | /* Stop DMA to/from device */ |
| 4613 | bp->flags |= BNXT_FLAG_FATAL_ERROR; |
| 4614 | bp->flags |= BNXT_FLAG_FW_RESET; |
| 4615 | |
| 4616 | bnxt_stop_rxtx(bp->eth_dev); |
| 4617 | |
| 4618 | PMD_DRV_LOG(ERR, "Detected FW dead condition\n"); |
| 4619 | |
| 4620 | rte_eth_dev_callback_process(bp->eth_dev, |
| 4621 | RTE_ETH_EVENT_ERR_RECOVERING, |
| 4622 | NULL); |
| 4623 | |
| 4624 | if (bnxt_is_primary_func(bp)) |
| 4625 | wait_msec = info->primary_func_wait_period; |
| 4626 | else |
| 4627 | wait_msec = info->normal_func_wait_period; |
| 4628 | |
| 4629 | rte_eal_alarm_set(US_PER_MS * wait_msec, |
| 4630 | bnxt_fw_reset_cb, (void *)bp); |
| 4631 | } |
| 4632 | |
| 4633 | void bnxt_schedule_fw_health_check(struct bnxt *bp) |
| 4634 | { |
nothing calls this directly
no test coverage detected