DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Zhou, Danny" <danny.zhou@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 2/2 dpdk] uio: fix pci generic driver breakage
Date: Wed, 15 Apr 2015 09:38:21 -0700	[thread overview]
Message-ID: <20150415093821.41be184c@urahara> (raw)
In-Reply-To: <20150415093420.6fc93b76@urahara>

The integration of using uio_pci_generic broke use of UIO
by igb_uio and other drivers. Go back to using uio IRQ control
through interrupt fd.

This patch assumes that if uio_pci_generic is being used
that the kernel has been fixed to support this
by integrating patch to support IRQ control.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -363,48 +363,28 @@ vfio_disable_msix(struct rte_intr_handle
 static int
 uio_intr_disable(struct rte_intr_handle *intr_handle)
 {
-	unsigned char command_high;
+	const int value = 0;
 
-	/* use UIO config file descriptor for uio_pci_generic */
-	if (pread(intr_handle->uio_cfg_fd, &command_high, 1, 5) != 1) {
+	if (write(intr_handle->fd, &value, sizeof(value)) < 0){
 		RTE_LOG(ERR, EAL,
-			"Error reading interrupts status for fd %d\n",
-			intr_handle->uio_cfg_fd);
+			"Error disabling interrupts for fd %d (%s)\n",
+			intr_handle->fd, strerror(errno));
 		return -1;
 	}
-	/* disable interrupts */
-	command_high |= 0x4;
-	if (pwrite(intr_handle->uio_cfg_fd, &command_high, 1, 5) != 1) {
-		RTE_LOG(ERR, EAL,
-			"Error disabling interrupts for fd %d\n",
-			intr_handle->uio_cfg_fd);
-		return -1;
-	}
-
 	return 0;
 }
 
 static int
 uio_intr_enable(struct rte_intr_handle *intr_handle)
 {
-	unsigned char command_high;
+	const int value = 1;
 
-	/* use UIO config file descriptor for uio_pci_generic */
-	if (pread(intr_handle->uio_cfg_fd, &command_high, 1, 5) != 1) {
+	if (write(intr_handle->fd, &value, sizeof(value)) < 0) {
 		RTE_LOG(ERR, EAL,
-			"Error reading interrupts status for fd %d\n",
-			intr_handle->uio_cfg_fd);
+			"Error enabling interrupts for fd %d (%s)\n",
+			intr_handle->fd, strerror(errno));
 		return -1;
 	}
-	/* enable interrupts */
-	command_high &= ~0x4;
-	if (pwrite(intr_handle->uio_cfg_fd, &command_high, 1, 5) != 1) {
-		RTE_LOG(ERR, EAL,
-			"Error enabling interrupts for fd %d\n",
-			intr_handle->uio_cfg_fd);
-		return -1;
-	}
-
 	return 0;
 }
 
@@ -547,7 +527,7 @@ rte_intr_callback_unregister(struct rte_
 int
 rte_intr_enable(struct rte_intr_handle *intr_handle)
 {
-	if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0)
+	if (!intr_handle || intr_handle->fd < 0)
 		return -1;
 
 	switch (intr_handle->type){
@@ -587,7 +567,7 @@ rte_intr_enable(struct rte_intr_handle *
 int
 rte_intr_disable(struct rte_intr_handle *intr_handle)
 {
-	if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0)
+	if (!intr_handle || intr_handle->fd < 0)
 		return -1;
 
 	switch (intr_handle->type){
--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
@@ -276,7 +276,6 @@ pci_uio_map_resource(struct rte_pci_devi
 	struct pci_map *maps;
 
 	dev->intr_handle.fd = -1;
-	dev->intr_handle.uio_cfg_fd = -1;
 	dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;
 
 	/* secondary processes - use already recorded details */
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
@@ -52,8 +52,7 @@ enum rte_intr_handle_type {
 struct rte_intr_handle {
 	union {
 		int vfio_dev_fd;  /**< VFIO device file descriptor */
-		int uio_cfg_fd;  /**< UIO config file descriptor
-					for uio_pci_generic */
+		int uio_cfg_fd;   /**< UIO config file descriptor */
 	};
 	int fd;	 /**< interrupt event file descriptor */
 	enum rte_intr_handle_type type;  /**< handle type */

      parent reply	other threads:[~2015-04-15 16:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-15  1:06 [dpdk-dev] UIO pci-generic support broke igb_uio Stephen Hemminger
2015-04-15  7:19 ` Zhou, Danny
2015-04-15 15:57   ` Stephen Hemminger
2015-04-15 16:34   ` [dpdk-dev] [PATCH 0/2] fix UIO support broken by 2.0 Stephen Hemminger
2015-04-15 16:36     ` [dpdk-dev] [PATCH 1/2 kernel] uio: add irq control support to uio_pci_generic Stephen Hemminger
2015-04-15 16:38     ` Stephen Hemminger [this message]

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=20150415093821.41be184c@urahara \
    --to=stephen@networkplumber.org \
    --cc=danny.zhou@intel.com \
    --cc=dev@dpdk.org \
    /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).