| 647 | } |
| 648 | |
| 649 | int |
| 650 | virtio_dev_rx_queue_setup(struct rte_eth_dev *dev, |
| 651 | uint16_t queue_idx, |
| 652 | uint16_t nb_desc, |
| 653 | unsigned int socket_id __rte_unused, |
| 654 | const struct rte_eth_rxconf *rx_conf, |
| 655 | struct rte_mempool *mp) |
| 656 | { |
| 657 | uint16_t vq_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX; |
| 658 | struct virtio_hw *hw = dev->data->dev_private; |
| 659 | struct virtqueue *vq = hw->vqs[vq_idx]; |
| 660 | struct virtnet_rx *rxvq; |
| 661 | uint16_t rx_free_thresh; |
| 662 | uint16_t buf_size; |
| 663 | const char *error; |
| 664 | |
| 665 | PMD_INIT_FUNC_TRACE(); |
| 666 | |
| 667 | if (rx_conf->rx_deferred_start) { |
| 668 | PMD_INIT_LOG(ERR, "Rx deferred start is not supported"); |
| 669 | return -EINVAL; |
| 670 | } |
| 671 | |
| 672 | buf_size = virtio_rx_mem_pool_buf_size(mp); |
| 673 | if (!virtio_rx_check_scatter(hw->max_rx_pkt_len, buf_size, |
| 674 | hw->rx_ol_scatter, &error)) { |
| 675 | PMD_INIT_LOG(ERR, "RxQ %u Rx scatter check failed: %s", |
| 676 | queue_idx, error); |
| 677 | return -EINVAL; |
| 678 | } |
| 679 | |
| 680 | rx_free_thresh = rx_conf->rx_free_thresh; |
| 681 | if (rx_free_thresh == 0) |
| 682 | rx_free_thresh = |
| 683 | RTE_MIN(vq->vq_nentries / 4, DEFAULT_RX_FREE_THRESH); |
| 684 | |
| 685 | if (rx_free_thresh & 0x3) { |
| 686 | PMD_INIT_LOG(ERR, "rx_free_thresh must be multiples of four." |
| 687 | " (rx_free_thresh=%u port=%u queue=%u)", |
| 688 | rx_free_thresh, dev->data->port_id, queue_idx); |
| 689 | return -EINVAL; |
| 690 | } |
| 691 | |
| 692 | if (rx_free_thresh >= vq->vq_nentries) { |
| 693 | PMD_INIT_LOG(ERR, "rx_free_thresh must be less than the " |
| 694 | "number of RX entries (%u)." |
| 695 | " (rx_free_thresh=%u port=%u queue=%u)", |
| 696 | vq->vq_nentries, |
| 697 | rx_free_thresh, dev->data->port_id, queue_idx); |
| 698 | return -EINVAL; |
| 699 | } |
| 700 | vq->vq_free_thresh = rx_free_thresh; |
| 701 | |
| 702 | /* |
| 703 | * For split ring vectorized path descriptors number must be |
| 704 | * equal to the ring size. |
| 705 | */ |
| 706 | if (nb_desc > vq->vq_nentries || |
nothing calls this directly
no test coverage detected