Lines Matching refs:tbl8
215 lpm->tbl8 = rte_zmalloc_socket(NULL,
218 if (lpm->tbl8 == NULL) {
219 RTE_LOG(ERR, LPM, "LPM tbl8 memory allocation failed\n");
272 rte_free(lpm->tbl8);
419 * Find, clean and allocate a tbl8.
422 tbl8_alloc(struct rte_lpm_tbl_entry *tbl8, uint32_t number_tbl8s)
424 uint32_t group_idx; /* tbl8 group index. */
427 /* Scan through tbl8 to find a free (i.e. INVALID) tbl8 group. */
429 tbl8_entry = &tbl8[group_idx * RTE_LPM_TBL8_GROUP_NUM_ENTRIES];
430 /* If a free tbl8 group is found clean it and set as VALID. */
446 /* Return group index for allocated tbl8 group. */
451 /* If there are no tbl8 groups free then return error. */
456 tbl8_free(struct rte_lpm_tbl_entry *tbl8, uint32_t tbl8_group_start)
458 /* Set tbl8 group invalid*/
461 __atomic_store(&tbl8[tbl8_group_start], &zero_tbl8_entry,
502 * index into tbl8.
510 if (!lpm->tbl8[j].valid ||
511 lpm->tbl8[j].depth <= depth) {
521 * Setting tbl8 entry in one go to avoid
524 __atomic_store(&lpm->tbl8[j],
550 /* Search for a free tbl8 group. */
551 tbl8_group_index = tbl8_alloc(lpm->tbl8, lpm->number_tbl8s);
553 /* Check tbl8 allocation was successful. */
558 /* Find index into tbl8 and range. */
563 /* Set tbl8 entry. */
568 .valid_group = lpm->tbl8[i].valid_group,
571 __atomic_store(&lpm->tbl8[i], &new_tbl8_entry,
576 * Update tbl24 entry to point to new tbl8 entry. Note: The
589 * tbl8 entries are written.
596 /* Search for free tbl8 group. */
597 tbl8_group_index = tbl8_alloc(lpm->tbl8, lpm->number_tbl8s);
608 /* Populate new tbl8 with tbl24 value. */
613 .valid_group = lpm->tbl8[i].valid_group,
616 __atomic_store(&lpm->tbl8[i], &new_tbl8_entry,
622 /* Insert new rule into the tbl8 entry. */
627 .valid_group = lpm->tbl8[i].valid_group,
630 __atomic_store(&lpm->tbl8[i], &new_tbl8_entry,
635 * Update tbl24 entry to point to new tbl8 entry. Note: The
648 * tbl8 entries are written.
654 * If it is valid, extended entry calculate the index into tbl8.
663 if (!lpm->tbl8[i].valid ||
664 lpm->tbl8[i].depth <= depth) {
669 .valid_group = lpm->tbl8[i].valid_group,
673 * Setting tbl8 entry in one go to avoid race
676 __atomic_store(&lpm->tbl8[i], &new_tbl8_entry,
725 * If add fails due to exhaustion of tbl8 extensions delete
832 if (lpm->tbl8[j].depth <= depth)
833 lpm->tbl8[j].valid = INVALID;
877 if (lpm->tbl8[j].depth <= depth)
878 __atomic_store(&lpm->tbl8[j],
892 * Return of -EEXIST means tbl8 is in use and thus can not be recycled.
893 * Return of -EINVAL means tbl8 is empty and thus can be recycled
894 * Return of value > -1 means tbl8 is in use but has all the same values and
898 tbl8_recycle_check(struct rte_lpm_tbl_entry *tbl8,
905 * Check the first entry of the given tbl8. If it is invalid we know
906 * this tbl8 does not contain any rule with a depth < RTE_LPM_MAX_DEPTH
907 * (As they would affect all entries in a tbl8) and thus this table
910 if (tbl8[tbl8_group_start].valid) {
916 if (tbl8[tbl8_group_start].depth <= MAX_DEPTH_TBL24) {
920 if (tbl8[i].depth !=
921 tbl8[tbl8_group_start].depth) {
934 * the tbl8 are invalid.
937 if (tbl8[i].valid)
959 /* Calculate the index into tbl8 and range. */
967 * Loop through the range of entries on tbl8 for which the
971 if (lpm->tbl8[i].depth <= depth)
972 lpm->tbl8[i].valid = INVALID;
975 /* Set new tbl8 entry. */
979 .valid_group = lpm->tbl8[tbl8_group_start].valid_group,
984 * Loop through the range of entries on tbl8 for which the
988 if (lpm->tbl8[i].depth <= depth)
989 __atomic_store(&lpm->tbl8[i], &new_tbl8_entry,
995 * Check if there are any valid entries in this tbl8 group. If all
996 * tbl8 entries are invalid we can free the tbl8 and invalidate the
1000 tbl8_recycle_index = tbl8_recycle_check(lpm->tbl8, tbl8_group_start);
1003 /* Set tbl24 before freeing tbl8 to avoid race condition.
1004 * Prevent the free of the tbl8 group from hoisting.
1008 tbl8_free(lpm->tbl8, tbl8_group_start);
1012 .next_hop = lpm->tbl8[tbl8_recycle_index].next_hop,
1015 .depth = lpm->tbl8[tbl8_recycle_index].depth,
1018 /* Set tbl24 before freeing tbl8 to avoid race condition.
1019 * Prevent the free of the tbl8 group from hoisting.
1024 tbl8_free(lpm->tbl8, tbl8_group_start);
1101 /* Zero tbl8. */
1102 memset(lpm->tbl8, 0, sizeof(lpm->tbl8[0])