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

Function sfc_dma_alloc

dpdk/drivers/net/sfc/sfc.c:56–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56int
57sfc_dma_alloc(struct sfc_adapter *sa, const char *name, uint16_t id,
58 efx_nic_dma_addr_type_t addr_type, size_t len, int socket_id,
59 efsys_mem_t *esmp)
60{
61 const struct rte_memzone *mz;
62 int rc;
63
64 sfc_log_init(sa, "name=%s id=%u len=%zu socket_id=%d",
65 name, id, len, socket_id);
66
67 mz = rte_eth_dma_zone_reserve(sa->eth_dev, name, id, len,
68 sysconf(_SC_PAGESIZE), socket_id);
69 if (mz == NULL) {
70 sfc_err(sa, "cannot reserve DMA zone for %s:%u %#x@%d: %s",
71 name, (unsigned int)id, (unsigned int)len, socket_id,
72 rte_strerror(rte_errno));
73 return ENOMEM;
74 }
75 if (mz->iova == RTE_BAD_IOVA) {
76 (void)rte_memzone_free(mz);
77 return EFAULT;
78 }
79
80 rc = sfc_nic_dma_mz_map(sa, mz, addr_type, &esmp->esm_addr);
81 if (rc != 0) {
82 (void)rte_memzone_free(mz);
83 return rc;
84 }
85
86 esmp->esm_mz = mz;
87 esmp->esm_base = mz->addr;
88
89 sfc_info(sa,
90 "DMA name=%s id=%u len=%lu socket_id=%d => virt=%p iova=%lx",
91 name, id, len, socket_id, esmp->esm_base,
92 (unsigned long)esmp->esm_addr);
93
94 return 0;
95}
96
97void
98sfc_dma_free(const struct sfc_adapter *sa, efsys_mem_t *esmp)

Callers 5

sfc_ev_qinitFunction · 0.85
sfc_mcdi_dma_allocFunction · 0.85
sfc_tx_qinitFunction · 0.85
sfc_rx_qinitFunction · 0.85
sfc_port_attachFunction · 0.85

Calls 4

rte_eth_dma_zone_reserveFunction · 0.85
rte_strerrorFunction · 0.85
rte_memzone_freeFunction · 0.85
sfc_nic_dma_mz_mapFunction · 0.85

Tested by

no test coverage detected