summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/ice/ice_vf_lib.c
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2022-02-22 16:27:12 -0800
committerTony Nguyen <anthony.l.nguyen@intel.com>2022-03-15 13:23:14 -0700
commit5a57ee83d9612342552f63b7a7f4f4bd2e885832 (patch)
tree817851afc5b9f8403d0e22f2e31008b23ceeceb7 /drivers/net/ethernet/intel/ice/ice_vf_lib.c
parentbf93bf791cec8aee0c3b9811097813726c1c01be (diff)
ice: remove PF pointer from ice_check_vf_init
The ice_check_vf_init function takes both a PF and a VF pointer. Every caller looks up the PF pointer from the VF structure. Some callers only use of the PF pointer is call this function. Move the lookup inside ice_check_vf_init and drop the unnecessary argument. Cleanup the callers to drop the now unnecessary local variables. In particular, replace the local PF pointer with a HW structure pointer in ice_vc_get_vf_res_msg which simplifies a few accesses to the HW structure in that function. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_vf_lib.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_vf_lib.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
index c584f5123ba7..6578059d9479 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
@@ -174,15 +174,12 @@ static void ice_wait_on_vf_reset(struct ice_vf *vf)
*/
int ice_check_vf_ready_for_cfg(struct ice_vf *vf)
{
- struct ice_pf *pf;
-
ice_wait_on_vf_reset(vf);
if (ice_is_vf_disabled(vf))
return -EINVAL;
- pf = vf->pf;
- if (ice_check_vf_init(pf, vf))
+ if (ice_check_vf_init(vf))
return -EBUSY;
return 0;
@@ -620,11 +617,12 @@ void ice_dis_vf_qs(struct ice_vf *vf)
/**
* ice_check_vf_init - helper to check if VF init complete
- * @pf: pointer to the PF structure
* @vf: the pointer to the VF to check
*/
-int ice_check_vf_init(struct ice_pf *pf, struct ice_vf *vf)
+int ice_check_vf_init(struct ice_vf *vf)
{
+ struct ice_pf *pf = vf->pf;
+
if (!test_bit(ICE_VF_STATE_INIT, vf->vf_states)) {
dev_err(ice_pf_to_dev(pf), "VF ID: %u in reset. Try again.\n",
vf->vf_id);
@@ -752,9 +750,9 @@ bool ice_vf_has_no_qs_ena(struct ice_vf *vf)
*/
bool ice_is_vf_link_up(struct ice_vf *vf)
{
- struct ice_pf *pf = vf->pf;
+ struct ice_port_info *pi = ice_vf_get_port_info(vf);
- if (ice_check_vf_init(pf, vf))
+ if (ice_check_vf_init(vf))
return false;
if (ice_vf_has_no_qs_ena(vf))
@@ -762,7 +760,7 @@ bool ice_is_vf_link_up(struct ice_vf *vf)
else if (vf->link_forced)
return vf->link_up;
else
- return pf->hw.port_info->phy.link_info.link_info &
+ return pi->phy.link_info.link_info &
ICE_AQ_LINK_UP;
}