* iavf_init_adminq - main initialization routine for Admin Queue * @hw: pointer to the hardware structure * * Prior to calling this function, drivers *MUST* set the following fields * in the hw->aq structure: * - hw->aq.num_asq_entries * - hw->aq.num_arq_entries * - hw->aq.arq_buf_size * - hw->aq.asq_buf_size **/
| 514 | * - hw->aq.asq_buf_size |
| 515 | **/ |
| 516 | enum iavf_status iavf_init_adminq(struct iavf_hw *hw) |
| 517 | { |
| 518 | enum iavf_status ret_code; |
| 519 | |
| 520 | /* verify input for valid configuration */ |
| 521 | if ((hw->aq.num_arq_entries == 0) || |
| 522 | (hw->aq.num_asq_entries == 0) || |
| 523 | (hw->aq.arq_buf_size == 0) || |
| 524 | (hw->aq.asq_buf_size == 0)) { |
| 525 | ret_code = IAVF_ERR_CONFIG; |
| 526 | goto init_adminq_exit; |
| 527 | } |
| 528 | iavf_init_spinlock(&hw->aq.asq_spinlock); |
| 529 | iavf_init_spinlock(&hw->aq.arq_spinlock); |
| 530 | |
| 531 | /* Set up register offsets */ |
| 532 | iavf_adminq_init_regs(hw); |
| 533 | |
| 534 | /* setup ASQ command write back timeout */ |
| 535 | hw->aq.asq_cmd_timeout = IAVF_ASQ_CMD_TIMEOUT; |
| 536 | |
| 537 | /* allocate the ASQ */ |
| 538 | ret_code = iavf_init_asq(hw); |
| 539 | if (ret_code != IAVF_SUCCESS) |
| 540 | goto init_adminq_destroy_spinlocks; |
| 541 | |
| 542 | /* allocate the ARQ */ |
| 543 | ret_code = iavf_init_arq(hw); |
| 544 | if (ret_code != IAVF_SUCCESS) |
| 545 | goto init_adminq_free_asq; |
| 546 | |
| 547 | /* success! */ |
| 548 | goto init_adminq_exit; |
| 549 | |
| 550 | init_adminq_free_asq: |
| 551 | iavf_shutdown_asq(hw); |
| 552 | init_adminq_destroy_spinlocks: |
| 553 | iavf_destroy_spinlock(&hw->aq.asq_spinlock); |
| 554 | iavf_destroy_spinlock(&hw->aq.arq_spinlock); |
| 555 | |
| 556 | init_adminq_exit: |
| 557 | return ret_code; |
| 558 | } |
| 559 | |
| 560 | /** |
| 561 | * iavf_shutdown_adminq - shutdown routine for the Admin Queue |
no test coverage detected