X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_pmd_mlx4%2Fmlx4.c;h=3a45746418db471e041463ea02102df02ca99790;hb=66e1591687ac;hp=942f539274a878421623c539d82e442170ee0e10;hpb=ae438314b1c442aa25027725bc6ecfc8982ab2be;p=dpdk.git diff --git a/lib/librte_pmd_mlx4/mlx4.c b/lib/librte_pmd_mlx4/mlx4.c index 942f539274..3a45746418 100644 --- a/lib/librte_pmd_mlx4/mlx4.c +++ b/lib/librte_pmd_mlx4/mlx4.c @@ -60,6 +60,16 @@ #include #include +/* Verbs header. */ +/* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */ +#ifdef PEDANTIC +#pragma GCC diagnostic ignored "-pedantic" +#endif +#include +#ifdef PEDANTIC +#pragma GCC diagnostic error "-pedantic" +#endif + /* DPDK headers don't like -pedantic. */ #ifdef PEDANTIC #pragma GCC diagnostic ignored "-pedantic" @@ -81,18 +91,6 @@ #pragma GCC diagnostic error "-pedantic" #endif -/* Verbs header. */ -/* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */ -#ifdef PEDANTIC -#pragma GCC diagnostic ignored "-pedantic" -#endif - -#include - -#ifdef PEDANTIC -#pragma GCC diagnostic error "-pedantic" -#endif - /* Generated configuration header. */ #include "mlx4_autoconf.h" @@ -4425,6 +4423,10 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) list = ibv_get_device_list(&i); if (list == NULL) { assert(errno); + if (errno == ENOSYS) { + WARN("cannot list devices, is ib_uverbs loaded?"); + return 0; + } return -errno; } assert(i >= 0); @@ -4453,9 +4455,15 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) break; } if (attr_ctx == NULL) { - if (err == 0) - err = ENODEV; ibv_free_device_list(list); + switch (err) { + case 0: + WARN("cannot access device, is mlx4_ib loaded?"); + return 0; + case EINVAL: + WARN("cannot use device, are drivers up to date?"); + return 0; + } assert(err > 0); return -err; } @@ -4632,7 +4640,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) snprintf(name, sizeof(name), "%s port %u", ibv_get_device_name(ibv_dev), port); - eth_dev = rte_eth_dev_allocate(name); + eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI); } if (eth_dev == NULL) { ERROR("can not allocate rte ethdev");