mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-06 04:45:27 +07:00
ixgbe: return early instead of wrap block in if statement
Since we exit at the end of the block, we can save a level of indentation by performing an early return, and make the next several sections of code more legible, with fewer 80 character line breaks. Also moved allocating vfinfo at the beginning and the notification for enabling SRIOV at the end of the function when we know that it will succeed. Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
2bc0972988
commit
da614d042a
@ -74,9 +74,9 @@ static inline void ixgbe_alloc_vf_macvlans(struct ixgbe_adapter *adapter)
|
|||||||
static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
|
static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
|
||||||
{
|
{
|
||||||
struct ixgbe_hw *hw = &adapter->hw;
|
struct ixgbe_hw *hw = &adapter->hw;
|
||||||
|
int i;
|
||||||
|
|
||||||
adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED;
|
adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED;
|
||||||
e_info(probe, "SR-IOV enabled with %d VFs\n", adapter->num_vfs);
|
|
||||||
|
|
||||||
/* Enable VMDq flag so device will be set in VM mode */
|
/* Enable VMDq flag so device will be set in VM mode */
|
||||||
adapter->flags |= IXGBE_FLAG_VMDQ_ENABLED;
|
adapter->flags |= IXGBE_FLAG_VMDQ_ENABLED;
|
||||||
@ -84,20 +84,19 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
|
|||||||
adapter->ring_feature[RING_F_VMDQ].limit = 1;
|
adapter->ring_feature[RING_F_VMDQ].limit = 1;
|
||||||
adapter->ring_feature[RING_F_VMDQ].offset = adapter->num_vfs;
|
adapter->ring_feature[RING_F_VMDQ].offset = adapter->num_vfs;
|
||||||
|
|
||||||
/* Initialize default switching mode VEB */
|
|
||||||
IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
|
|
||||||
adapter->bridge_mode = BRIDGE_MODE_VEB;
|
|
||||||
|
|
||||||
ixgbe_alloc_vf_macvlans(adapter);
|
|
||||||
|
|
||||||
/* If call to enable VFs succeeded then allocate memory
|
/* If call to enable VFs succeeded then allocate memory
|
||||||
* for per VF control structures.
|
* for per VF control structures.
|
||||||
*/
|
*/
|
||||||
adapter->vfinfo =
|
adapter->vfinfo = kcalloc(adapter->num_vfs,
|
||||||
kcalloc(adapter->num_vfs,
|
|
||||||
sizeof(struct vf_data_storage), GFP_KERNEL);
|
sizeof(struct vf_data_storage), GFP_KERNEL);
|
||||||
if (adapter->vfinfo) {
|
if (!adapter->vfinfo)
|
||||||
int i;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
ixgbe_alloc_vf_macvlans(adapter);
|
||||||
|
|
||||||
|
/* Initialize default switching mode VEB */
|
||||||
|
IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
|
||||||
|
adapter->bridge_mode = BRIDGE_MODE_VEB;
|
||||||
|
|
||||||
/* limit trafffic classes based on VFs enabled */
|
/* limit trafffic classes based on VFs enabled */
|
||||||
if ((adapter->hw.mac.type == ixgbe_mac_82599EB) &&
|
if ((adapter->hw.mac.type == ixgbe_mac_82599EB) &&
|
||||||
@ -134,12 +133,10 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
|
|||||||
adapter->vfinfo[i].xcast_mode = IXGBEVF_XCAST_MODE_NONE;
|
adapter->vfinfo[i].xcast_mode = IXGBEVF_XCAST_MODE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e_info(probe, "SR-IOV enabled with %d VFs\n", adapter->num_vfs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ixgbe_get_vfs - Find and take references to all vf devices
|
* ixgbe_get_vfs - Find and take references to all vf devices
|
||||||
* @adapter: Pointer to adapter struct
|
* @adapter: Pointer to adapter struct
|
||||||
|
Loading…
Reference in New Issue
Block a user