DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yong Wang <yongwang@vmware.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 4/6] vmxnet3: add tx l4 cksum offload
Date: Tue, 12 Jan 2016 18:08:35 -0800	[thread overview]
Message-ID: <1452650917-7960-5-git-send-email-yongwang@vmware.com> (raw)
In-Reply-To: <1452650917-7960-1-git-send-email-yongwang@vmware.com>

Support TCP/UDP checksum offload.

Signed-off-by: Yong Wang <yongwang@vmware.com>
---
 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

  parent reply	other threads:[~2016-01-13  2:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13  2:08 [dpdk-dev] [PATCH v4 0/6] vmxnet3 TSO, tx cksum offload and cleanups Yong Wang
2016-01-13  2:08 ` [dpdk-dev] [PATCH v4 1/6] vmxnet3: fix typos and remove unused struct Yong Wang
2016-01-13  2:08 ` [dpdk-dev] [PATCH v4 2/6] vmxnet3: restore tx data ring support Yong Wang
2016-01-13  2:08 ` [dpdk-dev] [PATCH v4 3/6] vmxnet3: cleanup txNumDeferred usage Yong Wang
2016-01-13  2:08 ` Yong Wang [this message]
2016-01-13  2:08 ` [dpdk-dev] [PATCH v4 5/6] vmxnet3: add TSO support Yong Wang
2016-03-15 20:39   ` Thomas Monjalon
2016-01-13  2:08 ` [dpdk-dev] [PATCH v4 6/6] vmxnet3: announce device offload capability Yong Wang
2016-01-13  4:56 ` [dpdk-dev] [PATCH v4 0/6] vmxnet3 TSO, tx cksum offload and cleanups Stephen Hemminger
2016-02-10 12:30   ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452650917-7960-5-git-send-email-yongwang@vmware.com \
    --to=yongwang@vmware.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).