net/thunderx: fix Tx checksum handling
authorKamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Fri, 30 Sep 2016 12:05:41 +0000 (14:05 +0200)
committerBruce Richardson <bruce.richardson@intel.com>
Thu, 13 Oct 2016 13:30:59 +0000 (15:30 +0200)
The symbols PKT_TX_TCP_CKSUM and PKT_TX_UDP_CKSUM are not bits on a
bitmask. Set l3_offset always for TX offloads, not just for PKT_TX_IP_CKSUM
being true.

Fixes: 1c421f18e095 ("net/thunderx: add single and multi-segment Tx")

Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
Signed-off-by: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Signed-off-by: Zyta Szpak <zyta.szpak@semihalf.com>
Signed-off-by: Slawomir Rosek <slawomir.rosek@semihalf.com>
Signed-off-by: Radoslaw Biernacki <rad@semihalf.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
drivers/net/thunderx/nicvf_rxtx.c

index eb51a72..e15c730 100644 (file)
@@ -70,19 +70,20 @@ fill_sq_desc_header(union sq_entry_t *entry, struct rte_mbuf *pkt)
        ol_flags = pkt->ol_flags & NICVF_TX_OFFLOAD_MASK;
        if (unlikely(ol_flags)) {
                /* L4 cksum */
        ol_flags = pkt->ol_flags & NICVF_TX_OFFLOAD_MASK;
        if (unlikely(ol_flags)) {
                /* L4 cksum */
-               if (ol_flags & PKT_TX_TCP_CKSUM)
+               uint64_t l4_flags = ol_flags & PKT_TX_L4_MASK;
+               if (l4_flags == PKT_TX_TCP_CKSUM)
                        sqe.hdr.csum_l4 = SEND_L4_CSUM_TCP;
                        sqe.hdr.csum_l4 = SEND_L4_CSUM_TCP;
-               else if (ol_flags & PKT_TX_UDP_CKSUM)
+               else if (l4_flags == PKT_TX_UDP_CKSUM)
                        sqe.hdr.csum_l4 = SEND_L4_CSUM_UDP;
                else
                        sqe.hdr.csum_l4 = SEND_L4_CSUM_DISABLE;
                        sqe.hdr.csum_l4 = SEND_L4_CSUM_UDP;
                else
                        sqe.hdr.csum_l4 = SEND_L4_CSUM_DISABLE;
+
+               sqe.hdr.l3_offset = pkt->l2_len;
                sqe.hdr.l4_offset = pkt->l3_len + pkt->l2_len;
 
                /* L3 cksum */
                sqe.hdr.l4_offset = pkt->l3_len + pkt->l2_len;
 
                /* L3 cksum */
-               if (ol_flags & PKT_TX_IP_CKSUM) {
+               if (ol_flags & PKT_TX_IP_CKSUM)
                        sqe.hdr.csum_l3 = 1;
                        sqe.hdr.csum_l3 = 1;
-                       sqe.hdr.l3_offset = pkt->l2_len;
-               }
        }
 
        entry->buff[0] = sqe.buff[0];
        }
 
        entry->buff[0] = sqe.buff[0];