net/mlx5: replace network to host macros
[dpdk.git] / examples / load_balancer / init.c
index 5a56078..717232e 100644 (file)
@@ -49,7 +49,6 @@
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
-#include <rte_per_lcore.h>
 #include <rte_launch.h>
 #include <rte_atomic.h>
 #include <rte_cycles.h>
@@ -81,7 +80,7 @@ static struct rte_eth_conf port_conf = {
                .hw_ip_checksum = 1, /**< IP checksum offload enabled */
                .hw_vlan_filter = 0, /**< VLAN filtering disabled */
                .jumbo_frame    = 0, /**< Jumbo Frame Support disabled */
-               .hw_strip_crc   = 0, /**< CRC stripped by hardware */
+               .hw_strip_crc   = 1, /**< CRC stripped by hardware */
        },
        .rx_adv_conf = {
                .rss_conf = {
@@ -160,13 +159,17 @@ app_init_lpm_tables(void)
                        continue;
                }
 
+               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);
                }
@@ -391,7 +394,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;
                        }
@@ -426,6 +429,8 @@ app_init_nics(void)
        /* Init NIC ports and queues, then start the ports */
        for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
                struct rte_mempool *pool;
+               uint16_t nic_rx_ring_size;
+               uint16_t nic_tx_ring_size;
 
                n_rx_queues = app_get_nic_rx_queues_per_port(port);
                n_tx_queues = app.nic_tx_port_mask[port];
@@ -446,6 +451,17 @@ app_init_nics(void)
                }
                rte_eth_promiscuous_enable(port);
 
+               nic_rx_ring_size = app.nic_rx_ring_size;
+               nic_tx_ring_size = app.nic_tx_ring_size;
+               ret = rte_eth_dev_adjust_nb_rx_tx_desc(
+                       port, &nic_rx_ring_size, &nic_tx_ring_size);
+               if (ret < 0) {
+                       rte_panic("Cannot adjust number of descriptors for port %u (%d)\n",
+                               (unsigned) port, ret);
+               }
+               app.nic_rx_ring_size = nic_rx_ring_size;
+               app.nic_tx_ring_size = nic_tx_ring_size;
+
                /* Init RX queues */
                for (queue = 0; queue < APP_MAX_RX_QUEUES_PER_NIC_PORT; queue ++) {
                        if (app.nic_rx_queue_mask[port][queue] == 0) {