From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Mateusz Palczewski <mateusz.palczewski@intel.com>,
<intel-wired-lan@lists.osuosl.org>
Cc: Norbert Zulinski <norbertx.zulinski@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH net v1] ice: Fix spurious interrupt during removal of trusted VF
Date: Fri, 7 Oct 2022 10:29:02 -0700 [thread overview]
Message-ID: <d5bebdad-64e2-fbd9-5298-790e4b0e9667@intel.com> (raw)
In-Reply-To: <20221007080722.99641-1-mateusz.palczewski@intel.com>
On 10/7/2022 1:07 AM, Mateusz Palczewski wrote:
> From: Norbert Zulinski <norbertx.zulinski@intel.com>
>
> Previously, during removal of trusted VF when VF is down there was
> number of spurious interrupt equal to number of queues on VF.
>
> Add check if VF already has inactive queues. If VF is disabled and
> has inactive rx queues then do not disable rx queues.
> Add check in ice_vsi_stop_tx_ring if it's VF's vsi and if VF is
> disabled.
>
> Fixes: efe41860008e ("ice: Fix memory corruption in VF driver")
> Signed-off-by: Norbert Zulinski <norbertx.zulinski@intel.com>
> Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
> ---
> drivers/net/ethernet/intel/ice/ice_base.c | 2 +-
> drivers/net/ethernet/intel/ice/ice_lib.c | 25 +++++++++++++++++++++
> drivers/net/ethernet/intel/ice/ice_lib.h | 1 +
> drivers/net/ethernet/intel/ice/ice_vf_lib.c | 5 ++++-
> 4 files changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
> index 1e3243808178..9ee022bb8ec2 100644
> --- a/drivers/net/ethernet/intel/ice/ice_base.c
> +++ b/drivers/net/ethernet/intel/ice/ice_base.c
> @@ -959,7 +959,7 @@ ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
> * associated to the queue to schedule NAPI handler
> */
> q_vector = ring->q_vector;
> - if (q_vector)
> + if (q_vector && !(vsi->vf && ice_is_vf_disabled(vsi->vf)))
> ice_trigger_sw_intr(hw, q_vector);
>
> status = ice_dis_vsi_txq(vsi->port_info, txq_meta->vsi_idx,
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> index 58d483e2f539..156a684831b4 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> @@ -2222,6 +2222,31 @@ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi)
> return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings, vsi->num_xdp_txq);
> }
>
> +/**
> + * ice_vsi_is_rx_queue_active
> + * @vsi: the VSI being configured
> + *
> + * Return true if at least one queue is active.
> + */
> +bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi)
> +{
> + struct ice_pf *pf = vsi->back;
> + struct ice_hw *hw = &pf->hw;
> + int i = 0;
This doesn't need to be initialized.
> +
> + for (i = 0; i < vsi->num_rxq; i++) {
ice_for_each_rxq can be used here
> + int pf_q;
> + u32 rx_reg;
RCT on these please.
> +
> + pf_q = vsi->rxq_map[i];
> + rx_reg = rd32(hw, QRX_CTRL(pf_q));
> + if (rx_reg & QRX_CTRL_QENA_STAT_M)
> + return true;
> + }
> +
> + return false;
> +}
> +
> /**
> * ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not
> * @vsi: VSI to check whether or not VLAN pruning is enabled.
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h
> index 8712b1d2ceec..441fb132f194 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.h
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.h
> @@ -127,4 +127,5 @@ u16 ice_vsi_num_non_zero_vlans(struct ice_vsi *vsi);
> bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f);
> void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f);
> void ice_init_feature_support(struct ice_pf *pf);
> +bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi);
> #endif /* !_ICE_LIB_H_ */
> diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
> index 0abeed092de1..1c51778db951 100644
> --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
> @@ -576,7 +576,10 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)
> return -EINVAL;
> }
> ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id);
> - ice_vsi_stop_all_rx_rings(vsi);
> +
> + if (ice_vsi_is_rx_queue_active(vsi))
> + ice_vsi_stop_all_rx_rings(vsi);
> +
> dev_dbg(dev, "VF is already disabled, there is no need for resetting it, telling VM, all is fine %d\n",
> vf->vf_id);
> return 0;
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
prev parent reply other threads:[~2022-10-07 17:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 8:07 [Intel-wired-lan] [PATCH net v1] ice: Fix spurious interrupt during removal of trusted VF Mateusz Palczewski
2022-10-07 17:29 ` Tony Nguyen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5bebdad-64e2-fbd9-5298-790e4b0e9667@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=mateusz.palczewski@intel.com \
--cc=norbertx.zulinski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox