Skip to content

Commit

Permalink
i40e: Add macro for PF reset bit
Browse files Browse the repository at this point in the history
Introduce a macro for the bit setting the PF reset flag and
update its usages. This makes it easier to use this flag
in functions to be introduced in future without encountering
checkpatch issues related to alignment and line over 80
characters.

Signed-off-by: Amritha Nambiar <[email protected]>
Tested-by: Andrew Bowers <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
  • Loading branch information
anambiarin authored and Jeff Kirsher committed Oct 13, 2017
1 parent 4e8b86c commit ff42418
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/i40e/i40e.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ enum i40e_state_t {
__I40E_STATE_SIZE__,
};

#define I40E_PF_RESET_FLAG BIT_ULL(__I40E_PF_RESET_REQUESTED)

/* VSI state flags */
enum i40e_vsi_state_t {
__I40E_VSI_DOWN,
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/intel/i40e/i40e_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
*/
if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) {
pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
i40e_do_reset_safe(pf,
BIT_ULL(__I40E_PF_RESET_REQUESTED));
i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG);
}

vsi = i40e_vsi_setup(pf, I40E_VSI_VMDQ2, vsi_seid, 0);
Expand Down
9 changes: 4 additions & 5 deletions drivers/net/ethernet/intel/i40e/i40e_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5747,7 +5747,7 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
err_setup_tx:
i40e_vsi_free_tx_resources(vsi);
if (vsi == pf->vsi[pf->lan_vsi])
i40e_do_reset(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED), true);
i40e_do_reset(pf, I40E_PF_RESET_FLAG, true);

return err;
}
Expand Down Expand Up @@ -5875,7 +5875,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags, bool lock_acquired)
wr32(&pf->hw, I40E_GLGEN_RTRIG, val);
i40e_flush(&pf->hw);

} else if (reset_flags & BIT_ULL(__I40E_PF_RESET_REQUESTED)) {
} else if (reset_flags & I40E_PF_RESET_FLAG) {

/* Request a PF Reset
*
Expand Down Expand Up @@ -9223,7 +9223,7 @@ static int i40e_set_features(struct net_device *netdev,
need_reset = i40e_set_ntuple(pf, features);

if (need_reset)
i40e_do_reset(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED), true);
i40e_do_reset(pf, I40E_PF_RESET_FLAG, true);

return 0;
}
Expand Down Expand Up @@ -9475,8 +9475,7 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,
pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
else
pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED;
i40e_do_reset(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED),
true);
i40e_do_reset(pf, I40E_PF_RESET_FLAG, true);
break;
}
}
Expand Down
5 changes: 2 additions & 3 deletions drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,16 +1425,15 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)
if (num_vfs) {
if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) {
pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
i40e_do_reset_safe(pf,
BIT_ULL(__I40E_PF_RESET_REQUESTED));
i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG);
}
return i40e_pci_sriov_enable(pdev, num_vfs);
}

if (!pci_vfs_assigned(pf->pdev)) {
i40e_free_vfs(pf);
pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED;
i40e_do_reset_safe(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED));
i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG);
} else {
dev_warn(&pdev->dev, "Unable to free VFs because some are assigned to VMs.\n");
return -EINVAL;
Expand Down

0 comments on commit ff42418

Please sign in to comment.