From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id C72677F78 for ; Tue, 18 Nov 2014 08:27:27 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 17 Nov 2014 23:35:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,408,1413270000"; d="scan'208";a="638795291" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 17 Nov 2014 23:37:46 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id sAI7biBS006491; Tue, 18 Nov 2014 15:37:44 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id sAI7bgDr007599; Tue, 18 Nov 2014 15:37:44 +0800 Received: (from jijiangl@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sAI7bgF1007595; Tue, 18 Nov 2014 15:37:42 +0800 From: Jijiang Liu To: dev@dpdk.org Date: Tue, 18 Nov 2014 15:37:31 +0800 Message-Id: <1416296251-7534-5-git-send-email-jijiang.liu@intel.com> X-Mailer: git-send-email 1.7.12.2 In-Reply-To: <1416296251-7534-1-git-send-email-jijiang.liu@intel.com> References: <1416296251-7534-1-git-send-email-jijiang.liu@intel.com> Subject: [dpdk-dev] [PATCH 4/4] testpmd:application changes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2014 07:27:28 -0000 Change the codes in testpmd due to introducing abstract packet type. Signed-off-by: Jijiang Liu --- app/test-pmd/csumonly.c | 12 ++++++------ app/test-pmd/rxonly.c | 20 +++++++++----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 8d10bfd..d9948e7 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -219,6 +219,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) struct tcp_hdr *inner_tcp_hdr; struct sctp_hdr *sctp_hdr; struct sctp_hdr *inner_sctp_hdr; + enum rte_eth_packet_type packet_type; uint16_t nb_rx; uint16_t nb_tx; @@ -272,11 +273,10 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) mb = pkts_burst[i]; l2_len = sizeof(struct ether_hdr); pkt_ol_flags = mb->ol_flags; + packet_type = (enum rte_eth_packet_type)mb->packet_type; ol_flags = (pkt_ol_flags & (~PKT_TX_L4_MASK)); - ipv4_tunnel = (pkt_ol_flags & PKT_RX_TUNNEL_IPV4_HDR) ? - 1 : 0; - ipv6_tunnel = (pkt_ol_flags & PKT_RX_TUNNEL_IPV6_HDR) ? - 1 : 0; + ipv4_tunnel = RTE_ETH_IS_TUNNEL_IPV4_HDR(packet_type); + ipv6_tunnel = RTE_ETH_IS_TUNNEL_IPV6_HDR(packet_type); eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (eth_type == ETHER_TYPE_VLAN) { @@ -309,7 +309,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) * + ipv4 or ipv6 * + udp or tcp or sctp or others */ - if (pkt_ol_flags & (PKT_RX_IPV4_HDR | PKT_RX_TUNNEL_IPV4_HDR)) { + if (pkt_ol_flags & PKT_RX_IPV4_HDR) { /* Do not support ipv4 option field */ l3_len = sizeof(struct ipv4_hdr) ; @@ -455,7 +455,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) } } /* End of L4 Handling*/ - } else if (pkt_ol_flags & (PKT_RX_IPV6_HDR | PKT_RX_TUNNEL_IPV6_HDR)) { + } else if (pkt_ol_flags & PKT_RX_IPV6_HDR) { ipv6_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(mb, unsigned char *) + l2_len); l3_len = sizeof(struct ipv6_hdr) ; diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c index 9ad1df6..3bf1b93 100644 --- a/app/test-pmd/rxonly.c +++ b/app/test-pmd/rxonly.c @@ -71,7 +71,7 @@ #include "testpmd.h" -#define MAX_PKT_RX_FLAGS 13 +#define MAX_PKT_RX_FLAGS 11 static const char *pkt_rx_flag_names[MAX_PKT_RX_FLAGS] = { "VLAN_PKT", "RSS_HASH", @@ -86,9 +86,6 @@ static const char *pkt_rx_flag_names[MAX_PKT_RX_FLAGS] = { "IEEE1588_PTP", "IEEE1588_TMST", - - "TUNNEL_IPV4_HDR", - "TUNNEL_IPV6_HDR", }; static inline void @@ -108,11 +105,12 @@ pkt_burst_receive(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mbuf *mb; struct ether_hdr *eth_hdr; + enum rte_eth_packet_type packet_type; uint16_t eth_type; uint64_t ol_flags; uint16_t nb_rx; - uint16_t i, packet_type; - uint64_t is_encapsulation; + uint16_t i; + uint32_t is_encapsulation; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; @@ -154,10 +152,10 @@ pkt_burst_receive(struct fwd_stream *fs) eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type); ol_flags = mb->ol_flags; - packet_type = mb->packet_type; + packet_type = (enum rte_eth_packet_type)mb->packet_type; - is_encapsulation = ol_flags & (PKT_RX_TUNNEL_IPV4_HDR | - PKT_RX_TUNNEL_IPV6_HDR); + is_encapsulation = RTE_ETH_IS_TUNNEL_IPV4_HDR(packet_type) | + RTE_ETH_IS_TUNNEL_IPV6_HDR(packet_type); print_ether_addr(" src=", ð_hdr->s_addr); print_ether_addr(" - dst=", ð_hdr->d_addr); @@ -186,7 +184,7 @@ pkt_burst_receive(struct fwd_stream *fs) l2_len = sizeof(struct ether_hdr); /* Do not support ipv4 option field */ - if (ol_flags & PKT_RX_TUNNEL_IPV4_HDR) { + if (RTE_ETH_IS_TUNNEL_IPV4_HDR(packet_type)) { l3_len = sizeof(struct ipv4_hdr); ipv4_hdr = (struct ipv4_hdr *) (rte_pktmbuf_mtod(mb, unsigned char *) + l2_len); @@ -207,7 +205,7 @@ pkt_burst_receive(struct fwd_stream *fs) printf(" - VXLAN packet: packet type =%d, " "Destination UDP port =%d, VNI = %d", - packet_type, RTE_BE_TO_CPU_16(udp_hdr->dst_port), + (uint16_t)packet_type, RTE_BE_TO_CPU_16(udp_hdr->dst_port), rte_be_to_cpu_32(vxlan_hdr->vx_vni) >> 8); } } -- 1.7.7.6