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

Function test6

dpdk/app/test/test_lpm.c:276–307  ·  view source on GitHub ↗

* Call add, lookup and delete for a single rule with depth <= 24 */

Source from the content-addressed store, hash-verified

274 * Call add, lookup and delete for a single rule with depth <= 24
275 */
276int32_t
277test6(void)
278{
279 struct rte_lpm *lpm = NULL;
280 struct rte_lpm_config config;
281
282 config.max_rules = MAX_RULES;
283 config.number_tbl8s = NUMBER_TBL8S;
284 config.flags = 0;
285 uint32_t ip = RTE_IPV4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0;
286 uint8_t depth = 24;
287 int32_t status = 0;
288
289 lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);
290 TEST_LPM_ASSERT(lpm != NULL);
291
292 status = rte_lpm_add(lpm, ip, depth, next_hop_add);
293 TEST_LPM_ASSERT(status == 0);
294
295 status = rte_lpm_lookup(lpm, ip, &next_hop_return);
296 TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));
297
298 status = rte_lpm_delete(lpm, ip, depth);
299 TEST_LPM_ASSERT(status == 0);
300
301 status = rte_lpm_lookup(lpm, ip, &next_hop_return);
302 TEST_LPM_ASSERT(status == -ENOENT);
303
304 rte_lpm_free(lpm);
305
306 return PASS;
307}
308
309/*
310 * Call add, lookup and delete for a single rule with depth > 24

Callers

nothing calls this directly

Calls 5

rte_lpm_createFunction · 0.50
rte_lpm_addFunction · 0.50
rte_lpm_lookupFunction · 0.50
rte_lpm_deleteFunction · 0.50
rte_lpm_freeFunction · 0.50

Tested by

no test coverage detected