/*-
* BSD LICENSE
- *
+ *
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
return NULL;
}
-#ifndef OFF_MAX
-#define OFF_MAX ((uint64_t)(off_t)-1)
-#endif
-
static int
pci_uio_map_secondary(struct rte_pci_device *dev)
{
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return (pci_uio_map_secondary(dev));
- rte_snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u",
+ snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u",
dev->addr.bus, dev->addr.devid, dev->addr.function);
if (access(devname, O_RDWR) < 0) {
RTE_LOG(WARNING, EAL, " "PCI_PRI_FMT" not managed by UIO driver, "
"skipping\n", loc->domain, loc->bus, loc->devid, loc->function);
- return -1;
+ return 1;
}
/* save fd if in primary process */
return (-1);
}
- rte_snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
+ snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
memcpy(&uio_res->pci_addr, &dev->addr, sizeof(uio_res->pci_addr));
return (0);
}
-/* parse the "resource" sysfs file */
-#define IORESOURCE_MEM 0x00000200
-
/* Compare two PCI device addresses. */
static int
pci_addr_comparison(struct rte_pci_addr *addr, struct rte_pci_addr *addr2)
/* device is valid, add in list (sorted) */
if (TAILQ_EMPTY(&pci_device_list)) {
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
- }
+ }
else {
struct rte_pci_device *dev2 = NULL;
}
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
}
-
+
return 0;
skipdev:
rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *dev)
{
struct rte_pci_id *id_table;
+ int ret;
for (id_table = dr->id_table ; id_table->vendor_id != 0; id_table++) {
return 0;
}
- if (dr->drv_flags & RTE_PCI_DRV_NEED_IGB_UIO) {
+ if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
/* map resources for devices that use igb_uio */
- if (pci_uio_map_resource(dev) < 0)
- return -1;
+ ret = pci_uio_map_resource(dev);
+ if (ret != 0)
+ return ret;
} else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&
rte_eal_process_type() == RTE_PROC_PRIMARY) {
/* unbind current driver */