| 897 | } |
| 898 | |
| 899 | static int32_t |
| 900 | delete_depth_small(struct __rte_lpm *i_lpm, uint32_t ip_masked, |
| 901 | uint8_t depth, int32_t sub_rule_index, uint8_t sub_rule_depth) |
| 902 | { |
| 903 | #define group_idx next_hop |
| 904 | uint32_t tbl24_range, tbl24_index, tbl8_group_index, tbl8_index, i, j; |
| 905 | |
| 906 | /* Calculate the range and index into Table24. */ |
| 907 | tbl24_range = depth_to_range(depth); |
| 908 | tbl24_index = (ip_masked >> 8); |
| 909 | struct rte_lpm_tbl_entry zero_tbl24_entry = {0}; |
| 910 | |
| 911 | /* |
| 912 | * Firstly check the sub_rule_index. A -1 indicates no replacement rule |
| 913 | * and a positive number indicates a sub_rule_index. |
| 914 | */ |
| 915 | if (sub_rule_index < 0) { |
| 916 | /* |
| 917 | * If no replacement rule exists then invalidate entries |
| 918 | * associated with this rule. |
| 919 | */ |
| 920 | for (i = tbl24_index; i < (tbl24_index + tbl24_range); i++) { |
| 921 | |
| 922 | if (i_lpm->lpm.tbl24[i].valid_group == 0 && |
| 923 | i_lpm->lpm.tbl24[i].depth <= depth) { |
| 924 | __atomic_store(&i_lpm->lpm.tbl24[i], |
| 925 | &zero_tbl24_entry, __ATOMIC_RELEASE); |
| 926 | } else if (i_lpm->lpm.tbl24[i].valid_group == 1) { |
| 927 | /* |
| 928 | * If TBL24 entry is extended, then there has |
| 929 | * to be a rule with depth >= 25 in the |
| 930 | * associated TBL8 group. |
| 931 | */ |
| 932 | |
| 933 | tbl8_group_index = i_lpm->lpm.tbl24[i].group_idx; |
| 934 | tbl8_index = tbl8_group_index * |
| 935 | RTE_LPM_TBL8_GROUP_NUM_ENTRIES; |
| 936 | |
| 937 | for (j = tbl8_index; j < (tbl8_index + |
| 938 | RTE_LPM_TBL8_GROUP_NUM_ENTRIES); j++) { |
| 939 | |
| 940 | if (i_lpm->lpm.tbl8[j].depth <= depth) |
| 941 | i_lpm->lpm.tbl8[j].valid = INVALID; |
| 942 | } |
| 943 | } |
| 944 | } |
| 945 | } else { |
| 946 | /* |
| 947 | * If a replacement rule exists then modify entries |
| 948 | * associated with this rule. |
| 949 | */ |
| 950 | |
| 951 | struct rte_lpm_tbl_entry new_tbl24_entry = { |
| 952 | .next_hop = i_lpm->rules_tbl[sub_rule_index].next_hop, |
| 953 | .valid = VALID, |
| 954 | .valid_group = 0, |
| 955 | .depth = sub_rule_depth, |
| 956 | }; |
no test coverage detected