| 1679 | } |
| 1680 | |
| 1681 | static int |
| 1682 | em_alloc_rx_queue_mbufs(struct em_rx_queue *rxq) |
| 1683 | { |
| 1684 | struct em_rx_entry *rxe = rxq->sw_ring; |
| 1685 | uint64_t dma_addr; |
| 1686 | unsigned i; |
| 1687 | static const struct e1000_rx_desc rxd_init = { |
| 1688 | .buffer_addr = 0, |
| 1689 | }; |
| 1690 | |
| 1691 | /* Initialize software ring entries */ |
| 1692 | for (i = 0; i < rxq->nb_rx_desc; i++) { |
| 1693 | volatile struct e1000_rx_desc *rxd; |
| 1694 | struct rte_mbuf *mbuf = rte_mbuf_raw_alloc(rxq->mb_pool); |
| 1695 | |
| 1696 | if (mbuf == NULL) { |
| 1697 | PMD_INIT_LOG(ERR, "RX mbuf alloc failed " |
| 1698 | "queue_id=%hu", rxq->queue_id); |
| 1699 | return -ENOMEM; |
| 1700 | } |
| 1701 | |
| 1702 | dma_addr = |
| 1703 | rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf)); |
| 1704 | |
| 1705 | /* Clear HW ring memory */ |
| 1706 | rxq->rx_ring[i] = rxd_init; |
| 1707 | |
| 1708 | rxd = &rxq->rx_ring[i]; |
| 1709 | rxd->buffer_addr = dma_addr; |
| 1710 | rxe[i].mbuf = mbuf; |
| 1711 | } |
| 1712 | |
| 1713 | return 0; |
| 1714 | } |
| 1715 | |
| 1716 | /********************************************************************* |
| 1717 | * |
no test coverage detected