examples/multi_process: remove unused variable
[dpdk.git] / examples / multi_process / l2fwd_fork / main.c
index aebf531..59c1024 100644 (file)
@@ -77,8 +77,7 @@
 
 #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
 #define MBUF_NAME      "mbuf_pool_%d"
-#define MBUF_SIZE      \
-(RTE_MBUF_DEFAULT_DATAROOM + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
+#define MBUF_DATA_SIZE RTE_MBUF_DEFAULT_BUF_SIZE
 #define NB_MBUF   8192
 #define RING_MASTER_NAME       "l2fwd_ring_m2s_"
 #define RING_SLAVE_NAME                "l2fwd_ring_s2m_"
@@ -163,7 +162,7 @@ static const struct rte_eth_conf port_conf = {
                .hw_ip_checksum = 0, /**< IP checksum offload disabled */
                .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 */
        },
        .txmode = {
                .mq_mode = ETH_MQ_TX_NONE,
@@ -442,7 +441,8 @@ reset_slave_all_ports(unsigned slaveid)
                pool = rte_mempool_lookup(buf_name);
                if (pool)
                        printf("Port %d mempool free object is %u(%u)\n", slave->port[i],
-                               rte_mempool_count(pool), (unsigned)NB_MBUF);
+                               rte_mempool_avail_count(pool),
+                               (unsigned int)NB_MBUF);
                else
                        printf("Can't find mempool %s\n", buf_name);
 
@@ -671,6 +671,8 @@ l2fwd_main_loop(void)
                                        port_statistics[portid].tx += sent;
 
                        }
+
+                       prev_tsc = cur_tsc;
                }
 
                /*
@@ -864,7 +866,7 @@ l2fwd_parse_args(int argc, char **argv)
                return -1;
        }
        ret = optind-1;
-       optind = 0; /* reset getopt lib */
+       optind = 1; /* reset getopt lib */
        return ret;
 }
 
@@ -900,7 +902,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;
                        }
@@ -935,7 +937,6 @@ main(int argc, char **argv)
        unsigned rx_lcore_id;
        unsigned nb_ports_in_mask = 0;
        unsigned i;
-       int flags = 0;
        uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc;
 
        /* Save cpu_affinity first, restore it in case it's floating process option */
@@ -979,26 +980,18 @@ main(int argc, char **argv)
        if (nb_ports == 0)
                rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
 
-       if (nb_ports > RTE_MAX_ETHPORTS)
-               nb_ports = RTE_MAX_ETHPORTS;
-
        /* create the mbuf pool */
        for (portid = 0; portid < nb_ports; portid++) {
                /* skip ports that are not enabled */
                if ((l2fwd_enabled_port_mask & (1 << portid)) == 0)
                        continue;
                char buf_name[RTE_MEMPOOL_NAMESIZE];
-               flags = MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET;
                snprintf(buf_name, RTE_MEMPOOL_NAMESIZE, MBUF_NAME, portid);
                l2fwd_pktmbuf_pool[portid] =
-                       rte_mempool_create(buf_name, NB_MBUF,
-                                          MBUF_SIZE, 32,
-                                          sizeof(struct rte_pktmbuf_pool_private),
-                                          rte_pktmbuf_pool_init, NULL,
-                                          rte_pktmbuf_init, NULL,
-                                          rte_socket_id(), flags);
+                       rte_pktmbuf_pool_create(buf_name, NB_MBUF, 32,
+                               0, MBUF_DATA_SIZE, rte_socket_id());
                if (l2fwd_pktmbuf_pool[portid] == NULL)
-                       rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
+                       rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
 
                printf("Create mbuf %s\n", buf_name);
        }