net/ionic: allow separate L3 and L4 checksum offload
authorAndrew Boyer <aboyer@pensando.io>
Mon, 18 Jan 2021 20:35:05 +0000 (12:35 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:10 +0000 (18:16 +0100)
DTS, at least, expects to be able to specify L4 checksum offload
without L3 csum offload. Split up the flag checks.

Fixes: a27d901331da ("net/ionic: add Rx and Tx handling")
Cc: stable@dpdk.org
Signed-off-by: Andrew Boyer <aboyer@pensando.io>
drivers/net/ionic/ionic_rxtx.c

index 61ad396..73e7284 100644 (file)
@@ -460,18 +460,22 @@ ionic_tx(struct ionic_queue *q, struct rte_mbuf *txm,
        uint8_t flags = 0;
 
        if ((ol_flags & PKT_TX_IP_CKSUM) &&
-                       (offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)) {
+           (offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)) {
                opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW;
                flags |= IONIC_TXQ_DESC_FLAG_CSUM_L3;
-               if (((ol_flags & PKT_TX_TCP_CKSUM) &&
-                               (offloads & DEV_TX_OFFLOAD_TCP_CKSUM)) ||
-                               ((ol_flags & PKT_TX_UDP_CKSUM) &&
-                               (offloads & DEV_TX_OFFLOAD_UDP_CKSUM)))
-                       flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4;
-       } else {
-               stats->no_csum++;
        }
 
+       if (((ol_flags & PKT_TX_TCP_CKSUM) &&
+            (offloads & DEV_TX_OFFLOAD_TCP_CKSUM)) ||
+           ((ol_flags & PKT_TX_UDP_CKSUM) &&
+            (offloads & DEV_TX_OFFLOAD_UDP_CKSUM))) {
+               opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW;
+               flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4;
+       }
+
+       if (opcode == IONIC_TXQ_DESC_OPCODE_CSUM_NONE)
+               stats->no_csum++;
+
        has_vlan = (ol_flags & PKT_TX_VLAN_PKT);
        encap = ((ol_flags & PKT_TX_OUTER_IP_CKSUM) ||
                        (ol_flags & PKT_TX_OUTER_UDP_CKSUM)) &&