From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF859A0562; Tue, 4 May 2021 13:32:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92B404014D; Tue, 4 May 2021 13:32:25 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id D7E9B40141 for ; Tue, 4 May 2021 13:32:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620127943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tsqPwBEdmzozF+yiu5CWoHKflqKfJjpe0OzVALP0JH4=; b=AGV0LIqKt7jnezsVeJrlyhfksxUbBURLhojyYvj5qUpk0eyam33bS2GLov0tJfBD0bnkzi gtAuTIAyDfCrsLEmRb7JHdrEWbeH22n8NvPbnMAPdTyMf5eFABYmkS1NIpbNPZl4nTcrs5 PMdjSQgrxzDDFaJhu57e9GvfWDStx/Q= Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-kJw3iI9ZPWeNdbm3_SgmyA-1; Tue, 04 May 2021 07:32:19 -0400 X-MC-Unique: kJw3iI9ZPWeNdbm3_SgmyA-1 Received: by mail-vs1-f72.google.com with SMTP id q16-20020a67d7900000b0290228198e77b6so1098696vsj.23 for ; Tue, 04 May 2021 04:32:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tsqPwBEdmzozF+yiu5CWoHKflqKfJjpe0OzVALP0JH4=; b=ma8VqQry6rgh71S9Woqu/dO9UUgQ+9eqsLD4UjGB6gP0RvjLLcbV2O5T7fZD6E1VZB sUDhnD+Ct7VPXfe5AQXBJOOUgDr4cVLnFwr40DZLw6M9aHxzxnSUi1eN7GLDQsitdO8r raj7umbhpEekf1Laj6Od12+4EIkj8J7A66/hT76qD37S8lrgDnQOz9JAk9UY19Dng2Q3 03k99cxIzwUOo+cSuurDU2HsR7iD3q2AsZHOOeOHo1heZ9u1LdikuYGtkZZyFDBoaCqN uEnNqjrTYZrht+ipTQoAZrHRT7LW/HmG/HGxXUSuAUqg8wmt91kIQe1SyhtCP1e8NAbp CFHw== X-Gm-Message-State: AOAM532w4X+DMCeekVY7iqUSXX/1E2vJe8cKtFMKjvc0mPNpoz/DGYu7 VIzJrtO82mspzBtZYqrrpLeYm++SrATVonYUEvTeALvuqgg+/aU1tfZI71Kza7LCJ5sScb/0EhV 3l786KvC3PPjKQ0cOZuI= X-Received: by 2002:a67:6b41:: with SMTP id g62mr1397244vsc.5.1620127939043; Tue, 04 May 2021 04:32:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuljewjZoHHwEKJ8aNyP1NL2aKOLmM0+TMv6TA12HX3M3elX9J1MF4v4SXRkYgbGdM2xO84GQUi55w3RakkRk= X-Received: by 2002:a67:6b41:: with SMTP id g62mr1397225vsc.5.1620127938843; Tue, 04 May 2021 04:32:18 -0700 (PDT) MIME-Version: 1.0 References: <20210421050243.130585-1-haiyue.wang@intel.com> <20210427133912.261993-1-haiyue.wang@intel.com> <20210427133912.261993-3-haiyue.wang@intel.com> In-Reply-To: <20210427133912.261993-3-haiyue.wang@intel.com> From: David Marchand Date: Tue, 4 May 2021 13:32:07 +0200 Message-ID: To: Haiyue Wang Cc: dev , Qi Zhang , "Wang, Liang-min" , Jingjing Wu , Beilei Xing Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v4 2/3] net/iavf: enable PCI bus master after reset X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Apr 27, 2021 at 4:05 PM Haiyue Wang 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 > --- > 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