DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jijiang Liu <jijiang.liu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 4/4] testpmd:application changes
Date: Tue, 18 Nov 2014 15:37:31 +0800	[thread overview]
Message-ID: <1416296251-7534-5-git-send-email-jijiang.liu@intel.com> (raw)
In-Reply-To: <1416296251-7534-1-git-send-email-jijiang.liu@intel.com>

Change the codes in testpmd due to introducing abstract packet type.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 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=", &eth_hdr->s_addr);
 		print_ether_addr(" - dst=", &eth_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

  parent reply	other threads:[~2014-11-18  7:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18  7:37 [dpdk-dev] [PATCH 0/4] Translate packet types for i40e Jijiang Liu
2014-11-18  7:37 ` [dpdk-dev] [PATCH 1/4] rte_mbuf:add packet types Jijiang Liu
2014-11-19 10:38   ` Olivier MATZ
2014-11-21 12:26     ` Liu, Jijiang
2014-11-21 13:25       ` Olivier MATZ
2014-11-18  7:37 ` [dpdk-dev] [PATCH 2/4] rte_mbuf:remove tunneling IP offload flags Jijiang Liu
2014-11-18  7:37 ` [dpdk-dev] [PATCH 3/4] i40e:translate i40e packet types Jijiang Liu
2014-11-18  7:37 ` Jijiang Liu [this message]
2014-11-18 11:33 ` [dpdk-dev] [PATCH 0/4] Translate packet types for i40e Ananyev, Konstantin
2014-11-18 13:08   ` Bruce Richardson
2014-11-18 15:29     ` Ananyev, Konstantin
2014-11-19  3:52       ` Liu, Jijiang
2014-11-19  9:47         ` Ananyev, Konstantin
2014-11-18 14:12   ` Zhang, Helin
2014-11-18 15:26     ` Ananyev, Konstantin
2014-11-18 15:55       ` Ananyev, Konstantin
2014-11-19  0:29       ` Zhang, Helin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416296251-7534-5-git-send-email-jijiang.liu@intel.com \
    --to=jijiang.liu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).