doc: add device specific API
[dpdk.git] / examples / load_balancer / runtime.c
index b69917b..6944325 100644 (file)
@@ -48,7 +48,6 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
-#include <rte_tailq.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_launch.h>
@@ -526,7 +525,7 @@ app_lcore_worker(
                        struct rte_mbuf *pkt;
                        struct ipv4_hdr *ipv4_hdr;
                        uint32_t ipv4_dst, pos;
-                       uint8_t port;
+                       uint32_t port;
 
                        if (likely(j < bsz_rd - 1)) {
                                APP_WORKER_PREFETCH1(rte_pktmbuf_mtod(lp->mbuf_in.array[j+1], unsigned char *));
@@ -536,11 +535,13 @@ app_lcore_worker(
                        }
 
                        pkt = lp->mbuf_in.array[j];
-                       ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, unsigned char *) + sizeof(struct ether_hdr));
+                       ipv4_hdr = rte_pktmbuf_mtod_offset(pkt,
+                                                          struct ipv4_hdr *,
+                                                          sizeof(struct ether_hdr));
                        ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
 
                        if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) {
-                               port = pkt->in_port;
+                               port = pkt->port;
                        }
 
                        pos = lp->mbuf_out[port].n_mbufs;