| 311 | */ |
| 312 | |
| 313 | int32_t |
| 314 | test7(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 |
nothing calls this directly
no test coverage detected