src/dpdk/drivers/net/igc/igc_filter.c
static inline int
igc_ethertype_filter_lookup(const struct igc_adapter *igc,
			uint16_t ethertype, int *empty)
{
	int i = 0;

	if (empty) {
		/* set to invalid valid */
		*empty = -1;

		/* search the filters array */
		for (; i < IGC_MAX_ETQF_FILTERS; i++) {
			if (igc->ethertype_filters[i].ether_type == ethertype)
				return i;
			if (igc->ethertype_filters[i].ether_type == 0) {
				/* get empty entry */
				*empty = i;
				i++;
				break;
			}
		}
	}

	/* search the rest of filters */
	for (; i < IGC_MAX_ETQF_FILTERS; i++) {
		if (igc->ethertype_filters[i].ether_type == ethertype)
			return i;	/* filter be found, return index */
	}

	return -1;
}
/*
 * igc_ethertype_filter_lookup - lookup ether-type filter
 *
 * @igc, IGC filter pointer
 * @ethertype, ethernet type
 * @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.
 *  empty parameter is only valid if the return value of the function is -1
 *
 * Return value
 * >= 0, item index of the ether-type filter
 * -1, the item not been found
 */
lookup ether-type filter
@igc, IGC filter pointer
@ethertype, ethernet type
@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.
empty parameter is only valid if the return value of the function is -1

Return value
>= 0, item index of the ether-type filter
-1, the item not been found
lookup ether - type filter @igc IGC filter pointer @ethertype ethernet type @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 . empty parameter is only valid if the return value of the function is - 1 Return value > = 0 item index of the ether - type filter - 1 the item not been found
static inline int
igc_ethertype_filter_lookup(const struct igc_adapter *igc,
			uint16_t ethertype, int *empty)
{
	int i = 0;
	if (empty) {
		*empty = -1;
		for (; i < IGC_MAX_ETQF_FILTERS; i++) {
			if (igc->ethertype_filters[i].ether_type == ethertype)
				return i;
			if (igc->ethertype_filters[i].ether_type == 0) {
				*empty = i;
				i++;
				break;
			}
		}
	}
	for (; i < IGC_MAX_ETQF_FILTERS; i++) {
		if (igc->ethertype_filters[i].ether_type == ethertype)
			return i;	
	}
	return -1;
}
static inline int igc_ethertype_filter_lookup ( const struct igc_adapter * igc , uint16_t ethertype , int * empty ) { int i = 0 ; if ( empty ) { * empty = -1 ; for ( ; i < IGC_MAX_ETQF_FILTERS ; i ++ ) { if ( igc -> ethertype_filters [ i ] . ether_type == ethertype ) return i ; if ( igc -> ethertype_filters [ i ] . ether_type == 0 ) { * empty = i ; i ++ ; break ; } } } for ( ; i < IGC_MAX_ETQF_FILTERS ; i ++ ) { if ( igc -> ethertype_filters [ i ] . ether_type == ethertype ) return i ; } return -1 ; }
igc_ethertype_filter_lookup - lookup ether-type filter
 @igc, IGC filter pointer
 @ethertype, ethernet type
 @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_ethertype_filter_lookup - lookup ether - type filter @igc IGC filter pointer @ethertype ethernet type @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 to invalid valid */ /* search the filters array */ /* get empty entry */ /* search the rest of filters */ /* filter be found, return index */