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

Function skeleton_rawdev_set_attr

dpdk/drivers/raw/skeleton/skeleton_rawdev.c:371–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371static int skeleton_rawdev_set_attr(struct rte_rawdev *dev,
372 const char *attr_name,
373 const uint64_t attr_value)
374{
375 int i;
376 uint8_t done = 0;
377 struct skeleton_rawdev *skeldev;
378
379 SKELETON_PMD_FUNC_TRACE();
380
381 if (!dev || !attr_name) {
382 SKELETON_PMD_ERR("Invalid arguments for setting attributes");
383 return -EINVAL;
384 }
385
386 skeldev = skeleton_rawdev_get_priv(dev);
387
388 /* Check if attribute already exists */
389 for (i = 0; i < SKELETON_MAX_ATTRIBUTES; i++) {
390 if (!skeldev->attr[i].name)
391 break;
392
393 if (!strncmp(skeldev->attr[i].name, attr_name,
394 SKELETON_ATTRIBUTE_NAME_MAX)) {
395 /* Update value */
396 skeldev->attr[i].value = attr_value;
397 done = 1;
398 break;
399 }
400 }
401
402 if (!done) {
403 if (i < (SKELETON_MAX_ATTRIBUTES - 1)) {
404 /* There is still space to insert one more */
405 skeldev->attr[i].name = strdup(attr_name);
406 if (!skeldev->attr[i].name)
407 return -ENOMEM;
408
409 skeldev->attr[i].value = attr_value;
410 return 0;
411 }
412 }
413
414 return -EINVAL;
415}
416
417static int skeleton_rawdev_enqueue_bufs(struct rte_rawdev *dev,
418 struct rte_rawdev_buf **buffers,

Callers

nothing calls this directly

Calls 3

skeleton_rawdev_get_privFunction · 0.85
strncmpFunction · 0.85
strdupFunction · 0.85

Tested by

no test coverage detected