ethdev: init all builtin drivers

Signed-off-by: Intel
This commit is contained in:
Intel 2012-12-20 00:00:00 +01:00 committed by Thomas Monjalon
parent d6537e6a74
commit 69d22b8e66
12 changed files with 96 additions and 170 deletions

View File

@ -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");

View File

@ -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();

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");
}

View File

@ -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;

View File

@ -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)

View File

@ -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