From patchwork Wed Apr 15 16:38:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 4317 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 19A8FC372; Wed, 15 Apr 2015 18:38:29 +0200 (CEST) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by dpdk.org (Postfix) with ESMTP id C5C4AC366 for ; Wed, 15 Apr 2015 18:38:27 +0200 (CEST) Received: by pacyx8 with SMTP id yx8so56539822pac.1 for ; Wed, 15 Apr 2015 09:38:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=k9flEmfHU1Uv5k7XuUW+yQwsb8srXkrI22agMoX7aAQ=; b=InUA8O52YmXjdbbnqBTfQ9+Ai0mlz30nrhRfoHg7I/CVKFj5z+noEDi7i7RHZJGKI6 U0Q4eq7b1icClOCPuDpIwF2UHjUb8HH+8HomWx1xQNkjeu7QwpWhxNYto6qZ/uSo5A8S FEc47dtpJ1SfE9JnhPxfCXvyFJT3hkByCdNg/2sUVRH3jKonS3IGbsRioqNVQJl1OuWw 0KiXBV29GxoIx0vTTtxmuaMFf/SHsqufgkD2rNP313irDQJYE4DXwBopfLtkyvDgWIAG XMcYTxD05WKqni1JmYJ053wjbtq+de4NrAEwIufVJfS705KL3cYZGjP/3mqhjRzMCNEF 6hwg== X-Gm-Message-State: ALoCoQlUy9pxhxaGC3vPxqJpI7AeevqdpLvxHlagk+uGwpaKxRMLTkYc3+Uh2T1NlD2HaybfxoEB X-Received: by 10.66.250.106 with SMTP id zb10mr48024888pac.36.1429115907144; Wed, 15 Apr 2015 09:38:27 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id np6sm4599573pdb.80.2015.04.15.09.38.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2015 09:38:26 -0700 (PDT) Date: Wed, 15 Apr 2015 09:38:21 -0700 From: Stephen Hemminger To: "Zhou, Danny" Message-ID: <20150415093821.41be184c@urahara> In-Reply-To: <20150415093420.6fc93b76@urahara> References: <20150414180620.03deb8ee@urahara> <20150415093420.6fc93b76@urahara> MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: [dpdk-dev] [PATCH 2/2 dpdk] uio: fix pci generic driver breakage X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 */