ena.c (efe6ab18dad8ff8d3188346845d7df8d0f37276a) | ena.c (74dba3ad78510ecdfdef8c793635d11533ccec6d) |
---|---|
1/*- 2 * BSD LICENSE 3 * 4 * Copyright (c) 2015-2017 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 --- 3335 unchanged lines hidden (view full) --- 3344 device_printf(adapter->pdev, 3345 "ENA admin queue is not in running state!\n"); 3346 counter_u64_add(adapter->dev_stats.admin_q_pause, 1); 3347 adapter->reset_reason = ENA_REGS_RESET_ADMIN_TO; 3348 adapter->trigger_reset = true; 3349 } 3350} 3351 | 1/*- 2 * BSD LICENSE 3 * 4 * Copyright (c) 2015-2017 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 --- 3335 unchanged lines hidden (view full) --- 3344 device_printf(adapter->pdev, 3345 "ENA admin queue is not in running state!\n"); 3346 counter_u64_add(adapter->dev_stats.admin_q_pause, 1); 3347 adapter->reset_reason = ENA_REGS_RESET_ADMIN_TO; 3348 adapter->trigger_reset = true; 3349 } 3350} 3351 |
3352static int 3353check_missing_comp_in_queue(struct ena_adapter *adapter, 3354 struct ena_ring *tx_ring) 3355{ 3356 struct bintime curtime, time; 3357 struct ena_tx_buffer *tx_buf; 3358 uint32_t missed_tx = 0; 3359 int i; 3360 3361 getbinuptime(&curtime); 3362 3363 for (i = 0; i < tx_ring->ring_size; i++) { 3364 tx_buf = &tx_ring->tx_buffer_info[i]; 3365 3366 if (!bintime_isset(&tx_buf->timestamp)) 3367 continue; 3368 3369 time = curtime; 3370 bintime_sub(&time, &tx_buf->timestamp); 3371 3372 /* Check again if packet is still waiting */ 3373 if (unlikely(bttosbt(time) > adapter->missing_tx_timeout)) { 3374 3375 if (!tx_buf->print_once) 3376 ena_trace(ENA_WARNING, "Found a Tx that wasn't " 3377 "completed on time, qid %d, index %d.\n", 3378 tx_ring->qid, i); 3379 3380 tx_buf->print_once = true; 3381 missed_tx++; 3382 3383 if (unlikely(missed_tx > 3384 adapter->missing_tx_threshold)) { 3385 device_printf(adapter->pdev, 3386 "The number of lost tx completion " 3387 "is above the threshold (%d > %d). " 3388 "Reset the device\n", 3389 missed_tx, 3390 adapter->missing_tx_threshold); 3391 adapter->reset_reason = 3392 ENA_REGS_RESET_MISS_TX_CMPL; 3393 adapter->trigger_reset = true; 3394 return (EIO); 3395 } 3396 } 3397 } 3398 3399 return (0); 3400} 3401 |
|
3352/* 3353 * Check for TX which were not completed on time. 3354 * Timeout is defined by "missing_tx_timeout". 3355 * Reset will be performed if number of incompleted 3356 * transactions exceeds "missing_tx_threshold". 3357 */ 3358static void check_for_missing_tx_completions(struct ena_adapter *adapter) 3359{ 3360 struct ena_ring *tx_ring; | 3402/* 3403 * Check for TX which were not completed on time. 3404 * Timeout is defined by "missing_tx_timeout". 3405 * Reset will be performed if number of incompleted 3406 * transactions exceeds "missing_tx_threshold". 3407 */ 3408static void check_for_missing_tx_completions(struct ena_adapter *adapter) 3409{ 3410 struct ena_ring *tx_ring; |
3361 struct ena_tx_buffer *tx_info; 3362 struct bintime curtime, time; 3363 int i, j, budget, missed_tx; | 3411 int i, budget, rc; |
3364 3365 /* Make sure the driver doesn't turn the device in other process */ 3366 rmb(); 3367 3368 if (!adapter->up) 3369 return; 3370 3371 if (adapter->trigger_reset) 3372 return; 3373 3374 if (adapter->missing_tx_timeout == 0) 3375 return; 3376 3377 budget = adapter->missing_tx_max_queues; | 3412 3413 /* Make sure the driver doesn't turn the device in other process */ 3414 rmb(); 3415 3416 if (!adapter->up) 3417 return; 3418 3419 if (adapter->trigger_reset) 3420 return; 3421 3422 if (adapter->missing_tx_timeout == 0) 3423 return; 3424 3425 budget = adapter->missing_tx_max_queues; |
3378 getbinuptime(&curtime); | |
3379 3380 for (i = adapter->next_monitored_tx_qid; i < adapter->num_queues; i++) { 3381 tx_ring = &adapter->tx_ring[i]; 3382 | 3426 3427 for (i = adapter->next_monitored_tx_qid; i < adapter->num_queues; i++) { 3428 tx_ring = &adapter->tx_ring[i]; 3429 |
3383 missed_tx = 0; | 3430 rc = check_missing_comp_in_queue(adapter, tx_ring); 3431 if (unlikely(rc)) 3432 return; |
3384 | 3433 |
3385 for (j = 0; j < tx_ring->ring_size; j++) { 3386 tx_info = &tx_ring->tx_buffer_info[j]; 3387 3388 if (!bintime_isset(&tx_info->timestamp)) 3389 continue; 3390 3391 time = curtime; 3392 bintime_sub(&time, &tx_info->timestamp); 3393 3394 /* Check again if packet is still waiting */ 3395 if (bintime_isset(&tx_info->timestamp) && unlikely( 3396 bttosbt(time) > adapter->missing_tx_timeout)) { 3397 if (tx_info->print_once) 3398 device_printf(adapter->pdev, 3399 "Found a Tx that wasn't completed " 3400 "on time, qid %d, index %d.\n", 3401 tx_ring->qid, j); 3402 3403 tx_info->print_once = false; 3404 missed_tx++; 3405 3406 if (unlikely(missed_tx > 3407 adapter->missing_tx_threshold)) { 3408 device_printf(adapter->pdev, 3409 "The number of lost tx completion " 3410 "is above the threshold (%d > %d). " 3411 "Reset the device\n", missed_tx, 3412 adapter->missing_tx_threshold); 3413 adapter->reset_reason = 3414 ENA_REGS_RESET_MISS_TX_CMPL; 3415 adapter->trigger_reset = true; 3416 return; 3417 } 3418 } 3419 } 3420 | |
3421 budget--; 3422 if (budget == 0) { 3423 i++; 3424 break; 3425 } 3426 } 3427 3428 adapter->next_monitored_tx_qid = i % adapter->num_queues; --- 520 unchanged lines hidden --- | 3434 budget--; 3435 if (budget == 0) { 3436 i++; 3437 break; 3438 } 3439 } 3440 3441 adapter->next_monitored_tx_qid = i % adapter->num_queues; --- 520 unchanged lines hidden --- |