MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx4_rx_queue_setup

Function mlx4_rx_queue_setup

dpdk/drivers/net/mlx4/mlx4_rxq.c:731–903  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

729 * 0 on success, negative errno value otherwise and rte_errno is set.
730 */
731int
732mlx4_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) {

Callers

nothing calls this directly

Calls 7

mlx4_zmallocv_socketFunction · 0.85
mlx4_mr_btree_initFunction · 0.85
mlx4_fd_set_non_blockingFunction · 0.85
mlx4_rx_queue_releaseFunction · 0.85
rte_align32pow2Function · 0.50
rte_log2_u32Function · 0.50

Tested by

no test coverage detected