* i40e_init_arq - initialize ARQ * @hw: pointer to the hardware structure * * The main initialization routine for the Admin Receive (Event) Queue. * Prior to calling this function, drivers *MUST* set the following fields * in the hw->aq structure: * - hw->aq.num_asq_entries * - hw->aq.arq_buf_size * * Do *NOT* hold the lock when calling this as the memory allocation routines
| 436 | * called are not going to be atomic context safe |
| 437 | **/ |
| 438 | enum i40e_status_code i40e_init_arq(struct i40e_hw *hw) |
| 439 | { |
| 440 | enum i40e_status_code ret_code = I40E_SUCCESS; |
| 441 | |
| 442 | if (hw->aq.arq.count > 0) { |
| 443 | /* queue already initialized */ |
| 444 | ret_code = I40E_ERR_NOT_READY; |
| 445 | goto init_adminq_exit; |
| 446 | } |
| 447 | |
| 448 | /* verify input for valid configuration */ |
| 449 | if ((hw->aq.num_arq_entries == 0) || |
| 450 | (hw->aq.arq_buf_size == 0)) { |
| 451 | ret_code = I40E_ERR_CONFIG; |
| 452 | goto init_adminq_exit; |
| 453 | } |
| 454 | |
| 455 | hw->aq.arq.next_to_use = 0; |
| 456 | hw->aq.arq.next_to_clean = 0; |
| 457 | |
| 458 | /* allocate the ring memory */ |
| 459 | ret_code = i40e_alloc_adminq_arq_ring(hw); |
| 460 | if (ret_code != I40E_SUCCESS) |
| 461 | goto init_adminq_exit; |
| 462 | |
| 463 | /* allocate buffers in the rings */ |
| 464 | ret_code = i40e_alloc_arq_bufs(hw); |
| 465 | if (ret_code != I40E_SUCCESS) |
| 466 | goto init_adminq_free_rings; |
| 467 | |
| 468 | /* initialize base registers */ |
| 469 | ret_code = i40e_config_arq_regs(hw); |
| 470 | if (ret_code != I40E_SUCCESS) |
| 471 | goto init_config_regs; |
| 472 | |
| 473 | /* success! */ |
| 474 | hw->aq.arq.count = hw->aq.num_arq_entries; |
| 475 | goto init_adminq_exit; |
| 476 | |
| 477 | init_adminq_free_rings: |
| 478 | i40e_free_adminq_arq(hw); |
| 479 | return ret_code; |
| 480 | |
| 481 | init_config_regs: |
| 482 | i40e_free_arq_bufs(hw); |
| 483 | |
| 484 | init_adminq_exit: |
| 485 | return ret_code; |
| 486 | } |
| 487 | |
| 488 | /** |
| 489 | * i40e_shutdown_asq - shutdown the ASQ |
no test coverage detected