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>
This commit is contained in:
parent
bf93bf791c
commit
5a57ee83d9
|
@ -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)
|
int ice_check_vf_ready_for_cfg(struct ice_vf *vf)
|
||||||
{
|
{
|
||||||
struct ice_pf *pf;
|
|
||||||
|
|
||||||
ice_wait_on_vf_reset(vf);
|
ice_wait_on_vf_reset(vf);
|
||||||
|
|
||||||
if (ice_is_vf_disabled(vf))
|
if (ice_is_vf_disabled(vf))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pf = vf->pf;
|
if (ice_check_vf_init(vf))
|
||||||
if (ice_check_vf_init(pf, vf))
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
return 0;
|
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
|
* 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
|
* @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)) {
|
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",
|
dev_err(ice_pf_to_dev(pf), "VF ID: %u in reset. Try again.\n",
|
||||||
vf->vf_id);
|
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)
|
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;
|
return false;
|
||||||
|
|
||||||
if (ice_vf_has_no_qs_ena(vf))
|
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)
|
else if (vf->link_forced)
|
||||||
return vf->link_up;
|
return vf->link_up;
|
||||||
else
|
else
|
||||||
return pf->hw.port_info->phy.link_info.link_info &
|
return pi->phy.link_info.link_info &
|
||||||
ICE_AQ_LINK_UP;
|
ICE_AQ_LINK_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ice_dis_vf_qs(struct ice_vf *vf);
|
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);
|
struct ice_port_info *ice_vf_get_port_info(struct ice_vf *vf);
|
||||||
int ice_vsi_apply_spoofchk(struct ice_vsi *vsi, bool enable);
|
int ice_vsi_apply_spoofchk(struct ice_vsi *vsi, bool enable);
|
||||||
bool ice_is_vf_trusted(struct ice_vf *vf);
|
bool ice_is_vf_trusted(struct ice_vf *vf);
|
||||||
|
|
|
@ -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;
|
enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;
|
||||||
struct virtchnl_vf_resource *vfres = NULL;
|
struct virtchnl_vf_resource *vfres = NULL;
|
||||||
struct ice_pf *pf = vf->pf;
|
struct ice_hw *hw = &vf->pf->hw;
|
||||||
struct ice_vsi *vsi;
|
struct ice_vsi *vsi;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (ice_check_vf_init(pf, vf)) {
|
if (ice_check_vf_init(vf)) {
|
||||||
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
|
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
|
||||||
goto err;
|
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
|
* inner/single VLAN respectively and don't allow VF to
|
||||||
* negotiate VIRTCHNL_VF_OFFLOAD in any other cases
|
* 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;
|
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)) {
|
!ice_vf_is_port_vlan_ena(vf)) {
|
||||||
vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_VLAN;
|
vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_VLAN;
|
||||||
/* configure backward compatible support for VFs that
|
/* 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
|
* configured in SVM, and no port VLAN is configured
|
||||||
*/
|
*/
|
||||||
ice_vf_vsi_cfg_svm_legacy_vlan_mode(vsi);
|
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
|
/* configure software offloaded VLAN support when DVM
|
||||||
* is enabled, but no port VLAN is enabled
|
* 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;
|
vfres->num_vsis = 1;
|
||||||
/* Tx and Rx queue are equal for VF */
|
/* Tx and Rx queue are equal for VF */
|
||||||
vfres->num_queue_pairs = vsi->num_txq;
|
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_key_size = ICE_VSIQF_HKEY_ARRAY_SIZE;
|
||||||
vfres->rss_lut_size = ICE_VSIQF_HLUT_ARRAY_SIZE;
|
vfres->rss_lut_size = ICE_VSIQF_HLUT_ARRAY_SIZE;
|
||||||
vfres->max_mtu = ice_vc_get_max_frame_size(vf);
|
vfres->max_mtu = ice_vc_get_max_frame_size(vf);
|
||||||
|
|
Loading…
Reference in New Issue