| 875 | } |
| 876 | |
| 877 | static int32_t |
| 878 | find_previous_rule(struct __rte_lpm *i_lpm, uint32_t ip, uint8_t depth, |
| 879 | uint8_t *sub_rule_depth) |
| 880 | { |
| 881 | int32_t rule_index; |
| 882 | uint32_t ip_masked; |
| 883 | uint8_t prev_depth; |
| 884 | |
| 885 | for (prev_depth = (uint8_t)(depth - 1); prev_depth > 0; prev_depth--) { |
| 886 | ip_masked = ip & depth_to_mask(prev_depth); |
| 887 | |
| 888 | rule_index = rule_find(i_lpm, ip_masked, prev_depth); |
| 889 | |
| 890 | if (rule_index >= 0) { |
| 891 | *sub_rule_depth = prev_depth; |
| 892 | return rule_index; |
| 893 | } |
| 894 | } |
| 895 | |
| 896 | return -1; |
| 897 | } |
| 898 | |
| 899 | static int32_t |
| 900 | delete_depth_small(struct __rte_lpm *i_lpm, uint32_t ip_masked, |
no test coverage detected