vmxnet3: add Tx L4 checksum offload
authorYong Wang <yongwang@vmware.com>
Wed, 13 Jan 2016 02:08:35 +0000 (18:08 -0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 16 Mar 2016 18:05:46 +0000 (19:05 +0100)
Support TCP/UDP checksum offload.

Signed-off-by: Yong Wang <yongwang@vmware.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
doc/guides/rel_notes/release_16_04.rst
drivers/net/vmxnet3/vmxnet3_rxtx.c

index 522c463..7461457 100644 (file)
@@ -52,6 +52,10 @@ This section should contain new features added in this release. Sample format:
   Tx data ring has been shown to improve small pkt forwarding performance
   on vSphere environment.
 
+* **Added vmxnet3 Tx L4 checksum offload.**
+
+  Support TCP/UDP checksum offload.
+
 * **Virtio 1.0.**
 
   Enabled virtio 1.0 support for virtio pmd driver.
index f88ced7..2a74a22 100644 (file)
@@ -409,7 +409,27 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                        gdesc->txd.tci = txm->vlan_tci;
                }
 
-               /* TODO: Add transmit checksum offload here */
+               if (txm->ol_flags & PKT_TX_L4_MASK) {
+                       gdesc->txd.om = VMXNET3_OM_CSUM;
+                       gdesc->txd.hlen = txm->l2_len + txm->l3_len;
+
+                       switch (txm->ol_flags & PKT_TX_L4_MASK) {
+                       case PKT_TX_TCP_CKSUM:
+                               gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct tcp_hdr, cksum);
+                               break;
+                       case PKT_TX_UDP_CKSUM:
+                               gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum);
+                               break;
+                       default:
+                               PMD_TX_LOG(WARNING, "requested cksum offload not supported %#llx",
+                                          txm->ol_flags & PKT_TX_L4_MASK);
+                               abort();
+                       }
+               } else {
+                       gdesc->txd.hlen = 0;
+                       gdesc->txd.om = VMXNET3_OM_NONE;
+                       gdesc->txd.msscof = 0;
+               }
 
                /* flip the GEN bit on the SOP */
                rte_compiler_barrier();
@@ -724,8 +744,8 @@ vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev,
        PMD_INIT_FUNC_TRACE();
 
        if ((tx_conf->txq_flags & ETH_TXQ_FLAGS_NOXSUMS) !=
-           ETH_TXQ_FLAGS_NOXSUMS) {
-               PMD_INIT_LOG(ERR, "TX no support for checksum offload yet");
+           ETH_TXQ_FLAGS_NOXSUMSCTP) {
+               PMD_INIT_LOG(ERR, "SCTP checksum offload not supported");
                return -EINVAL;
        }