From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by dpdk.org (Postfix) with ESMTP id 8B9401F3 for ; Sat, 10 Aug 2013 00:16:53 +0200 (CEST) Received: by mail-pb0-f44.google.com with SMTP id xa7so4962462pbc.31 for ; Fri, 09 Aug 2013 15:17:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=zxp5z9idwAfjkA0AjOsrEefEWKr80VBqZxh81Im0QCE=; b=Z6wB8f6EDf264VvdgNFwybBAPLOK9Kw42fUR96bZLef1+6V18kb7iJoeKv2S85xh2m i00g+mNyQmwCRJQ6mtBEK/zwLQ8o7AIb7wMyv4/Ib9GYgnrspq6lhassyalRsF+geWkr wqAKjPtvLwVQAyKB6G91MITqfUyZw2i5YClFfwVlCkMPZwCQEk6MSr/HbsSO649kn1Tj RfS0cMxdqk7Oh30U7Rl6pfSXcBM5T21/o6TLE1+6hKrMeFs8eCA2NOgrEMCKbqynDVsW pR+LpZkogphF2Z8mDkl1ulMQp4hL5KJINzflpWV+3tLv+GCAcoaHWbikMtGjiSXlKq4S 0b/w== X-Gm-Message-State: ALoCoQmuGhCTVQq0fHp6UMiAKwQVz//bCiv9RKZxvnr/zzHY8PQNsB4ij12zZMYiLEFidXn/qX3k X-Received: by 10.68.163.131 with SMTP id yi3mr13705374pbb.55.1376086640333; Fri, 09 Aug 2013 15:17:20 -0700 (PDT) Received: from nehalam.linuxnetplumber.net (static-50-53-69-237.bvtn.or.frontiernet.net. [50.53.69.237]) by mx.google.com with ESMTPSA id aj3sm24604637pad.8.2013.08.09.15.17.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 09 Aug 2013 15:17:19 -0700 (PDT) Date: Fri, 9 Aug 2013 15:17:16 -0700 From: Stephen Hemminger To: Patrick Mahan Message-ID: <20130809151716.0516cf0a@nehalam.linuxnetplumber.net> In-Reply-To: <52054701.2050602@mahan.org> References: <20130808165344.18a543b9@nehalam.linuxnetplumber.net> <7866DDBC-AD11-4BF6-83E7-5FB61DD8281D@mahan.org> <20130808175032.7b343765@nehalam.linuxnetplumber.net> <52054701.2050602@mahan.org> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] Need to support mapping in bar1 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: , X-List-Received-Date: Fri, 09 Aug 2013 22:16:54 -0000 It assumed another patch to allow different UIO driver devices. It hasn't been accepted, I presume because 6Wind doesn't like the patch because their drivers work differently. Subject: eal: support different modules In order to support new devices, the module name should not be a boolean flag to EAL subsystem, instead use have a module name in pci device structure. An additional change is that failure to detect module should not be fatal, but an error like other EAL setup problems, allowing the application to recover. Signed-off-by: Stephen Hemminger --- app/chkincs/test_pci.c | 3 ++- app/test/test_pci.c | 4 ++-- lib/librte_eal/common/include/rte_pci.h | 5 ++--- lib/librte_eal/linuxapp/eal/eal_pci.c | 9 ++------- lib/librte_pmd_igb/e1000_ethdev.c | 2 +- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 4 ++-- 6 files changed, 11 insertions(+), 16 deletions(-) --- a/lib/librte_eal/common/include/rte_pci.h 2013-07-16 09:44:47.000000000 -0700 +++ b/lib/librte_eal/common/include/rte_pci.h 2013-08-08 17:41:37.866416535 -0700 @@ -151,10 +151,9 @@ struct rte_pci_driver { pci_devinit_t *devinit; /**< Device init. function. */ struct rte_pci_id *id_table; /**< ID table, NULL terminated. */ uint32_t drv_flags; /**< Flags contolling handling of device. */ + const char *module_name; /**< Associated kernel module */ }; -/** Device needs igb_uio kernel module */ -#define RTE_PCI_DRV_NEED_IGB_UIO 0x0001 /** Device driver must be registered several times until failure */ #define RTE_PCI_DRV_MULTIPLE 0x0002 /** Device needs to be unbound even if no module is provided */ --- a/lib/librte_eal/linuxapp/eal/eal_pci.c 2013-07-16 09:44:47.255210583 -0700 +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c 2013-08-08 17:40:52.606974358 -0700 @@ -76,7 +76,7 @@ * This code is used to simulate a PCI probe by parsing information in * sysfs. Moreover, when a registered driver matches a device, the * kernel driver currently using it is unloaded and replaced by - * igb_uio module, which is a very minimal userland driver for Intel + * a module, which is a very minimal userland driver for Intel * network card, only providing access to PCI BAR to applications, and * enabling bus master. */ @@ -84,8 +84,6 @@ #define PROC_MODULES "/proc/modules" -#define IGB_UIO_NAME "igb_uio" - #define UIO_NEWID "/sys/bus/pci/drivers/%s/new_id" #define UIO_BIND "/sys/bus/pci/drivers/%s/bind" @@ -700,12 +698,9 @@ int rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *dev) { struct rte_pci_id *id_table; - const char *module_name = NULL; + const char *module_name = dr->module_name; int uio_status = -1; - if (dr->drv_flags & RTE_PCI_DRV_NEED_IGB_UIO) - module_name = IGB_UIO_NAME; - uio_status = pci_uio_check_module(module_name); for (id_table = dr->id_table ; id_table->vendor_id != 0; id_table++) { --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 2013-06-05 14:41:53.000000000 -0700 +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 2013-08-08 17:40:52.606974358 -0700 @@ -547,7 +547,7 @@ static struct eth_driver rte_ixgbe_pmd = { .name = "rte_ixgbe_pmd", .id_table = pci_id_ixgbe_map, - .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO, + .module_name = "igb_uio", }, .eth_dev_init = eth_ixgbe_dev_init, .dev_private_size = sizeof(struct ixgbe_adapter), @@ -560,7 +560,7 @@ static struct eth_driver rte_ixgbevf_pmd { .name = "rte_ixgbevf_pmd", .id_table = pci_id_ixgbevf_map, - .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO, + .module_name = "igb_uio", }, .eth_dev_init = eth_ixgbevf_dev_init, .dev_private_size = sizeof(struct ixgbe_adapter), --- a/app/test/test_pci.c 2013-06-05 14:41:53.000000000 -0700 +++ b/app/test/test_pci.c 2013-08-08 17:40:52.606974358 -0700 @@ -69,7 +69,7 @@ static int my_driver_init(struct rte_pci struct rte_pci_device *dev); /* - * To test cases where RTE_PCI_DRV_NEED_IGB_UIO is set, and isn't set, two + * To test cases where module_name is set, and isn't set, two * drivers are created (one with IGB devices, the other with IXGBE devices). */ @@ -101,7 +101,7 @@ struct rte_pci_driver my_driver = { .name = "test_driver", .devinit = my_driver_init, .id_table = my_driver_id, - .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO, + .module_name = "igb_uio", }; struct rte_pci_driver my_driver2 = { --- a/app/chkincs/test_pci.c 2013-06-05 14:41:53.000000000 -0700 +++ b/app/chkincs/test_pci.c 2013-08-08 17:40:52.606974358 -0700 @@ -64,7 +64,8 @@ struct rte_pci_driver my_driver = { "test_driver", my_driver_init, my_driver_id, - RTE_PCI_DRV_NEED_IGB_UIO, + 0, + "igb_uio", }; static int --- a/lib/librte_pmd_igb/e1000_ethdev.c 2013-06-05 14:41:53.000000000 -0700 +++ b/lib/librte_pmd_igb/e1000_ethdev.c 2013-08-08 17:40:52.610974310 -0700 @@ -235,7 +235,7 @@ eth_igb_dev_init(__attribute__((unused)) return 0; } - hw->hw_addr= (void *)pci_dev->mem_resource.addr; + hw->hw_addr = pci_dev->mem_resource[0].addr; igb_identify_hardware(eth_dev); @@ -336,7 +336,7 @@ static struct eth_driver rte_igb_pmd = { { .name = "rte_igb_pmd", .id_table = pci_id_igb_map, - .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO, + .module_name = "igb_uio", }, .eth_dev_init = eth_igb_dev_init, .dev_private_size = sizeof(struct e1000_adapter),