lib: remove extra parenthesis after return
[dpdk.git] / lib / librte_eal / common / include / rte_pci.h
index ac30925..7801fa0 100644 (file)
@@ -74,6 +74,7 @@
 extern "C" {
 #endif
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
 #include <errno.h>
@@ -142,11 +143,11 @@ struct rte_pci_addr {
 
 struct rte_devargs;
 
-enum rte_pt_driver {
-       RTE_PT_UNKNOWN          = 0,
-       RTE_PT_IGB_UIO          = 1,
-       RTE_PT_VFIO             = 2,
-       RTE_PT_UIO_GENERIC      = 3,
+enum rte_kernel_driver {
+       RTE_KDRV_UNKNOWN = 0,
+       RTE_KDRV_IGB_UIO,
+       RTE_KDRV_VFIO,
+       RTE_KDRV_UIO_GENERIC,
 };
 
 /**
@@ -158,11 +159,11 @@ struct rte_pci_device {
        struct rte_pci_id id;                   /**< PCI ID. */
        struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE];   /**< PCI Memory Resource */
        struct rte_intr_handle intr_handle;     /**< Interrupt handle */
-       const struct rte_pci_driver *driver;    /**< Associated driver */
+       struct rte_pci_driver *driver;          /**< Associated driver */
        uint16_t max_vfs;                       /**< sriov enable if not zero */
        int numa_node;                          /**< NUMA node connection */
        struct rte_devargs *devargs;            /**< Device user arguments */
-       enum rte_pt_driver pt_driver;           /**< Driver of passthrough */
+       enum rte_kernel_driver kdrv;            /**< Kernel driver passthrough */
 };
 
 /** Any PCI device identifier (vendor, device, ...) */
@@ -204,7 +205,7 @@ struct rte_pci_driver {
        const char *name;                       /**< Driver name. */
        pci_devinit_t *devinit;                 /**< Device init. function. */
        pci_devuninit_t *devuninit;             /**< Device uninit function. */
-       struct rte_pci_id *id_table;            /**< ID table, NULL terminated. */
+       const struct rte_pci_id *id_table;      /**< ID table, NULL terminated. */
        uint32_t drv_flags;                     /**< Flags contolling handling of device. */
 };
 
@@ -227,7 +228,7 @@ do {                                                               \
        errno = 0;                                              \
        val = strtoul((in), &end, 16);                          \
        if (errno != 0 || end[0] != (dlm) || val > (lim))       \
-               return (-EINVAL);                               \
+               return -EINVAL;                                 \
        (fd) = (typeof (fd))val;                                \
        (in) = end + 1;                                         \
 } while(0)
@@ -238,10 +239,10 @@ do {                                                               \
  * a domain prefix (i.e. domain returned is always 0)
  *
  * @param input
- *     The input string to be parsed. Should have the format XX:XX.X
+ *     The input string to be parsed. Should have the format XX:XX.X
  * @param dev_addr
- *     The PCI Bus-Device-Function address to be returned. Domain will always be
- *     returned as 0
+ *     The PCI Bus-Device-Function address to be returned. Domain will always be
+ *     returned as 0
  * @return
  *  0 on success, negative on error.
  */
@@ -252,7 +253,7 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
        GET_PCIADDR_FIELD(input, dev_addr->bus, UINT8_MAX, ':');
        GET_PCIADDR_FIELD(input, dev_addr->devid, UINT8_MAX, '.');
        GET_PCIADDR_FIELD(input, dev_addr->function, UINT8_MAX, 0);
-       return (0);
+       return 0;
 }
 
 /**
@@ -261,9 +262,9 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
  * a domain prefix.
  *
  * @param input
- *     The input string to be parsed. Should have the format XXXX:XX:XX.X
+ *     The input string to be parsed. Should have the format XXXX:XX:XX.X
  * @param dev_addr
- *     The PCI Bus-Device-Function address to be returned
+ *     The PCI Bus-Device-Function address to be returned
  * @return
  *  0 on success, negative on error.
  */
@@ -274,7 +275,7 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
        GET_PCIADDR_FIELD(input, dev_addr->bus, UINT8_MAX, ':');
        GET_PCIADDR_FIELD(input, dev_addr->devid, UINT8_MAX, '.');
        GET_PCIADDR_FIELD(input, dev_addr->function, UINT8_MAX, 0);
-       return (0);
+       return 0;
 }
 #undef GET_PCIADDR_FIELD
 
@@ -292,7 +293,8 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
  *     Negative on addr is less than addr2, or error.
  */
 static inline int
-rte_eal_compare_pci_addr(struct rte_pci_addr *addr, struct rte_pci_addr *addr2)
+rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
+                        const struct rte_pci_addr *addr2)
 {
        uint64_t dev_addr, dev_addr2;
 
@@ -312,6 +314,15 @@ rte_eal_compare_pci_addr(struct rte_pci_addr *addr, struct rte_pci_addr *addr2)
                return 0;
 }
 
+/**
+ * Scan the content of the PCI bus, and the devices in the devices
+ * list
+ *
+ * @return
+ *  0 on success, negative on error
+ */
+int rte_eal_pci_scan(void);
+
 /**
  * Probe the PCI bus for registered drivers.
  *
@@ -339,7 +350,7 @@ int rte_eal_pci_probe(void);
  *   - 0 on success.
  *   - Negative on error.
  */
-int rte_eal_pci_probe_one(struct rte_pci_addr *addr);
+int rte_eal_pci_probe_one(const struct rte_pci_addr *addr);
 
 /**
  * Close the single PCI device.
@@ -354,7 +365,7 @@ int rte_eal_pci_probe_one(struct rte_pci_addr *addr);
  *   - 0 on success.
  *   - Negative on error.
  */
-int rte_eal_pci_close_one(struct rte_pci_addr *addr);
+int rte_eal_pci_close_one(const struct rte_pci_addr *addr);
 #endif /* RTE_LIBRTE_EAL_HOTPLUG */
 
 /**