From: Michal Kobylinski <michalx.kobylin...@intel.com>

This patch is adapting examples to use new rte_lpm structures. 

Signed-off-by: Michal Kobylinski <michalx.kobylinski at intel.com>
---
 examples/ip_fragmentation/main.c | 10 +++++-----
 examples/ip_reassembly/main.c    |  9 +++++----
 examples/l3fwd-power/main.c      |  2 +-
 examples/l3fwd-vf/main.c         |  2 +-
 examples/l3fwd/main.c            | 16 ++++++++--------
 examples/load_balancer/runtime.c |  3 +--
 6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index fbc0b8d..41df0b1 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -266,8 +266,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct 
lcore_queue_conf *qconf,
                uint8_t queueid, uint8_t port_in)
 {
        struct rx_queue *rxq;
-       uint32_t i, len;
-       uint8_t next_hop, port_out, ipv6;
+       uint32_t i, len, next_hop;
+       uint8_t next_hop6, port_out, ipv6;
        int32_t len2;

        ipv6 = 0;
@@ -327,9 +327,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct 
lcore_queue_conf *qconf,
                ip_hdr = rte_pktmbuf_mtod(m, struct ipv6_hdr *);

                /* Find destination port */
-               if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, &next_hop) == 
0 &&
-                               (enabled_port_mask & 1 << next_hop) != 0) {
-                       port_out = next_hop;
+               if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, &next_hop6) == 
0 &&
+                               (enabled_port_mask & 1 << next_hop6) != 0) {
+                       port_out = next_hop6;

                        /* Build transmission burst for new port */
                        len = qconf->tx_mbufs[port_out].len;
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 741c398..4a9dcbe 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -347,7 +347,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t 
queue,
        struct rte_ip_frag_death_row *dr;
        struct rx_queue *rxq;
        void *d_addr_bytes;
-       uint8_t next_hop, dst_port;
+       uint8_t dst_port, next_hop6;
+       uint32_t next_hop;

        rxq = &qconf->rx_queue_list[queue];

@@ -427,9 +428,9 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t 
queue,
                }

                /* Find destination port */
-               if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, &next_hop) == 
0 &&
-                               (enabled_port_mask & 1 << next_hop) != 0) {
-                       dst_port = next_hop;
+               if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, &next_hop6) == 
0 &&
+                               (enabled_port_mask & 1 << next_hop6) != 0) {
+                       dst_port = next_hop6;
                }

                eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv6);
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 8bb88ce..f647713 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -631,7 +631,7 @@ static inline uint8_t
 get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint8_t portid,
                lookup_struct_t *ipv4_l3fwd_lookup_struct)
 {
-       uint8_t next_hop;
+       uint32_t next_hop;

        return (uint8_t) ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct,
                        rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop) == 0)?
diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c
index 01f610e..193c3ab 100644
--- a/examples/l3fwd-vf/main.c
+++ b/examples/l3fwd-vf/main.c
@@ -440,7 +440,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)?
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 1f3e5c6..0f410f0 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -710,7 +710,7 @@ get_ipv6_dst_port(void *ipv6_hdr,  uint8_t portid, 
lookup_struct_t * ipv6_l3fwd_
 static inline uint8_t
 get_ipv4_dst_port(void *ipv4_hdr,  uint8_t portid, lookup_struct_t * 
ipv4_l3fwd_lookup_struct)
 {
-       uint8_t next_hop;
+       uint32_t next_hop;

        return (uint8_t) ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct,
                rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr),
@@ -1151,7 +1151,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, 
struct lcore_conf *qcon
  * to BAD_PORT value.
  */
 static inline __attribute__((always_inline)) void
-rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype)
+rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint32_t *dp, uint32_t ptype)
 {
        uint8_t ihl;

@@ -1182,7 +1182,7 @@ static inline __attribute__((always_inline)) uint16_t
 get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
        uint32_t dst_ipv4, uint8_t portid)
 {
-       uint8_t next_hop;
+       uint32_t next_hop;
        struct ipv6_hdr *ipv6_hdr;
        struct ether_hdr *eth_hdr;

@@ -1194,7 +1194,7 @@ get_dst_port(const struct lcore_conf *qconf, struct 
rte_mbuf *pkt,
                eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
                ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1);
                if (rte_lpm6_lookup(qconf->ipv6_lookup_struct,
-                               ipv6_hdr->dst_addr, &next_hop) != 0)
+                               ipv6_hdr->dst_addr, (uint8_t *)&next_hop) != 0)
                        next_hop = portid;
        } else {
                next_hop = portid;
@@ -1205,7 +1205,7 @@ get_dst_port(const struct lcore_conf *qconf, struct 
rte_mbuf *pkt,

 static inline void
 process_packet(struct lcore_conf *qconf, struct rte_mbuf *pkt,
-       uint16_t *dst_port, uint8_t portid)
+       uint32_t *dst_port, uint8_t portid)
 {
        struct ether_hdr *eth_hdr;
        struct ipv4_hdr *ipv4_hdr;
@@ -1275,7 +1275,7 @@ processx4_step2(const struct lcore_conf *qconf,
                uint32_t ipv4_flag,
                uint8_t portid,
                struct rte_mbuf *pkt[FWDSTEP],
-               uint16_t dprt[FWDSTEP])
+               uint32_t dprt[FWDSTEP])
 {
        rte_xmm_t dst;
        const  __m128i bswap_mask = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, 11,
@@ -1301,7 +1301,7 @@ processx4_step2(const struct lcore_conf *qconf,
  * Perform RFC1812 checks and updates for IPV4 packets.
  */
 static inline void
-processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP])
+processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint32_t dst_port[FWDSTEP])
 {
        __m128i te[FWDSTEP];
        __m128i ve[FWDSTEP];
@@ -1527,7 +1527,7 @@ main_loop(__attribute__((unused)) void *dummy)
        int32_t k;
        uint16_t dlp;
        uint16_t *lp;
-       uint16_t dst_port[MAX_PKT_BURST];
+       uint32_t dst_port[MAX_PKT_BURST];
        __m128i dip[MAX_PKT_BURST / FWDSTEP];
        uint32_t ipv4_flag[MAX_PKT_BURST / FWDSTEP];
        uint16_t pnum[MAX_PKT_BURST + 1];
diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c
index 2b265c2..bca63de 100644
--- a/examples/load_balancer/runtime.c
+++ b/examples/load_balancer/runtime.c
@@ -524,8 +524,7 @@ app_lcore_worker(
                for (j = 0; j < bsz_rd; j ++) {
                        struct rte_mbuf *pkt;
                        struct ipv4_hdr *ipv4_hdr;
-                       uint32_t ipv4_dst, pos;
-                       uint8_t port;
+                       uint32_t ipv4_dst, pos, port;

                        if (likely(j < bsz_rd - 1)) {
                                
APP_WORKER_PREFETCH1(rte_pktmbuf_mtod(lp->mbuf_in.array[j+1], unsigned char *));
-- 
1.9.1

Reply via email to