[dpdk-dev,4/4] testpmd:application changes
Commit Message
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(-)
@@ -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) ;
@@ -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);
}
}