remove unused ring includes
[dpdk.git] / examples / l3fwd-vf / main.c
index 20ba03a..f56e8db 100644 (file)
@@ -65,7 +65,6 @@
 #include <rte_debug.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_ip.h>
@@ -94,8 +93,6 @@
 
 #define MEMPOOL_CACHE_SIZE 256
 
-#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
-
 /*
  * This expression is used to calculate the number of mbufs needed depending on user input, taking
  *  into account memory for rx and tx hardware rings, cache per lcore and mtable per port per lcore.
@@ -253,7 +250,6 @@ static lookup_struct_t *l3fwd_lookup_struct[NB_SOCKETS];
 struct rte_hash_parameters l3fwd_hash_params = {
        .name = "l3fwd_hash_0",
        .entries = L3FWD_HASH_ENTRIES,
-       .bucket_entries = 4,
        .key_len = sizeof(struct ipv4_5tuple),
        .hash_func = DEFAULT_HASH_FUNC,
        .hash_func_init_val = 0,
@@ -443,7 +439,7 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr,  uint8_t portid, lookup_struct_t * l3fwd
 static inline uint8_t
 get_dst_port(struct ipv4_hdr *ipv4_hdr,  uint8_t portid, lookup_struct_t * l3fwd_lookup_struct)
 {
-       uint8_t next_hop;
+       uint32_t next_hop;
 
        return (uint8_t) ((rte_lpm_lookup(l3fwd_lookup_struct,
                        rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop) == 0)?
@@ -461,8 +457,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, lookup_struct_t * l3fwd
 
        eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
 
-       ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, unsigned char *) +
-                               sizeof(struct ether_hdr));
+       ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *,
+                                          sizeof(struct ether_hdr));
 
 #ifdef DO_RFC_1812_CHECKS
        /* Check to make sure the packet is valid (RFC1812) */
@@ -872,10 +868,16 @@ setup_lpm(int socketid)
        int ret;
        char s[64];
 
+       struct rte_lpm_config lpm_ipv4_config;
+
+       lpm_ipv4_config.max_rules = L3FWD_LPM_MAX_RULES;
+       lpm_ipv4_config.number_tbl8s = 256;
+       lpm_ipv4_config.flags = 0;
+
        /* create the LPM table */
        snprintf(s, sizeof(s), "L3FWD_LPM_%d", socketid);
-       l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid,
-                               L3FWD_LPM_MAX_RULES, 0);
+       l3fwd_lookup_struct[socketid] =
+                       rte_lpm_create(s, socketid, &lpm_ipv4_config);
        if (l3fwd_lookup_struct[socketid] == NULL)
                rte_exit(EXIT_FAILURE, "Unable to create the l3fwd LPM table"
                                " on socket %d\n", socketid);
@@ -924,13 +926,9 @@ init_mem(unsigned nb_mbuf)
                }
                if (pktmbuf_pool[socketid] == NULL) {
                        snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
-                       pktmbuf_pool[socketid] =
-                               rte_mempool_create(s, nb_mbuf, MBUF_SIZE,
-                                                  MEMPOOL_CACHE_SIZE,
-                                       sizeof(struct rte_pktmbuf_pool_private),
-                                       rte_pktmbuf_pool_init, NULL,
-                                       rte_pktmbuf_init, NULL,
-                                       socketid, 0);
+                       pktmbuf_pool[socketid] = rte_pktmbuf_pool_create(s,
+                               nb_mbuf, MEMPOOL_CACHE_SIZE, 0,
+                               RTE_MBUF_DEFAULT_BUF_SIZE, socketid);
                        if (pktmbuf_pool[socketid] == NULL)
                                rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", socketid);
                        else
@@ -983,8 +981,6 @@ main(int argc, char **argv)
                rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
 
        nb_ports = rte_eth_dev_count();
-       if (nb_ports > RTE_MAX_ETHPORTS)
-               nb_ports = RTE_MAX_ETHPORTS;
 
        if (check_port_config(nb_ports) < 0)
                rte_exit(EXIT_FAILURE, "check_port_config failed\n");