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

Function test7

dpdk/app/test/test_lpm.c:313–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311 */
312
313int32_t
314test7(void)
315{
316 xmm_t ipx4;
317 uint32_t hop[4];
318 struct rte_lpm *lpm = NULL;
319 struct rte_lpm_config config;
320
321 config.max_rules = MAX_RULES;
322 config.number_tbl8s = NUMBER_TBL8S;
323 config.flags = 0;
324 uint32_t ip = RTE_IPV4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0;
325 uint8_t depth = 32;
326 int32_t status = 0;
327
328 lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);
329 TEST_LPM_ASSERT(lpm != NULL);
330
331 status = rte_lpm_add(lpm, ip, depth, next_hop_add);
332 TEST_LPM_ASSERT(status == 0);
333
334 status = rte_lpm_lookup(lpm, ip, &next_hop_return);
335 TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));
336
337 ipx4 = vect_set_epi32(ip, ip + 0x100, ip - 0x100, ip);
338 rte_lpm_lookupx4(lpm, ipx4, hop, UINT32_MAX);
339 TEST_LPM_ASSERT(hop[0] == next_hop_add);
340 TEST_LPM_ASSERT(hop[1] == UINT32_MAX);
341 TEST_LPM_ASSERT(hop[2] == UINT32_MAX);
342 TEST_LPM_ASSERT(hop[3] == next_hop_add);
343
344 status = rte_lpm_delete(lpm, ip, depth);
345 TEST_LPM_ASSERT(status == 0);
346
347 status = rte_lpm_lookup(lpm, ip, &next_hop_return);
348 TEST_LPM_ASSERT(status == -ENOENT);
349
350 rte_lpm_free(lpm);
351
352 return PASS;
353}
354
355/*
356 * Use rte_lpm_add to add rules which effect only the second half of the lpm

Callers

nothing calls this directly

Calls 7

vect_set_epi32Function · 0.85
rte_lpm_createFunction · 0.50
rte_lpm_addFunction · 0.50
rte_lpm_lookupFunction · 0.50
rte_lpm_lookupx4Function · 0.50
rte_lpm_deleteFunction · 0.50
rte_lpm_freeFunction · 0.50

Tested by

no test coverage detected