app/testpmd: add csum parse-tunnel command
[dpdk.git] / app / test-pmd / csumonly.c
index 41711fd..858eb47 100644 (file)
@@ -183,16 +183,15 @@ process_inner_cksums(void *l3_hdr, uint16_t ethertype, uint16_t l3_len,
                ipv4_hdr = l3_hdr;
                ipv4_hdr->hdr_checksum = 0;
 
+               ol_flags |= PKT_TX_IPV4;
                if (tso_segsz != 0 && l4_proto == IPPROTO_TCP) {
                        ol_flags |= PKT_TX_IP_CKSUM;
                } else {
                        if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM)
                                ol_flags |= PKT_TX_IP_CKSUM;
-                       else {
+                       else
                                ipv4_hdr->hdr_checksum =
                                        rte_ipv4_cksum(ipv4_hdr);
-                               ol_flags |= PKT_TX_IPV4;
-                       }
                }
        } else if (ethertype == _htons(ETHER_TYPE_IPv6))
                ol_flags |= PKT_TX_IPV6;
@@ -256,11 +255,9 @@ process_outer_cksums(void *outer_l3_hdr, uint16_t outer_ethertype,
        struct udp_hdr *udp_hdr;
        uint64_t ol_flags = 0;
 
-       if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
-               ol_flags |= PKT_TX_UDP_TUNNEL_PKT;
-
        if (outer_ethertype == _htons(ETHER_TYPE_IPv4)) {
                ipv4_hdr->hdr_checksum = 0;
+               ol_flags |= PKT_TX_OUTER_IPV4;
 
                if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
                        ol_flags |= PKT_TX_OUTER_IP_CKSUM;
@@ -376,7 +373,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
                l3_hdr = (char *)eth_hdr + l2_len;
 
                /* check if it's a supported tunnel (only vxlan for now) */
-               if (l4_proto == IPPROTO_UDP) {
+               if ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) &&
+                       l4_proto == IPPROTO_UDP) {
                        udp_hdr = (struct udp_hdr *)((char *)l3_hdr + l3_len);
 
                        /* check udp destination port, 4789 is the default
@@ -473,7 +471,6 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
                                { PKT_TX_UDP_CKSUM, PKT_TX_L4_MASK },
                                { PKT_TX_TCP_CKSUM, PKT_TX_L4_MASK },
                                { PKT_TX_SCTP_CKSUM, PKT_TX_L4_MASK },
-                               { PKT_TX_UDP_TUNNEL_PKT, PKT_TX_UDP_TUNNEL_PKT },
                                { PKT_TX_IPV4, PKT_TX_IPV4 },
                                { PKT_TX_IPV6, PKT_TX_IPV6 },
                                { PKT_TX_OUTER_IP_CKSUM, PKT_TX_OUTER_IP_CKSUM },