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

Function test_pflock

dpdk/app/test/test_pflock.c:160–194  ·  view source on GitHub ↗

* - There is a global pflock and a table of pflocks (one per lcore). * * - The test function takes all of these locks and launches the * ``test_pflock_per_core()`` function on each core (except the main). * * - The function takes the global write lock, display something, * then releases the global lock. * - Then, it takes the per-lcore write lock, display something, and * rel

Source from the content-addressed store, hash-verified

158 * message. The autotest script checks that the message order is correct.
159 */
160static int
161test_pflock(void)
162{
163 int i;
164
165 rte_pflock_init(&sl);
166 for (i = 0; i < RTE_MAX_LCORE; i++)
167 rte_pflock_init(&sl_tab[i]);
168
169 rte_pflock_write_lock(&sl);
170
171 RTE_LCORE_FOREACH_WORKER(i) {
172 rte_pflock_write_lock(&sl_tab[i]);
173 rte_eal_remote_launch(test_pflock_per_core, NULL, i);
174 }
175
176 rte_pflock_write_unlock(&sl);
177
178 RTE_LCORE_FOREACH_WORKER(i) {
179 rte_pflock_write_unlock(&sl_tab[i]);
180 rte_delay_ms(100);
181 }
182
183 rte_pflock_write_lock(&sl);
184 /* this message should be the last message of test */
185 printf("Global write lock taken on main core %u\n", rte_lcore_id());
186 rte_pflock_write_unlock(&sl);
187
188 rte_eal_mp_wait_lcore();
189
190 if (test_pflock_perf() < 0)
191 return -1;
192
193 return 0;
194}
195
196REGISTER_FAST_TEST(pflock_autotest, true, true, test_pflock);

Callers

nothing calls this directly

Calls 9

rte_pflock_initFunction · 0.85
rte_pflock_write_lockFunction · 0.85
rte_eal_remote_launchFunction · 0.85
rte_pflock_write_unlockFunction · 0.85
rte_delay_msFunction · 0.85
rte_lcore_idFunction · 0.85
rte_eal_mp_wait_lcoreFunction · 0.85
test_pflock_perfFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected