| 2852 | } |
| 2853 | |
| 2854 | int |
| 2855 | i40e_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 |
no test coverage detected