DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, Jerin Jacob <jerin.jacob@caviumnetworks.com>,
	Jonas Pfefferle <jpf@zurich.ibm.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [dpdk-dev]  [PATCH] bus/pci: fix vfio device reset
Date: Sat, 28 Oct 2017 11:52:55 +0530	[thread overview]
Message-ID: <20171028062255.11910-1-jerin.jacob@caviumnetworks.com> (raw)

If the device is not capable of resetting, then Linux kernel updates
the errno as EINVAL.
http://elixir.free-electrons.com/linux/v4.9/source/drivers/vfio/pci/vfio_pci.c#L887

Honor the EINVAL errno value to avoid pci vfio setup failure.

Fixes: f25f8f367644 ("bus/pci: check VFIO reset ioctl error")

Cc: Jonas Pfefferle <jpf@zurich.ibm.com>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 drivers/bus/pci/linux/pci_vfio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 360eed380..11df64846 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -338,8 +338,11 @@ pci_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 		return -1;
 	}
 
-	/* Reset the device */
-	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET)) {
+	/*
+	 * Reset the device. If the device is not capable of resetting,
+	 * then it updates errno as EINVAL.
+	 */
+	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
 		RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n",
 				errno, strerror(errno));
 		return -1;
-- 
2.14.3

             reply	other threads:[~2017-10-28  6:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-28  6:22 Jerin Jacob [this message]
2017-10-28 10:54 ` Jonas Pfefferle1
2017-10-31 18:24   ` Thomas Monjalon

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=20171028062255.11910-1-jerin.jacob@caviumnetworks.com \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=jpf@zurich.ibm.com \
    --cc=thomas@monjalon.net \
    /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;
as well as URLs for NNTP newsgroup(s).