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

Function dma_map_cb

dpdk/app/test-pmd/testpmd.c:1066–1100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1064}
1065
1066static void
1067dma_map_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,
1068 struct rte_mempool_memhdr *memhdr, unsigned mem_idx __rte_unused)
1069{
1070 uint16_t pid = 0;
1071 size_t page_size = sysconf(_SC_PAGESIZE);
1072 int ret;
1073
1074 ret = rte_extmem_register(memhdr->addr, memhdr->len, NULL, 0,
1075 page_size);
1076 if (ret) {
1077 TESTPMD_LOG(DEBUG,
1078 "unable to register addr 0x%p\n", memhdr->addr);
1079 return;
1080 }
1081 RTE_ETH_FOREACH_DEV(pid) {
1082 struct rte_eth_dev_info dev_info;
1083
1084 ret = eth_dev_info_get_print_err(pid, &dev_info);
1085 if (ret != 0) {
1086 TESTPMD_LOG(DEBUG,
1087 "unable to get device info for port %d on addr 0x%p,"
1088 "mempool mapping will not be performed\n",
1089 pid, memhdr->addr);
1090 continue;
1091 }
1092 ret = rte_dev_dma_map(dev_info.device, memhdr->addr, 0, memhdr->len);
1093 if (ret) {
1094 TESTPMD_LOG(DEBUG,
1095 "unable to DMA map addr 0x%p "
1096 "for device %s\n",
1097 memhdr->addr, rte_dev_name(dev_info.device));
1098 }
1099 }
1100}
1101#endif
1102
1103static unsigned int

Callers

nothing calls this directly

Calls 4

rte_extmem_registerFunction · 0.85
rte_dev_dma_mapFunction · 0.85
rte_dev_nameFunction · 0.85

Tested by

no test coverage detected