* iavf_init_asq - main initialization routine for ASQ * @hw: pointer to the hardware structure * * This is the main initialization routine for the Admin Send 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 al
| 322 | * called are not going to be atomic context safe |
| 323 | **/ |
| 324 | enum iavf_status iavf_init_asq(struct iavf_hw *hw) |
| 325 | { |
| 326 | enum iavf_status ret_code = IAVF_SUCCESS; |
| 327 | |
| 328 | if (hw->aq.asq.count > 0) { |
| 329 | /* queue already initialized */ |
| 330 | ret_code = IAVF_ERR_NOT_READY; |
| 331 | goto init_adminq_exit; |
| 332 | } |
| 333 | |
| 334 | /* verify input for valid configuration */ |
| 335 | if ((hw->aq.num_asq_entries == 0) || |
| 336 | (hw->aq.asq_buf_size == 0)) { |
| 337 | ret_code = IAVF_ERR_CONFIG; |
| 338 | goto init_adminq_exit; |
| 339 | } |
| 340 | |
| 341 | hw->aq.asq.next_to_use = 0; |
| 342 | hw->aq.asq.next_to_clean = 0; |
| 343 | |
| 344 | /* allocate the ring memory */ |
| 345 | ret_code = iavf_alloc_adminq_asq_ring(hw); |
| 346 | if (ret_code != IAVF_SUCCESS) |
| 347 | goto init_adminq_exit; |
| 348 | |
| 349 | /* allocate buffers in the rings */ |
| 350 | ret_code = iavf_alloc_asq_bufs(hw); |
| 351 | if (ret_code != IAVF_SUCCESS) |
| 352 | goto init_adminq_free_rings; |
| 353 | |
| 354 | /* initialize base registers */ |
| 355 | ret_code = iavf_config_asq_regs(hw); |
| 356 | if (ret_code != IAVF_SUCCESS) |
| 357 | goto init_config_regs; |
| 358 | |
| 359 | /* success! */ |
| 360 | hw->aq.asq.count = hw->aq.num_asq_entries; |
| 361 | goto init_adminq_exit; |
| 362 | |
| 363 | init_adminq_free_rings: |
| 364 | iavf_free_adminq_asq(hw); |
| 365 | return ret_code; |
| 366 | |
| 367 | init_config_regs: |
| 368 | iavf_free_asq_bufs(hw); |
| 369 | |
| 370 | init_adminq_exit: |
| 371 | return ret_code; |
| 372 | } |
| 373 | |
| 374 | /** |
| 375 | * iavf_init_arq - initialize ARQ |
no test coverage detected