| 499 | } |
| 500 | |
| 501 | int __rte_cold |
| 502 | ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, |
| 503 | uint16_t rx_queue_id, |
| 504 | uint16_t nb_desc, |
| 505 | uint32_t socket_id, |
| 506 | const struct rte_eth_rxconf *rx_conf, |
| 507 | struct rte_mempool *mp) |
| 508 | { |
| 509 | struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); |
| 510 | struct ionic_rx_qcq *rxq; |
| 511 | uint64_t offloads; |
| 512 | int err; |
| 513 | |
| 514 | if (rx_queue_id >= lif->nrxqcqs) { |
| 515 | IONIC_PRINT(ERR, |
| 516 | "Queue index %u not available (max %u queues)", |
| 517 | rx_queue_id, lif->nrxqcqs); |
| 518 | return -EINVAL; |
| 519 | } |
| 520 | |
| 521 | offloads = rx_conf->offloads | eth_dev->data->dev_conf.rxmode.offloads; |
| 522 | IONIC_PRINT(DEBUG, |
| 523 | "Configuring skt %u RX queue %u with %u buffers, offloads %jx", |
| 524 | socket_id, rx_queue_id, nb_desc, offloads); |
| 525 | |
| 526 | if (!rx_conf->rx_drop_en) |
| 527 | IONIC_PRINT(WARNING, "No-drop mode is not supported"); |
| 528 | |
| 529 | /* Validate number of receive descriptors */ |
| 530 | if (!rte_is_power_of_2(nb_desc) || |
| 531 | nb_desc < IONIC_MIN_RING_DESC || |
| 532 | nb_desc > IONIC_MAX_RING_DESC) { |
| 533 | IONIC_PRINT(ERR, |
| 534 | "Bad descriptor count (%u) for queue %u (min: %u)", |
| 535 | nb_desc, rx_queue_id, IONIC_MIN_RING_DESC); |
| 536 | return -EINVAL; /* or use IONIC_DEFAULT_RING_DESC */ |
| 537 | } |
| 538 | |
| 539 | /* Free memory prior to re-allocation if needed... */ |
| 540 | if (eth_dev->data->rx_queues[rx_queue_id] != NULL) { |
| 541 | ionic_dev_rx_queue_release(eth_dev, rx_queue_id); |
| 542 | eth_dev->data->rx_queues[rx_queue_id] = NULL; |
| 543 | } |
| 544 | |
| 545 | eth_dev->data->rx_queue_state[rx_queue_id] = |
| 546 | RTE_ETH_QUEUE_STATE_STOPPED; |
| 547 | |
| 548 | err = ionic_rx_qcq_alloc(lif, socket_id, rx_queue_id, nb_desc, mp, |
| 549 | &rxq); |
| 550 | if (err) { |
| 551 | IONIC_PRINT(ERR, "Queue %d allocation failure", rx_queue_id); |
| 552 | return -EINVAL; |
| 553 | } |
| 554 | |
| 555 | rxq->mb_pool = mp; |
| 556 | rxq->wdog_ms = IONIC_Q_WDOG_MS; |
| 557 | |
| 558 | /* |
nothing calls this directly
no test coverage detected