X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fl3fwd-vf%2Fmain.c;h=6e8726e857c4fd3f139aa19de1f7885b74747e6a;hb=b6df9fc8715f9a925136006b18fdd65f9c621757;hp=a7f4cce203f68e0da14b91dfd32bf8a672047d03;hpb=af75078fece3615088e561357c1e97603e43a5fe;p=dpdk.git diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index a7f4cce203..6e8726e857 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -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 @@ -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 @@ -87,8 +86,6 @@ #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) #include -#include -#include #elif (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) #include #else @@ -196,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, }, }; @@ -225,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 +#define DEFAULT_HASH_FUNC rte_hash_crc +#else +#include +#define DEFAULT_HASH_FUNC rte_jhash +#endif + struct ipv4_5tuple { uint32_t ip_dst; uint32_t ip_src; @@ -254,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, }; @@ -472,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 = ð_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 */ @@ -855,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); @@ -961,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");