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

Function open_dma

dpdk/examples/vhost/main.c:240–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240static inline int
241open_dma(const char *value)
242{
243 struct dma_for_vhost *dma_info = dma_bind;
244 char *input = strndup(value, strlen(value) + 1);
245 char *addrs = input;
246 char *ptrs[2];
247 char *start, *end, *substr;
248 int64_t socketid, vring_id;
249
250 struct rte_dma_info info;
251 struct rte_dma_conf dev_config = { .nb_vchans = 1 };
252 struct rte_dma_vchan_conf qconf = {
253 .direction = RTE_DMA_DIR_MEM_TO_MEM,
254 .nb_desc = DMA_RING_SIZE
255 };
256
257 int dev_id;
258 int ret = 0;
259 uint16_t i = 0;
260 char *dma_arg[RTE_MAX_VHOST_DEVICE];
261 int args_nr;
262
263 if (input == NULL)
264 return -1;
265
266 while (isblank(*addrs))
267 addrs++;
268 if (*addrs == '\0') {
269 ret = -1;
270 goto out;
271 }
272
273 /* process DMA devices within bracket. */
274 addrs++;
275 substr = strtok(addrs, ";]");
276 if (!substr) {
277 ret = -1;
278 goto out;
279 }
280
281 args_nr = rte_strsplit(substr, strlen(substr), dma_arg, RTE_MAX_VHOST_DEVICE, ',');
282 if (args_nr <= 0) {
283 ret = -1;
284 goto out;
285 }
286
287 while (i < args_nr) {
288 char *arg_temp = dma_arg[i];
289 char *txd, *rxd;
290 uint8_t sub_nr;
291 int async_flag;
292
293 sub_nr = rte_strsplit(arg_temp, strlen(arg_temp), ptrs, 2, '@');
294 if (sub_nr != 2) {
295 ret = -1;
296 goto out;
297 }

Callers 1

us_vhost_parse_argsFunction · 0.85

Calls 13

strndupFunction · 0.85
isblankFunction · 0.85
strtokFunction · 0.85
rte_strsplitFunction · 0.85
strstrFunction · 0.85
strtolFunction · 0.85
is_dma_configuredFunction · 0.85
rte_dma_info_getFunction · 0.85
rte_dma_configureFunction · 0.85
rte_dma_vchan_setupFunction · 0.85
rte_dma_startFunction · 0.85

Tested by

no test coverage detected