update copyright date to 2013
[dpdk.git] / examples / l3fwd-vf / main.c
index 6f8d22b..6e8726e 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  * 
- *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
  *   All rights reserved.
  * 
  *   Redistribution and use in source and binary forms, with or without 
@@ -86,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
@@ -195,10 +193,11 @@ static struct rte_eth_conf port_conf = {
        .rx_adv_conf = {
                .rss_conf = {
                        .rss_key = NULL,
-                       .rss_hf = ETH_RSS_IPV4,
+                       .rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6,
                },
        },
        .txmode = {
+               .mq_mode = ETH_DCB_NONE,
        },
 };
 
@@ -224,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;
@@ -253,7 +261,7 @@ struct rte_hash_parameters l3fwd_hash_params = {
        .entries = L3FWD_HASH_ENTRIES,
        .bucket_entries = 4,
        .key_len = sizeof(struct ipv4_5tuple),
-       .hash_func = rte_hash_crc,
+       .hash_func = DEFAULT_HASH_FUNC,
        .hash_func_init_val = 0,
        .socket_id = SOCKET0,
 };
@@ -471,9 +479,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, lookup_struct_t * l3fwd
        if (dst_port >= MAX_PORTS || (enabled_port_mask & 1 << dst_port) == 0)
                dst_port = portid;
 
-       /* 00:09:c0:00:00:xx */
+       /* 02:00:00:00:00:xx */
        tmp = &eth_hdr->d_addr.addr_bytes[0];
-       *((uint64_t *)tmp) = 0x000000c00900 + (dst_port << 24);
+       *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40);
 
 #ifdef DO_RFC_1812_CHECKS
        /* Update time to live and header checksum */
@@ -854,7 +862,7 @@ setup_lpm(int socketid)
        /* create the LPM table */
        rte_snprintf(s, sizeof(s), "L3FWD_LPM_%d", socketid);
        l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid,
-                               L3FWD_LPM_MAX_RULES, RTE_LPM_MEMZONE);
+                               L3FWD_LPM_MAX_RULES, 0);
        if (l3fwd_lookup_struct[socketid] == NULL)
                rte_exit(EXIT_FAILURE, "Unable to create the l3fwd LPM table"
                                " on socket %d\n", socketid);
@@ -960,17 +968,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");