From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 09/16] Enable VFIO device binding
Date: Thu, 22 May 2014 14:03:44 +0200 [thread overview]
Message-ID: <1414388.FIrhq1zrZl@xps13> (raw)
In-Reply-To: <1400514709-24087-10-git-send-email-anatoly.burakov@intel.com>
2014-05-19 16:51, Anatoly Burakov:
> Add support for binding VFIO devices if RTE_PCI_DRV_NEED_IGB_UIO
> is set for this driver. Try VFIO first, if not mapped then try
> IGB_UIO too.
You have renamed RTE_PCI_DRV_NEED_IGB_UIO. Please update this log :)
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -401,6 +401,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr,
> struct rte_pci_device *d {
> struct rte_pci_id *id_table;
> int ret = 0;
> + int mapped = 0;
>
> for (id_table = dr->id_table ; id_table->vendor_id != 0; id_table++) {
>
> @@ -435,8 +436,17 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr,
> struct rte_pci_device *d }
>
> if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
> + /* try mapping the NIC resources using VFIO if it exists */
> +#ifdef VFIO_PRESENT
> + if (vfio_cfg.vfio_enabled) {
> + if ((ret = pci_vfio_map_resource(dev)) == 0)
> + mapped = 1;
> + else if (ret < 0)
> + return ret;
> + }
> +#endif
> /* map resources for devices that use igb_uio */
> - if ((ret = pci_uio_map_resource(dev)) != 0)
> + if (!mapped && (ret = pci_uio_map_resource(dev)) != 0)
> return ret;
I think creating a function pci_map_resource() could be cleaner (you won't
need variable mapped).
> +#ifdef VFIO_PRESENT
> + memset(&vfio_cfg, 0, sizeof(vfio_cfg));
> +
> + /* initialize group list */
> + int i, ret;
> +
> + for (i = 0; i < VFIO_MAX_GROUPS; i++) {
> + vfio_cfg.vfio_groups[i].fd = -1;
> + vfio_cfg.vfio_groups[i].group_no = -1;
> + }
> + vfio_cfg.vfio_container_fd = -1;
> +
> + /* check if we have VFIO driver enabled */
> + if (access(VFIO_DIR, F_OK) == 0) {
> + static int socket_fd;
> +
> + vfio_cfg.vfio_enabled = 1;
> +
> + /* if we are primary process, create a thread to communicate with
> + * secondary processes. the thread will use a socket to wait for
> + * requests from secondary process to send open file descriptors,
> + * because VFIO does not allow multiple open descriptors on a group
or
> + * VFIO container.
> + */
> + if (internal_config.process_type == RTE_PROC_PRIMARY) {
> + /* set up local socket */
> + if ((socket_fd = pci_vfio_socket_setup()) < 0) {
> + RTE_LOG(ERR, EAL, "Failed to set up local socket!\n");
> + return -1;
> + }
> + ret = pthread_create(&socket_thread, NULL,
> + pci_vfio_socket_thread, (void*) &socket_fd);
> + if (ret) {
> + RTE_LOG(ERR, EAL,
> + "Failed to create thread for communication with secondary
"
> + "processes!\n");
> + return -1;
> + }
> + }
Also here, it could help to have a dedicated function for vfio init.
> + }
> + else
checkpatch.pl reports an error: "else should follow close brace '}'"
> + RTE_LOG(INFO, EAL, "VFIO driver not loaded or wrong permissions\n");
> +#endif
Thanks
--
Thomas
next prev parent reply other threads:[~2014-05-22 12:03 UTC|newest]
Thread overview: 161+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-01 11:05 [dpdk-dev] [PATCH 00/16] [RFC] [VFIO] Add VFIO support to DPDK Burakov, Anatoly
2014-05-01 16:12 ` Stephen Hemminger
2014-05-01 17:00 ` Chris Wright
2014-05-02 9:00 ` Burakov, Anatoly
2014-05-05 14:44 ` Vincent JARDIN
2014-05-06 8:41 ` Burakov, Anatoly
2014-05-02 8:58 ` Burakov, Anatoly
2014-09-08 8:20 ` Sujith Sankar (ssujith)
2014-09-08 8:21 ` Burakov, Anatoly
2014-09-08 8:27 ` Sujith Sankar (ssujith)
2014-09-08 8:30 ` Burakov, Anatoly
2014-09-08 8:33 ` Sujith Sankar (ssujith)
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 00/16] " Anatoly Burakov
2014-05-28 14:37 ` [dpdk-dev] [PATCH v3 00/20] " Anatoly Burakov
2014-05-28 14:37 ` [dpdk-dev] [PATCH v3 01/20] pci: move open() out of pci_map_resource, rename structs Anatoly Burakov
2014-05-28 14:37 ` [dpdk-dev] [PATCH v3 02/20] pci: move uio mapping code to a separate file Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 03/20] pci: fixing errors in a previous commit found by checkpatch Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 04/20] pci: distinguish between legitimate failures and non-fatal errors Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 05/20] pci: Rename RTE_PCI_DRV_NEED_IGB_UIO to RTE_PCI_DRV_NEED_MAPPING Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 06/20] igb_uio: make igb_uio compilation optional Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 07/20] igb_uio: Moved interrupt type out of igb_uio Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 08/20] vfio: add support for VFIO in Linuxapp targets Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 09/20] vfio: add VFIO header Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 10/20] interrupts: Add support for VFIO interrupts Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 11/20] eal: remove -Wno-return-type for non-existent eal_hpet.c Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 12/20] vfio: create mapping code for VFIO Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 13/20] vfio: add multiprocess support Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 14/20] pci: enable VFIO device binding Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 15/20] eal: added support for selecting VFIO interrupt type from EAL command-line Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 16/20] eal: make --no-huge use mmap instead of malloc Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 17/20] test app: adding unit tests for VFIO EAL command-line parameter Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 18/20] igb_uio: Removed PCI ID table from igb_uio Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 19/20] binding script: Renamed igb_uio_bind to dpdk_nic_bind Anatoly Burakov
2014-05-28 14:38 ` [dpdk-dev] [PATCH v3 20/20] setup script: adding support for VFIO to setup.sh Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 00/20] Add VFIO support to DPDK Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 01/20] pci: move open() out of pci_map_resource, rename structs Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 02/20] pci: move uio mapping code to a separate file Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 03/20] pci: fixing errors in a previous commit found by checkpatch Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 04/20] pci: distinguish between legitimate failures and non-fatal errors Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 05/20] pci: Rename RTE_PCI_DRV_NEED_IGB_UIO to RTE_PCI_DRV_NEED_MAPPING Anatoly Burakov
2014-06-04 9:03 ` Burakov, Anatoly
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 06/20] igb_uio: make igb_uio compilation optional Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 07/20] igb_uio: Moved interrupt type out of igb_uio Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 08/20] vfio: add support for VFIO in Linuxapp targets Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 09/20] vfio: add VFIO header Anatoly Burakov
2014-06-03 10:17 ` [dpdk-dev] [PATCH v4 10/20] interrupts: Add support for VFIO interrupts Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 11/20] eal: remove -Wno-return-type for non-existent eal_hpet.c Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 12/20] vfio: create mapping code for VFIO Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 13/20] vfio: add multiprocess support Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 14/20] pci: enable VFIO device binding Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 15/20] eal: added support for selecting VFIO interrupt type from EAL command-line Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 16/20] eal: make --no-huge use mmap instead of malloc Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 17/20] test app: adding unit tests for VFIO EAL command-line parameter Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 18/20] igb_uio: Removed PCI ID table from igb_uio Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 19/20] binding script: Renamed igb_uio_bind to dpdk_nic_bind Anatoly Burakov
2014-06-03 10:18 ` [dpdk-dev] [PATCH v4 20/20] setup script: adding support for VFIO to setup.sh Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 00/20] Add VFIO support to DPDK Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 01/20] pci: move open() out of pci_map_resource, rename structs Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 02/20] pci: move uio mapping code to a separate file Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 03/20] pci: fixing errors in a previous commit found by checkpatch Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 04/20] pci: distinguish between legitimate failures and non-fatal errors Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 05/20] pci: Rename RTE_PCI_DRV_NEED_IGB_UIO to RTE_PCI_DRV_NEED_MAPPING Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 06/20] igb_uio: make igb_uio compilation optional Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 07/20] igb_uio: Moved interrupt type out of igb_uio Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 08/20] vfio: add support for VFIO in Linuxapp targets Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 09/20] vfio: add VFIO header Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 10/20] interrupts: Add support for VFIO interrupts Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 11/20] eal: remove -Wno-return-type for non-existent eal_hpet.c Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 12/20] vfio: create mapping code for VFIO Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 13/20] vfio: add multiprocess support Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 14/20] pci: enable VFIO device binding Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 15/20] eal: added support for selecting VFIO interrupt type from EAL command-line Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 16/20] eal: make --no-huge use mmap instead of malloc Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 17/20] test app: adding unit tests for VFIO EAL command-line parameter Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 18/20] igb_uio: Removed PCI ID table from igb_uio Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 19/20] binding script: Renamed igb_uio_bind to dpdk_nic_bind Anatoly Burakov
2014-06-10 11:11 ` [dpdk-dev] [PATCH v5 20/20] setup script: adding support for VFIO to setup.sh Anatoly Burakov
2014-06-13 14:38 ` [dpdk-dev] [PATCH v5 00/20] Add VFIO support to DPDK Burakov, Anatoly
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 " Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 01/20] pci: move open() out of pci_map_resource, rename structs Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 02/20] pci: move uio mapping code to a separate file Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 03/20] pci: fixing errors in a previous commit found by checkpatch Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 04/20] pci: distinguish between legitimate failures and non-fatal errors Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 05/20] pci: Rename RTE_PCI_DRV_NEED_IGB_UIO to RTE_PCI_DRV_NEED_MAPPING Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 06/20] igb_uio: make igb_uio compilation optional Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 07/20] igb_uio: Moved interrupt type out of igb_uio Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 08/20] vfio: add support for VFIO in Linuxapp targets Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 09/20] vfio: add VFIO header Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 10/20] interrupts: Add support for VFIO interrupts Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 11/20] eal: remove -Wno-return-type for non-existent eal_hpet.c Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 12/20] vfio: create mapping code for VFIO Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 13/20] vfio: add multiprocess support Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 14/20] pci: enable VFIO device binding Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 15/20] eal: added support for selecting VFIO interrupt type from EAL command-line Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 16/20] eal: make --no-huge use mmap instead of malloc Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 17/20] test app: adding unit tests for VFIO EAL command-line parameter Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 18/20] igb_uio: Removed PCI ID table from igb_uio Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 19/20] binding script: Renamed igb_uio_bind to dpdk_nic_bind Anatoly Burakov
2014-06-13 14:52 ` [dpdk-dev] [PATCH v6 20/20] setup script: adding support for VFIO to setup.sh Anatoly Burakov
2014-06-16 9:08 ` [dpdk-dev] [PATCH v6 00/20] Add VFIO support to DPDK Thomas Monjalon
2014-06-16 9:28 ` Burakov, Anatoly
2014-06-16 13:07 ` Thomas Monjalon
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 01/16] Separate igb_uio mapping into a separate file Anatoly Burakov
2014-05-21 12:42 ` Thomas Monjalon
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 02/16] Distinguish between legitimate failures and non-fatal errors Anatoly Burakov
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 03/16] Rename RTE_PCI_DRV_NEED_IGB_UIO to RTE_PCI_DRV_NEED_MAPPING Anatoly Burakov
2014-05-21 12:55 ` Thomas Monjalon
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 04/16] Make igb_uio compilation optional Anatoly Burakov
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 05/16] Moved interrupt type out of igb_uio Anatoly Burakov
2014-05-21 13:38 ` Thomas Monjalon
2014-05-21 13:44 ` Burakov, Anatoly
2014-05-21 13:46 ` Thomas Monjalon
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 06/16] Add support for VFIO in Linuxapp targets Anatoly Burakov
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 07/16] Add support for VFIO interrupts, add VFIO header Anatoly Burakov
2014-05-21 16:07 ` Thomas Monjalon
2014-05-22 12:45 ` Burakov, Anatoly
2014-05-22 12:49 ` Thomas Monjalon
2014-05-22 12:54 ` Burakov, Anatoly
2014-05-27 14:29 ` Burakov, Anatoly
2014-05-27 14:38 ` Thomas Monjalon
2014-05-27 14:40 ` Burakov, Anatoly
2014-05-27 14:46 ` Thomas Monjalon
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 08/16] Add support for mapping devices through VFIO Anatoly Burakov
2014-05-22 11:53 ` Thomas Monjalon
2014-05-22 12:06 ` Burakov, Anatoly
2014-05-22 12:28 ` Thomas Monjalon
2014-05-22 12:37 ` Burakov, Anatoly
2014-05-22 12:46 ` Thomas Monjalon
2014-05-22 12:54 ` Burakov, Anatoly
2014-05-27 16:21 ` Burakov, Anatoly
2014-05-27 16:36 ` Thomas Monjalon
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 09/16] Enable VFIO device binding Anatoly Burakov
2014-05-22 12:03 ` Thomas Monjalon [this message]
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 10/16] Added support for selecting VFIO interrupt type from EAL command-line Anatoly Burakov
2014-05-20 7:40 ` Stephen Hemminger
2014-05-20 8:33 ` Burakov, Anatoly
2014-05-20 11:23 ` Stephen Hemminger
2014-05-20 11:26 ` Burakov, Anatoly
2014-05-20 21:39 ` Stephen Hemminger
2014-05-22 12:34 ` Thomas Monjalon
2014-05-28 10:35 ` Burakov, Anatoly
2014-05-28 11:24 ` Thomas Monjalon
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 11/16] Make --no-huge use mmap instead of malloc Anatoly Burakov
2014-05-22 13:04 ` Thomas Monjalon
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 12/16] Adding unit tests for VFIO EAL command-line parameter Anatoly Burakov
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 13/16] Removed PCI ID table from igb_uio Anatoly Burakov
2014-05-22 13:13 ` Thomas Monjalon
2014-05-22 13:24 ` Burakov, Anatoly
2014-05-22 13:28 ` Thomas Monjalon
2014-05-22 23:11 ` Stephen Hemminger
2014-05-23 7:48 ` Thomas Monjalon
2014-05-23 0:10 ` Antti Kantee
2014-05-28 13:45 ` Thomas Monjalon
2014-05-28 14:50 ` Antti Kantee
2014-05-28 16:24 ` Stephen Hemminger
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 14/16] Renamed igb_uio_bind to dpdk_nic_bind Anatoly Burakov
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 15/16] Added support for VFIO drivers in dpdk_nic_bind.py Anatoly Burakov
2014-05-22 13:23 ` Thomas Monjalon
2014-05-19 15:51 ` [dpdk-dev] [PATCH v2 16/16] Adding support for VFIO to setup.sh Anatoly Burakov
2014-05-22 13:25 ` Thomas Monjalon
2014-05-27 3:23 [dpdk-dev] [PATCH v2 09/16] Enable VFIO device binding Xu, HuilongX
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=1414388.FIrhq1zrZl@xps13 \
--to=thomas.monjalon@6wind.com \
--cc=anatoly.burakov@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).