MCPcopy Index your code
hub / github.com/F-Stack/f-stack / test_vdev_bus

Function test_vdev_bus

dpdk/app/test/test_vdev.c:69–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static int
70test_vdev_bus(void)
71{
72 struct rte_bus *vdev_bus = rte_bus_find_by_name("vdev");
73 struct rte_dev_iterator dev_iter = { 0 };
74 struct rte_device *dev, *dev0, *dev1;
75
76 /* not supported */
77 if (vdev_bus == NULL)
78 return 0;
79
80 /* create first vdev */
81 if (rte_vdev_init("net_null_test0", "") < 0) {
82 printf("Failed to create vdev net_null_test0\n");
83 goto fail;
84 }
85 dev0 = vdev_bus->find_device(NULL, cmp_dev_name, "net_null_test0");
86 if (dev0 == NULL) {
87 printf("Cannot find net_null_test0 vdev\n");
88 goto fail;
89 }
90
91 /* create second vdev */
92 if (rte_vdev_init("net_null_test1", "") < 0) {
93 printf("Failed to create vdev net_null_test1\n");
94 goto fail;
95 }
96 dev1 = vdev_bus->find_device(NULL, cmp_dev_name, "net_null_test1");
97 if (dev1 == NULL) {
98 printf("Cannot find net_null_test1 vdev\n");
99 goto fail;
100 }
101
102 /* try to match vdevs */
103 dev = get_matching_vdev("name=net_null_test0");
104 if (dev != dev0) {
105 printf("Cannot match net_null_test0 vdev\n");
106 goto fail;
107 }
108
109 dev = get_matching_vdev("name=net_null_test1");
110 if (dev != dev1) {
111 printf("Cannot match net_null_test1 vdev\n");
112 goto fail;
113 }
114
115 dev = get_matching_vdev("name=unexistant");
116 if (dev != NULL) {
117 printf("Unexistant vdev should not match\n");
118 goto fail;
119 }
120
121 dev = get_matching_vdev("");
122 if (dev == NULL || dev == dev1) {
123 printf("Cannot match any vdev with empty match string\n");
124 goto fail;
125 }
126

Callers 1

test_vdevFunction · 0.85

Calls 5

rte_bus_find_by_nameFunction · 0.85
rte_vdev_initFunction · 0.85
get_matching_vdevFunction · 0.85
rte_vdev_uninitFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected