From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 01/16] Separate igb_uio mapping into a separate file
Date: Wed, 21 May 2014 14:42:23 +0200 [thread overview]
Message-ID: <5094274.XRo5rd3sBr@xps13> (raw)
In-Reply-To: <1400514709-24087-2-git-send-email-anatoly.burakov@intel.com>
Hi Anatoly,
2014-05-19 16:51, Anatoly Burakov:
> In order to make the code a bit more clean while using multiple
> drivers, IGB_UIO mapping has been separated into its own file.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
[...]
> /* map a particular resource from a file */
> -static void *
> -pci_map_resource(void *requested_addr, const char *devname, off_t offset,
> +void *
> +pci_map_resource(void *requested_addr, int fd, off_t offset,
> size_t size)
> {
> - int fd;
> void *mapaddr;
>
> - /*
> - * open devname, to mmap it
> - */
> - fd = open(devname, O_RDWR);
> - if (fd < 0) {
> - RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
> - devname, strerror(errno));
> - goto fail;
> - }
> -
> /* Map the PCI memory resource of device */
> mapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE,
> MAP_SHARED, fd, offset);
> - close(fd);
> if (mapaddr == MAP_FAILED ||
> (requested_addr != NULL && mapaddr != requested_addr)) {
> - RTE_LOG(ERR, EAL, "%s(): cannot mmap(%s(%d), %p, 0x%lx, 0x%lx):"
> - " %s (%p)\n", __func__, devname, fd, requested_addr,
> + RTE_LOG(ERR, EAL, "%s(): cannot mmap(%d, %p, 0x%lx, 0x%lx):"
> + " %s (%p)\n", __func__, fd, requested_addr,
> (unsigned long)size, (unsigned long)offset,
> strerror(errno), mapaddr);
> goto fail;
[...]
> -static int
> -pci_uio_map_resource(struct rte_pci_device *dev)
[...]
> - /* if matching map is found, then use it */
> - if (j != nb_maps) {
> - offset = j * pagesz;
> - if (maps[j].addr != NULL ||
> - (mapaddr = pci_map_resource(NULL, devname,
> - (off_t)offset,
> - (size_t)maps[j].size)
> - ) == NULL) {
> - rte_free(uio_res);
> - return (-1);
> - }
> -
> - maps[j].addr = mapaddr;
> - maps[j].offset = offset;
> - dev->mem_resource[i].addr = mapaddr;
> - }
[...]
> + /* if matching map is found, then use it */
> + if (j != nb_maps) {
> + offset = j * pagesz;
> +
> + /*
> + * open devname, to mmap it
> + */
> + fd = open(uio_res->path, O_RDWR);
> + if (fd < 0) {
> + RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
> + uio_res->path, strerror(errno));
> + rte_free(uio_res);
> + return -1;
> + }
> +
> + if (maps[j].addr != NULL
> + || (mapaddr = pci_map_resource(NULL, fd,
> + (off_t) offset, (size_t) maps[j].size)) == NULL)
{
> + rte_free(uio_res);
> + close(fd);
> + return (-1);
> + }
> + close(fd);
> +
> + maps[j].addr = mapaddr;
> + maps[j].offset = offset;
> + dev->mem_resource[i].addr = mapaddr;
> + }
Looking at pci_map_resource(), it seems you are not only moving functions in
another file.
Please split this patch in a way we can clearly see what is changing.
Thanks
--
Thomas
next prev parent reply other threads:[~2014-05-21 12:42 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 [this message]
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
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 2:25 [dpdk-dev] [PATCH v2 01/16] Separate igb_uio mapping into a separate file 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=5094274.XRo5rd3sBr@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).