]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ice: remove PF pointer from ice_check_vf_init
authorJacob Keller <jacob.e.keller@intel.com>
Wed, 23 Feb 2022 00:27:12 +0000 (16:27 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 15 Mar 2022 20:23:14 +0000 (13:23 -0700)
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>
drivers/net/ethernet/intel/ice/ice_vf_lib.c
drivers/net/ethernet/intel/ice/ice_vf_lib_private.h
drivers/net/ethernet/intel/ice/ice_virtchnl.c

index c584f5123ba72bb0bebd03515bb9eb4ce938f693..6578059d947947feef667e9d4d4133343c74764e 100644 (file)
@@ -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;
 }
 
index e9374693496ed1574d336c465383afbad6e50c92..15887e772c76e8f610555c6edf6413e5c270eaf2 100644 (file)
@@ -24,7 +24,7 @@
 #endif
 
 void ice_dis_vf_qs(struct ice_vf *vf);
-int ice_check_vf_init(struct ice_pf *pf, struct ice_vf *vf);
+int ice_check_vf_init(struct ice_vf *vf);
 struct ice_port_info *ice_vf_get_port_info(struct ice_vf *vf);
 int ice_vsi_apply_spoofchk(struct ice_vsi *vsi, bool enable);
 bool ice_is_vf_trusted(struct ice_vf *vf);
index d820ec6226408f262d30ffb87857e1f1288f8c61..3f1a63815bac97601cb8d47bf81da546b0946def 100644 (file)
@@ -370,12 +370,12 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)
 {
        enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;
        struct virtchnl_vf_resource *vfres = NULL;
-       struct ice_pf *pf = vf->pf;
+       struct ice_hw *hw = &vf->pf->hw;
        struct ice_vsi *vsi;
        int len = 0;
        int ret;
 
-       if (ice_check_vf_init(pf, vf)) {
+       if (ice_check_vf_init(vf)) {
                v_ret = VIRTCHNL_STATUS_ERR_PARAM;
                goto err;
        }
@@ -412,9 +412,9 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)
                 * inner/single VLAN respectively and don't allow VF to
                 * negotiate VIRTCHNL_VF_OFFLOAD in any other cases
                 */
-               if (ice_is_dvm_ena(&pf->hw) && ice_vf_is_port_vlan_ena(vf)) {
+               if (ice_is_dvm_ena(hw) && ice_vf_is_port_vlan_ena(vf)) {
                        vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_VLAN;
-               } else if (!ice_is_dvm_ena(&pf->hw) &&
+               } else if (!ice_is_dvm_ena(hw) &&
                           !ice_vf_is_port_vlan_ena(vf)) {
                        vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_VLAN;
                        /* configure backward compatible support for VFs that
@@ -422,7 +422,7 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)
                         * configured in SVM, and no port VLAN is configured
                         */
                        ice_vf_vsi_cfg_svm_legacy_vlan_mode(vsi);
-               } else if (ice_is_dvm_ena(&pf->hw)) {
+               } else if (ice_is_dvm_ena(hw)) {
                        /* configure software offloaded VLAN support when DVM
                         * is enabled, but no port VLAN is enabled
                         */
@@ -472,7 +472,7 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)
        vfres->num_vsis = 1;
        /* Tx and Rx queue are equal for VF */
        vfres->num_queue_pairs = vsi->num_txq;
-       vfres->max_vectors = pf->vfs.num_msix_per;
+       vfres->max_vectors = vf->pf->vfs.num_msix_per;
        vfres->rss_key_size = ICE_VSIQF_HKEY_ARRAY_SIZE;
        vfres->rss_lut_size = ICE_VSIQF_HLUT_ARRAY_SIZE;
        vfres->max_mtu = ice_vc_get_max_frame_size(vf);