src/dpdk/drivers/net/txgbe/base/txgbe_hw.c
s32 txgbe_find_vlvf_slot(struct txgbe_hw *hw, u32 vlan, bool vlvf_bypass)
{
	s32 regindex, first_empty_slot;
	u32 bits;

	/* short cut the special case */
	if (vlan == 0)
		return 0;

	/* if vlvf_bypass is set we don't want to use an empty slot, we
	 * will simply bypass the VLVF if there are no entries present in the
	 * VLVF that contain our VLAN
	 */
	first_empty_slot = vlvf_bypass ? TXGBE_ERR_NO_SPACE : 0;

	/* add VLAN enable bit for comparison */
	vlan |= TXGBE_PSRVLAN_EA;

	/* Search for the vlan id in the VLVF entries. Save off the first empty
	 * slot found along the way.
	 *
	 * pre-decrement loop covering (TXGBE_NUM_POOL - 1) .. 1
	 */
	for (regindex = TXGBE_NUM_POOL; --regindex;) {
		wr32(hw, TXGBE_PSRVLANIDX, regindex);
		bits = rd32(hw, TXGBE_PSRVLAN);
		if (bits == vlan)
			return regindex;
		if (!first_empty_slot && !bits)
			first_empty_slot = regindex;
	}

	/* If we are here then we didn't find the VLAN.  Return first empty
	 * slot we found during our search, else error.
	 */
	if (!first_empty_slot)
		DEBUGOUT("No space in VLVF.\n");

	return first_empty_slot ? first_empty_slot : TXGBE_ERR_NO_SPACE;
}
/**
 *  txgbe_find_vlvf_slot - find the vlanid or the first empty slot
 *  @hw: pointer to hardware structure
 *  @vlan: VLAN id to write to VLAN filter
 *  @vlvf_bypass: true to find vlanid only, false returns first empty slot if
 *		  vlanid not found
 *
 *
 *  return the VLVF index where this VLAN id should be placed
 *
 **/
find the vlanid or the first empty slot
@hw: pointer to hardware structure
@vlan: VLAN id to write to VLAN filter
@vlvf_bypass: true to find vlanid only, false returns first empty slot if
vlanid not found

return the VLVF index where this VLAN id should be placed
find the vlanid or the first empty slot @hw : pointer to hardware structure @vlan : VLAN id to write to VLAN filter @vlvf_bypass : true to find vlanid only false returns first empty slot if vlanid not found return the VLVF index where this VLAN id should be placed
s32 txgbe_find_vlvf_slot(struct txgbe_hw *hw, u32 vlan, bool vlvf_bypass)
{
	s32 regindex, first_empty_slot;
	u32 bits;
	if (vlan == 0)
		return 0;
	first_empty_slot = vlvf_bypass ? TXGBE_ERR_NO_SPACE : 0;
	vlan |= TXGBE_PSRVLAN_EA;
	for (regindex = TXGBE_NUM_POOL; --regindex;) {
		wr32(hw, TXGBE_PSRVLANIDX, regindex);
		bits = rd32(hw, TXGBE_PSRVLAN);
		if (bits == vlan)
			return regindex;
		if (!first_empty_slot && !bits)
			first_empty_slot = regindex;
	}
	if (!first_empty_slot)
		DEBUGOUT("No space in VLVF.\n");
	return first_empty_slot ? first_empty_slot : TXGBE_ERR_NO_SPACE;
}
s32 txgbe_find_vlvf_slot ( struct txgbe_hw * hw , u32 vlan , bool vlvf_bypass ) { s32 regindex , first_empty_slot ; u32 bits ; if ( vlan == 0 ) return 0 ; first_empty_slot = vlvf_bypass ? TXGBE_ERR_NO_SPACE : 0 ; vlan |= TXGBE_PSRVLAN_EA ; for ( regindex = TXGBE_NUM_POOL ; -- regindex ; ) { wr32 ( hw , TXGBE_PSRVLANIDX , regindex ) ; bits = rd32 ( hw , TXGBE_PSRVLAN ) ; if ( bits == vlan ) return regindex ; if ( ! first_empty_slot && ! bits ) first_empty_slot = regindex ; } if ( ! first_empty_slot ) DEBUGOUT ( " \n " ) ; return first_empty_slot ? first_empty_slot : TXGBE_ERR_NO_SPACE ; }
txgbe_find_vlvf_slot - find the vlanid or the first empty slot
  @hw: pointer to hardware structure
  @vlan: VLAN id to write to VLAN filter
  @vlvf_bypass: true to find vlanid only, false returns first empty slot if
                vlanid not found
txgbe_find_vlvf_slot - find the vlanid or the first empty slot @hw : pointer to hardware structure @vlan : VLAN id to write to VLAN filter @vlvf_bypass : true to find vlanid only false returns first empty slot if vlanid not found
/* short cut the special case */ /* if vlvf_bypass is set we don't want to use an empty slot, we
	 * will simply bypass the VLVF if there are no entries present in the
	 * VLVF that contain our VLAN
	 */ /* add VLAN enable bit for comparison */ /* Search for the vlan id in the VLVF entries. Save off the first empty
	 * slot found along the way.
	 *
	 * pre-decrement loop covering (TXGBE_NUM_POOL - 1) .. 1
	 */ /* If we are here then we didn't find the VLAN.  Return first empty
	 * slot we found during our search, else error.
	 */