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

Function nfp_net_rx_queue_setup

dpdk/drivers/net/nfp/nfp_rxtx.c:835–938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

833}
834
835int
836nfp_net_rx_queue_setup(struct rte_eth_dev *dev,
837 uint16_t queue_idx,
838 uint16_t nb_desc,
839 unsigned int socket_id,
840 const struct rte_eth_rxconf *rx_conf,
841 struct rte_mempool *mp)
842{
843 uint32_t rx_desc_sz;
844 uint16_t min_rx_desc;
845 uint16_t max_rx_desc;
846 struct nfp_net_hw *hw;
847 struct nfp_net_rxq *rxq;
848 const struct rte_memzone *tz;
849
850 hw = nfp_net_get_hw(dev);
851
852 nfp_net_rx_desc_limits(hw, &min_rx_desc, &max_rx_desc);
853
854 /* Validating number of descriptors */
855 rx_desc_sz = nb_desc * sizeof(struct nfp_net_rx_desc);
856 if (rx_desc_sz % NFP_ALIGN_RING_DESC != 0 ||
857 nb_desc > max_rx_desc || nb_desc < min_rx_desc) {
858 PMD_DRV_LOG(ERR, "Wrong nb_desc value");
859 return -EINVAL;
860 }
861
862 /*
863 * Free memory prior to re-allocation if needed. This is the case after
864 * calling @nfp_net_stop().
865 */
866 if (dev->data->rx_queues[queue_idx] != NULL) {
867 nfp_net_rx_queue_release(dev, queue_idx);
868 dev->data->rx_queues[queue_idx] = NULL;
869 }
870
871 /* Allocating rx queue data structure */
872 rxq = rte_zmalloc_socket("ethdev RX queue", sizeof(struct nfp_net_rxq),
873 RTE_CACHE_LINE_SIZE, socket_id);
874 if (rxq == NULL)
875 return -ENOMEM;
876
877 dev->data->rx_queues[queue_idx] = rxq;
878
879 /* Hw queues mapping based on firmware configuration */
880 rxq->qidx = queue_idx;
881 rxq->fl_qcidx = queue_idx * hw->stride_rx;
882 rxq->qcp_fl = hw->rx_bar + NFP_QCP_QUEUE_OFF(rxq->fl_qcidx);
883
884 /*
885 * Tracking mbuf size for detecting a potential mbuf overflow due to
886 * RX offset.
887 */
888 rxq->mem_pool = mp;
889 rxq->mbuf_size = rxq->mem_pool->elt_size;
890 rxq->mbuf_size -= (sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM);
891 hw->flbufsz = rxq->mbuf_size;
892

Callers

nothing calls this directly

Calls 9

nfp_net_get_hwFunction · 0.85
nfp_net_rx_desc_limitsFunction · 0.85
nfp_net_rx_queue_releaseFunction · 0.85
rte_zmalloc_socketFunction · 0.85
rte_eth_dma_zone_reserveFunction · 0.85
nfp_net_reset_rx_queueFunction · 0.85
nn_cfg_writeqFunction · 0.85
nn_cfg_writebFunction · 0.85
rte_log2_u32Function · 0.50

Tested by

no test coverage detected