From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 49EC41BAC2 for ; Thu, 26 Oct 2017 12:06:53 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id m72so6878621wmc.1 for ; Thu, 26 Oct 2017 03:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=xvoccLyaFacqhhyiOadh1KZqPHGrOm3dp01lbqnPsko=; b=bH0AXCAMeWa53yx8wfDQ/TzPdQUvRtgbFiLSBR6pOL5/9Dmj+inIMQiZ0NdQGoOAQi nuELN2h98az8NRb/Hcr6tQk8L/LZR5XFiHTqFlJR9nLCpFYG+0bRYuS+C7ATDdV9vk4G JWUY4Ra4MgQe0ttIBdRdehqfecIB/BHSzlBEDKUOzcWl4t9nRmqmT2BRdYZQQh3H4zSx moWD3HzOPLmgu8pGrTCskdFdkIAavpMRuVzjzMhJ5BQ4QwuDCVWQgGtLB8Q3S/hXuOH5 AV9T4YtGRvnC6Iy2C/h2mxK0uN53WQtY02F9Pk5LhXB2aeQ94/HziTQrsxU1qZt+vq8n n2BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=xvoccLyaFacqhhyiOadh1KZqPHGrOm3dp01lbqnPsko=; b=kSP72J/0fiK7AmubjxheMRGozqt4gLjPQIeSLPdrkHFjWWSdGBC2YsDb1iktZcC9h7 ZV+gHGcR7aDc4iVr17OK1jcWQP38vs8OiVMsBqU/StoU0L+/kfPbcw/k/oJkxIQLnQvd cL8LjGrZRuT32ZE5gIjE6o5D1JFu9QhYM1JMf/N3TZlb39piIwU569LBdBGxK9WoXFTY YGsd8LX+RqFrzahuKTLeZX+sKr4ylmi5MnrLNwWPhauI59eC4/+G3HImNhviMHpo+yem yrgWwiueOZ3UwlBLmtlxccHh3OKJ44c6zivpCqaH7ZtZQyfvb7ZJ9NJJmkM09m9okinN fOxA== X-Gm-Message-State: AMCzsaWUYlyCwkt/vWZ8A5gnY2FuHvpw3y8U0giJiK+37kJwqdwDazxv e0zS8puOAbmctR1visAxOrsfZgEf X-Google-Smtp-Source: ABhQp+QzC2LWwo/fQn8QYEhHRO1cvz4IqRi9TbRCRRYzpav+QaR8PszFdRImdY7eE5+jpSCWc6rAYQ== X-Received: by 10.80.217.15 with SMTP id t15mr27876787edj.217.1509012412528; Thu, 26 Oct 2017 03:06:52 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id u12sm3339619edk.45.2017.10.26.03.06.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Oct 2017 03:06:51 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 26 Oct 2017 12:06:06 +0200 Message-Id: <55a6e297219e46ab4169699c2e71e77aeb7c2f18.1509012196.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v8 21/25] pci: use EAL exposed configuration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 10:06:53 -0000 Signed-off-by: Gaetan Rivet --- lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 18 +++++++++++------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c index 7d82195..e73b7cd 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -368,7 +368,7 @@ rte_pci_scan(void) }; /* for debug purposes, PCI can be disabled */ - if (internal_config.no_pci) + if (!rte_eal_has_pci()) return 0; fd = open("/dev/pci", O_RDONLY); diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index 3a853a6..cee4b94 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -457,7 +457,7 @@ rte_pci_scan(void) struct rte_pci_addr addr; /* for debug purposes, PCI can be disabled */ - if (internal_config.no_pci) + if (!rte_eal_has_pci()) return 0; #ifdef VFIO_PRESENT diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c index b639ab9..d17837a 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c @@ -214,7 +214,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf, return -1; /* create uio device if we've been asked to */ - if (internal_config.create_uio_dev && create && + if (rte_eal_create_uio_dev() && create && pci_mknod_uio_dev(dstbuf, uio_num) < 0) RTE_LOG(WARNING, EAL, "Cannot create /dev/uio%u\n", uio_num); diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 3331b13..7006a1d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -209,14 +209,18 @@ static int pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) { int i, ret, intr_idx; + enum rte_intr_mode intr_mode; /* default to invalid index */ intr_idx = VFIO_PCI_NUM_IRQS; + /* Get default / configured intr_mode */ + intr_mode = rte_eal_vfio_intr_mode(); + /* get interrupt type from internal config (MSI-X by default, can be * overridden from the command line */ - switch (internal_config.vfio_intr_mode) { + switch (intr_mode) { case RTE_INTR_MODE_MSIX: intr_idx = VFIO_PCI_MSIX_IRQ_INDEX; break; @@ -240,7 +244,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) int fd = -1; /* skip interrupt modes we don't want */ - if (internal_config.vfio_intr_mode != RTE_INTR_MODE_NONE && + if (intr_mode != RTE_INTR_MODE_NONE && i != intr_idx) continue; @@ -256,7 +260,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) /* if this vector cannot be used with eventfd, fail if we explicitly * specified interrupt type, otherwise continue */ if ((irq.flags & VFIO_IRQ_INFO_EVENTFD) == 0) { - if (internal_config.vfio_intr_mode != RTE_INTR_MODE_NONE) { + if (intr_mode != RTE_INTR_MODE_NONE) { RTE_LOG(ERR, EAL, " interrupt vector does not support eventfd!\n"); return -1; @@ -277,15 +281,15 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) switch (i) { case VFIO_PCI_MSIX_IRQ_INDEX: - internal_config.vfio_intr_mode = RTE_INTR_MODE_MSIX; + intr_mode = RTE_INTR_MODE_MSIX; dev->intr_handle.type = RTE_INTR_HANDLE_VFIO_MSIX; break; case VFIO_PCI_MSI_IRQ_INDEX: - internal_config.vfio_intr_mode = RTE_INTR_MODE_MSI; + intr_mode = RTE_INTR_MODE_MSI; dev->intr_handle.type = RTE_INTR_HANDLE_VFIO_MSI; break; case VFIO_PCI_INTX_IRQ_INDEX: - internal_config.vfio_intr_mode = RTE_INTR_MODE_LEGACY; + intr_mode = RTE_INTR_MODE_LEGACY; dev->intr_handle.type = RTE_INTR_HANDLE_VFIO_LEGACY; break; default: @@ -615,7 +619,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev) int pci_vfio_map_resource(struct rte_pci_device *dev) { - if (internal_config.process_type == RTE_PROC_PRIMARY) + if (rte_eal_process_type() == RTE_PROC_PRIMARY) return pci_vfio_map_resource_primary(dev); else return pci_vfio_map_resource_secondary(dev); -- 2.1.4