* DPDK callback to configure a Rx queue. * * @param dev * Pointer to Ethernet device structure. * @param idx * Rx queue index. * @param desc * Number of descriptors to configure in queue. * @param socket * NUMA socket on which memory must be allocated. * @param[in] conf * Thresholds parameters. * @param mp * Memory pool for buffer allocations. * * @return * 0 on succe
| 729 | * 0 on success, negative errno value otherwise and rte_errno is set. |
| 730 | */ |
| 731 | int |
| 732 | mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, |
| 733 | unsigned int socket, const struct rte_eth_rxconf *conf, |
| 734 | struct rte_mempool *mp) |
| 735 | { |
| 736 | struct mlx4_priv *priv = dev->data->dev_private; |
| 737 | uint32_t mb_len = rte_pktmbuf_data_room_size(mp); |
| 738 | struct rte_mbuf *(*elts)[rte_align32pow2(desc)]; |
| 739 | struct rxq *rxq; |
| 740 | struct mlx4_malloc_vec vec[] = { |
| 741 | { |
| 742 | .align = RTE_CACHE_LINE_SIZE, |
| 743 | .size = sizeof(*rxq), |
| 744 | .addr = (void **)&rxq, |
| 745 | }, |
| 746 | { |
| 747 | .align = RTE_CACHE_LINE_SIZE, |
| 748 | .size = sizeof(*elts), |
| 749 | .addr = (void **)&elts, |
| 750 | }, |
| 751 | }; |
| 752 | int ret; |
| 753 | uint32_t crc_present; |
| 754 | uint64_t offloads; |
| 755 | uint32_t max_rx_pktlen; |
| 756 | |
| 757 | offloads = conf->offloads | dev->data->dev_conf.rxmode.offloads; |
| 758 | |
| 759 | DEBUG("%p: configuring queue %u for %u descriptors", |
| 760 | (void *)dev, idx, desc); |
| 761 | |
| 762 | if (idx >= dev->data->nb_rx_queues) { |
| 763 | rte_errno = EOVERFLOW; |
| 764 | ERROR("%p: queue index out of range (%u >= %u)", |
| 765 | (void *)dev, idx, dev->data->nb_rx_queues); |
| 766 | return -rte_errno; |
| 767 | } |
| 768 | rxq = dev->data->rx_queues[idx]; |
| 769 | if (rxq) { |
| 770 | rte_errno = EEXIST; |
| 771 | ERROR("%p: Rx queue %u already configured, release it first", |
| 772 | (void *)dev, idx); |
| 773 | return -rte_errno; |
| 774 | } |
| 775 | if (!desc) { |
| 776 | rte_errno = EINVAL; |
| 777 | ERROR("%p: invalid number of Rx descriptors", (void *)dev); |
| 778 | return -rte_errno; |
| 779 | } |
| 780 | if (desc != RTE_DIM(*elts)) { |
| 781 | desc = RTE_DIM(*elts); |
| 782 | WARN("%p: increased number of descriptors in Rx queue %u" |
| 783 | " to the next power of two (%u)", |
| 784 | (void *)dev, idx, desc); |
| 785 | } |
| 786 | /* By default, FCS (CRC) is stripped by hardware. */ |
| 787 | crc_present = 0; |
| 788 | if (offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC) { |
nothing calls this directly
no test coverage detected