>From cfaf9c28dbff3bec0c867aa4270b01b04bf50276 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Sat, 27 Jun 2015 22:42:42 +0000 Subject: [PATCH 7/8] examples: update examples to use 24 bit extended next hop Signed-off-by: Matthew Hall --- examples/ip_reassembly/main.c | 3 ++- examples/l3fwd-power/main.c | 2 +- examples/l3fwd-vf/main.c | 2 +- examples/l3fwd/main.c | 16 ++++++++-------- examples/load_balancer/runtime.c | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 741c398..86e33a7 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; + uint32_t next_hop; + uint8_t dst_port; rxq = &qconf->rx_queue_list[queue]; 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..4f31e52 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), @@ -720,7 +720,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint8_t portid, lookup_struct_t * ipv4_l3fwd_ static inline uint8_t get_ipv6_dst_port(void *ipv6_hdr, uint8_t portid, lookup6_struct_t * ipv6_l3fwd_lookup_struct) { - uint8_t next_hop; + uint32_t next_hop; return (uint8_t) ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, ((struct ipv6_hdr*)ipv6_hdr)->dst_addr, &next_hop) == 0)? next_hop : portid); @@ -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; @@ -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..6944325 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -525,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 *)); -- 1.9.1