X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Ficmpecho.c;h=af6f7e7902e4e4bda8e839bea8f3958ce4cf30c4;hb=3127f99274b679124658afdbfc49210730c50617;hp=949cc558da8ff60a45e9b0134dc864dfd71b2d0c;hpb=ecaeed4f1d042b4317f756ad49ab4d918d0e4f76;p=dpdk.git diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 949cc558da..af6f7e7902 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 @@ -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,7 +278,7 @@ 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 rte_ipv4_hdr *ip_h; struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; @@ -293,27 +293,19 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) uint32_t cksum; uint8_t i; int l2_len; -#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES - uint64_t start_tsc; - uint64_t end_tsc; - uint64_t core_cycles; -#endif + uint64_t start_tsc = 0; -#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES - start_tsc = rte_rdtsc(); -#endif + get_start_cycles(&start_tsc); /* * First, receive a burst of packets. */ nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst, nb_pkt_per_burst); + inc_rx_burst_stats(fs, nb_rx); if (unlikely(nb_rx == 0)) return; -#ifdef RTE_TEST_PMD_RECORD_BURST_STATS - fs->rx_burst_stats.pkt_burst_spread[nb_rx]++; -#endif fs->rx_packets += nb_rx; nb_replies = 0; for (i = 0; i < nb_rx; i++) { @@ -360,7 +352,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 != RTE_ETHER_TYPE_IPv4) || + (arp_pro != RTE_ETHER_TYPE_IPV4) || (arp_h->arp_hlen != 6) || (arp_h->arp_plen != 4) ) { @@ -414,11 +406,11 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) continue; } - if (eth_type != RTE_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); @@ -431,7 +423,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * Check if packet is a ICMP echo request. */ icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { @@ -509,9 +501,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) } } fs->tx_packets += nb_tx; -#ifdef RTE_TEST_PMD_RECORD_BURST_STATS - fs->tx_burst_stats.pkt_burst_spread[nb_tx]++; -#endif + inc_tx_burst_stats(fs, nb_tx); if (unlikely(nb_tx < nb_replies)) { fs->fwd_dropped += (nb_replies - nb_tx); do { @@ -520,11 +510,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) } } -#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES - end_tsc = rte_rdtsc(); - core_cycles = (end_tsc - start_tsc); - fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles); -#endif + get_end_cycles(fs, start_tsc); } struct fwd_engine icmp_echo_engine = {