On Tue, Apr 27, 2021 at 4:05 PM Haiyue Wang <haiyue.w...@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.w...@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
there?
WDYT?


-- 
David Marchand

Reply via email to