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

Function test_device_setup

dpdk/app/test-mldev/test_device_ops.c:42–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42static int
43test_device_setup(struct ml_test *test, struct ml_options *opt)
44{
45 struct test_device *t;
46 void *test_device;
47 int ret = 0;
48
49 /* allocate for test structure */
50 test_device = rte_zmalloc_socket(test->name, sizeof(struct test_device),
51 RTE_CACHE_LINE_SIZE, opt->socket_id);
52 if (test_device == NULL) {
53 ml_err("failed to allocate memory for test_model");
54 ret = -ENOMEM;
55 goto error;
56 }
57 test->test_priv = test_device;
58 t = ml_test_priv(test);
59
60 t->cmn.result = ML_TEST_FAILED;
61 t->cmn.opt = opt;
62
63 /* get device info */
64 ret = rte_ml_dev_info_get(opt->dev_id, &t->cmn.dev_info);
65 if (ret < 0) {
66 ml_err("failed to get device info");
67 goto error;
68 }
69
70 return 0;
71
72error:
73 rte_free(test_device);
74
75 return ret;
76}
77
78static void
79test_device_destroy(struct ml_test *test, struct ml_options *opt)

Callers

nothing calls this directly

Calls 4

rte_zmalloc_socketFunction · 0.85
ml_test_privFunction · 0.85
rte_ml_dev_info_getFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected