ena.c (5517ca8486bfbf4d0cd369898f3e4d10cd614a9a) | ena.c (1f67704e2cd85a507776312b52dc63d8690b9260) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2015-2023 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 --- 3044 unchanged lines hidden (view full) --- 3053 3054 return (0); 3055} 3056 3057static int 3058check_missing_comp_in_tx_queue(struct ena_adapter *adapter, 3059 struct ena_ring *tx_ring) 3060{ | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2015-2023 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 --- 3044 unchanged lines hidden (view full) --- 3053 3054 return (0); 3055} 3056 3057static int 3058check_missing_comp_in_tx_queue(struct ena_adapter *adapter, 3059 struct ena_ring *tx_ring) 3060{ |
3061 uint32_t missed_tx = 0, new_missed_tx = 0; |
|
3061 device_t pdev = adapter->pdev; 3062 struct bintime curtime, time; 3063 struct ena_tx_buffer *tx_buf; 3064 int time_since_last_cleanup; 3065 int missing_tx_comp_to; 3066 sbintime_t time_offset; | 3062 device_t pdev = adapter->pdev; 3063 struct bintime curtime, time; 3064 struct ena_tx_buffer *tx_buf; 3065 int time_since_last_cleanup; 3066 int missing_tx_comp_to; 3067 sbintime_t time_offset; |
3067 uint32_t missed_tx = 0; | |
3068 int i, rc = 0; 3069 3070 getbinuptime(&curtime); 3071 3072 for (i = 0; i < tx_ring->ring_size; i++) { 3073 tx_buf = &tx_ring->tx_buffer_info[i]; 3074 3075 if (bintime_isset(&tx_buf->timestamp) == 0) --- 26 unchanged lines hidden (view full) --- 3102 tx_ring->tx_last_cleanup_ticks); 3103 missing_tx_comp_to = sbttoms( 3104 adapter->missing_tx_timeout); 3105 ena_log(pdev, WARN, 3106 "Found a Tx that wasn't completed on time, qid %d, index %d. " 3107 "%d msecs have passed since last cleanup. Missing Tx timeout value %d msecs.\n", 3108 tx_ring->qid, i, time_since_last_cleanup, 3109 missing_tx_comp_to); | 3068 int i, rc = 0; 3069 3070 getbinuptime(&curtime); 3071 3072 for (i = 0; i < tx_ring->ring_size; i++) { 3073 tx_buf = &tx_ring->tx_buffer_info[i]; 3074 3075 if (bintime_isset(&tx_buf->timestamp) == 0) --- 26 unchanged lines hidden (view full) --- 3102 tx_ring->tx_last_cleanup_ticks); 3103 missing_tx_comp_to = sbttoms( 3104 adapter->missing_tx_timeout); 3105 ena_log(pdev, WARN, 3106 "Found a Tx that wasn't completed on time, qid %d, index %d. " 3107 "%d msecs have passed since last cleanup. Missing Tx timeout value %d msecs.\n", 3108 tx_ring->qid, i, time_since_last_cleanup, 3109 missing_tx_comp_to); |
3110 /* Add new TX completions which are missed */ 3111 new_missed_tx++; |
|
3110 } 3111 3112 tx_buf->print_once = false; 3113 missed_tx++; 3114 } 3115 } | 3112 } 3113 3114 tx_buf->print_once = false; 3115 missed_tx++; 3116 } 3117 } |
3116 | 3118 /* Checking if this TX ring missing TX completions have passed the threshold */ |
3117 if (unlikely(missed_tx > adapter->missing_tx_threshold)) { 3118 ena_log(pdev, ERR, 3119 "The number of lost tx completion is above the threshold " 3120 "(%d > %d). Reset the device\n", 3121 missed_tx, adapter->missing_tx_threshold); 3122 ena_trigger_reset(adapter, ENA_REGS_RESET_MISS_TX_CMPL); 3123 rc = EIO; 3124 } | 3119 if (unlikely(missed_tx > adapter->missing_tx_threshold)) { 3120 ena_log(pdev, ERR, 3121 "The number of lost tx completion is above the threshold " 3122 "(%d > %d). Reset the device\n", 3123 missed_tx, adapter->missing_tx_threshold); 3124 ena_trigger_reset(adapter, ENA_REGS_RESET_MISS_TX_CMPL); 3125 rc = EIO; 3126 } |
3127 /* Add the newly discovered missing TX completions */ 3128 counter_u64_add(tx_ring->tx_stats.missing_tx_comp, new_missed_tx); |
|
3125 | 3129 |
3126 counter_u64_add(tx_ring->tx_stats.missing_tx_comp, missed_tx); 3127 | |
3128 return (rc); 3129} 3130 3131/* 3132 * Check for TX which were not completed on time. 3133 * Timeout is defined by "missing_tx_timeout". 3134 * Reset will be performed if number of incompleted 3135 * transactions exceeds "missing_tx_threshold". --- 941 unchanged lines hidden --- | 3130 return (rc); 3131} 3132 3133/* 3134 * Check for TX which were not completed on time. 3135 * Timeout is defined by "missing_tx_timeout". 3136 * Reset will be performed if number of incompleted 3137 * transactions exceeds "missing_tx_threshold". --- 941 unchanged lines hidden --- |