From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-outbound-2.vmware.com (smtp-outbound-2.vmware.com [208.91.2.13]) by dpdk.org (Postfix) with ESMTP id D66B98E7D for ; Wed, 13 Jan 2016 03:19:33 +0100 (CET) Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id E517628BAC; Tue, 12 Jan 2016 18:19:30 -0800 (PST) Received: from prmh-edge-ivybridge-01.eng.vmware.com (unknown [10.24.235.72]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 1CDC4B040A; Tue, 12 Jan 2016 18:19:32 -0800 (PST) From: Yong Wang To: dev@dpdk.org Date: Tue, 12 Jan 2016 18:08:35 -0800 Message-Id: <1452650917-7960-5-git-send-email-yongwang@vmware.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452650917-7960-1-git-send-email-yongwang@vmware.com> References: <1452650917-7960-1-git-send-email-yongwang@vmware.com> Subject: [dpdk-dev] [PATCH v4 4/6] vmxnet3: add tx l4 cksum offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2016 02:19:34 -0000 Support TCP/UDP checksum offload. Signed-off-by: Yong Wang --- doc/guides/rel_notes/release_2_3.rst | 3 +++ drivers/net/vmxnet3/vmxnet3_rxtx.c | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst index a23c8ac..58205fe 100644 --- a/doc/guides/rel_notes/release_2_3.rst +++ b/doc/guides/rel_notes/release_2_3.rst @@ -20,6 +20,9 @@ Drivers Tx data ring has been shown to improve small pkt forwarding performance on vSphere environment. +* **vmxnet3: add tx l4 cksum offload.** + + Support TCP/UDP checksum offload. Libraries ~~~~~~~~~ diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index f3af2f2..2c1bc3c 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -415,7 +415,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(); @@ -729,8 +749,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; } -- 1.9.1