Commit 63d9379a authored by Alexander Duyck's avatar Alexander Duyck Committed by Jeff Kirsher

ixgbe: Reduce VT code indent in set_vfta by introducing jump label

In order to clear the way for upcoming work I thought it best to drop the
level of indent in the ixgbe_set_vfta_generic function.  Most of the code
is held in the virtualization specific section.  So the easiest approach is
to just add a jump label and jump past the bulk of the code if it is not
enabled.
Signed-off-by: default avatarAlexander Duyck <aduyck@mirantis.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent c18fbd5f
...@@ -3051,8 +3051,8 @@ s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind, ...@@ -3051,8 +3051,8 @@ s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
bool vlan_on) bool vlan_on)
{ {
u32 regidx, vfta_delta, vfta; u32 regidx, vfta_delta, vfta;
s32 vlvf_index;
u32 bits; u32 bits;
u32 vt;
if (vlan > 4095) if (vlan > 4095)
return IXGBE_ERR_PARAM; return IXGBE_ERR_PARAM;
...@@ -3088,83 +3088,81 @@ s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind, ...@@ -3088,83 +3088,81 @@ s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
* Or !vlan_on * Or !vlan_on
* clear the pool bit and possibly the vind * clear the pool bit and possibly the vind
*/ */
vt = IXGBE_READ_REG(hw, IXGBE_VT_CTL); if (!(IXGBE_READ_REG(hw, IXGBE_VT_CTL) & IXGBE_VT_CTL_VT_ENABLE))
if (vt & IXGBE_VT_CTL_VT_ENABLE) { goto vfta_update;
s32 vlvf_index;
vlvf_index = ixgbe_find_vlvf_slot(hw, vlan);
vlvf_index = ixgbe_find_vlvf_slot(hw, vlan); if (vlvf_index < 0)
if (vlvf_index < 0) return vlvf_index;
return vlvf_index;
if (vlan_on) {
if (vlan_on) { /* set the pool bit */
/* set the pool bit */ if (vind < 32) {
if (vind < 32) { bits = IXGBE_READ_REG(hw,
bits = IXGBE_READ_REG(hw, IXGBE_VLVFB(vlvf_index*2));
IXGBE_VLVFB(vlvf_index*2)); bits |= (1 << vind);
bits |= (1 << vind); IXGBE_WRITE_REG(hw,
IXGBE_WRITE_REG(hw, IXGBE_VLVFB(vlvf_index*2),
IXGBE_VLVFB(vlvf_index*2), bits);
bits);
} else {
bits = IXGBE_READ_REG(hw,
IXGBE_VLVFB((vlvf_index*2)+1));
bits |= (1 << (vind-32));
IXGBE_WRITE_REG(hw,
IXGBE_VLVFB((vlvf_index*2)+1),
bits);
}
} else { } else {
/* clear the pool bit */ bits = IXGBE_READ_REG(hw,
if (vind < 32) { IXGBE_VLVFB((vlvf_index*2)+1));
bits = IXGBE_READ_REG(hw, bits |= (1 << (vind-32));
IXGBE_VLVFB(vlvf_index*2)); IXGBE_WRITE_REG(hw,
bits &= ~(1 << vind); IXGBE_VLVFB((vlvf_index*2)+1),
IXGBE_WRITE_REG(hw, bits);
IXGBE_VLVFB(vlvf_index*2),
bits);
bits |= IXGBE_READ_REG(hw,
IXGBE_VLVFB((vlvf_index*2)+1));
} else {
bits = IXGBE_READ_REG(hw,
IXGBE_VLVFB((vlvf_index*2)+1));
bits &= ~(1 << (vind-32));
IXGBE_WRITE_REG(hw,
IXGBE_VLVFB((vlvf_index*2)+1),
bits);
bits |= IXGBE_READ_REG(hw,
IXGBE_VLVFB(vlvf_index*2));
}
} }
} else {
/* /* clear the pool bit */
* If there are still bits set in the VLVFB registers if (vind < 32) {
* for the VLAN ID indicated we need to see if the bits = IXGBE_READ_REG(hw,
* caller is requesting that we clear the VFTA entry bit. IXGBE_VLVFB(vlvf_index*2));
* If the caller has requested that we clear the VFTA bits &= ~(1 << vind);
* entry bit but there are still pools/VFs using this VLAN IXGBE_WRITE_REG(hw,
* ID entry then ignore the request. We're not worried IXGBE_VLVFB(vlvf_index*2),
* about the case where we're turning the VFTA VLAN ID bits);
* entry bit on, only when requested to turn it off as bits |= IXGBE_READ_REG(hw,
* there may be multiple pools and/or VFs using the IXGBE_VLVFB((vlvf_index*2)+1));
* VLAN ID entry. In that case we cannot clear the
* VFTA bit until all pools/VFs using that VLAN ID have also
* been cleared. This will be indicated by "bits" being
* zero.
*/
if (bits) {
IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index),
(IXGBE_VLVF_VIEN | vlan));
/* if someone wants to clear the vfta entry but
* some pools/VFs are still using it. Ignore it.
*/
if (!vlan_on)
vfta_delta = 0;
} else { } else {
IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), 0); bits = IXGBE_READ_REG(hw,
IXGBE_VLVFB((vlvf_index*2)+1));
bits &= ~(1 << (vind-32));
IXGBE_WRITE_REG(hw,
IXGBE_VLVFB((vlvf_index*2)+1),
bits);
bits |= IXGBE_READ_REG(hw,
IXGBE_VLVFB(vlvf_index*2));
} }
} }
/* If there are still bits set in the VLVFB registers
* for the VLAN ID indicated we need to see if the
* caller is requesting that we clear the VFTA entry bit.
* If the caller has requested that we clear the VFTA
* entry bit but there are still pools/VFs using this VLAN
* ID entry then ignore the request. We're not worried
* about the case where we're turning the VFTA VLAN ID
* entry bit on, only when requested to turn it off as
* there may be multiple pools and/or VFs using the
* VLAN ID entry. In that case we cannot clear the
* VFTA bit until all pools/VFs using that VLAN ID have also
* been cleared. This will be indicated by "bits" being
* zero.
*/
if (bits) {
IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index),
(IXGBE_VLVF_VIEN | vlan));
/* if someone wants to clear the vfta entry but
* some pools/VFs are still using it. Ignore it.
*/
if (!vlan_on)
vfta_delta = 0;
} else {
IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), 0);
}
vfta_update:
if (vfta_delta) if (vfta_delta)
IXGBE_WRITE_REG(hw, IXGBE_VFTA(regidx), vfta); IXGBE_WRITE_REG(hw, IXGBE_VFTA(regidx), vfta);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment