| 5398 | } |
| 5399 | |
| 5400 | int |
| 5401 | i40e_vsi_release(struct i40e_vsi *vsi) |
| 5402 | { |
| 5403 | struct i40e_pf *pf; |
| 5404 | struct i40e_hw *hw; |
| 5405 | struct i40e_vsi_list *vsi_list; |
| 5406 | void *temp; |
| 5407 | int ret; |
| 5408 | struct i40e_mac_filter *f; |
| 5409 | uint16_t user_param; |
| 5410 | |
| 5411 | if (!vsi) |
| 5412 | return I40E_SUCCESS; |
| 5413 | |
| 5414 | if (!vsi->adapter) |
| 5415 | return -EFAULT; |
| 5416 | |
| 5417 | user_param = vsi->user_param; |
| 5418 | |
| 5419 | pf = I40E_VSI_TO_PF(vsi); |
| 5420 | hw = I40E_VSI_TO_HW(vsi); |
| 5421 | |
| 5422 | /* VSI has child to attach, release child first */ |
| 5423 | if (vsi->veb) { |
| 5424 | RTE_TAILQ_FOREACH_SAFE(vsi_list, &vsi->veb->head, list, temp) { |
| 5425 | if (i40e_vsi_release(vsi_list->vsi) != I40E_SUCCESS) |
| 5426 | return -1; |
| 5427 | } |
| 5428 | i40e_veb_release(vsi->veb); |
| 5429 | } |
| 5430 | |
| 5431 | if (vsi->floating_veb) { |
| 5432 | RTE_TAILQ_FOREACH_SAFE(vsi_list, &vsi->floating_veb->head, |
| 5433 | list, temp) { |
| 5434 | if (i40e_vsi_release(vsi_list->vsi) != I40E_SUCCESS) |
| 5435 | return -1; |
| 5436 | } |
| 5437 | } |
| 5438 | |
| 5439 | /* Remove all macvlan filters of the VSI */ |
| 5440 | i40e_vsi_remove_all_macvlan_filter(vsi); |
| 5441 | RTE_TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) |
| 5442 | rte_free(f); |
| 5443 | |
| 5444 | if (vsi->type != I40E_VSI_MAIN && |
| 5445 | ((vsi->type != I40E_VSI_SRIOV) || |
| 5446 | !pf->floating_veb_list[user_param])) { |
| 5447 | /* Remove vsi from parent's sibling list */ |
| 5448 | if (vsi->parent_vsi == NULL || vsi->parent_vsi->veb == NULL) { |
| 5449 | PMD_DRV_LOG(ERR, "VSI's parent VSI is NULL"); |
| 5450 | return I40E_ERR_PARAM; |
| 5451 | } |
| 5452 | TAILQ_REMOVE(&vsi->parent_vsi->veb->head, |
| 5453 | &vsi->sib_vsi_list, list); |
| 5454 | |
| 5455 | /* Remove all switch element of the VSI */ |
| 5456 | ret = i40e_aq_delete_element(hw, vsi->seid, NULL); |
| 5457 | if (ret != I40E_SUCCESS) |
no test coverage detected