| 502 | } |
| 503 | |
| 504 | int |
| 505 | idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id) |
| 506 | { |
| 507 | struct idpf_rx_queue *rxq; |
| 508 | uint16_t max_pkt_len; |
| 509 | uint32_t frame_size; |
| 510 | int err; |
| 511 | |
| 512 | if (rx_queue_id >= dev->data->nb_rx_queues) |
| 513 | return -EINVAL; |
| 514 | |
| 515 | rxq = dev->data->rx_queues[rx_queue_id]; |
| 516 | |
| 517 | if (rxq == NULL || !rxq->q_set) { |
| 518 | PMD_DRV_LOG(ERR, "RX queue %u not available or setup", |
| 519 | rx_queue_id); |
| 520 | return -EINVAL; |
| 521 | } |
| 522 | |
| 523 | frame_size = dev->data->mtu + IDPF_ETH_OVERHEAD; |
| 524 | |
| 525 | max_pkt_len = |
| 526 | RTE_MIN((uint32_t)IDPF_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, |
| 527 | frame_size); |
| 528 | |
| 529 | rxq->max_pkt_len = max_pkt_len; |
| 530 | if ((dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) || |
| 531 | frame_size > rxq->rx_buf_len) |
| 532 | dev->data->scattered_rx = 1; |
| 533 | |
| 534 | err = idpf_qc_ts_mbuf_register(rxq); |
| 535 | if (err != 0) { |
| 536 | PMD_DRV_LOG(ERR, "fail to residter timestamp mbuf %u", |
| 537 | rx_queue_id); |
| 538 | return -EIO; |
| 539 | } |
| 540 | |
| 541 | if (rxq->adapter->is_rx_singleq) { |
| 542 | /* Single queue */ |
| 543 | err = idpf_qc_single_rxq_mbufs_alloc(rxq); |
| 544 | if (err != 0) { |
| 545 | PMD_DRV_LOG(ERR, "Failed to allocate RX queue mbuf"); |
| 546 | return err; |
| 547 | } |
| 548 | |
| 549 | rte_wmb(); |
| 550 | |
| 551 | /* Init the RX tail register. */ |
| 552 | IDPF_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); |
| 553 | } else { |
| 554 | /* Split queue */ |
| 555 | err = idpf_qc_split_rxq_mbufs_alloc(rxq->bufq1); |
| 556 | if (err != 0) { |
| 557 | PMD_DRV_LOG(ERR, "Failed to allocate RX buffer queue mbuf"); |
| 558 | return err; |
| 559 | } |
| 560 | err = idpf_qc_split_rxq_mbufs_alloc(rxq->bufq2); |
| 561 | if (err != 0) { |
no test coverage detected