ena.c (aa9c3226b9e86042e5d84cbfc2ffc69b84744bb6) ena.c (7926bc4492a9a5c1e12595355d5c11121eb51f4b)
1/*-
2 * BSD LICENSE
3 *
4 * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 2728 unchanged lines hidden (view full) ---

2737 return;
2738
2739 timestamp = atomic_load_acq_64(&adapter->keep_alive_timestamp);
2740 time = getsbinuptime() - timestamp;
2741 if (unlikely(time > adapter->keep_alive_timeout)) {
2742 device_printf(adapter->pdev,
2743 "Keep alive watchdog timeout.\n");
2744 counter_u64_add(adapter->dev_stats.wd_expired, 1);
1/*-
2 * BSD LICENSE
3 *
4 * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 2728 unchanged lines hidden (view full) ---

2737 return;
2738
2739 timestamp = atomic_load_acq_64(&adapter->keep_alive_timestamp);
2740 time = getsbinuptime() - timestamp;
2741 if (unlikely(time > adapter->keep_alive_timeout)) {
2742 device_printf(adapter->pdev,
2743 "Keep alive watchdog timeout.\n");
2744 counter_u64_add(adapter->dev_stats.wd_expired, 1);
2745 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
2746 adapter->reset_reason = ENA_REGS_RESET_KEEP_ALIVE_TO;
2747 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
2748 }
2745 ena_trigger_reset(adapter, ENA_REGS_RESET_KEEP_ALIVE_TO);
2749 }
2750}
2751
2752/* Check if admin queue is enabled */
2753static void check_for_admin_com_state(struct ena_adapter *adapter)
2754{
2755 if (unlikely(ena_com_get_admin_running_state(adapter->ena_dev) ==
2756 false)) {
2757 device_printf(adapter->pdev,
2758 "ENA admin queue is not in running state!\n");
2759 counter_u64_add(adapter->dev_stats.admin_q_pause, 1);
2746 }
2747}
2748
2749/* Check if admin queue is enabled */
2750static void check_for_admin_com_state(struct ena_adapter *adapter)
2751{
2752 if (unlikely(ena_com_get_admin_running_state(adapter->ena_dev) ==
2753 false)) {
2754 device_printf(adapter->pdev,
2755 "ENA admin queue is not in running state!\n");
2756 counter_u64_add(adapter->dev_stats.admin_q_pause, 1);
2760 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
2761 adapter->reset_reason = ENA_REGS_RESET_ADMIN_TO;
2762 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
2763 }
2757 ena_trigger_reset(adapter, ENA_REGS_RESET_ADMIN_TO);
2764 }
2765}
2766
2767static int
2768check_for_rx_interrupt_queue(struct ena_adapter *adapter,
2769 struct ena_ring *rx_ring)
2770{
2771 if (likely(rx_ring->first_interrupt))
2772 return (0);
2773
2774 if (ena_com_cq_empty(rx_ring->ena_com_io_cq))
2775 return (0);
2776
2777 rx_ring->no_interrupt_event_cnt++;
2778
2779 if (rx_ring->no_interrupt_event_cnt == ENA_MAX_NO_INTERRUPT_ITERATIONS) {
2780 device_printf(adapter->pdev, "Potential MSIX issue on Rx side "
2781 "Queue = %d. Reset the device\n", rx_ring->qid);
2758 }
2759}
2760
2761static int
2762check_for_rx_interrupt_queue(struct ena_adapter *adapter,
2763 struct ena_ring *rx_ring)
2764{
2765 if (likely(rx_ring->first_interrupt))
2766 return (0);
2767
2768 if (ena_com_cq_empty(rx_ring->ena_com_io_cq))
2769 return (0);
2770
2771 rx_ring->no_interrupt_event_cnt++;
2772
2773 if (rx_ring->no_interrupt_event_cnt == ENA_MAX_NO_INTERRUPT_ITERATIONS) {
2774 device_printf(adapter->pdev, "Potential MSIX issue on Rx side "
2775 "Queue = %d. Reset the device\n", rx_ring->qid);
2782 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
2783 adapter->reset_reason = ENA_REGS_RESET_MISS_INTERRUPT;
2784 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
2785 }
2776 ena_trigger_reset(adapter, ENA_REGS_RESET_MISS_INTERRUPT);
2786 return (EIO);
2787 }
2788
2789 return (0);
2790}
2791
2792static int
2793check_missing_comp_in_tx_queue(struct ena_adapter *adapter,

--- 21 unchanged lines hidden (view full) ---

2815 time_offset > 2 * adapter->missing_tx_timeout)) {
2816 /*
2817 * If after graceful period interrupt is still not
2818 * received, we schedule a reset.
2819 */
2820 device_printf(adapter->pdev,
2821 "Potential MSIX issue on Tx side Queue = %d. "
2822 "Reset the device\n", tx_ring->qid);
2777 return (EIO);
2778 }
2779
2780 return (0);
2781}
2782
2783static int
2784check_missing_comp_in_tx_queue(struct ena_adapter *adapter,

--- 21 unchanged lines hidden (view full) ---

2806 time_offset > 2 * adapter->missing_tx_timeout)) {
2807 /*
2808 * If after graceful period interrupt is still not
2809 * received, we schedule a reset.
2810 */
2811 device_printf(adapter->pdev,
2812 "Potential MSIX issue on Tx side Queue = %d. "
2813 "Reset the device\n", tx_ring->qid);
2823 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET,
2824 adapter))) {
2825 adapter->reset_reason =
2826 ENA_REGS_RESET_MISS_INTERRUPT;
2827 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET,
2828 adapter);
2829 }
2814 ena_trigger_reset(adapter,
2815 ENA_REGS_RESET_MISS_INTERRUPT);
2830 return (EIO);
2831 }
2832
2833 /* Check again if packet is still waiting */
2834 if (unlikely(time_offset > adapter->missing_tx_timeout)) {
2835
2836 if (!tx_buf->print_once)
2837 ena_trace(ENA_WARNING, "Found a Tx that wasn't "

--- 5 unchanged lines hidden (view full) ---

2843 }
2844 }
2845
2846 if (unlikely(missed_tx > adapter->missing_tx_threshold)) {
2847 device_printf(adapter->pdev,
2848 "The number of lost tx completion is above the threshold "
2849 "(%d > %d). Reset the device\n",
2850 missed_tx, adapter->missing_tx_threshold);
2816 return (EIO);
2817 }
2818
2819 /* Check again if packet is still waiting */
2820 if (unlikely(time_offset > adapter->missing_tx_timeout)) {
2821
2822 if (!tx_buf->print_once)
2823 ena_trace(ENA_WARNING, "Found a Tx that wasn't "

--- 5 unchanged lines hidden (view full) ---

2829 }
2830 }
2831
2832 if (unlikely(missed_tx > adapter->missing_tx_threshold)) {
2833 device_printf(adapter->pdev,
2834 "The number of lost tx completion is above the threshold "
2835 "(%d > %d). Reset the device\n",
2836 missed_tx, adapter->missing_tx_threshold);
2851 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
2852 adapter->reset_reason = ENA_REGS_RESET_MISS_TX_CMPL;
2853 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
2854 }
2837 ena_trigger_reset(adapter, ENA_REGS_RESET_MISS_TX_CMPL);
2855 rc = EIO;
2856 }
2857
2858 counter_u64_add(tx_ring->tx_stats.missing_tx_comp, missed_tx);
2859
2860 return (rc);
2861}
2862

--- 752 unchanged lines hidden ---
2838 rc = EIO;
2839 }
2840
2841 counter_u64_add(tx_ring->tx_stats.missing_tx_comp, missed_tx);
2842
2843 return (rc);
2844}
2845

--- 752 unchanged lines hidden ---