src/dpdk/lib/librte_efd/rte_efd.c
static inline void
move_groups(uint32_t bin_id, uint8_t bin_size,
		struct efd_offline_group_rules *new_group,
		struct efd_offline_group_rules * const current_group)
{

	uint8_t empty_idx = 0;
	unsigned int i;

	if (new_group == current_group)
		return;

	for (i = 0; i < current_group->num_rules; i++) {
		/*
		 * Move keys that belong to the same bin
		 * to the new group
		 */
		if (current_group->bin_id[i] == bin_id) {
			new_group->key_idx[new_group->num_rules] =
					current_group->key_idx[i];
			new_group->value[new_group->num_rules] =
					current_group->value[i];
			new_group->bin_id[new_group->num_rules] =
					current_group->bin_id[i];
			new_group->num_rules++;
		} else {
			if (i != empty_idx) {
				/*
				 * Need to move this key towards
				 * the top of the array
				 */
				current_group->key_idx[empty_idx] =
						current_group->key_idx[i];
				current_group->value[empty_idx] =
						current_group->value[i];
				current_group->bin_id[empty_idx] =
						current_group->bin_id[i];
			}
			empty_idx++;
		}

	}
	current_group->num_rules -= bin_size;
}
/*
 * Move the bin from prev group to the new group
 */
Move the bin from prev group to the new group
Move the bin from prev group to the new group
static inline void
move_groups(uint32_t bin_id, uint8_t bin_size,
		struct efd_offline_group_rules *new_group,
		struct efd_offline_group_rules * const current_group)
{
	uint8_t empty_idx = 0;
	unsigned int i;
	if (new_group == current_group)
		return;
	for (i = 0; i < current_group->num_rules; i++) {
		if (current_group->bin_id[i] == bin_id) {
			new_group->key_idx[new_group->num_rules] =
					current_group->key_idx[i];
			new_group->value[new_group->num_rules] =
					current_group->value[i];
			new_group->bin_id[new_group->num_rules] =
					current_group->bin_id[i];
			new_group->num_rules++;
		} else {
			if (i != empty_idx) {
				current_group->key_idx[empty_idx] =
						current_group->key_idx[i];
				current_group->value[empty_idx] =
						current_group->value[i];
				current_group->bin_id[empty_idx] =
						current_group->bin_id[i];
			}
			empty_idx++;
		}
	}
	current_group->num_rules -= bin_size;
}
static inline void move_groups ( uint32_t bin_id , uint8_t bin_size , struct efd_offline_group_rules * new_group , struct efd_offline_group_rules * const current_group ) { uint8_t empty_idx = 0 ; unsigned int i ; if ( new_group == current_group ) return ; for ( i = 0 ; i < current_group -> num_rules ; i ++ ) { if ( current_group -> bin_id [ i ] == bin_id ) { new_group -> key_idx [ new_group -> num_rules ] = current_group -> key_idx [ i ] ; new_group -> value [ new_group -> num_rules ] = current_group -> value [ i ] ; new_group -> bin_id [ new_group -> num_rules ] = current_group -> bin_id [ i ] ; new_group -> num_rules ++ ; } else { if ( i != empty_idx ) { current_group -> key_idx [ empty_idx ] = current_group -> key_idx [ i ] ; current_group -> value [ empty_idx ] = current_group -> value [ i ] ; current_group -> bin_id [ empty_idx ] = current_group -> bin_id [ i ] ; } empty_idx ++ ; } } current_group -> num_rules -= bin_size ; }
Move the bin from prev group to the new group
Move the bin from prev group to the new group
/*
		 * Move keys that belong to the same bin
		 * to the new group
		 */ /*
				 * Need to move this key towards
				 * the top of the array
				 */