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

Function i40e_alloc_rx_queue_mbufs

dpdk/drivers/net/i40e/i40e_rxtx.c:2854–2891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2852}
2853
2854int
2855i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq)
2856{
2857 struct i40e_rx_entry *rxe = rxq->sw_ring;
2858 uint64_t dma_addr;
2859 uint16_t i;
2860
2861 for (i = 0; i < rxq->nb_rx_desc; i++) {
2862 volatile union i40e_rx_desc *rxd;
2863 struct rte_mbuf *mbuf = rte_mbuf_raw_alloc(rxq->mp);
2864
2865 if (unlikely(!mbuf)) {
2866 PMD_DRV_LOG(ERR, "Failed to allocate mbuf for RX");
2867 return -ENOMEM;
2868 }
2869
2870 rte_mbuf_refcnt_set(mbuf, 1);
2871 mbuf->next = NULL;
2872 mbuf->data_off = RTE_PKTMBUF_HEADROOM;
2873 mbuf->nb_segs = 1;
2874 mbuf->port = rxq->port_id;
2875
2876 dma_addr =
2877 rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
2878
2879 rxd = &rxq->rx_ring[i];
2880 rxd->read.pkt_addr = dma_addr;
2881 rxd->read.hdr_addr = 0;
2882#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
2883 rxd->read.rsvd1 = 0;
2884 rxd->read.rsvd2 = 0;
2885#endif /* RTE_LIBRTE_I40E_16BYTE_RX_DESC */
2886
2887 rxe[i].mbuf = mbuf;
2888 }
2889
2890 return 0;
2891}
2892
2893/*
2894 * Calculate the buffer length, and check the jumbo frame

Callers 1

i40e_dev_rx_queue_startFunction · 0.85

Calls 3

rte_mbuf_raw_allocFunction · 0.85
rte_mbuf_refcnt_setFunction · 0.85

Tested by

no test coverage detected