X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Ficmpecho.c;h=78e3adf2c10692a7acafd1ca61daf27173c42477;hb=4940344dab1d4da95ec6cd9f4fa8ac1fbc61ba54;hp=f41179208108a6ad28dc0528bf7f8646628d2f40;hpb=538da7a1cad25fbdffe298c8ca76fc4dbd262d1b;p=dpdk.git diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index f411792081..78e3adf2c1 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -188,7 +188,7 @@ ip_proto_name(uint16_t ip_proto) "PIM", /**< Protocol Independent Mcast */ }; - if (ip_proto < sizeof(ip_proto_names) / sizeof(ip_proto_names[0])) + if (ip_proto < RTE_DIM(ip_proto_names)) return ip_proto_names[ip_proto]; switch (ip_proto) { #ifdef IPPROTO_PGM @@ -223,9 +223,9 @@ ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf) static void ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, ea); if (what) printf("%s", what); printf("%s", buf); @@ -243,7 +243,7 @@ ipv4_addr_dump(const char *what, uint32_t be_ipv4_addr) } static uint16_t -ipv4_hdr_cksum(struct ipv4_hdr *ip_h) +ipv4_hdr_cksum(struct rte_ipv4_hdr *ip_h) { uint16_t *v16_h; uint32_t ip_cksum; @@ -278,8 +278,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_ether_hdr *eth_h; struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; - struct ipv4_hdr *ip_h; - struct icmp_hdr *icmp_h; + struct rte_ipv4_hdr *ip_h; + struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; uint32_t ip_addr; @@ -308,12 +308,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) */ nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst, nb_pkt_per_burst); - if (unlikely(nb_rx == 0)) - return; - #ifdef RTE_TEST_PMD_RECORD_BURST_STATS fs->rx_burst_stats.pkt_burst_spread[nb_rx]++; #endif + if (unlikely(nb_rx == 0)) + return; + fs->rx_packets += nb_rx; nb_replies = 0; for (i = 0; i < nb_rx; i++) { @@ -330,7 +330,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_dump(" ETH: src=", ð_h->s_addr); ether_addr_dump(" dst=", ð_h->d_addr); } - if (eth_type == ETHER_TYPE_VLAN) { + if (eth_type == RTE_ETHER_TYPE_VLAN) { vlan_h = (struct rte_vlan_hdr *) ((char *)eth_h + sizeof(struct rte_ether_hdr)); l2_len += sizeof(struct rte_vlan_hdr); @@ -346,7 +346,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) } /* Reply to ARP requests */ - if (eth_type == ETHER_TYPE_ARP) { + if (eth_type == RTE_ETHER_TYPE_ARP) { arp_h = (struct rte_arp_hdr *) ((char *)eth_h + l2_len); arp_op = RTE_BE_TO_CPU_16(arp_h->arp_opcode); arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_protocol); @@ -360,7 +360,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) } if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != RTE_ARP_HRD_ETHER) || - (arp_pro != ETHER_TYPE_IPv4) || + (arp_pro != RTE_ETHER_TYPE_IPV4) || (arp_h->arp_hlen != 6) || (arp_h->arp_plen != 4) ) { @@ -414,11 +414,11 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) continue; } - if (eth_type != ETHER_TYPE_IPv4) { + if (eth_type != RTE_ETHER_TYPE_IPV4) { rte_pktmbuf_free(pkt); continue; } - ip_h = (struct ipv4_hdr *) ((char *)eth_h + l2_len); + ip_h = (struct rte_ipv4_hdr *) ((char *)eth_h + l2_len); if (verbose_level > 0) { ipv4_addr_dump(" IPV4: src=", ip_h->src_addr); ipv4_addr_dump(" dst=", ip_h->dst_addr); @@ -430,10 +430,10 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) /* * Check if packet is a ICMP echo request. */ - icmp_h = (struct icmp_hdr *) ((char *)ip_h + - sizeof(struct ipv4_hdr)); + icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + + sizeof(struct rte_ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && - (icmp_h->icmp_type == IP_ICMP_ECHO_REQUEST) && + (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { rte_pktmbuf_free(pkt); continue; @@ -457,7 +457,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * - switch the request IP source and destination * addresses in the reply IP header, * - keep the IP header checksum unchanged. - * - set IP_ICMP_ECHO_REPLY in ICMP header. + * - set RTE_IP_ICMP_ECHO_REPLY in ICMP header. * ICMP checksum is computed by assuming it is valid in the * echo request and not verified. */ @@ -480,10 +480,10 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ip_h->src_addr = ip_h->dst_addr; ip_h->dst_addr = ip_addr; } - icmp_h->icmp_type = IP_ICMP_ECHO_REPLY; + icmp_h->icmp_type = RTE_IP_ICMP_ECHO_REPLY; cksum = ~icmp_h->icmp_cksum & 0xffff; - cksum += ~htons(IP_ICMP_ECHO_REQUEST << 8) & 0xffff; - cksum += htons(IP_ICMP_ECHO_REPLY << 8); + cksum += ~htons(RTE_IP_ICMP_ECHO_REQUEST << 8) & 0xffff; + cksum += htons(RTE_IP_ICMP_ECHO_REPLY << 8); cksum = (cksum & 0xffff) + (cksum >> 16); cksum = (cksum & 0xffff) + (cksum >> 16); icmp_h->icmp_cksum = ~cksum;