[dpdk-dev] [PATCH v4 2/3] net/iavf: enable PCI bus master after reset

Wang, Haiyue haiyue.wang at intel.com
Tue May 4 17:07:21 CEST 2021


> -----Original Message-----
> From: David Marchand <david.marchand at redhat.com>
> Sent: Tuesday, May 4, 2021 19:32
> To: Wang, Haiyue <haiyue.wang at intel.com>
> Cc: dev <dev at dpdk.org>; Zhang, Qi Z <qi.z.zhang at intel.com>; Wang, Liang-min <liang-min.wang at intel.com>;
> Wu, Jingjing <jingjing.wu at intel.com>; Xing, Beilei <beilei.xing at intel.com>
> Subject: Re: [PATCH v4 2/3] net/iavf: enable PCI bus master after reset
> 
> On Tue, Apr 27, 2021 at 4:05 PM Haiyue Wang <haiyue.wang at intel.com> wrote:
> >
> > The VF reset can be triggerred by the PF reset event, in this case, the
> > PCI bus master will be cleared, then the VF is not allowed to issue any
> > Memory or I/O Requests.
> >
> > So after the reset event is detected, always enable the PCI bus master.
> >
> > Signed-off-by: Haiyue Wang <haiyue.wang at intel.com>
> > ---
> >  drivers/net/iavf/iavf_ethdev.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> > index d523a0618..9a0a20a29 100644
> > --- a/drivers/net/iavf/iavf_ethdev.c
> > +++ b/drivers/net/iavf/iavf_ethdev.c
> > @@ -2255,6 +2255,9 @@ iavf_dev_close(struct rte_eth_dev *dev)
> >         rte_free(vf->aq_resp);
> >         vf->aq_resp = NULL;
> >
> > +       if (vf->vf_reset)
> > +               rte_pci_set_bus_master(pci_dev, true);
> > +
> >         vf->vf_reset = false;
> 
> Not checking for the return code can leave the device in an invalid state.
> Then after this, calling the init code will fail.
> 
> I'd rather move rte_pci_set_bus_master() (it is a noop if bus master
> is already enabled) in the init path and check for the return code

Currently, just called when vf_reset happened. And I noticed that the kernel
doesn't handle pci_read/write_config_word return code in most cases. I'm wondering
if the PCI ops really failed, the system can return back ?

> there?
> WDYT?
> 
> 
> --
> David Marchand



More information about the dev mailing list