ethdev: init all builtin drivers
[dpdk.git] / examples / l3fwd / main.c
index 3b6e5b6..4d579c1 100644 (file)
@@ -30,7 +30,6 @@
  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * 
- *  version: DPDK.L.1.2.3-3
  */
 
 #include <stdio.h>
@@ -87,8 +86,6 @@
 
 #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH)
 #include <rte_hash.h>
-#include <rte_hash_crc.h>
-#include <rte_jhash.h>
 #elif (APP_LOOKUP_METHOD == APP_LOOKUP_LPM)
 #include <rte_lpm.h>
 #else
@@ -226,6 +223,15 @@ static struct rte_mempool * pktmbuf_pool[NB_SOCKETS];
 
 
 #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH)
+
+#ifdef RTE_MACHINE_CPUFLAG_SSE4_2
+#include <rte_hash_crc.h>
+#define DEFAULT_HASH_FUNC       rte_hash_crc
+#else
+#include <rte_jhash.h>
+#define DEFAULT_HASH_FUNC       rte_jhash
+#endif
+
 struct ipv4_5tuple {
        uint32_t ip_dst;
        uint32_t ip_src;
@@ -968,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");