src/dpdk/drivers/net/igc/igc_filter.c
static int
igc_tuple_filter_lookup(const struct igc_adapter *igc,
			const struct igc_ntuple_filter *ntuple,
			int *empty)
{
	int i = 0;

	if (empty) {
		/* set initial value */
		*empty = -1;

		/* search the filter array */
		for (; i < IGC_MAX_NTUPLE_FILTERS; i++) {
			if (igc->ntuple_filters[i].hash_val) {
				/* compare the hase value */
				if (ntuple->hash_val ==
					igc->ntuple_filters[i].hash_val)
					/* filter be found, return index */
					return i;
			} else {
				/* get the empty entry */
				*empty = i;
				i++;
				break;
			}
		}
	}

	/* search the rest of filters */
	for (; i < IGC_MAX_NTUPLE_FILTERS; i++) {
		if (ntuple->hash_val == igc->ntuple_filters[i].hash_val)
			/* filter be found, return index */
			return i;
	}

	return -1;
}
/*
 * igc_tuple_filter_lookup - lookup n-tuple filter
 *
 * @igc, igc filter pointer
 * @ntuple, n-tuple filter pointer
 * @empty, a place to store the index of empty entry if the item not found
 *  it's not smaller than 0 if valid, otherwise -1 for no empty entry.
 *  The value of empty is uncertain if the return value of the function is
 *  not -1.
 *
 * Return value
 * >= 0, item index of the filter
 * -1, the item not been found
 */
lookup n-tuple filter
@igc, igc filter pointer
@ntuple, n-tuple filter pointer
@empty, a place to store the index of empty entry if the item not found
it's not smaller than 0 if valid, otherwise -1 for no empty entry.
The value of empty is uncertain if the return value of the function is
not -1.

Return value
>= 0, item index of the filter
-1, the item not been found
lookup n - tuple filter @igc igc filter pointer @ntuple n - tuple filter pointer @empty a place to store the index of empty entry if the item not found it ' s not smaller than 0 if valid otherwise - 1 for no empty entry . The value of empty is uncertain if the return value of the function is not - 1 . Return value > = 0 item index of the filter - 1 the item not been found
static int
igc_tuple_filter_lookup(const struct igc_adapter *igc,
			const struct igc_ntuple_filter *ntuple,
			int *empty)
{
	int i = 0;
	if (empty) {
		*empty = -1;
		for (; i < IGC_MAX_NTUPLE_FILTERS; i++) {
			if (igc->ntuple_filters[i].hash_val) {
				if (ntuple->hash_val ==
					igc->ntuple_filters[i].hash_val)
					return i;
			} else {
				*empty = i;
				i++;
				break;
			}
		}
	}
	for (; i < IGC_MAX_NTUPLE_FILTERS; i++) {
		if (ntuple->hash_val == igc->ntuple_filters[i].hash_val)
			return i;
	}
	return -1;
}
static int igc_tuple_filter_lookup ( const struct igc_adapter * igc , const struct igc_ntuple_filter * ntuple , int * empty ) { int i = 0 ; if ( empty ) { * empty = -1 ; for ( ; i < IGC_MAX_NTUPLE_FILTERS ; i ++ ) { if ( igc -> ntuple_filters [ i ] . hash_val ) { if ( ntuple -> hash_val == igc -> ntuple_filters [ i ] . hash_val ) return i ; } else { * empty = i ; i ++ ; break ; } } } for ( ; i < IGC_MAX_NTUPLE_FILTERS ; i ++ ) { if ( ntuple -> hash_val == igc -> ntuple_filters [ i ] . hash_val ) return i ; } return -1 ; }
igc_tuple_filter_lookup - lookup n-tuple filter
 @igc, igc filter pointer
 @ntuple, n-tuple filter pointer
 @empty, a place to store the index of empty entry if the item not found
  it's not smaller than 0 if valid, otherwise -1 for no empty entry.
igc_tuple_filter_lookup - lookup n - tuple filter @igc igc filter pointer @ntuple n - tuple filter pointer @empty a place to store the index of empty entry if the item not found it ' s not smaller than 0 if valid otherwise - 1 for no empty entry .
/* set initial value */ /* search the filter array */ /* compare the hase value */ /* filter be found, return index */ /* get the empty entry */ /* search the rest of filters */ /* filter be found, return index */