> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zh...@intel.com>
> Sent: 2023年6月9日 9:48
> To: Ye, MingjinX <mingjinx...@intel.com>; dev@dpdk.org
> Cc: Yang, Qiming <qiming.y...@intel.com>; Zhou, YidingX
> <yidingx.z...@intel.com>; Ye, MingjinX <mingjinx...@intel.com>;
> sta...@dpdk.org; Wu, Jingjing <jingjing...@intel.com>; Xing, Beilei
> <beilei.x...@intel.com>
> Subject: RE: [PATCH] net/iavf: fix abnormal disable HW interrupt
>
>
>
> > -----Original Message-----
> > From: Mingjin Ye <mingjinx...@intel.com>
> > Sent: Thursday, June 8, 2023 2:23 PM
> > To: dev@dpdk.org
> > Cc: Yang, Qiming <qiming.y...@intel.com>; Zhou, YidingX
> > <yidingx.z...@intel.com>; Ye, MingjinX <mingjinx...@intel.com>;
> > sta...@dpdk.org; Wu, Jingjing <jingjing...@intel.com>; Xing, Beilei
> > <beilei.x...@intel.com>
> > Subject: [PATCH] net/iavf: fix abnormal disable HW interrupt
> >
> > For command VIRTCHNL_OP_REQUEST_QUEUES, polling access to the
> admin
> > queue has the issue of access overruns after disabling interrupt. That
> > results in FW disabling HW interrupt for protection purposes.
> >
> > The updates/changes in this patch:
> > 1. Remove the polling admin queue processing and use the generic
> > interrupt processing instead.
> > 2. Release redundant queue resource before stopping processing
> > interrupt events.
> >
> > Fixes: 22b123a36d07 ("net/avf: initialize PMD")
> > Fixes: ef807926e148 ("net/iavf: support requesting additional queues
> > from
> > PF")
> > Fixes: 84108425054a ("net/iavf: support asynchronous virtual channel
> > message")
> > Cc: sta...@dpdk.org
> >
> > Signed-off-by: Mingjin Ye <mingjinx...@intel.com>
> > ---
> > drivers/net/iavf/iavf_ethdev.c | 25 +++++++++---------
> > drivers/net/iavf/iavf_vchnl.c | 48 +++++++---------------------------
> > 2 files changed, 23 insertions(+), 50 deletions(-)
> >
> > diff --git a/drivers/net/iavf/iavf_ethdev.c
> > b/drivers/net/iavf/iavf_ethdev.c index e6cf897293..ba5c88a1ec 100644
> > --- a/drivers/net/iavf/iavf_ethdev.c
> > +++ b/drivers/net/iavf/iavf_ethdev.c
> > @@ -2756,6 +2756,19 @@ iavf_dev_close(struct rte_eth_dev *dev)
> > }
> >
> > ret = iavf_dev_stop(dev);
> > +
> > + /*
> > + * Release redundant queue resource when close the dev
> > + * so that other vfs can re-use the queues.
> > + */
> > + if (vf->lv_enabled) {
> > + ret = iavf_request_queues(dev,
> > IAVF_MAX_NUM_QUEUES_DFLT);
> > + if (ret)
> > + PMD_DRV_LOG(ERR, "Reset the num of queues
> > failed");
> > +
> > + vf->max_rss_qregion = IAVF_MAX_NUM_QUEUES_DFLT;
> > + }
> > +
> > adapter->closed = true;
> >
> > /* free iAVF security device context all related resources */ @@ -
> > 2772,18 +2785,6 @@ iavf_dev_close(struct rte_eth_dev *dev)
> > if (vf->promisc_unicast_enabled || vf->promisc_multicast_enabled)
> > iavf_config_promisc(adapter, false, false);
> >
> > - /*
> > - * Release redundant queue resource when close the dev
> > - * so that other vfs can re-use the queues.
> > - */
> > - if (vf->lv_enabled) {
> > - ret = iavf_request_queues(dev,
> > IAVF_MAX_NUM_QUEUES_DFLT);
> > - if (ret)
> > - PMD_DRV_LOG(ERR, "Reset the num of queues
> > failed");
> > -
> > - vf->max_rss_qregion = IAVF_MAX_NUM_QUEUES_DFLT;
> > - }
> > -
> > iavf_shutdown_adminq(hw);
> > if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR)
> {
> > /* disable uio intr before callback unregister */ diff --git
> > a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index
> > 8cc5377bcf..579c0d0d70 100644
> > --- a/drivers/net/iavf/iavf_vchnl.c
> > +++ b/drivers/net/iavf/iavf_vchnl.c
> > @@ -323,6 +323,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
> > struct iavf_cmd_info *args,
> >
> > switch (args->ops) {
> > case VIRTCHNL_OP_RESET_VF:
> > + case VIRTCHNL_OP_REQUEST_QUEUES:
> > /*no need to wait for response */
> > _clear_cmd(vf);
> > break;
>
> Have you tested the "large VF" case ( > 16 queue) with this patch.
> I assume event VIRTCHNL_EVENT_RESET_IMPENDING need to be handled
> here then to trigger a device reset.
> But I didn't see related part in your patch.
The processing related to the "big VF" is moved before "adapter->closed = true;"
to make sure it can be handled correctly by the interrupt function.