Setup a veb */
| 5337 | |
| 5338 | /* Setup a veb */ |
| 5339 | static struct i40e_veb * |
| 5340 | i40e_veb_setup(struct i40e_pf *pf, struct i40e_vsi *vsi) |
| 5341 | { |
| 5342 | struct i40e_veb *veb; |
| 5343 | int ret; |
| 5344 | struct i40e_hw *hw; |
| 5345 | |
| 5346 | if (pf == NULL) { |
| 5347 | PMD_DRV_LOG(ERR, |
| 5348 | "veb setup failed, associated PF shouldn't null"); |
| 5349 | return NULL; |
| 5350 | } |
| 5351 | hw = I40E_PF_TO_HW(pf); |
| 5352 | |
| 5353 | veb = rte_zmalloc("i40e_veb", sizeof(struct i40e_veb), 0); |
| 5354 | if (!veb) { |
| 5355 | PMD_DRV_LOG(ERR, "Failed to allocate memory for veb"); |
| 5356 | goto fail; |
| 5357 | } |
| 5358 | |
| 5359 | veb->associate_vsi = vsi; |
| 5360 | veb->associate_pf = pf; |
| 5361 | TAILQ_INIT(&veb->head); |
| 5362 | veb->uplink_seid = vsi ? vsi->uplink_seid : 0; |
| 5363 | |
| 5364 | /* create floating veb if vsi is NULL */ |
| 5365 | if (vsi != NULL) { |
| 5366 | ret = i40e_aq_add_veb(hw, veb->uplink_seid, vsi->seid, |
| 5367 | I40E_DEFAULT_TCMAP, false, |
| 5368 | &veb->seid, false, NULL); |
| 5369 | } else { |
| 5370 | ret = i40e_aq_add_veb(hw, 0, 0, I40E_DEFAULT_TCMAP, |
| 5371 | true, &veb->seid, false, NULL); |
| 5372 | } |
| 5373 | |
| 5374 | if (ret != I40E_SUCCESS) { |
| 5375 | PMD_DRV_LOG(ERR, "Add veb failed, aq_err: %d", |
| 5376 | hw->aq.asq_last_status); |
| 5377 | goto fail; |
| 5378 | } |
| 5379 | veb->enabled_tc = I40E_DEFAULT_TCMAP; |
| 5380 | |
| 5381 | /* get statistics index */ |
| 5382 | ret = i40e_aq_get_veb_parameters(hw, veb->seid, NULL, NULL, |
| 5383 | &veb->stats_idx, NULL, NULL, NULL); |
| 5384 | if (ret != I40E_SUCCESS) { |
| 5385 | PMD_DRV_LOG(ERR, "Get veb statistics index failed, aq_err: %d", |
| 5386 | hw->aq.asq_last_status); |
| 5387 | goto fail; |
| 5388 | } |
| 5389 | /* Get VEB bandwidth, to be implemented */ |
| 5390 | /* Now associated vsi binding to the VEB, set uplink to this VEB */ |
| 5391 | if (vsi) |
| 5392 | vsi->uplink_seid = veb->seid; |
| 5393 | |
| 5394 | return veb; |
| 5395 | fail: |
| 5396 | rte_free(veb); |
no test coverage detected