app/testpmd: rename vxlan in outer-ip in csum commands
[dpdk.git] / app / test-pmd / csumonly.c
index 4b438d1..3921643 100644 (file)
@@ -255,20 +255,20 @@ 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)
+               if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)
                        ol_flags |= PKT_TX_OUTER_IP_CKSUM;
                else
                        ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr);
-       } else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
+       } else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)
                ol_flags |= PKT_TX_OUTER_IPV6;
 
+       /* outer UDP checksum is always done in software as we have no
+        * hardware supporting it today, and no API for it. */
+
        udp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr + outer_l3_len);
        /* do not recalculate udp cksum if it was 0 */
        if (udp_hdr->dgram_cksum != 0) {
@@ -303,8 +303,8 @@ process_outer_cksums(void *outer_l3_hdr, uint16_t outer_ethertype,
  * The testpmd command line for this forward engine sets the flags
  * TESTPMD_TX_OFFLOAD_* in ports[tx_port].tx_ol_flags. They control
  * wether a checksum must be calculated in software or in hardware. The
- * IP, UDP, TCP and SCTP flags always concern the inner layer.  The
- * VxLAN flag concerns the outer IP (if packet is recognized as a vxlan packet).
+ * IP, UDP, TCP and SCTP flags always concern the inner layer. The
+ * OUTER_IP is only useful for tunnel packets.
  */
 static void
 pkt_burst_checksum_forward(struct fwd_stream *fs)
@@ -376,7 +376,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
@@ -434,18 +435,18 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
                /* step 4: fill the mbuf meta data (flags and header lengths) */
 
                if (tunnel == 1) {
-                       if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM) {
+                       if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) {
                                m->outer_l2_len = outer_l2_len;
                                m->outer_l3_len = outer_l3_len;
                                m->l2_len = l4_tun_len + l2_len;
                                m->l3_len = l3_len;
                        }
                        else {
-                               /* if we don't do vxlan cksum in hw,
-                                  outer checksum will be wrong because
-                                  we changed the ip, but it shows that
-                                  we can process the inner header cksum
-                                  in the nic */
+                               /* if there is a outer UDP cksum
+                                  processed in sw and the inner in hw,
+                                  the outer checksum will be wrong as
+                                  the payload will be modified by the
+                                  hardware */
                                m->l2_len = outer_l2_len + outer_l3_len +
                                        sizeof(struct udp_hdr) +
                                        sizeof(struct vxlan_hdr) + l2_len;
@@ -473,7 +474,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 },
@@ -505,7 +505,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
                                        "m->l4_len=%d\n",
                                        m->l2_len, m->l3_len, m->l4_len);
                        if ((tunnel == 1) &&
-                               (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM))
+                               (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM))
                                printf("tx: m->outer_l2_len=%d m->outer_l3_len=%d\n",
                                        m->outer_l2_len, m->outer_l3_len);
                        if (tso_segsz != 0)