From: Intel Date: Wed, 19 Dec 2012 23:00:00 +0000 (+0100) Subject: ethdev: init all builtin drivers X-Git-Tag: spdx-start~11372 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=69d22b8e668d4cbc6d3a5e2873551de5d44c3a45;p=dpdk.git ethdev: init all builtin drivers Signed-off-by: Intel --- diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 52caf496d2..6963598f19 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1043,17 +1043,8 @@ main(int argc, char** argv) if (diag < 0) rte_panic("Cannot init EAL\n"); -#ifdef RTE_LIBRTE_IGB_PMD - if (rte_igb_pmd_init()) - rte_panic("Cannot init igb PMD\n"); -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - if (rte_ixgbe_pmd_init()) - rte_panic("Cannot init ixgbe PMD\n"); - - if (rte_ixgbevf_pmd_init()) - rte_panic("Cannot init ixgbevf PMD\n"); -#endif + if (rte_pmd_init_all()) + rte_panic("Cannot init PMD\n"); if (rte_eal_pci_probe()) rte_panic("Cannot probe PCI\n"); @@ -1062,6 +1053,7 @@ main(int argc, char** argv) if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No probed ethernet devices - check that " "CONFIG_RTE_LIBRTE_IGB_PMD=y and that " + "CONFIG_RTE_LIBRTE_EM_PMD=y and that " "CONFIG_RTE_LIBRTE_IXGBE_PMD=y in your " "configuration file\n"); diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index e8433607f1..f1f52d99b0 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -518,16 +518,9 @@ main(int argc, char** argv) } /* Initialise PMD driver(s) */ -#ifdef RTE_LIBRTE_IGB_PMD - ret = rte_igb_pmd_init(); + ret = rte_pmd_init_all(); if (ret < 0) - FATAL_ERROR("Could not initialise igb PMD (%d)", ret); -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_ixgbe_pmd_init(); - if (ret < 0) - FATAL_ERROR("Could not initialise ixgbe PMD (%d)", ret); -#endif + FATAL_ERROR("Could not probe PMD (%d)", ret); /* Scan PCI bus for recognised devices */ ret = rte_eal_pci_probe(); diff --git a/examples/ipv4_frag/main.c b/examples/ipv4_frag/main.c index 93daabff40..5983986342 100644 --- a/examples/ipv4_frag/main.c +++ b/examples/ipv4_frag/main.c @@ -557,14 +557,8 @@ MAIN(int argc, char **argv) rte_panic("Cannot init indirect mbuf pool\n"); /* init driver */ -#ifdef RTE_LIBRTE_IGB_PMD - if (rte_igb_pmd_init() < 0) - rte_panic("Cannot init igb pmd\n"); -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - if (rte_ixgbe_pmd_init() < 0) - rte_panic("Cannot init ixgbe pmd\n"); -#endif + if (rte_pmd_init_all() < 0) + rte_panic("Cannot init PMD\n"); if (rte_eal_pci_probe() < 0) rte_panic("Cannot probe PCI\n"); diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index d1b1a66b3a..0ae8c3c8cc 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -701,14 +701,8 @@ MAIN(int argc, char **argv) rte_exit(EXIT_FAILURE, "Cannot init clone mbuf pool\n"); /* init driver */ -#ifdef RTE_LIBRTE_IGB_PMD - if (rte_igb_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init igb pmd\n"); -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - if (rte_ixgbe_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init ixgbe pmd\n"); -#endif + if (rte_pmd_init_all() < 0) + rte_exit(EXIT_FAILURE, "Cannot init pmd\n"); if (rte_eal_pci_probe() < 0) rte_exit(EXIT_FAILURE, "Cannot probe PCI\n"); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index b887f6b347..6731a14a97 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -566,14 +566,8 @@ MAIN(int argc, char **argv) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); /* init driver(s) */ -#ifdef RTE_LIBRTE_IGB_PMD - if (rte_igb_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init igb pmd\n"); -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - if (rte_ixgbe_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init ixgbe pmd\n"); -#endif + if (rte_pmd_init_all() < 0) + rte_exit(EXIT_FAILURE, "Cannot init pmd\n"); if (rte_eal_pci_probe() < 0) rte_exit(EXIT_FAILURE, "Cannot probe PCI\n"); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 9e2d9abc8d..ead3cb85f0 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -967,17 +967,8 @@ MAIN(int argc, char **argv) rte_exit(EXIT_FAILURE, "init_mem failed\n"); /* init driver */ -#ifdef RTE_LIBRTE_IGB_PMD - if (rte_igb_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init igb pmd\n"); -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - if (rte_ixgbe_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init ixgbe pmd\n"); - - if (rte_ixgbevf_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init ixgbevf pmd\n"); -#endif + if (rte_pmd_init_all() < 0) + rte_exit(EXIT_FAILURE, "Cannot init pmd\n"); if (rte_eal_pci_probe() < 0) rte_exit(EXIT_FAILURE, "Cannot probe PCI\n"); diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 0fcc0c3631..4d579c16de 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -974,15 +974,9 @@ MAIN(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "init_mem failed\n"); - /* init driver */ -#ifdef RTE_LIBRTE_IGB_PMD - if (rte_igb_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init igb pmd\n"); -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - if (rte_ixgbe_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init ixgbe pmd\n"); -#endif + /* init driver(s) */ + if (rte_pmd_init_all() < 0) + rte_exit(EXIT_FAILURE, "Cannot init pmd\n"); if (rte_eal_pci_probe() < 0) rte_exit(EXIT_FAILURE, "Cannot probe PCI\n"); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 8b209e1b5f..5f0fad6c93 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -614,14 +614,8 @@ MAIN(int argc, char **argv) rte_panic("Cannot init mbuf pool\n"); /* init driver(s) */ -#ifdef RTE_LIBRTE_IGB_PMD - if (rte_igb_pmd_init() < 0) - rte_panic("Cannot init igb pmd\n"); -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - if (rte_ixgbe_pmd_init() < 0) - rte_panic("Cannot init ixgbe pmd\n"); -#endif + if (rte_pmd_init_all() < 0) + rte_panic("Cannot init pmd\n"); if (rte_eal_pci_probe() < 0) rte_panic("Cannot probe PCI\n"); diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index 6e011528b2..f95e5ef848 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -387,16 +387,10 @@ app_init_nics(void) /* Init driver */ printf("Initializing the PMD driver ...\n"); -#ifdef RTE_LIBRTE_IGB_PMD - if (rte_igb_pmd_init() < 0) { - rte_panic("Cannot init IGB PMD\n"); + if (rte_pmd_init_all() < 0) { + rte_panic("Cannot init PMD\n"); } -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - if (rte_ixgbe_pmd_init() < 0) { - rte_panic("Cannot init IXGBE PMD\n"); - } -#endif + if (rte_eal_pci_probe() < 0) { rte_panic("Cannot probe PCI\n"); } diff --git a/examples/multi_process/client_server_mp/shared/init_drivers.h b/examples/multi_process/client_server_mp/shared/init_drivers.h index 1e73cc70cd..fc629ccff9 100644 --- a/examples/multi_process/client_server_mp/shared/init_drivers.h +++ b/examples/multi_process/client_server_mp/shared/init_drivers.h @@ -41,14 +41,7 @@ static inline int init_drivers(void) { - if ( -#ifdef RTE_LIBRTE_IGB_PMD - (rte_igb_pmd_init() < 0) || -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - (rte_ixgbe_pmd_init() < 0) || -#endif - (rte_eal_pci_probe() < 0 )) + if (rte_pmd_init_all() < 0 || rte_eal_pci_probe() < 0) return -1; return 0; diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index 96bb62bd2a..afbb3a4a2a 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -425,14 +425,8 @@ main(int argc, char **argv) /* probe to determine the NIC devices available */ proc_type = rte_eal_process_type(); -#ifdef RTE_LIBRTE_IGB_PMD - if (rte_igb_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init igb pmd\n"); -#endif -#ifdef RTE_LIBRTE_IXGBE_PMD - if (rte_ixgbe_pmd_init() < 0) - rte_exit(EXIT_FAILURE, "Cannot init ixgbe pmd\n"); -#endif + if (rte_pmd_init_all() < 0) + rte_exit(EXIT_FAILURE, "Cannot init pmd\n"); if (rte_eal_pci_probe() < 0) rte_exit(EXIT_FAILURE, "Cannot probe PCI\n"); if (rte_eth_dev_count() == 0) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index cb99d0c59d..048035750b 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -866,6 +866,24 @@ extern void rte_eth_driver_register(struct eth_driver *eth_drv); */ extern int rte_igb_pmd_init(void); +/** + * The initialization function of the driver for + * Intel(r) EM Gigabit Ethernet Controller devices. + * This function is invoked once at EAL start time. + * @return + * 0 on success + */ +extern int rte_em_pmd_init(void); + +/** + * The initialization function of the driver for 1Gbps Intel IGB_VF + * Ethernet devices. + * Invoked once at EAL start time. + * @return + * 0 on success + */ +extern int rte_igbvf_pmd_init(void); + /** * The initialization function of the driver for 10Gbps Intel IXGBE * Ethernet devices. @@ -884,6 +902,60 @@ extern int rte_ixgbe_pmd_init(void); */ extern int rte_ixgbevf_pmd_init(void); +/** + * The initialization function of *all* supported and enabled drivers. + * Right now, the following PMDs are supported: + * - igb + * - igbvf + * - em + * - ixgbe + * - ixgbevf + * This function is invoked once at EAL start time. + * @return + * 0 on success. + * Error code of the device initialization failure, + * -ENODEV if there are no drivers available + * (e.g. if all driver config options are = n). + */ +static inline +int rte_pmd_init_all(void) +{ + int ret = -ENODEV; + +#ifdef RTE_LIBRTE_IGB_PMD + if ((ret = rte_igb_pmd_init()) != 0) { + RTE_LOG(ERR, PMD, "Cannot init igb PMD\n"); + return (ret); + } + if ((ret = rte_igbvf_pmd_init()) != 0) { + RTE_LOG(ERR, PMD, "Cannot init igbvf PMD\n"); + return (ret); + } +#endif /* RTE_LIBRTE_IGB_PMD */ + +#ifdef RTE_LIBRTE_EM_PMD + if ((ret = rte_em_pmd_init()) != 0) { + RTE_LOG(ERR, PMD, "Cannot init em PMD\n"); + return (ret); + } +#endif /* RTE_LIBRTE_EM_PMD */ + +#ifdef RTE_LIBRTE_IXGBE_PMD + if ((ret = rte_ixgbe_pmd_init()) != 0) { + RTE_LOG(ERR, PMD, "Cannot init ixgbe PMD\n"); + return (ret); + } + if ((ret = rte_ixgbevf_pmd_init()) != 0) { + RTE_LOG(ERR, PMD, "Cannot init ixgbevf PMD\n"); + return (ret); + } +#endif /* RTE_LIBRTE_IXGBE_PMD */ + + if (ret == -ENODEV) + RTE_LOG(ERR, PMD, "No PMD(s) are configured\n"); + return (ret); +} + /** * Configure an Ethernet device. * This function must be invoked first before any other function in the @@ -1728,79 +1800,6 @@ int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr, int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr); -/*-------------------------- Deprecated definitions --------------------------*/ - -/* Needed to stop deprecation warnings becoming errors with GCC. */ -#ifndef __INTEL_COMPILER -#pragma GCC diagnostic warning "-Wdeprecated-declarations" -#endif - -#ifdef RTE_LIBRTE_82576_PMD -#pragma message "\nWARNING: CONFIG_RTE_LIBRTE_82576_PMD is deprecated. " \ -"CONFIG_RTE_LIBRTE_IGB_PMD must be set in the config file to use Intel(R) " \ -"DPDK supported Gigabit Ethernet Controllers." -#endif - -#ifdef RTE_LIBRTE_IGB_PMD -/** - * @deprecated The config file option CONFIG_RTE_LIBRTE_82576_PMD and resulting - * preprocessor define RTE_LIBRTE_82576_PMD are deprecated. - * CONFIG_RTE_LIBRTE_IGB_PMD must be set in the config file to use Intel(R) DPDK - * supported Gigabit Ethernet Controllers, and RTE_LIBRTE_IGB_PMD should be used - * in code. - */ -#define RTE_LIBRTE_82576_PMD 1 -#endif - -/** - * @deprecated rte_82576_pmd_init() is deprecated and will be removed from - * future versions of Intel(R) DPDK. It has been replaced by rte_igb_pmd_init(). - * - * @return - * 0 on success - */ -static inline int __attribute__((deprecated)) -rte_82576_pmd_init(void) { - RTE_LOG(WARNING, PMD, "rte_82576_pmd_init() is deprecated and will be " - "removed from future version of Intel(R) DPDK. It has " - "been replaced by rte_igb_pmd_init()"); - return rte_igb_pmd_init(); -} - - -#ifdef RTE_LIBRTE_82599_PMD -#pragma message "\nWARNING: CONFIG_RTE_LIBRTE_82599_PMD is deprecated. " \ -"CONFIG_RTE_LIBRTE_IXGBE_PMD must be set in the config file to use Intel(R) " \ -"DPDK supported 10 Gigabit Ethernet Controllers." -#endif - -#ifdef RTE_LIBRTE_IXGBE_PMD -/** - * @deprecated The config file option CONFIG_RTE_LIBRTE_82599_PMD and resulting - * preprocessor define RTE_LIBRTE_82599_PMD are deprecated. - * CONFIG_RTE_LIBRTE_IXGBE_PMD must be set in the config file to use Intel(R) - * DPDK supported Gigabit Ethernet Controllers, and RTE_LIBRTE_IXGBE_PMD should - * be used in code. - */ -#define RTE_LIBRTE_82599_PMD 1 -#endif - -/** - * @deprecated rte_82599_pmd_init() is deprecated and will be removed from - * future versions of Intel(R) DPDK. It has been replaced by - * rte_ixgbe_pmd_init(). - * - * @return - * 0 on success - */ -static inline int __attribute__((deprecated)) -rte_82599_pmd_init(void) { - RTE_LOG(WARNING, PMD, "rte_82599_pmd_init() is deprecated and will be " - "removed from future version of Intel(R) DPDK. It has " - "been replaced by rte_ixgbe_pmd_init()"); - return rte_ixgbe_pmd_init(); -} - #ifdef __cplusplus } #endif