* Move the bin from prev group to the new group */
| 833 | * Move the bin from prev group to the new group |
| 834 | */ |
| 835 | static inline void |
| 836 | move_groups(uint32_t bin_id, uint8_t bin_size, |
| 837 | struct efd_offline_group_rules *new_group, |
| 838 | struct efd_offline_group_rules * const current_group) |
| 839 | { |
| 840 | |
| 841 | uint8_t empty_idx = 0; |
| 842 | unsigned int i; |
| 843 | |
| 844 | if (new_group == current_group) |
| 845 | return; |
| 846 | |
| 847 | for (i = 0; i < current_group->num_rules; i++) { |
| 848 | /* |
| 849 | * Move keys that belong to the same bin |
| 850 | * to the new group |
| 851 | */ |
| 852 | if (current_group->bin_id[i] == bin_id) { |
| 853 | new_group->key_idx[new_group->num_rules] = |
| 854 | current_group->key_idx[i]; |
| 855 | new_group->value[new_group->num_rules] = |
| 856 | current_group->value[i]; |
| 857 | new_group->bin_id[new_group->num_rules] = |
| 858 | current_group->bin_id[i]; |
| 859 | new_group->num_rules++; |
| 860 | } else { |
| 861 | if (i != empty_idx) { |
| 862 | /* |
| 863 | * Need to move this key towards |
| 864 | * the top of the array |
| 865 | */ |
| 866 | current_group->key_idx[empty_idx] = |
| 867 | current_group->key_idx[i]; |
| 868 | current_group->value[empty_idx] = |
| 869 | current_group->value[i]; |
| 870 | current_group->bin_id[empty_idx] = |
| 871 | current_group->bin_id[i]; |
| 872 | } |
| 873 | empty_idx++; |
| 874 | } |
| 875 | |
| 876 | } |
| 877 | current_group->num_rules -= bin_size; |
| 878 | } |
| 879 | |
| 880 | /* |
| 881 | * Revert group/s to their previous state before |
no outgoing calls
no test coverage detected