X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fload_balancer%2Finit.c;h=e07850be17e3738c9b0fa56ad35e7a88a9cf7de0;hb=cda291fb8ada5882205dd7785e4f318920cecf1c;hp=09ba3ff8f10c33ae7fd1d4c36e61da9d4b869aa5;hpb=8a387fa85f02ed64f755e0baa72e567d1917af48;p=dpdk.git diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index 09ba3ff8f1..e07850be17 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -95,26 +94,6 @@ static struct rte_eth_conf port_conf = { }, }; -static struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = APP_DEFAULT_NIC_RX_PTHRESH, - .hthresh = APP_DEFAULT_NIC_RX_HTHRESH, - .wthresh = APP_DEFAULT_NIC_RX_WTHRESH, - }, - .rx_free_thresh = APP_DEFAULT_NIC_RX_FREE_THRESH, - .rx_drop_en = APP_DEFAULT_NIC_RX_DROP_EN, -}; - -static struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = APP_DEFAULT_NIC_TX_PTHRESH, - .hthresh = APP_DEFAULT_NIC_TX_HTHRESH, - .wthresh = APP_DEFAULT_NIC_TX_WTHRESH, - }, - .tx_free_thresh = APP_DEFAULT_NIC_TX_FREE_THRESH, - .tx_rs_thresh = APP_DEFAULT_NIC_TX_RS_THRESH, -}; - static void app_assign_worker_ids(void) { @@ -146,18 +125,12 @@ app_init_mbuf_pools(void) continue; } - rte_snprintf(name, sizeof(name), "mbuf_pool_%u", socket); + snprintf(name, sizeof(name), "mbuf_pool_%u", socket); printf("Creating the mbuf pool for socket %u ...\n", socket); - app.pools[socket] = rte_mempool_create( - name, - APP_DEFAULT_MEMPOOL_BUFFERS, - APP_DEFAULT_MBUF_SIZE, + app.pools[socket] = rte_pktmbuf_pool_create( + name, APP_DEFAULT_MEMPOOL_BUFFERS, APP_DEFAULT_MEMPOOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socket, - 0); + 0, APP_DEFAULT_MBUF_DATA_SIZE, socket); if (app.pools[socket] == NULL) { rte_panic("Cannot create mbuf pool on socket %u\n", socket); } @@ -187,13 +160,17 @@ app_init_lpm_tables(void) continue; } - rte_snprintf(name, sizeof(name), "lpm_table_%u", socket); + struct rte_lpm_config lpm_config; + + lpm_config.max_rules = APP_MAX_LPM_RULES; + lpm_config.number_tbl8s = 256; + lpm_config.flags = 0; + snprintf(name, sizeof(name), "lpm_table_%u", socket); printf("Creating the LPM table for socket %u ...\n", socket); app.lpm_tables[socket] = rte_lpm_create( name, socket, - APP_MAX_LPM_RULES, - 0); + &lpm_config); if (app.lpm_tables[socket] == NULL) { rte_panic("Unable to create LPM table on socket %u\n", socket); } @@ -259,7 +236,7 @@ app_init_rings_rx(void) lcore, socket_io, lcore_worker); - rte_snprintf(name, sizeof(name), "app_ring_rx_s%u_io%u_w%u", + snprintf(name, sizeof(name), "app_ring_rx_s%u_io%u_w%u", socket_io, lcore, lcore_worker); @@ -342,7 +319,7 @@ app_init_rings_tx(void) printf("Creating ring to connect worker lcore %u with TX port %u (through I/O lcore %u) (socket %u) ...\n", lcore, port, (unsigned)lcore_io, (unsigned)socket_io); - rte_snprintf(name, sizeof(name), "app_ring_tx_s%u_w%u_p%u", socket_io, lcore, port); + snprintf(name, sizeof(name), "app_ring_tx_s%u_w%u_p%u", socket_io, lcore, port); ring = rte_ring_create( name, app.ring_tx_size, @@ -418,7 +395,7 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask) continue; } /* clear all_ports_up flag if any link down */ - if (link.link_status == 0) { + if (link.link_status == ETH_LINK_DOWN) { all_ports_up = 0; break; } @@ -450,10 +427,6 @@ app_init_nics(void) int ret; uint32_t n_rx_queues, n_tx_queues; - if (rte_eal_pci_probe() < 0) { - rte_panic("Cannot probe PCI\n"); - } - /* Init NIC ports and queues, then start the ports */ for (port = 0; port < APP_MAX_NIC_PORTS; port ++) { struct rte_mempool *pool; @@ -495,7 +468,7 @@ app_init_nics(void) queue, (uint16_t) app.nic_rx_ring_size, socket, - &rx_conf, + NULL, pool); if (ret < 0) { rte_panic("Cannot init RX queue %u for port %u (%d)\n", @@ -516,7 +489,7 @@ app_init_nics(void) 0, (uint16_t) app.nic_tx_ring_size, socket, - &tx_conf); + NULL); if (ret < 0) { rte_panic("Cannot init TX queue 0 for port %d (%d)\n", port,