| 445 | } |
| 446 | |
| 447 | static struct bnxt_vnic_info* |
| 448 | bnxt_vnic_queue_create(struct bnxt *bp, int32_t vnic_id, uint16_t q_index) |
| 449 | { |
| 450 | uint8_t *rx_queue_state = bp->eth_dev->data->rx_queue_state; |
| 451 | struct bnxt_vnic_info *vnic; |
| 452 | struct bnxt_rx_queue *rxq = NULL; |
| 453 | int32_t rc = -EINVAL; |
| 454 | uint16_t saved_mru = 0; |
| 455 | |
| 456 | vnic = &bp->vnic_info[vnic_id]; |
| 457 | if (vnic->rx_queue_cnt) { |
| 458 | PMD_DRV_LOG(ERR, "invalid queue configuration %d\n", vnic_id); |
| 459 | return NULL; |
| 460 | } |
| 461 | |
| 462 | /* set the queue_bitmap */ |
| 463 | BNXT_VNIC_BITMAP_SET(vnic->queue_bitmap, q_index); |
| 464 | |
| 465 | rxq = bp->rx_queues[q_index]; |
| 466 | if (rx_queue_state[q_index] == RTE_ETH_QUEUE_STATE_STOPPED) |
| 467 | rxq->rx_started = 0; |
| 468 | else |
| 469 | rxq->rx_started = 1; |
| 470 | |
| 471 | vnic->rx_queue_cnt++; |
| 472 | vnic->start_grp_id = q_index; |
| 473 | vnic->end_grp_id = q_index + 1; |
| 474 | vnic->func_default = 0; /* This is not a default VNIC. */ |
| 475 | bp->nr_vnics++; |
| 476 | |
| 477 | /* Allocate vnic group for p4 platform */ |
| 478 | rc = bnxt_vnic_grp_alloc(bp, vnic); |
| 479 | if (rc) { |
| 480 | PMD_DRV_LOG(DEBUG, "Failed to allocate vnic groups\n"); |
| 481 | goto cleanup; |
| 482 | } |
| 483 | |
| 484 | /* populate the fw group table */ |
| 485 | bnxt_vnic_ring_grp_populate(bp, vnic); |
| 486 | bnxt_vnic_rules_init(vnic); |
| 487 | |
| 488 | rc = bnxt_hwrm_vnic_alloc(bp, vnic); |
| 489 | if (rc) { |
| 490 | PMD_DRV_LOG(DEBUG, "Failed to allocate vnic %d\n", q_index); |
| 491 | goto cleanup; |
| 492 | } |
| 493 | |
| 494 | /* store the mru so we can set it to zero in hw */ |
| 495 | if (rxq->rx_started == 0) { |
| 496 | saved_mru = vnic->mru; |
| 497 | vnic->mru = 0; |
| 498 | } |
| 499 | |
| 500 | rc = bnxt_hwrm_vnic_cfg(bp, vnic); |
| 501 | if (rxq->rx_started == 0) |
| 502 | vnic->mru = saved_mru; |
| 503 | |
| 504 | if (rc) { |
no test coverage detected